Free Hero Mesh

Check-in [e3c2fc3bcb]
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:Change Four and Eight to Rook and Queen; also add Bishop
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e3c2fc3bcb7920cc0124a95619397dee1727fb8b
User & Date: user on 2021-05-20 00:47:05
Other Links: manifest | tags
Context
2021-05-22
23:10
Fix documentation of CLASS_DATA function check-in: ad65a30a4b user: user tags: trunk
2021-05-20
00:47
Change Four and Eight to Rook and Queen; also add Bishop check-in: e3c2fc3bcb user: user tags: trunk
2021-05-18
06:25
Always disable buffering for stderr. check-in: 79b85a3d23 user: user tags: trunk
Changes

Modified class.c from [390a2adac5] to [674cdbf650].

1101
1102
1103
1104
1105
1106
1107
1108
1109

1110
1111
1112
1113
1114
1115
1116
  for(;;) {
    nxttok();
    if(Tokenf(TF_MACRO)) ParseError("Unexpected macro\n");
    if(Tokenf(TF_DIR)) {
      cl->codes[ptr++]=tokenv&15;
    } else if(Tokenf(TF_NAME)) {
      switch(tokenv) {
        case OP_ADD: case OP_CLIMB: case OP_EIGHT: case OP_FOUR:
        case OP_HEIGHT: case OP_LOC: case OP_MARK: case OP_SUB:

        case OP_DIR: case OP_DIR_C: case OP_DIR_E: case OP_DIR_EC:
        case OP_OBJTOPAT: case OP_OBJBOTTOMAT: case OP_CUT: case OP_MUL:
        case OP_OBJABOVE: case OP_OBJBELOW: case OP_TRACE: case OP_NEXT:
        case 0x0200 ... 0x02FF: // message
        case 0x4000 ... 0x7FFF: // class
        case 0xC000 ... 0xFFFF: // message
          cl->codes[ptr++]=tokenv;







|
|
>







1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
  for(;;) {
    nxttok();
    if(Tokenf(TF_MACRO)) ParseError("Unexpected macro\n");
    if(Tokenf(TF_DIR)) {
      cl->codes[ptr++]=tokenv&15;
    } else if(Tokenf(TF_NAME)) {
      switch(tokenv) {
        case OP_ADD: case OP_CLIMB: case OP_HEIGHT:
        case OP_LOC: case OP_MARK: case OP_SUB:
        case OP_QUEEN: case OP_ROOK: case OP_BISHOP:
        case OP_DIR: case OP_DIR_C: case OP_DIR_E: case OP_DIR_EC:
        case OP_OBJTOPAT: case OP_OBJBOTTOMAT: case OP_CUT: case OP_MUL:
        case OP_OBJABOVE: case OP_OBJBELOW: case OP_TRACE: case OP_NEXT:
        case 0x0200 ... 0x02FF: // message
        case 0x4000 ... 0x7FFF: // class
        case 0xC000 ... 0xFFFF: // message
          cl->codes[ptr++]=tokenv;

Modified class.doc from [ca75a1769b] to [529040a567].

2309
2310
2311
2312
2313
2314
2315



2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
  is repeated until it no longer matches. If the first word is begin,
  then it must match at least once; if it is if, then it can match zero
  or more times. The match is greedy; it will match as much as possible.

begin
  Begin a block.




Climb
  Fail the match if the origin object cannot climb here.

(Climb <number>)
  Fail the match if the height here is greater than this number.

cut
  Discards the most recent choice point.

else
  Delimits alternatives within a block.

Four
  Try four directions (E, N, W, and S).

Eight
  Try all eight directions.

Height
  Fail the match if the origin object can climb here.

(Height <number>)
  Fail the match if the height here isn't greater than this number.

if







>
>
>












<
<
<
<
<
<







2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330






2331
2332
2333
2334
2335
2336
2337
  is repeated until it no longer matches. If the first word is begin,
  then it must match at least once; if it is if, then it can match zero
  or more times. The match is greedy; it will match as much as possible.

begin
  Begin a block.

Bishop
  Try four directions (NE, NW, SW, and SE).

Climb
  Fail the match if the origin object cannot climb here.

(Climb <number>)
  Fail the match if the height here is greater than this number.

cut
  Discards the most recent choice point.

else
  Delimits alternatives within a block.







Height
  Fail the match if the origin object can climb here.

(Height <number>)
  Fail the match if the height here isn't greater than this number.

if
2351
2352
2353
2354
2355
2356
2357






2358
2359
2360
2361
2362
2363
2364

ObjBottomAt
  Match the object at the bottom of this location.

ObjTopAt
  Match the object at the top of this location.







then
  Ends a block started with begin or if.

Trace
  Used for debugging.









>
>
>
>
>
>







2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367

ObjBottomAt
  Match the object at the bottom of this location.

ObjTopAt
  Match the object at the top of this location.

Queen
  Try all eight directions.

Rook
  Try four directions (E, N, W, and S).

then
  Ends a block started with begin or if.

Trace
  Used for debugging.


Modified exec.c from [d618410326] to [51d82ac75e].

1720
1721
1722
1723
1724
1725
1726













1727
1728
1729
1730
1731
1732
1733
      cp[cpi].dir=d;
      cp[cpi].depth=vstackptr;
      ptr=code[ptr]+2;
      break;
    case OP_BEGIN:
      ptr++;
      break;













    case OP_CLIMB:
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)>objects[obj]->climb) goto fail;
      break;
    case OP_CLIMB_C:
      g=code[ptr++];
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)>g) goto fail;
      break;







>
>
>
>
>
>
>
>
>
>
>
>
>







1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
      cp[cpi].dir=d;
      cp[cpi].depth=vstackptr;
      ptr=code[ptr]+2;
      break;
    case OP_BEGIN:
      ptr++;
      break;
    case OP_BISHOP:
      if(cpi>=MAXCHOICE-4) Throw("Choice overflow");
      d=1;
      cpi+=3;
      cp[cpi].x=x;
      cp[cpi].y=y;
      cp[cpi].depth=vstackptr;
      cp[cpi].ptr=ptr;
      cp[cpi-1]=cp[cpi-2]=cp[cpi];
      cp[cpi].dir=3;
      cp[cpi-1].dir=5;
      cp[cpi-2].dir=7;
      break;
    case OP_CLIMB:
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)>objects[obj]->climb) goto fail;
      break;
    case OP_CLIMB_C:
      g=code[ptr++];
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)>g) goto fail;
      break;
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
      objects[obj]->dir=d;
      break;
    case OP_DIR_EC:
      if(n==VOIDLINK) Throw("No object specified in pattern");
      changed=1;
      objects[n]->dir=d;
      break;
    case OP_EIGHT:
      if(cpi>=MAXCHOICE-8) Throw("Choice overflow");
      d=0;
      cpi+=7;
      cp[cpi].x=x;
      cp[cpi].y=y;
      cp[cpi].depth=vstackptr;
      cp[cpi].ptr=ptr;
      cp[cpi-1]=cp[cpi-2]=cp[cpi-3]=cp[cpi-4]=cp[cpi-5]=cp[cpi-6]=cp[cpi];
      cp[cpi].dir=1;
      cp[cpi-1].dir=2;
      cp[cpi-2].dir=3;
      cp[cpi-3].dir=4;
      cp[cpi-4].dir=5;
      cp[cpi-5].dir=6;
      cp[cpi-6].dir=7;
      break;
    case OP_ELSE:
      ptr--;
      while(code[ptr]==OP_ELSE) ptr=code[ptr+2];
      break;
    case OP_FOUR:
      if(cpi>=MAXCHOICE-4) Throw("Choice overflow");
      d=0;
      cpi+=3;
      cp[cpi].x=x;
      cp[cpi].y=y;
      cp[cpi].depth=vstackptr;
      cp[cpi].ptr=ptr;
      cp[cpi-1]=cp[cpi-2]=cp[cpi];
      cp[cpi].dir=2;
      cp[cpi-1].dir=4;
      cp[cpi-2].dir=6;
      break;
    case OP_HEIGHT:
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)<=objects[obj]->climb) goto fail;
      break;
    case OP_HEIGHT_C:
      g=code[ptr++];
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)<=g) goto fail;
      break;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




<
<
<
<
<
<
<
<
<
<
<
<
<







1759
1760
1761
1762
1763
1764
1765

















1766
1767
1768
1769













1770
1771
1772
1773
1774
1775
1776
      objects[obj]->dir=d;
      break;
    case OP_DIR_EC:
      if(n==VOIDLINK) Throw("No object specified in pattern");
      changed=1;
      objects[n]->dir=d;
      break;

















    case OP_ELSE:
      ptr--;
      while(code[ptr]==OP_ELSE) ptr=code[ptr+2];
      break;













    case OP_HEIGHT:
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)<=objects[obj]->climb) goto fail;
      break;
    case OP_HEIGHT_C:
      g=code[ptr++];
      if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)<=g) goto fail;
      break;
1826
1827
1828
1829
1830
1831
1832

















1833
1834
1835
1836
1837
1838
1839
1840
1841
1842













1843
1844
1845
1846
1847
1848
1849
      break;
    case OP_OBJBOTTOMAT:
      n=obj_bottom_at(x,y);
      break;
    case OP_OBJTOPAT:
      n=obj_top_at(x,y);
      break;

















    case OP_RET:
      if(all) {
        if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow");
        if(n==VOIDLINK) n=obj_bottom_at(x,y);
        Push(OVALUE(n));
        goto fail;
      } else {
        return n==VOIDLINK?obj_bottom_at(x,y):n;
      }
      break;













    case OP_SUB:
      if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow");
      Push(NVALUE(0));
      break;
    case OP_THEN:
      // This opcode does nothing
      break;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










>
>
>
>
>
>
>
>
>
>
>
>
>







1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
      break;
    case OP_OBJBOTTOMAT:
      n=obj_bottom_at(x,y);
      break;
    case OP_OBJTOPAT:
      n=obj_top_at(x,y);
      break;
    case OP_QUEEN:
      if(cpi>=MAXCHOICE-8) Throw("Choice overflow");
      d=0;
      cpi+=7;
      cp[cpi].x=x;
      cp[cpi].y=y;
      cp[cpi].depth=vstackptr;
      cp[cpi].ptr=ptr;
      cp[cpi-1]=cp[cpi-2]=cp[cpi-3]=cp[cpi-4]=cp[cpi-5]=cp[cpi-6]=cp[cpi];
      cp[cpi].dir=1;
      cp[cpi-1].dir=2;
      cp[cpi-2].dir=3;
      cp[cpi-3].dir=4;
      cp[cpi-4].dir=5;
      cp[cpi-5].dir=6;
      cp[cpi-6].dir=7;
      break;
    case OP_RET:
      if(all) {
        if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow");
        if(n==VOIDLINK) n=obj_bottom_at(x,y);
        Push(OVALUE(n));
        goto fail;
      } else {
        return n==VOIDLINK?obj_bottom_at(x,y):n;
      }
      break;
    case OP_ROOK:
      if(cpi>=MAXCHOICE-4) Throw("Choice overflow");
      d=0;
      cpi+=3;
      cp[cpi].x=x;
      cp[cpi].y=y;
      cp[cpi].depth=vstackptr;
      cp[cpi].ptr=ptr;
      cp[cpi-1]=cp[cpi-2]=cp[cpi];
      cp[cpi].dir=2;
      cp[cpi-1].dir=4;
      cp[cpi-2].dir=6;
      break;
    case OP_SUB:
      if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow");
      Push(NVALUE(0));
      break;
    case OP_THEN:
      // This opcode does nothing
      break;

Modified instruc from [41c1a088a9] to [3f9b18c19d].

293
294
295
296
297
298
299
300
301

302
303
304
305
306
307
308
ArraySlice
CopyArray
DotProduct

; Pattern matching
-,=Pattern "P"
-,=PatternS "P*"
-Four
-Eight

-cut

; Inheritance
-Abstract
,Super

; Specials







|
|
>







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
ArraySlice
CopyArray
DotProduct

; Pattern matching
-,=Pattern "P"
-,=PatternS "P*"
-Rook
-Bishop
-Queen
-cut

; Inheritance
-Abstract
,Super

; Specials

Modified instruc.h from [0d28c1603f] to [bdce706361].

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
#define OP_PATTERN_C 35036
#define OP_PATTERN_E 37084
#define OP_PATTERN_EC 39132
#define OP_PATTERNS 32989
#define OP_PATTERNS_C 35037
#define OP_PATTERNS_E 37085
#define OP_PATTERNS_EC 39133
#define OP_FOUR 32990
#define OP_EIGHT 32991

#define OP_CUT 32992
#define OP_ABSTRACT 32993
#define OP_SUPER 32994
#define OP_SUPER_C 35042
#define OP_FUNCTION 32995
#define OP_LOCAL 32996
#define OP_LABEL 32997
#define OP_STRING 32998
#define OP_INT16 32999
#define OP_INT32 33000
#define OP_DISPATCH 33001
#define OP_USERFLAG 33002
#ifdef HEROMESH_CLASS
static const Op_Names op_names[]={
{"*",8486939},
{"+",8421401},
{"+Move",10584238},
{"-",8421402},
{"-Move",10584239},
{"-rot",8421382},
{".",10518528},
{"/",8486940},
{"ANHH",8389394},
{"ARRIVED",8389124},
{"Abstract",8683745},
{"Animate",8421516},
{"AnimateDead",8421517},
{"Arg1",8552571},
{"Arg2",8552572},
{"Arg3",8552573},
{"Array",8683732},
{"ArrayCell",8421592},







|
|
>
|
|
|
|
|
|
|
|
|
|
|
|












|







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
#define OP_PATTERN_C 35036
#define OP_PATTERN_E 37084
#define OP_PATTERN_EC 39132
#define OP_PATTERNS 32989
#define OP_PATTERNS_C 35037
#define OP_PATTERNS_E 37085
#define OP_PATTERNS_EC 39133
#define OP_ROOK 32990
#define OP_BISHOP 32991
#define OP_QUEEN 32992
#define OP_CUT 32993
#define OP_ABSTRACT 32994
#define OP_SUPER 32995
#define OP_SUPER_C 35043
#define OP_FUNCTION 32996
#define OP_LOCAL 32997
#define OP_LABEL 32998
#define OP_STRING 32999
#define OP_INT16 33000
#define OP_INT32 33001
#define OP_DISPATCH 33002
#define OP_USERFLAG 33003
#ifdef HEROMESH_CLASS
static const Op_Names op_names[]={
{"*",8486939},
{"+",8421401},
{"+Move",10584238},
{"-",8421402},
{"-Move",10584239},
{"-rot",8421382},
{".",10518528},
{"/",8486940},
{"ANHH",8389394},
{"ARRIVED",8389124},
{"Abstract",8683746},
{"Animate",8421516},
{"AnimateDead",8421517},
{"Arg1",8552571},
{"Arg2",8552572},
{"Arg3",8552573},
{"Array",8683732},
{"ArrayCell",8421592},
476
477
478
479
480
481
482

483
484
485
486
487
488
489
{"BOOOM",8389410},
{"BOUNCE",8389415},
{"BRRREEET",8389396},
{"BRRRT",8389395},
{"BUZZER",8389420},
{"BWEEP",8389397},
{"Background",8683650},

{"Broadcast",10518671},
{"BroadcastAnd",8421520},
{"BroadcastAndEx",8421521},
{"BroadcastEx",10518675},
{"BroadcastList",8421524},
{"BroadcastListEx",8421525},
{"BroadcastSum",8421526},







>







477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
{"BOOOM",8389410},
{"BOUNCE",8389415},
{"BRRREEET",8389396},
{"BRRRT",8389395},
{"BUZZER",8389420},
{"BWEEP",8389397},
{"Background",8683650},
{"Bishop",8683743},
{"Broadcast",10518671},
{"BroadcastAnd",8421520},
{"BroadcastAndEx",8421521},
{"BroadcastEx",10518675},
{"BroadcastList",8421524},
{"BroadcastListEx",8421525},
{"BroadcastSum",8421526},
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
{"Dir",8618050},
{"Distance",9142342},
{"Done",8618099},
{"DotProduct",8421595},
{"E",9437184},
{"END_TURN",8389139},
{"EditorHelp",8683657},
{"Eight",8683743},
{"F",9437192},
{"FAROUT",8389421},
{"FFFFTT",8389399},
{"FLOATED",8389132},
{"FROG",8389383},
{"Finished",8552577},
{"FlushClass",8421535},
{"FlushObj",8487072},
{"Four",8683742},
{"From",8421498},
{"GLASS",8389379},
{"GLISSANT",8389419},
{"GetArray",8421589},
{"GetInventory",8421537},
{"HAWK",8389425},
{"HEARTBEAT",8389407},







<








<







528
529
530
531
532
533
534

535
536
537
538
539
540
541
542

543
544
545
546
547
548
549
{"Dir",8618050},
{"Distance",9142342},
{"Done",8618099},
{"DotProduct",8421595},
{"E",9437184},
{"END_TURN",8389139},
{"EditorHelp",8683657},

{"F",9437192},
{"FAROUT",8389421},
{"FFFFTT",8389399},
{"FLOATED",8389132},
{"FROG",8389383},
{"Finished",8552577},
{"FlushClass",8421535},
{"FlushObj",8487072},

{"From",8421498},
{"GLASS",8389379},
{"GLISSANT",8389419},
{"GetArray",8421589},
{"GetInventory",8421537},
{"HAWK",8389425},
{"HEARTBEAT",8389407},
622
623
624
625
626
627
628

629
630
631
632
633
634
635
636

637
638
639
640
641
642
643
{"P*",8880349},
{"PLAYERMOVING",8389133},
{"POSTINIT",8389138},
{"POUR",8389377},
{"POWER",8389386},
{"Player",8487029},
{"PopUp",8421563},

{"Quiz",8683653},
{"R",9437198},
{"RATCHET1",8389418},
{"RATCHET2",8389412},
{"RATTLE",8389403},
{"RB",9437197},
{"RF",9437199},
{"Rel",8487101},

{"S",9437190},
{"SE",9437191},
{"SMALL_POP",8389389},
{"SPLASH",8389376},
{"STEAM",8389424},
{"STOP",8388608},
{"SUBS",8683659},







>








>







622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
{"P*",8880349},
{"PLAYERMOVING",8389133},
{"POSTINIT",8389138},
{"POUR",8389377},
{"POWER",8389386},
{"Player",8487029},
{"PopUp",8421563},
{"Queen",8683744},
{"Quiz",8683653},
{"R",9437198},
{"RATCHET1",8389418},
{"RATCHET2",8389412},
{"RATTLE",8389403},
{"RB",9437197},
{"RF",9437199},
{"Rel",8487101},
{"Rook",8683742},
{"S",9437190},
{"SE",9437191},
{"SMALL_POP",8389389},
{"SPLASH",8389376},
{"STEAM",8389424},
{"STOP",8388608},
{"SUBS",8683659},
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
{"Shape",8618047},
{"ShapeDir",8618070},
{"Sharp",8618069},
{"Shovable",8618071},
{"Sound",8421570},
{"Stealthy",8618096},
{"Strength",9142354},
{"Super",8487138},
{"Synchronize",8421571},
{"TAHTASHH",8389409},
{"THMP_thmp",8389405},
{"THWIT",8389384},
{"TICK",8389391},
{"Target",8487108},
{"Temperature",9142333},







|







654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
{"Shape",8618047},
{"ShapeDir",8618070},
{"Sharp",8618069},
{"Shovable",8618071},
{"Sound",8421570},
{"Stealthy",8618096},
{"Strength",9142354},
{"Super",8487139},
{"Synchronize",8421571},
{"TAHTASHH",8389409},
{"THMP_thmp",8389405},
{"THWIT",8389384},
{"TICK",8389391},
{"Target",8487108},
{"Temperature",9142333},
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
{"bor",8421412},
{"bxor",8421413},
{"c?",8421429},
{"case",8683542},
{"chain",8421528},
{"clear",8421586},
{"count",8421585},
{"cut",8683744},
{"cz?",8421430},
{"dup",8421377},
{"else",8683530},
{"eq",8421420},
{"eq2",8421421},
{"flip",8421584},
{"for",8683537},







|







730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
{"bor",8421412},
{"bxor",8421413},
{"c?",8421429},
{"case",8683542},
{"chain",8421528},
{"clear",8421586},
{"count",8421585},
{"cut",8683745},
{"cz?",8421430},
{"dup",8421377},
{"else",8683530},
{"eq",8421420},
{"eq2",8421421},
{"flip",8421584},
{"for",8683537},
777
778
779
780
781
782
783
784
785
{"then",8683531},
{"tmark",8421580},
{"tuck",8421380},
{"uniq",8421587},
{"until",8683534},
{"while",8683535},
};
#define N_OP_NAMES 335
#endif







|

779
780
781
782
783
784
785
786
787
{"then",8683531},
{"tmark",8421580},
{"tuck",8421380},
{"uniq",8421587},
{"until",8683534},
{"while",8683535},
};
#define N_OP_NAMES 336
#endif