From 3f1a6814517e039f0a68518191da0e812711cb84 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 28 Feb 2007 19:08:02 +0000 Subject: [PATCH] - Changed the net start pane to open underneath the existing window instead of scrunching the startup screen up to make room for it. - Added the red net notches for Hexen's startup screen. - Added hprintf and status simulation for Heretic's startup screen. SVN r495 (trunk) --- docs/rh-log.txt | 4 + src/d_main.cpp | 208 ++++++++++++++++++++++------------------- src/sdl/st_start.cpp | 12 +++ src/st_start.h | 2 + src/win32/st_start.cpp | 132 +++++++++++++++++++++++++- 5 files changed, 259 insertions(+), 99 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index cff8c6dcce..e44cf3c6fc 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ February 28, 2007 +- Changed the net start pane to open underneath the existing window instead + of scrunching the startup screen up to make room for it. +- Added the red net notches for Hexen's startup screen. +- Added hprintf and status simulation for Heretic's startup screen. - Fixed: When I converted the P_Thing_Projectile() code for target leading to use the new vector routines, I had made dist calculate the squared length of the aim vector instead of the correct length. diff --git a/src/d_main.cpp b/src/d_main.cpp index d6b1260a2b..e42692d713 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2082,102 +2082,8 @@ void D_DoomMain (void) Printf ("ST_Init: Init startup screen.\n"); ST_Init (R_GuesstimateNumTextures() + 5); - // [RH] Now that all text strings are set up, - // insert them into the level and cluster data. - G_MakeEpisodes (); - - // [RH] Parse through all loaded mapinfo lumps - Printf ("G_ParseMapInfo: Load map definitions.\n"); - G_ParseMapInfo (); - - // [RH] Parse any SNDINFO lumps - Printf ("S_InitData: Load sound definitions.\n"); - S_InitData (); - - FActorInfo::StaticInit (); - - // [GRB] Initialize player class list - SetupPlayerClasses (); - - // [RH] Load custom key and weapon settings from WADs - D_LoadWadSettings (); - - // [GRB] Check if someone used clearplayerclasses but not addplayerclass - if (PlayerClasses.Size () == 0) - { - I_FatalError ("No player classes defined"); - } - - FActorInfo::StaticGameSet (); - ST_Progress (); - - Printf ("R_Init: Init %s refresh subsystem.\n", GameNames[gameinfo.gametype]); - R_Init (); - - Printf ("DecalLibrary: Load decals.\n"); - DecalLibrary.Clear (); - DecalLibrary.ReadAllDecals (); - - // [RH] Try adding .deh and .bex files on the command line. - // If there are none, try adding any in the config file. - - //if (gameinfo.gametype == GAME_Doom) - { - if (!ConsiderPatches ("-deh", ".deh") && - !ConsiderPatches ("-bex", ".bex") && - (gameinfo.gametype == GAME_Doom) && - GameConfig->SetSection ("Doom.DefaultDehacked")) - { - const char *key; - const char *value; - - while (GameConfig->NextInSection (key, value)) - { - if (stricmp (key, "Path") == 0 && FileExists (value)) - { - Printf ("Applying patch %s\n", value); - DoDehPatch (value, true); - } - } - } - - DoDehPatch (NULL, true); // See if there's a patch in a PWAD - FinishDehPatch (); // Create replacements for dehacked pickups - } - HandleNoSector (); // clear NOSECTOR flag off all actors modified by Dehacked and the BossEye. - - FActorInfo::StaticSetActorNums (); - - - // [RH] User-configurable startup strings. Because BOOM does. - static const char *startupString[5] = { - "STARTUP1", "STARTUP2", "STARTUP3", "STARTUP4", "STARTUP5" - }; - for (p = 0; p < 5; ++p) - { - const char *str = GStrings[startupString[p]]; - if (str != NULL && str[0] != '\0') - { - Printf ("%s\n", str); - } - } - - //Added by MC: - bglobal.getspawned = Args.GatherFiles ("-bots", "", false); - if (bglobal.getspawned->NumArgs() == 0) - { - delete bglobal.getspawned; - bglobal.getspawned = NULL; - } - else - { - bglobal.spawn_tries = 0; - bglobal.wanted_botnum = bglobal.getspawned->NumArgs(); - } - - flags = dmflags; - Printf ("P_Init: Checking cmd-line parameters...\n"); + flags = dmflags; if (Args.CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS; if (Args.CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN; if (Args.CheckParm ("-fast")) flags |= DF_FAST_MONSTERS; @@ -2302,13 +2208,125 @@ void D_DoomMain (void) timelimit = 20.f; } + // + // Build status bar line! + // + if (deathmatch) + ST_HereticStatus("DeathMatch..."); + if (dmflags & DF_NO_MONSTERS) + ST_HereticStatus("No Monsters..."); + if (dmflags & DF_MONSTERS_RESPAWN) + ST_HereticStatus("Respawning..."); + if (autostart) + { + FString temp; + temp.Format ("Warp to map %s, Skill %d ", startmap, gameskill + 1); + ST_HereticStatus (temp); + } + + // [RH] Now that all text strings are set up, + // insert them into the level and cluster data. + G_MakeEpisodes (); + + // [RH] Parse through all loaded mapinfo lumps + Printf ("G_ParseMapInfo: Load map definitions.\n"); + G_ParseMapInfo (); + + // [RH] Parse any SNDINFO lumps + Printf ("S_InitData: Load sound definitions.\n"); + S_InitData (); + + FActorInfo::StaticInit (); + + // [GRB] Initialize player class list + SetupPlayerClasses (); + + // [RH] Load custom key and weapon settings from WADs + D_LoadWadSettings (); + + // [GRB] Check if someone used clearplayerclasses but not addplayerclass + if (PlayerClasses.Size () == 0) + { + I_FatalError ("No player classes defined"); + } + + FActorInfo::StaticGameSet (); + ST_Progress (); + + Printf ("R_Init: Init %s refresh subsystem.\n", GameNames[gameinfo.gametype]); + ST_HereticMessage ("Loading graphics", 0x3f); + R_Init (); + + Printf ("DecalLibrary: Load decals.\n"); + DecalLibrary.Clear (); + DecalLibrary.ReadAllDecals (); + + // [RH] Try adding .deh and .bex files on the command line. + // If there are none, try adding any in the config file. + + //if (gameinfo.gametype == GAME_Doom) + { + if (!ConsiderPatches ("-deh", ".deh") && + !ConsiderPatches ("-bex", ".bex") && + (gameinfo.gametype == GAME_Doom) && + GameConfig->SetSection ("Doom.DefaultDehacked")) + { + const char *key; + const char *value; + + while (GameConfig->NextInSection (key, value)) + { + if (stricmp (key, "Path") == 0 && FileExists (value)) + { + Printf ("Applying patch %s\n", value); + DoDehPatch (value, true); + } + } + } + + DoDehPatch (NULL, true); // See if there's a patch in a PWAD + FinishDehPatch (); // Create replacements for dehacked pickups + } + HandleNoSector (); // clear NOSECTOR flag off all actors modified by Dehacked and the BossEye. + + FActorInfo::StaticSetActorNums (); + + + // [RH] User-configurable startup strings. Because BOOM does. + static const char *startupString[5] = { + "STARTUP1", "STARTUP2", "STARTUP3", "STARTUP4", "STARTUP5" + }; + for (p = 0; p < 5; ++p) + { + const char *str = GStrings[startupString[p]]; + if (str != NULL && str[0] != '\0') + { + Printf ("%s\n", str); + } + } + + //Added by MC: + bglobal.getspawned = Args.GatherFiles ("-bots", "", false); + if (bglobal.getspawned->NumArgs() == 0) + { + delete bglobal.getspawned; + bglobal.getspawned = NULL; + } + else + { + bglobal.spawn_tries = 0; + bglobal.wanted_botnum = bglobal.getspawned->NumArgs(); + } + Printf ("M_Init: Init miscellaneous info.\n"); M_Init (); Printf ("P_Init: Init Playloop state.\n"); + ST_HereticMessage ("Init game engine", 0x3f); P_Init (); Printf ("D_CheckNetGame: Checking network game status.\n"); + ST_HereticMessage ("Checking network game status.", 0x3f); D_CheckNetGame (); // [RH] Lock any cvars that should be locked now that we're diff --git a/src/sdl/st_start.cpp b/src/sdl/st_start.cpp index 676a68994f..5c1ef8f4a5 100644 --- a/src/sdl/st_start.cpp +++ b/src/sdl/st_start.cpp @@ -60,6 +60,8 @@ static void ST_TTY_NetProgress (int count); static void ST_TTY_NetMessage (const char *format, ...); static void ST_TTY_NetDone (); static bool ST_TTY_NetLoop (bool (*timer_callback)(void *), void *userdata); +static void ST_Null_HereticMessage (const char *, int); +static void ST_Null_HereticStatus (const char *); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -67,6 +69,8 @@ static bool ST_TTY_NetLoop (bool (*timer_callback)(void *), void *userdata); void (*ST_Done)(); void (*ST_Progress)(); +void (*ST_HereticMessage)(const char *message, int attributes); +void (*ST_HereticStatus)(const char *status); void (*ST_NetInit)(const char *message, int numplayers); void (*ST_NetProgress)(int count); void (*ST_NetMessage)(const char *format, ...); @@ -304,6 +308,14 @@ static bool ST_TTY_NetLoop(bool (*timer_callback)(void *), void *userdata) } } +static void ST_Null_HereticMessage (const char *, int) +{ +} + +static void ST_Null_HereticStatus (const char *) +{ +} + void ST_Endoom() { exit(0); diff --git a/src/st_start.h b/src/st_start.h index 60d77f92ca..e14a96dd80 100644 --- a/src/st_start.h +++ b/src/st_start.h @@ -37,6 +37,8 @@ extern void ST_Init(int maxProgress); extern void (*ST_Done)(); extern void (*ST_Progress)(); +extern void (*ST_HereticMessage)(const char *message, int attributes); +extern void (*ST_HereticStatus)(const char *status); extern void (*ST_NetInit)(const char *message, int numplayers); extern void (*ST_NetProgress)(int count); extern void (*ST_NetMessage)(const char *format, ...); // cover for printf() diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index 5db92f59c5..d63854a17a 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -110,6 +110,7 @@ void RestoreConView(); void LayoutMainWindow (HWND hWnd, HWND pane); +int LayoutNetStartPane (HWND pane, int w); bool ST_Util_CreateStartupWindow (); void ST_Util_SizeWindowForBitmap (int scale); @@ -136,6 +137,8 @@ static INT_PTR CALLBACK NetStartPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LP static void ST_Basic_Init (); static void ST_Basic_Done (); static void ST_Basic_Progress (); +static void ST_Basic_HereticMessage (const char *message, int attributes); +static void ST_Basic_HereticStatus (const char *status); static void ST_Basic_NetInit (const char *message, int numplayers); static void ST_Basic_NetProgress (int count); static void ST_Basic_NetMessage (const char *format, ...); @@ -145,9 +148,12 @@ static bool ST_Basic_NetLoop (bool (*timer_callback)(void *), void *userdata); static void ST_Hexen_Init (); static void ST_Hexen_Done (); static void ST_Hexen_Progress (); +static void ST_Hexen_NetProgress (int count); static void ST_Heretic_Init (); static void ST_Heretic_Progress (); +static void ST_Heretic_Message (const char *message, int attributes); +static void ST_Heretic_Status (const char *status); static void ST_Strife_Init (); static void ST_Strife_Done (); @@ -163,6 +169,8 @@ extern HWND Window, ConWindow, ProgressBar, NetStartPane, StartupScreen, GameTit void (*ST_Done)(); void (*ST_Progress)(); +void (*ST_HereticMessage)(const char *message, int attributes); +void (*ST_HereticStatus)(const char *status); void (*ST_NetInit)(const char *message, int numplayers); void (*ST_NetProgress)(int count); void (*ST_NetMessage)(const char *format, ...); @@ -183,6 +191,7 @@ static int MaxPos, CurPos, NotchPos; static int NetMaxPos, NetCurPos; static LRESULT NetMarqueeMode; static int ThermX, ThermY, ThermWidth, ThermHeight; +static int HMsgY, SMsgX; static BYTE *StrifeStartupPics[4+2+1]; static const char *StrifeStartupPicNames[4+2+1] = @@ -322,6 +331,8 @@ static void ST_Basic_Init () ST_Done = ST_Basic_Done; ST_Progress = ST_Basic_Progress; + ST_HereticMessage = ST_Basic_HereticMessage; + ST_HereticStatus = ST_Basic_HereticStatus; ST_NetInit = ST_Basic_NetInit; ST_NetProgress = ST_Basic_NetProgress; ST_NetMessage = ST_Basic_NetMessage; @@ -365,6 +376,30 @@ static void ST_Basic_Progress() } } +//========================================================================== +// +// ST_Basic_HereticMessage +// +// Only used by the Heretic startup screen. +// +//========================================================================== + +static void ST_Basic_HereticMessage (const char *, int) +{ +} + +//========================================================================== +// +// ST_Basic_HereticStatus +// +// Only used by the Heretic startup screen. +// +//========================================================================== + +static void ST_Basic_HereticStatus (const char *) +{ +} + //========================================================================== // // ST_Basic_NetInit @@ -389,10 +424,12 @@ static void ST_Basic_NetInit(const char *message, int numplayers) DestroyWindow (ProgressBar); ProgressBar = NULL; } + RECT winrect; + GetWindowRect (Window, &winrect); + SetWindowPos (Window, NULL, 0, 0, + winrect.right - winrect.left, winrect.bottom - winrect.top + LayoutNetStartPane (NetStartPane, 0), + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER); LayoutMainWindow (Window, NULL); - // Make sure the last line of output is visible in the log window. - SendMessage (ConWindow, EM_LINESCROLL, 0, SendMessage (ConWindow, EM_GETLINECOUNT, 0, 0) - - SendMessage (ConWindow, EM_GETFIRSTVISIBLELINE, 0, 0)); } if (NetStartPane != NULL) { @@ -641,8 +678,10 @@ static void ST_Hexen_Init () ST_Done = ST_Hexen_Done; ST_Progress = ST_Hexen_Progress; + ST_HereticMessage = ST_Basic_HereticMessage; + ST_HereticStatus = ST_Basic_HereticStatus; ST_NetInit = ST_Basic_NetInit; - ST_NetProgress = ST_Basic_NetProgress; + ST_NetProgress = ST_Hexen_NetProgress; ST_NetMessage = ST_Basic_NetMessage; ST_NetDone = ST_Basic_NetDone; ST_NetLoop = ST_Basic_NetLoop; @@ -705,6 +744,33 @@ static void ST_Hexen_Progress() I_GetEvent (); } +//========================================================================== +// +// ST_Hexen_NetProgress +// +// Draws the red net noches in addition to the normal progress bar. +// +//========================================================================== + +static void ST_Hexen_NetProgress (int count) +{ + int oldpos = NetCurPos; + int x, y; + + ST_Basic_NetProgress (count); + if (NetMaxPos != 0 && NetCurPos > oldpos) + { + for (; oldpos < NetCurPos && oldpos < ST_MAX_NETNOTCHES; ++oldpos) + { + x = ST_NETPROGRESS_X + ST_NETNOTCH_WIDTH * oldpos; + y = ST_NETPROGRESS_Y; + ST_Util_DrawBlock (StartupBitmap, NetNotchBits, x, y, ST_NETNOTCH_WIDTH / 2, ST_NETNOTCH_HEIGHT); + } + S_Sound (CHAN_BODY, "Drip", 1, ATTN_NONE); + I_GetEvent (); + } +} + //========================================================================== // // ST_Heretic_Init @@ -752,6 +818,8 @@ static void ST_Heretic_Init () ThermY = THERM_Y * font[0]; ThermWidth = THERM_LEN * 8 - 4; ThermHeight = font[0]; + HMsgY = 7; + SMsgX = 1; ST_Util_FreeFont (font); @@ -761,6 +829,8 @@ static void ST_Heretic_Init () ST_Done = ST_Hexen_Done; ST_Progress = ST_Heretic_Progress; + ST_HereticMessage = ST_Heretic_Message; + ST_HereticStatus = ST_Heretic_Status; ST_NetInit = ST_Basic_NetInit; ST_NetProgress = ST_Basic_NetProgress; ST_NetMessage = ST_Basic_NetMessage; @@ -797,6 +867,58 @@ static void ST_Heretic_Progress() I_GetEvent (); } +//========================================================================== +// +// ST_Heretic_Message +// +// Prints text in the center box of the startup screen. +// +//========================================================================== + +static void ST_Heretic_Message (const char *message, int attributes) +{ + BYTE *font = ST_Util_LoadFont (TEXT_FONT_NAME); + if (font != NULL) + { + int x; + + for (x = 0; message[x] != '\0'; ++x) + { + ST_Util_DrawChar (StartupBitmap, font, 17 + x, HMsgY, message[x], attributes); + } + ST_Util_InvalidateRect (StartupScreen, StartupBitmap, 17 * 8, HMsgY * font[0], (17 + x) * 8, HMsgY * font[0] + font[0]); + ST_Util_FreeFont (font); + HMsgY++; + I_GetEvent (); + } +} + +//========================================================================== +// +// ST_Heretic_Status +// +// Appends text to Heretic's status line. +// +//========================================================================== + +static void ST_Heretic_Status (const char *status) +{ + BYTE *font = ST_Util_LoadFont (TEXT_FONT_NAME); + if (font != NULL) + { + int x; + + for (x = 0; status[x] != '\0'; ++x) + { + ST_Util_DrawChar (StartupBitmap, font, SMsgX + x, 24, status[x], 0x1f); + } + ST_Util_InvalidateRect (StartupScreen, StartupBitmap, SMsgX * 8, 24 * font[0], (SMsgX + x) * 8, 25 * font[0]); + ST_Util_FreeFont (font); + SMsgX += x; + I_GetEvent (); + } +} + //========================================================================== // // ST_Strife_Init @@ -859,6 +981,8 @@ static void ST_Strife_Init () ST_Done = ST_Strife_Done; ST_Progress = ST_Strife_Progress; + ST_HereticMessage = ST_Basic_HereticMessage; + ST_HereticStatus = ST_Basic_HereticStatus; ST_NetInit = ST_Basic_NetInit; ST_NetProgress = ST_Basic_NetProgress; ST_NetMessage = ST_Basic_NetMessage;