mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-28 05:31:17 +00:00
- hooked up graphical start screens with the in-game renderer.
This commit is contained in:
parent
79f4a9c0f3
commit
59cddf1601
14 changed files with 74 additions and 64 deletions
|
@ -450,7 +450,6 @@ set( PLAT_WIN32_SOURCES
|
|||
common/platform/win32/i_system.cpp
|
||||
common/platform/win32/i_specialpaths.cpp
|
||||
common/platform/win32/st_start.cpp
|
||||
common/platform/win32/st_start_util.cpp
|
||||
common/platform/win32/gl_sysfb.cpp
|
||||
common/platform/win32/base_sysfb.cpp
|
||||
common/platform/win32/win32basevideo.cpp
|
||||
|
|
|
@ -292,7 +292,7 @@ void PacketGet (void)
|
|||
if (err == WSAECONNRESET)
|
||||
{ // The remote node aborted unexpectedly, so pretend it sent an exit packet
|
||||
|
||||
if (StartScreen != NULL)
|
||||
if (StartWindow != NULL)
|
||||
{
|
||||
I_NetMessage ("The connection from %s was dropped.\n",
|
||||
GetPlayerName(node).GetChars());
|
||||
|
@ -1049,19 +1049,19 @@ void I_NetMessage(const char* text, ...)
|
|||
// todo: later these must be dispatched by the main menu, not the start screen.
|
||||
void I_NetProgress(int val)
|
||||
{
|
||||
StartScreen->NetProgress(val);
|
||||
StartWindow->NetProgress(val);
|
||||
}
|
||||
void I_NetInit(const char* msg, int num)
|
||||
{
|
||||
StartScreen->NetInit(msg, num);
|
||||
StartWindow->NetInit(msg, num);
|
||||
}
|
||||
bool I_NetLoop(bool (*timer_callback)(void*), void* userdata)
|
||||
{
|
||||
return StartScreen->NetLoop(timer_callback, userdata);
|
||||
return StartWindow->NetLoop(timer_callback, userdata);
|
||||
}
|
||||
void I_NetDone()
|
||||
{
|
||||
StartScreen->NetDone();
|
||||
StartWindow->NetDone();
|
||||
}
|
||||
#ifdef __WIN32__
|
||||
const char *neterror (void)
|
||||
|
|
|
@ -135,16 +135,19 @@ public:
|
|||
|
||||
FRemapTable* GetTranslation(int slot, int index)
|
||||
{
|
||||
if (TranslationTables.Size() <= (unsigned)slot) return nullptr;
|
||||
return TranslationTables[slot].GetVal(index);
|
||||
}
|
||||
|
||||
void ClearTranslationSlot(int slot)
|
||||
{
|
||||
if (TranslationTables.Size() <= (unsigned)slot) return;
|
||||
TranslationTables[slot].Clear();
|
||||
}
|
||||
|
||||
unsigned NumTranslations(int slot) const
|
||||
{
|
||||
if (TranslationTables.Size() <= (unsigned)slot) return 0;
|
||||
return TranslationTables[slot].Size();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ protected:
|
|||
|
||||
|
||||
|
||||
extern FStartupScreen *StartScreen;
|
||||
extern FStartupScreen *StartWindow;
|
||||
|
||||
extern void ST_Endoom();
|
||||
|
||||
|
@ -95,10 +95,10 @@ extern void ST_Endoom();
|
|||
|
||||
inline void DeleteStartupScreen()
|
||||
{
|
||||
if (StartScreen != nullptr)
|
||||
if (StartWindow != nullptr)
|
||||
{
|
||||
delete StartScreen;
|
||||
StartScreen = nullptr;
|
||||
delete StartWindow;
|
||||
StartWindow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ double PerfToSec, PerfToMillisec;
|
|||
CVAR(Bool, con_printansi, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE);
|
||||
CVAR(Bool, con_4bitansi, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE);
|
||||
|
||||
extern FStartupScreen *StartScreen;
|
||||
extern FStartupScreen *StartWindow;
|
||||
|
||||
void I_SetIWADInfo()
|
||||
{
|
||||
|
@ -278,10 +278,10 @@ void I_PrintStr(const char *cp)
|
|||
}
|
||||
}
|
||||
|
||||
if (StartScreen) CleanProgressBar();
|
||||
if (StartWindow) CleanProgressBar();
|
||||
fputs(printData.GetChars(),stdout);
|
||||
if (terminal) fputs("\033[0m",stdout);
|
||||
if (StartScreen) RedrawProgressBar(ProgressBarCurPos,ProgressBarMaxPos);
|
||||
if (StartWindow) RedrawProgressBar(ProgressBarCurPos,ProgressBarMaxPos);
|
||||
}
|
||||
|
||||
int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
|
||||
|
|
|
@ -78,7 +78,7 @@ extern void CleanProgressBar();
|
|||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
FStartupScreen *StartScreen;
|
||||
FStartupScreen *StartWindow;
|
||||
|
||||
CUSTOM_CVAR(Int, showendoom, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ void MainWindow::ShowErrorPane(const char* text)
|
|||
return;
|
||||
}
|
||||
|
||||
if (StartScreen != NULL) // Ensure that the network pane is hidden.
|
||||
if (StartWindow != NULL) // Ensure that the network pane is hidden.
|
||||
{
|
||||
I_NetDone();
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ extern HINSTANCE g_hInst;
|
|||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
FStartupScreen *StartScreen;
|
||||
FStartupScreen *StartWindow;
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ FStartScreen* GetGameStartScreen(int max_progress)
|
|||
Printf("Error creating start screen: %s\n", err.what());
|
||||
// fall through to the generic startup screen
|
||||
}
|
||||
return CreateGenericStartScreen(max_progress);
|
||||
//return CreateGenericStartScreen(max_progress);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,5 @@ protected:
|
|||
};
|
||||
|
||||
FStartScreen* GetGameStartScreen(int max_progress);
|
||||
extern FStartScreen* StartScreen;
|
||||
|
||||
extern void ST_Endoom();
|
||||
|
|
|
@ -1186,19 +1186,19 @@ FGameTexture *CreateShaderTexture(bool, bool);
|
|||
void InitBuildTiles();
|
||||
FImageSource* CreateEmptyTexture();
|
||||
|
||||
void FTextureManager::Init(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&))
|
||||
void FTextureManager::Init()
|
||||
{
|
||||
progressFunc = progressFunc_;
|
||||
DeleteAll();
|
||||
//if (BuildTileFiles.Size() == 0) CountBuildTiles ();
|
||||
|
||||
// Add all the static content
|
||||
auto nulltex = MakeGameTexture(new FImageTexture(CreateEmptyTexture()), nullptr, ETextureType::Null);
|
||||
AddGameTexture(nulltex);
|
||||
|
||||
// This is for binding to unused texture units, because accessing an unbound texture unit is undefined. It's a one pixel empty texture.
|
||||
auto emptytex = MakeGameTexture(new FImageTexture(CreateEmptyTexture()), nullptr, ETextureType::Override);
|
||||
emptytex->SetSize(1, 1);
|
||||
AddGameTexture(emptytex);
|
||||
AddGameTexture(emptytex);
|
||||
|
||||
// some special textures used in the game.
|
||||
AddGameTexture(CreateShaderTexture(false, false));
|
||||
AddGameTexture(CreateShaderTexture(false, true));
|
||||
|
@ -1211,6 +1211,12 @@ void FTextureManager::Init(void (*progressFunc_)(), void (*checkForHacks)(BuildI
|
|||
mt = MakeGameTexture(new AnimTexture(), "AnimTextureFrame2", ETextureType::Override);
|
||||
mt->SetUpscaleFlag(false, true);
|
||||
AddGameTexture(mt);
|
||||
}
|
||||
|
||||
void FTextureManager::AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&))
|
||||
{
|
||||
progressFunc = progressFunc_;
|
||||
//if (BuildTileFiles.Size() == 0) CountBuildTiles ();
|
||||
|
||||
int wadcnt = fileSystem.GetNumWads();
|
||||
|
||||
|
|
|
@ -123,7 +123,8 @@ public:
|
|||
|
||||
void LoadTextureX(int wadnum, FMultipatchTextureBuilder &build);
|
||||
void AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build);
|
||||
void Init(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo &));
|
||||
void Init();
|
||||
void AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&));
|
||||
void DeleteAll();
|
||||
|
||||
void ReplaceTexture (FTextureID picnum, FGameTexture *newtexture, bool free);
|
||||
|
|
|
@ -119,6 +119,7 @@
|
|||
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||
#include "doomfont.h"
|
||||
#include "screenjob.h"
|
||||
#include "startscreen.h"
|
||||
|
||||
#ifdef __unix__
|
||||
#include "i_system.h" // for SHARE_DIR
|
||||
|
@ -329,6 +330,7 @@ FString lastIWAD;
|
|||
int restart = 0;
|
||||
bool AppActive = true;
|
||||
bool playedtitlemusic;
|
||||
FStartScreen* StartScreen;
|
||||
|
||||
cycle_t FrameCycles;
|
||||
|
||||
|
@ -2130,6 +2132,7 @@ static void CheckCmdLine()
|
|||
timelimit = 20.f;
|
||||
}
|
||||
|
||||
if (!StartScreen) return;
|
||||
//
|
||||
// Build status bar line!
|
||||
//
|
||||
|
@ -3064,6 +3067,11 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
|
||||
D_GrabCVarDefaults(); //parse DEFCVARS
|
||||
|
||||
int max_progress = TexMan.GuesstimateNumTextures();
|
||||
int per_shader_progress = 0;//screen->GetShaderCount()? (max_progress / 10 / screen->GetShaderCount()) : 0;
|
||||
bool nostartscreen = batchrun || restart || Args->CheckParm("-join") || Args->CheckParm("-host") || Args->CheckParm("-norun");
|
||||
StartScreen = nostartscreen? nullptr : GetGameStartScreen(per_shader_progress > 0 ? max_progress * 10 / 9 : max_progress + 3);
|
||||
|
||||
GameConfig->DoKeySetup(gameinfo.ConfigName);
|
||||
|
||||
// Now that wads are loaded, define mod-specific cvars.
|
||||
|
@ -3096,22 +3104,24 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
Printf("%s", ci.GetChars());
|
||||
}
|
||||
|
||||
// [RH] Initialize palette management
|
||||
InitPalette ();
|
||||
InitPalette();
|
||||
TexMan.Init();
|
||||
|
||||
if (!batchrun) Printf ("V_Init: allocate screen.\n");
|
||||
if (!restart)
|
||||
{
|
||||
V_InitScreenSize();
|
||||
}
|
||||
|
||||
if (!restart)
|
||||
{
|
||||
// This allocates a dummy framebuffer as a stand-in until V_Init2 is called.
|
||||
V_InitScreen ();
|
||||
|
||||
if (StartScreen != nullptr)
|
||||
{
|
||||
V_Init2();
|
||||
StartScreen->Render();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (restart)
|
||||
else
|
||||
{
|
||||
// Update screen palette when restarting
|
||||
screen->UpdatePalette();
|
||||
|
@ -3133,31 +3143,11 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
if (!batchrun) Printf ("ST_Init: Init startup screen.\n");
|
||||
if (!restart)
|
||||
{
|
||||
if (GameStartupInfo.Type == FStartupInfo::DefaultStartup)
|
||||
{
|
||||
switch (gameinfo.gametype)
|
||||
{
|
||||
case GAME_Hexen:
|
||||
GameStartupInfo.Type = FStartupInfo::HexenStartup;
|
||||
break;
|
||||
|
||||
case GAME_Heretic:
|
||||
GameStartupInfo.Type = FStartupInfo::HereticStartup;
|
||||
break;
|
||||
|
||||
case GAME_Strife:
|
||||
GameStartupInfo.Type = FStartupInfo::StrifeStartup;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
StartScreen = FStartupScreen::CreateInstance (TexMan.GuesstimateNumTextures() + 5);
|
||||
StartWindow = FStartupScreen::CreateInstance (TexMan.GuesstimateNumTextures() + 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartScreen = new FStartupScreen(0);
|
||||
StartWindow = new FStartupScreen(0);
|
||||
}
|
||||
|
||||
CheckCmdLine();
|
||||
|
@ -3183,14 +3173,19 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
if (!batchrun) Printf ("Texman.Init: Init texture manager.\n");
|
||||
UpdateUpscaleMask();
|
||||
SpriteFrames.Clear();
|
||||
TexMan.Init([]() { StartScreen->Progress(); }, CheckForHacks);
|
||||
TexMan.AddTextures([]()
|
||||
{
|
||||
StartWindow->Progress();
|
||||
if (StartScreen) StartScreen->Progress(1);
|
||||
}, CheckForHacks);
|
||||
PatchTextures();
|
||||
TexAnim.Init();
|
||||
C_InitConback(TexMan.CheckForTexture(gameinfo.BorderFlat, ETextureType::Flat), true, 0.25);
|
||||
|
||||
FixWideStatusBar();
|
||||
|
||||
StartScreen->Progress();
|
||||
StartWindow->Progress();
|
||||
if (StartScreen) StartScreen->Progress(1);
|
||||
V_InitFonts();
|
||||
InitDoomFonts();
|
||||
V_LoadTranslations();
|
||||
|
@ -3216,12 +3211,15 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
I_FatalError ("No player classes defined");
|
||||
}
|
||||
|
||||
StartScreen->Progress ();
|
||||
StartWindow->Progress();
|
||||
if (StartScreen) StartScreen->Progress (1);
|
||||
|
||||
ParseGLDefs();
|
||||
|
||||
if (!batchrun) Printf ("R_Init: Init %s refresh subsystem.\n", gameinfo.ConfigName.GetChars());
|
||||
StartScreen->LoadingStatus ("Loading graphics", 0x3f);
|
||||
if (StartScreen) StartScreen->LoadingStatus ("Loading graphics", 0x3f);
|
||||
if (StartScreen) StartScreen->Progress(1);
|
||||
StartWindow->Progress();
|
||||
R_Init ();
|
||||
|
||||
if (!batchrun) Printf ("DecalLibrary: Load decals.\n");
|
||||
|
@ -3282,7 +3280,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
primaryLevel->BotInfo.wanted_botnum = primaryLevel->BotInfo.getspawned.Size();
|
||||
|
||||
if (!batchrun) Printf ("P_Init: Init Playloop state.\n");
|
||||
StartScreen->LoadingStatus ("Init game engine", 0x3f);
|
||||
if (StartScreen) StartScreen->LoadingStatus ("Init game engine", 0x3f);
|
||||
AM_StaticInit();
|
||||
P_Init ();
|
||||
|
||||
|
@ -3311,7 +3309,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
if (!restart)
|
||||
{
|
||||
if (!batchrun) Printf ("D_CheckNetGame: Checking network game status.\n");
|
||||
StartScreen->LoadingStatus ("Checking network game status.", 0x3f);
|
||||
if (StartScreen) StartScreen->LoadingStatus ("Checking network game status.", 0x3f);
|
||||
if (!D_CheckNetGame ())
|
||||
{
|
||||
return 0;
|
||||
|
@ -3346,8 +3344,6 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
autostart = true;
|
||||
}
|
||||
|
||||
delete StartScreen;
|
||||
StartScreen = NULL;
|
||||
S_Sound (CHAN_BODY, 0, "misc/startupdone", 1, ATTN_NONE);
|
||||
|
||||
if (Args->CheckParm("-norun") || batchrun)
|
||||
|
@ -3355,11 +3351,18 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
|
|||
return 1337; // special exit
|
||||
}
|
||||
|
||||
V_Init2();
|
||||
if (StartScreen == nullptr) V_Init2();
|
||||
while(!screen->CompileNextShader())
|
||||
{
|
||||
// here we can do some visual updates later
|
||||
}
|
||||
if (StartScreen)
|
||||
{
|
||||
StartScreen->Progress(max_progress); // advance progress bar to the end.
|
||||
StartScreen->Render(true);
|
||||
delete StartScreen;
|
||||
StartScreen = NULL;
|
||||
}
|
||||
twod->fullscreenautoaspect = gameinfo.fullscreenautoaspect;
|
||||
// Initialize the size of the 2D drawer so that an attempt to access it outside the draw code won't crash.
|
||||
twod->Begin(screen->GetWidth(), screen->GetHeight());
|
||||
|
|
|
@ -393,8 +393,7 @@ FRenderer* SWRenderer;
|
|||
|
||||
void R_Init ()
|
||||
{
|
||||
StartScreen->Progress();
|
||||
R_InitTranslationTables ();
|
||||
//R_InitTranslationTables ();
|
||||
R_SetViewSize (screenblocks);
|
||||
|
||||
if (SWRenderer == NULL)
|
||||
|
|
Loading…
Reference in a new issue