Index: main.c ================================================================== --- main.c +++ main.c @@ -179,10 +179,22 @@ sqlite3_bind_blob64(st,4,data,sz,0); while((e=sqlite3_step(st))==SQLITE_ROW); if(e!=SQLITE_DONE) fatal("SQL error (%d): %s\n",e,sqlite3_errmsg(userdb)); sqlite3_finalize(st); } + +static void load_level_index(void) { + long sz; + int i; + unsigned char*data=read_lump(0,LUMP_LEVEL_IDX,&sz,0); + if(!data) return; + if(sz>65536) fatal("Too many levels\n"); + level_index=malloc((level_nindex=sz>>1)*sizeof(Uint16)); + if(!level_index) fatal("Allocation failed\n"); + for(i=0;i=0?read_lump(FIL_LEVEL,lvl,&sz,0):0; @@ -296,10 +308,17 @@ } // skip level strings for now if(p>end) goto bad1; free(buf); level_id=lvl; + level_ord=0; + if(level_index) { + for(i=0;i