Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include "../EditScenario.func.hpp"

#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"
#include "OpenSHC/Rendering/Enums/RenderTarget.hpp"
#include "OpenSHC/UI/Enums/MenuModalType.hpp"

#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp"
#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp"
#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp"
#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"
#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp"
#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuViews {

// FUNCTION: STRONGHOLDCRUSADER 0x004B8080
void EditScenario::MenuView_EditScenario_DoEveryFrame()
{
// the background, centred
DAT_TextureRenderCoreObject::instance.currentRenderSurfaceIdentifierUnk_0x8
= OpenSHC::Rendering::Enums::RT_SCREEN_MENU;
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface,
DAT_TextureRenderCoreObject::ptr)(0,
(DAT_WindowAndDirectDraw::instance.resolutionX
- DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width)
/ 2,
(DAT_WindowAndDirectDraw::instance.resolutionY
- DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height)
/ 2);
if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) {
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU;
// "Scenario Editor"
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderTextBanner,
DAT_PencilRenderCore::ptr)(OpenSHC::DE::SHCDE::TEXT_SCENARIO, 2, DAT_MenuHandlerState::instance.x,
DAT_MenuHandlerState::instance.y, 800, 60);
// the map surface, set before the corners are worked out (after them: quick_diff 0.9920 -> 0.9840)
DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME;
// the list box: dimmed and framed in yellow, with a 20 pixel strip on its right for the scroll buttons
int const left = DAT_MenuHandlerState::instance.x + 270;
int const top = DAT_MenuHandlerState::instance.y + 90;
int const right = DAT_MenuHandlerState::instance.x + 770;
int const bottom = DAT_MenuHandlerState::instance.y + 489;
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)(
left, top, right - 20, bottom);
int const frameRight = right + 1;
int const frameLeft = left - 1;
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)(
frameLeft, top - 1, frameRight, top - 1, COL_VERY_SOFT_YELLOW::instance.shortValue);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)(
frameLeft, bottom + 1, frameRight, bottom + 1, COL_VERY_SOFT_YELLOW::instance.shortValue);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)(
right - 20, top + 20, frameRight, top + 20, COL_VERY_SOFT_YELLOW::instance.shortValue);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)(
frameLeft, top, frameLeft, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)(
frameRight, top, frameRight, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)(
right - 20, top, right - 20, bottom, COL_VERY_SOFT_YELLOW::instance.shortValue);
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)(
right - 19, bottom - 20, right, bottom - 20, COL_VERY_SOFT_YELLOW::instance.shortValue);
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "../GameStartEnterName.func.hpp"

#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/Text/UserTextHandler.func.hpp"
#include "OpenSHC/UI/MenuModalComposition.func.hpp"
#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp"
#include "OpenSHC/Text/TextArrayIndexType.hpp"
#include "OpenSHC/UI/Enums/MenuModalType.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp"
#include "OpenSHC/Globals/DAT_MouseState.hpp"
#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp"
#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp"
#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuViews {

// FUNCTION: STRONGHOLDCRUSADER 0x00424B10
void GameStartEnterName::MenuView_GameStartEnterName_DoEveryFrame()
{
// == TRUE as in the original, which compares with 1 (truthiness: quick_diff 0.9375 -> 0.8542)
if (DAT_GameCore::instance.isNameEntryActive == TRUE) {
return;
}
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface,
DAT_TextureRenderCoreObject::ptr)(0,
(DAT_WindowAndDirectDraw::instance.resolutionX
- DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width)
/ 2,
(DAT_WindowAndDirectDraw::instance.resolutionY
- DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height)
/ 2);
// the original tests the flag again after the draw call; nothing sets it there, so this branch does not run
if (DAT_GameCore::instance.isNameEntryActive == TRUE) {
// after a second, once draggingStopped is set or on a right click, back to the main menu
DWORD const now = timeGetTime();
if (now - DAT_GameCore::instance.nameEntryStartTime <= 1000 && !DAT_MouseState::instance.draggingStopped
&& !DAT_MouseState::instance.rightClickStop) {
return;
}
} else {
// return pressed: close the dialog and go to the main menu
// read, cleared, then tested (testing the field itself: quick_diff 0.9375 -> 0.9053)
dword const returnPressed = DAT_UserTextHandlerState::instance.returnPressed;
DAT_UserTextHandlerState::instance.returnPressed = 0;
if (returnPressed == 0) {
return;
}
MACRO_CALL_MEMBER(OpenSHC::UI::MenuModalComposition_Func::activateModalDialog,
DAT_MenuModalComposition1::ptr)(OpenSHC::UI::Enums::MMT_NONE, FALSE);
MACRO_CALL_MEMBER(OpenSHC::Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(
OpenSHC::Text::TAIT_NINE__FILTER_B);
}
MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
OpenSHC::UI::Enums::MVT_MAIN_MENU, 0);
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include "../IntroLogos.func.hpp"

#include "OpenSHC/Game/GameCore.func.hpp"
#include "OpenSHC/Text/TextManager.func.hpp"
#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp"
#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp"
#include "OpenSHC/DE/SHCDE/eTextSections.hpp"
#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp"
#include "OpenSHC/Text/TextAlignment.hpp"
#include "OpenSHC/UI/Enums/MenuViewType.hpp"

#include "OpenSHC/Globals/COL_BLACK.hpp"
#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_IntroBlendStrength.hpp"
#include "OpenSHC/Globals/DAT_IntroStep.hpp"
#include "OpenSHC/Globals/DAT_IntroTimestamp.hpp"
#include "OpenSHC/Globals/DAT_IntroTransitionStep.hpp"
#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp"
#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"
#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp"
#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp"

namespace OpenSHC {
namespace UI {
namespace MenuViews {

// FUNCTION: STRONGHOLDCRUSADER 0x004247A0
void IntroLogos::MenuView_IntroLogos_DoEveryFrame()
{
// the two logos, then the online-play notice on black
if (DAT_IntroStep::instance < 2) {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface,
DAT_TextureRenderCoreObject::ptr)(0,
(DAT_WindowAndDirectDraw::instance.resolutionX
- DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width)
/ 2,
(DAT_WindowAndDirectDraw::instance.resolutionY
- DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height)
/ 2);
} else {
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox,
DAT_PencilRenderCore::ptr)(0, 0, DAT_WindowAndDirectDraw::instance.resolutionX,
DAT_WindowAndDirectDraw::instance.resolutionY, COL_BLACK::instance.shortValue);
int const y = DAT_WindowAndDirectDraw::instance.resolutionY / 2 - 30;
int const x = DAT_WindowAndDirectDraw::instance.resolutionX / 2;
// "Gameplay may change during online play"
MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)(
MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset,
DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_GAMEPLAY_ONLINE, 0),
x, y, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_FFFFFF, 16, FALSE, 0);
}
DWORD const currentTime = timeGetTime();
if (DAT_IntroTransitionStep::instance == 0) {
// fade in
DAT_IntroBlendStrength::instance = (int)(currentTime - DAT_IntroTimestamp::instance) / 20;
if (DAT_IntroBlendStrength::instance >= 32) {
DAT_IntroBlendStrength::instance = 32;
DAT_IntroTransitionStep::instance = 1;
DAT_IntroTimestamp::instance = timeGetTime();
}
} else if (DAT_IntroTransitionStep::instance == 1) {
// hold: 2.5 seconds, the second logo 6
int duration = 2500;
if (DAT_IntroStep::instance == 1) {
duration = 6000;
}
if ((int)(currentTime - DAT_IntroTimestamp::instance) > duration) {
DAT_IntroTransitionStep::instance = 2;
DAT_IntroTimestamp::instance = timeGetTime();
}
} else if (DAT_IntroTransitionStep::instance == 2) {
// fade out, then the next logo or the intro video
DAT_IntroBlendStrength::instance = 32 - (int)(currentTime - DAT_IntroTimestamp::instance) / 20;
if (DAT_IntroBlendStrength::instance <= 0) {
if (DAT_IntroStep::instance == 0) {
DAT_IntroTransitionStep::instance = 0;
DAT_IntroBlendStrength::instance = 0;
DAT_IntroStep::instance = 1;
MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
OpenSHC::UI::Enums::MVT_INTRO_LOGOS, 0);
} else if (DAT_IntroStep::instance == 1) {
DAT_IntroTransitionStep::instance = 0;
DAT_IntroBlendStrength::instance = 0;
DAT_IntroStep::instance = 2;
MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
OpenSHC::UI::Enums::MVT_INTRO_LOGOS, 0);
} else {
MACRO_CALL_MEMBER(OpenSHC::Game::GameCore_Func::switchToMenuView, DAT_GameCore::ptr)(
OpenSHC::UI::Enums::MVT_INTRO_VIDEO, 0);
}
}
}
if (DAT_IntroBlendStrength::instance >= 32) {
return;
}
// the original calls timeGetTime() here and drops the result
timeGetTime();
MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox,
DAT_PencilRenderCore::ptr)(0, 0, DAT_WindowAndDirectDraw::instance.resolutionX,
DAT_WindowAndDirectDraw::instance.resolutionY, DAT_IntroBlendStrength::instance);
}

}
}
}
Loading
Loading