Overview
Comment: | Add instructions for checking types of values |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ef4096f8169cf1ab2d6c0f2718661c67 |
User & Date: | user on 2021-01-06 07:31:04 |
Other Links: | manifest | tags |
Context
2021-01-06
| ||
22:07 | Implement clicking on the move list to rewind/replay, and display the move number when hovering the move list check-in: 6aab82917f user: user tags: trunk | |
07:31 | Add instructions for checking types of values check-in: ef4096f816 user: user tags: trunk | |
01:14 | Change the code that sends MSG_CREATED and MSG_DESTROYED according to my testing of how Hero Mesh is working check-in: d81bafda40 user: user tags: trunk | |
Changes
Modified class.doc from [7351e72438] to [688e54123c].
︙ | |||
975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | + + + + + + + + | treated as 1. Other non-numeric return values are errors. BroadcastSumEx ( class message arg1 arg2 arg3 -- total ) As BroadcastSum but with three message arguments. 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. Create ( class x y image dir -- obj ) ** Creates a new object at the specified location, and returns it. The result is zero if the class is zero, the coordinates are out of range, the object cannot be created due to the CollisionLayers, or if the new object is destroyed before its CREATE message returns. cz? ( any -- bool ) True if the value is a class or zero, or false if it is neither a class nor zero. Error if it is a sound. 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 ) ** |
︙ | |||
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 | 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 | + + + + | Test if first input is less than second input (unsigned). ,lt ( in1 in2 -- bool ) Test if first input is less than second input (signed). lxor ( in1 in2 -- out ) Logical XOR. m? ( any -- bool ) True if the value is a message, or false if it is any other type. Error if it is a sound. MaxInventory ( number -- ) Results in an error and loss of game if the number of different inventory items exceeds the given number, otherwise no effect. mod ( in1 in2 -- out ) Unsigned divide in1 by in2 producing the remainder. |
︙ | |||
1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 | + + + + + + + + | departures, and send FLOATED and SUNK messages as appropriate. ,MoveTo ( obj x y -- bool ) ** As MoveTo but for a specified object, not necessarily this one. Msg ( -- message ) The current message being processed. n? ( any -- bool ) True if the value is a number, or false if it is any other type. Error if it is a sound. ne ( in1 in2 -- bool ) As eq but the result is inverted (like "eq lnot"). neg ( in -- out ) Multiply by negative one. NewX ( oldx dir -- newx ) Advance the number in the direction as though it is a X coordinate. If the direction is north or south, leaves it alone, but if it is east or west then it is increased or decreased by one. The output is never less than zero nor exceeding the playfield width by more than one. NewY ( oldx dir -- newy ) Advance the number in the direction as though it is a Y coordinate. nip ( x y -- y ) o? ( any -- bool ) True if the value is an object (whether or not it has been garbage collected), or false for any other type. Error if it is a sound. ObjAbove ( -- obj ) The object above this one (0 if this one is at the top). "Above" means it overlaps this object, not upward on the screen (north). ,ObjAbove ( obj -- obj ) The object above the specified object (0 if there isn't any). |
︙ | |||
1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 | 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | + + + + + | If you specify multiple bits, it finds one with any of those bits. (It is not possible for there to be more than one such object.) ObjTopAt ( x y -- obj ) Find the object on the top at the specified location. The result will be zero if that location is vacant or out of range. oz? ( any -- bool ) True if the value is an object or zero, or false if it is neither an object nor zero. (Even if the object has been garbage collected, it is still true.) Error if it is a sound. PopUp ( value -- ) Displays a popup message. Normally, the value is a string, but it can be another type, and it will try to display it. If the text contains any \q commands, then dismissing the popup message will send a KEY message to the object which created the popup message. If there is already another existing popup message, only the first one set up will be displayed, and the others will be ignored. IgnoreKey also affects what happens when a |
︙ | |||
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | + + + + + | Logical right shift. If the shift amount is out of the range 0-31, then all bits are shifted out and the result is zero. ,rsh ( in shift -- out ) Arithmetic right shift. If the shift amount is out of the range 0-31, then all bits are shifted out; the result will be -1 if the input is negative, or 0 otherwise. s? ( any -- bool ) True if the value is a string (which may be either a string in the class codes or a string in the level), or false if it is any other type. Error if it is a sound. Self ( -- obj ) The reference to the current object. Send ( message arg1 arg2 -- value ) Similar to ,Send but this object sends the message to itself. |
︙ |
Modified exec.c from [101a0036ee] to [790ffffb30].
︙ | |||
1247 1248 1249 1250 1251 1252 1253 | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | - + + | #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) #define GetFlagOf(a) t2=Pop(),Push(t2.t==TY_CLASS?NVALUE(classes[t2.u]->oflags&a?1:0):(i=v_object(t2),i==VOIDLINK?NVALUE(0):NVALUE(objects[i]->oflags&a?1:0))) #define GetClassFlagOf(a) t2=Pop(),Push(t2.t==TY_CLASS?NVALUE(classes[t2.u]->cflags&a?1:0):(i=v_object(t2),i==VOIDLINK?NVALUE(0):NVALUE(classes[objects[i]->class]->cflags&a?1:0))) |
︙ | |||
1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | + + + + + + + | case OP_OBJDIR_C: StackReq(2,1); t2=Pop(); Numeric(t2); i=obj_dir(v_object(Pop()),t2.u); Push(OVALUE(i)); break; case OP_OBJLAYERAT: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); i=obj_layer_at(t1.u,t2.u,t3.u); Push(OVALUE(i)); break; case OP_OBJTOPAT: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); i=obj_top_at(t1.u,t2.u); Push(OVALUE(i)); break; case OP_PLAYER: StackReq(0,1); if(classes[o->class]->cflags&CF_PLAYER) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_PLAYER_C: StackReq(1,1); GetClassFlagOf(CF_PLAYER); break; case OP_POPUP: StackReq(1,0); v_set_popup(obj,0); break; case OP_POPUPARGS: i=code[ptr++]; StackReq(i+1,0); v_set_popup(obj,i); break; case OP_QC: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t==TY_CLASS) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_QCZ: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t==TY_CLASS || (t1.t==TY_NUMBER && !t1.u)) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_QM: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t==TY_MESSAGE) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_QN: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t==TY_NUMBER) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_QO: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t>TY_MAXTYPE) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_QOZ: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t>TY_MAXTYPE || (t1.t==TY_NUMBER && !t1.u)) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_QS: StackReq(1,1); t1=Pop(); NotSound(t1); if(t1.t==TY_STRING || t1.t==TY_LEVELSTRING) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_RET: return; case OP_ROT: StackReq(3,3); t3=Pop(); t2=Pop(); t1=Pop(); Push(t2); Push(t3); Push(t1); break; case OP_ROTBACK: StackReq(3,3); t3=Pop(); t2=Pop(); t1=Pop(); Push(t3); Push(t1); Push(t2); break; case OP_RSH: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t2.u&~31?0:t1.u>>t2.u)); break; case OP_RSH_C: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t2.u&~31?(t1.s<0?-1:0):t1.s>>t2.u)); break; case OP_SELF: StackReq(0,1); Push(OVALUE(obj)); break; case OP_SEND: StackReq(3,1); t4=Pop(); t3=Pop(); t2=Pop(); Push(v_send_self(obj,t2,t3,t4,NVALUE(0))); break; |
︙ |
Modified instruc from [651dfa2b24] to [ad8994f3d8].
︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | + + + + + + + + + | eq ne ,gt ,lt ,ge ,le is ; Type checks qn "n?" qc "c?" qcz "cz?" qm "m?" qs "s?" qo "o?" qoz "oz?" ; Standard variables ,Class ,=!Temperature ,=Shape ,Xloc ,Yloc |
︙ |
Modified instruc.h from [ebbc66b70f] to [0ce4d3ad81].
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 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 | + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - - - + + + + + + + + + + + - + - - - + + + - + - - - - + + + + - - - - - - - + + + + + + + - + - - + + - - - - + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - - - - - - - + + + + + + + - - - - + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - + + - - - + + + - - - - - + + + + + - + | #define OP_LT 32809 #define OP_LT_C 34857 #define OP_GE 32810 #define OP_GE_C 34858 #define OP_LE 32811 #define OP_LE_C 34859 #define OP_IS 32812 #define OP_QN 32813 #define OP_QC 32814 #define OP_QCZ 32815 #define OP_QM 32816 #define OP_QS 32817 #define OP_QO 32818 #define OP_QOZ 32819 |
︙ | |||
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 | 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 | + + + + + + + - + | {"bit6",8388672}, {"bit7",8388736}, {"bit8",8423400}, {"bit9",8423401}, {"bnot",8421408}, {"bor",8421406}, {"bxor",8421407}, {"c?",8421422}, {"cz?",8421423}, {"dup",8486913}, {"el",8683530}, {"else",8683528}, {"eq",8421414}, {"for",8683536}, {"ge",8486954}, {"gt",8486952}, {"if",8683527}, {"is",8421420}, {"land",8421410}, {"le",8486955}, {"lnot",8421413}, {"lor",8421411}, {"lsh",8421403}, {"lt",8486953}, {"lxor",8421412}, {"m?",8421424}, {"mod",8486937}, {"n?",8421421}, {"ne",8421415}, {"neg",8421402}, {"next",8683537}, {"nip",8421379}, {"o?",8421426}, {"oz?",8421427}, {"repeat",8683535}, {"ret",8421396}, {"rot",8421381}, {"rsh",8486940}, {"s?",8421425}, {"swap",8421378}, {"then",8683529}, {"tuck",8421380}, {"until",8683533}, {"while",8683534}, }; |