From d6f1c76c9d59b5e65cbaad3d4795036ce3666978 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 May 2020 23:51:59 +0200 Subject: [PATCH] cleanup --- source/games/duke/src/game.h | 2 +- source/games/duke/src/zz_cmdline.cpp | 38 ------ source/games/duke/src/zz_game.cpp | 165 ++------------------------ source/games/duke/src/zz_savegame.cpp | 1 - 4 files changed, 14 insertions(+), 192 deletions(-) diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index 4d49cca69..97b82ffde 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -138,7 +138,7 @@ typedef struct { int32_t entered_name,screen_tilting; int32_t coop,screen_size,lockout,crosshair; - int32_t playerai,angleinterpolation; + int32_t angleinterpolation; int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness; int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off; diff --git a/source/games/duke/src/zz_cmdline.cpp b/source/games/duke/src/zz_cmdline.cpp index bd09600fd..5b7629168 100644 --- a/source/games/duke/src/zz_cmdline.cpp +++ b/source/games/duke/src/zz_cmdline.cpp @@ -33,46 +33,8 @@ BEGIN_DUKE_NS int32_t g_fakeMultiMode = 0; - -static void G_AddDemo(const char* param) -{ - Bstrncpy(tempbuf, param, sizeof(tempbuf)); - char * colon = (char *) Bstrchr(tempbuf, ':'); - int32_t framespertic=-1, numrepeats=1; - - if (colon && colon != tempbuf) - { - // -d:[,] - // profiling options - *(colon++) = 0; - sscanf(colon, "%d,%d", &framespertic, &numrepeats); - } - - Demo_SetFirst(tempbuf); - - if (framespertic < 0) - { - Printf("Play demo %s.\n", g_firstDemoFile); - } - else - { - framespertic = clamp(framespertic, 0, 8)+1; - // TODO: repeat count and gathering statistics. - Printf("Profile demo %s, %d frames/gametic, repeated 1x.\n", g_firstDemoFile, - framespertic-1); - Demo_PlayFirst(framespertic, 1); - g_noLogo = 1; - } -} - void G_CheckCommandLine() { - if (Args->CheckParm("-condebug") || Args->CheckParm("-z")) g_scriptDebug = 1; - if (Args->CheckParm("-altai")) - { - ud.playerai = 1; - Printf("Other player AI.\n"); - } auto val = Args->CheckValue("-skill"); if (val) { diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index f16722758..472da7372 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -54,13 +54,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h. //#define DEBUG_MIRRORS_ONLY -#if KRANDDEBUG -# define GAME_INLINE -# define GAME_STATIC -#else # define GAME_INLINE inline # define GAME_STATIC static -#endif BEGIN_DUKE_NS @@ -443,25 +438,8 @@ static void G_SE150_Draw(int32_t spnum, int32_t x, int32_t y, int32_t z, int32_t if (sprite[spnum].lotag == 154) fofmode = 150; if (sprite[spnum].lotag == 155) fofmode = 151; - // fofmode=sprite[spnum].lotag-2; - - // sectnum=sprite[j].sectnum; - // sectnum=cursectnum; ok++; - /* recursive? - for(j=0;jopos.x; - ud.foly = g_player[screenpeek].ps->opos.y; - ud.fola = g_player[screenpeek].ps->oang; - } -#endif restorepalette = 1; G_UpdateScreenArea(); } @@ -1800,21 +1752,7 @@ static void parsedefinitions_game_include(const char *fileName, scriptfile *pScr { scriptfile *included = scriptfile_fromfile(fileName); - if (!included) - { - if (!Bstrcasecmp(cmdtokptr,"null") || pScript == NULL) // this is a bit overboard to prevent unused parameter warnings - { - // Printf("Warning: Failed including %s as module\n", fn); - } -/* - else - { - Printf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } -*/ - } - else + if (included) { parsedefinitions_game(included, firstPass); scriptfile_close(included); @@ -2211,10 +2149,6 @@ static void G_Cleanup(void) if (label != (char *)&sprite[0]) Xfree(label); if (labelcode != (int32_t *)§or[0]) Xfree(labelcode); -#if 0 - if (labeltype != (int32_t*)&wall[0]) Xfree(labeltype); -#endif - } /* @@ -2247,15 +2181,9 @@ static void G_CompileScripts(void) Bmemcpy(newlabel, label, labelcnt*64); Bmemcpy(newlabelcode, labelcode, labelcnt*sizeof(int32_t)); -#if 0 - Bmemcpy(newlabeltype, labeltype, labelcnt*sizeof(int32_t)); -#endif label = newlabel; labelcode = newlabelcode; -#if 0 - labeltype = newlabeltype; -#endif } Bmemset(sprite, 0, MAXSPRITES*sizeof(spritetype)); @@ -2464,14 +2392,6 @@ static int G_EndOfLevel(void) return 1; } -#if defined(_WIN32) && defined(DEBUGGINGAIDS) -// See FILENAME_CASE_CHECK in cache1d.c -static int32_t check_filename_casing(void) -{ - return !(g_player[myconnectindex].ps->gm&MODE_GAME); -} -#endif - void G_MaybeAllocPlayer(int32_t pnum) { if (g_player[pnum].ps == NULL) @@ -2626,11 +2546,6 @@ int GameInterface::app_main() } } - // gotta set the proper title after we compile the CONs if this is the full version - - if (g_scriptDebug) - Printf("CON debugging activated (level %d).\n",g_scriptDebug); - numplayers = 1; g_mostConcurrentPlayers = ud.multimode; @@ -2788,19 +2703,16 @@ MAIN_LOOP_RESTART: Net_WaitForEverybody(); } - else// if (g_networkMode != NET_DEDICATED_SERVER) + else G_DisplayLogo(); - //if (g_networkMode != NET_DEDICATED_SERVER) + M_StartControlPanel(false); + M_SetMenu(NAME_Mainmenu); + if (G_PlaybackDemo()) { - M_StartControlPanel(false); - M_SetMenu(NAME_Mainmenu); - if (G_PlaybackDemo()) - { - FX_StopAllSounds(); - g_noLogoAnim = 1; - goto MAIN_LOOP_RESTART; - } + FX_StopAllSounds(); + g_noLogoAnim = 1; + goto MAIN_LOOP_RESTART; } } else G_UpdateScreenArea(); @@ -2836,18 +2748,8 @@ MAIN_LOOP_RESTART: // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo inputState.SetBindsEnabled(!!(g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO))); -#if 0 -//#ifndef _WIN32 - // stdin -> OSD input for dedicated server - if (g_networkMode == NET_DEDICATED_SERVER) - { - } - else -#endif - { - G_HandleLocalKeys(); - } - + G_HandleLocalKeys(); + OSD_DispatchQueued(); char gameUpdate = false; @@ -2904,11 +2806,8 @@ MAIN_LOOP_RESTART: } } - /*if (g_networkMode == NET_DEDICATED_SERVER) - { - idle(); - } - else */if (G_FPSLimit()) + + if (G_FPSLimit()) { if (RRRA && g_player[myconnectindex].ps->OnMotorcycle) P_GetInputMotorcycle(myconnectindex); @@ -2938,7 +2837,7 @@ MAIN_LOOP_RESTART: while (1); } -GAME_STATIC GAME_INLINE int32_t G_MoveLoop() +int32_t G_MoveLoop() { int i; @@ -2985,9 +2884,6 @@ int G_DoMoveThings(void) // Name display when aiming at opponents if (cl_idplayers && (g_netServer || ud.multimode > 1) -#ifdef SPLITSCREEN_MOD_HACKS - && !g_fakeMultiMode -#endif ) { hitdata_t hitData; @@ -3035,12 +2931,6 @@ int G_DoMoveThings(void) } } - // Moved lower so it is restored correctly by diffs: -// everyothertime++; - - //if (g_netClient) // [75] The server should not overwrite its own randomseed - // randomseed = ticrandomseed; - for (bssize_t TRAVERSE_CONNECT(i)) Bmemcpy(g_player[i].input, &inputfifo[movefifoplc&(MOVEFIFOSIZ-1)][i], sizeof(input_t)); @@ -3048,24 +2938,6 @@ int G_DoMoveThings(void) G_UpdateInterpolations(); - /* - j = -1; - for (TRAVERSE_CONNECT(i)) - { - if (g_player[i].playerquitflag == 0 || TEST_SYNC_KEY(g_player[i].sync->bits,SK_GAMEQUIT) == 0) - { - j = i; - continue; - } - - G_CloseDemoWrite(); - - g_player[i].playerquitflag = 0; - } - */ - - Net_GetSyncStat(); - g_moveThingsCount++; if (ud.recstat == 1) G_DemoRecord(); @@ -3128,25 +3000,14 @@ int G_DoMoveThings(void) Net_CorrectPrediction(); - //if (g_netServer) - // Net_SendServerUpdates(); - if ((everyothertime&1) == 0) { { fi.animatewalls(); movecyclers(); } - - //if (g_netServer && (everyothertime % 10) == 0) - //{ - // Net_SendMapUpdate(); - //} } - //if (g_netClient) //Slave - // Net_SendClientUpdate(); - if (RR && ud.recstat == 0 && ud.multimode < 2) dotorch(); diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index 72f3c99a2..5073e8793 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -804,7 +804,6 @@ static const dataspec_t svgm_udnetw[] = { DS_NOCHK, &ud.marker, sizeof(ud.marker), 1 }, { DS_NOCHK, &ud.ffire, sizeof(ud.ffire), 1 }, { DS_NOCHK, &ud.noexits, sizeof(ud.noexits), 1 }, - { DS_NOCHK, &ud.playerai, sizeof(ud.playerai), 1 }, { 0, &ud.pause_on, sizeof(ud.pause_on), 1 }, { 0, connectpoint2, sizeof(connectpoint2), 1 }, { 0, &randomseed, sizeof(randomseed), 1 },