diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 36ba591f2..98095d1f2 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -2812,7 +2812,7 @@ DETONATEB: int m = 0; switch (s->picnum) { - case TRIPBOMBSPRITE: m = powderkegblastradius; break; + case TRIPBOMBSPRITE: m = tripbombblastradius; break; // powder keg case HEAVYHBOMB: m = pipebombblastradius; break; case HBOMBAMMO: m = pipebombblastradius; break; case MORTER: m = morterblastradius; break; diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index 343e17087..eaf0d43e5 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -382,6 +382,11 @@ enum sflags_t SFLAG_NOCANSEECHECK = 0x20000000, }; +enum +{ + TFLAG_WALLSWITCH = 1 +}; + enum { EVENT_INIT = 0, @@ -442,10 +447,24 @@ enum miscConstants HORIZ_MAX =299, AUTO_AIM_ANGLE =48, PHEIGHT_DUKE =(38<<8), - PHEIGHT_RR =(40<<8) + PHEIGHT_RR =(40<<8), + MAXMINECARTS = 16, + MAXJAILDOORS = 32, + MAXLIGHTNINSECTORS = 64, + MAXTORCHSECTORS = 64, + MAXGEOSECTORS = 64, + + DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0, }; +enum { + MUS_INTRO = 0, + MUS_BRIEFING = 1, + MUS_LOADING = 2, +}; + + enum { // Control flags for WW2GI weapons. @@ -463,3 +482,16 @@ enum EFlamethrowerState kHitSprite = 0xC000, }; +enum gamemode_t { + MODE_MENU = 0x00000001, + MODE_DEMO = 0x00000002, + MODE_GAME = 0x00000004, + MODE_EOL = 0x00000008, + MODE_TYPE = 0x00000010, + MODE_RESTART = 0x00000020, +}; + + +#define VOLUMEALL ((g_gameType & GAMEFLAG_SHAREWARE) == 0) +#define PLUTOPAK ((g_gameType & GAMEFLAG_PLUTOPAK) != 0) +#define VOLUMEONE ((g_gameType & GAMEFLAG_SHAREWARE) != 0) diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index a36aa769d..23823d8cb 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -17,7 +17,6 @@ #include "gamevar.h" #include "global.h" #include "names.h" -#include "player.h" #include "quotemgr.h" #include "rts.h" #include "sounds.h" diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index c965733f1..cc684449b 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -238,4 +238,10 @@ void GetInput(); void startmainmenu(); void loadcons(); +void updateinterpolations(); +void restoreinterpolations(); +void setinterpolation(int* posptr); +void stopinterpolation(int* posptr); +void dointerpolations(int smoothratio); + END_DUKE_NS diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index f16c2e4d2..a004487b8 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -34,62 +34,66 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS - - - extern user_defs ud; -extern int rtsplaying; -extern int32_t cameraclock; -extern int32_t cameradist; -extern int32_t tempwallptr; - -enum -{ - TFLAG_WALLSWITCH = 1 -}; -// for now just flags not related to actors, may get more info later. -struct TileInfo -{ - int flags; -}; -extern TileInfo tileinfo[MAXTILES]; - - -extern int32_t actor_tog; -extern int32_t otherp; - - -extern ActorInfo actorinfo[MAXTILES]; -extern weaponhit hittype[MAXSPRITES]; -extern bool sound445done; +// Variables that do not need to be saved. +extern int respawnactortime; +extern int bouncemineblastradius; +extern int respawnitemtime; +extern int morterblastradius; +extern int numfreezebounces; +extern int pipebombblastradius; +extern int dukefriction; +extern int rpgblastradius; +extern int seenineblastradius; +extern int shrinkerblastradius; +extern int gc; +extern int tripbombblastradius; +extern int cameraclock; +extern int cameradist; +extern int otherp; // transient helper, MP only +extern TileInfo tileinfo[MAXTILES]; // static state +extern ActorInfo actorinfo[MAXTILES]; // static state +extern int actor_tog; // cheat state extern intptr_t apScriptGameEvent[]; - extern TArray<int> ScriptCode; +extern input_t sync[MAXPLAYERS]; +extern int16_t max_ammo_amount[MAX_WEAPONS]; +extern int16_t weaponsandammosprites[15]; +extern int32_t PHEIGHT; + +// Interpolation code is the same in all games with slightly different naming - this needs to be unified and cleaned up. +// Interpolations are reconstructed on load and do not need to be saved. +#define MAXINTERPOLATIONS MAXSPRITES +extern int numinterpolations; +extern int* curipos[MAXINTERPOLATIONS]; +extern int bakipos[MAXINTERPOLATIONS]; + + +// Variables that must be saved + +extern int rtsplaying; +extern int tempwallptr; +extern weaponhit hittype[MAXSPRITES]; +extern bool sound445done; +extern int levelTextTime; +extern uint16_t frags[MAXPLAYERS][MAXPLAYERS]; +extern player_struct ps[MAXPLAYERS]; +extern int spriteqamount; +extern uint8_t shadedsector[MAXSECTORS]; +extern int lastvisinc; + + + +// todo + + -#define VOLUMEALL ((g_gameType & GAMEFLAG_SHAREWARE) == 0) -#define PLUTOPAK ((g_gameType & GAMEFLAG_PLUTOPAK) != 0) -#define VOLUMEONE ((g_gameType & GAMEFLAG_SHAREWARE) != 0) - -#define MOVEFIFOSIZ 256 - -#define MAXGAMETYPES 16 - -enum { - MUS_INTRO = 0, - MUS_BRIEFING = 1, - MUS_LOADING = 2, -}; -#define MAXMINECARTS 16 -#define MAXJAILDOORS 32 -#define MAXLIGHTNINSECTORS 64 -#define MAXTORCHSECTORS 64 -#define MAXGEOSECTORS 64 #ifdef global_c_ #define G_EXTERN @@ -97,219 +101,101 @@ enum { #define G_EXTERN extern #endif -#define MAXINTERPOLATIONS MAXSPRITES - - -G_EXTERN int32_t duke3d_globalflags; - -// KEEPINSYNC astub.c (used values only) -enum DUKE3D_GLOBALFLAGS { - DUKE3D_NO_WIDESCREEN_PINNING = 1<<0, - DUKE3D_NO_HARDCODED_FOGPALS = 1<<1, - DUKE3D_NO_PALETTE_CHANGES = 1<<2, -}; - -struct animwalltype -{ - int16_t wallnum, tag; -}; - +G_EXTERN int duke3d_globalflags; G_EXTERN animwalltype animwall[MAXANIMWALLS]; -enum -{ - MAXLABELLEN = 64 -}; - G_EXTERN bool synchronized_input; -G_EXTERN char g_loadFromGroupOnly; -G_EXTERN char pus,pub; G_EXTERN char ready2send; -#define MAXPLAYERNAME 32 G_EXTERN char tempbuf[MAXSECTORS<<1],buf[1024]; - G_EXTERN input_t loc; -G_EXTERN int32_t avgfvel, avgsvel, avgbits; +G_EXTERN int avgfvel, avgsvel, avgbits; G_EXTERN fix16_t avgavel, avghorz; G_EXTERN int8_t avgextbits; -G_EXTERN int32_t movefifosendplc; +G_EXTERN int movefifosendplc; -G_EXTERN int32_t predictfifoplc; +G_EXTERN int predictfifoplc; -G_EXTERN int32_t g_networkBroadcastMode; +G_EXTERN int g_networkBroadcastMode; -G_EXTERN int32_t g_animWallCnt; -#define numanimwalls g_animWallCnt -G_EXTERN int32_t g_animateCnt; -#define animatecnt g_animateCnt -G_EXTERN int32_t numclouds; -G_EXTERN int32_t camsprite; -G_EXTERN int32_t g_frameRate; -G_EXTERN int32_t g_cyclerCnt; -#define numcyclers g_cyclerCnt -G_EXTERN int32_t g_damageCameras; -#define camerashitable g_damageCameras -G_EXTERN int32_t g_defaultLabelCnt; -G_EXTERN int32_t g_earthquakeTime; -#define earthquaketime g_earthquakeTime -G_EXTERN int32_t g_freezerSelfDamage; -#define freezerhurtowner g_freezerSelfDamage -G_EXTERN int32_t g_gameQuit; -G_EXTERN int32_t global_random; -G_EXTERN int32_t impact_damage; -G_EXTERN int32_t g_maxPlayerHealth; -G_EXTERN int32_t mirrorcnt; -G_EXTERN int32_t playerswhenstarted; -G_EXTERN int32_t g_musicSize; -G_EXTERN int32_t numplayersprites; -G_EXTERN int32_t g_scriptDebug; -G_EXTERN int32_t show_shareware; -G_EXTERN int32_t g_spriteDeleteQueuePos; -G_EXTERN int32_t max_player_health; -G_EXTERN int32_t max_armour_amount; -G_EXTERN int32_t lasermode; -G_EXTERN int32_t screenpeek; +G_EXTERN int numanimwalls; +G_EXTERN int animatecnt; +G_EXTERN int numclouds; +G_EXTERN int camsprite; +G_EXTERN int numcyclers; +G_EXTERN int camerashitable; +G_EXTERN int earthquaketime; +G_EXTERN int freezerhurtowner; +G_EXTERN int gamequit; +G_EXTERN int global_random; +G_EXTERN int impact_damage; +G_EXTERN int mirrorcnt; +G_EXTERN int playerswhenstarted; +G_EXTERN int numplayersprites; +G_EXTERN int show_shareware; +G_EXTERN int spriteqloc; +G_EXTERN int max_player_health; +G_EXTERN int max_armour_amount; +G_EXTERN int lasermode; +G_EXTERN int screenpeek; -G_EXTERN int16_t g_animateSect[MAXANIMATES]; -#define animatesect g_animateSect -G_EXTERN int32_t *g_animatePtr[MAXANIMATES]; -#define animateptr g_animatePtr -G_EXTERN int32_t g_animateGoal[MAXANIMATES]; -#define animategoal g_animateGoal -G_EXTERN int32_t g_animateVel[MAXANIMATES]; -#define animatevel g_animateVel +G_EXTERN int16_t animatesect[MAXANIMATES]; +G_EXTERN int * animateptr[MAXANIMATES]; +G_EXTERN int animategoal[MAXANIMATES]; +G_EXTERN int animatevel[MAXANIMATES]; G_EXTERN int16_t clouds[256]; G_EXTERN int16_t cloudx; G_EXTERN int16_t cloudy; G_EXTERN ClockTicks cloudtotalclock; -G_EXTERN int16_t SpriteDeletionQueue[1024]; -G_EXTERN int16_t g_cyclers[MAXCYCLERS][6]; -#define cyclers g_cyclers +G_EXTERN int16_t spriteq[1024]; +G_EXTERN int16_t cyclers[MAXCYCLERS][6]; G_EXTERN int16_t mirrorsector[64]; G_EXTERN int16_t mirrorwall[64]; G_EXTERN ClockTicks lockclock; G_EXTERN ClockTicks ototalclock; -G_EXTERN int32_t wupass; -G_EXTERN int32_t chickenplant; -G_EXTERN int32_t thunderon; -G_EXTERN int32_t g_ufoSpawn; -#define ufospawn g_ufoSpawn -G_EXTERN int32_t g_ufoCnt; -#define ufocnt g_ufoCnt -G_EXTERN int32_t g_hulkSpawn; -#define hulkspawn g_hulkSpawn -G_EXTERN int32_t g_lastLevel; -#define lastlevel g_lastLevel +G_EXTERN int wupass; +G_EXTERN int chickenplant; +G_EXTERN int thunderon; +G_EXTERN int ufospawn; +G_EXTERN int ufocnt; +G_EXTERN int hulkspawn; +G_EXTERN int lastlevel; - -G_EXTERN int32_t geosectorwarp[MAXGEOSECTORS]; -G_EXTERN int32_t geosectorwarp2[MAXGEOSECTORS]; -G_EXTERN int32_t geosector[MAXGEOSECTORS]; -G_EXTERN int32_t geox[MAXGEOSECTORS]; -G_EXTERN int32_t geoy[MAXGEOSECTORS]; -G_EXTERN int32_t geox2[MAXGEOSECTORS]; -G_EXTERN int32_t geoy2[MAXGEOSECTORS]; +G_EXTERN int geosectorwarp[MAXGEOSECTORS]; +G_EXTERN int geosectorwarp2[MAXGEOSECTORS]; +G_EXTERN int geosector[MAXGEOSECTORS]; +G_EXTERN int geox[MAXGEOSECTORS]; +G_EXTERN int geoy[MAXGEOSECTORS]; +G_EXTERN int geox2[MAXGEOSECTORS]; +G_EXTERN int geoy2[MAXGEOSECTORS]; G_EXTERN uint32_t geocnt; -G_EXTERN int32_t g_thunderFlash; -G_EXTERN int32_t g_thunderTime; -G_EXTERN int32_t g_winderFlash; -G_EXTERN int32_t g_winderTime; -G_EXTERN int32_t g_brightness; +G_EXTERN int g_thunderFlash; +G_EXTERN int g_thunderTime; +G_EXTERN int g_winderFlash; +G_EXTERN int g_winderTime; +G_EXTERN int g_brightness; G_EXTERN int16_t ambientlotag[64]; G_EXTERN int16_t ambienthitag[64]; G_EXTERN uint32_t ambientfx; - G_EXTERN int msx[MAXANIMPOINTS], msy[MAXANIMPOINTS]; -G_EXTERN int32_t WindTime, WindDir; -G_EXTERN int16_t fakebubba_spawn, mamaspawn_count, banjosound, g_bellTime, BellSprite; -#define BellTime g_bellTime -#define word_119BE0 BellSprite +G_EXTERN int WindTime, WindDir; +G_EXTERN int16_t fakebubba_spawn, mamaspawn_count, banjosound, BellTime, BellSprite /* word_119BE0*/; G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS]; // move these back into the base structs! -G_EXTERN uint8_t enemysizecheat, ufospawnsminion, pistonsound, chickenphase, RRRA_ExitedLevel, fogactive; -extern int32_t g_cdTrack; -#define raat607 enemysizecheat // only as a reminder -#define raat605 chickenphase -#define at59d yeehaa_timer +G_EXTERN uint8_t enemysizecheat /*raat607*/, ufospawnsminion, pistonsound, chickenphase /* raat605*/, RRRA_ExitedLevel, fogactive; G_EXTERN player_orig po[MAXPLAYERS]; G_EXTERN uint32_t everyothertime; -G_EXTERN double g_gameUpdateTime; -G_EXTERN double g_gameUpdateAndDrawTime; -#define GAMEUPDATEAVGTIMENUMSAMPLES 100 -extern float g_gameUpdateAvgTime; - -#ifndef global_c_ -extern char CheatKeys[2]; -extern char g_gametypeNames[MAXGAMETYPES][33]; - -extern int32_t respawnactortime; -extern int32_t bouncemineblastradius; -extern int32_t g_deleteQueueSize; -extern int32_t g_gametypeCnt; -extern int32_t respawnitemtime; -extern int32_t g_morterRadius; -#define morterblastradius g_morterRadius -extern int32_t numfreezebounces; -extern int32_t g_pipebombRadius; -#define pipebombblastradius g_pipebombRadius -extern int32_t dukefriction; -extern int32_t rpgblastradius; -extern int32_t g_scriptSize; -extern int32_t g_seenineRadius; -#define seenineblastradius g_seenineRadius -extern int32_t g_shrinkerRadius; -#define shrinkerblastradius g_shrinkerRadius -extern int32_t g_spriteGravity; -extern int32_t g_timerTicsPerSecond; -extern int32_t g_tripbombRadius; -#define tripbombblastradius g_tripbombRadius -#define powderkegblastradius g_tripbombRadius -extern int32_t g_volumeCnt; -#define gc g_spriteGravity - -extern int16_t weaponsandammosprites[15]; -extern int32_t g_gametypeFlags[MAXGAMETYPES]; - -#endif - -// Interpolation code is the same in all games with slightly different naming - this needs to be unified and cleaned up. -extern int32_t numinterpolations; -extern int32_t* curipos[MAXINTERPOLATIONS]; -extern int32_t bakipos[MAXINTERPOLATIONS]; - - -// old names as porting help. -void updateinterpolations(); -void restoreinterpolations(); -void setinterpolation(int* posptr); -void stopinterpolation(int* posptr); -void dointerpolations(int smoothratio); - - -extern player_struct ps[MAXPLAYERS]; - - -extern int spriteqamount; -#define spriteq SpriteDeletionQueue -#define spriteqloc g_spriteDeleteQueuePos - - - -extern uint8_t shadedsector[MAXSECTORS]; - - END_DUKE_NS diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index bf2e773cf..5d29bcb36 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -2,7 +2,7 @@ #include "mathutil.h" #include "glbackend/glbackend.h" -#include "player.h" +#include "global.h" // all inline functions. BEGIN_DUKE_NS diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 36be6db02..4d5071122 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -762,7 +762,7 @@ static void processInputBits(player_struct *p, ControlInfo &info) if (info.dx > 0 || info.dyaw < 0) loc.bits |= SKB_INV_RIGHT; } - if (g_gameQuit) loc.bits |= SKB_GAMEQUIT; + if (gamequit) loc.bits |= SKB_GAMEQUIT; //if (inputState.GetKeyStatus(sc_Escape)) loc.bits |= SKB_ESCAPE; fixme. This never gets here because the menu eats the escape key. if (!onVehicle) @@ -1239,7 +1239,7 @@ void GetInput() if (paused) { loc = {}; - if (g_gameQuit) loc.bits |= SKB_GAMEQUIT; + if (gamequit) loc.bits |= SKB_GAMEQUIT; return; } diff --git a/source/games/duke/src/player.h b/source/games/duke/src/player.h deleted file mode 100644 index fa52e3b96..000000000 --- a/source/games/duke/src/player.h +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef player_h_ -#define player_h_ - -#include "names.h" -#include "fix16.h" -#include "tarray.h" -#include "constants.h" -#include "types.h" - -BEGIN_DUKE_NS - -extern int32_t playerswhenstarted; - -extern int32_t PHEIGHT; - - -enum gamemode_t { - MODE_MENU = 0x00000001, - MODE_DEMO = 0x00000002, - MODE_GAME = 0x00000004, - MODE_EOL = 0x00000008, - MODE_TYPE = 0x00000010, - MODE_RESTART = 0x00000020, -}; - - -extern uint16_t frags[MAXPLAYERS][MAXPLAYERS]; -extern input_t sync[MAXPLAYERS]; - -extern int16_t max_ammo_amount[MAX_WEAPONS]; - - -extern int lastvisinc; - -END_DUKE_NS - -#endif diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 15e980bd4..ca6f6af4d 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -36,7 +36,6 @@ source as it is released. #include "ns.h" #include "global.h" #include "gamevar.h" -#include "player.h" #include "names_d.h" BEGIN_DUKE_NS @@ -2309,7 +2308,6 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect) } else p->kickback_pic = 0; - if (screenpeek == snum) pus = 1; p->ammo_amount[p->curr_weapon]--; fi.shoot(pi, GROWSPARK); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 13726df48..708232bdb 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1161,7 +1161,7 @@ int doincrements_r(struct player_struct* p) { BellTime--; if (BellTime == 0) - sprite[word_119BE0].picnum++; + sprite[BellSprite].picnum++; } if (chickenphase > 0) chickenphase--; @@ -3058,7 +3058,6 @@ static void operateweapon(int snum, ESyncBits sb_snum, int psect) if (p->kickback_pic > 3) { p->kickback_pic = 0; - if (screenpeek == snum) pus = 1; fi.shoot(pi, GROWSPARK); p->noise_radius = 1024; madenoise(snum); diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index aaffabb0f..ef41f65ae 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -36,8 +36,7 @@ source as it is released. #include "ns.h" #include "global.h" #include "gamevar.h" -#include "player.h" -#include "names_d.h" + #include "names_d.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 653db1f78..7a3d61f76 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -125,7 +125,6 @@ void resetplayerstats(int snum) p->got_access = 7; else p->got_access = 0; p->random_club_frame= 0; - pus = 1; p->on_warping_sector = 0; p->spritebridge = 0; p->palette = 0; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 8c524564c..dd8af47c8 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -568,7 +568,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype) if (sprite[i].picnum == RRTILE8660) { BellTime = 132; - word_119BE0 = i; + BellSprite = i; } sprite[i].picnum++; break; @@ -756,7 +756,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype) if (picnum == RRTILE8660) { BellTime = 132; - word_119BE0 = w; + BellSprite = w; sprite[w].picnum++; } else if (picnum == RRTILE8464) diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 032a9fbc0..099430b80 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -605,6 +605,8 @@ void S_PlaySpecialMusic(unsigned int m) void S_PlayRRMusic(int newTrack) { + static int32_t g_cdTrack = -1; + if (!isRR() || !mus_redbook || cd_disabled || currentLevel->music.IsNotEmpty()) return; Mus_Stop(); diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 8bc40a226..81003f1ab 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -26,6 +26,10 @@ struct weaponhit int temp_data[6]; }; +struct animwalltype +{ + short wallnum, tag; +}; // Todo - put more state in here struct ActorInfo @@ -35,6 +39,12 @@ struct ActorInfo int aimoffset; }; +// for now just flags not related to actors, may get more info later. +struct TileInfo +{ + int flags; +}; + struct input_t // original name was input which is too generic for a type name. { fixed_t q16avel, q16horz; // These were expanded to 16.16 fixed point. diff --git a/source/games/duke/src/zz_global.cpp b/source/games/duke/src/zz_global.cpp index 5f4aa95f5..998a02ec2 100644 --- a/source/games/duke/src/zz_global.cpp +++ b/source/games/duke/src/zz_global.cpp @@ -29,62 +29,50 @@ BEGIN_DUKE_NS user_defs ud; -char g_gametypeNames[MAXGAMETYPES][33] -= { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" }; - - -float g_gameUpdateAvgTime = -1.f; - -int32_t respawnactortime = 768; -int32_t bouncemineblastradius = 2500; -int32_t respawnitemtime = 768; - -int32_t g_morterRadius = 2500; -int32_t numfreezebounces = 3; -int32_t g_gametypeCnt = 5; -int32_t g_volumeCnt = 3; -int32_t g_pipebombRadius = 2500; -int32_t dukefriction = 0xCFD0; -int32_t rpgblastradius = 1780; -int32_t g_scriptSize = 1048576; -int32_t g_seenineRadius = 2048; -int32_t g_shrinkerRadius = 650; -int32_t g_spriteGravity = 176; -int32_t g_timerTicsPerSecond = TICRATE; -int32_t g_tripbombRadius = 3880; -int32_t g_cdTrack = -1; - -uint16_t frags[MAXPLAYERS][MAXPLAYERS]; -input_t sync[MAXPLAYERS]; - -int16_t weaponsandammosprites[15]; +// Variables that do not need to be saved. +int respawnactortime = 768; +int bouncemineblastradius = 2500; +int respawnitemtime = 768; +int morterblastradius = 2500; +int numfreezebounces = 3; +int pipebombblastradius = 2500; +int dukefriction = 0xCFD0; +int rpgblastradius = 1780; +int seenineblastradius = 2048; +int shrinkerblastradius = 650; +int gc = 176; +int tripbombblastradius = 3880; +int cameradist = 0, cameraclock = 0; +int otherp; TileInfo tileinfo[MAXTILES]; // This is not from EDuke32. - - -int levelTextTime; // must be serialized -int rtsplaying; // must be serialized -int otherp; // MP only -bool sound445done; // this was local state inside a function, but this must be maintained globally and serialized - -int16_t max_ammo_amount[MAX_WEAPONS]; -int32_t spriteqamount = 64; - -uint8_t shadedsector[MAXSECTORS]; - -int32_t cameradist = 0, cameraclock = 0; - -int32_t g_Shareware = 0; - -int32_t tempwallptr; -int32_t actor_tog; - -weaponhit hittype[MAXSPRITES]; ActorInfo actorinfo[MAXTILES]; +int actor_tog; +input_t sync[MAXPLAYERS]; +int16_t max_ammo_amount[MAX_WEAPONS]; +int16_t weaponsandammosprites[15]; +int PHEIGHT = PHEIGHT_DUKE; + + + +// Variables that must be saved +int rtsplaying; +int tempwallptr; +weaponhit hittype[MAXSPRITES]; +bool sound445done; // this was local state inside a function, but this must be maintained globally and serialized +int levelTextTime; // must be serialized +uint16_t frags[MAXPLAYERS][MAXPLAYERS]; player_struct ps[MAXPLAYERS]; +int spriteqamount = 64; +uint8_t shadedsector[MAXSECTORS]; +int lastvisinc; + + + + + + -int32_t PHEIGHT = PHEIGHT_DUKE; -int32_t lastvisinc; END_DUKE_NS diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index cbdf067cf..e23037914 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "savegamehelp.h" BEGIN_DUKE_NS - +#if 0 // For storing pointers in files. // back_p==0: ptr -> "small int" // back_p==1: "small int" -> ptr @@ -248,10 +248,13 @@ bool G_SavePlayer(FSaveGameNode *sv) return res; } + return 0; } +#endif bool GameInterface::LoadGame(FSaveGameNode* sv) { +#if 0 if (ud.multimode > 1) { quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Multiplayer Loading Not Yet Supported"); @@ -267,10 +270,13 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) ps[myconnectindex].gm = MODE_GAME; return !c; } +#endif + return 0; } bool GameInterface::SaveGame(FSaveGameNode* sv) { +#if 0 if (ud.multimode > 1) { quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Multiplayer Saving Not Yet Supported"); @@ -283,8 +289,11 @@ bool GameInterface::SaveGame(FSaveGameNode* sv) videoNextPage(); // no idea if this is needed here. return G_SavePlayer(sv); } +#endif + return 0; } +#if 0 ////////// GENERIC SAVING/LOADING SYSTEM ////////// typedef struct dataspec_ @@ -609,7 +618,7 @@ static const dataspec_t svgm_anmisc[] = { DS_SAVEFN|DS_LOADFN , (void *)&sv_postanimateptr, 0, 1 }, { 0, &camsprite, sizeof(camsprite), 1 }, // { 0, &g_origins[0], sizeof(g_origins[0]), ARRAY_SIZE(g_origins) }, type has changed - { 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 }, + { 0, &spriteqloc, sizeof(spriteqloc), 1 }, { DS_NOCHK, &spriteqamount, sizeof(spriteqamount), 1 }, { DS_CNT(spriteqamount), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&spriteqamount }, { DS_NOCHK, &numclouds, sizeof(numclouds), 1 }, @@ -1122,7 +1131,7 @@ static void postloadplayer(int32_t savegamep) ps[i].drug_timer = 0; } - +#endif ////////// END GENERIC SAVING/LOADING SYSTEM //////////