Overview
Comment: | Implement FindConnection instruction. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c49ea7253dfe9152ab53a3db7d46f9ba |
User & Date: | user on 2022-02-22 02:35:51 |
Other Links: | manifest | tags |
Context
2022-03-03
| ||
01:39 | If you click on an object to view the description but doesn't have one, try the one below, until finding one that has a description (if any). check-in: ce300fde56 user: user tags: trunk | |
2022-02-22
| ||
02:35 | Implement FindConnection instruction. check-in: c49ea7253d user: user tags: trunk | |
2022-02-16
| ||
07:09 | Implement the Morton and ,Morton instructions. (On some computers it may be possible to optimize this better; this optimization is not currently implemented.) check-in: 3532fea858 user: user tags: trunk | |
Changes
Modified class.doc from [e1fcb10826] to [775d5d0d22].
︙ | |||
1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 | 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | + + + + + + + + + + + + + | a mark, then it is added like using Connect (if the object's flags allow it) and then the return value will be 2. ,FakeMove ( obj dir -- result ) ** Works like FakeMove but you can specify a different object instead of the current one. FindConnection ( link -- result ) ** Find all connected objects to this one, execute the link for all objects in the connected group (including this one), and then pushes zero. If any of the CONNECT messages return nonzero, then it will stop and then the result is that value instead, and won't execute the link at all. If this object doesn't have the Connection flag, or its other flags are not appropriate, then it just does nothing and the result is zero. ,FindConnection ( obj link -- result ) ** Similar to FindConnection but uses a specified object instead of necessarily using the current object. If the object is zero then it will do nothing and the result is zero. Finished ( -- number ) Returns the value of an internal flag which tells it that the beginning and ending phases should be skipped. This is a 8-bit number; zero means don't skip them, and any other number means it does. When the game engine sets this automatically, it normally sets it to 1, but "-1 FlushClass" during the input phase sets it to 255. When you set this value by yourself, you can use any 8-bit number. |
︙ | |||
2235 2236 2237 2238 2239 2240 2241 | 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 | - + + + | Should use the ,Connect instruction to add additional objects to the connection group; it will then send this message to those objects too. If the return value is true, then the movement fails, and none of the objects in the group will move. The Inertia of this object is set automatically before calling this message; it can change the Inertia before returning if it wants a different value for Inertia. Arg1 is the number of objects in the group previously to this one, Arg2 is the |
︙ |
Modified exec.c from [3521db691c] to [c5e36d78e2].
︙ | |||
2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 | 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | x&=0xFFFF; x|=x<<8; x&=0x00FF00FF; x|=x<<4; x&=0x0F0F0F0F; x|=x<<2; x&=0x33333333; x|=x<<1; x&=0x55555555; return x; } static Value v_find_connection(Uint32 xobj,Uint32 lnk,Uint32 obj,Uint16*code) { Object*o=objects[obj]; Value v=NVALUE(0); Uint32 n; int i; int first=nconn; int last; if(nconn!=pconn) Throw("Improper nested connected move"); if((o->oflags^OF_CONNECTION)&(OF_CONNECTION|OF_MOVING|OF_DESTROYED|OF_BIZARRO)) return NVALUE(0); add_connection(obj); for(i=first;i<nconn;i++) { o=objects[n=conn[i].obj]; v=send_message(obj,n,MSG_CONNECT,NVALUE(i-first),NVALUE(objects[obj]->dir),UVALUE(0,TY_MARK)); if(v_bool(v)) goto done; if(o->shovable&0xFF00) add_connection_shov(o); } last=pconn=nconn; for(i=first;i<last;i++) { StackReq(0,1); Push(OVALUE(conn[i].obj)); if(lnk!=0xFFFF) execute_program(classes[lnk>>16]->codes,lnk&0xFFFF,xobj); } done: for(i=first;i<nconn;i++) { o=objects[conn[i].obj]; o->oflags&=~OF_MOVING; if(conn[i].visual) o->oflags|=OF_VISUALONLY; else o->oflags&=~OF_VISUALONLY; } pconn=nconn=first; StackReq(0,1); return v; } // Here is where the execution of a Free Hero Mesh bytecode subroutine is executed. #define NoIgnore() do{ changed=1; }while(0) #define GetVariableOf(a,b) (i=v_object(Pop()),i==VOIDLINK?NVALUE(0):b(objects[i]->a)) #define GetVariableOrAttributeOf(a,b) (t2=Pop(),t2.t==TY_CLASS?NVALUE(classes[t2.u]->a):(i=v_object(t2),i==VOIDLINK?NVALUE(0):b(objects[i]->a))) #define Numeric(a) do{ if((a).t!=TY_NUMBER) Throw("Type mismatch"); }while(0) #define DivideBy(a) do{ Numeric(a); if(!(a).u) Throw("Division by zero"); }while(0) |
︙ | |||
2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 | 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 | + + | case OP_DUP: StackReq(1,2); t1=Pop(); Push(t1); Push(t1); break; case OP_EQ: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?1:0)); break; case OP_EQ2: StackReq(4,1); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t3)?(v_equal(t2,t4)?1:0):0)); break; case OP_EXEC: StackReq(1,0); t1=Pop(); i=convert_link(t1,obj,code); if(i==0xFFFF) return; code=classes[i>>16]->codes; ptr=i&0xFFFF; break; case OP_EXEC_C: StackReq(1,0); t1=Pop(); i=convert_link(t1,obj,code); if(i!=0xFFFF) execute_program(classes[i>>16]->codes,i&0xFFFF,obj); break; case OP_FAKEMOVE: NoIgnore(); StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(fake_move_dir(obj,resolve_dir(obj,t1.u),0))); break; case OP_FAKEMOVE_C: NoIgnore(); StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(fake_move_dir(i,resolve_dir(i,t1.u),0))); break; case OP_FINDCONNECTION: NoIgnore(); StackReq(1,1); t1=Pop(); t2=v_find_connection(obj,convert_link(t1,obj,code),obj,code); Push(t2); break; case OP_FINDCONNECTION_C: NoIgnore(); StackReq(2,1); t1=Pop(); i=v_object(Pop()); t2=(i==VOIDLINK)?NVALUE(0):v_find_connection(obj,convert_link(t1,obj,code),i,code); Push(t2); break; case OP_FINISHED: StackReq(0,1); Push(NVALUE(all_flushed)); break; case OP_FINISHED_E: StackReq(1,0); t1=Pop(); Numeric(t1); all_flushed=t1.u; break; case OP_FLIP: v_flip(); break; case OP_FLUSHCLASS: NoIgnore(); StackReq(1,0); t1=Pop(); if(t1.t==TY_CLASS) flush_class(t1.u); else if(t1.t==TY_NUMBER && t1.s==-1) flush_all(); else if(t1.t) Throw("Type mismatch"); break; case OP_FLUSHOBJ: NoIgnore(); flush_object(obj); break; case OP_FLUSHOBJ_C: NoIgnore(); StackReq(1,0); i=v_object(Pop()); if(i!=VOIDLINK) flush_object(i); break; case OP_FOR: NoIgnore(); StackReq(3,1); t3=Pop(); t2=Pop(); t1=Pop(); ptr=v_for(code,ptr,t1,t2,t3); break; |
︙ |
Modified instruc from [e91542e6fc] to [becda5ce14].
︙ | |||
237 238 239 240 241 242 243 244 245 246 247 248 249 250 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | + | ,Connect .Create Data DelInventory Delta .,Destroy ,FakeMove ,FindConnection FlushClass ,FlushObj GetInventory HeightAt HitMe IgnoreKey .,IntMove ; move without initializing Inertia |
︙ |
Modified instruc.h from [0651293b43] to [a4f91b92f3].
︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - + + + - - - + + + | #define OP_DELTA 32935 #define OP_DESTROY 32936 #define OP_DESTROY_C 34984 #define OP_DESTROY_D 41128 #define OP_DESTROY_CD 43176 #define OP_FAKEMOVE 32937 #define OP_FAKEMOVE_C 34985 #define OP_FINDCONNECTION 32938 #define OP_FINDCONNECTION_C 34986 |
︙ | |||
548 549 550 551 552 553 554 | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | - + | {"CodePage",8683656}, {"CollisionLayers",8487036}, {"Coloc",8487074}, {"Compatible",8487035}, {"Connect",8487075}, {"Connection",8618104}, {"Control",8421514}, |
︙ | |||
570 571 572 573 574 575 576 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | - + + - - + + - - + + - + - + - + - + - + - + - - - + + + - - + + - - - + + + - + - - - + + + - - - - - - - - + + + + + + + + - - + + - - + + - - + + - + - - - - + + + + - + - - - - - + + + + + - + - - - + + + - + - - - - + + + + - + - + - + | {"Departed",8618091}, {"Departures",8618093}, {"Destroy",10584232}, {"Destroyed",8487033}, {"Dir",8618054}, {"Distance",9142346}, {"Done",8618103}, |
︙ | |||
786 787 788 789 790 791 792 | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | - - - + + + - + - + - + - + - + - + - + | {"bit9",8423401}, {"bnot",8421418}, {"bor",8421416}, {"bxor",8421417}, {"c?",8421433}, {"case",8683542}, {"chain",8421536}, |