diff --git a/src/OpenSHC/UI/MenuViews/BuildingAndStatusMenu/MenuView_BuildingAndStatusMenu_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/BuildingAndStatusMenu/MenuView_BuildingAndStatusMenu_DoEveryFrame.cpp new file mode 100644 index 0000000000..27da7e0cc3 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/BuildingAndStatusMenu/MenuView_BuildingAndStatusMenu_DoEveryFrame.cpp @@ -0,0 +1,348 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/UI/BuildingMenus.func.hpp" +#include "OpenSHC/UI/MinimapViewState.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/UI/StatusMenus.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/DE/SHCDE/eInBuildingModes.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Rendering/ScreenResolutionEnum.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" + +#include "OpenSHC/Globals/COL_MAGENTA.hpp" +#include "OpenSHC/Globals/DAT_00b96108.hpp" +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.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 { + namespace BuildingAndStatusMenu { + + // FUNCTION: STRONGHOLDCRUSADER 0x004494E0 + void MenuView_BuildingAndStatusMenu_DoEveryFrame() + { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_640x480) { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_PANELS, 3, 0, DAT_MenuHandlerState::instance.y + 472); + } else if (DAT_GameCore::instance.activeMenuTab.tabType + == OpenSHC::UI::Enums::BASMTT_BARRACKS_OR_MPMENU_MODEM) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, + DAT_PencilRenderCore::ptr)(DAT_MenuHandlerState::instance.x, + DAT_MenuHandlerState::instance.y + 405, DAT_MenuHandlerState::instance.x + 799, + DAT_MenuHandlerState::instance.y + 471, COL_MAGENTA::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_PANELS, 4, + DAT_MenuHandlerState::instance.x, DAT_MenuHandlerState::instance.y + 405); + } else if (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_MERCENARYPOST) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, + DAT_PencilRenderCore::ptr)(DAT_MenuHandlerState::instance.x, + DAT_MenuHandlerState::instance.y + 405, DAT_MenuHandlerState::instance.x + 799, + DAT_MenuHandlerState::instance.y + 471, COL_MAGENTA::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_PANELS, 6, + DAT_MenuHandlerState::instance.x, DAT_MenuHandlerState::instance.y + 405); + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawColorBox, + DAT_PencilRenderCore::ptr)(DAT_MenuHandlerState::instance.x, + DAT_MenuHandlerState::instance.y + 406, DAT_MenuHandlerState::instance.x + 799, + DAT_MenuHandlerState::instance.y + 471, COL_MAGENTA::instance.shortValue); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_PANELS, 2, + DAT_MenuHandlerState::instance.x, DAT_MenuHandlerState::instance.y + 441); + } + if (DAT_00b96108::instance != 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderLoadedGfx, + DAT_TextureRenderCoreObject::ptr)( + 0, DAT_MenuHandlerState::instance.x + 14, DAT_MenuHandlerState::instance.y + 489); + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + switch (DAT_GameCore::instance.activeMenuTab.inBuildingTab) { + case OpenSHC::DE::SHCDE::IBM_INSIDE_BARRACKS: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_RecruitingBuilding)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_MERCPOST: + // the original keeps this arm apart from the barracks' one; MSVC merges the two here + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_RecruitingBuilding)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_KEEP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Keep)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_INN: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Inn)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_GRANARY: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Granary)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_OUTPOST: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Outpost)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_HOUSE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_House)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_WOODCUTTERS_HUT: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_WoodcutterShut)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_OXEN_BASE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_OxThether)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_IRON_MINE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Ironmine)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_PITCH_DIGGER: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_PitchRig)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_HUNTERS_HUT: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_HuntersHut)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_GOODS_YARD: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Stockpile)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_ARMOURY: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Armory)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_FLETCHERS_WORKSHOP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Fletcher)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_BLACKSMITHS_WORKSHOP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Blacksmith)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_POLETURNERS_WORKSHOP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Poleturner)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_ARMOURERS_WORKSHOP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Armourer)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TANNERS_WORKSHOP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Tanner)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_BAKERS_WORKSHOP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Bakery)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_BREWERS_WORKSHOP: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Brewery)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_QUARRY: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Quarry)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_QUARRYPILE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Quarry_Stonepile)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_HEALERS: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Apothecary)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_ENGINEERS_GUILD: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Engineersguild)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TUNNELLERS_GUILD: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Tunnelersguild)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CATHEDRAL: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Cathedral)(); + case OpenSHC::DE::SHCDE::IBM_INSIDE_TRADEPOST: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Marketplace)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TRADEPOST_PRICES: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Marketplace_Stonks)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TRADEPOST_DO_THE_TRADE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Marketplace_Trade)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TRADEPOST_FOOD: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Marketplace_Food)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TRADEPOST_BULK: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Marketplace_Resource)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TRADEPOST_ARMS: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Marketplace_Weapons)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_WELL: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Well)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_WATERPOT: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_WaterPot)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_OIL_SMELTER: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Oilsmelter)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_WHEATFARM: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Wheatfarm)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_HOPSFARM: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Hopfarm)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_APPLEFARM: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Applefarm)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CATTLEFARM: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Diaryfarm)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_MILL: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Mill)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_STABLES: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Stables)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CHURCH: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_ChapelAndChurch)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_GATEHOUSE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Gatehouse)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_DRAWBRIDGE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Drawbridge)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_POSTERN_GATE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Unused_PosternGate)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TUNNEL_ENTERANCE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_TunnelEntrance)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_SIGNPOST: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Signpost)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_KILLING_PIT: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_KillingPit)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CAMPGROUND: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Campfire)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TOWER: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Tower)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_GALLOWS: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Gallows)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_STOCKS: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Stocks)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_WITCH_HOIST: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Unused_Witchhoist)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_MAYPOLE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Maypole)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_GARDEN: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Gardens)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_PARADEGROUND: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_TrainingGrounds)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CATAPULT: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Siegetent_Catapult)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_ARAB_BALLISTA: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Siegetent_Fireballista)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_TREBUCHET: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Siegetent_Trebuchet)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_SIEGE_TOWER: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Siegetent_Siegetower)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_BATTERING_RAM: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Siegetent_BatteringRam)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_PORTABLE_SHIELD: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Siegetent_Shield)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CESS_PIT: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_CessPit)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_BURNING_STAKE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_BurningStake)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_GIBBET: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Gibbet)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_DUNGEON: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Dungeon)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_STRETCHING_RACK: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_StretchingRack)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_FLOGGING_RACK: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Unused_FloggingRack)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CHOPPING_BLOCK: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_ChoppingBlock)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_DUNKING_STOOL: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_DunkingStool)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_DOG_CAGE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_DogCage)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_STATUE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Statue)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_SHRINE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Shrine)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_BEEHIVE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Unused_BeeHive)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_DANCING_BEAR: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_DancingBear)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_POND: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Unused_Pond)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_BEAR_CAVE: + MACRO_CALL(OpenSHC::UI::BuildingMenus_Func::RenderBuildingMenu_Unused_BearCave)(); + break; + case OpenSHC::DE::SHCDE::IBM_INSIDE_CHIMP: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Chimp)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Overview)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_POPULARITY: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Popularity)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_FEARFACTOR: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_FearFactor)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_POPULATION: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Population)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_FOOD: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Food)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_ARMY: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Army)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_STORES: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Resources)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_RELIGION: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Religion)(); + break; + case OpenSHC::DE::SHCDE::IBM_SUB_MODE_REPORTS_WEAPONS: + MACRO_CALL(OpenSHC::UI::StatusMenus_Func::RenderStatusMenu_Weapons)(); + break; + } + DAT_WindowAndDirectDraw::instance.unk_resetViewportRelated = 2; + if (!DAT_GameCore::instance.isBinkVideoPlaying + && !DAT_BuildingsState::instance.DAT_IsBuildingOrPeasantBinkPlaying + && DAT_WindowAndDirectDraw::instance.currentGameResolution != OpenSHC::Rendering::SRE_640x480) { + DAT_MinimapViewState::instance.needsRedraw = TRUE; + MACRO_CALL_MEMBER( + OpenSHC::UI::MinimapViewState_Func::renderMinimapMain, DAT_MinimapViewState::ptr)(); + } + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/SingleplayerMapChoice/MenuView_SingleplayerMapChoice_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/SingleplayerMapChoice/MenuView_SingleplayerMapChoice_DoEveryFrame.cpp new file mode 100644 index 0000000000..fd560b2f33 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/SingleplayerMapChoice/MenuView_SingleplayerMapChoice_DoEveryFrame.cpp @@ -0,0 +1,186 @@ +// disable deprecation warnings for strcpy and strcat +#pragma warning(disable : 4996) + +#include "../SingleplayerMapChoice.func.hpp" + +#include "OpenSHC/IO/ResourceManager.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/UI/Helpers.func.hpp" +#include "OpenSHC/UI/MenuItems/SinglePlayerMapChoice.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/FileResourceType.hpp" +#include "OpenSHC/Map/MapLockState.hpp" +#include "OpenSHC/Map/MapType2.hpp" +#include "OpenSHC/string-macros.hpp" + +#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" +#include "OpenSHC/Globals/DAT_00b960dc.hpp" +#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MapMissionType.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_ResourceManager.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/DWORD_00b95b1c.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace SingleplayerMapChoice { + + // FUNCTION: STRONGHOLDCRUSADER 0x00448E90 + void MenuView_SingleplayerMapChoice_DoEveryFrame() + { + 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 map table's background fades in (positive) or out (negative) + if (DAT_00b960dc::instance != 0) { + DAT_GameCore::instance.hasMenuRenderedUnk = 1; + if ((int)DAT_00b960dc::instance < 0) { + DAT_ButtonBackgroundBlendStrength::instance -= (timeGetTime() - DWORD_00b95b1c::instance) / 40; + if (DAT_ButtonBackgroundBlendStrength::instance <= 0) { + DAT_ButtonBackgroundBlendStrength::instance = 0; + DAT_00b960dc::instance = 0; + } + } else { + DAT_ButtonBackgroundBlendStrength::instance += (timeGetTime() - DWORD_00b95b1c::instance) / 40; + if (DAT_ButtonBackgroundBlendStrength::instance >= 32) { + DAT_ButtonBackgroundBlendStrength::instance = 32; + DAT_GameCore::instance.menuSwitchDelay = 0; + } + } + } + + // list the maps of the chosen mission type, and select the one named in + // standaloneFilename + if (DAT_GameSynchronyState::instance.reparseMaps) { + DAT_GameSynchronyState::instance.reparseMaps = FALSE; + DAT_MouseState::instance.waitCursorToggle = 1; + MACRO_CALL(OpenSHC::UI::Helpers_Func::SetCursorDependingOnProgramState)(); + MACRO_CALL_MEMBER( + OpenSHC::IO::ResourceManager_Func::mapNames_syncLoadedMapNames, DAT_ResourceManager::ptr)(); + int count = 0; + int selected = -1; + for (int id = 0; id < DAT_ResourceManager::instance.mapFileCounter; ++id) { + char fileName[1008]; // the size of the original's buffer + strcpy(fileName, + MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, + DAT_ResourceManager::ptr)(id)); + // ".map" + strcat(fileName, S__MAP_005A2294); + MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::resolveResourceFileName, + DAT_ResourceManager::ptr)(OpenSHC::IO::FRT_MAPS, fileName); + MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::loadMapMetaByID, DAT_ResourceManager::ptr)( + id); + switch (DAT_MapPropertiesState::instance.scenarioMissionSiegeOrInvasion) { + case OpenSHC::Map::MT_SIEGE: + DAT_MapPropertiesState::instance.scenarionMissionType = 2; + break; + case OpenSHC::Map::MT_INVASION: + DAT_MapPropertiesState::instance.scenarionMissionType = 3; + break; + case OpenSHC::Map::MT_ECONOMIC: + DAT_MapPropertiesState::instance.scenarionMissionType = 1; + break; + case OpenSHC::Map::MT_JUST_BUILD: + DAT_MapPropertiesState::instance.scenarionMissionType = 0; + break; + } + if (DAT_GameCore::instance.mapType != 0 + || DAT_MapPropertiesState::instance.scenarionMissionType != DAT_MapMissionType::instance + || DAT_GameCore::instance.savedMapLocked >= OpenSHC::Map::MLS_MISSION) { + continue; + } + DAT_MenuTextInputState::instance.DAT_ArrayOfMapIndices[count] = id; + DAT_MenuTextInputState::instance.DAT_ArrayOfMapIndices2[count - 1] = id; + DAT_MenuTextInputState::instance.arrayOfMapEndInt2[id] = DAT_GameCore::instance.savedMapEndInt2; + if (MACRO_CALL(OpenSHC::OS_Func::__stricmp)( + MACRO_CALL_MEMBER(OpenSHC::IO::ResourceManager_Func::mapNames_getLoadedMapNameForIndex, + DAT_ResourceManager::ptr)(id), + DAT_GameCore::instance.standaloneFilename) + == 0) { + selected = count; + } + ++count; + } + DAT_MouseState::instance.waitCursorToggle = 0; + DAT_GameSynchronyState::instance.DAT_MapSelectionTotalNumber = count; + DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset = 0; + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected = -1; + DAT_GameSynchronyState::instance.skirmishRelated1 = 0; + if (count != 0) { + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected = 0; + if (strlen(DAT_GameCore::instance.standaloneFilename) != 0 && selected >= 0) { + // scrolled so that the selected map is in the table's 13 rows; the globals count, and + // each arm calls the table (a local counter or one call behind the test measures lower) + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected = selected; + while (DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected >= 13) { + --DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected; + ++DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset; + } + MACRO_CALL(OpenSHC::UI::MenuItems::SinglePlayerMapChoice_Func:: + MenuItemActionHandler_SingleplayerMapChoice_MapTable)( + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected); + } else { + MACRO_CALL(OpenSHC::UI::MenuItems::SinglePlayerMapChoice_Func:: + MenuItemActionHandler_SingleplayerMapChoice_MapTable)( + DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected); + } + DAT_GameSynchronyState::instance.skirmishRelated1 = 1; + DAT_GameCore::instance.standaloneFilename[0] = '\0'; + } + DWORD_00b95b1c::instance = timeGetTime(); + } + + // the map table's box, narrower for sieges + int const x = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + int const y = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; + int left = x + 280; + if (DAT_MapMissionType::instance != 2) { + left = x + 140; + } + int const top = y + 253; + int const right = x + 660; + int const bottom = y + 534; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, DAT_PencilRenderCore::ptr)( + left, top, right - 20, bottom, (DAT_ButtonBackgroundBlendStrength::instance - 32) * 16 / 32 + 32); + if (DAT_00b960dc::instance != 0) { + return; + } + // its frame, the header line and the scroll bar's + int const frameLeft = left - 1; + int const frameRight = right + 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)( + frameLeft, 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); + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/UnusedCreateSiege/MenuView_UnusedCreateSiege_DoEveryFrame.cpp b/src/OpenSHC/UI/MenuViews/UnusedCreateSiege/MenuView_UnusedCreateSiege_DoEveryFrame.cpp new file mode 100644 index 0000000000..8f11b23170 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/UnusedCreateSiege/MenuView_UnusedCreateSiege_DoEveryFrame.cpp @@ -0,0 +1,217 @@ +#include "../UnusedCreateSiege.func.hpp" + +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI/MinimapViewState.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Map/MapConstants.hpp" +#include "OpenSHC/Map/MapType2.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_BottomLeftTextDisplayState.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/INT_00b95f68.hpp" +#include "OpenSHC/Globals/INT_00b960e4.hpp" +#include "OpenSHC/Globals/INT_00b960ec.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + namespace UnusedCreateSiege { + + // FUNCTION: STRONGHOLDCRUSADER 0x004306D0 + void MenuView_UnusedCreateSiege_DoEveryFrame() + { + DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 = OpenSHC::Map::MT_SIEGE; + 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); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHeaderBanner, DAT_PencilRenderCore::ptr)( + DAT_MenuHandlerState::instance.x + 48, DAT_MenuHandlerState::instance.y + 6, 704, 50); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + if (!DAT_BottomLeftTextDisplayState::instance.currentlyDisplayedTextIsDisplayedUnk) { + // "Use the pre-built map and fixed amounts of stone and gold to build the strongest castle ..." + DAT_TextManagerObject::instance.field_0x24 = 1; + // its position named, y first (inline: quick_diff 0.8802 -> 0.5928) + int const textY = DAT_MenuHandlerState::instance.y + 118; + int const textX = DAT_MenuHandlerState::instance.x + 18; + MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::renderMultilineText6Unk, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_MAPEDIT, 37), + textX, textY, 456, 0xccfaff, OpenSHC::Rendering::Colors::COL_000000, 17, 0); + } + // "'Siege That' Builder - " and the map's name + 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_MAPEDIT, 34), + DAT_MenuHandlerState::instance.x + 140, DAT_MenuHandlerState::instance.y + 35, + OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_C2F0EB, 17, FALSE, 0); + // " - " + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + s___005a2304, DAT_MenuHandlerState::instance.x + 140, DAT_MenuHandlerState::instance.y + 35, + OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_C2F0EB, 17, TRUE, 0); + if (INT_00b960e4::instance == 0) { + // "Untitled" + 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_MAPEDIT, 24), + DAT_MenuHandlerState::instance.x + 140, DAT_MenuHandlerState::instance.y + 35, + OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_C2F0EB, 17, TRUE, 0); + } else { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderTextToScreen, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER( + OpenSHC::Text::UserTextHandler_Func::getTextArrayPointer, DAT_UserTextHandlerState::ptr)(2), + DAT_MenuHandlerState::instance.x + 140, DAT_MenuHandlerState::instance.y + 35, + OpenSHC::Text::TTA_LEFT, OpenSHC::Rendering::Colors::COL_C2F0EB, 17, TRUE, 0); + } + + if (DAT_MenuModalComposition1::instance.activeModalDialogID == OpenSHC::UI::Enums::MMT_NONE) { + // the minimap preview, centred on (x, y) + int x = DAT_MenuHandlerState::instance.x + 600; + int y = DAT_MenuHandlerState::instance.y + 240; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + int mapSize = DAT_TileMapState::instance.mapSize; + if (mapSize == 0) { + mapSize = OpenSHC::Map::MC_MAP_SIZE_400; + } + int const centerX = x; + int const centerY = y; + DAT_MinimapViewState::instance.needsRedraw = TRUE; + char sizeText[20]; + // "%dx%d" + MACRO_CALL(OpenSHC::OS_Func::_sprintf)(sizeText, s__dx_d_005a22fc, mapSize, mapSize); + // x and y move to the preview's top left corner + int previewSize; + switch (mapSize) { + case 100: + x -= 50; + y -= 50; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 100; + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + x -= 80; + y -= 80; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 160; + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, mapSize, mapSize); + previewSize = 200; + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + // drawn at half size + x -= 75; + y -= 75; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 150, 150); + previewSize = 150; + break; + default: + // 400 is drawn at half size + x -= 100; + y -= 100; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::renderMinimapEditor, + DAT_MinimapViewState::ptr)(x, y, 200, 200); + previewSize = 200; + break; + } + + // a two-pixel black frame around the preview + // default first, as the original lays the arms out; a 100 map gets the default 200 frame + switch (mapSize) { + default: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 100, centerY - 100, centerX + 99, centerY + 100, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 101, centerY - 101, centerX + 100, centerY + 101, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_300: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 75, centerY - 75, centerX + 73, centerY + 74, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 76, centerY - 76, centerX + 74, centerY + 75, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_200: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 98, centerY - 99, centerX + 99, centerY + 99, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 99, centerY - 100, centerX + 100, centerY + 100, COL_BLACK::instance.shortValue); + break; + case OpenSHC::Map::MC_MAP_SIZE_160: + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 78, centerY - 79, centerX + 78, centerY + 77, COL_BLACK::instance.shortValue); + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBorderBox, DAT_PencilRenderCore::ptr)( + centerX - 79, centerY - 80, centerX + 79, centerY + 78, COL_BLACK::instance.shortValue); + break; + } + + // the size label at the top right (x += previewSize: quick_diff 0.9760 -> 0.8617) + int const labelX = x + previewSize; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, DAT_PencilRenderCore::ptr)( + labelX + - MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::computeTextWidth, + DAT_TextManagerObject::ptr)(sizeText, 19) + - 15, + y - 15, labelX, y); + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, + DAT_TextManagerObject::ptr)(sizeText, labelX - 5, y - 11, OpenSHC::Text::TTA_RIGHT, + OpenSHC::Rendering::Colors::COL_C2F0EB, OpenSHC::Rendering::Colors::COL_000000, 19, FALSE, 0); + } + if (DAT_MenuTextInputState::instance.field_0xa4 != 0) { + INT_00b95f68::instance = 0; + DAT_MenuTextInputState::instance.field_0xa4 = 0; + } + INT_00b960ec::instance + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[0] + .id + != 0; + } + + } + } +} +} diff --git a/src/OpenSHC/UI/MenuViews/UnusedDemoBuyItScreen/MenuView_UnusedDemoBuyItScreen_DoInitial.cpp b/src/OpenSHC/UI/MenuViews/UnusedDemoBuyItScreen/MenuView_UnusedDemoBuyItScreen_DoInitial.cpp new file mode 100644 index 0000000000..2066a01f37 --- /dev/null +++ b/src/OpenSHC/UI/MenuViews/UnusedDemoBuyItScreen/MenuView_UnusedDemoBuyItScreen_DoInitial.cpp @@ -0,0 +1,56 @@ +#include "../UnusedDemoBuyItScreen.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/Rendering/ScreenResolutionEnum.hpp" + +#include "OpenSHC/Globals/COL_BLACK.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" +#include "OpenSHC/Globals/INT_00b960e0.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuViews { + + // FUNCTION: STRONGHOLDCRUSADER 0x00426600 + void UnusedDemoBuyItScreen::MenuView_UnusedDemoBuyItScreen_DoInitial() + { + 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); + // the picture and the menu sit 24 pixels further right at 800x600 + int offset = 0; + INT_00b960e0::instance = 0; + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_800x600) { + offset = 24; + INT_00b960e0::instance = 24; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawGfxOnFlaggedSurface, + DAT_TextureRenderCoreObject::ptr)(0, + (DAT_WindowAndDirectDraw::instance.resolutionX + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].width) + / 2 + + offset, + (DAT_WindowAndDirectDraw::instance.resolutionY + - DAT_TextureRenderCoreObject::instance.loadedGfxArray[0].height) + / 2); + int const borderHeight = DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; + int const borderWidth = DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + Menu* const menu = DAT_MenuHandlerState::instance.currentMenu; + menu->yPosition = borderHeight; + // x apart from borderWidth puts the height in eax (one local for both: quick_diff 0.9535 -> 0.8605) + int x = borderWidth; + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_800x600) { + x = borderWidth + 24; + } + menu->xPosition = x; + DAT_MenuHandlerState::instance.y = borderHeight; + DAT_MenuHandlerState::instance.x = x; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index ed989c9a21..9ff4278f3f 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -6767,7 +6767,7 @@ SHC_3BB0A8C1_0x00426340 | 0.0% | Pending SHC_3BB0A8C1_0x00426570 | 0.0% | Pending -SHC_3BB0A8C1_0x00426600 | 0.0% | Pending +SHC_3BB0A8C1_0x00426600 | 97.7% | x in its own local; the menu y store placed before the resolution test SHC_3BB0A8C1_0x004266A0 | 100.0% | Reimplemented @@ -10117,7 +10117,7 @@ SHC_3BB0A8C1_0x00430686 | 0.0% | Pending SHC_3BB0A8C1_0x00430690 | 0.0% | Pending -SHC_3BB0A8C1_0x004306D0 | 0.0% | Pending +SHC_3BB0A8C1_0x004306D0 | 91.4% | own rewrite from the asm with gynt's draft; the constant 1's register and the name branch's register use SHC_3BB0A8C1_0x00430B10 | 0.0% | Pending @@ -16381,7 +16381,7 @@ SHC_3BB0A8C1_0x004489F0 | 0.0% | Pending SHC_3BB0A8C1_0x00448D40 | 0.0% | Pending -SHC_3BB0A8C1_0x00448E90 | 0.0% | Pending +SHC_3BB0A8C1_0x00448E90 | 92.5% | own rewrite from the asm with gynt's draft; one push ahead of two stores, and the box's x and two side registers SHC_3BB0A8C1_0x00449274 | 0.0% | Pending @@ -16407,7 +16407,7 @@ SHC_3BB0A8C1_0x00449400 | 0.0% | Pending SHC_3BB0A8C1_0x00449410 | 0.0% | Pending -SHC_3BB0A8C1_0x004494E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004494E0 | 72.9% | gynt's draft in the original's arm order; the original keeps the mercenary post's arm apart from the barracks' one SHC_3BB0A8C1_0x00449994 | 0.0% | Pending