Overview
Comment: | Implement the Finished variable. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0a1cd0e0c13c30a0086fb751f28cbb63 |
User & Date: | user on 2021-03-03 22:42:08 |
Other Links: | manifest | tags |
Context
2021-03-04
| ||
05:42 | Add the "over" instruction (like in Forth) check-in: 7f0da6b7e4 user: user tags: trunk | |
2021-03-03
| ||
22:42 | Implement the Finished variable. check-in: 0a1cd0e0c1 user: user tags: trunk | |
22:27 | More improvements to documentation. check-in: 65e4177b15 user: user tags: trunk | |
Changes
Modified class.doc from [5e123ebdb0] to [be86508900].
︙ | ︙ | |||
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 | eq ( in1 in2 -- bool ) Test if they are equal. Sounds cannot be compared, but you can compare values of any other type. Strings compare as equal if they contain the same text. Object references are only equal if they refer to the same object; objects which no longer exist still compare correctly. Values of two different types are never equal to each other. FlushClass ( class -- ) ** Resets the Arrived, Busy, Departed, Inertia, Moved, and UserSignal flags of all objects of the specified class to zero. If the class is -1, then all objects are flushed in this way, and during the input phase, it also skips the beginning and ending phases if the class is -1. | > > > > > > > > > > > > > > | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | eq ( in1 in2 -- bool ) Test if they are equal. Sounds cannot be compared, but you can compare values of any other type. Strings compare as equal if they contain the same text. Object references are only equal if they refer to the same object; objects which no longer exist still compare correctly. Values of two different types are never equal to each other. 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. =Finished ( number -- ) Write to the Finished variable. Only the low 8-bits are used. When set to nonzero then the beginning and ending phases are skipped (see above), but if IgnoreKey is used, then all phases are skipped, regardless of the value of this flag. FlushClass ( class -- ) ** Resets the Arrived, Busy, Departed, Inertia, Moved, and UserSignal flags of all objects of the specified class to zero. If the class is -1, then all objects are flushed in this way, and during the input phase, it also skips the beginning and ending phases if the class is -1. |
︙ | ︙ |
Modified exec.c from [b7234aa702] to [48b02ea770].
︙ | ︙ | |||
43 44 45 46 47 48 49 | Uint32 from; Value arg1,arg2,arg3; } MessageVars; static jmp_buf my_env; static const char*my_error; static MessageVars msgvars; | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | Uint32 from; Value arg1,arg2,arg3; } MessageVars; static jmp_buf my_env; static const char*my_error; static MessageVars msgvars; static Uint8 lastimage_processing,changed,all_flushed; static Value vstack[VSTACKSIZE]; static int vstackptr; static const char*traceprefix; static Uint8 current_key; static Value quiz_obj; static Value traced_obj; |
︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 | } if(p==VOIDLINK) break; n=p; } } static inline void flush_all(void) { | | | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | } if(p==VOIDLINK) break; n=p; } } static inline void flush_all(void) { if(current_key) all_flushed=255; flush_class(0); } static inline Value v_broadcast(Uint32 from,Value c,Value msg,Value arg1,Value arg2,Value arg3,int s) { if(msg.t!=TY_MESSAGE) Throw("Type mismatch"); if(c.t!=TY_CLASS && (c.t!=TY_NUMBER || c.u)) Throw("Type mismatch"); return NVALUE(broadcast(from,c.u,msg.u,arg1,arg2,arg3,s)); |
︙ | ︙ | |||
1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | case OP_DONE_C: StackReq(1,1); GetFlagOf(OF_DONE); break; case OP_DONE_E: StackReq(1,0); if(v_bool(Pop())) o->oflags|=OF_DONE; else o->oflags&=~OF_BUSY; break; case OP_DONE_EC: StackReq(2,0); SetFlagOf(OF_DONE); break; case OP_DROP: StackReq(1,0); Pop(); break; case OP_DROP_D: StackReq(2,0); Pop(); Pop(); break; 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_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; case OP_FROM: StackReq(0,1); Push(OVALUE(msgvars.from)); break; case OP_FUNCTION: execute_program(classes[0]->codes,functions[code[ptr++]],obj); break; case OP_GE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?0:1)); break; | > > | 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | case OP_DONE_C: StackReq(1,1); GetFlagOf(OF_DONE); break; case OP_DONE_E: StackReq(1,0); if(v_bool(Pop())) o->oflags|=OF_DONE; else o->oflags&=~OF_BUSY; break; case OP_DONE_EC: StackReq(2,0); SetFlagOf(OF_DONE); break; case OP_DROP: StackReq(1,0); Pop(); break; case OP_DROP_D: StackReq(2,0); Pop(); Pop(); break; 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_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_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; case OP_FROM: StackReq(0,1); Push(OVALUE(msgvars.from)); break; case OP_FUNCTION: execute_program(classes[0]->codes,functions[code[ptr++]],obj); break; case OP_GE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?0:1)); break; |
︙ | ︙ |
Modified instruc from [fccdfbdf14] to [e0db812da3].
︙ | ︙ | |||
182 183 184 185 186 187 188 189 190 191 192 193 194 195 | From =Arg1 =Arg2 =Arg3 MoveNumber Level Key ; Class definitions -Background ; used at top level only; not in a class -Input -Quiz -InPlace -DefaultImage | > | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | From =Arg1 =Arg2 =Arg3 MoveNumber Level Key =Finished ; Class definitions -Background ; used at top level only; not in a class -Input -Quiz -InPlace -DefaultImage |
︙ | ︙ |
Modified instruc.h from [9be41debf3] to [9fcfb8d96f].
︙ | ︙ | |||
266 267 268 269 270 271 272 | #define OP_ARG2 32884 #define OP_ARG2_E 36980 #define OP_ARG3 32885 #define OP_ARG3_E 36981 #define OP_MOVENUMBER 32886 #define OP_LEVEL 32887 #define OP_KEY 32888 | > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 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 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 | #define OP_ARG2 32884 #define OP_ARG2_E 36980 #define OP_ARG3 32885 #define OP_ARG3_E 36981 #define OP_MOVENUMBER 32886 #define OP_LEVEL 32887 #define OP_KEY 32888 #define OP_FINISHED 32889 #define OP_FINISHED_E 36985 #define OP_BACKGROUND 32890 #define OP_INPUT 32891 #define OP_QUIZ 32892 #define OP_INPLACE 32893 #define OP_DEFAULTIMAGE 32894 #define OP_HELP 32895 #define OP_EDITORHELP 32896 #define OP_SUBS 32897 #define OP_ANIMATE 32898 #define OP_ASSASSINATE 32899 #define OP_ASSASSINATE_C 34947 #define OP_BROADCAST 32900 #define OP_BROADCAST_D 41092 #define OP_BROADCASTCLASS 32901 #define OP_BROADCASTEX 32902 #define OP_BROADCASTEX_D 41094 #define OP_BROADCASTSUM 32903 #define OP_BROADCASTSUMEX 32904 #define OP_CREATE 32905 #define OP_CREATE_D 41097 #define OP_DELINVENTORY 32906 #define OP_DELTA 32907 #define OP_DESTROY 32908 #define OP_DESTROY_C 34956 #define OP_DESTROY_D 41100 #define OP_DESTROY_CD 43148 #define OP_FLUSHCLASS 32909 #define OP_FLUSHOBJ 32910 #define OP_FLUSHOBJ_C 34958 #define OP_GETINVENTORY 32911 #define OP_HEIGHTAT 32912 #define OP_IGNOREKEY 32913 #define OP_INTMOVE 32914 #define OP_INTMOVE_C 34962 #define OP_INTMOVE_D 41106 #define OP_INTMOVE_CD 43154 #define OP_JUMPTO 32915 #define OP_JUMPTO_C 34963 #define OP_JUMPTO_D 41107 #define OP_JUMPTO_CD 43155 #define OP_LOC 32916 #define OP_LOC_C 34964 #define OP_LOCATEME 32917 #define OP_LOSELEVEL 32918 #define OP_MAXINVENTORY 32919 #define OP_MOVE 32920 #define OP_MOVE_C 34968 #define OP_MOVE_D 41112 #define OP_MOVE_CD 43160 #define OP_MOVEPLUS 32921 #define OP_MOVEPLUS_C 34969 #define OP_MOVEPLUS_D 41113 #define OP_MOVEPLUS_CD 43161 #define OP_MOVETO 32922 #define OP_MOVETO_C 34970 #define OP_MOVETO_D 41114 #define OP_MOVETO_CD 43162 #define OP_NEWX 32923 #define OP_NEWXY 32924 #define OP_NEWY 32925 #define OP_OBJABOVE 32926 #define OP_OBJABOVE_C 34974 #define OP_OBJBELOW 32927 #define OP_OBJBELOW_C 34975 #define OP_OBJBOTTOMAT 32928 #define OP_OBJCLASSAT 32929 #define OP_OBJDIR 32930 #define OP_OBJDIR_C 34978 #define OP_OBJLAYERAT 32931 #define OP_OBJTOPAT 32932 #define OP_POPUP 32933 #define OP_POPUPARGS 32934 #define OP_QUEUETURN 32935 #define OP_SEND 32936 #define OP_SEND_C 34984 #define OP_SEND_D 41128 #define OP_SEND_CD 43176 #define OP_SENDEX 32937 #define OP_SENDEX_C 34985 #define OP_SENDEX_D 41129 #define OP_SENDEX_CD 43177 #define OP_SETINVENTORY 32938 #define OP_SOUND 32939 #define OP_SYNCHRONIZE 32940 #define OP_TRACE 32941 #define OP_VOLUMEAT 32942 #define OP_WINLEVEL 32943 #define OP_XDIR 32944 #define OP_XDIR_C 34992 #define OP_XYDIR 32945 #define OP_YDIR 32946 #define OP_YDIR_C 34994 #define OP_MARK 32947 #define OP_TMARK 32948 #define OP_IN 32949 #define OP_NIN 32950 #define OP_MBEGIN 32951 #define OP_ARRAY 32952 #define OP_GETARRAY 32953 #define OP_INITARRAY 32954 #define OP_SETARRAY 32955 #define OP_FUNCTION 32956 #define OP_LOCAL 32957 #define OP_LABEL 32958 #define OP_STRING 32959 #define OP_INT16 32960 #define OP_INT32 32961 #define OP_DISPATCH 32962 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486936}, {"+",8421398}, {"-",8421399}, {"-rot",8421382}, {".",10518528}, {"/",8486937}, {"ANHH",8389394}, {"ARRIVED",8389124}, {"Animate",8421506}, {"Arg1",8552563}, {"Arg2",8552564}, {"Arg3",8552565}, {"Array",8683704}, {"Arrivals",8618081}, {"Arrived",8618079}, {"Assassinate",8487043}, {"B",9437196}, {"BANG",8389380}, {"BEDOINGNG",8389406}, {"BEEDEEP",8389404}, {"BEGIN_TURN",8389123}, {"BIZARRO_SWAP",8389143}, {"BOOOM",8389410}, {"BOUNCE",8389415}, {"BRRREEET",8389396}, {"BRRRT",8389395}, {"BUZZER",8389420}, {"BWEEP",8389397}, {"Background",8683642}, {"Broadcast",10518660}, {"BroadcastEx",10518662}, {"BroadcastSum",8421511}, {"BroadcastSumEx",8421512}, {"Busy",8618083}, {"CHEEP",8389393}, {"CHYEW",8389392}, {"CLEANUP",8389140}, {"CLICK",8389388}, {"COLLIDE",8389142}, {"COLLIDEBY",8389141}, {"CREATE",8389121}, {"CREATED",8389137}, {"Class",8486965}, {"Climb",9142345}, {"CollisionLayers",8487023}, {"Compatible",8487022}, {"Create",10518665}, {"DEEP_POP",8389417}, {"DEPARTED",8389125}, {"DESTROY",8389122}, {"DESTROYED",8389136}, {"DINK",8389390}, {"DOOR",8389378}, {"DRLRLRINK",8389398}, {"DYUPE",8389413}, {"DefaultImage",8683646}, {"DelInventory",8421514}, {"Delta",8421515}, {"Density",9142337}, {"Departed",8618080}, {"Departures",8618082}, {"Destroy",10584204}, {"Destroyed",8487020}, {"Dir",8618043}, {"Distance",9142335}, {"Done",8618091}, {"E",9437184}, {"END_TURN",8389139}, {"EditorHelp",8683648}, {"F",9437192}, {"FAROUT",8389421}, {"FFFFTT",8389399}, {"FLOATED",8389132}, {"FROG",8389383}, {"Finished",8552569}, {"FlushClass",8421517}, {"FlushObj",8487054}, {"From",8421490}, {"GLASS",8389379}, {"GLISSANT",8389419}, {"GetArray",8421561}, {"GetInventory",8421519}, {"HAWK",8389425}, {"HEARTBEAT",8389407}, {"HIT",8389134}, {"HITBY",8389135}, {"Hard",8618061}, {"Height",9142343}, {"HeightAt",8421520}, {"Help",8683647}, {"INIT",8389120}, {"IgnoreKey",8421521}, {"Image",8618044}, {"InPlace",8683645}, {"Inertia",9142333}, {"InitArray",8421562}, {"Input",8683643}, {"IntMove",10584210}, {"Invisible",8618084}, {"JAYAYAYNG",8389416}, {"JUMPED",8389128}, {"JumpTo",10584211}, {"KEWEL",8389422}, {"KEY",8389129}, {"KLECK",8389387}, {"KLINKK",8389385}, {"Key",8421496}, {"KeyCleared",8618085}, {"L",9437194}, {"LASTIMAGE",8389126}, {"LB",9437195}, {"LF",9437193}, {"LOCK",8389408}, {"LOOP",8388610}, {"Level",8421495}, {"Loc",8487060}, {"LocateMe",8421525}, {"LoseLevel",8421526}, {"MOVED",8389127}, {"MOVING",8389130}, {"MaxInventory",8421527}, {"Misc1",9142353}, {"Misc2",9142355}, {"Misc3",9142357}, {"Misc4",9142359}, {"Misc5",9142361}, {"Misc6",9142363}, {"Misc7",9142365}, {"Move",10584216}, {"Move+",10584217}, {"MoveNumber",8421494}, {"MoveTo",10584218}, {"Moved",8618090}, {"Msg",8421489}, {"N",9437186}, {"NE",9437185}, {"NW",9437187}, {"NewX",8421531}, {"NewXY",8421532}, {"NewY",8421533}, {"OLDPHONE",8389402}, {"ONCE",8388609}, {"OSC",8388616}, {"OSCLOOP",8388618}, {"ObjAbove",8487070}, {"ObjBelow",8487071}, {"ObjBottomAt",8421536}, {"ObjClassAt",8421537}, {"ObjDir",8487074}, {"ObjLayerAt",8421539}, {"ObjTopAt",8421540}, {"PLAYERMOVING",8389133}, {"POSTINIT",8389138}, {"POUR",8389377}, {"POWER",8389386}, {"Player",8487021}, {"PopUp",8421541}, {"QueueTurn",8421543}, {"Quiz",8683644}, {"R",9437198}, {"RATCHET1",8389418}, {"RATCHET2",8389412}, {"RATTLE",8389403}, {"RB",9437197}, {"RF",9437199}, {"S",9437190}, {"SE",9437191}, {"SMALL_POP",8389389}, {"SPLASH",8389376}, {"STEAM",8389424}, {"STOP",8388608}, {"SUBS",8683649}, {"SUNK",8389131}, {"SW",9437189}, {"Self",8421488}, {"Send",10584232}, {"SendEx",10584233}, {"SetArray",8421563}, {"SetInventory",8421546}, {"Shape",8618040}, {"ShapeDir",8618063}, {"Sharp",8618062}, {"Shovable",8618064}, {"Sound",8421547}, {"Stealthy",8618089}, {"Strength",9142347}, {"Synchronize",8421548}, {"TAHTASHH",8389409}, {"THMP_thmp",8389405}, {"THWIT",8389384}, {"TICK",8389391}, {"Temperature",9142326}, {"Trace",8421549}, {"UH_OH",8389382}, {"UNCORK",8389414}, {"UNHH",8389381}, {"UserSignal",8618086}, {"UserState",8618087}, {"VACUUM",8389411}, {"VisualOnly",8618088}, {"Volume",9142339}, {"VolumeAt",8421550}, {"W",9437188}, {"WAHOO",8389400}, {"WHACK",8389423}, {"Weight",9142341}, {"WinLevel",8421551}, {"XDir",8487088}, {"XYDir",8421553}, {"Xloc",8486969}, {"YDir",8487090}, {"YEEHAW",8389401}, {"Yloc",8486970}, {"_",8421555}, {"again",8683533}, {"band",8421406}, {"begin",8683532}, {"bit",8683554}, {"bit0",8388609}, {"bit1",8388610}, {"bit10",8423402}, |
︙ | ︙ | |||
638 639 640 641 642 643 644 | {"el",8683531}, {"else",8683529}, {"eq",8421415}, {"for",8683537}, {"ge",8486955}, {"gt",8486953}, {"if",8683528}, | | | | | | | 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 | {"el",8683531}, {"else",8683529}, {"eq",8421415}, {"for",8683537}, {"ge",8486955}, {"gt",8486953}, {"if",8683528}, {"in",8421557}, {"is",8421421}, {"land",8421411}, {"le",8486956}, {"lnot",8421414}, {"lor",8421412}, {"lsh",8421404}, {"lt",8486954}, {"lxor",8421413}, {"m?",8421425}, {"mbegin",8683703}, {"mod",8486938}, {"n?",8421422}, {"ne",8421416}, {"neg",8421403}, {"next",8683538}, {"nin",8421558}, {"nip",8421379}, {"o?",8421427}, {"oz?",8421428}, {"pick",8421383}, {"repeat",8683536}, {"ret",8421397}, {"rot",8421381}, {"rsh",8486941}, {"s?",8421426}, {"swap",8421378}, {"then",8683530}, {"tmark",8421556}, {"tuck",8421380}, {"until",8683534}, {"while",8683535}, }; #define N_OP_NAMES 295 #endif |