diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index cf5260158..7db678a16 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -708,6 +708,7 @@ static const vec2_t globalvartable[] = { CON_XORVAR, CON_XORVAR_GLOBAL }, }; +#ifdef INCOMPLETE_STRUCT_ACCESS static const vec2_t playervartable[] = { { CON_IFVARA, CON_IFVARA_PLAYER }, @@ -775,17 +776,22 @@ static const vec2_t actorvartable[] = { CON_SUBVAR, CON_SUBVAR_ACTOR }, { CON_XORVAR, CON_XORVAR_ACTOR }, }; +#endif static inthashtable_t h_varvar = { NULL, INTHASH_SIZE(ARRAY_SIZE(varvartable)) }; static inthashtable_t h_globalvar = { NULL, INTHASH_SIZE(ARRAY_SIZE(globalvartable)) }; +#ifdef INCOMPLETE_STRUCT_ACCESS static inthashtable_t h_playervar = { NULL, INTHASH_SIZE(ARRAY_SIZE(playervartable)) }; static inthashtable_t h_actorvar = { NULL, INTHASH_SIZE(ARRAY_SIZE(actorvartable)) }; +#endif static inthashtable_t *const inttables[] = { &h_varvar, &h_globalvar, +#ifdef INCOMPLETE_STRUCT_ACCESS &h_playervar, &h_actorvar, +#endif }; @@ -2453,14 +2459,14 @@ static void scriptUpdateOpcodeForVariableType(intptr_t *ins) case 0: opcode = inthash_find(&h_globalvar, *ins & VM_INSTMASK); break; -/* +#ifdef INCOMPLETE_STRUCT_ACCESS case GAMEVAR_PERACTOR: opcode = inthash_find(&h_actorvar, *ins & VM_INSTMASK); break; case GAMEVAR_PERPLAYER: opcode = inthash_find(&h_playervar, *ins & VM_INSTMASK); break; -*/ +#endif } } @@ -6180,11 +6186,13 @@ void scriptInitTables() for (auto &globalvar : globalvartable) inthash_add(&h_globalvar, globalvar.x, globalvar.y, 0); +#ifdef INCOMPLETE_STRUCT_ACCESS for (auto &playervar : playervartable) inthash_add(&h_playervar, playervar.x, playervar.y, 0); for (auto &actorvar : actorvartable) inthash_add(&h_actorvar, actorvar.x, actorvar.y, 0); +#endif } void C_Compile(const char *fileName) @@ -6319,8 +6327,10 @@ void C_Compile(const char *fileName) inthash_free(&h_varvar); inthash_free(&h_globalvar); +#ifdef INCOMPLETE_STRUCT_ACCESS inthash_free(&h_playervar); inthash_free(&h_actorvar); +#endif freehashnames(); freesoundhashnames(); diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index fdb896ec0..88415e234 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -878,6 +878,7 @@ enum ScriptKeywords_t CON_WHILEVARN_GLOBAL, CON_XORVAR_GLOBAL, +#ifdef INCOMPLETE_STRUCT_ACCESS CON_IFVARA_PLAYER, CON_IFVARAE_PLAYER, CON_IFVARAND_PLAYER, @@ -939,6 +940,7 @@ enum ScriptKeywords_t CON_WHILEVARL_ACTOR, CON_WHILEVARN_ACTOR, CON_XORVAR_ACTOR, +#endif CON_IFVARVARA, CON_IFVARVARAE, diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 4cb3c593a..8bd87cf53 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1424,8 +1424,8 @@ next_instruction: insptr = tempscrptr; } continue; -/* +#ifdef INCOMPLETE_STRUCT_ACCESS case CON_IFVARE_ACTOR: insptr++; tw = aGameVars[*insptr++].pValues[vm.spriteNum & (MAXSPRITES-1)]; @@ -1669,7 +1669,7 @@ next_instruction: aGameVars[*insptr].pValues[vm.playerNum & (MAXPLAYERS-1)] >>= insptr[1]; insptr += 2; continue; -*/ +#endif case CON_WHILEVARN_GLOBAL: { @@ -1695,6 +1695,7 @@ next_instruction: continue; } +#ifdef INCOMPLETE_STRUCT_ACCESS case CON_WHILEVARN_ACTOR: { auto const savedinsptr = &insptr[2]; @@ -1750,12 +1751,14 @@ next_instruction: continue; } +#endif case CON_MODVAR_GLOBAL: insptr++; aGameVars[*insptr].global %= insptr[1]; insptr += 2; continue; +#ifdef INCOMPLETE_STRUCT_ACCESS case CON_MODVAR_ACTOR: insptr++; aGameVars[*insptr].pValues[vm.spriteNum & (MAXSPRITES-1)] %= insptr[1]; @@ -1766,6 +1769,7 @@ next_instruction: aGameVars[*insptr].pValues[vm.playerNum & (MAXPLAYERS-1)] %= insptr[1]; insptr += 2; continue; +#endif case CON_IFVARAND: insptr++; @@ -1916,7 +1920,7 @@ next_instruction: insptr += 2; continue; -/* +#ifdef INCOMPLETE_STRUCT_ACCESS case CON_DIVVAR_PLAYER: { insptr++; @@ -1936,7 +1940,7 @@ next_instruction: insptr += 2; continue; } -*/ +#endif case CON_DIVVARVAR: insptr++; @@ -2234,6 +2238,7 @@ next_instruction: insptr += 2; continue; +#ifdef INCOMPLETE_STRUCT_ACCESS case CON_RANDVAR_PLAYER: insptr++; aGameVars[*insptr].pValues[vm.playerNum & (MAXPLAYERS-1)] = mulscale16(krand(), insptr[1] + 1); @@ -2245,6 +2250,7 @@ next_instruction: aGameVars[*insptr].pValues[vm.spriteNum & (MAXSPRITES-1)] = mulscale16(krand(), insptr[1] + 1); insptr += 2; continue; +#endif case CON_RANDVARVAR: insptr++;