diff --git a/src/deh_lua.c b/src/deh_lua.c index c056db82a7ca65c7bb9c1ba363708ce5880d253f..b73479263ff57653925e0b4df47a8e555d7f9bc4 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -59,23 +59,14 @@ static inline int lib_freeslot(lua_State *L) } else if (fastcmp(type, "SPR")) { - char wad; spritenum_t j; - lua_getfield(L, LUA_REGISTRYINDEX, "WAD"); - wad = (char)lua_tointeger(L, -1); - lua_pop(L, 1); for (j = SPR_FIRSTFREESLOT; j <= SPR_LASTFREESLOT; j++) { if (used_spr[(j-SPR_FIRSTFREESLOT)/8] & (1<<(j%8))) - { - if (!sprnames[j][4] && memcmp(sprnames[j],word,4)==0) - sprnames[j][4] = wad; continue; // Already allocated, next. - } // Found a free slot! CONS_Printf("Sprite SPR_%s allocated.\n",word); strncpy(sprnames[j],word,4); - //sprnames[j][4] = 0; used_spr[(j-SPR_FIRSTFREESLOT)/8] |= 1<<(j%8); // Okay, this sprite slot has been named now. // Lua needs to update the value in _G if it exists LUA_UpdateSprName(word, j); @@ -456,7 +447,7 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) else if (fastncmp("SPR_",word,4)) { p = word+4; for (i = 0; i < NUMSPRITES; i++) - if (!sprnames[i][4] && fastncmp(p,sprnames[i],4)) { + if (fastncmp(p,sprnames[i],4)) { // updating overridden sprnames is not implemented for soc parser, // so don't use cache if (mathlib) diff --git a/src/deh_soc.c b/src/deh_soc.c index 65db63ebb13fab76dc84dbbfb64f43fa13a8895f..6b90b6a86e582f085f4e7bbaf20c93a0c7007add 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -443,14 +443,9 @@ void readfreeslots(MYFILE *f) for (i = SPR_FIRSTFREESLOT; i <= SPR_LASTFREESLOT; i++) { if (used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8))) - { - if (!sprnames[i][4] && memcmp(sprnames[i],word,4)==0) - sprnames[i][4] = (char)f->wad; continue; // Already allocated, next. - } // Found a free slot! strncpy(sprnames[i],word,4); - //sprnames[i][4] = 0; used_spr[(i-SPR_FIRSTFREESLOT)/8] |= 1<<(i%8); // Okay, this sprite slot has been named now. // Lua needs to update the value in _G if it exists LUA_UpdateSprName(word, i); @@ -4183,7 +4178,7 @@ spritenum_t get_sprite(const char *word) if (fastncmp("SPR_",word,4)) word += 4; // take off the SPR_ for (i = 0; i < NUMSPRITES; i++) - if (!sprnames[i][4] && memcmp(word,sprnames[i],4)==0) + if (memcmp(word,sprnames[i],4)==0) return i; deh_warning("Couldn't find sprite named 'SPR_%s'",word); return SPR_NULL; diff --git a/src/lua_script.c b/src/lua_script.c index b62fa675e2e7193da3a688d89d2f1cf377298a51..057899555480383611652c552e41bf41398b0e2b 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -622,9 +622,6 @@ static inline boolean LUA_LoadFile(MYFILE *f, char *name) if (!gL) // Lua needs to be initialized LUA_ClearState(); - lua_pushinteger(gL, f->wad); - lua_setfield(gL, LUA_REGISTRYINDEX, "WAD"); - lua_pushcfunction(gL, LUA_GetErrorMessage); errorhandlerindex = lua_gettop(gL); diff --git a/src/r_things.c b/src/r_things.c index 76e68068757fb1d387ac0c296c260f014f15098e..d56b473b8714e3ed40b57edc6f3c1403da58dde1 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -480,9 +480,6 @@ void R_AddSpriteDefs(UINT16 wadnum) // for (i = 0; i < numsprites; i++) { - if (sprnames[i][4] && wadnum >= (UINT16)sprnames[i][4]) - continue; - if (R_AddSingleSpriteDef(sprnames[i], &sprites[i], wadnum, start, end)) { // if a new sprite was added (not just replaced)