- startup cleanup.

This commit is contained in:
Christoph Oelckers 2019-11-01 00:32:56 +01:00
parent 57f879fa8b
commit 67acad3984
22 changed files with 119 additions and 468 deletions

View file

@ -1235,11 +1235,9 @@ static int32_t check_filename_casing(void)
} }
#endif #endif
int app_main(int argc, char const * const * argv) int app_main()
{ {
char buffer[BMAX_PATH]; char buffer[BMAX_PATH];
margc = argc;
margv = argv;
OSD_SetFunctions(NULL, OSD_SetFunctions(NULL,
NULL, NULL,
@ -2277,7 +2275,7 @@ void sndPlaySpecialMusicOrNothing(int nMusic)
} }
extern void faketimerhandler(); extern void faketimerhandler();
extern int app_main(int argc, char const* const* argv); extern int app_main();
extern void app_crashhandler(void); extern void app_crashhandler(void);
bool validate_hud(int layout); bool validate_hud(int layout);
void set_hud_layout(int layout); void set_hud_layout(int layout);

View file

@ -230,7 +230,7 @@ struct GameInterface
{ {
int TicRate; int TicRate;
void (*faketimerhandler)(); void (*faketimerhandler)();
int (*app_main)(int, char const* const*); int (*app_main)();
bool (*validate_hud)(int); bool (*validate_hud)(int);
void (*set_hud_layout)(int size); void (*set_hud_layout)(int size);
void (*set_hud_scale)(int size); void (*set_hud_scale)(int size);

View file

@ -385,9 +385,6 @@ static void sighandler(int signum)
#ifdef _WIN32 #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 ) int WINAPI WinMain(HINSTANCE , HINSTANCE , LPSTR , int )
#else #else
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -452,8 +449,7 @@ int main(int argc, char *argv[])
FString logpath = M_GetDocumentsPath() + "demolition.log"; FString logpath = M_GetDocumentsPath() + "demolition.log";
OSD_SetLogFile(logpath); OSD_SetLogFile(logpath);
CONFIG_Init(); r = CONFIG_Init();
r = gi->app_main(buildargc, (const char**)buildargv);
} }
catch (const std::runtime_error & err) catch (const std::runtime_error & err)
{ {
@ -636,7 +632,6 @@ int32_t initsystem(void)
if (drvname) if (drvname)
initprintf("Using \"%s\" video driver\n", drvname); initprintf("Using \"%s\" video driver\n", drvname);
#endif #endif
wm_setapptitle(apptitle);
} }
return 0; 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) void setvideomode_sdlcommonpost(int32_t x, int32_t y, int32_t c, int32_t fs, int32_t regrab)
{ {
wm_setapptitle(apptitle);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (!nogl) if (!nogl)

View file

@ -198,6 +198,7 @@ void FGameConfigFile::DoAutoloadSetup (/*FIWadManager *iwad_man*/)
{ {
const char *lastver = GetValueForKey ("Version"); const char *lastver = GetValueForKey ("Version");
if (lastver != NULL) last = atof(lastver); if (lastver != NULL) last = atof(lastver);
isInitialized = true;
} }
CreateSectionAtStart("Global.Autoload"); CreateSectionAtStart("Global.Autoload");

View file

@ -55,6 +55,7 @@ public:
void AddAutoexec (FArgs *list, const char *gamename); void AddAutoexec (FArgs *list, const char *gamename);
FString GetConfigPath (bool tryProg); FString GetConfigPath (bool tryProg);
void ReadNetVars (); void ReadNetVars ();
bool IsInitialized() const { return isInitialized; }
protected: protected:
void WriteCommentHeader (FileWriter *file) const; void WriteCommentHeader (FileWriter *file) const;
@ -65,6 +66,7 @@ private:
void ReadCVars (unsigned flags); void ReadCVars (unsigned flags);
bool bModSetup; bool bModSetup;
bool isInitialized;
char section[64]; char section[64];
char *subsection; char *subsection;

View file

@ -110,7 +110,7 @@ static const GameFuncNameDesc gamefuncs[] = {
}; };
extern FString currentGame; FString currentGame;
FString LumpFilter; FString LumpFilter;
static TMap<FName, int> GF_NameToNum; static TMap<FName, int> GF_NameToNum;
@ -349,14 +349,14 @@ void CheckFrontend(int flags)
// //
//========================================================================== //==========================================================================
void CONFIG_Init() int CONFIG_Init()
{ {
SetClipshapes(); SetClipshapes();
// This must be done before initializing any data, so doing it late in the startup process won't work. // 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)) if (CONTROL_Startup(controltype_keyboardandmouse, BGetTime, gi->TicRate))
{ {
exit(1); return 1;
} }
userConfig.ProcessOptions(); userConfig.ProcessOptions();
@ -366,14 +366,33 @@ void CONFIG_Init()
auto groups = GrpScan(); auto groups = GrpScan();
int groupno = ShowStartupWindow(groups); int groupno = ShowStartupWindow(groups);
LumpFilter = currentGame; if (groupno == -1) return 0;
if (LumpFilter.Compare("Redneck") == 0) LumpFilter = "Redneck.Redneck"; auto &group = groups[groupno];
else if (LumpFilter.Compare("RedneckRides") == 0) LumpFilter = "Redneck.RidesAgain"; 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); 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()) if (userConfig.CommandName.IsNotEmpty())
{ {
@ -399,6 +418,7 @@ void CONFIG_Init()
CONTROL_ClearAssignments(); CONTROL_ClearAssignments();
CONFIG_InitMouseAndController(); CONFIG_InitMouseAndController();
CONFIG_SetGameControllerDefaultsStandard(); CONFIG_SetGameControllerDefaultsStandard();
return gi->app_main();
} }
//========================================================================== //==========================================================================

View file

@ -14,7 +14,7 @@ class FArgs;
extern uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2]; extern uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
void CONFIG_Init(); int CONFIG_Init();
void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy=false); void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy=false);
int32_t CONFIG_FunctionNameToNum(const char* func); int32_t CONFIG_FunctionNameToNum(const char* func);
const char* CONFIG_FunctionNumToName(int32_t func); const char* CONFIG_FunctionNumToName(int32_t func);

View file

@ -27,11 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "screens.h" #include "screens.h"
#include "renderlayer.h" #include "renderlayer.h"
#include "cmdline.h" #include "cmdline.h"
#include "m_argv.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS
int32_t g_commandSetup = 0;
int32_t g_noSetup = 0;
int32_t g_fakeMultiMode = 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 (Args->CheckParm("-condebug") || Args->CheckParm("-z")) g_scriptDebug = 1;
#if 0 if (Args->CheckParm("-altai"))
int16_t i = 1, j; {
const char *c, *k; ud.playerai = 1;
OSD_Printf("Other player AI.\n");
}
if (argc > 1) auto val = Args->CheckValue("-skill");
{ if (val)
initprintf("Application parameters: "); {
while (i < argc) ud.m_player_skill = ud.player_skill = std::clamp((int)strtol(val, nullptr, 0), 0, 5);
initprintf("%s ", argv[i++]); if (ud.m_player_skill == 4) ud.m_respawn_monsters = ud.respawn_monsters = 1;
initprintf("\n"); }
val = Args->CheckValue("-respawn");
i = 1; if (val)
do {
{ if (*val == '1') ud.m_respawn_monsters = 1;
const char *const oc = argv[i]; else if (*val == '2') ud.m_respawn_items = 1;
int32_t shortopt = 0, ignored_short_opt = 0; else if (*val == '3') ud.m_respawn_inventory = 1;
else
c = oc; {
ud.m_respawn_monsters = 1;
if (*c == '-') ud.m_respawn_items = 1;
{ ud.m_respawn_inventory = 1;
shortopt = 0; }
OSD_Printf("Respawn on.\n");
if (!Bstrcasecmp(c+1, "noffire")) }
{ if (Args->CheckParm("-showcoords") || Args->CheckParm("-w"))
ud.m_ffire = 0; {
i++; cl_showcoords = 1;
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
} }
END_DUKE_NS END_DUKE_NS

View file

@ -28,12 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS 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_ShowParameterHelp(void);
extern void G_ShowDebugHelp(void); extern void G_ShowDebugHelp(void);
extern int32_t g_commandSetup;
extern int32_t g_noSetup;
extern int32_t g_fakeMultiMode; extern int32_t g_fakeMultiMode;
END_DUKE_NS END_DUKE_NS

View file

@ -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) static void G_FreeHashAnim(const char * /*string*/, intptr_t key)
{ {
Xfree((void *)key); Xfree((void *)key);
@ -6140,7 +6123,6 @@ void G_BackToMenu(void)
Menu_Open(myconnectindex); Menu_Open(myconnectindex);
Menu_Change(MENU_MAIN); Menu_Change(MENU_MAIN);
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
G_UpdateAppTitle();
} }
static int G_EndOfLevel(void) 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(actor_t)%4 == 0);
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_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 #ifndef NETCODE_DISABLE
if (enet_initialize() != 0) if (enet_initialize() != 0)
@ -6278,8 +6260,6 @@ int app_main(int argc, const char * const*argv)
BGetTime, BGetTime,
GAME_onshowosd); GAME_onshowosd);
wm_setapptitle(APPNAME);
initprintf(HEAD2 " %s\n", s_buildRev); initprintf(HEAD2 " %s\n", s_buildRev);
PrintBuildInfo(); PrintBuildInfo();
@ -6297,7 +6277,7 @@ int app_main(int argc, const char * const*argv)
G_DeleteOldSaves(); G_DeleteOldSaves();
#endif #endif
G_CheckCommandLine(argc,argv); G_CheckCommandLine();
// This needs to happen afterwards, as G_CheckCommandLine() is where we set // This needs to happen afterwards, as G_CheckCommandLine() is where we set
// up the command-line-provided search paths (duh). // 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 // gotta set the proper title after we compile the CONs if this is the full version
G_UpdateAppTitle();
if (g_scriptDebug) if (g_scriptDebug)
initprintf("CON debugging activated (level %d).\n",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 #endif
extern void faketimerhandler(); extern void faketimerhandler();
extern int app_main(int argc, char const* const* argv); extern int app_main();
extern void app_crashhandler(void); extern void app_crashhandler(void);
GameInterface Interface = { GameInterface Interface = {

View file

@ -313,7 +313,6 @@ void G_GameQuit(void);
void G_GetCrosshairColor(void); void G_GetCrosshairColor(void);
void G_HandleLocalKeys(void); void G_HandleLocalKeys(void);
void G_HandleSpecialKeys(void); void G_HandleSpecialKeys(void);
void G_UpdateAppTitle(void);
void G_PrintGameQuotes(int32_t snum); void G_PrintGameQuotes(int32_t snum);
//void G_SE40(int32_t smoothratio); //void G_SE40(int32_t smoothratio);
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);

View file

@ -5194,7 +5194,7 @@ repeatcase:
} }
gamename[i] = '\0'; gamename[i] = '\0';
g_gameNamePtr = Xstrdup(gamename); g_gameNamePtr = Xstrdup(gamename);
G_UpdateAppTitle(); // G_UpdateAppTitle();
} }
continue; continue;

View file

@ -1842,32 +1842,6 @@ int G_EnterLevel(int gameMode)
ud.screen_size = ssize; 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; auto &p0 = *g_player[0].ps;
int16_t playerAngle; int16_t playerAngle;

View file

@ -1609,8 +1609,6 @@ void G_DisplayLogo(void)
renderFlushPerms(); renderFlushPerms();
videoNextPage(); videoNextPage();
G_UpdateAppTitle();
S_StopMusic(); S_StopMusic();
FX_StopAllSounds(); // JBF 20031228 FX_StopAllSounds(); // JBF 20031228
S_ClearSoundLocks(); // JBF 20031228 S_ClearSoundLocks(); // JBF 20031228
@ -2151,8 +2149,6 @@ void G_BonusScreen(int32_t bonusonly)
if (g_networkMode == NET_DEDICATED_SERVER) if (g_networkMode == NET_DEDICATED_SERVER)
return; return;
G_UpdateAppTitle();
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
{ {
lastmapname = Bstrrchr(boardfilename, '\\'); lastmapname = Bstrrchr(boardfilename, '\\');

View file

@ -642,7 +642,8 @@ int ShowStartupWindow(TArray<GrpEntry> &groups)
auto choice = startwin_run(); auto choice = startwin_run();
if (choice == 0) if (choice == 0)
{ {
Bexit(EXIT_SUCCESS); startwin_close();
return - 1;
} }
} }
startwin_close(); startwin_close();

View file

@ -27,12 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "screens.h" #include "screens.h"
#include "renderlayer.h" #include "renderlayer.h"
#include "cmdline.h" #include "cmdline.h"
#include "m_argv.h"
BEGIN_RR_NS BEGIN_RR_NS
int32_t g_commandSetup = 0;
int32_t g_noSetup = 0;
int32_t g_noSound = 0;
int32_t g_fakeMultiMode = 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 (Args->CheckParm("-condebug") || Args->CheckParm("-z")) g_scriptDebug = 1;
#if 0 if (Args->CheckParm("-altai"))
int16_t i = 1, j; {
const char *c, *k; ud.playerai = 1;
OSD_Printf("Other player AI.\n");
}
if (argc > 1) auto val = Args->CheckValue("-skill");
{ if (val)
initprintf("Application parameters: "); {
while (i < argc) ud.m_player_skill = ud.player_skill = std::clamp((int)strtol(val, nullptr, 0), 0, 5);
initprintf("%s ", argv[i++]); if (ud.m_player_skill == 4) ud.m_respawn_monsters = ud.respawn_monsters = 1;
initprintf("\n"); }
val = Args->CheckValue("-respawn");
i = 1; if (val)
do {
{ if (*val == '1') ud.m_respawn_monsters = 1;
const char *const oc = argv[i]; else if (*val == '2') ud.m_respawn_items = 1;
int32_t shortopt = 0, ignored_short_opt = 0; else if (*val == '3') ud.m_respawn_inventory = 1;
else
c = oc; {
ud.m_respawn_monsters = 1;
if (*c == '-') ud.m_respawn_items = 1;
{ ud.m_respawn_inventory = 1;
shortopt = 0; }
OSD_Printf("Respawn on.\n");
#ifdef HAVE_CLIPSHAPE_FEATURE }
if (!Bstrcasecmp(c+1, "clipmap")) if (Args->CheckParm("-showcoords") || Args->CheckParm("-w"))
{ {
if (argc > i+1) cl_showcoords = 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
} }
END_RR_NS END_RR_NS

View file

@ -27,12 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_RR_NS 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_ShowParameterHelp(void);
extern void G_ShowDebugHelp(void); extern void G_ShowDebugHelp(void);
extern int32_t g_commandSetup;
extern int32_t g_noSetup;
extern int32_t g_fakeMultiMode; extern int32_t g_fakeMultiMode;
END_RR_NS END_RR_NS

View file

@ -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) static void G_FreeHashAnim(const char * /*string*/, intptr_t key)
{ {
Bfree((void *)key); Bfree((void *)key);
@ -7529,7 +7516,6 @@ void G_BackToMenu(void)
Menu_Open(myconnectindex); Menu_Open(myconnectindex);
Menu_Change(MENU_MAIN); Menu_Change(MENU_MAIN);
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
G_UpdateAppTitle();
} }
static int G_EndOfLevel(void) 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(actor_t)%4 == 0);
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_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; playing_rr = 1;
#ifndef NETCODE_DISABLE #ifndef NETCODE_DISABLE
@ -7636,14 +7622,6 @@ int app_main(int argc, char const * const * argv)
else atexit(enet_deinitialize); else atexit(enet_deinitialize);
#endif #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, OSD_SetFunctions(GAME_drawosdchar,
GAME_drawosdstr, GAME_drawosdstr,
GAME_drawosdcursor, GAME_drawosdcursor,
@ -7653,8 +7631,6 @@ int app_main(int argc, char const * const * argv)
BGetTime, BGetTime,
GAME_onshowosd); GAME_onshowosd);
wm_setapptitle(APPNAME);
initprintf(HEAD2 " %s\n", s_buildRev); initprintf(HEAD2 " %s\n", s_buildRev);
PrintBuildInfo(); PrintBuildInfo();
@ -7672,7 +7648,7 @@ int app_main(int argc, char const * const * argv)
// accesses g_player[0]. // accesses g_player[0].
G_MaybeAllocPlayer(0); G_MaybeAllocPlayer(0);
G_CheckCommandLine(argc,argv); G_CheckCommandLine();
// This needs to happen afterwards, as G_CheckCommandLine() is where we set // This needs to happen afterwards, as G_CheckCommandLine() is where we set
// up the command-line-provided search paths (duh). // 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 // gotta set the proper title after we compile the CONs if this is the full version
G_UpdateAppTitle();
if (g_scriptDebug) if (g_scriptDebug)
initprintf("CON debugging activated (level %d).\n",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 void faketimerhandler();
extern int app_main(int argc, char const* const* argv); extern int app_main();
extern void app_crashhandler(void); extern void app_crashhandler(void);
GameInterface Interface = { GameInterface Interface = {

View file

@ -286,7 +286,6 @@ void G_GameQuit(void);
void G_GetCrosshairColor(void); void G_GetCrosshairColor(void);
void G_HandleLocalKeys(void); void G_HandleLocalKeys(void);
void G_HandleSpecialKeys(void); void G_HandleSpecialKeys(void);
void G_UpdateAppTitle(void);
void G_PrintGameQuotes(int32_t snum); void G_PrintGameQuotes(int32_t snum);
//void G_SE40(int32_t smoothratio); //void G_SE40(int32_t smoothratio);
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);

View file

@ -2376,24 +2376,6 @@ int G_EnterLevel(int gameMode)
ud.screen_size = i; 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; DukePlayer_t *const pPlayer = g_player[0].ps;
int16_t lbang; int16_t lbang;

View file

@ -1444,8 +1444,6 @@ void G_DisplayLogo(void)
renderFlushPerms(); renderFlushPerms();
videoNextPage(); videoNextPage();
G_UpdateAppTitle();
S_StopMusic(); S_StopMusic();
FX_StopAllSounds(); // JBF 20031228 FX_StopAllSounds(); // JBF 20031228
S_ClearSoundLocks(); // JBF 20031228 S_ClearSoundLocks(); // JBF 20031228
@ -2171,8 +2169,6 @@ void G_BonusScreen(int32_t bonusonly)
//if (g_networkMode == NET_DEDICATED_SERVER) //if (g_networkMode == NET_DEDICATED_SERVER)
// return; // return;
G_UpdateAppTitle();
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
{ {
lastmapname = Bstrrchr(boardfilename, '\\'); lastmapname = Bstrrchr(boardfilename, '\\');
@ -2753,8 +2749,6 @@ void G_BonusScreenRRRA(int32_t bonusonly)
//if (g_networkMode == NET_DEDICATED_SERVER) //if (g_networkMode == NET_DEDICATED_SERVER)
// return; // return;
G_UpdateAppTitle();
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
{ {
lastmapname = Bstrrchr(boardfilename, '\\'); lastmapname = Bstrrchr(boardfilename, '\\');
@ -2771,7 +2765,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel) if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel)
lastmapname = "CLOSE ENCOUNTERS"; lastmapname = "CLOSE ENCOUNTERS";
else if (g_turdLevel) else if (g_turdLevel)
lastmapname = "SMELTING PLANT"; lastmapname = "SMELTIN' PLANT";
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);

View file

@ -851,7 +851,7 @@ static void SW_FatalEngineError(void)
} }
void void
InitGame(int32_t argc, char const * const * argv) InitGame()
{ {
extern int MovesPerPacket; extern int MovesPerPacket;
//void *ReserveMem=NULL; //void *ReserveMem=NULL;
@ -2805,9 +2805,9 @@ GameIntro(void)
} }
void void
Control(int32_t argc, char const * const * argv) Control()
{ {
InitGame(argc, argv); InitGame();
MONO_PRINT("InitGame done"); MONO_PRINT("InitGame done");
MNU_InitMenus(); MNU_InitMenus();
@ -3331,7 +3331,7 @@ void CommandLineHelp(char const * const * argv)
#endif #endif
} }
int32_t app_main(int32_t argc, char const * const * argv) int32_t app_main()
{ {
int i; int i;
int stat, nexti; int stat, nexti;
@ -3365,16 +3365,10 @@ int32_t app_main(int32_t argc, char const * const * argv)
if (SW_SHAREWARE) if (SW_SHAREWARE)
{ {
wm_setapptitle(APPNAME " Shareware");
// Zero out the maps that aren't in shareware version // 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)); memset(&LevelInfo[MAX_LEVELS_SW+1], 0, sizeof(LEVEL_INFO)*(MAX_LEVELS_REG-MAX_LEVELS_SW));
GameVersion++; GameVersion++;
} }
else
{
wm_setapptitle(APPNAME);
}
for (i = 0; i < MAX_SW_PLAYERS; i++) for (i = 0; i < MAX_SW_PLAYERS; i++)
INITLIST(&Player[i].PanelSpriteList); INITLIST(&Player[i].PanelSpriteList);
@ -3849,7 +3843,7 @@ int32_t app_main(int32_t argc, char const * const * argv)
} }
} }
#endif #endif
Control(argc, argv); Control();
return 0; return 0;
} }
@ -5548,7 +5542,7 @@ saveable_module saveable_build =
}; };
extern void faketimerhandler(); extern void faketimerhandler();
extern int app_main(int argc, char const* const* argv); extern int app_main();
extern void app_crashhandler(void); extern void app_crashhandler(void);
/*extern*/ bool validate_hud(int requested_size) { return requested_size; } /*extern*/ bool validate_hud(int requested_size) { return requested_size; }
/*extern*/ void set_hud(int requested_size) { /* the relevant setting is gs.BorderNum */} /*extern*/ void set_hud(int requested_size) { /* the relevant setting is gs.BorderNum */}