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 [d47c90633f]:

To Artifact [fed1a85264]:


197
198
199
200
201
202
203

204
205




206
207
208
209
210
211
212
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217







+


+
+
+
+







const char*load_level(int lvl) {
  // Load level by ID. Returns null pointer if successful, or an error message if it failed.
  long sz=0;
  unsigned char*buf=lvl>=0?read_lump(FIL_LEVEL,lvl,&sz,0):0;
  unsigned char*p=buf;
  unsigned char*end=buf+sz;
  int i,n,x,y,z;
  Uint16 lo=0;
  Uint32 o;
  Uint32 mru[2];
  if(lvl<0 && level_index && -lvl<=level_nindex) {
    lo=-lvl;
    lvl=level_index[~lvl];
  }
  if(lvl<0) return "Invalid level ID";
  if(!buf) return "Cannot find level";
  free(level_title);
  level_title=0;
  annihilate();
  generation_number=TY_MAXTYPE+1;
  level_version=p[0]|(p[1]<<8);
306
307
308
309
310
311
312
313
314


315
316
317
318
319
320
321
311
312
313
314
315
316
317


318
319
320
321
322
323
324
325
326







-
-
+
+







      }
    }
  }
  // skip level strings for now
  if(p>end) goto bad1;
  free(buf);
  level_id=lvl;
  level_ord=0;
  if(level_index) {
  level_ord=lo;
  if(level_index && !lo) {
    for(i=0;i<level_nindex;i++) if(level_index[i]==lvl) {
      level_ord=i+1;
      break;
    }
  }
  return 0;
bad1: