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 [0a4452237b]:

To Artifact [170c8e3f92]:


48
49
50
51
52
53
54

55
56
57
58
59
60
61
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62







+







Uint8 inv_back_color=9;
char**stringpool;
AnimationSlot anim_slot[8];
Uint8 keymask[256/8];
Uint16 array_size;
Uint16*orders;
Uint8 norders;
Uint16 control_class;

#define HASH_SIZE 8888
#define LOCAL_HASH_SIZE 5555
typedef struct {
  Uint16 id;
  char*txt;
} Hash;
2133
2134
2135
2136
2137
2138
2139
2140

2141
2142
2143
2144
2145
2146
2147
2134
2135
2136
2137
2138
2139
2140

2141
2142
2143
2144
2145
2146
2147
2148







-
+







    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_INPUT: case OP_PLAYER: case OP_CONTROL:
        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;
2184
2185
2186
2187
2188
2189
2190

2191
2192
2193
2194
2195
2196
2197
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199







+







        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;
        case OP_CONTROL: if(i==control_class) goto found; break;
      }
      continue;
      found: classes[i]->order=j; break;
    }
  }
}

2338
2339
2340
2341
2342
2343
2344







2345
2346
2347
2348
2349
2350
2351
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360







+
+
+
+
+
+
+







          nxttok();
          if(tokent!=TF_CLOSE) ParseError("Expected close parenthesis\n");
          break;
        case OP_ORDER:
          if(norders) ParseError("Extra (Order) block\n");
          parse_order_block();
          break;
        case OP_CONTROL:
          if(control_class) ParseError("Extra (Control) block\n");
          strcpy(tokenstr,"(Control)");
          control_class=look_class_name();
          if(!(classes[control_class]->cflags&CF_NOCLASS1)) ParseError("Conflicting definition of (Control) class\n");
          class_definition(control_class,vst);
          break;
        default:
          ParseError("Invalid top level definition: %s\n",tokenstr);
      }
    } else {
      ParseError("Invalid top level definition\n");
    }
  }
2372
2373
2374
2375
2376
2377
2378




2379
2380
2381
2382
2383
2384
2385
2386
2387
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400







+
+
+
+









    } else {
      free(glohash[i].txt);
    }
  }
  if(vst) sqlite3_finalize(vst);
  free(glohash);
  for(i=1;i<undef_class;i++) if(classes[i] && (classes[i]->cflags&CF_NOCLASS1)) fatal("Class $%s mentioned but not defined\n",classes[i]->name);
  if(control_class) {
    if(classes[control_class]->nimages) fatal("Images are not allowed in Control class");
    if(classes[control_class]->cflags&CF_GROUP) fatal("Control class is not allowed to be Abstract");
  }
  if(macros) for(i=0;i<MAX_MACRO;i++) if(macros[i]) free_macro(macros[i]);
  free(macros);
  if(array_size) {
    array_data=malloc(array_size*sizeof(Value));
    if(!array_data) fatal("Array allocation failed\n");
  }
  if(norders) set_class_orders();
  fprintf(stderr,"Done\n");
}