mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- startup cleanup.
This commit is contained in:
parent
57f879fa8b
commit
67acad3984
22 changed files with 119 additions and 468 deletions
|
@ -1235,11 +1235,9 @@ static int32_t check_filename_casing(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
int app_main(int argc, char const * const * argv)
|
||||
int app_main()
|
||||
{
|
||||
char buffer[BMAX_PATH];
|
||||
margc = argc;
|
||||
margv = argv;
|
||||
|
||||
OSD_SetFunctions(NULL,
|
||||
NULL,
|
||||
|
@ -2277,7 +2275,7 @@ void sndPlaySpecialMusicOrNothing(int nMusic)
|
|||
}
|
||||
|
||||
extern void faketimerhandler();
|
||||
extern int app_main(int argc, char const* const* argv);
|
||||
extern int app_main();
|
||||
extern void app_crashhandler(void);
|
||||
bool validate_hud(int layout);
|
||||
void set_hud_layout(int layout);
|
||||
|
|
|
@ -230,7 +230,7 @@ struct GameInterface
|
|||
{
|
||||
int TicRate;
|
||||
void (*faketimerhandler)();
|
||||
int (*app_main)(int, char const* const*);
|
||||
int (*app_main)();
|
||||
bool (*validate_hud)(int);
|
||||
void (*set_hud_layout)(int size);
|
||||
void (*set_hud_scale)(int size);
|
||||
|
|
|
@ -385,9 +385,6 @@ static void sighandler(int signum)
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
FString currentGame; // Currently there is no global state for the current game. This is a temporary workaround because the video init code needs to do a few things based on the active game.
|
||||
|
||||
|
||||
int WINAPI WinMain(HINSTANCE , HINSTANCE , LPSTR , int )
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -452,8 +449,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
FString logpath = M_GetDocumentsPath() + "demolition.log";
|
||||
OSD_SetLogFile(logpath);
|
||||
CONFIG_Init();
|
||||
r = gi->app_main(buildargc, (const char**)buildargv);
|
||||
r = CONFIG_Init();
|
||||
}
|
||||
catch (const std::runtime_error & err)
|
||||
{
|
||||
|
@ -636,7 +632,6 @@ int32_t initsystem(void)
|
|||
if (drvname)
|
||||
initprintf("Using \"%s\" video driver\n", drvname);
|
||||
#endif
|
||||
wm_setapptitle(apptitle);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1351,7 +1346,6 @@ int32_t setvideomode_sdlcommon(int32_t *x, int32_t *y, int32_t c, int32_t fs, in
|
|||
|
||||
void setvideomode_sdlcommonpost(int32_t x, int32_t y, int32_t c, int32_t fs, int32_t regrab)
|
||||
{
|
||||
wm_setapptitle(apptitle);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (!nogl)
|
||||
|
|
|
@ -198,6 +198,7 @@ void FGameConfigFile::DoAutoloadSetup (/*FIWadManager *iwad_man*/)
|
|||
{
|
||||
const char *lastver = GetValueForKey ("Version");
|
||||
if (lastver != NULL) last = atof(lastver);
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
CreateSectionAtStart("Global.Autoload");
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
void AddAutoexec (FArgs *list, const char *gamename);
|
||||
FString GetConfigPath (bool tryProg);
|
||||
void ReadNetVars ();
|
||||
bool IsInitialized() const { return isInitialized; }
|
||||
|
||||
protected:
|
||||
void WriteCommentHeader (FileWriter *file) const;
|
||||
|
@ -65,6 +66,7 @@ private:
|
|||
void ReadCVars (unsigned flags);
|
||||
|
||||
bool bModSetup;
|
||||
bool isInitialized;
|
||||
|
||||
char section[64];
|
||||
char *subsection;
|
||||
|
|
|
@ -110,7 +110,7 @@ static const GameFuncNameDesc gamefuncs[] = {
|
|||
|
||||
};
|
||||
|
||||
extern FString currentGame;
|
||||
FString currentGame;
|
||||
FString LumpFilter;
|
||||
|
||||
static TMap<FName, int> GF_NameToNum;
|
||||
|
@ -349,14 +349,14 @@ void CheckFrontend(int flags)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void CONFIG_Init()
|
||||
int CONFIG_Init()
|
||||
{
|
||||
SetClipshapes();
|
||||
|
||||
// This must be done before initializing any data, so doing it late in the startup process won't work.
|
||||
if (CONTROL_Startup(controltype_keyboardandmouse, BGetTime, gi->TicRate))
|
||||
{
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
userConfig.ProcessOptions();
|
||||
|
||||
|
@ -366,14 +366,33 @@ void CONFIG_Init()
|
|||
|
||||
auto groups = GrpScan();
|
||||
int groupno = ShowStartupWindow(groups);
|
||||
LumpFilter = currentGame;
|
||||
if (LumpFilter.Compare("Redneck") == 0) LumpFilter = "Redneck.Redneck";
|
||||
else if (LumpFilter.Compare("RedneckRides") == 0) LumpFilter = "Redneck.RidesAgain";
|
||||
if (groupno == -1) return 0;
|
||||
auto &group = groups[groupno];
|
||||
GrpEntry* dependency = nullptr;
|
||||
if (group.FileInfo.dependencyCRC != 0)
|
||||
{
|
||||
for (auto& dep : groups)
|
||||
{
|
||||
if (dep.FileInfo.CRC == group.FileInfo.dependencyCRC)
|
||||
{
|
||||
dependency = &dep;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LumpFilter = group.FileInfo.gamefilter;
|
||||
if (LumpFilter.IsEmpty() && dependency) LumpFilter = dependency->FileInfo.gamefilter;
|
||||
currentGame = LumpFilter;
|
||||
currentGame.Truncate(currentGame.IndexOf("."));
|
||||
CheckFrontend(group.FileInfo.flags);
|
||||
|
||||
//CONFIG_ReadCombatMacros();
|
||||
//CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
|
||||
G_ReadConfig(currentGame);
|
||||
|
||||
if (!GameConfig->IsInitialized())
|
||||
{
|
||||
CONFIG_ReadCombatMacros();
|
||||
CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
|
||||
}
|
||||
|
||||
if (userConfig.CommandName.IsNotEmpty())
|
||||
{
|
||||
|
@ -399,6 +418,7 @@ void CONFIG_Init()
|
|||
CONTROL_ClearAssignments();
|
||||
CONFIG_InitMouseAndController();
|
||||
CONFIG_SetGameControllerDefaultsStandard();
|
||||
return gi->app_main();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -14,7 +14,7 @@ class FArgs;
|
|||
|
||||
extern uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
|
||||
|
||||
void CONFIG_Init();
|
||||
int CONFIG_Init();
|
||||
void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy=false);
|
||||
int32_t CONFIG_FunctionNameToNum(const char* func);
|
||||
const char* CONFIG_FunctionNumToName(int32_t func);
|
||||
|
|
|
@ -27,11 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "screens.h"
|
||||
#include "renderlayer.h"
|
||||
#include "cmdline.h"
|
||||
#include "m_argv.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
int32_t g_commandSetup = 0;
|
||||
int32_t g_noSetup = 0;
|
||||
int32_t g_fakeMultiMode = 0;
|
||||
|
||||
|
||||
|
@ -66,164 +65,38 @@ static void G_AddDemo(const char* param)
|
|||
}
|
||||
}
|
||||
|
||||
void G_CheckCommandLine(int32_t argc, char const * const * argv)
|
||||
void G_CheckCommandLine()
|
||||
{
|
||||
// stuff for later
|
||||
#if 0
|
||||
int16_t i = 1, j;
|
||||
const char *c, *k;
|
||||
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
initprintf("Application parameters: ");
|
||||
while (i < argc)
|
||||
initprintf("%s ", argv[i++]);
|
||||
initprintf("\n");
|
||||
|
||||
i = 1;
|
||||
do
|
||||
{
|
||||
const char *const oc = argv[i];
|
||||
int32_t shortopt = 0, ignored_short_opt = 0;
|
||||
|
||||
c = oc;
|
||||
|
||||
if (*c == '-')
|
||||
{
|
||||
shortopt = 0;
|
||||
|
||||
if (!Bstrcasecmp(c+1, "noffire"))
|
||||
{
|
||||
ud.m_ffire = 0;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
if (!Bstrcasecmp(c+1, "clipmap"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddClipMap(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!Bstrcasecmp(c+1, "condebug"))
|
||||
{
|
||||
g_scriptDebug = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*c == '-')
|
||||
#ifdef _WIN32
|
||||
|| (*c == '/')
|
||||
#endif
|
||||
)
|
||||
{
|
||||
shortopt = 1;
|
||||
|
||||
c++;
|
||||
switch (Btolower(*c))
|
||||
{
|
||||
case 'a':
|
||||
ud.playerai = 1;
|
||||
initprintf("Other player AI.\n");
|
||||
break;
|
||||
case 'c':
|
||||
c++;
|
||||
ud.m_coop = 0;
|
||||
while ((*c >= '0')&&(*c <= '9'))
|
||||
{
|
||||
ud.m_coop *= 10;
|
||||
ud.m_coop += *c - '0';
|
||||
c++;
|
||||
}
|
||||
ud.m_coop--;
|
||||
break;
|
||||
case 'q':
|
||||
if (*(++c) == 0)
|
||||
{
|
||||
ud.multimode = 1;
|
||||
initprintf("Fake multiplayer mode: expected number after -q, falling back to 1 player.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t numpl = Batoi(c);
|
||||
|
||||
if (numpl < 2 || numpl > MAXPLAYERS)
|
||||
{
|
||||
initprintf("Fake multiplayer mode: expected 2-%d players, falling back to 1.\n",
|
||||
MAXPLAYERS);
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.multimode = numpl;
|
||||
initprintf("Fake multiplayer mode: %d players.\n", ud.multimode);
|
||||
|
||||
g_fakeMultiMode = numpl;
|
||||
}
|
||||
}
|
||||
|
||||
ud.m_coop = ud.coop = 0;
|
||||
ud.m_marker = ud.marker = 1;
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = 1;
|
||||
ud.m_respawn_items = ud.respawn_items = 1;
|
||||
ud.m_respawn_inventory = ud.respawn_inventory = 1;
|
||||
break;
|
||||
case 'r':
|
||||
ud.m_recstat = 1;
|
||||
initprintf("Demo record mode on.\n");
|
||||
break;
|
||||
case 's':
|
||||
c++;
|
||||
ud.m_player_skill = ud.player_skill = (Batoi(c)%5);
|
||||
if (ud.m_player_skill == 4)
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = 1;
|
||||
break;
|
||||
case 't':
|
||||
c++;
|
||||
if (*c == '1') ud.m_respawn_monsters = 1;
|
||||
else if (*c == '2') ud.m_respawn_items = 1;
|
||||
else if (*c == '3') ud.m_respawn_inventory = 1;
|
||||
else
|
||||
{
|
||||
ud.m_respawn_monsters = 1;
|
||||
ud.m_respawn_items = 1;
|
||||
ud.m_respawn_inventory = 1;
|
||||
}
|
||||
initprintf("Respawn on.\n");
|
||||
break;
|
||||
case 'v':
|
||||
c++;
|
||||
ud.warp_on = 1;
|
||||
ud.m_volume_number = ud.volume_number = ((unsigned) (Batoi(c)-1))%MAXVOLUMES;
|
||||
break;
|
||||
case 'w':
|
||||
cl_showcoords = 1;
|
||||
break;
|
||||
case 'z':
|
||||
c++;
|
||||
g_scriptDebug = Batoi(c);
|
||||
if (!g_scriptDebug)
|
||||
g_scriptDebug = 1;
|
||||
break;
|
||||
default:
|
||||
ignored_short_opt = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!shortopt || ignored_short_opt)
|
||||
initprintf("Warning: ignored application parameter \"%s\".\n", oc);
|
||||
|
||||
i++;
|
||||
} while (i < argc);
|
||||
}
|
||||
#endif
|
||||
if (Args->CheckParm("-condebug") || Args->CheckParm("-z")) g_scriptDebug = 1;
|
||||
if (Args->CheckParm("-altai"))
|
||||
{
|
||||
ud.playerai = 1;
|
||||
OSD_Printf("Other player AI.\n");
|
||||
}
|
||||
auto val = Args->CheckValue("-skill");
|
||||
if (val)
|
||||
{
|
||||
ud.m_player_skill = ud.player_skill = std::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)
|
||||
{
|
||||
if (*val == '1') ud.m_respawn_monsters = 1;
|
||||
else if (*val == '2') ud.m_respawn_items = 1;
|
||||
else if (*val == '3') ud.m_respawn_inventory = 1;
|
||||
else
|
||||
{
|
||||
ud.m_respawn_monsters = 1;
|
||||
ud.m_respawn_items = 1;
|
||||
ud.m_respawn_inventory = 1;
|
||||
}
|
||||
OSD_Printf("Respawn on.\n");
|
||||
}
|
||||
if (Args->CheckParm("-showcoords") || Args->CheckParm("-w"))
|
||||
{
|
||||
cl_showcoords = 1;
|
||||
}
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -28,12 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_DUKE_NS
|
||||
|
||||
|
||||
extern void G_CheckCommandLine(int32_t argc, char const * const * argv);
|
||||
extern void G_CheckCommandLine();
|
||||
extern void G_ShowParameterHelp(void);
|
||||
extern void G_ShowDebugHelp(void);
|
||||
|
||||
extern int32_t g_commandSetup;
|
||||
extern int32_t g_noSetup;
|
||||
extern int32_t g_fakeMultiMode;
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -5705,23 +5705,6 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
|
|||
|
||||
|
||||
|
||||
void G_UpdateAppTitle(void)
|
||||
{
|
||||
if (g_gameNamePtr)
|
||||
{
|
||||
#ifdef EDUKE32_STANDALONE
|
||||
Bstrcpy(tempbuf, g_gameNamePtr);
|
||||
#else
|
||||
Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr);
|
||||
#endif
|
||||
wm_setapptitle(tempbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
wm_setapptitle(APPNAME);
|
||||
}
|
||||
}
|
||||
|
||||
static void G_FreeHashAnim(const char * /*string*/, intptr_t key)
|
||||
{
|
||||
Xfree((void *)key);
|
||||
|
@ -6140,7 +6123,6 @@ void G_BackToMenu(void)
|
|||
Menu_Open(myconnectindex);
|
||||
Menu_Change(MENU_MAIN);
|
||||
KB_FlushKeyboardQueue();
|
||||
G_UpdateAppTitle();
|
||||
}
|
||||
|
||||
static int G_EndOfLevel(void)
|
||||
|
@ -6261,7 +6243,7 @@ void G_MaybeAllocPlayer(int32_t pnum)
|
|||
EDUKE32_STATIC_ASSERT(sizeof(actor_t)%4 == 0);
|
||||
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0);
|
||||
|
||||
int app_main(int argc, const char * const*argv)
|
||||
int app_main()
|
||||
{
|
||||
#ifndef NETCODE_DISABLE
|
||||
if (enet_initialize() != 0)
|
||||
|
@ -6278,8 +6260,6 @@ int app_main(int argc, const char * const*argv)
|
|||
BGetTime,
|
||||
GAME_onshowosd);
|
||||
|
||||
wm_setapptitle(APPNAME);
|
||||
|
||||
initprintf(HEAD2 " %s\n", s_buildRev);
|
||||
PrintBuildInfo();
|
||||
|
||||
|
@ -6297,7 +6277,7 @@ int app_main(int argc, const char * const*argv)
|
|||
G_DeleteOldSaves();
|
||||
#endif
|
||||
|
||||
G_CheckCommandLine(argc,argv);
|
||||
G_CheckCommandLine();
|
||||
|
||||
// This needs to happen afterwards, as G_CheckCommandLine() is where we set
|
||||
// up the command-line-provided search paths (duh).
|
||||
|
@ -6336,8 +6316,6 @@ int app_main(int argc, const char * const*argv)
|
|||
|
||||
// gotta set the proper title after we compile the CONs if this is the full version
|
||||
|
||||
G_UpdateAppTitle();
|
||||
|
||||
if (g_scriptDebug)
|
||||
initprintf("CON debugging activated (level %d).\n",g_scriptDebug);
|
||||
|
||||
|
@ -7085,7 +7063,7 @@ void A_SpawnRandomGlass(int spriteNum, int wallNum, int glassCnt)
|
|||
#endif
|
||||
|
||||
extern void faketimerhandler();
|
||||
extern int app_main(int argc, char const* const* argv);
|
||||
extern int app_main();
|
||||
extern void app_crashhandler(void);
|
||||
|
||||
GameInterface Interface = {
|
||||
|
|
|
@ -313,7 +313,6 @@ void G_GameQuit(void);
|
|||
void G_GetCrosshairColor(void);
|
||||
void G_HandleLocalKeys(void);
|
||||
void G_HandleSpecialKeys(void);
|
||||
void G_UpdateAppTitle(void);
|
||||
void G_PrintGameQuotes(int32_t snum);
|
||||
//void G_SE40(int32_t smoothratio);
|
||||
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
|
||||
|
|
|
@ -5194,7 +5194,7 @@ repeatcase:
|
|||
}
|
||||
gamename[i] = '\0';
|
||||
g_gameNamePtr = Xstrdup(gamename);
|
||||
G_UpdateAppTitle();
|
||||
// G_UpdateAppTitle();
|
||||
}
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1842,32 +1842,6 @@ int G_EnterLevel(int gameMode)
|
|||
|
||||
ud.screen_size = ssize;
|
||||
|
||||
if (Menu_HaveUserMap())
|
||||
{
|
||||
if (g_gameNamePtr)
|
||||
#ifdef EDUKE32_STANDALONE
|
||||
Bsnprintf(apptitle, sizeof(apptitle), "%s - %s", boardfilename, g_gameNamePtr);
|
||||
#else
|
||||
Bsnprintf(apptitle, sizeof(apptitle), "%s - %s - " APPNAME, boardfilename, g_gameNamePtr);
|
||||
#endif
|
||||
else
|
||||
Bsnprintf(apptitle, sizeof(apptitle), "%s - " APPNAME, boardfilename);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_gameNamePtr)
|
||||
#ifdef EDUKE32_STANDALONE
|
||||
Bsprintf(apptitle,"%s - %s",m.name,g_gameNamePtr);
|
||||
#else
|
||||
Bsprintf(apptitle, "%s - %s - " APPNAME, m.name, g_gameNamePtr);
|
||||
#endif
|
||||
else
|
||||
Bsprintf(apptitle,"%s - " APPNAME,m.name);
|
||||
}
|
||||
|
||||
Bstrcpy(tempbuf,apptitle);
|
||||
wm_setapptitle(tempbuf);
|
||||
|
||||
auto &p0 = *g_player[0].ps;
|
||||
int16_t playerAngle;
|
||||
|
||||
|
|
|
@ -1609,8 +1609,6 @@ void G_DisplayLogo(void)
|
|||
renderFlushPerms();
|
||||
videoNextPage();
|
||||
|
||||
G_UpdateAppTitle();
|
||||
|
||||
S_StopMusic();
|
||||
FX_StopAllSounds(); // JBF 20031228
|
||||
S_ClearSoundLocks(); // JBF 20031228
|
||||
|
@ -2151,8 +2149,6 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
if (g_networkMode == NET_DEDICATED_SERVER)
|
||||
return;
|
||||
|
||||
G_UpdateAppTitle();
|
||||
|
||||
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
|
||||
{
|
||||
lastmapname = Bstrrchr(boardfilename, '\\');
|
||||
|
|
|
@ -642,7 +642,8 @@ int ShowStartupWindow(TArray<GrpEntry> &groups)
|
|||
auto choice = startwin_run();
|
||||
if (choice == 0)
|
||||
{
|
||||
Bexit(EXIT_SUCCESS);
|
||||
startwin_close();
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
startwin_close();
|
||||
|
|
|
@ -27,12 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "screens.h"
|
||||
#include "renderlayer.h"
|
||||
#include "cmdline.h"
|
||||
#include "m_argv.h"
|
||||
|
||||
BEGIN_RR_NS
|
||||
|
||||
int32_t g_commandSetup = 0;
|
||||
int32_t g_noSetup = 0;
|
||||
int32_t g_noSound = 0;
|
||||
int32_t g_fakeMultiMode = 0;
|
||||
|
||||
|
||||
|
@ -67,159 +65,37 @@ static void G_AddDemo(const char* param)
|
|||
}
|
||||
}
|
||||
|
||||
void G_CheckCommandLine(int32_t argc, char const * const * argv)
|
||||
void G_CheckCommandLine()
|
||||
{
|
||||
// Stuff to sort out later.
|
||||
#if 0
|
||||
int16_t i = 1, j;
|
||||
const char *c, *k;
|
||||
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
initprintf("Application parameters: ");
|
||||
while (i < argc)
|
||||
initprintf("%s ", argv[i++]);
|
||||
initprintf("\n");
|
||||
|
||||
i = 1;
|
||||
do
|
||||
{
|
||||
const char *const oc = argv[i];
|
||||
int32_t shortopt = 0, ignored_short_opt = 0;
|
||||
|
||||
c = oc;
|
||||
|
||||
if (*c == '-')
|
||||
{
|
||||
shortopt = 0;
|
||||
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
if (!Bstrcasecmp(c+1, "clipmap"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
G_AddClipMap(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!Bstrcasecmp(c+1, "condebug"))
|
||||
{
|
||||
g_scriptDebug = 1;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*c == '-')
|
||||
#ifdef _WIN32
|
||||
|| (*c == '/')
|
||||
#endif
|
||||
)
|
||||
{
|
||||
shortopt = 1;
|
||||
|
||||
c++;
|
||||
switch (Btolower(*c))
|
||||
{
|
||||
case 'a':
|
||||
ud.playerai = 1;
|
||||
initprintf("Other player AI.\n");
|
||||
break;
|
||||
case 'c':
|
||||
c++;
|
||||
ud.m_coop = 0;
|
||||
while ((*c >= '0')&&(*c <= '9'))
|
||||
{
|
||||
ud.m_coop *= 10;
|
||||
ud.m_coop += *c - '0';
|
||||
c++;
|
||||
}
|
||||
ud.m_coop--;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
if (*(++c) == 0)
|
||||
{
|
||||
ud.multimode = 1;
|
||||
initprintf("Fake multiplayer mode: expected number after -q, falling back to 1 player.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t numpl = Batoi(c);
|
||||
|
||||
if (numpl < 2 || numpl > MAXPLAYERS)
|
||||
{
|
||||
initprintf("Fake multiplayer mode: expected 2-%d players, falling back to 1.\n",
|
||||
MAXPLAYERS);
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.multimode = numpl;
|
||||
initprintf("Fake multiplayer mode: %d players.\n", ud.multimode);
|
||||
|
||||
g_fakeMultiMode = numpl;
|
||||
}
|
||||
}
|
||||
|
||||
ud.m_coop = ud.coop = 0;
|
||||
ud.m_marker = ud.marker = 1;
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = 1;
|
||||
ud.m_respawn_items = ud.respawn_items = 1;
|
||||
ud.m_respawn_inventory = ud.respawn_inventory = 1;
|
||||
break;
|
||||
case 'r':
|
||||
ud.m_recstat = 1;
|
||||
initprintf("Demo record mode on.\n");
|
||||
break;
|
||||
case 's':
|
||||
c++;
|
||||
ud.m_player_skill = ud.player_skill = (Batoi(c)%5);
|
||||
if (ud.m_player_skill == 4)
|
||||
ud.m_respawn_monsters = ud.respawn_monsters = 1;
|
||||
break;
|
||||
case 't':
|
||||
c++;
|
||||
if (*c == '1') ud.m_respawn_monsters = 1;
|
||||
else if (*c == '2') ud.m_respawn_items = 1;
|
||||
else if (*c == '3') ud.m_respawn_inventory = 1;
|
||||
else
|
||||
{
|
||||
ud.m_respawn_monsters = 1;
|
||||
ud.m_respawn_items = 1;
|
||||
ud.m_respawn_inventory = 1;
|
||||
}
|
||||
initprintf("Respawn on.\n");
|
||||
break;
|
||||
case 'v':
|
||||
c++;
|
||||
ud.warp_on = 1;
|
||||
ud.m_volume_number = ud.volume_number = ((unsigned) (Batoi(c)-1))%MAXVOLUMES;
|
||||
break;
|
||||
case 'w':
|
||||
cl_showcoords = 1;
|
||||
break;
|
||||
case 'z':
|
||||
c++;
|
||||
g_scriptDebug = Batoi(c);
|
||||
if (!g_scriptDebug)
|
||||
g_scriptDebug = 1;
|
||||
break;
|
||||
default:
|
||||
ignored_short_opt = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!shortopt || ignored_short_opt)
|
||||
initprintf("Warning: ignored application parameter \"%s\".\n", oc);
|
||||
|
||||
i++;
|
||||
} while (i < argc);
|
||||
}
|
||||
#endif
|
||||
if (Args->CheckParm("-condebug") || Args->CheckParm("-z")) g_scriptDebug = 1;
|
||||
if (Args->CheckParm("-altai"))
|
||||
{
|
||||
ud.playerai = 1;
|
||||
OSD_Printf("Other player AI.\n");
|
||||
}
|
||||
auto val = Args->CheckValue("-skill");
|
||||
if (val)
|
||||
{
|
||||
ud.m_player_skill = ud.player_skill = std::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)
|
||||
{
|
||||
if (*val == '1') ud.m_respawn_monsters = 1;
|
||||
else if (*val == '2') ud.m_respawn_items = 1;
|
||||
else if (*val == '3') ud.m_respawn_inventory = 1;
|
||||
else
|
||||
{
|
||||
ud.m_respawn_monsters = 1;
|
||||
ud.m_respawn_items = 1;
|
||||
ud.m_respawn_inventory = 1;
|
||||
}
|
||||
OSD_Printf("Respawn on.\n");
|
||||
}
|
||||
if (Args->CheckParm("-showcoords") || Args->CheckParm("-w"))
|
||||
{
|
||||
cl_showcoords = 1;
|
||||
}
|
||||
}
|
||||
END_RR_NS
|
||||
|
|
|
@ -27,12 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_RR_NS
|
||||
|
||||
extern void G_CheckCommandLine(int32_t argc, char const * const * argv);
|
||||
extern void G_CheckCommandLine();
|
||||
extern void G_ShowParameterHelp(void);
|
||||
extern void G_ShowDebugHelp(void);
|
||||
|
||||
extern int32_t g_commandSetup;
|
||||
extern int32_t g_noSetup;
|
||||
extern int32_t g_fakeMultiMode;
|
||||
|
||||
END_RR_NS
|
||||
|
|
|
@ -7073,19 +7073,6 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
|
|||
|
||||
|
||||
|
||||
void G_UpdateAppTitle(void)
|
||||
{
|
||||
if (g_gameNamePtr)
|
||||
{
|
||||
Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr);
|
||||
wm_setapptitle(tempbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
wm_setapptitle(APPNAME);
|
||||
}
|
||||
}
|
||||
|
||||
static void G_FreeHashAnim(const char * /*string*/, intptr_t key)
|
||||
{
|
||||
Bfree((void *)key);
|
||||
|
@ -7529,7 +7516,6 @@ void G_BackToMenu(void)
|
|||
Menu_Open(myconnectindex);
|
||||
Menu_Change(MENU_MAIN);
|
||||
KB_FlushKeyboardQueue();
|
||||
G_UpdateAppTitle();
|
||||
}
|
||||
|
||||
static int G_EndOfLevel(void)
|
||||
|
@ -7627,7 +7613,7 @@ void G_MaybeAllocPlayer(int32_t pnum)
|
|||
EDUKE32_STATIC_ASSERT(sizeof(actor_t)%4 == 0);
|
||||
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0);
|
||||
|
||||
int app_main(int argc, char const * const * argv)
|
||||
int app_main()
|
||||
{
|
||||
playing_rr = 1;
|
||||
#ifndef NETCODE_DISABLE
|
||||
|
@ -7636,14 +7622,6 @@ int app_main(int argc, char const * const * argv)
|
|||
else atexit(enet_deinitialize);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
extern int32_t (*check_filename_casing_fn)(void);
|
||||
check_filename_casing_fn = check_filename_casing;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
OSD_SetFunctions(GAME_drawosdchar,
|
||||
GAME_drawosdstr,
|
||||
GAME_drawosdcursor,
|
||||
|
@ -7653,8 +7631,6 @@ int app_main(int argc, char const * const * argv)
|
|||
BGetTime,
|
||||
GAME_onshowosd);
|
||||
|
||||
wm_setapptitle(APPNAME);
|
||||
|
||||
initprintf(HEAD2 " %s\n", s_buildRev);
|
||||
PrintBuildInfo();
|
||||
|
||||
|
@ -7672,7 +7648,7 @@ int app_main(int argc, char const * const * argv)
|
|||
// accesses g_player[0].
|
||||
G_MaybeAllocPlayer(0);
|
||||
|
||||
G_CheckCommandLine(argc,argv);
|
||||
G_CheckCommandLine();
|
||||
|
||||
// This needs to happen afterwards, as G_CheckCommandLine() is where we set
|
||||
// up the command-line-provided search paths (duh).
|
||||
|
@ -7717,8 +7693,6 @@ int app_main(int argc, char const * const * argv)
|
|||
|
||||
// gotta set the proper title after we compile the CONs if this is the full version
|
||||
|
||||
G_UpdateAppTitle();
|
||||
|
||||
if (g_scriptDebug)
|
||||
initprintf("CON debugging activated (level %d).\n",g_scriptDebug);
|
||||
|
||||
|
@ -8534,7 +8508,7 @@ void A_SpawnRandomGlass(int spriteNum, int wallNum, int glassCnt)
|
|||
|
||||
|
||||
extern void faketimerhandler();
|
||||
extern int app_main(int argc, char const* const* argv);
|
||||
extern int app_main();
|
||||
extern void app_crashhandler(void);
|
||||
|
||||
GameInterface Interface = {
|
||||
|
|
|
@ -286,7 +286,6 @@ void G_GameQuit(void);
|
|||
void G_GetCrosshairColor(void);
|
||||
void G_HandleLocalKeys(void);
|
||||
void G_HandleSpecialKeys(void);
|
||||
void G_UpdateAppTitle(void);
|
||||
void G_PrintGameQuotes(int32_t snum);
|
||||
//void G_SE40(int32_t smoothratio);
|
||||
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
|
||||
|
|
|
@ -2376,24 +2376,6 @@ int G_EnterLevel(int gameMode)
|
|||
|
||||
ud.screen_size = i;
|
||||
|
||||
if (Menu_HaveUserMap())
|
||||
{
|
||||
if (g_gameNamePtr)
|
||||
Bsnprintf(apptitle, sizeof(apptitle), "%s - %s - " APPNAME, boardfilename, g_gameNamePtr);
|
||||
else
|
||||
Bsnprintf(apptitle, sizeof(apptitle), "%s - " APPNAME, boardfilename);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_gameNamePtr)
|
||||
Bsprintf(apptitle, "%s - %s - " APPNAME, g_mapInfo[mii].name, g_gameNamePtr);
|
||||
else
|
||||
Bsprintf(apptitle,"%s - " APPNAME,g_mapInfo[mii].name);
|
||||
}
|
||||
|
||||
Bstrcpy(tempbuf,apptitle);
|
||||
wm_setapptitle(tempbuf);
|
||||
|
||||
DukePlayer_t *const pPlayer = g_player[0].ps;
|
||||
int16_t lbang;
|
||||
|
||||
|
|
|
@ -1444,8 +1444,6 @@ void G_DisplayLogo(void)
|
|||
renderFlushPerms();
|
||||
videoNextPage();
|
||||
|
||||
G_UpdateAppTitle();
|
||||
|
||||
S_StopMusic();
|
||||
FX_StopAllSounds(); // JBF 20031228
|
||||
S_ClearSoundLocks(); // JBF 20031228
|
||||
|
@ -2171,8 +2169,6 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
//if (g_networkMode == NET_DEDICATED_SERVER)
|
||||
// return;
|
||||
|
||||
G_UpdateAppTitle();
|
||||
|
||||
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
|
||||
{
|
||||
lastmapname = Bstrrchr(boardfilename, '\\');
|
||||
|
@ -2753,8 +2749,6 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
//if (g_networkMode == NET_DEDICATED_SERVER)
|
||||
// return;
|
||||
|
||||
G_UpdateAppTitle();
|
||||
|
||||
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
|
||||
{
|
||||
lastmapname = Bstrrchr(boardfilename, '\\');
|
||||
|
@ -2771,7 +2765,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel)
|
||||
lastmapname = "CLOSE ENCOUNTERS";
|
||||
else if (g_turdLevel)
|
||||
lastmapname = "SMELTING PLANT";
|
||||
lastmapname = "SMELTIN' PLANT";
|
||||
|
||||
|
||||
fadepal(0, 0, 0, 0, 252, 4);
|
||||
|
|
|
@ -851,7 +851,7 @@ static void SW_FatalEngineError(void)
|
|||
}
|
||||
|
||||
void
|
||||
InitGame(int32_t argc, char const * const * argv)
|
||||
InitGame()
|
||||
{
|
||||
extern int MovesPerPacket;
|
||||
//void *ReserveMem=NULL;
|
||||
|
@ -2805,9 +2805,9 @@ GameIntro(void)
|
|||
}
|
||||
|
||||
void
|
||||
Control(int32_t argc, char const * const * argv)
|
||||
Control()
|
||||
{
|
||||
InitGame(argc, argv);
|
||||
InitGame();
|
||||
|
||||
MONO_PRINT("InitGame done");
|
||||
MNU_InitMenus();
|
||||
|
@ -3331,7 +3331,7 @@ void CommandLineHelp(char const * const * argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
int32_t app_main(int32_t argc, char const * const * argv)
|
||||
int32_t app_main()
|
||||
{
|
||||
int i;
|
||||
int stat, nexti;
|
||||
|
@ -3365,16 +3365,10 @@ int32_t app_main(int32_t argc, char const * const * argv)
|
|||
|
||||
if (SW_SHAREWARE)
|
||||
{
|
||||
wm_setapptitle(APPNAME " Shareware");
|
||||
|
||||
// Zero out the maps that aren't in shareware version
|
||||
memset(&LevelInfo[MAX_LEVELS_SW+1], 0, sizeof(LEVEL_INFO)*(MAX_LEVELS_REG-MAX_LEVELS_SW));
|
||||
GameVersion++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wm_setapptitle(APPNAME);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_SW_PLAYERS; i++)
|
||||
INITLIST(&Player[i].PanelSpriteList);
|
||||
|
@ -3849,7 +3843,7 @@ int32_t app_main(int32_t argc, char const * const * argv)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
Control(argc, argv);
|
||||
Control();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5548,7 +5542,7 @@ saveable_module saveable_build =
|
|||
};
|
||||
|
||||
extern void faketimerhandler();
|
||||
extern int app_main(int argc, char const* const* argv);
|
||||
extern int app_main();
|
||||
extern void app_crashhandler(void);
|
||||
/*extern*/ bool validate_hud(int requested_size) { return requested_size; }
|
||||
/*extern*/ void set_hud(int requested_size) { /* the relevant setting is gs.BorderNum */}
|
||||
|
|
Loading…
Reference in a new issue