Overview
Comment: | Add CancelTriggers and DeferTriggers instructions. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
68320feb4f951c0efd0011f7b2d14225 |
User & Date: | user on 2023-08-10 02:50:24 |
Other Links: | manifest | tags |
Context
2023-08-14
| ||
03:58 | Add incomplete tutorial document file. (Hopefully can be improved in future) check-in: cd748e0fe5 user: user tags: trunk | |
2023-08-10
| ||
02:50 | Add CancelTriggers and DeferTriggers instructions. check-in: 68320feb4f user: user tags: trunk | |
2023-08-06
| ||
19:44 | Add some additional checks to JumpTo for Compatible classes only. This fixes three levels, one each in HEARTS1, HEARTS4, and SUPERHRO. check-in: 22d38aadb5 user: user tags: trunk | |
Changes
Modified class.doc from [8def31bf08] to [ccc3c5d04b].
︙ | |||
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | + + + + + + + + | bxor ( in1 in2 -- out ) Bitwise XOR. c? ( any -- bool ) True if the value is a class, or false if it is any other type. Error if it is a sound. CancelTriggers ( -- bits ) ** Cancel all triggers for this object, including Moved, Departed, and Arrived. The return value has bit0 set for Moved, bit1 set for Departed, and bit2 set for Arrived, according to which triggers have been pending. ,CancelTriggers ( obj -- bits ) ** Like CancelTriggers but for a specified object instead of this one. (case <cases...>) ( any -- ??? ) A case block. Read one value from stack; find which case it matches, and then push or jump to the result for that case. See the section below about case blocks for details. chain ( any -- bool ) If given an object of the same class as the current object, selects that |
︙ | |||
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 | + + + + + + + + + + + | Data ( string index -- ... ) Read string data. If the index is a number, it is the zero-based number of which data block in the string to read; all of the data in that block is pushed to the stack. If there isn't enough data blocks, then nothing will be pushed to the stack. If the index is the KEY message, then all of the key codes of the quiz buttons in the string are push to stack. DeferTriggers ( -- ) ** Any triggers that would be executed during the current loop of triggers is deferred until the next such loop; the Arrived, Departed, and Moved variables are updated with the triggers that would have been done so that they will be set to be executed during the next trigger loop. If the Compatible flag is set then the meaning is a bit different and the Arrived, Departed, and Moved variables are unchanged. ,DeferTriggers ( obj -- ) ** Like DeferTriggers but for a specified object instead of this one. DelInventory ( class image -- ) ** Delete an item from the inventory; see SetInventory for more details. Delta ( in1 in2 -- out ) Subtracts the smaller input from the larger (unsigned). Destroy ( -- value ) ** |
︙ |
Modified exec.c from [e4a58f292e] to [dbcc43fd0c].
︙ | |||
2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 | 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 | + + + + + + + + + + + + + + + + + + + + + + | n=playfield[x+y*64-65]; while(n!=VOIDLINK) { m=objects[n]->up; v_trigger(from,n,v); n=m; } } static Uint32 cancel_triggers(Uint32 obj) { Object*o=objects[obj]; Uint8 r=0; if(o->oflags&(OF_MOVED|OF_MOVED2)) r|=0x01,o->oflags&=~(OF_MOVED|OF_MOVED2); if(o->departed2 || o->departed) r|=0x02,o->departed2=o->departed=0; if(o->arrived2 || o->arrived) r|=0x04,o->arrived2=o->arrived=0; return r; } static void defer_triggers(Uint32 obj) { Object*o=objects[obj]; if(classes[o->class]->cflags&CF_COMPATIBLE) { o->arrived2=o->departed2=1; o->oflags|=OF_MOVED2; } else { o->arrived|=o->arrived2; o->departed|=o->departed2; o->arrived2=o->departed2=0; if(o->oflags&OF_MOVED2) o->oflags=(o->oflags|OF_MOVED)&~OF_MOVED2; } } static void v_sweep(Uint32 from,Value arg3) { Value arg2=Pop(); Value arg1=Pop(); Value v=Pop(); Uint8 hv=v_bool(Pop()); Uint16 msg=v.u; |
︙ | |||
3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 | 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 | + + | case OP_BROADCASTSUMEX: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,t5,1)); break; case OP_BUSY: StackReq(0,1); if(o->oflags&OF_BUSY) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_BUSY_C: StackReq(1,1); GetFlagOf(OF_BUSY); break; case OP_BUSY_E: NoIgnore(); StackReq(1,0); if(v_bool(Pop())) o->oflags|=OF_BUSY; else o->oflags&=~OF_BUSY; break; case OP_BUSY_EC: NoIgnore(); StackReq(2,0); SetFlagOf(OF_BUSY); break; case OP_BXOR: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u^t2.u)); break; case OP_CALLSUB: execute_program(code,code[ptr++],obj); break; case OP_CANCELTRIGGERS: NoIgnore(); StackReq(0,1); i=cancel_triggers(obj); Push(NVALUE(i)); break; case OP_CANCELTRIGGERS_C: NoIgnore(); StackReq(1,1); i=v_object(Pop()); if(i!=VOIDLINK) i=cancel_triggers(i); Push(NVALUE(i)); break; case OP_CASE: StackReq(1,1); t1=Pop(); ptr=v_case(code,ptr,t1); break; case OP_CHAIN: StackReq(1,1); t1=Pop(); i=v_chain(t1,o->class); if(i==VOIDLINK) { Push(NVALUE(1)); } else { o=objects[obj=i]; Push(NVALUE(0)); } break; case OP_CHEBYSHEV: StackReq(1,1); t1=Pop(); i=chebyshev(obj,v_object(t1)); Push(NVALUE(i)); break; case OP_CHEBYSHEV_C: StackReq(2,1); t2=Pop(); t1=Pop(); i=chebyshev(v_object(t1),v_object(t2)); Push(NVALUE(i)); break; case OP_CLASS: StackReq(0,1); Push(CVALUE(o->class)); break; case OP_CLASS_C: StackReq(1,1); Push(GetVariableOf(class,CVALUE)); break; case OP_CLEAR: t1.t=TY_NUMBER; while(vstackptr>0) { t1=Pop(); if(t1.t==TY_MARK) break; } if(t1.t!=TY_MARK) Throw("No mark"); break; |
︙ | |||
3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 | 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 | + + | case OP_CREATE: NoIgnore(); StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_create(obj,t1,t2,t3,t4,t5)); break; case OP_CREATE_D: NoIgnore(); StackReq(5,0); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_create(obj,t1,t2,t3,t4,t5); break; case OP_CRUSH: StackReq(0,1); if(o->oflags&OF_CRUSH) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_CRUSH_C: StackReq(1,1); GetFlagOf(OF_CRUSH); break; case OP_CRUSH_E: NoIgnore(); StackReq(1,0); if(v_bool(Pop())) o->oflags|=OF_CRUSH; else o->oflags&=~OF_CRUSH; break; case OP_CRUSH_EC: NoIgnore(); StackReq(2,0); SetFlagOf(OF_CRUSH); break; case OP_DATA: StackReq(2,1); t2=Pop(); t1=Pop(); v_data(t1,t2); break; case OP_DEFERTRIGGERS: NoIgnore(); defer_triggers(obj); break; case OP_DEFERTRIGGERS_C: NoIgnore(); StackReq(1,0); i=v_object(Pop()); if(i!=VOIDLINK) defer_triggers(i); break; case OP_DELINVENTORY: StackReq(2,0); t2=Pop(); t1=Pop(); v_delete_inventory(t1,t2); break; case OP_DELTA: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u>t2.u?t1.u-t2.u:t2.u-t1.u)); break; case OP_DENSITY: StackReq(0,1); Push(NVALUE(o->density)); break; case OP_DENSITY_C: StackReq(1,1); Push(GetVariableOrAttributeOf(density,NVALUE)); break; case OP_DENSITY_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); change_density(obj,t1.s); break; case OP_DENSITY_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); change_density(obj,t1.s&0xFFFF); break; case OP_DENSITY_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); change_density(v_object(Pop()),t1.s); break; |
︙ |
Modified instruc from [2fda304d27] to [f96da63b9c].
︙ | |||
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | + + | BroadcastAndEx *BroadcastClass ; for (Broadcast [class]) .BroadcastEx ; broadcast with three arguments BroadcastList ; Broadcast, pushing results to stack BroadcastListEx BroadcastSum ; Broadcast, but result is sum of return values BroadcastSumEx ,CancelTriggers chain ,Chebyshev ,Coloc ,Connect .Create Data ,DeferTriggers DelInventory Delta .,Destroy ,FakeMove ,FindConnection FlushClass ,FlushObj |
︙ |
Modified instruc.h from [ee3354bb1f] to [37c1270125].
︙ | |||
344 345 346 347 348 349 350 | 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 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 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 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - + + + - - - + + + + - + - + - + - - + + - + + - - + + - + - + - - + + - - + + - - + + - + - + - + - + - + - + - - - + + + - - + + - - - + + + - + - - - + + + - - - - - - - - + + + + + + + + - - + + - - + + - - - + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + - + - + - + - - - + + + - + - + - + | #define OP_BROADCASTCLASS 32930 #define OP_BROADCASTEX 32931 #define OP_BROADCASTEX_D 41123 #define OP_BROADCASTLIST 32932 #define OP_BROADCASTLISTEX 32933 #define OP_BROADCASTSUM 32934 #define OP_BROADCASTSUMEX 32935 #define OP_CANCELTRIGGERS 32936 #define OP_CANCELTRIGGERS_C 34984 |
︙ | |||
834 835 836 837 838 839 840 | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | - - - - + + + + - + - + - + - + - + - + - + | {"bit8",8423400}, {"bit9",8423401}, {"bnot",8421421}, {"bor",8421419}, {"bxor",8421420}, {"c?",8421436}, {"case",8683544}, |