diff --git a/source/rr/CMakeLists.txt b/source/rr/CMakeLists.txt index 00a741f25..d27afd315 100644 --- a/source/rr/CMakeLists.txt +++ b/source/rr/CMakeLists.txt @@ -11,6 +11,7 @@ set( PCH_SOURCES src/game.cpp src/gamedef.cpp src/gameexec.cpp + src/gamevars.cpp src/global.cpp src/namesdyn.cpp src/net.cpp diff --git a/source/rr/src/common_game.h b/source/rr/src/common_game.h index 2e3c6e9c5..f0b9ba44a 100644 --- a/source/rr/src/common_game.h +++ b/source/rr/src/common_game.h @@ -17,8 +17,8 @@ BEGIN_RR_NS #define RRRA (g_gameType & GAMEFLAG_RRRA) #define NAM (g_gameType & GAMEFLAG_NAM) #define NAPALM (g_gameType & GAMEFLAG_NAPALM) -//#define WW2GI (g_gameType & GAMEFLAG_WW2GI) -//#define NAM_WW2GI (g_gameType & (GAMEFLAG_NAM|GAMEFLAG_WW2GI)) +#define WW2GI (g_gameType & GAMEFLAG_WW2GI) +#define NAM_WW2GI (g_gameType & (GAMEFLAG_NAM|GAMEFLAG_WW2GI)) #define SHAREWARE (g_gameType & GAMEFLAG_SHAREWARE) //#define DUKEBETA ((g_gameType & GAMEFLAG_DUKEBETA) == GAMEFLAG_DUKEBETA) //#define IONMAIDEN (g_gameType & GAMEFLAG_IONMAIDEN) diff --git a/source/rr/src/events_defs.h b/source/rr/src/events_defs.h new file mode 100644 index 000000000..377a4c231 --- /dev/null +++ b/source/rr/src/events_defs.h @@ -0,0 +1,51 @@ + +#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_AIMDOWN = EVENT_AIMUP, +}; + +#endif diff --git a/source/rr/src/game.h b/source/rr/src/game.h index 193eb30ec..776d7547b 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -277,7 +277,6 @@ void G_HandleLocalKeys(void); void G_HandleSpecialKeys(void); void G_PrintGameQuotes(int32_t snum); //void G_SE40(int32_t smoothratio); -void G_Shutdown(void); void G_UpdatePlayerFromMenu(void); void P_DoQuote(int32_t q,DukePlayer_t *p); void P_SetGamePalette(DukePlayer_t* player, uint32_t palid, ESetPalFlags flags); diff --git a/source/rr/src/gamedef.cpp b/source/rr/src/gamedef.cpp index 3bc2e682b..d8f6a6a20 100644 --- a/source/rr/src/gamedef.cpp +++ b/source/rr/src/gamedef.cpp @@ -310,8 +310,6 @@ static hashtable_t * const tables_free [] = { void C_InitHashes() { - uint32_t i; - for (auto table : tables) hash_init(table); @@ -1874,7 +1872,7 @@ setvar: case CON_ADDVARVAR: case CON_SETVARVAR: { -setvarvar: +//setvarvar: auto ins = &g_scriptPtr[-1]; auto tptr = textptr; int const lnum = g_lineNumber; diff --git a/source/rr/src/gamevars.cpp b/source/rr/src/gamevars.cpp index b11f230aa..7ba0abd0e 100644 --- a/source/rr/src/gamevars.cpp +++ b/source/rr/src/gamevars.cpp @@ -20,11 +20,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- +#include "ns.h" // Must come before everything else! + #include "duke3d.h" #include "menus.h" #include "savegame.h" +#include "namesdyn.h" +#include "gamevars.h" -#include "vfs.h" +//#include "vfs.h" + +BEGIN_RR_NS #define gamevars_c_ @@ -84,38 +90,39 @@ void Gv_Clear(void) DO_FREE_AND_NULL(gameVar.szLabel); } -int Gv_ReadSave(buildvfs_kfd kFile) +// Note that this entire function is totally architecture dependent and needs to be fixed (which won't be easy...) +int Gv_ReadSave(FileReader &kFile) { char tbuf[12]; - if (kread(kFile, tbuf, 12)!=12) goto corrupt; + if (kFile.Read(tbuf, 12)!=12) goto corrupt; if (Bmemcmp(tbuf, "BEG: EDuke32", 12)) { OSD_Printf("BEG ERR\n"); return 2; } Gv_Free(); // nuke 'em from orbit, it's the only way to be sure... - if (kdfread_LZ4(&g_gameVarCount,sizeof(g_gameVarCount),1,kFile) != 1) goto corrupt; + if (kFile.Read(&g_gameVarCount,sizeof(g_gameVarCount)) != sizeof(g_gameVarCount)) goto corrupt; for (bssize_t i=0; iammo_amount[pPlayer->curr_weapon]--; - int pipeBombType; + //int pipeBombType; int pipeBombZvel; int pipeBombFwdVel; diff --git a/source/rr/src/savegame.cpp b/source/rr/src/savegame.cpp index 358be3e3e..a5636d885 100644 --- a/source/rr/src/savegame.cpp +++ b/source/rr/src/savegame.cpp @@ -1427,7 +1427,7 @@ static uint8_t *dosaveplayer2(FileWriter *fil, uint8_t *mem) PRINTSIZE("script"); mem=writespecdata(svgm_anmisc, fil, mem); // animates, quotes & misc. PRINTSIZE("animisc"); - Gv_WriteSave(fil); // gamevars + Gv_WriteSave(*fil); // gamevars mem=writespecdata((const dataspec_t *)svgm_vars, 0, mem); PRINTSIZE("vars"); @@ -1483,7 +1483,7 @@ int32_t sv_updatestate(int32_t frominit) if (readspecdata(svgm_secwsp, nullptr, &p)) return -4; if (readspecdata(svgm_script, nullptr, &p)) return -5; if (readspecdata(svgm_anmisc, nullptr, &p)) return -6; - if (readspecdata((const dataspec_t *)svgm_vars, -1, &p)) return -8; + if (readspecdata((const dataspec_t *)svgm_vars, nullptr, &p)) return -8; if (p != pbeg+svsnapsiz) {