- Exhumed menu tweaks - draw a background and caption for the option menus the game originally did not have.

- fixed a crash in the 2D drawer when two consecutively allocated vertex buffers had the same address. Strangely this only occured with Exhumed but not the other games
- fixed Exhumed crashing with sound disabled.
This commit is contained in:
Christoph Oelckers 2019-12-26 17:42:45 +01:00
parent f77736ccb4
commit 68a3a60d0b
9 changed files with 41 additions and 12 deletions

View file

@ -983,9 +983,9 @@ if( APPLE )
endif()
if( WIN32 )
set( INSTALL_PATH . CACHE STRING "Directory where the demolition executable will be placed during install." )
set( INSTALL_PATH . CACHE STRING "Directory where the executable will be placed during install." )
else()
set( INSTALL_PATH bin CACHE STRING "Directory where the demolition executable will be placed during install." )
set( INSTALL_PATH bin CACHE STRING "Directory where the executable will be placed during install." )
endif()
install(TARGETS demolition
DESTINATION ${INSTALL_PATH}
@ -1008,6 +1008,8 @@ source_group("Code\\Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/commo
source_group("Code\\Rendering" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/.+")
source_group("Code\\Rendering\\GL_Load" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl_load/.+")
source_group("Code\\Rendering\\GL\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl/system.+")
source_group("Platform" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/platform/.+")
source_group("Platform\\Win32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/platform/win32/.+")
source_group("Utility\\Smackerdec" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/smackerdec/.+")
source_group("Utility\\Smackerdec\\Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/libsmackerdec/include/.+")
source_group("Utility\\Smackerdec\\Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/libsmackerdec/src/.+")

View file

@ -1051,7 +1051,7 @@ void C_Ticker()
lasttic = consoletic;
NotifyStrings.Tick();
if (GUICapture & 1)
if (ConsoleState == c_down)
{
D_ProcessEvents();
}

View file

@ -839,7 +839,7 @@ void M_Ticker (void)
if (DMenu::MenuTime & 3) return;
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off)
{
D_ProcessEvents(); // The main loop is blocked when the menu is open and cannot dispatch the events.
if (DMenu::MenuTime != 0) D_ProcessEvents(); // The main loop is blocked when the menu is open and cannot dispatch the events.
if (transition.previous) transition.previous->Ticker();
if (DMenu::CurrentMenu == nullptr) return; // In case one of the sub-screens has closed the menu.
DMenu::CurrentMenu->Ticker();

View file

@ -52,6 +52,20 @@ int menu_Menu(int nVal)
M_SetMenu(NAME_MainMenu);
while (M_Active())
{
auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo;
int dword_9AB5F = ((int)totalclock / 16) & 3;
videoClearScreen(blackcol);
overwritesprite(160, 100, kSkullHead, 32, 3, kPalNormal);
overwritesprite(161, 130, kSkullJaw, 32, 3, kPalNormal);
overwritesprite(160, 40, nLogoTile, 32, 3, kPalNormal);
// draw the fire urn/lamp thingies
overwritesprite(50, 150, kTile3512 + dword_9AB5F, 32, 3, kPalNormal);
overwritesprite(270, 150, kTile3512 + ((dword_9AB5F + 2) & 3), 32, 3, kPalNormal);
HandleAsync();
videoNextPage();
@ -190,8 +204,8 @@ void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* t
{
int height = 11;
auto lines = FString(text).Split("\n");
int y = 100 - (height * lines.Size() / 2);
auto lines = FString(text).MakeUpper().Split("\n");
int y = position - (height * lines.Size() / 2);
for (auto& l : lines)
{
int width = MyGetStringWidth(l);
@ -201,6 +215,11 @@ void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* t
}
}
void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
{
DrawCenteredTextScreen(origin, text, 10, false);
}
END_PS_NS

View file

@ -81,8 +81,6 @@ BEGIN_PS_NS
extern const char* s_buildRev;
extern const char* s_buildTimestamp;
const char* AppProperName = APPNAME;
const char* AppTechnicalName = APPBASENAME;
void FinishLevel();

View file

@ -285,7 +285,8 @@ struct GameInterface : ::GameInterface
void StartGame(FGameStartup& gs) override;
bool CanSave() override;
FSavegameInfo GetSaveSig() override;
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg);
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
void DrawMenuCaption(const DVector2& origin, const char* text) override;
FString statFPS() override;
//GameStats getStats() override;

View file

@ -338,7 +338,7 @@ void PlayLocalSound(short nSound, short nRate)
// There is exactly one occurence in the entire game which alters the pitch.
pASound->snd_channel = soundEngine->StartSound(SOURCE_Unattached, nullptr, nullptr, CHAN_BODY, CHANF_OVERLAP, nSound + 1, 1.f, ATTN_NONE, nullptr);
if (nRate)
if (nRate && pASound->snd_channel)
{
float ratefac = (11025 + nRate) / 11025.f;
soundEngine->SetPitch(pASound->snd_channel, ratefac);

View file

@ -256,6 +256,15 @@ public:
{
renderState.IndexBuffer = vb;
}
void ClearBufferState()
{
SetVertexBuffer(nullptr, 0, 0);
SetIndexBuffer(nullptr);
// Invalidate the pointers as well to make sure that if another buffer with the same address is used it actually gets bound.
LastVertexBuffer = (IVertexBuffer*)~intptr_t(0);
LastIndexBuffer = (IIndexBuffer*)~intptr_t(0);
}
const VSMatrix &GetMatrix(int num)
{
return matrices[num];

View file

@ -118,6 +118,7 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
}
F2DVertexBuffer vb;
vb.UploadData(&vertices[0], vertices.Size(), &indices[0], indices.Size());
assert(vb.GetBufferObjects().first && vb.GetBufferObjects().second);
SetVertexBuffer(vb.GetBufferObjects().first, 0, 0);
SetIndexBuffer(vb.GetBufferObjects().second);
SetFadeDisable(true);
@ -210,8 +211,7 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
//state.SetScissor(-1, -1, -1, -1);
//state.SetRenderStyle(STYLE_Translucent);
SetVertexBuffer(nullptr, 0, 0);
SetIndexBuffer(nullptr);
ClearBufferState();
UseColorOnly(false);
//state.EnableBrightmap(true);
//state.SetTextureMode(TM_NORMAL);