Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [cc0a42cded]:

To Artifact [4bcfc3b7e0]:


2225
2226
2227
2228
2229
2230
2231
2232

2233
2234
2235
2236
2237
2238
2239
2225
2226
2227
2228
2229
2230
2231

2232
2233
2234
2235
2236
2237
2238
2239







-
+







    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");
    switch(tokenv) {
      case OP_INPUT: case OP_PLAYER: case OP_CONTROL:
      case OP_INPUT: case OP_PLAYER: case OP_CONTROL: case 0x4000 ... 0x7FFF:
        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);
        orders[ptr++]=tokenv;
        break;
2251
2252
2253
2254
2255
2256
2257

2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271

2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288








2289
2290
2291
2292
2293
2294
2295
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271

2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304







+













-
+

















+
+
+
+
+
+
+
+







        case OP_MISC6: case OP_MISC6_C:
        case OP_MISC7: case OP_MISC7_C:
        case OP_TEMPERATURE: case OP_TEMPERATURE_C:
        case OP_DENSITY: case OP_DENSITY_C:
        case OP_XLOC: case OP_XLOC_C:
        case OP_YLOC: case OP_YLOC_C:
        case OP_IMAGE: case OP_IMAGE_C:
        case 0xC000 ... 0xFFFF:
          orders[ptr++]=tokenv;
          break;
        default: ParseError("Unexpected token in (Order) block\n");
      }
    }
    orders[ptr++]=OP_RET;
    nxttok();
  }
  if(!norders) ParseError("Empty (Order) block\n");
  orders=realloc(orders,ptr*sizeof(Uint16))?:orders;
}

static void set_class_orders(void) {
  int i,j,k;
  int i,j,k,m;
  if(main_options['C']) {
    for(j=1;j<=norders;j++) {
      printf("Order %d =",j);
      k=orders[j];
      while(orders[k]!=OP_RET) printf(" %04X",orders[k++]);
      putchar('\n');
    }
  }
  for(i=1;i<undef_class;i++) if(classes[i] && (classes[i]->nmsg || classes[0]->nmsg) && !(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 0x4000 ... 0x7FFF:
          if(i+0x4000==k) goto found;
          m=i;
          while(m && classes[m]->codes && classes[m]->codes[0]==OP_SUPER) {
            if(classes[m]->codes[1]+0x4000==k) goto found;
            m=classes[m]->codes[1];
          }
          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;
        case OP_CONTROL: if(i==control_class) goto found; break;
      }
      continue;
      found:
      classes[i]->order=j;