Free Hero Mesh

Check-in [9aec3201e3]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Implement NewXY and XYDir instructions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9aec3201e3d022f9d79766f526a3f4e52a84c9b8
User & Date: user on 2021-02-10 04:59:19
Other Links: manifest | tags
Context
2021-02-10
05:02
Implement the ,Loc instruction. check-in: 225cba49fa user: user tags: trunk
04:59
Implement NewXY and XYDir instructions. check-in: 9aec3201e3 user: user tags: trunk
04:52
Add an example configuration file. check-in: 8fd8c63a9e user: user tags: trunk
Changes

Modified class.doc from [eb7b165753] to [7468fdc695].

1202
1203
1204
1205
1206
1207
1208



1209

1210
1211
1212
1213
1214
1215
1216
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211

1212
1213
1214
1215
1216
1217
1218
1219







+
+
+
-
+








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.

NewXY  ( oldx oldy dir -- newx newy )
  NewX and NewY together.

NewY  ( oldx dir -- newy )
NewY  ( oldy 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.
1364
1365
1366
1367
1368
1369
1370



1371
1372
1373
1374
1375
1376
1377
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383







+
+
+







XDir  ( dir -- newx )
  Finds the X coordinate of the cell in the specified direction.

,XDir  ( obj dir -- newx )
  Finds the X coordinate of the cell in the specified direction of the
  specified object.

XYDir  ( dir -- newx newy )
  Finds the X and Y coordinates of the cell in the given direction.

YDir  ( dir -- newy )
  Finds the Y coordinate of the cell in the given direction.

,YDir  ( obj dir -- newy )
  Finds the Y coordinate of the cell in the specified direction of the
  specified object.

Modified exec.c from [3483fb1cee] to [51f022bade].

1477
1478
1479
1480
1481
1482
1483

1484
1485
1486
1487
1488
1489
1490
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491







+







    case OP_MOVETO_CD: NoIgnore(); StackReq(3,0); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); i=v_object(Pop()); move_to(obj,i,t2.u,t3.u); break;
    case OP_MSG: StackReq(0,1); Push(MVALUE(msgvars.msg)); break;
    case OP_MUL: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u*t2.u)); break;
    case OP_MUL_C: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.s*t2.s)); break;
    case OP_NE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?0:1)); break;
    case OP_NEG: StackReq(1,1); t1=Pop(); Numeric(t1); t1.s=-t1.s; Push(t1); break;
    case OP_NEWX: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_x(t1.u,t2.u))); break;
    case OP_NEWXY: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_x(t1.u,t3.u))); Push(NVALUE(new_y(t2.u,t3.u))); break;
    case OP_NEWY: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_y(t1.u,t2.u))); break;
    case OP_NEXT: StackReq(0,1); ptr=v_next(code,ptr); break;
    case OP_NIP: StackReq(2,1); t1=Pop(); Pop(); Push(t1); break;
    case OP_OBJABOVE: StackReq(0,1); i=obj_above(obj); Push(OVALUE(i)); break;
    case OP_OBJABOVE_C: StackReq(1,1); i=obj_above(v_object(Pop())); Push(OVALUE(i)); break;
    case OP_OBJBELOW: StackReq(0,1); i=obj_below(obj); Push(OVALUE(i)); break;
    case OP_OBJBELOW_C: StackReq(1,1); i=obj_below(v_object(Pop())); Push(OVALUE(i)); break;
1585
1586
1587
1588
1589
1590
1591

1592
1593
1594
1595
1596
1597
1598
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600







+







    case OP_WEIGHT_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->weight=t1.u; break;
    case OP_WEIGHT_EC16: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->weight=t1.u; break;
    case OP_WINLEVEL: key_ignored=0; gameover=1; Throw(0); break;
    case OP_XDIR: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(o->x+x_delta[resolve_dir(obj,t1.u)])); break;
    case OP_XDIR_C: StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(objects[i]->x+x_delta[resolve_dir(i,t1.u)])); break;
    case OP_XLOC: StackReq(0,1); Push(NVALUE(o->x)); break;
    case OP_XLOC_C: StackReq(1,1); Push(GetVariableOf(x,NVALUE)); break;
    case OP_XYDIR: StackReq(1,2); t1=Pop(); Numeric(t1); i=resolve_dir(obj,t1.u); Push(NVALUE(o->x+x_delta[i])); Push(NVALUE(o->y+y_delta[i])); break;
    case OP_YDIR: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(o->y+y_delta[resolve_dir(obj,t1.u)])); break;
    case OP_YDIR_C: StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(objects[i]->y+y_delta[resolve_dir(i,t1.u)])); break;
    case OP_YLOC: StackReq(0,1); Push(NVALUE(o->y)); break;
    case OP_YLOC_C: StackReq(1,1); Push(GetVariableOf(y,NVALUE)); break;
#define MiscVar(a,b) \
    case a: StackReq(0,1); Push(o->b); break; \
    case a+0x0800: StackReq(1,1); Push(GetVariableOf(b,)); break; \

Modified instruc from [ad8994f3d8] to [cba4030e74].

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
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







+




















+










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
WinLevel
,XDir
XYDir
,YDir

; Specials
*Function
*Local
*Label
*String
*Int16
*Int32

Modified instruc.h from [0ce4d3ad81] to [fef41e8e89].

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
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







+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







#define OP_MOVEPLUS_D 41111
#define OP_MOVEPLUS_CD 43159
#define OP_MOVETO 32920
#define OP_MOVETO_C 34968
#define OP_MOVETO_D 41112
#define OP_MOVETO_CD 43160
#define OP_NEWX 32921
#define OP_NEWXY 32922
#define OP_NEWY 32922
#define OP_OBJABOVE 32923
#define OP_OBJABOVE_C 34971
#define OP_OBJBELOW 32924
#define OP_OBJBELOW_C 34972
#define OP_OBJBOTTOMAT 32925
#define OP_OBJCLASSAT 32926
#define OP_OBJDIR 32927
#define OP_OBJDIR_C 34975
#define OP_OBJLAYERAT 32928
#define OP_OBJTOPAT 32929
#define OP_POPUP 32930
#define OP_POPUPARGS 32931
#define OP_QUEUETURN 32932
#define OP_SEND 32933
#define OP_SEND_C 34981
#define OP_SEND_D 41125
#define OP_SEND_CD 43173
#define OP_SENDEX 32934
#define OP_SENDEX_C 34982
#define OP_SENDEX_D 41126
#define OP_SENDEX_CD 43174
#define OP_SETINVENTORY 32935
#define OP_SOUND 32936
#define OP_SYNCHRONIZE 32937
#define OP_TRACE 32938
#define OP_VOLUMEAT 32939
#define OP_WINLEVEL 32940
#define OP_XDIR 32941
#define OP_XDIR_C 34989
#define OP_YDIR 32942
#define OP_YDIR_C 34990
#define OP_FUNCTION 32943
#define OP_LOCAL 32944
#define OP_LABEL 32945
#define OP_STRING 32946
#define OP_INT16 32947
#define OP_INT32 32948
#define OP_NEWY 32923
#define OP_OBJABOVE 32924
#define OP_OBJABOVE_C 34972
#define OP_OBJBELOW 32925
#define OP_OBJBELOW_C 34973
#define OP_OBJBOTTOMAT 32926
#define OP_OBJCLASSAT 32927
#define OP_OBJDIR 32928
#define OP_OBJDIR_C 34976
#define OP_OBJLAYERAT 32929
#define OP_OBJTOPAT 32930
#define OP_POPUP 32931
#define OP_POPUPARGS 32932
#define OP_QUEUETURN 32933
#define OP_SEND 32934
#define OP_SEND_C 34982
#define OP_SEND_D 41126
#define OP_SEND_CD 43174
#define OP_SENDEX 32935
#define OP_SENDEX_C 34983
#define OP_SENDEX_D 41127
#define OP_SENDEX_CD 43175
#define OP_SETINVENTORY 32936
#define OP_SOUND 32937
#define OP_SYNCHRONIZE 32938
#define OP_TRACE 32939
#define OP_VOLUMEAT 32940
#define OP_WINLEVEL 32941
#define OP_XDIR 32942
#define OP_XDIR_C 34990
#define OP_XYDIR 32943
#define OP_YDIR 32944
#define OP_YDIR_C 34992
#define OP_FUNCTION 32945
#define OP_LOCAL 32946
#define OP_LABEL 32947
#define OP_STRING 32948
#define OP_INT16 32949
#define OP_INT32 32950
#ifdef HEROMESH_CLASS
static const Op_Names op_names[]={
{"*",8486935},
{"+",8421397},
{"-",8421398},
{"-rot",8421382},
{".",10518528},
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
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







+
-
+




-
-
-
-
-
-
-
+
+
+
+
+
+
+





-
-
+
+

















-
-
-
+
+
+




-
+


-
+





-
+








-
+




-
-
+
+
+

-
+







{"MoveTo",10584216},
{"Moved",8618089},
{"Msg",8421488},
{"N",9437186},
{"NE",9437185},
{"NW",9437187},
{"NewX",8421529},
{"NewXY",8421530},
{"NewY",8421530},
{"NewY",8421531},
{"OLDPHONE",8389402},
{"ONCE",8388609},
{"OSC",8388616},
{"OSCLOOP",8388618},
{"ObjAbove",8487067},
{"ObjBelow",8487068},
{"ObjBottomAt",8421533},
{"ObjClassAt",8421534},
{"ObjDir",8487071},
{"ObjLayerAt",8421536},
{"ObjTopAt",8421537},
{"ObjAbove",8487068},
{"ObjBelow",8487069},
{"ObjBottomAt",8421534},
{"ObjClassAt",8421535},
{"ObjDir",8487072},
{"ObjLayerAt",8421537},
{"ObjTopAt",8421538},
{"PLAYERMOVING",8389133},
{"POSTINIT",8389138},
{"POUR",8389377},
{"POWER",8389386},
{"Player",8487020},
{"PopUp",8421538},
{"QueueTurn",8421540},
{"PopUp",8421539},
{"QueueTurn",8421541},
{"Quiz",8683642},
{"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",8683647},
{"SUNK",8389131},
{"SW",9437189},
{"Self",8421487},
{"Send",10584229},
{"SendEx",10584230},
{"SetInventory",8421543},
{"Send",10584230},
{"SendEx",10584231},
{"SetInventory",8421544},
{"Shape",8618039},
{"ShapeDir",8618062},
{"Sharp",8618061},
{"Shovable",8618063},
{"Sound",8421544},
{"Sound",8421545},
{"Stealthy",8618088},
{"Strength",9142346},
{"Synchronize",8421545},
{"Synchronize",8421546},
{"TAHTASHH",8389409},
{"THMP_thmp",8389405},
{"THWIT",8389384},
{"TICK",8389391},
{"Temperature",9142325},
{"Trace",8421546},
{"Trace",8421547},
{"UH_OH",8389382},
{"UNCORK",8389414},
{"UNHH",8389381},
{"UserSignal",8618085},
{"UserState",8618086},
{"VACUUM",8389411},
{"VisualOnly",8618087},
{"Volume",9142338},
{"VolumeAt",8421547},
{"VolumeAt",8421548},
{"W",9437188},
{"WAHOO",8389400},
{"WHACK",8389423},
{"Weight",9142340},
{"WinLevel",8421548},
{"XDir",8487085},
{"WinLevel",8421549},
{"XDir",8487086},
{"XYDir",8421551},
{"Xloc",8486968},
{"YDir",8487086},
{"YDir",8487088},
{"YEEHAW",8389401},
{"Yloc",8486969},
{"again",8683532},
{"band",8421405},
{"begin",8683531},
{"bit",8683553},
{"bit0",8388609},
646
647
648
649
650
651
652
653

654
650
651
652
653
654
655
656

657
658







-
+

{"s?",8421425},
{"swap",8421378},
{"then",8683529},
{"tuck",8421380},
{"until",8683533},
{"while",8683534},
};
#define N_OP_NAMES 282
#define N_OP_NAMES 284
#endif