Free Hero Mesh

Check-in [a724f44255]
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 (attribute userflags) syntax, in order to access bit patterns of user flags directly in class codes (e.g. so that they can be passed to subroutines, etc).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a724f442555a817273ad313e0690c954d216782d
User & Date: user on 2022-01-25 06:31:07
Other Links: manifest | tags
Context
2022-01-29
05:55
Implement the Sound instruction. (There are still a few problems such as clicks at the end of some sound effects, and a few problems with the sound test menu. However, it mostly works, now.) check-in: d15195a921 user: user tags: trunk
2022-01-25
06:31
Implement (attribute userflags) syntax, in order to access bit patterns of user flags directly in class codes (e.g. so that they can be passed to subroutines, etc). check-in: a724f44255 user: user tags: trunk
2022-01-21
05:17
Implement loading standard sounds, and working in sound test menu. (Free replacements for standard sounds are not yet available, though.) check-in: b43c838ca3 user: user tags: trunk
Changes

Modified class.c from [cfa005344c] to [633629bcf7].

1580
1581
1582
1583
1584
1585
1586


























1587
1588
1589
1590
1591
1592
1593
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







          }
          tokenv=x;
          goto numeric;
        case OP_CASE:
          cl->codes[ptr++]=OP_CASE;
          ptr=peep=case_block(cla,ptr,hash);
          break;
        case OP_MISC4: y=0x000; goto uflags;
        case OP_MISC4_C: y=0x100; goto uflags;
        case OP_MISC5: y=0x020; goto uflags;
        case OP_MISC5_C: y=0x120; goto uflags;
        case OP_MISC6: y=0x040; goto uflags;
        case OP_MISC6_C: y=0x140; goto uflags;
        case OP_MISC7: y=0x060; goto uflags;
        case OP_MISC7_C: y=0x160; goto uflags;
        case OP_COLLISIONLAYERS: y=0x080; goto uflags;
        case OP_COLLISIONLAYERS_C: y=0x180; goto uflags;
        uflags:
          x=0;
          for(;;) {
            nxttok();
            if(tokent==TF_CLOSE) break;
            if(Tokenf(TF_MACRO) || !Tokenf(TF_NAME) || tokenv!=OP_USERFLAG) ParseError("User flag or close parenthesis expected\n");
            tokenv=look_hash(glohash,HASH_SIZE,0x1000,0x10FF,0,"user flags");
            if(!tokenv) ParseError("User flag ^%s not defined\n",tokenstr);
            if((tokenv^y)&0xE0) {
              if(y&0x100) ParseError("User flag ^%s belongs to the wrong attribute\n",tokenstr);
            } else {
              if(Tokenf(TF_COMMA)) x&=~(1<<(tokenv&31)); else x|=1<<(tokenv&31);
            }
          }
          tokenv=x;
          goto numeric;
        default:
          ParseError("Invalid parenthesized instruction\n");
      }
    } else if(tokent==TF_CLOSE) {
      if(flowdepth) ParseError("Unterminated flow control structure\n");
      if(peep<ptr && cl->codes[ptr-1]==OP_RET) break;
      if(peep<ptr && (cl->codes[ptr-1]&0xFF00)==0x1E00) break;

Modified class.doc from [e20d997f8f] to [28dfcc240c].

1113
1114
1115
1116
1117
1118
1119











1120
1121
1122
1123
1124
1125
1126
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137







+
+
+
+
+
+
+
+
+
+
+







=<label>
  Go to a label. (Put the colon after the equal sign; this instruction,
  and the one below, are using a double sigil.)

,<label>
  Call a label as a subroutine; when it returns, comes back to here.

(<attribute> <userflags...>)  ( -- number )
  The attribute must be one of Misc4, Misc5, Misc6, Misc7, or
  CollisionLayers, and may optionally be preceded by a comma. This
  produces the number with all of the specified bits set only. If the
  attribute is preceded by a comma, then it is an error to specify any
  user flags not assigned to that variable, otherwise any user flags
  that do not belong are ignored. Any user flag may optionally be
  preceded by a comma, and may occur multiple times; only the last
  instance of each is used. If the last instance of a flag has a
  comma then that bit is clear, if without a comma then it is set.

.  ( x -- )

+  ( in1 in2 -- out )
  Add two numbers together.

-  ( in1 in2 -- out )
  Subtract in2 from in1.