Free Hero Mesh

Check-in [41eca04785]
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 ,if ,while ,until instructions (conditions with keeping the value in the stack if it is nonzero)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 41eca047850687322601a0ced6d35bb64acdc24d
User & Date: user on 2023-08-04 23:03:10
Other Links: manifest | tags
Context
2023-08-06
19:44
Add some additional checks to JumpTo for Compatible classes only. This fixes three levels, one each in HEARTS1, HEARTS4, and SUPERHRO. check-in: 22d38aadb5 user: user tags: trunk
2023-08-04
23:03
Implement ,if ,while ,until instructions (conditions with keeping the value in the stack if it is nonzero) check-in: 41eca04785 user: user tags: trunk
18:15
Implement the / and ,/ commands in pattern blocks. check-in: 9930393c98 user: user tags: trunk
Changes

Modified TODO from [80bfdead8a] to [76519b42a4].

1
2
3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
* Sound effects
  * Compressed wave sounds (?)
  * Numeric sounds (?)
  * Band limited synthesis
* Game engine features
  * String data (partially implemented)
  * A ,PopUp command to use a popup with arguments starting from a mark
  * Possibility to define auto-generation levels mode
  * Popup inventory list (with optional possibility of choice) (?)
  * Playfield array


* Editor
  * Mouse dragging
* Deal better with allowing to skip past corrupted levels
* Picture editor/loading
  * Allowing more altimages
* Puzzle set catalog format (using with internet; a separate program)
* Inventory/replay hybrid view










>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
* Sound effects
  * Compressed wave sounds (?)
  * Numeric sounds (?)
  * Band limited synthesis
* Game engine features
  * String data (partially implemented)
  * A ,PopUp command to use a popup with arguments starting from a mark
  * Possibility to define auto-generation levels mode
  * Popup inventory list (with optional possibility of choice) (?)
  * Playfield array
  * Replacement patterns
  * MID_TURN message / custom trigger phase
* Editor
  * Mouse dragging
* Deal better with allowing to skip past corrupted levels
* Picture editor/loading
  * Allowing more altimages
* Puzzle set catalog format (using with internet; a separate program)
* Inventory/replay hybrid view
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

46
47



48
49
50
51
52
53
54
* VCR mode
* Command-line switch for batch export levels
* SQL
  * Implement the GROUP column in the CLASSES table
  * Allow multiple SQL statements in one binding
* Fonts/text
  * More code pages
  * Large fonts (possibly: width 8 or 16, height 8-32)
  * Multibyte encodings (e.g. EUC-JP)
* Branching replay recording
* Slow movement displaying state between triggers
* Warning if file changed when uncommited data exists in the cache database
* Cache database option to be keyed by hash
* Composite puzzle set format (implemented)
  * Optional hypertext help
  * Compressed class definitions (?)

* Option to auto display level titles
* Option to use a separate solution file



* Multiuser scoring within one computer system (optional capability)
* Launcher menu (optional; separate program)
* Implement the (obsolete?) ImageSeq and ImageLoop commands (used in DESERT3)
* Testing
  * Bizarro world
  * Connection movement (it is partially tested, already)
  * Sweep, SweepEx, HitMe







|
|







>
|
|
>
>
>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
* VCR mode
* Command-line switch for batch export levels
* SQL
  * Implement the GROUP column in the CLASSES table
  * Allow multiple SQL statements in one binding
* Fonts/text
  * More code pages
  * Large fonts
  * Multibyte encodings (TRON code)
* Branching replay recording
* Slow movement displaying state between triggers
* Warning if file changed when uncommited data exists in the cache database
* Cache database option to be keyed by hash
* Composite puzzle set format (implemented)
  * Optional hypertext help
  * Compressed class definitions (?)
* User interface options
  * Auto display level titles
  * Separate solution file
  * Start on level select screen
  * Start on most recently accessed level
  * Start on first unsolved level
* Multiuser scoring within one computer system (optional capability)
* Launcher menu (optional; separate program)
* Implement the (obsolete?) ImageSeq and ImageLoop commands (used in DESERT3)
* Testing
  * Bizarro world
  * Connection movement (it is partially tested, already)
  * Sweep, SweepEx, HitMe

Modified class.c from [133b55b71e] to [53fa966b10].

1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
            if(!s) fatal("Allocation failed\n");
            s->id=tokenv|0x8000;
            s->addr=ptr-1;
            s->next=labelstack;
            labelstack=s;
          }
          break;
        case OP_IF: case OP_OR: case OP_AND: case OP_FORK:
          AddInst(tokenv);
          FlowPush(OP_IF);
          peep=++ptr;
          break;
        case OP_THEN:
          FlowPop(OP_IF);
          cl->codes[flowptr[flowdepth]]=peep=ptr;







|







1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
            if(!s) fatal("Allocation failed\n");
            s->id=tokenv|0x8000;
            s->addr=ptr-1;
            s->next=labelstack;
            labelstack=s;
          }
          break;
        case OP_IF: case OP_IF_C: case OP_OR: case OP_AND: case OP_FORK:
          AddInst(tokenv);
          FlowPush(OP_IF);
          peep=++ptr;
          break;
        case OP_THEN:
          FlowPop(OP_IF);
          cl->codes[flowptr[flowdepth]]=peep=ptr;
1659
1660
1661
1662
1663
1664
1665




1666
1667
1668
1669





1670
1671
1672
1673
1674
1675
1676
          FlowPop(OP_BEGIN);
          AddInst2(OP_GOTO,flowptr[flowdepth]);
          break;
        case OP_UNTIL:
          FlowPop(OP_BEGIN);
          AddInst2(OP_IF,flowptr[flowdepth]);
          break;




        case OP_WHILE:
          AddInst(OP_IF);
          FlowPush(OP_WHILE);
          peep=++ptr;





          break;
        case OP_REPEAT:
          FlowPop(OP_WHILE);
          x=flowptr[flowdepth];
          FlowPop(OP_BEGIN);
          AddInst2(OP_GOTO,flowptr[flowdepth]);
          cl->codes[x]=ptr;







>
>
>
>




>
>
>
>
>







1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
          FlowPop(OP_BEGIN);
          AddInst2(OP_GOTO,flowptr[flowdepth]);
          break;
        case OP_UNTIL:
          FlowPop(OP_BEGIN);
          AddInst2(OP_IF,flowptr[flowdepth]);
          break;
        case OP_UNTIL_C:
          FlowPop(OP_BEGIN);
          AddInst2(OP_IF_C,flowptr[flowdepth]);
          break;
        case OP_WHILE:
          AddInst(OP_IF);
          FlowPush(OP_WHILE);
          peep=++ptr;
          break;
        case OP_WHILE_C:
          AddInst(OP_IF_C);
          FlowPush(OP_WHILE);
          peep=++ptr;
          break;
        case OP_REPEAT:
          FlowPop(OP_WHILE);
          x=flowptr[flowdepth];
          FlowPop(OP_BEGIN);
          AddInst2(OP_GOTO,flowptr[flowdepth]);
          cl->codes[x]=ptr;

Modified class.doc from [c2dbc07def] to [792876c921].

2232
2233
2234
2235
2236
2237
2238




2239
2240
2241
2242
2243
2244
2245
mbegin <body> repeat  ( -- any ) ( -- )
  The "mbegin" instruction is a shortcut for "begin tmark while", and it has
  the same behaviour.

or <body> then  ( any -- any )
  Takes a value from the stack. If it is true, leaves it there and skips the
  body, otherwise removes it and executes the body.






=== Case blocks ===

A case block consists of (case) with the cases listed inside of the () after
the word "case". Each case consists of two tokens inside of their own
parentheses. The first token may be any one of:







>
>
>
>







2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
mbegin <body> repeat  ( -- any ) ( -- )
  The "mbegin" instruction is a shortcut for "begin tmark while", and it has
  the same behaviour.

or <body> then  ( any -- any )
  Takes a value from the stack. If it is true, leaves it there and skips the
  body, otherwise removes it and executes the body.

Any of the keywords "if", "while", and "until" in the above constructions
can optionally have a comma prefix; if they do, then the value remains on
the top of the stack if it is true, and is only popped if it is zero.


=== Case blocks ===

A case block consists of (case) with the cases listed inside of the () after
the word "case". Each case consists of two tokens inside of their own
parentheses. The first token may be any one of:

Modified exec.c from [fa70af0dc1] to [1c5a8555ba].

3343
3344
3345
3346
3347
3348
3349

3350
3351
3352
3353
3354
3355
3356
    case OP_HEIGHT_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->height=t1.u; break;
    case OP_HEIGHT_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->height=t1.u&0xFFFF; break;
    case OP_HEIGHT_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->height=t1.u; break;
    case OP_HEIGHT_EC16: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->height=t1.u&0xFFFF; break;
    case OP_HEIGHTAT: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(height_at(t1.u,t2.u))); break;
    case OP_HITME: NoIgnore(); StackReq(1,1); t1=Pop(); Numeric(t1); i=v_hitme(obj,t1.u); break;
    case OP_IF: StackReq(1,0); if(v_bool(Pop())) ptr++; else ptr=code[ptr]; break;

    case OP_IGNOREKEY: if(current_key) key_ignored=all_flushed=1; break;
    case OP_IMAGE: StackReq(0,1); Push(NVALUE(o->image)); break;
    case OP_IMAGE_C: StackReq(1,1); Push(GetVariableOf(image,NVALUE)); break;
    case OP_IMAGE_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->image=t1.u; break;
    case OP_IMAGE_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->image=t1.u; break;
    case OP_IN: StackReq(2,1); i=v_in(); Push(NVALUE(i?1:0)); break;
    case OP_INERTIA: StackReq(0,1); Push(NVALUE(o->inertia)); break;







>







3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
    case OP_HEIGHT_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->height=t1.u; break;
    case OP_HEIGHT_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->height=t1.u&0xFFFF; break;
    case OP_HEIGHT_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->height=t1.u; break;
    case OP_HEIGHT_EC16: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->height=t1.u&0xFFFF; break;
    case OP_HEIGHTAT: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(height_at(t1.u,t2.u))); break;
    case OP_HITME: NoIgnore(); StackReq(1,1); t1=Pop(); Numeric(t1); i=v_hitme(obj,t1.u); break;
    case OP_IF: StackReq(1,0); if(v_bool(Pop())) ptr++; else ptr=code[ptr]; break;
    case OP_IF_C: StackReq(1,1); t1=Pop(); if(v_bool(t1)) { ptr++; Push(t1); } else ptr=code[ptr]; break;
    case OP_IGNOREKEY: if(current_key) key_ignored=all_flushed=1; break;
    case OP_IMAGE: StackReq(0,1); Push(NVALUE(o->image)); break;
    case OP_IMAGE_C: StackReq(1,1); Push(GetVariableOf(image,NVALUE)); break;
    case OP_IMAGE_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->image=t1.u; break;
    case OP_IMAGE_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->image=t1.u; break;
    case OP_IN: StackReq(2,1); i=v_in(); Push(NVALUE(i?1:0)); break;
    case OP_INERTIA: StackReq(0,1); Push(NVALUE(o->inertia)); break;

Modified instruc from [ff5a0f1f93] to [2fda304d27].

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
tuck
rot
rotback "-rot"
pick
over

; Flow controls
-if
-else
-then
-begin
-again
-until
-while
-repeat
-for
-next
*goto
*CallSub
ret
retnz







|




|
|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
tuck
rot
rotback "-rot"
pick
over

; Flow controls
-,if
-else
-then
-begin
-again
-,until
-,while
-repeat
-for
-next
*goto
*CallSub
ret
retnz

Modified instruc.h from [ad766f3299] to [ee3354bb1f].

12
13
14
15
16
17
18

19
20
21
22
23

24

25
26
27
28
29
30
31
#define OP_NIP 32771
#define OP_TUCK 32772
#define OP_ROT 32773
#define OP_ROTBACK 32774
#define OP_PICK 32775
#define OP_OVER 32776
#define OP_IF 32777

#define OP_ELSE 32778
#define OP_THEN 32779
#define OP_BEGIN 32780
#define OP_AGAIN 32781
#define OP_UNTIL 32782

#define OP_WHILE 32783

#define OP_REPEAT 32784
#define OP_FOR 32785
#define OP_NEXT 32786
#define OP_GOTO 32787
#define OP_CALLSUB 32788
#define OP_RET 32789
#define OP_RETNZ 32790







>





>

>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define OP_NIP 32771
#define OP_TUCK 32772
#define OP_ROT 32773
#define OP_ROTBACK 32774
#define OP_PICK 32775
#define OP_OVER 32776
#define OP_IF 32777
#define OP_IF_C 34825
#define OP_ELSE 32778
#define OP_THEN 32779
#define OP_BEGIN 32780
#define OP_AGAIN 32781
#define OP_UNTIL 32782
#define OP_UNTIL_C 34830
#define OP_WHILE 32783
#define OP_WHILE_C 34831
#define OP_REPEAT 32784
#define OP_FOR 32785
#define OP_NEXT 32786
#define OP_GOTO 32787
#define OP_CALLSUB 32788
#define OP_RET 32789
#define OP_RETNZ 32790
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
{"eq2",8421428},
{"exec",8486942},
{"flip",8421615},
{"for",8683537},
{"fork",8683547},
{"ge",8486968},
{"gt",8486966},
{"if",8683529},
{"in",8421612},
{"is",8421434},
{"land",8421423},
{"le",8486969},
{"link",8683549},
{"lnot",8421426},
{"lor",8421424},







|







849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
{"eq2",8421428},
{"exec",8486942},
{"flip",8421615},
{"for",8683537},
{"fork",8683547},
{"ge",8486968},
{"gt",8486966},
{"if",8749065},
{"in",8421612},
{"is",8421434},
{"land",8421423},
{"le",8486969},
{"link",8683549},
{"lnot",8421426},
{"lor",8421424},
886
887
888
889
890
891
892
893
894
895
896
897
{"rtn",8683548},
{"s?",8421439},
{"swap",8421378},
{"then",8683531},
{"tmark",8421611},
{"tuck",8421380},
{"uniq",8421618},
{"until",8683534},
{"while",8683535},
};
#define N_OP_NAMES 374
#endif







|
|



889
890
891
892
893
894
895
896
897
898
899
900
{"rtn",8683548},
{"s?",8421439},
{"swap",8421378},
{"then",8683531},
{"tmark",8421611},
{"tuck",8421380},
{"uniq",8421618},
{"until",8749070},
{"while",8749071},
};
#define N_OP_NAMES 374
#endif