From 18b272412a0e5d8f3a872afaeaa8c2abbc2e9626 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 23 Jun 2020 21:56:42 +0200 Subject: [PATCH] - command line stuff can be traced back to JFDuke. --- source/games/duke/CMakeLists.txt | 2 +- source/games/duke/src/cmdline.h | 38 ------------------- source/games/duke/src/duke3d.h | 2 + .../src/{zz_cmdline.cpp => game_main.cpp} | 31 ++++++++++----- source/games/duke/src/zz_game.cpp | 5 ++- source/games/duke/src/zz_osdcmds.cpp | 2 +- source/games/duke/src/zz_premap.cpp | 1 - 7 files changed, 29 insertions(+), 52 deletions(-) delete mode 100644 source/games/duke/src/cmdline.h rename source/games/duke/src/{zz_cmdline.cpp => game_main.cpp} (57%) diff --git a/source/games/duke/CMakeLists.txt b/source/games/duke/CMakeLists.txt index c29de71df..00a0d660a 100644 --- a/source/games/duke/CMakeLists.txt +++ b/source/games/duke/CMakeLists.txt @@ -1,5 +1,6 @@ set( PCH_SOURCES + src/game_main.cpp src/actors.cpp src/actors_r.cpp src/actors_d.cpp @@ -33,7 +34,6 @@ set( PCH_SOURCES src/zz_actors.cpp src/zz_anim.cpp src/zz_cheats.cpp - src/zz_cmdline.cpp src/zz_common.cpp src/zz_d_menu.cpp src/zz_demo.cpp diff --git a/source/games/duke/src/cmdline.h b/source/games/duke/src/cmdline.h deleted file mode 100644 index c983f2e12..000000000 --- a/source/games/duke/src/cmdline.h +++ /dev/null @@ -1,38 +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. -*/ -//------------------------------------------------------------------------- - -#ifndef cmdline_h__ -#define cmdline_h__ - -#include "compat.h" - -BEGIN_DUKE_NS - -extern void G_CheckCommandLine(); -extern void G_ShowParameterHelp(void); -extern void G_ShowDebugHelp(void); - -extern int32_t g_fakeMultiMode; - -END_DUKE_NS - -#endif // cmdline_h__ diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 6dbe54262..241923726 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -37,6 +37,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS +extern int32_t g_fakeMultiMode; + #define VOLUMEALL (g_Shareware == 0) #define PLUTOPAK (true)//g_scriptVersion >= 14) #define VOLUMEONE (g_Shareware == 1) diff --git a/source/games/duke/src/zz_cmdline.cpp b/source/games/duke/src/game_main.cpp similarity index 57% rename from source/games/duke/src/zz_cmdline.cpp rename to source/games/duke/src/game_main.cpp index 5b7629168..f6c51faf8 100644 --- a/source/games/duke/src/zz_cmdline.cpp +++ b/source/games/duke/src/game_main.cpp @@ -1,12 +1,13 @@ //------------------------------------------------------------------------- /* -Copyright (C) 2016 EDuke32 developers and contributors +Copyright (C) 1996, 2003 - 3D Realms Entertainment -This file is part of EDuke32. +This file is part of Duke Nukem 3D version 1.5 - Atomic Edition -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. +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 @@ -16,9 +17,13 @@ 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. +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 +Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) */ -//------------------------------------------------------------------------- +//------------------------------------------------------------------------- #include "ns.h" // Must come before everything else! @@ -31,17 +36,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS -int32_t g_fakeMultiMode = 0; +//--------------------------------------------------------------------------- +// +// game specific command line args go here. +// +//--------------------------------------------------------------------------- -void G_CheckCommandLine() +void checkcommandline() { auto val = Args->CheckValue("-skill"); + if (!val) val = Args->CheckValue("-s"); if (val) { ud.m_player_skill = ud.player_skill = clamp((int)strtol(val, nullptr, 0), 0, 5); if (ud.m_player_skill == 4) ud.m_respawn_monsters = ud.respawn_monsters = 1; } val = Args->CheckValue("-respawn"); + if (!val) val = Args->CheckValue("-t"); if (val) { if (*val == '1') ud.m_respawn_monsters = 1; @@ -56,4 +67,6 @@ void G_CheckCommandLine() Printf("Respawn on.\n"); } } + END_DUKE_NS + diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 7518a1795..0ed8b42dd 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "cheats.h" #include "sbar.h" #include "screens.h" -#include "cmdline.h" #include "palette.h" #include "gamecvars.h" #include "gameconfigfile.h" @@ -60,7 +59,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS void SetDispatcher(); +void checkcommandline(); +int32_t g_fakeMultiMode = 0; int32_t g_quitDeadline = 0; int32_t g_cameraDistance = 0, g_cameraClock = 0; @@ -2375,7 +2376,7 @@ int GameInterface::app_main() // accesses g_player[0]. G_MaybeAllocPlayer(0); - G_CheckCommandLine(); + checkcommandline(); SetDefaults(); diff --git a/source/games/duke/src/zz_osdcmds.cpp b/source/games/duke/src/zz_osdcmds.cpp index e7766f3e4..fbe7a9b7e 100644 --- a/source/games/duke/src/zz_osdcmds.cpp +++ b/source/games/duke/src/zz_osdcmds.cpp @@ -20,10 +20,10 @@ 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! #include "cheats.h" -#include "cmdline.h" #include "demo.h" // g_firstDemoFile[] #include "duke3d.h" #include "menus.h" diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index dacc62aea..0d214a7e8 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menus.h" #include "demo.h" #include "savegame.h" -#include "cmdline.h" #include "statistics.h" #include "menu/menu.h" #include "mapinfo.h"