2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
|
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
|
+
+
-
|
}
static void parse_order_block(void) {
// OP_MISC1, OP_MISC1_C, etc = properties (_C=reverse)
// 0x1000...0x10FF = Have flag
// OP_RET = end of block
Uint16 beg,ptr;
ParseError("(Not implemented yet)\n"); //TODO: remove this when it is implemented in exec.c too
orders=malloc(0x4000*sizeof(Uint16));
if(!orders) fatal("Allocation failed\n");
nxttok();
if(tokent==TF_INT) {
if(tokenv<1 || tokenv>254) ParseError("Order number out of range\n");
beg=ptr=tokenv;
nxttok();
} else {
beg=ptr=128;
}
while(tokent!=TF_CLOSE) {
if(tokent!=TF_OPEN) ParseError("Open or close parenthesis expected\n");
if(ptr>=0x3FFD) ParseError("Out of order memory\n");
nxttok();
if(Tokenf(TF_MACRO|TF_COMMA|TF_EQUAL) || !Tokenf(TF_NAME)) ParseError("Unexpected token in (Order) block\n");
orders[++norders]=ptr;
if(norders==beg) ParseError("Too many orders\n");
orders[norders++]=ptr;
switch(tokenv) {
case OP_INPUT: case OP_PLAYER:
orders[ptr++]=tokenv;
break;
case OP_USERFLAG:
tokenv=look_hash(glohash,HASH_SIZE,0x1000,0x10FF,0,"user flags");
if(!tokenv) ParseError("User flag ^%s not defined\n",tokenstr);
|
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
|
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
|
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
orders[ptr++]=OP_RET;
}
if(!norders) ParseError("Empty (Order) block\n");
orders=realloc(orders,ptr*sizeof(Uint16))?:orders;
}
static void set_class_orders(void) {
//TODO
int i,j,k;
for(i=1;i<undef_class;i++) if(classes[i] && !(classes[i]->cflags&(CF_GROUP|CF_NOCLASS2))) {
for(j=1;j<norders;j++) {
k=orders[orders[j]];
switch(k) {
case 0x1000 ... 0x101F: if(classes[i]->misc4&(1UL<<(k&0x1F))) goto found; break;
case 0x1020 ... 0x103F: if(classes[i]->misc5&(1UL<<(k&0x1F))) goto found; break;
case 0x1040 ... 0x105F: if(classes[i]->misc6&(1UL<<(k&0x1F))) goto found; break;
case 0x1060 ... 0x107F: if(classes[i]->misc7&(1UL<<(k&0x1F))) goto found; break;
case 0x1080 ... 0x1087: if(classes[i]->collisionLayers&(1L<<(k&0x07))) goto found; break;
case OP_PLAYER: if(classes[i]->cflags&CF_PLAYER) goto found; break;
case OP_INPUT: if(classes[i]->cflags&CF_INPUT) goto found; break;
}
continue;
found: classes[i]->order=j; break;
}
}
}
void load_classes(void) {
int i;
int gloptr=0;
Hash*glolocalhash;
char*nam=sqlite3_mprintf("%s.class",basefilename);
|
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
|
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
|
-
+
|
nxttok();
if(tokent!=TF_CLOSE) ParseError("Expected close parenthesis\n");
break;
case OP_MISC4: define_user_flags(0x1000,0x101F); break;
case OP_MISC5: define_user_flags(0x1020,0x103F); break;
case OP_MISC6: define_user_flags(0x1040,0x105F); break;
case OP_MISC7: define_user_flags(0x1060,0x107F); break;
case OP_COLLISIONLAYERS: define_user_flags(0x1C80,0x1C87); break;
case OP_COLLISIONLAYERS: define_user_flags(0x1080,0x1087); break;
case OP_CODEPAGE:
nxttok();
if(tokent!=TF_INT || tokenv<1 || tokenv>65535) ParseError("Number from 1 to 65535 expected\n");
set_code_page(tokenv);
nxttok();
if(tokent!=TF_CLOSE) ParseError("Expected close parenthesis\n");
break;
|