diff --git a/source/games/duke/CMakeLists.txt b/source/games/duke/CMakeLists.txt index a97a66a3e..8665e096a 100644 --- a/source/games/duke/CMakeLists.txt +++ b/source/games/duke/CMakeLists.txt @@ -6,6 +6,7 @@ set( PCH_SOURCES src/actors_lava.cpp src/bowling.cpp src/gamedef.cpp + src/gamevar.cpp src/zz_actors.cpp src/sectors.cpp src/sectors_d.cpp diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index ea2f810f1..f77540a49 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -228,14 +228,14 @@ void checkavailweapon(struct player_struct* p) p->curr_weapon = weap; if (isWW2GI()) { - SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->i, snum); + SetGameVarID(g_iWeaponVarID, p->curr_weapon, snum, p->i); if (p->curr_weapon >= 0) { - SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum); + SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], snum, p->i); } else { - SetGameVarID(g_iWorksLikeVarID, -1, p->i, snum); + SetGameVarID(g_iWorksLikeVarID, -1, snum, p->i); } OnEvent(EVENT_CHANGEWEAPON, p->i, snum, -1); } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index df3c59565..70377288a 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -125,16 +125,16 @@ void addweapon_d(struct player_struct *p, int weapon) short snum; snum = sprite[p->i].yvel; - SetGameVarID(g_iWeaponVarID,weapon, p->i, snum); + SetGameVarID(g_iWeaponVarID,weapon, snum, p->i); if (p->curr_weapon >= 0) { - SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[weapon][snum], p->i, snum); + SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[weapon][snum], snum, p->i); } else { - SetGameVarID(g_iWorksLikeVarID, -1, p->i, snum); + SetGameVarID(g_iWorksLikeVarID, -1, snum, p->i); } - SetGameVarID(g_iReturnVarID, 0, -1, snum); + SetGameVarID(g_iReturnVarID, 0, snum, -1); OnEvent(EVENT_CHANGEWEAPON, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, -1, snum) == 0) { diff --git a/source/games/duke/src/events_defs.h b/source/games/duke/src/events_defs.h index 899c54827..e69de29bb 100644 --- a/source/games/duke/src/events_defs.h +++ b/source/games/duke/src/events_defs.h @@ -1,52 +0,0 @@ - -#ifndef EDUKE32_EVENTS_DEFS_H_ -#define EDUKE32_EVENTS_DEFS_H_ - -// the order of these can't be changed or else compatibility with EDuke 2.0 mods will break -// KEEPINSYNC with EventNames[] and lunatic/con_lang.lua -enum GameEvent_t { - EVENT_INIT, // 0 - EVENT_ENTERLEVEL, - EVENT_RESETWEAPONS, - EVENT_RESETINVENTORY, - EVENT_HOLSTER, - EVENT_LOOKLEFT, // 5 - EVENT_LOOKRIGHT, - EVENT_SOARUP, - EVENT_SOARDOWN, - EVENT_CROUCH, - EVENT_JUMP, // 10 - EVENT_RETURNTOCENTER, - EVENT_LOOKUP, - EVENT_LOOKDOWN, - EVENT_AIMUP, - EVENT_FIRE, // 15 - EVENT_CHANGEWEAPON, - EVENT_GETSHOTRANGE, - EVENT_GETAUTOAIMANGLE, - EVENT_GETLOADTILE, - EVENT_CHEATGETSTEROIDS, // 20 - EVENT_CHEATGETHEAT, - EVENT_CHEATGETBOOT, - EVENT_CHEATGETSHIELD, - EVENT_CHEATGETSCUBA, - EVENT_CHEATGETHOLODUKE, // 25 - EVENT_CHEATGETJETPACK, - EVENT_CHEATGETFIRSTAID, - EVENT_QUICKKICK, - EVENT_INVENTORY, - EVENT_USENIGHTVISION, // 30 - EVENT_USESTEROIDS, - EVENT_INVENTORYLEFT, - EVENT_INVENTORYRIGHT, - EVENT_HOLODUKEON, - EVENT_HOLODUKEOFF, // 35 - EVENT_USEMEDKIT, - EVENT_USEJETPACK, - EVENT_TURNAROUND, - MAXEVENTS, - EVENT_MAXEVENT = MAXEVENTS, - EVENT_AIMDOWN = EVENT_AIMUP, -}; - -#endif diff --git a/source/games/duke/src/gamedef.h b/source/games/duke/src/gamedef.h index 6abb09daf..95d216a88 100644 --- a/source/games/duke/src/gamedef.h +++ b/source/games/duke/src/gamedef.h @@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef gamedef_h_ #define gamedef_h_ +#include "gamevar.h" #include "actors.h" #include "build.h" // hashtable_t #include "cheats.h" @@ -31,20 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS -#if 0 -enum -{ - LABEL_ANY = -1, - LABEL_DEFINE = 1, - LABEL_STATE = 2, - LABEL_ACTOR = 4, - LABEL_ACTION = 8, - LABEL_AI = 16, - LABEL_MOVE = 32, - LABEL_EVENT = 0x40, -}; -#endif - #define LABEL_HASPARM2 1 #define LABEL_ISSTRING 2 @@ -67,8 +54,7 @@ extern int32_t g_zRangeVarID; // var ID of "ZRANGE" #define g_iWeaponVarID g_weaponVarID #define g_iWorksLikeVarID g_worksLikeVarID -#include "events_defs.h" -extern intptr_t apScriptGameEvent[MAXEVENTS]; +extern intptr_t apScriptGameEvent[EVENT_NUMEVENTS]; extern char g_scriptFileName[BMAX_PATH]; diff --git a/source/games/duke/src/gamevar.cpp b/source/games/duke/src/gamevar.cpp new file mode 100644 index 000000000..bbfa1d1ed --- /dev/null +++ b/source/games/duke/src/gamevar.cpp @@ -0,0 +1,1317 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements) + +This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Original Source: 1996 - Todd Replogle +Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms + +EDuke enhancements integrated: 04/13/2003 - Matt Saettler + +Note: EDuke source was in transition. Changes are in-progress in the +source as it is released. + +*/ +//------------------------------------------------------------------------- + +#include "ns.h" +#include "global.h" +#include "gamedef.h" +#include "serializer.h" +#include "namesdyn.h" +#include "build.h" +#include "mmulti.h" +#include "gamevar.h" + +BEGIN_DUKE_NS + + +MATTGAMEVAR aGameVars[MAXGAMEVARS]; +int iGameVarCount; + +extern int errorcount, warningcount, line_count; + +#if 0 +extern int total_lines, line_number, labelcnt, warning, error; + +intptr_t *actorLoadEventScrptr[MAXTILES]; +intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; + +int g_iReturnVarID=-1; // var ID of "RETURN" +int g_iWeaponVarID=-1; // var ID of "WEAPON" +int g_iWorksLikeVarID=-1; // var ID of "WORKSLIKE" +int g_iZRangeVarID=-1; // var ID of "ZRANGE" +int g_iAngRangeVarID=-1; // var ID of "ANGRANGE" +int g_iAimAngleVarID=-1; // var ID of "AUTOAIMANGLE" +int g_iAtWithVarID=-1; // var ID of "AtWith" + + + +// global crap for event management +int g_i,g_p; +int g_x; +int *g_t; +uint8_t killit_flag; +spritetype *g_sp; +#endif + + +//--------------------------------------------------------------------------- +// +// to do +// +//--------------------------------------------------------------------------- + +void SerializeGameVars(FSerializer &arc) +{ +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +bool AddGameVar(const char *pszLabel, intptr_t lValue, unsigned dwFlags) +{ + + int i; + int j; + + int b=0; + + if(dwFlags & GAMEVAR_FLAG_PLONG) + dwFlags|=GAMEVAR_FLAG_SYSTEM; // force system if PLONG + + if(strlen(pszLabel) > (MAXVARLABEL-1) ) + { + warningcount++; + Printf(TEXTCOLOR_RED " * WARNING.(L%ld) Variable Name '%s' too int (max is %d)\n", line_number, pszLabel, MAXVARLABEL - 1); + return 0; + } + for(i=0;i= iGameVarCount) + { + Printf("GetGameVarID: Invalid Game ID %d\n", id); + return -1; + } + if( id == g_iThisActorID ) + { + return sActor; + } + if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER ) + { + // for the current player + if(sPlayer >=0 && sPlayer < MAXPLAYERS) + { + return aGameVars[id].plValues[sPlayer]; + } + else + { + return aGameVars[id].lValue; + } + } + else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR ) + { + // for the current actor + if(sActor >= 0 && sActor <=MAXSPRITES) + { + return aGameVars[id].plValues[sActor]; + } + else + { + return aGameVars[id].lValue; + } + } + else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG ) + { + if( !aGameVars[id].plValues) + { + Printf("GetGameVarID NULL PlValues for PLONG Var=%s\n",aGameVars[id].szLabel); + } + + return *aGameVars[id].plValues; + } + else + { + return aGameVars[id].lValue; + } + +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void SetGameVarID(int id, int lValue, int sActor, int sPlayer) +{ + if(id<0 || id >= iGameVarCount) + { + Printf("Invalid Game ID %d\n", id); + return; + } + if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER ) + { + // for the current player + aGameVars[id].plValues[sPlayer]=lValue; + } + else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR ) + { + // for the current actor + aGameVars[id].plValues[sActor]=lValue; + } + else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG ) + { + // set the value at pointer + *aGameVars[id].plValues=lValue; + } + else + { + aGameVars[id].lValue=lValue; + } + +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int GetGameVar(char *szGameLabel, int lDefault, short sActor, short sPlayer) +{ + int i; + for(i=0;i=MAXGAMEEVENTS) return 0; + return (apScriptGameEvent[i]!=NULL); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void OnEvent(int iEventID, short i,short p,long x) +{ + int og_i,og_p; + int og_x; + int *og_t; + spritetype *og_sp; + uint8_t okillit_flag; + intptr_t *oinsptr; + + char done; + + if( iEventID >= MAXGAMEEVENTS) + { + Printf("Invalid Event ID\n"); + return; + } + if( apScriptGameEvent[iEventID] == 0 ) + { + return; + } + + // save current values... + og_i=g_i; + og_p=g_p; + og_x=g_x; + og_sp=g_sp; + og_t=g_t; + okillit_flag=killit_flag; + oinsptr=insptr; + + g_i = i; // current sprite ID + g_p = p; /// current player ID + g_x = x; // ? + g_sp = &sprite[g_i]; + g_t = &hittype[g_i].temp_data[0]; + + insptr = (apScriptGameEvent[iEventID]); + + killit_flag = 0; + do + done = parse(); + while( done == 0 ); + + // restore old values... + g_i=og_i; + g_p=og_p; + g_x=og_x; + g_sp=og_sp; + g_t=og_t; + killit_flag=okillit_flag; + insptr=oinsptr; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int *aplWeaponClip[MAX_WEAPONS]; // number of items in clip +int *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire) +int *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire +int *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none) +int *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire. +int *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon +int *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots +int *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item +int *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn +int *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst' +int *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like +int *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when initialy firing. zero for no sound +int *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic) +int *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time +int *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID + + +void SetSystemVarPointers(); + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void InitGameVarPointers(void) +{ + int i,j; + char aszBuf[64]; + // called from game Init AND when level is loaded... + +//AddLog("InitGameVarPointers"); + + for(i=0;i plArray; +} MATTGAMEVAR; + +extern MATTGAMEVAR aGameVars[MAXGAMEVARS]; +extern int iGameVarCount; + +extern int g_iReturnVarID; // var ID of "RETURN" +extern int g_iWeaponVarID; // var ID of "WEAPON" +extern int g_iWorksLikeVarID; // var ID of "WORKSLIKE" +extern int g_iZRangeVarID; // var ID of "ZRANGE" +extern int g_iAngRangeVarID; // var ID of "ANGRANGE" +extern int g_iAimAngleVarID; // var ID of "AUTOAIMANGLE" + + +// global crap for event management +extern int g_i, g_p; +extern int g_x; +extern int* g_t; +extern uint8_t killit_flag; +//extern sprite_ype* g_sp; + +bool AddGameVar(const char *pszLabel, intptr_t lValue, unsigned dwFlags); +int GetGameID(const char *szGameLabel); +int GetDefID(const char *szGameLabel); +void FreeGameVars(void); +void ClearGameVars(void); +void AddSystemVars(); +void ResetGameVars(void); +int GetGameVarID(int id, int sActor, int sPlayer); +void SetGameVarID(int id, int lValue, int sActor, int sPlayer); +int GetGameVar(char* szGameLabel, int lDefault, int sActor, int sPlayer); + +void ClearGameEvents(); +bool IsGameEvent(int i); +void InitGameVarPointers(void); +void ResetSystemDefaults(void); + + + +END_DUKE_NS diff --git a/source/games/duke/src/gamevars.h b/source/games/duke/src/gamevars.h index 7ac7d4951..e39544425 100644 --- a/source/games/duke/src/gamevars.h +++ b/source/games/duke/src/gamevars.h @@ -24,15 +24,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define gamevars_h_ #include "gamedef.h" +#include "gamevar.h" BEGIN_DUKE_NS -#define MAXGAMEVARS 2048 // must be a power of two -#define MAXVARLABEL 26 - -#define GV_FLAG_CONSTANT (MAXGAMEVARS) -#define GV_FLAG_NEGATIVE (MAXGAMEVARS<<1) - // store global game definitions enum GamevarFlags_t { @@ -46,9 +41,6 @@ enum GamevarFlags_t GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed) GAMEVAR_INT32PTR = 0x00002000, // plValues is a pointer to an int32_t GAMEVAR_INT16PTR = 0x00008000, // plValues is a pointer to a short - GAMEVAR_FLAG_DEFAULT = GAMEVAR_DEFAULT, - GAMEVAR_FLAG_SECRET = 0x200, // placeholder - GAMEVAR_FLAG_READONLY = 0x1000, // placeholder GAMEVAR_PTR_MASK = GAMEVAR_INT32PTR | GAMEVAR_INT16PTR, }; @@ -85,7 +77,7 @@ int __fastcall Gv_GetVar(int const gameVar); void __fastcall Gv_GetManyVars(int const numVars, int32_t * const outBuf); void __fastcall Gv_SetVar(int const gameVar, int const newValue); -inline void SetGameVarID(int var, int newval, int pnum, int snum) +inline void SetGameVarID(int var, int newval, int snum, int pnum) { Gv_SetVar(var, newval, snum, pnum); } @@ -105,7 +97,6 @@ inline int GetGameVar(const char* szGameLabel, int defaultValue, int spriteNum, return Gv_GetVarByLabel(szGameLabel, defaultValue, spriteNum, playerNum); } void Gv_NewVar(const char *pszLabel,intptr_t lValue,uint32_t dwFlags); -#define AddGameVar Gv_NewVar int GetDefID(const char* label); diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index dd0c2af0f..b5db2dfd6 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "quotes.h" #include "sector.h" #include "sounds.h" +#include "gamevars.h" BEGIN_DUKE_NS @@ -204,7 +205,6 @@ G_EXTERN uint32_t g_ambientCnt; G_EXTERN intptr_t *apScript; G_EXTERN intptr_t *scriptptr; -G_EXTERN map_t g_mapInfo[(MAXVOLUMES + 1) * MAXLEVELS]; // +1 volume for "intro", "briefing" and "loading" music G_EXTERN vec2_t g_origins[MAXANIMPOINTS]; struct msx_ { diff --git a/source/games/duke/src/premap.h b/source/games/duke/src/premap.h index 2c4a081b4..55d1739d3 100644 --- a/source/games/duke/src/premap.h +++ b/source/games/duke/src/premap.h @@ -32,7 +32,6 @@ extern int32_t voting,vote_map,vote_episode; int G_EnterLevel(int gameMode); int G_FindLevelByFile(const char *fileName); void G_CacheMapData(void); -void G_FreeMapState(int levelNum); void G_NewGame(int volumeNum, int levelNum, int skillNum); void G_ResetTimers(uint8_t keepgtics); void G_UpdateScreenArea(void); diff --git a/source/games/duke/src/sector.h b/source/games/duke/src/sector.h index 6457a1496..8369c3cf9 100644 --- a/source/games/duke/src/sector.h +++ b/source/games/duke/src/sector.h @@ -45,64 +45,6 @@ typedef struct { int16_t wallnum, tag; } animwalltype; -typedef struct { - // this needs to have a copy of everything related to the map/actor state - // see savegame.c - int32_t g_animateGoal[MAXANIMATES], g_animateVel[MAXANIMATES], g_animateCnt; - intptr_t g_animatePtr[MAXANIMATES]; - int32_t lockclock; - vec2_t origins[MAXANIMPOINTS]; - int32_t randomseed, g_globalRandom; - int32_t pskyidx; - - int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos; - int16_t g_animateSect[MAXANIMATES]; - int16_t g_cyclers[MAXCYCLERS][6]; - int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount; - int16_t g_animWallCnt; - int16_t g_cloudCnt,g_cloudSect[256],g_cloudX,g_cloudY; - int16_t g_cyclerCnt; - - int32_t numsprites; - int16_t tailspritefree; - int16_t headspritesect[MAXSECTORS+1]; - int16_t headspritestat[MAXSTATUS+1]; - int16_t nextspritesect[MAXSPRITES]; - int16_t nextspritestat[MAXSPRITES]; - int16_t numsectors; - int16_t numwalls; - int16_t prevspritesect[MAXSPRITES]; - int16_t prevspritestat[MAXSPRITES]; - - uint16_t g_earthquakeTime; - int8_t g_playerSpawnCnt; - - FixedBitArray show2dsector; - - actor_t actor[MAXSPRITES]; - playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; - animwalltype animwall[MAXANIMWALLS]; - usectortype sector[MAXSECTORS]; - spriteext_t spriteext[MAXSPRITES]; - uspritetype sprite[MAXSPRITES]; - uwalltype wall[MAXWALLS]; -#ifndef NEW_MAP_FORMAT - wallext_t wallext[MAXWALLS]; -#endif - intptr_t *vars[MAXGAMEVARS]; -#ifdef YAX_ENABLE - int32_t numyaxbunches; -# if !defined NEW_MAP_FORMAT - int16_t yax_bunchnum[MAXSECTORS][2]; - int16_t yax_nextwall[MAXWALLS][2]; -# endif -#endif -} mapstate_t; - -typedef struct { - mapstate_t *savedstate; -} map_t; - void breakwall(short newpn, short spr, short dawallnum); void activatebysector(int s, int sn); diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 46e03b91b..715814b81 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -6497,21 +6497,10 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass) } - -static void G_FreeHashAnim(const char * /*string*/, intptr_t key) -{ - Xfree((void *)key); -} - static void G_Cleanup(void) { int32_t i; - for (i=(MAXLEVELS*(MAXVOLUMES+1))-1; i>=0; i--) // +1 volume for "intro", "briefing" music - { - G_FreeMapState(i); - } - for (i=MAXPLAYERS-1; i>=0; i--) { Xfree(g_player[i].ps); diff --git a/source/games/duke/src/zz_gameexec.cpp b/source/games/duke/src/zz_gameexec.cpp index 3af463bad..fc586a98f 100644 --- a/source/games/duke/src/zz_gameexec.cpp +++ b/source/games/duke/src/zz_gameexec.cpp @@ -101,7 +101,7 @@ static void VM_DeleteSprite(int const spriteNum, int const playerNum) A_DeleteSprite(spriteNum); } -intptr_t apScriptGameEvent[MAXEVENTS]; +intptr_t apScriptGameEvent[EVENT_NUMEVENTS]; static uspritetype dummy_sprite; static actor_t dummy_actor; @@ -2717,53 +2717,7 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) case concmd_addlogvar: insptr++; - { - int32_t m = 1; - char szBuf[256]; - int32_t lVarID = *insptr; - - if ((lVarID >= g_gameVarCount) || lVarID < 0) - { - if (*insptr == MAXGAMEVARS) // addlogvar for a constant? Har. - insptr++; - else if (EDUKE32_PREDICT_TRUE(*insptr & GV_FLAG_NEGATIVE)) - { - m = -m; - lVarID ^= GV_FLAG_NEGATIVE; - } - else - { - // invalid varID - CON_ERRPRINTF("invalid variable\n"); - continue; - } - } - Bsprintf(tempbuf, "CONLOGVAR: L=%d %s ", VM_DECODE_LINE_NUMBER(g_tw), aaGameVars[lVarID].szLabel); - - if (aaGameVars[lVarID].flags & GAMEVAR_READONLY) - { - Bsprintf(szBuf, " (read-only)"); - Bstrcat(tempbuf, szBuf); - } - if (aaGameVars[lVarID].flags & GAMEVAR_PERPLAYER) - { - Bsprintf(szBuf, " (Per Player. Player=%d)", vm.playerNum); - } - else if (aaGameVars[lVarID].flags & GAMEVAR_PERACTOR) - { - Bsprintf(szBuf, " (Per Actor. Actor=%d)", vm.spriteNum); - } - else - { - Bsprintf(szBuf, " (Global)"); - } - Bstrcat(tempbuf, szBuf); - Bsprintf(szBuf, " =%d\n", Gv_GetVar(lVarID) * m); - Bstrcat(tempbuf, szBuf); - Printf(TEXTCOLOR_GREEN "%s", tempbuf); - insptr++; - continue; - } + continue; case concmd_ifvare: insptr++; @@ -2788,13 +2742,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) debug_break(); VM_ScriptInfo(insptr, 64); G_GameExit("An error has occurred in the " GAMENAME " virtual machine.\n\n"); -#if 0 - "If you are an end user, please e-mail the file " GAMENAMELOWERCASE ".log\n" - "along with links to any mods you're using to development@voidpoint.com.\n\n" - "If you are a developer, please attach all of your script files\n" - "along with instructions on how to reproduce this error.\n\n" - "Thank you!"); -#endif break; } } diff --git a/source/games/duke/src/zz_gamevars.cpp b/source/games/duke/src/zz_gamevars.cpp index c120eef77..179716b6e 100644 --- a/source/games/duke/src/zz_gamevars.cpp +++ b/source/games/duke/src/zz_gamevars.cpp @@ -119,22 +119,6 @@ void Gv_ResetVars(void) /* this is called during a new game and nowhere else */ void Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags) { - if (EDUKE32_PREDICT_FALSE(g_gameVarCount >= MAXGAMEVARS)) - { - errorcount++; - ReportError(-1); - Printf("%s:%d: error: too many gamevars!\n",g_scriptFileName,line_number); - return; - } - - if (EDUKE32_PREDICT_FALSE(Bstrlen(pszLabel) > (MAXVARLABEL-1))) - { - errorcount++; - ReportError(-1); - Printf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_scriptFileName,line_number,pszLabel, MAXVARLABEL); - return; - } - int gV = hash_find(&h_gamevars,pszLabel); if (gV >= 0 && !(aaGameVars[gV].flags & GAMEVAR_RESET)) @@ -241,7 +225,7 @@ static FORCE_INLINE int __fastcall getvar__(int const gameVar, int const spriteN case GAMEVAR_INT16PTR: returnValue = *(int16_t *)var.global; break; } - return NEGATE_ON_CONDITION(returnValue, gameVar & GV_FLAG_NEGATIVE); + return returnValue; } int __fastcall Gv_GetVar(int const gameVar, int const spriteNum, int const playerNum) { return getvar__(gameVar, spriteNum, playerNum); } diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 372929a76..f776bf7fb 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -1940,9 +1940,6 @@ end_vol4a: //AddLog("Newgame"); - for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++) - G_FreeMapState(i); - if (m_coop != 1) { for (bssize_t weaponNum = 0; weaponNum < MAX_WEAPONS; weaponNum++) @@ -2478,16 +2475,6 @@ int G_EnterLevel(int gameMode) return 0; } -void G_FreeMapState(int levelNum) -{ - map_t *const pMapInfo = &g_mapInfo[levelNum]; - - if (pMapInfo->savedstate == NULL) - return; - - ALIGNED_FREE_AND_NULL(pMapInfo->savedstate); -} - void G_SetFog(int fogtype) { GLInterface.SetMapFog(fogtype != 0);