Overview
Comment: | Implement the Chebyshev, Manhattan, Rel, and Seek instructions. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7db27bc31e55c2d82b7bcdf4cbb59899 |
User & Date: | user on 2021-03-26 03:55:45 |
Other Links: | manifest | tags |
Context
2021-03-27
| ||
08:21 | Implement the text editor, for editing the level title and level strings (currently, only editing the title is implemented). check-in: 1665c0ca5d user: user tags: trunk | |
2021-03-26
| ||
03:55 | Implement the Chebyshev, Manhattan, Rel, and Seek instructions. check-in: 7db27bc31e user: user tags: trunk | |
2021-03-25
| ||
06:31 | Implement user flags (a way to give a name to bits of Misc4-Misc7 and CollisionLayers) check-in: 386d28a9fb user: user tags: trunk | |
Changes
Modified class.doc from [4888810f01] to [4e45686ad2].
︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 | object as the current object and continues executing the code with that object instead. This new current object is not saved if you return from a function or a subroutine call. If it successfully chained, then the result is false. If given an object of a different class, an object that doesn't exist, or anything other than an object, then it does nothing and the result is true. 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 ) | > > > > > > > > | 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 | object as the current object and continues executing the code with that object instead. This new current object is not saved if you return from a function or a subroutine call. If it successfully chained, then the result is false. If given an object of a different class, an object that doesn't exist, or anything other than an object, then it does nothing and the result is true. Chebyshev ( obj -- number ) Calculate the Chebyshev distance between this object and the specified object. If the specified object is zero, then the result is also zero. ,Chebyshev ( obj1 obj2 -- number ) Calculate the Chebyshev distance between thie two specified objects. If either specified object is zero, then the result is also zero. 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 ) |
︙ | ︙ | |||
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | 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. | > > > > > > > > | 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 | 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. Manhattan ( obj -- number ) Calculate the Manhattan distance between this object and the specified object. If the specified object is zero, then the result is also zero. ,Manhattan ( obj1 obj2 -- number ) Calculate the Manhattan distance between thie two specified objects. If either specified object is zero, then the result is also zero. 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. |
︙ | ︙ | |||
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | must be a number from 0 to 255. The extra turn is not entered into the replay list and does not increase MoveNumber, but otherwise will act like any other turn. Popup messages are not removed; they will be retained, and these extra turns execute the input phase as though there is no popup quiz. (Not implemented yet. Details described here might be changed when it is implemented.) ret ( -- ) Exit the current subroutine. If this is a message block, it must either leave the stack as it is, or leave it but with one extra value pushed which will be the return value from the message call. (This is implied at the end of a code block.) For a user defined function call, or a subroutine call, these restrictions are not applicable. | > > > > > > > > | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | must be a number from 0 to 255. The extra turn is not entered into the replay list and does not increase MoveNumber, but otherwise will act like any other turn. Popup messages are not removed; they will be retained, and these extra turns execute the input phase as though there is no popup quiz. (Not implemented yet. Details described here might be changed when it is implemented.) Rel ( dir -- dir ) Resolves a relative direction to an absolute direction. ,Rel ( obj dir -- dir ) Resolves a relative direction to an absolute direction, using the direction of the specified object as the base. If zero is specified instead of a valid object, thent the result is the same as the input. ret ( -- ) Exit the current subroutine. If this is a message block, it must either leave the stack as it is, or leave it but with one extra value pushed which will be the return value from the message call. (This is implied at the end of a code block.) For a user defined function call, or a subroutine call, these restrictions are not applicable. |
︙ | ︙ | |||
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | 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. ,Send ( obj message arg1 arg2 -- value ) | > > > > > > > > > | 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | 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. Seek ( obj -- dir ) Returns the direction from this object to the specified object. If that object is in the same place as this one, returns F. If zero is specified then it is an error. ,Seek ( obj1 obj2 -- dir ) Returns the direction from obj1 to obj2. If the two objects are in the same place, returns F. If either object is zero, then it is an error. Self ( -- obj ) The reference to the current object. Send ( message arg1 arg2 -- value ) Similar to ,Send but this object sends the message to itself. ,Send ( obj message arg1 arg2 -- value ) |
︙ | ︙ |
Modified exec.c from [09b8696c39] to [664301a3a6].
︙ | ︙ | |||
360 361 362 363 364 365 366 367 368 369 370 371 372 373 | while(i!=VOIDLINK) { o=objects[i]; if(r<o->volume && !(o->oflags&(OF_DESTROYED|OF_VISUALONLY))) r=o->volume; i=o->up; } return r; } static Uint32 obj_above(Uint32 i) { Object*o; if(i==VOIDLINK) return VOIDLINK; o=objects[i]; i=o->up; while(i!=VOIDLINK) { | > > > > > > > > > > > > > > > > > | 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 | while(i!=VOIDLINK) { o=objects[i]; if(r<o->volume && !(o->oflags&(OF_DESTROYED|OF_VISUALONLY))) r=o->volume; i=o->up; } return r; } static Uint32 obj_seek(Uint32 aa,Uint32 bb) { Object*a; Object*b; if(aa==VOIDLINK || bb==VOIDLINK) Throw("Cannot seek to zero object"); a=objects[aa]; b=objects[bb]; if(a->x==b->x) { if(a->y==b->y) return 8; return a->y<b->y?6:2; } else if(a->x<b->x) { if(a->y==b->y) return 0; return a->y<b->y?7:1; } else { if(a->y==b->y) return 4; return a->y<b->y?5:3; } } static Uint32 obj_above(Uint32 i) { Object*o; if(i==VOIDLINK) return VOIDLINK; o=objects[i]; i=o->up; while(i!=VOIDLINK) { |
︙ | ︙ | |||
1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | static Uint32 v_chain(Value v,Uint16 c) { if(v.t==TY_SOUND || v.t==TY_USOUND) Throw("Cannot convert sound to object"); if(v.t<=TY_MAXTYPE) return VOIDLINK; if(v.u>=nobjects || !objects[v.u] || objects[v.u]->generation!=v.t) return VOIDLINK; if(objects[v.u]->class!=c) return VOIDLINK; return v.u; } // 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) | > > > > > > > > > > > > > | 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | static Uint32 v_chain(Value v,Uint16 c) { if(v.t==TY_SOUND || v.t==TY_USOUND) Throw("Cannot convert sound to object"); if(v.t<=TY_MAXTYPE) return VOIDLINK; if(v.u>=nobjects || !objects[v.u] || objects[v.u]->generation!=v.t) return VOIDLINK; if(objects[v.u]->class!=c) return VOIDLINK; return v.u; } static inline Uint32 manhattan(Uint32 a,Uint32 b) { if(a==VOIDLINK || b==VOIDLINK) return 0; return abs(objects[a]->x-objects[b]->x)+abs(objects[a]->y-objects[b]->y); } static inline Uint32 chebyshev(Uint32 a,Uint32 b) { Uint32 i,j; if(a==VOIDLINK || b==VOIDLINK) return 0; i=abs(objects[a]->x-objects[b]->x); j=abs(objects[a]->y-objects[b]->y); return i>j?i:j; } // 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) |
︙ | ︙ | |||
1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | 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_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_CLASS: StackReq(0,1); Push(CVALUE(o->class)); break; case OP_CLASS_C: StackReq(1,1); Push(GetVariableOf(class,CVALUE)); break; case OP_CLIMB: StackReq(0,1); Push(NVALUE(o->climb)); break; case OP_CLIMB_C: StackReq(1,1); Push(GetVariableOrAttributeOf(climb,NVALUE)); break; case OP_CLIMB_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->climb=t1.u; break; case OP_CLIMB_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->climb=t1.u&0xFFFF; break; case OP_CLIMB_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) o->climb=t1.u; break; | > > | 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | 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_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_CLIMB: StackReq(0,1); Push(NVALUE(o->climb)); break; case OP_CLIMB_C: StackReq(1,1); Push(GetVariableOrAttributeOf(climb,NVALUE)); break; case OP_CLIMB_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->climb=t1.u; break; case OP_CLIMB_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->climb=t1.u&0xFFFF; break; case OP_CLIMB_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) o->climb=t1.u; break; |
︙ | ︙ | |||
1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 | case OP_LOCATEME: locate_me(o->x,o->y); break; case OP_LOR: StackReq(2,1); t1=Pop(); t2=Pop(); if(v_bool(t1) || v_bool(t2)) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_LOSELEVEL: gameover=-1; Throw(0); break; case OP_LSH: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t2.u&~31?0:t1.u<<t2.u)); break; case OP_LT: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?1:0)); break; case OP_LT_C: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_signed_greater(t2,t1)?1:0)); break; case OP_LXOR: StackReq(2,1); t1=Pop(); t2=Pop(); if(v_bool(t1)?!v_bool(t2):v_bool(t2)) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_MARK: StackReq(0,1); Push(UVALUE(0,TY_MARK)); break; case OP_MAXINVENTORY: StackReq(1,0); t1=Pop(); Numeric(t1); if(ninventory>t1.u) Throw("Inventory overflow"); break; case OP_MOD: StackReq(2,1); t2=Pop(); DivideBy(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u%t2.u)); break; case OP_MOD_C: StackReq(2,1); t2=Pop(); DivideBy(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.s%t2.s)); break; case OP_MOVE: NoIgnore(); StackReq(1,1); t1=Pop(); Numeric(t1); o->inertia=o->strength; Push(NVALUE(move_dir(obj,obj,t1.u))); break; case OP_MOVE_C: NoIgnore(); StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else { objects[i]->inertia=o->strength; Push(NVALUE(move_dir(obj,i,t1.u))); } break; case OP_MOVE_D: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->inertia=o->strength; move_dir(obj,obj,t1.u); break; | > > | 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 | case OP_LOCATEME: locate_me(o->x,o->y); break; case OP_LOR: StackReq(2,1); t1=Pop(); t2=Pop(); if(v_bool(t1) || v_bool(t2)) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_LOSELEVEL: gameover=-1; Throw(0); break; case OP_LSH: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t2.u&~31?0:t1.u<<t2.u)); break; case OP_LT: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?1:0)); break; case OP_LT_C: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_signed_greater(t2,t1)?1:0)); break; case OP_LXOR: StackReq(2,1); t1=Pop(); t2=Pop(); if(v_bool(t1)?!v_bool(t2):v_bool(t2)) Push(NVALUE(1)); else Push(NVALUE(0)); break; case OP_MANHATTAN: StackReq(1,1); t1=Pop(); i=manhattan(obj,v_object(t1)); Push(NVALUE(i)); break; case OP_MANHATTAN_C: StackReq(2,1); t2=Pop(); t1=Pop(); i=manhattan(v_object(t1),v_object(t2)); Push(NVALUE(i)); break; case OP_MARK: StackReq(0,1); Push(UVALUE(0,TY_MARK)); break; case OP_MAXINVENTORY: StackReq(1,0); t1=Pop(); Numeric(t1); if(ninventory>t1.u) Throw("Inventory overflow"); break; case OP_MOD: StackReq(2,1); t2=Pop(); DivideBy(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u%t2.u)); break; case OP_MOD_C: StackReq(2,1); t2=Pop(); DivideBy(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.s%t2.s)); break; case OP_MOVE: NoIgnore(); StackReq(1,1); t1=Pop(); Numeric(t1); o->inertia=o->strength; Push(NVALUE(move_dir(obj,obj,t1.u))); break; case OP_MOVE_C: NoIgnore(); StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else { objects[i]->inertia=o->strength; Push(NVALUE(move_dir(obj,i,t1.u))); } break; case OP_MOVE_D: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->inertia=o->strength; move_dir(obj,obj,t1.u); break; |
︙ | ︙ | |||
1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 | 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; case OP_SEND_C: StackReq(4,1); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_send_message(obj,t1,t2,t3,t4,NVALUE(0))); break; case OP_SEND_D: StackReq(3,0); t4=Pop(); t3=Pop(); t2=Pop(); v_send_self(obj,t2,t3,t4,NVALUE(0)); break; case OP_SEND_CD: StackReq(4,0); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_send_message(obj,t1,t2,t3,t4,NVALUE(0)); break; case OP_SENDEX: StackReq(4,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); Push(v_send_self(obj,t2,t3,t4,t5)); break; case OP_SENDEX_C: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_send_message(obj,t1,t2,t3,t4,t5)); break; | > > > > | 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 | 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_REL: StackReq(1,1); t1=Pop(); Numeric(t1); i=resolve_dir(obj,t1.u); Push(NVALUE(i)); break; case OP_REL_C: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); i=v_object(t1); i=(i==VOIDLINK?t2.u:resolve_dir(i,t2.u)); Push(NVALUE(i)); 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_SEEK: StackReq(1,1); t1=Pop(); i=obj_seek(obj,v_object(t1)); Push(NVALUE(i)); break; case OP_SEEK_C: StackReq(2,1); t2=Pop(); t1=Pop(); i=obj_seek(v_object(t1),v_object(t2)); Push(NVALUE(i)); 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; case OP_SEND_C: StackReq(4,1); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_send_message(obj,t1,t2,t3,t4,NVALUE(0))); break; case OP_SEND_D: StackReq(3,0); t4=Pop(); t3=Pop(); t2=Pop(); v_send_self(obj,t2,t3,t4,NVALUE(0)); break; case OP_SEND_CD: StackReq(4,0); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_send_message(obj,t1,t2,t3,t4,NVALUE(0)); break; case OP_SENDEX: StackReq(4,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); Push(v_send_self(obj,t2,t3,t4,t5)); break; case OP_SENDEX_C: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_send_message(obj,t1,t2,t3,t4,t5)); break; |
︙ | ︙ |
Modified instruc from [ceba8d00b7] to [13d4221bb0].
︙ | ︙ | |||
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 | ,Assassinate ; destroy without sending any messages .Broadcast *BroadcastClass ; for (Broadcast [class]) .BroadcastEx ; broadcast with three arguments BroadcastSum ; Broadcast, but result is sum of return values BroadcastSumEx chain .Create DelInventory Delta .,Destroy FlushClass ,FlushObj GetInventory HeightAt IgnoreKey .,IntMove ; move without initializing Inertia .,JumpTo ,Loc ; same as: Xloc Yloc LocateMe LoseLevel MaxInventory ; error if more than that many slots in inventory .,Move .,MovePlus "Move+" ; obj.Inertia+=Strength instead of obj.Inertia=Strength .,MoveTo ; the internal MoveTo() function NewX NewXY NewY ,ObjAbove ,ObjBelow ObjBottomAt ObjClassAt ,ObjDir ObjLayerAt ObjTopAt PopUp *PopUpArgs ; for (PopUp [number]) QueueTurn ; queue another turn that automatically occurs after this one .,Send .,SendEx ; send with three arguments SetInventory Sound Synchronize Trace VolumeAt | > > > > | 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 | ,Assassinate ; destroy without sending any messages .Broadcast *BroadcastClass ; for (Broadcast [class]) .BroadcastEx ; broadcast with three arguments BroadcastSum ; Broadcast, but result is sum of return values BroadcastSumEx chain ,Chebyshev .Create DelInventory Delta .,Destroy FlushClass ,FlushObj GetInventory HeightAt IgnoreKey .,IntMove ; move without initializing Inertia .,JumpTo ,Loc ; same as: Xloc Yloc LocateMe LoseLevel ,Manhattan MaxInventory ; error if more than that many slots in inventory .,Move .,MovePlus "Move+" ; obj.Inertia+=Strength instead of obj.Inertia=Strength .,MoveTo ; the internal MoveTo() function NewX NewXY NewY ,ObjAbove ,ObjBelow ObjBottomAt ObjClassAt ,ObjDir ObjLayerAt ObjTopAt PopUp *PopUpArgs ; for (PopUp [number]) QueueTurn ; queue another turn that automatically occurs after this one ,Rel ,Seek .,Send .,SendEx ; send with three arguments SetInventory Sound Synchronize Trace VolumeAt |
︙ | ︙ |
Modified instruc.h from [af49a4968c] to [9577840e31].
︙ | ︙ | |||
289 290 291 292 293 294 295 | #define OP_BROADCAST_D 41095 #define OP_BROADCASTCLASS 32904 #define OP_BROADCASTEX 32905 #define OP_BROADCASTEX_D 41097 #define OP_BROADCASTSUM 32906 #define OP_BROADCASTSUMEX 32907 #define OP_CHAIN 32908 | > > | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | #define OP_BROADCAST_D 41095 #define OP_BROADCASTCLASS 32904 #define OP_BROADCASTEX 32905 #define OP_BROADCASTEX_D 41097 #define OP_BROADCASTSUM 32906 #define OP_BROADCASTSUMEX 32907 #define OP_CHAIN 32908 #define OP_CHEBYSHEV 32909 #define OP_CHEBYSHEV_C 34957 #define OP_CREATE 32910 #define OP_CREATE_D 41102 #define OP_DELINVENTORY 32911 #define OP_DELTA 32912 #define OP_DESTROY 32913 #define OP_DESTROY_C 34961 #define OP_DESTROY_D 41105 #define OP_DESTROY_CD 43153 #define OP_FLUSHCLASS 32914 #define OP_FLUSHOBJ 32915 #define OP_FLUSHOBJ_C 34963 #define OP_GETINVENTORY 32916 #define OP_HEIGHTAT 32917 #define OP_IGNOREKEY 32918 #define OP_INTMOVE 32919 #define OP_INTMOVE_C 34967 #define OP_INTMOVE_D 41111 #define OP_INTMOVE_CD 43159 #define OP_JUMPTO 32920 #define OP_JUMPTO_C 34968 #define OP_JUMPTO_D 41112 #define OP_JUMPTO_CD 43160 #define OP_LOC 32921 #define OP_LOC_C 34969 #define OP_LOCATEME 32922 #define OP_LOSELEVEL 32923 #define OP_MANHATTAN 32924 #define OP_MANHATTAN_C 34972 #define OP_MAXINVENTORY 32925 #define OP_MOVE 32926 #define OP_MOVE_C 34974 #define OP_MOVE_D 41118 #define OP_MOVE_CD 43166 #define OP_MOVEPLUS 32927 #define OP_MOVEPLUS_C 34975 #define OP_MOVEPLUS_D 41119 #define OP_MOVEPLUS_CD 43167 #define OP_MOVETO 32928 #define OP_MOVETO_C 34976 #define OP_MOVETO_D 41120 #define OP_MOVETO_CD 43168 #define OP_NEWX 32929 #define OP_NEWXY 32930 #define OP_NEWY 32931 #define OP_OBJABOVE 32932 #define OP_OBJABOVE_C 34980 #define OP_OBJBELOW 32933 #define OP_OBJBELOW_C 34981 #define OP_OBJBOTTOMAT 32934 #define OP_OBJCLASSAT 32935 #define OP_OBJDIR 32936 #define OP_OBJDIR_C 34984 #define OP_OBJLAYERAT 32937 #define OP_OBJTOPAT 32938 #define OP_POPUP 32939 #define OP_POPUPARGS 32940 #define OP_QUEUETURN 32941 #define OP_REL 32942 #define OP_REL_C 34990 #define OP_SEEK 32943 #define OP_SEEK_C 34991 #define OP_SEND 32944 #define OP_SEND_C 34992 #define OP_SEND_D 41136 #define OP_SEND_CD 43184 #define OP_SENDEX 32945 #define OP_SENDEX_C 34993 #define OP_SENDEX_D 41137 #define OP_SENDEX_CD 43185 #define OP_SETINVENTORY 32946 #define OP_SOUND 32947 #define OP_SYNCHRONIZE 32948 #define OP_TRACE 32949 #define OP_VOLUMEAT 32950 #define OP_WINLEVEL 32951 #define OP_XDIR 32952 #define OP_XDIR_C 35000 #define OP_XYDIR 32953 #define OP_YDIR 32954 #define OP_YDIR_C 35002 #define OP_MARK 32955 #define OP_TMARK 32956 #define OP_IN 32957 #define OP_NIN 32958 #define OP_MBEGIN 32959 #define OP_ARRAY 32960 #define OP_GETARRAY 32961 #define OP_INITARRAY 32962 #define OP_SETARRAY 32963 #define OP_ARRAYCELL 32964 #define OP_FUNCTION 32965 #define OP_LOCAL 32966 #define OP_LABEL 32967 #define OP_STRING 32968 #define OP_INT16 32969 #define OP_INT32 32970 #define OP_DISPATCH 32971 #define OP_USERFLAG 32972 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486937}, {"+",8421399}, {"-",8421400}, {"-rot",8421382}, {".",10518528}, {"/",8486938}, {"ANHH",8389394}, {"ARRIVED",8389124}, {"Animate",8421508}, {"AnimateDead",8421509}, {"Arg1",8552565}, {"Arg2",8552566}, {"Arg3",8552567}, {"Array",8683712}, {"ArrayCell",8421572}, {"Arrivals",8618083}, {"Arrived",8618081}, {"Assassinate",8487046}, {"B",9437196}, {"BANG",8389380}, {"BEDOINGNG",8389406}, {"BEEDEEP",8389404}, |
︙ | ︙ | |||
427 428 429 430 431 432 433 434 435 436 437 | {"CHYEW",8389392}, {"CLEANUP",8389140}, {"CLICK",8389388}, {"COLLIDE",8389142}, {"COLLIDEBY",8389141}, {"CREATE",8389121}, {"CREATED",8389137}, {"Class",8486967}, {"Climb",9142347}, {"CollisionLayers",8487025}, {"Compatible",8487024}, | > | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | > > | | | | | | | | | | | | | | 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 | {"CHYEW",8389392}, {"CLEANUP",8389140}, {"CLICK",8389388}, {"COLLIDE",8389142}, {"COLLIDEBY",8389141}, {"CREATE",8389121}, {"CREATED",8389137}, {"Chebyshev",8487053}, {"Class",8486967}, {"Climb",9142347}, {"CollisionLayers",8487025}, {"Compatible",8487024}, {"Create",10518670}, {"DEEP_POP",8389417}, {"DEPARTED",8389125}, {"DESTROY",8389122}, {"DESTROYED",8389136}, {"DINK",8389390}, {"DOOR",8389378}, {"DRLRLRINK",8389398}, {"DYUPE",8389413}, {"DefaultImage",8683648}, {"DelInventory",8421519}, {"Delta",8421520}, {"Density",9142339}, {"Departed",8618082}, {"Departures",8618084}, {"Destroy",10584209}, {"Destroyed",8487022}, {"Dir",8618045}, {"Distance",9142337}, {"Done",8618093}, {"E",9437184}, {"END_TURN",8389139}, {"EditorHelp",8683650}, {"F",9437192}, {"FAROUT",8389421}, {"FFFFTT",8389399}, {"FLOATED",8389132}, {"FROG",8389383}, {"Finished",8552571}, {"FlushClass",8421522}, {"FlushObj",8487059}, {"From",8421492}, {"GLASS",8389379}, {"GLISSANT",8389419}, {"GetArray",8421569}, {"GetInventory",8421524}, {"HAWK",8389425}, {"HEARTBEAT",8389407}, {"HIT",8389134}, {"HITBY",8389135}, {"Hard",8618063}, {"Height",9142345}, {"HeightAt",8421525}, {"Help",8683649}, {"INIT",8389120}, {"IgnoreKey",8421526}, {"Image",8618046}, {"InPlace",8683647}, {"Inertia",9142335}, {"InitArray",8421570}, {"Input",8683645}, {"IntMove",10584215}, {"Invisible",8618086}, {"JAYAYAYNG",8389416}, {"JUMPED",8389128}, {"JumpTo",10584216}, {"KEWEL",8389422}, {"KEY",8389129}, {"KLECK",8389387}, {"KLINKK",8389385}, {"Key",8421498}, {"KeyCleared",8618087}, {"L",9437194}, {"LASTIMAGE",8389126}, {"LB",9437195}, {"LF",9437193}, {"LOCK",8389408}, {"LOOP",8388610}, {"Level",8421497}, {"Loc",8487065}, {"LocateMe",8421530}, {"LoseLevel",8421531}, {"MOVED",8389127}, {"MOVING",8389130}, {"Manhattan",8487068}, {"MaxInventory",8421533}, {"Misc1",9142355}, {"Misc2",9142357}, {"Misc3",9142359}, {"Misc4",9142361}, {"Misc5",9142363}, {"Misc6",9142365}, {"Misc7",9142367}, {"Move",10584222}, {"Move+",10584223}, {"MoveNumber",8421496}, {"MoveTo",10584224}, {"Moved",8618092}, {"Msg",8421491}, {"N",9437186}, {"NE",9437185}, {"NW",9437187}, {"NewX",8421537}, {"NewXY",8421538}, {"NewY",8421539}, {"OLDPHONE",8389402}, {"ONCE",8388609}, {"OSC",8388616}, {"OSCLOOP",8388618}, {"ObjAbove",8487076}, {"ObjBelow",8487077}, {"ObjBottomAt",8421542}, {"ObjClassAt",8421543}, {"ObjDir",8487080}, {"ObjLayerAt",8421545}, {"ObjTopAt",8421546}, {"PLAYERMOVING",8389133}, {"POSTINIT",8389138}, {"POUR",8389377}, {"POWER",8389386}, {"Player",8487023}, {"PopUp",8421547}, {"QueueTurn",8421549}, {"Quiz",8683646}, {"R",9437198}, {"RATCHET1",8389418}, {"RATCHET2",8389412}, {"RATTLE",8389403}, {"RB",9437197}, {"RF",9437199}, {"Rel",8487086}, {"S",9437190}, {"SE",9437191}, {"SMALL_POP",8389389}, {"SPLASH",8389376}, {"STEAM",8389424}, {"STOP",8388608}, {"SUBS",8683651}, {"SUNK",8389131}, {"SW",9437189}, {"Seek",8487087}, {"Self",8421490}, {"Send",10584240}, {"SendEx",10584241}, {"SetArray",8421571}, {"SetInventory",8421554}, {"Shape",8618042}, {"ShapeDir",8618065}, {"Sharp",8618064}, {"Shovable",8618066}, {"Sound",8421555}, {"Stealthy",8618091}, {"Strength",9142349}, {"Synchronize",8421556}, {"TAHTASHH",8389409}, {"THMP_thmp",8389405}, {"THWIT",8389384}, {"TICK",8389391}, {"Temperature",9142328}, {"Trace",8421557}, {"UH_OH",8389382}, {"UNCORK",8389414}, {"UNHH",8389381}, {"UserSignal",8618088}, {"UserState",8618089}, {"VACUUM",8389411}, {"VisualOnly",8618090}, {"Volume",9142341}, {"VolumeAt",8421558}, {"W",9437188}, {"WAHOO",8389400}, {"WHACK",8389423}, {"Weight",9142343}, {"WinLevel",8421559}, {"XDir",8487096}, {"XYDir",8421561}, {"Xloc",8486971}, {"YDir",8487098}, {"YEEHAW",8389401}, {"Yloc",8486972}, {"_",8421563}, {"a?",8421430}, {"again",8683534}, {"band",8421407}, {"begin",8683533}, {"bit",8683555}, {"bit0",8388609}, {"bit1",8388610}, |
︙ | ︙ | |||
650 651 652 653 654 655 656 | {"el",8683532}, {"else",8683530}, {"eq",8421416}, {"for",8683538}, {"ge",8486956}, {"gt",8486954}, {"if",8683529}, | | | | | | | 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 | {"el",8683532}, {"else",8683530}, {"eq",8421416}, {"for",8683538}, {"ge",8486956}, {"gt",8486954}, {"if",8683529}, {"in",8421565}, {"is",8421422}, {"land",8421412}, {"le",8486957}, {"lnot",8421415}, {"lor",8421413}, {"lsh",8421405}, {"lt",8486955}, {"lxor",8421414}, {"m?",8421426}, {"mbegin",8683711}, {"mod",8486939}, {"n?",8421423}, {"ne",8421417}, {"neg",8421404}, {"next",8683539}, {"nin",8421566}, {"nip",8421379}, {"o?",8421428}, {"over",8421384}, {"oz?",8421429}, {"pick",8421383}, {"repeat",8683537}, {"ret",8421398}, {"rot",8421381}, {"rsh",8486942}, {"s?",8421427}, {"swap",8421378}, {"then",8683531}, {"tmark",8421564}, {"tuck",8421380}, {"until",8683535}, {"while",8683536}, }; #define N_OP_NAMES 304 #endif |