From 34c6f64d828f1f44ffe20a68e8420721a4277fb2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Jan 2007 12:30:34 +0000 Subject: [PATCH] - Added ENDOOM screen. It will only be shown when the game is exited via the main menu and there is an option to switch it off for those who don't want to wait. SVN r441 (trunk) --- docs/rh-log.txt | 5 +++ src/m_menu.cpp | 3 +- src/m_options.cpp | 2 ++ src/sdl/st_start.cpp | 5 +++ src/st_start.h | 1 + src/win32/st_start.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 1 deletion(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index dbbe22ec2..bf43264e4 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +January 6, 2007 (Changes by Graf Zahl) +- Added ENDOOM screen. It will only be shown when the game is exited via the + main menu and there is an option to switch it off for those who don't want + to wait. + January 5, 2007 - Added simulation of Heretic's startup screen. - Changed copyright notice for i_main.cpp, since none of it is really id's diff --git a/src/m_menu.cpp b/src/m_menu.cpp index e56a20bd1..d7483fa38 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -64,6 +64,7 @@ #include "lists.h" #include "gi.h" #include "p_tick.h" +#include "st_start.h" // MACROS ------------------------------------------------------------------ @@ -1956,7 +1957,7 @@ void M_QuitResponse(int ch) I_WaitVBL (105); } } - exit (0); + ST_Endoom(); } void M_QuitDOOM (int choice) diff --git a/src/m_options.cpp b/src/m_options.cpp index 877b7bf3f..4723b8816 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -81,6 +81,7 @@ #include "m_menu.h" EXTERN_CVAR(Bool, nomonsterinterpolation) +EXTERN_CVAR(Bool, showendoom) // // defaulted values // @@ -510,6 +511,7 @@ static menuitem_t VideoItems[] = { { discrete, "Stretch status bar", {&st_scale}, {2.0}, {0.0}, {0.0}, {OnOff} }, { discrete, "Screen wipe style", {&wipetype}, {4.0}, {0.0}, {0.0}, {Wipes} }, #ifdef _WIN32 + { discrete, "Show ENDOOM screen", {&showendoom}, {2.0}, {0.0}, {0.0}, {OnOff} }, { discrete, "DirectDraw palette hack", {&vid_palettehack}, {2.0}, {0.0}, {0.0}, {OnOff} }, { discrete, "Use attached surfaces", {&vid_attachedsurfaces},{2.0}, {0.0}, {0.0}, {OnOff} }, #endif diff --git a/src/sdl/st_start.cpp b/src/sdl/st_start.cpp index 160be85c9..6e94550c3 100644 --- a/src/sdl/st_start.cpp +++ b/src/sdl/st_start.cpp @@ -303,3 +303,8 @@ static bool ST_TTY_NetLoop(bool (*timer_callback)(void *), void *userdata) } } } + +void ST_Endoom() +{ + exit(0); +} \ No newline at end of file diff --git a/src/st_start.h b/src/st_start.h index 5c151d65f..fc12fa641 100644 --- a/src/st_start.h +++ b/src/st_start.h @@ -42,3 +42,4 @@ extern void (*ST_NetProgress)(int count); extern void (*ST_NetMessage)(const char *format, ...); // cover for printf() extern void (*ST_NetDone)(); extern bool (*ST_NetLoop)(bool (*timer_callback)(void *), void *userdata); +extern void ST_Endoom(); \ No newline at end of file diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index e54a22da6..7aa65c005 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -47,6 +47,7 @@ #include "templates.h" #include "i_system.h" #include "i_input.h" +#include "hardware.h" #include "gi.h" #include "w_wad.h" #include "s_sound.h" @@ -83,6 +84,7 @@ // TYPES ------------------------------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- +void RestoreConView(); bool ST_Util_CreateStartupWindow (); void ST_Util_SizeWindowForBitmap (); @@ -743,6 +745,80 @@ static void ST_Heretic_Progress() I_GetEvent (); } + +//========================================================================== +// +// ST_Endoom +// +// Shows an ENDOOM text screen +// +//========================================================================== +CVAR(Bool, showendoom, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) + +void ST_Endoom() +{ + if (!showendoom) return; + + int endoom_lump = Wads.CheckNumForName ( + gameinfo.gametype == GAME_Doom? "ENDOOM" : + gameinfo.gametype == GAME_Heretic? "ENDTEXT" : + gameinfo.gametype == GAME_Strife? "ENDSTRF" : NULL); + + BYTE endoom_screen[4000]; + BYTE *font; + MSG mess; + + if (endoom_lump < 0 || Wads.LumpLength (endoom_lump) != 4000) + { + exit(0); + } + + font = ST_Util_LoadFont (TEXT_FONT_NAME, TEXT_FONT_HEIGHT); + if (font == NULL) + { + exit(0); + } + + if (!ST_Util_CreateStartupWindow()) + { + ST_Util_FreeFont (font); + exit(0); + } + ST_Done = ST_Basic_Done; + + I_ShutdownGraphics (); + RestoreConView (); + S_StopMusic(true); + + Wads.ReadLump (endoom_lump, endoom_screen); + + // Draw the loading screen to a bitmap. + StartupBitmap = ST_Util_AllocTextBitmap (font); + ST_Util_DrawTextScreen (StartupBitmap, endoom_screen, font); + ST_Util_FreeFont (font); + + ST_Util_SizeWindowForBitmap (); + LayoutMainWindow (Window, NULL); + InvalidateRect (StartupScreen, NULL, TRUE); + + // Wait until any key has been pressed or a quit message has been received + + while (1) + { + if (PeekMessage (&mess, NULL, 0, 0, PM_REMOVE)) + { + if (mess.message == WM_QUIT) + exit (int(mess.wParam)); + if (mess.message == WM_KEYDOWN || mess.message == WM_SYSKEYDOWN || mess.message == WM_LBUTTONDOWN) + exit(0); + + TranslateMessage (&mess); + DispatchMessage (&mess); + } + else WaitMessage(); + } +} + //========================================================================== // // ST_Util_CreateStartupWindow