From 3028b3f3fd1c67319b6d08478b46a26866fe01e5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Jul 2020 20:04:11 +0200 Subject: [PATCH] - merged game.h into global.h and game.cpp into global.cpp. Meaning that all global declarations are in one file now. --- source/games/duke/CMakeLists.txt | 1 - source/games/duke/src/animatesprites_d.cpp | 1 - source/games/duke/src/animatesprites_r.cpp | 1 - source/games/duke/src/d_menu.cpp | 1 - source/games/duke/src/duke3d.h | 1 - source/games/duke/src/game.h | 76 ---------------------- source/games/duke/src/global.h | 37 +++++++++++ source/games/duke/src/hudweapon_r.cpp | 1 - source/games/duke/src/input.cpp | 1 - source/games/duke/src/player_d.cpp | 1 - source/games/duke/src/player_r.cpp | 1 - source/games/duke/src/player_w.cpp | 1 - source/games/duke/src/savegame.h | 2 +- source/games/duke/src/spawn.cpp | 1 - source/games/duke/src/spawn_d.cpp | 1 - source/games/duke/src/spawn_r.cpp | 1 - source/games/duke/src/zz_game.cpp | 74 --------------------- source/games/duke/src/zz_global.cpp | 25 +++++++ 18 files changed, 63 insertions(+), 164 deletions(-) delete mode 100644 source/games/duke/src/game.h delete mode 100644 source/games/duke/src/zz_game.cpp diff --git a/source/games/duke/CMakeLists.txt b/source/games/duke/CMakeLists.txt index 7fd2e085f..4002e472e 100644 --- a/source/games/duke/CMakeLists.txt +++ b/source/games/duke/CMakeLists.txt @@ -45,7 +45,6 @@ set( PCH_SOURCES src/spawn.cpp src/spawn_d.cpp src/spawn_r.cpp - src/zz_game.cpp src/zz_global.cpp src/zz_savegame.cpp ) diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 037415d8c..121f10f47 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -35,7 +35,6 @@ source as it is released. #include "ns.h" #include "global.h" -#include "game.h" #include "prediction.h" #include "names_d.h" diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index bfd24cea1..07a9b0b87 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -29,7 +29,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" -#include "game.h" #include "names_r.h" #include "prediction.h" diff --git a/source/games/duke/src/d_menu.cpp b/source/games/duke/src/d_menu.cpp index e4a6cbb23..d6f40f333 100644 --- a/source/games/duke/src/d_menu.cpp +++ b/source/games/duke/src/d_menu.cpp @@ -31,7 +31,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "duke3d.h" #include "savegame.h" -#include "game.h" #include "superfasthash.h" #include "gamecvars.h" #include "gamecontrol.h" diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 23bec0242..a36aa769d 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -14,7 +14,6 @@ #include "menu/menu.h" #include "funct.h" #include "gamecontrol.h" -#include "game.h" #include "gamevar.h" #include "global.h" #include "names.h" diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h deleted file mode 100644 index 8aa28abd8..000000000 --- a/source/games/duke/src/game.h +++ /dev/null @@ -1,76 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2016 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. -*/ -//------------------------------------------------------------------------- - -#pragma once - -#include "fix16.h" -#include "mmulti.h" -#include "palette.h" -#include "cmdlib.h" -#include "screenjob.h" -#include "constants.h" -#include "types.h" - -BEGIN_DUKE_NS - - -extern user_defs ud; -extern int rtsplaying; - -#ifndef ONLY_USERDEFS - -extern int32_t g_Shareware; -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; - -#endif - - -extern intptr_t apScriptGameEvent[]; - -extern TArray ScriptCode; - - -#include "concmd.h" - -END_DUKE_NS diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index 250857ce2..7852999e2 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -30,10 +30,47 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "quotemgr.h" #include "sounds.h" #include "constants.h" +#include "types.h" BEGIN_DUKE_NS + + +extern user_defs ud; +extern int rtsplaying; + +extern int32_t g_Shareware; +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; + +extern intptr_t apScriptGameEvent[]; + +extern TArray ScriptCode; + + + #define VOLUMEALL (g_Shareware == 0) #define PLUTOPAK (true)//g_scriptVersion >= 14) #define VOLUMEONE (g_Shareware == 1) diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 222cf4c86..6735f4edf 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -28,7 +28,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" -#include "game.h" #include "names_r.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index d06269b08..36be6db02 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -35,7 +35,6 @@ source as it is released. #include "ns.h" #include "global.h" -#include "game.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index f06771cb9..15e980bd4 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -35,7 +35,6 @@ source as it is released. #include "ns.h" #include "global.h" -#include "game.h" #include "gamevar.h" #include "player.h" #include "names_d.h" diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index b9b7a2e76..13726df48 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -28,7 +28,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" -#include "game.h" #include "names_r.h" #include "mapinfo.h" diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index eab95151d..aaffabb0f 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -35,7 +35,6 @@ source as it is released. #include "ns.h" #include "global.h" -#include "game.h" #include "gamevar.h" #include "player.h" #include "names_d.h" diff --git a/source/games/duke/src/savegame.h b/source/games/duke/src/savegame.h index 90e6f89d9..38d427899 100644 --- a/source/games/duke/src/savegame.h +++ b/source/games/duke/src/savegame.h @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef savegame_h_ #define savegame_h_ -#include "game.h" +#include "global.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 79c3e72fd..d40991930 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -35,7 +35,6 @@ source as it is released. #include #include "ns.h" #include "global.h" -#include "game.h" #include "sounds.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 23f77c17d..4d2128cbe 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -34,7 +34,6 @@ source as it is released. #include #include "ns.h" #include "global.h" -#include "game.h" #include "sounds.h" #include "names_d.h" diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 1d509ebcd..5370b4095 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -29,7 +29,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include #include "ns.h" #include "global.h" -#include "game.h" #include "sounds.h" #include "names_r.h" diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp deleted file mode 100644 index c342b9346..000000000 --- a/source/games/duke/src/zz_game.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2016 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. -*/ -//------------------------------------------------------------------------- - -#include "ns.h" // Must come before everything else! - -#define game_c_ - -#include "duke3d.h" -#include "compat.h" -#include "baselayer.h" -#include "savegame.h" - -#include "sbar.h" -#include "palette.h" -#include "gamecvars.h" -#include "gameconfigfile.h" -#include "printf.h" -#include "m_argv.h" -#include "filesystem.h" -#include "statistics.h" -#include "c_dispatch.h" -#include "mapinfo.h" -#include "v_video.h" -#include "glbackend/glbackend.h" -#include "st_start.h" -#include "i_interface.h" - -BEGIN_DUKE_NS - -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]; -player_struct ps[MAXPLAYERS]; - -int32_t PHEIGHT = PHEIGHT_DUKE; - -int32_t lastvisinc; - -END_DUKE_NS diff --git a/source/games/duke/src/zz_global.cpp b/source/games/duke/src/zz_global.cpp index 1ef99fc0e..5f4aa95f5 100644 --- a/source/games/duke/src/zz_global.cpp +++ b/source/games/duke/src/zz_global.cpp @@ -62,4 +62,29 @@ int16_t weaponsandammosprites[15]; 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]; +player_struct ps[MAXPLAYERS]; + +int32_t PHEIGHT = PHEIGHT_DUKE; + +int32_t lastvisinc; + END_DUKE_NS