diff --git a/src/OpenSHC/UI/MenuItem/handleMenuElementsCallbacks.cpp b/src/OpenSHC/UI/MenuItem/handleMenuElementsCallbacks.cpp new file mode 100644 index 0000000000..10502c05cc --- /dev/null +++ b/src/OpenSHC/UI/MenuItem/handleMenuElementsCallbacks.cpp @@ -0,0 +1,366 @@ +#include "../MenuItem.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Input/MouseState.func.hpp" +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" +#include "OpenSHC/Audio/SFX/SoundEffectID.hpp" +#include "OpenSHC/Rendering/Enums/GmDataIndex.hpp" +#include "OpenSHC/UI/Enums/MenuItemRenderFunctionType.hpp" +#include "OpenSHC/UI/Enums/MenuItemType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp" +#include "OpenSHC/Globals/BOOL_CurrentMenuClickState.hpp" +#include "OpenSHC/Globals/DAT_00ed31d0.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonGmDataIndex.hpp" +#include "OpenSHC/Globals/DAT_CurrentButtonPictureInGm.hpp" +#include "OpenSHC/Globals/DAT_MenuHandlerState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_ScrollingHandler.hpp" +#include "OpenSHC/Globals/DAT_StopHandlingMenuItems.hpp" +#include "OpenSHC/Globals/DAT_UIDragDropDefinedData.hpp" + +namespace OpenSHC { +namespace UI { + + using OpenSHC::Audio::SFX::SoundEffectID; + using OpenSHC::Rendering::Enums::GmDataIndex; + using OpenSHC::UI::Enums::MenuItemRenderFunctionType; + using OpenSHC::UI::Enums::MenuItemType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004F4290 + int MenuItem::handleMenuElementsCallbacks() + { + MenuItemTypeInt const type = this->menuItemType & OpenSHC::UI::Enums::MIT_MENU_ITEM_TYPE_ID_PARTUnk; + if (this->iconDeactivatedUnk_0x36 || this->unknownZero) { + return 0; + } + this->hovering = 0; + if (type == ((MenuItemType)0)) { + (*this->menuItemActionHandler.simple)(this->callbackParameter.parameter); + return 0; + } + if (type == ((MenuItemType)1) && DAT_ScrollingHandler::instance.isScrolling_0x0) { + (*this->menuItemActionHandler.simple)(this->callbackParameter.parameter); + return 0; + } + if (this->clicked + && (int)(timeGetTime() - this->secondItemTypeData.buttonState.clickTimestamp_0x4) + > this->menuPointer->thousand) { + this->clicked = 0; + } + if (type != OpenSHC::UI::Enums::MIT_SLIDERUnk && type != OpenSHC::UI::Enums::MIT_SCROLLBARUnk) { + DAT_StopHandlingMenuItems::instance = 1; + if (!MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::isMouseInsideBox, DAT_MouseState::ptr)( + this->menuPointer->xPosition + this->position.position.x, + this->menuPointer->yPosition + this->position.position.y, this->itemWidth, this->itemHeight)) { + return 0; + } + DAT_MenuHandlerState::instance.field_0x3c = 1; + DAT_ButtonX::instance = this->menuPointer->xPosition + this->position.position.x; + DAT_ButtonY::instance = this->menuPointer->yPosition + this->position.position.y; + BOOL_CurrentMenuClickState::instance = (BOOLEnum)this->clicked; + if (this->menuItemRenderFunctionType == OpenSHC::UI::Enums::MIRFT_GM_DATA_IMAGE + && (this->firstItemTypeData.gmDataIndex & OpenSHC::Rendering::Enums::GDI_USE_PIXEL_MOUSE_HIT_CHECKUnk) + != OpenSHC::Rendering::Enums::GDI_NONE_0) { + DAT_CurrentButtonGmDataIndex::instance = this->firstItemTypeData.gmDataIndex & 0x7fffff; + DAT_ButtonCurrentlyInteracting::instance = (BOOLEnum)(this->hovering | this->clicked); + DAT_CurrentButtonPictureInGm::instance + = this->secondItemTypeData.buttonState.currentButtonPictureInGm_0xc; + if (!MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::isMouseOnButtonImageUnk, + AlphaAndButtonSurfaceObj::ptr)()) { + return 0; + } + } + if (*(int*)&this->textMessageLookupIndex != -1 && !DAT_MenuModalComposition1::instance.mbr_0x78) { + this->menuPointer->hoveredItem = this; + } + if (this->menuPointer->someMenuItemPtr_0x3c != this && !this->menuPointer->field_0x40) { + int const sound = this->textMessageLookupIndex.field_0x2; + if (sound != 1) { + if ((uint)(sound - 2) <= 5) { + this->menuPointer->someMenuItemPtr_0x3c = this; + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + (SoundEffectID)(this->textMessageLookupIndex.field_0x2 + 0x7f)); + this->menuPointer->field_0x40 = 1; + } + } else { + this->menuPointer->someMenuItemPtr_0x3c = this; + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + ((SoundEffectID)0x88)); + this->menuPointer->field_0x40 = 1; + } + } + this->hovering = 1; + if (type == OpenSHC::UI::Enums::MIT_TEXT_OR_STATE_OR_PLAYER_DEPENDENTUnk) { + if (DAT_MouseState::instance.rightClickStart) { + DWORD const now = timeGetTime(); + this->secondItemTypeData.buttonState.clickTimestamp_0x4 = now; + this->secondItemTypeData.buttonState.someTimestamp_1_0x0 = now; + this->clicked = 1; + BOOL_CurrentMenuClickState::instance = TRUE; + (*this->menuItemActionHandler.simple)(this->callbackParameter.parameter); + this->secondItemTypeData.buttonState.countTo100 = 0; + this->clicked = (short)BOOL_CurrentMenuClickState::instance; + return DAT_StopHandlingMenuItems::instance; + } + return 0; + } + if (DAT_MouseState::instance.leftClickStart) { + DWORD const now = timeGetTime(); + this->secondItemTypeData.buttonState.clickTimestamp_0x4 = now; + this->secondItemTypeData.buttonState.someTimestamp_1_0x0 = now; + this->clicked = 1; + BOOL_CurrentMenuClickState::instance = TRUE; + (*this->menuItemActionHandler.simple)(this->callbackParameter.parameter); + this->secondItemTypeData.buttonState.countTo100 = 0; + this->clicked = (short)BOOL_CurrentMenuClickState::instance; + return DAT_StopHandlingMenuItems::instance; + } + if (DAT_MouseState::instance.leftClickState && type == ((MenuItemType)2)) { + DWORD const now = timeGetTime(); + this->secondItemTypeData.buttonState.clickTimestamp_0x4 = now; + this->clicked = 1; + BOOL_CurrentMenuClickState::instance = TRUE; + if ((int)(now - this->secondItemTypeData.buttonState.someTimestamp_1_0x0) < 0x28) { + return 0; + } + this->secondItemTypeData.buttonState.countTo100 = this->secondItemTypeData.buttonState.countTo100 + 1; + this->secondItemTypeData.buttonState.someTimestamp_1_0x0 + = this->secondItemTypeData.buttonState.clickTimestamp_0x4; + if (this->secondItemTypeData.buttonState.countTo100 >= 100) { + this->secondItemTypeData.buttonState.countTo100 = 99; + } + DAT_00ed31d0::instance = this->secondItemTypeData.buttonState.countTo100; + if (DAT_UIDragDropDefinedData::instance.UI_DragTicks[this->secondItemTypeData.buttonState.countTo100] + == 0) { + return 0; + } + (*this->menuItemActionHandler.simple)(this->callbackParameter.parameter); + this->clicked = (short)BOOL_CurrentMenuClickState::instance; + this->secondItemTypeData.buttonState.countTo100 = DAT_00ed31d0::instance; + return DAT_StopHandlingMenuItems::instance; + } + if (DAT_MouseState::instance.draggingStopped && type == ((MenuItemType)10)) { + DWORD const now = timeGetTime(); + this->secondItemTypeData.buttonState.clickTimestamp_0x4 = now; + this->secondItemTypeData.buttonState.someTimestamp_1_0x0 = now; + this->clicked = 1; + BOOL_CurrentMenuClickState::instance = TRUE; + (*this->menuItemActionHandler.simple)(this->callbackParameter.parameter); + this->secondItemTypeData.buttonState.countTo100 = 0; + this->clicked = (short)BOOL_CurrentMenuClickState::instance; + DAT_StopHandlingMenuItems::instance = 0; + return 0; + } + if (this->menuItemRenderFunctionType != ((MenuItemRenderFunctionType)2)) { + return 0; + } + int direction; + if (DAT_MouseState::instance.scrollEventData == 7) { + direction = 2; + } else if (DAT_MouseState::instance.scrollEventData == 8) { + direction = 1; + } else { + return 0; + } + DWORD const now = timeGetTime(); + this->secondItemTypeData.buttonState.clickTimestamp_0x4 = now; + this->secondItemTypeData.buttonState.someTimestamp_1_0x0 = now; + this->clicked = 1; + BOOL_CurrentMenuClickState::instance = TRUE; + if (DAT_MouseState::instance.midClickState) { + for (int i = 100; i != 0; i--) { + (*this->menuItemActionHandler.simple)(direction); + } + } else { + for (int i = 10; i != 0; i--) { + (*this->menuItemActionHandler.simple)(direction); + } + } + this->secondItemTypeData.buttonState.countTo100 = 0; + this->clicked = (short)BOOL_CurrentMenuClickState::instance; + return DAT_StopHandlingMenuItems::instance; + } + if (this->menuPointer->one) { + int* const min = &this->secondItemTypeData.buttonState.someTimestamp_1_0x0; + int* const max = &this->secondItemTypeData.buttonState.clickTimestamp_0x4; + int* const value = &this->secondItemTypeData.buttonState.countTo100; + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 1, min, max, value); + int const lowest = *min; + this->secondItemTypeData.buttonState.currentButtonPictureInGm_0xc = -1000; + if (*max < lowest) { + *max = lowest; + } + if (*value < lowest) { + *value = lowest; + } + int const highest = *max; + if (*value > highest) { + *value = highest; + } + return 0; + } + if (this->secondItemTypeData.buttonState.countTo100 + < this->secondItemTypeData.buttonState.someTimestamp_1_0x0) { + this->secondItemTypeData.buttonState.countTo100 = this->secondItemTypeData.buttonState.someTimestamp_1_0x0; + } + if (this->secondItemTypeData.buttonState.countTo100 > this->secondItemTypeData.buttonState.clickTimestamp_0x4) { + this->secondItemTypeData.buttonState.countTo100 = this->secondItemTypeData.buttonState.clickTimestamp_0x4; + } + int* const min = &this->secondItemTypeData.buttonState.someTimestamp_1_0x0; + int* const max = &this->secondItemTypeData.buttonState.clickTimestamp_0x4; + int* const value = &this->secondItemTypeData.buttonState.countTo100; + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 4, min, max, value); + if (DAT_MouseState::instance.scrollEventData == 7) { + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 6, min, max, value); + } else if (DAT_MouseState::instance.scrollEventData == 8) { + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 5, min, max, value); + } + int const lowest = *min; + if (*max < lowest) { + *max = lowest; + } + if (*value < lowest) { + *value = lowest; + } + int const highest = *max; + if (*value > highest) { + *value = highest; + } + int offset = 0; + int insideThumb = 0; + if (!DAT_MouseState::instance.leftClickStart && !DAT_MouseState::instance.leftClickState) { + this->secondItemTypeData.buttonState.currentButtonPictureInGm_0xc = -1000; + return 0; + } + int size = this->itemWidth; + int mouse = DAT_MouseState::instance.screenSpaceX; + int left = this->menuPointer->xPosition + this->position.position.x; + int start = left; + if (type == OpenSHC::UI::Enums::MIT_SCROLLBARUnk) { + start = this->menuPointer->yPosition + this->position.position.y; + size = this->itemHeight; + mouse = DAT_MouseState::instance.screenSpaceY; + } + int const range = highest - lowest; + int thumb = size; + if (range > 0) { + thumb = size / (range + 1); + if (thumb <= this->firstItemTypeData.itemsToSkip) { + thumb = this->firstItemTypeData.itemsToSkip; + } + offset = ((*value - lowest) * (size - thumb)) / range; + } + if (MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::isMouseInsideBox, DAT_MouseState::ptr)( + left, this->menuPointer->yPosition + this->position.position.y, this->itemWidth, this->itemHeight)) { + this->hovering = 1; + } + BOOLEnum insideBox; + if (type == OpenSHC::UI::Enums::MIT_SLIDERUnk) { + insideBox = MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::isMouseInsideBox, DAT_MouseState::ptr)( + this->menuPointer->xPosition + this->position.position.x + offset, + this->menuPointer->yPosition + this->position.position.y, thumb, this->itemHeight); + } else { + insideBox = MACRO_CALL_MEMBER(OpenSHC::Input::MouseState_Func::isMouseInsideBox, DAT_MouseState::ptr)( + this->menuPointer->xPosition + this->position.position.x, + this->menuPointer->yPosition + this->position.position.y + offset, this->itemWidth, thumb); + } + if (insideBox) { + insideThumb = 1; + } + if (DAT_MouseState::instance.leftClickStart) { + if (!this->hovering) { + return 0; + } + if (insideThumb) { + this->secondItemTypeData.buttonState.currentButtonPictureInGm_0xc = mouse - start - offset; + if (*value < *min) { + *value = *min; + } + if (*value > *max) { + *value = *max; + } + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 3, min, max, value); + } else if (mouse < start + offset) { + insideThumb = ((*max - *min) * thumb) / (size - thumb); + if (!insideThumb) { + insideThumb = 1; + } + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 7, min, max, &insideThumb); + *value = *value - insideThumb; + if (*value < *min) { + *value = *min; + } + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 2, min, max, value); + } else { + insideThumb = ((*max - *min) * thumb) / (size - thumb); + if (!insideThumb) { + insideThumb = 1; + } + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 7, min, max, &insideThumb); + *value = *value + insideThumb; + if (*value > *max) { + *value = *max; + } + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 2, min, max, value); + } + int const lowest2 = *min; + if (*max < lowest2) { + *max = lowest2; + } + if (*value < lowest2) { + *value = lowest2; + } + if (*value > *max) { + *value = *max; + } + return 0; + } + if (!DAT_MouseState::instance.leftClickState) { + return 0; + } + if (this->secondItemTypeData.buttonState.currentButtonPictureInGm_0xc <= -1000) { + return 0; + } + int const lowest3 = *min; + int const steps = *max - lowest3; + if (steps <= 0) { + return 0; + } + *value = (((size - thumb) / steps / 2 - this->secondItemTypeData.buttonState.currentButtonPictureInGm_0xc + - start + mouse) + * steps) + / (size - thumb) + + lowest3; + if (*max < lowest3) { + *max = lowest3; + } + if (*value < lowest3) { + *value = lowest3; + } + if (*value > *max) { + *value = *max; + } + (*this->menuItemActionHandler.slider)(this->callbackParameter.parameter, 3, min, max, value); + int const lowest4 = *min; + if (*max < lowest4) { + *max = lowest4; + } + if (*value < lowest4) { + *value = lowest4; + } + if (*value > *max) { + *value = *max; + } + return 0; + } + +} +} diff --git a/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingWorkStatus.cpp b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingWorkStatus.cpp new file mode 100644 index 0000000000..a88ff43a6e --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/BuildingAndStatusMenu/MenuItemRenderFunction_BuildingAndStatusMenu_BuildingWorkStatus.cpp @@ -0,0 +1,194 @@ +#include "../BuildingAndStatusMenu.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" +#include "OpenSHC/Map/Units/States/UnitState.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/UI/Enums/BuildingsAndStatusMenuTabType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::DE::SHCDE::eTextSections; + using OpenSHC::Map::Buildings::BuildingTypeShort; + using OpenSHC::Map::Units::UnitType; + using OpenSHC::Map::Units::States::UnitState; + using OpenSHC::Text::TextAlignment; + using OpenSHC::UI::Enums::BuildingsAndStatusMenuTabType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004476B0 + void BuildingAndStatusMenu::MenuItemRenderFunction_BuildingAndStatusMenu_BuildingWorkStatus(int param_1, ...) + { + if (DAT_GameCore::instance.activeMenuTab.tabType == OpenSHC::UI::Enums::BASMTT_PEASANT) { + return; + } + short const employees + = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .currentEmployeeCount; + BOOLEnum noPeasantWalking = TRUE; + if (employees == 0 + && DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .currentlyNeededEmployeeCount + == 0) { + return; + } + if (DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .buildingTypeBasedEmployeeCount + <= 0) { + return; + } + if (DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].buildingType + >= 0x28 + && DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .buildingType + <= 0x2c) { + return; + } + if (DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].buildingType + >= 0x24 + && DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .buildingType + <= 0x26) { + return; + } + if (DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .hasAccessToKeep + == 0) { + // "No access to keep" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_GENERAL_BUILDINGS, 9, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + return; + } + if (DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID].sleeping) { + // "Turned off" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_GENERAL_BUILDINGS, 7, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + return; + } + short needed = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .currentlyNeededEmployeeCount; + if (needed != 0) { + int textID; + if (employees == 0) { + textID = 3; + } else { + textID = needed + 4; + } + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_GENERAL_BUILDINGS, textID, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + return; + } + int unit; + for (int i = 0; i < employees; i++) { + unit = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .workerID[i]; + if (DAT_UnitsState::instance.units[unit].unitType == OpenSHC::Map::Units::UT_PEASANT) { + noPeasantWalking = FALSE; + } + } + if (!noPeasantWalking) { + // "Peasant on his way" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_GENERAL_BUILDINGS, 4, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + return; + } + switch (DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .buildingType) { + case OpenSHC::Map::Buildings::BT_MILL: { + int status = 100; + for (int i = 0; i < employees; i++) { + switch (DAT_UnitsState::instance + .units[DAT_BuildingsState::instance + .buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .workerID[i]] + .state.generic) { + case OpenSHC::Map::Units::States::US_AIM_WEAPONUnk: + status = 0; + break; + case OpenSHC::Map::Units::States::US_STAND_UPUnk: + if (status > 1) { + status = 1; + } + break; + case OpenSHC::Map::Units::States::US_RELOAD_WEAPONUnk: + if (status > 2) { + status = 2; + } + break; + case ((UnitState)3): + if (status > 3) { + status = 3; + } + break; + case OpenSHC::Map::Units::States::US_DETERMINE_NEXT_STATEUnk: + case ((UnitState)2): + case OpenSHC::Map::Units::States::US_FIRE_WEAPONUnk: + case OpenSHC::Map::Units::States::US_LOOK_AROUNDUnk: + if (status > 4) { + status = 4; + } + break; + case OpenSHC::Map::Units::States::US_IDLEUnk: + if (status > 5) { + status = 5; + } + break; + } + } + if (status < 100) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_MILL, status + 3, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + } + return; + } + case OpenSHC::Map::Buildings::BT_QUARRY: + // "Currently Functioning" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_GENERAL_BUILDINGS, 2, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + return; + case OpenSHC::Map::Buildings::BT_FLETCHER: + case OpenSHC::Map::Buildings::BT_BLACKSMITH: + case OpenSHC::Map::Buildings::BT_POLETURNER: + // "Worker:" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_GENERAL_BUILDINGS, 10, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance - 10, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderPeasantMenu_CurrentActionUnk)( + unit, DAT_ButtonX::instance + 0x96, DAT_ButtonY::instance + 10); + return; + case OpenSHC::Map::Buildings::BT_IRONMINE: + unit = DAT_BuildingsState::instance.buildings[DAT_BuildingsState::instance.menuSelectedBuildingID] + .workerID[1]; + default: + // "Worker:" + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderText2, DAT_TextManagerObject::ptr)( + OpenSHC::DE::SHCDE::TEXT_IN_GENERAL_BUILDINGS, 10, DAT_ButtonX::instance + 0x96, + DAT_ButtonY::instance - 20, OpenSHC::Text::TTA_LEFT, 0, 0x12, FALSE); + MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderPeasantMenu_CurrentActionUnk)( + unit, DAT_ButtonX::instance + 0x96, DAT_ButtonY::instance); + return; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_CreateEventCallbackFunction.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_CreateEventCallbackFunction.cpp new file mode 100644 index 0000000000..7a97ee2433 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemActionHandler_General_CreateEventCallbackFunction.cpp @@ -0,0 +1,543 @@ +#include "../General.func.hpp" + +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Game/GameStateStructures.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Map/LandscapeState.func.hpp" +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/Map/Units/TribesState.func.hpp" +#include "OpenSHC/Map/Units/TroopValueState.func.hpp" +#include "OpenSHC/Map/Units/UnitsState.func.hpp" +#include "OpenSHC/Rendering/Bink/AIMessageQueue.func.hpp" +#include "OpenSHC/Rendering/ViewportRenderState.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/UI/MinimapViewState.func.hpp" +#include "OpenSHC/Audio/SFX/SoundEffectID.hpp" +#include "OpenSHC/Commands/MappersEnum.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Game/Player/Enums/BuildingEntryInfoEnum.hpp" +#include "OpenSHC/Map/Buildings/BuildingType.hpp" +#include "OpenSHC/Map/Buildings/BuildingTypeShort.hpp" +#include "OpenSHC/Map/Units/Instructions/UnitMatchSpeedEnum.hpp" +#include "OpenSHC/Map/Units/UnitLogicState.hpp" +#include "OpenSHC/Map/Units/UnitType.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/string-macros.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_LandscapeState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_MinimapViewState.hpp" +#include "OpenSHC/Globals/DAT_MissionAestheticsDefinedData.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TileMapState.hpp" +#include "OpenSHC/Globals/DAT_TribesState.hpp" +#include "OpenSHC/Globals/DAT_TroopValueState.hpp" +#include "OpenSHC/Globals/DAT_UnitsState.hpp" +#include "OpenSHC/Globals/DAT_VideoBikQueue.hpp" +#include "OpenSHC/Globals/DAT_ViewportRenderState.hpp" +#include "OpenSHC/Globals/SEC_RNG.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::Audio::SFX::SoundEffectID; + using OpenSHC::Commands::MappersEnum; + using OpenSHC::DE::SHCDE::eTextSections; + using OpenSHC::Map::Buildings::BuildingType; + using OpenSHC::Map::Buildings::BuildingTypeShort; + using OpenSHC::Map::Units::UnitLogicState; + using OpenSHC::Map::Units::UnitType; + using OpenSHC::Map::Units::Instructions::UnitMatchSpeedEnum; + using OpenSHC::UI::Enums::MenuModalType; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004C1770 + void General::MenuItemActionHandler_General_CreateEventCallbackFunction(int param_1, ...) + { + short tribeSize; + BOOLEnum hasSignpost; + int popularity; + int found; + int playerID; + int count; + int i; + int signpost; + int unitID; + int keepID; + dword lionTribe; + dword tribeID; + dword archerTribe; + dword monkTribe; + uint targetX; + int unitSelectionIndex = 0; + uint targetY; + // The original keeps the archer tribe in the param_1 slot and the monk tribe in a stack local. + dword monkTribeSlot; + switch (param_1) { + case 0x17: + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_TRIGGER_EVENT); + return; + default: + return; + case 0x2e: + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_CREATE_OR_TRIGGER_INVASION); + return; + case 0xd4: + // Invasion + MACRO_CALL_MEMBER( + OpenSHC::Map::MapPropertiesState_Func::spawnInvasionEventAttackWave, DAT_MapPropertiesState::ptr)(); + case 0x24: + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + case 9: + case 0xdd: + DAT_MapPropertiesState::instance.invasionEventContent.crusaderArabian = 0; + return; + case 10: + case 0xde: + DAT_MapPropertiesState::instance.invasionEventContent.crusaderArabian = 1; + return; + case 0xb: + DAT_MapPropertiesState::instance.invasionEventContent.crusaderArabian = 2; + return; + case 0xc: + DAT_MapPropertiesState::instance.invasionEventContent.crusaderArabian = 3; + return; + case 0x57: + DAT_MapPropertiesState::instance.invasionEventContent.crusaderArabian = 4; + return; + case 0x85: + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::spawnUnit, DAT_UnitsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, (int)(SEC_RNG::instance.currentNumber2 % 9), + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .xEntry + * 8, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .yEntry + * 8, + (int)(DAT_TileMapState::instance.HeightLayer[DAT_GameState::instance + .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .tileEntry]), + OpenSHC::Map::Units::UT_JUGGLER); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::spawnUnit, DAT_UnitsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, (SEC_RNG::instance.currentNumber2 >> 3) % 9, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .xEntry + * 8, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .yEntry + * 8, + (UnitType)((int)(DAT_TileMapState::instance.HeightLayer[DAT_GameState::instance + .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .tileEntry])), + OpenSHC::Map::Units::UT_JUGGLER); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::spawnUnit, DAT_UnitsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, (SEC_RNG::instance.currentNumber2 >> 6) % 9, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .xEntry + * 8, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .yEntry + * 8, + (UnitType)((int)(DAT_TileMapState::instance.HeightLayer[DAT_GameState::instance + .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .tileEntry])), + OpenSHC::Map::Units::UT_JUGGLER); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::spawnUnit, DAT_UnitsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, (SEC_RNG::instance.currentNumber2 >> 9) % 9, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .xEntry + * 8, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .yEntry + * 8, + (UnitType)((int)(DAT_TileMapState::instance.HeightLayer[DAT_GameState::instance + .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .tileEntry])), + OpenSHC::Map::Units::UT_FIREEATER); + MACRO_CALL_MEMBER(OpenSHC::Map::Units::UnitsState_Func::spawnUnit, DAT_UnitsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, (SEC_RNG::instance.currentNumber2 >> 0xc) % 9, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .xEntry + * 8, + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .yEntry + * 8, + (UnitType)((int)(DAT_TileMapState::instance.HeightLayer[DAT_GameState::instance + .playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_CAMPGROUND] + .tileEntry])), + OpenSHC::Map::Units::UT_FIREEATER); + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 1), + DAT_MissionAestheticsDefinedData::instance.RandomEvent1VideoName, S_RANDOM_EVENTS1_WAV_005AA8EC); + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + case 0x90: + if (!MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::hasAvailableSpawnSlotForWildlifeOrMercs, + DAT_TribesState::ptr)() + || (!MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::findBuildingOfTypeForPlayer, + DAT_BuildingsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, OpenSHC::Map::Buildings::BT_HOPFARM) + && !MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::findBuildingOfTypeForPlayer, + DAT_BuildingsState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID, + OpenSHC::Map::Buildings::BT_WHEATFARM))) { + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + } + DAT_GameState::instance.mapAndTime.eventCountdownRabbitInfestation = 1200; + MACRO_CALL_MEMBER( + OpenSHC::Map::Units::TribesState_Func::spawnRabbitAtFirstFreeSpawnPoint, DAT_TribesState::ptr)(); + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::setSpawnMoment, DAT_MinimapViewState::ptr)( + DAT_TribesState::instance.unknownX_01, DAT_TribesState::instance.unknownY_01); + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 7), + DAT_MissionAestheticsDefinedData::instance.RandomEvent7VideoName, S_RANDOM_EVENTS7_WAV_005AA8D8); + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + case 0x8f: + MACRO_CALL_MEMBER( + OpenSHC::Map::LandscapeState_Func::ageFourFifthsOfGrowingTrees, DAT_LandscapeState::ptr)(); + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 6), + DAT_MissionAestheticsDefinedData::instance.RandomEvent6VideoName, S_RANDOM_EVENTS6_WAV_005AA8C4); + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + case 0x95: + DAT_GameState::instance.mapAndTime.unitLadyRelated = 1; + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .eventMarriageCountdown = 0xc; + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity + > 10000) { + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity = 10000; + } + // "The people rejoice at your forthcoming marriage, Sire." + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 0xc), + DAT_MissionAestheticsDefinedData::instance.RandomEvent12VideoName, S_RANDOM_EVENTS12_WAV_005AA8B0); + MACRO_CALL_MEMBER(OpenSHC::Audio::SFX::SFXState_Func::setUpSFXToPlayUnk, DAT_SFXState::ptr)( + OpenSHC::Audio::SFX::SEID_CHAPEL_BELL); + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + case 0x96: + DAT_GameState::instance.mapAndTime.unitJesterRelated = 1; + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .eventJesterCountdown = 0x30; + if (DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity + > 10000) { + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity = 10000; + } + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 0xd), + DAT_MissionAestheticsDefinedData::instance.RandomEvent13VideoName, S_RANDOM_EVENTS13_WAV_005AA89C); + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + case 0x8b: + case 0x91: + case 0x92: + case 0x94: + case 0xb3: + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa0 = param_1; + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa8 = 1; + switch (param_1) { + case 0x92: + case 0x94: + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa4 = 0x32; + break; + case 0x8b: + case 0x91: + case 0xb3: + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa4 = 10; + break; + } + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::activateModalDialogAndClearText, + DAT_MenuTextInputState::ptr)(OpenSHC::UI::Enums::MMT_TRIGGER_EVENT_SLIDER); + return; + case 0x25: + switch (DAT_MapPropertiesState::instance.invasionEventContent.field_0xa0) { + case 0x8b: + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .eventPlagueCountdown = 0x18; + popularity + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity; + if (6000 < popularity) { + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .popularity = (popularity - 6000) / 2 + 6000; + } + MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::spawnPoisonCloudsAtRandomStorageOrArmyBuilding, + DAT_GameState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID, + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa8); + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 2), + DAT_MissionAestheticsDefinedData::instance.RandomEvent2VideoName, + S_RANDOM_EVENTS2_WAV_005AA888); + break; + case 0x91: { + dword spawnX; + uint spawnY; + found = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::findRecentOrSignpostSpawnLocation, + DAT_TribesState::ptr)(&spawnX, &spawnY); + if (found == 0 + || !MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::xyAreValid, + DAT_ViewportRenderState::ptr)(spawnX, spawnY)) + break; + playerID = DAT_GameSynchronyState::instance.currentPlayerSlotID; + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .eventLionsCountdown = 0xc; + popularity = DAT_GameState::instance.playerDataArray[playerID].popularity; + if (6000 < popularity) { + DAT_GameState::instance.playerDataArray[playerID].popularity = (popularity - 6000) / 2 + 6000; + } + i = 0; + if (0 < DAT_MapPropertiesState::instance.invasionEventContent.field_0xa8) { + do { + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::findRecentOrSignpostSpawnLocation, + DAT_TribesState::ptr)(&spawnX, &spawnY); + lionTribe = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::createAnimal, + DAT_TribesState::ptr)(OpenSHC::Commands::M_MAPPER_LION, (uint)(spawnX), spawnY, + (int)((uint) + * (byte*)(DAT_ViewportRenderState::instance.translationMatrix[spawnY].addXgetTile + + 0x1d32c38 + spawnX))); + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::setSpawnMoment, + DAT_MinimapViewState::ptr)(spawnX, spawnY); + count = DAT_MapPropertiesState::instance.invasionEventContent.field_0xa8; + i = i + 1; + DAT_TribesState::instance.tribes[lionTribe].unknownBool02 = 0; + DAT_TribesState::instance.tribes[lionTribe].unknownBool01 = 1; + } while (i < count); + } + } + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 8), + DAT_MissionAestheticsDefinedData::instance.RandomEvent8VideoName, + S_RANDOM_EVENTS8_WAV_005AA874); + break; + + case 0x92: + hasSignpost = MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::hasAnySignpost, DAT_GameState::ptr)(); + if (hasSignpost == FALSE) + break; + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .eventBanditsCountdown = 0x10; + DAT_TroopValueState::instance.attackInfo.inv_count + = DAT_TroopValueState::instance.attackInfo.inv_count + 1; + if (0x32 <= DAT_TroopValueState::instance.attackInfo.inv_count) { + DAT_TroopValueState::instance.attackInfo.inv_count = 1; + } + MACRO_CALL_MEMBER(OpenSHC::Map::Units::TroopValueState_Func::initializeAttackWaveSlot, + DAT_TroopValueState::ptr)(DAT_TroopValueState::instance.attackInfo.inv_count, 0); + DAT_TroopValueState::instance.attackInfo + .attackWavePlayerIDArray[DAT_TroopValueState::instance.attackInfo.inv_count] = 8; + signpost + = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::pickRandomAccessibleSignpostEntry, + DAT_GameState::ptr)(); + tribeID = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::createTribeWithSpawnedUnit, + DAT_TribesState::ptr)(0, OpenSHC::AI::Tribes::AITT_MACEMEN, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].x, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].y, 8, + OpenSHC::Map::Units::UT_E_MACE, + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa8 + 1); + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::setSpawnMoment, DAT_MinimapViewState::ptr)( + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].x, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].y); + if (0 < DAT_TribesState::instance.tribes[tribeID].size) { + do { + unitID = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getUnitIDForIndexInTribe, + DAT_TribesState::ptr)(tribeID, unitSelectionIndex); + tribeSize = DAT_TribesState::instance.tribes[tribeID].size; + unitSelectionIndex = unitSelectionIndex + 1; + DAT_UnitsState::instance.units[unitID].calculatedOwnerPlayerIndex = 5; + DAT_UnitsState::instance.units[unitID].logicalState = OpenSHC::Map::Units::ULS_NORMAL; + } while (unitSelectionIndex < tribeSize); + } + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 9), + DAT_MissionAestheticsDefinedData::instance.RandomEvent9VideoName, + S_RANDOM_EVENTS9_WAV_005AA860); + break; + case 0x94: + hasSignpost = MACRO_CALL_MEMBER( + OpenSHC::Game::GameStateStructures_Func::hasAnySignpost, DAT_GameState::ptr)(); + if (hasSignpost == FALSE) + break; + signpost + = MACRO_CALL_MEMBER(OpenSHC::Game::GameStateStructures_Func::pickRandomAccessibleSignpostEntry, + DAT_GameState::ptr)(); + archerTribe = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::spawnUnitsAroundLocation, + DAT_TribesState::ptr)(OpenSHC::AI::Tribes::AITT_ARCHERS, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].x, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].y, + (int)(DAT_GameSynchronyState::instance.currentPlayerSlotID), OpenSHC::Map::Units::UT_E_ARCHER, + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa8); + param_1 = archerTribe; + monkTribe = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::spawnUnitsAroundLocation, + DAT_TribesState::ptr)(OpenSHC::AI::Tribes::AITT_HOPS_FARMER_UNK, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].x, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].y, + (int)(DAT_GameSynchronyState::instance.currentPlayerSlotID), OpenSHC::Map::Units::UT_E_MONK, 1); + monkTribeSlot = monkTribe; + MACRO_CALL_MEMBER(OpenSHC::UI::MinimapViewState_Func::setSpawnMoment, DAT_MinimapViewState::ptr)( + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].x, + DAT_GameState::instance.mapAndTime.signpostEntryData[signpost].y); + DAT_TribesState::instance.tribes[archerTribe].pendingScatterMove = 0; + i = 0; + DAT_TribesState::instance.tribes[monkTribe].pendingScatterMove = 0; + if (0 < DAT_TribesState::instance.tribes[archerTribe].size) { + do { + unitID = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getUnitIDForIndexInTribe, + DAT_TribesState::ptr)(param_1, i); + tribeSize = DAT_TribesState::instance.tribes[archerTribe].size; + i = i + 1; + DAT_UnitsState::instance.units[unitID].calculatedOwnerPlayerIndex = 8; + DAT_UnitsState::instance.units[unitID].logicalState = OpenSHC::Map::Units::ULS_NORMAL; + } while (i < tribeSize); + } + i = 0; + if (0 < DAT_TribesState::instance.tribes[monkTribe].size) { + do { + unitID = MACRO_CALL_MEMBER(OpenSHC::Map::Units::TribesState_Func::getUnitIDForIndexInTribe, + DAT_TribesState::ptr)(monkTribeSlot, i); + tribeSize = DAT_TribesState::instance.tribes[monkTribe].size; + i = i + 1; + DAT_UnitsState::instance.units[unitID].calculatedOwnerPlayerIndex = 8; + DAT_UnitsState::instance.units[unitID].logicalState = OpenSHC::Map::Units::ULS_NORMAL; + } while (i < tribeSize); + } + keepID + = DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .buildingEntryInfos[OpenSHC::Game::Player::Enums::BEIE_KEEP] + .id; + if (0 < keepID) { + BuildingTypeShort keepType = DAT_BuildingsState::instance.buildings[keepID].buildingType; + targetX = 0; + targetY = 0; + if (keepType == OpenSHC::Map::Buildings::BT_MANORHOUSE) { + targetX = (int)(short)DAT_BuildingsState::instance.buildings[keepID].x + 3; + targetY = (int)(short)DAT_BuildingsState::instance.buildings[keepID].y + 8; + } else if (keepType == OpenSHC::Map::Buildings::BT_STONEKEEP) { + targetX = (int)(short)DAT_BuildingsState::instance.buildings[keepID].x + 3; + targetY = (int)(short)DAT_BuildingsState::instance.buildings[keepID].y + 3; + } else if (keepType == OpenSHC::Map::Buildings::BT_STRONGHOLD) { + targetX = (int)(short)DAT_BuildingsState::instance.buildings[keepID].x + 3; + targetY = (int)(short)DAT_BuildingsState::instance.buildings[keepID].y + 3; + } else if (keepType == OpenSHC::Map::Buildings::BT_KEEPFOUR) { + targetX = (int)(short)DAT_BuildingsState::instance.buildings[keepID].x + 4; + targetY = (int)(short)DAT_BuildingsState::instance.buildings[keepID].y + 4; + } else if (keepType == OpenSHC::Map::Buildings::BT_KEEPFIVE) { + targetX = (int)(short)DAT_BuildingsState::instance.buildings[keepID].x + 5; + targetY = (int)(short)DAT_BuildingsState::instance.buildings[keepID].y + 5; + } + MACRO_CALL_MEMBER( + OpenSHC::Map::Units::TribesState_Func::giveTribeMoveInstruction, DAT_TribesState::ptr)( + param_1, targetX, targetY, 0, 0, OpenSHC::Map::Units::Instructions::UMSE_0); + MACRO_CALL_MEMBER( + OpenSHC::Map::Units::TribesState_Func::giveTribeMoveInstruction, DAT_TribesState::ptr)( + monkTribeSlot, targetX, targetY, 0, 0, OpenSHC::Map::Units::Instructions::UMSE_0); + } + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 0xb), + DAT_MissionAestheticsDefinedData::instance.RandomEvent11VideoName, + S_RANDOM_EVENTS11_WAV_005AA84C); + break; + case 0xb3: + DAT_GameState::instance.playerDataArray[DAT_GameSynchronyState::instance.currentPlayerSlotID] + .eventFireCountdown = 8; + MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::spreadFireRandomlyToBuildings, + DAT_BuildingsState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID, + DAT_MapPropertiesState::instance.invasionEventContent.field_0xa8); + if (MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::findFirstBuildingOfType, + DAT_BuildingsState::ptr)( + DAT_GameSynchronyState::instance.currentPlayerSlotID, OpenSHC::Map::Buildings::BT_WELL)) { + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 0xf), + DAT_MissionAestheticsDefinedData::instance.RandomEvent15VideoName, + S_GENERAL_MESSAGE3_WAV_005AA2C0); + } else if (MACRO_CALL_MEMBER(OpenSHC::Map::Buildings::BuildingsState_Func::findFirstBuildingOfType, + DAT_BuildingsState::ptr)(DAT_GameSynchronyState::instance.currentPlayerSlotID, + OpenSHC::Map::Buildings::BT_WATERPOT)) { + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 0xf), + DAT_MissionAestheticsDefinedData::instance.RandomEvent15VideoName, + S_GENERAL_MESSAGE3_WAV_005AA2C0); + } else { + // "There is fire in the castle and we have not built any wells my Liege!" + MACRO_CALL_MEMBER( + OpenSHC::Rendering::Bink::AIMessageQueue_Func::playEventVideoBik, DAT_VideoBikQueue::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_ACTION, 0x11), + DAT_MissionAestheticsDefinedData::instance.RandomEvent15VideoName, + S_GENERAL_MESSAGE3_WAV_005AA2C0); + } + break; + default: + break; + } + MACRO_CALL_MEMBER( + OpenSHC::UI::MenuTextInputState_Func::clearAnyOtherModalDialogs, DAT_MenuTextInputState::ptr)(); + return; + } + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_EventButtonAndData.cpp b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_EventButtonAndData.cpp new file mode 100644 index 0000000000..0b8654a860 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/General/MenuItemRenderFunction_General_EventButtonAndData.cpp @@ -0,0 +1,60 @@ +#include "../General.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Rendering/AlphaAndButtonSurface.func.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/Rendering/Colors/BGR24.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/AlphaAndButtonSurfaceObj.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonW.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::DE::SHCDE::eTextSections; + using OpenSHC::Rendering::Colors::BGR24; + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004BFFA0 + void General::MenuItemRenderFunction_General_EventButtonAndData(int param_1, ...) + { + int month; + BGR24 color; + if (param_1 != -1) { + MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderScenarioButtonWithText)(param_1); + return; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::AlphaAndButtonSurface_Func::renderBasicButton, + AlphaAndButtonSurfaceObj::ptr)(0, OpenSHC::Rendering::Enums::RT_CONTEXT_BASED); + int xParam = (int)DAT_ButtonW::instance / 2 + DAT_ButtonX::instance; + int yParam = DAT_ButtonY::instance + 6; + if (DAT_ButtonCurrentlyInteracting::instance == FALSE) { + month = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .header.month; + color = 0xc2f0eb; + } else { + month = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .header.month; + color = 0xccfaff; + } + 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_MONTHS, month + 0xc), + xParam, yParam, OpenSHC::Text::TTA_CENTER, color, 0x12, FALSE, 0); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/Roundtable/MenuItemRenderFunction_Roundtable_Main.cpp b/src/OpenSHC/UI/MenuItems/Roundtable/MenuItemRenderFunction_Roundtable_Main.cpp new file mode 100644 index 0000000000..bda0683600 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Roundtable/MenuItemRenderFunction_Roundtable_Main.cpp @@ -0,0 +1,248 @@ +#include "../Roundtable.func.hpp" + +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/MenuItems/General.func.hpp" +#include "OpenSHC/UI/Rendering.func.hpp" +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/DE/SHCDE/eTextSections.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_00df423c.hpp" +#include "OpenSHC/Globals/DAT_00df4288.hpp" +#include "OpenSHC/Globals/DAT_BlendingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_ButtonBackgroundBlendStrength.hpp" +#include "OpenSHC/Globals/DAT_ButtonCurrentlyInteracting.hpp" +#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MouseState.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" +#include "OpenSHC/Globals/DAT_RenderingDefinedData.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::DE::SHCDE::eGM; + using OpenSHC::DE::SHCDE::eTextSections; + using OpenSHC::IO::Graphics::GmID; + using OpenSHC::Rendering::Enums::RenderTarget; + using OpenSHC::Text::TextAlignment; + using OpenSHC::WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004AEF70 + void Roundtable::MenuItemRenderFunction_Roundtable_Main(int param_1, ...) + { + int aiType = 0; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_SCREEN_MENU; + if (param_1 <= 8) { + int const playerID = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[param_1]; + if (playerID <= 0) { + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + int const group = DAT_GameSynchronyState::instance.DAT_PlayerGroupArray[playerID]; + DAT_ButtonUnknownZero::instance = 1; + if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] != -1 + || DAT_GameSynchronyState::instance.currentAIArray[playerID] != 0) { + if (DAT_GameSynchronyState::instance.isHost) { + DAT_ButtonUnknownZero::instance = 0; + } + if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] == -1) { + aiType = DAT_GameSynchronyState::instance.currentAIArray[playerID]; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, playerID + 0x222, + DAT_ButtonX::instance, DAT_ButtonY::instance); + if (aiType == 0) { + if (DAT_GameCore::instance.lordIcons[playerID] == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 0x21b, + DAT_ButtonX::instance, DAT_ButtonY::instance); + } else if (DAT_GameCore::instance.lordIcons[playerID] == 1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 0x21c, + DAT_ButtonX::instance, DAT_ButtonY::instance); + } else if (DAT_TextureRenderCoreObject::instance.bitmapFaceSizes[playerID + 0x13] > 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, 0x21d, + DAT_ButtonX::instance, DAT_ButtonY::instance); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawBitmapFace, + DAT_TextureRenderCoreObject::ptr)( + playerID + 0x13, DAT_ButtonX::instance + 4, DAT_ButtonY::instance + 4); + } + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, aiType + 0x20a, + DAT_ButtonX::instance, DAT_ButtonY::instance); + } + if (DAT_00df423c::instance == param_1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimBox, + DAT_PencilRenderCore::ptr)(DAT_ButtonX::instance, DAT_ButtonY::instance, + DAT_ButtonX::instance + 0x47, DAT_ButtonY::instance + 0x47); + } + if (DAT_ButtonCurrentlyInteracting::instance) { + if (DAT_00df423c::instance == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 0x202, + DAT_ButtonX::instance - 6, DAT_ButtonY::instance - 6, + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 0x201, 0); + } + if (DAT_ButtonCurrentlyInteracting::instance) { + DAT_00df4288::instance = 1; + } + } + if (group != 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, + group * 2 + 0x1ed, DAT_ButtonX::instance - 10, DAT_ButtonY::instance - 8); + } + if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] != -1) { + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, + DAT_TextManagerObject::ptr)(DAT_GameSynchronyState::instance.DAT_PlayerNames[playerID], + DAT_ButtonX::instance + 0x20, DAT_ButtonY::instance + 0x50, OpenSHC::Text::TTA_CENTER, + DAT_RenderingDefinedData::instance + .ColorTable1[DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[playerID]], + 0, 0x13, FALSE, 0); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + MACRO_CALL_MEMBER( + OpenSHC::Text::TextManager_Func::renderInGameTextWithShadow, DAT_TextManagerObject::ptr)( + MACRO_CALL_MEMBER(OpenSHC::Text::TextManager_Func::getTextStringInGroupAtOffset, + DAT_TextManagerObject::ptr)(OpenSHC::DE::SHCDE::TEXT_XPLAY_WAITING_ROOM, + DAT_GameSynchronyState::instance.currentAIArray[playerID] * 9 + 0xe7 + + DAT_GameSynchronyState::instance.aiVariationArray[playerID]), + DAT_ButtonX::instance + 0x20, DAT_ButtonY::instance + 0x50, OpenSHC::Text::TTA_CENTER, + DAT_RenderingDefinedData::instance + .ColorTable1[DAT_BlendingDefinedData::instance.PlayerSlotUnitColor[playerID]], + 0, 0x12, FALSE, 0); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + } else { + if (param_1 <= 0x12) { + int const playerID = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[param_1 - 10]; + if (playerID > 0 && DAT_00df423c::instance != 0 && DAT_ButtonCurrentlyInteracting::instance + && param_1 - 10 != DAT_00df423c::instance + && (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] != -1 + || MACRO_CALL_MEMBER(OpenSHC::Synchrony::GameSynchronyState_Func::isAIPlayer, + DAT_GameSynchronyState::ptr)(playerID))) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 0x202, + DAT_ButtonX::instance + 0x3e, DAT_ButtonY::instance - 1, + OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_2, 0x201, 0); + } + } + if (param_1 == 0x14) { + if (DAT_ButtonCurrentlyInteracting::instance) { + DAT_00df4288::instance = 1; + if (DAT_00df423c::instance == 0) { + DAT_ButtonCurrentlyInteracting::instance = FALSE; + } + } + MACRO_CALL(OpenSHC::UI::Rendering_Func::RenderCurrentButtonToScreenMenuWithBlendingUnk)( + (DAT_ButtonBackgroundBlendStrength::instance - 0x20) * 0x20 / 32 + 0x20); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + if (param_1 == 100 || param_1 == 0x65) { + DAT_ButtonUnknownZero::instance = DAT_00df423c::instance != 0; + if (DAT_GameSynchronyState::instance.isHost) { + MACRO_CALL(OpenSHC::UI::MenuItems::General_Func:: + MenuItemRenderFunction_General_RenderCurrentButtonWithPossibleAlphaTexOnScreenMenuSurface)(); + if (DAT_ButtonCurrentlyInteracting::instance) { + DAT_00df4288::instance = 1; + } + } else { + DAT_ButtonUnknownZero::instance = 1; + } + } + if (param_1 == 200) { + aiType = 0; + if (DAT_00df423c::instance != 0 && DAT_GameSynchronyState::instance.isHost) { + if (DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[DAT_00df423c::instance] == 0) { + DAT_00df423c::instance = 0; + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + int const playerID + = DAT_GameSynchronyState::instance.DAT_RoundTableOrderArray[DAT_00df423c::instance]; + if (playerID >= 1) { + int x = DAT_MouseState::instance.screenSpaceX + - DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth; + int y = DAT_MouseState::instance.screenSpaceY + - DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight; + if (y < 4) { + y = 4; + } else if (y > 0x16c) { + y = 0x16c; + } + if (x < 4) { + x = 4; + } else if (x > 0x2d4) { + x = 0x2d4; + } + if (DAT_GameSynchronyState::instance.currentPlayerFullIDArray[playerID] == -1) { + aiType = DAT_GameSynchronyState::instance.currentAIArray[playerID]; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, + playerID + 0x222, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y); + if (aiType == 0) { + if (DAT_GameCore::instance.lordIcons[playerID] == 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, + 0x21b, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y); + } else if (DAT_GameCore::instance.lordIcons[playerID] == 1) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, + 0x21c, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y); + } else if (DAT_TextureRenderCoreObject::instance.bitmapFaceSizes[playerID + 0x13] > 0) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, + 0x21d, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::drawBitmapFace, + DAT_TextureRenderCoreObject::ptr)(playerID + 0x13, + DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x + 4, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y + 4); + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue + = OpenSHC::Rendering::Enums::RT_MAP_GAME; + return; + } + } else { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS2, + aiType + 0x20a, DAT_WindowAndDirectDraw::instance.mainMenuBorderWidth + x, + DAT_WindowAndDirectDraw::instance.mainMenuBorderHeight + y); + } + } + } + } + } + DAT_TextureRenderCoreObject::instance.drawBufferChoiceValue = OpenSHC::Rendering::Enums::RT_MAP_GAME; + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/SoundOptions/MenuItemActionHandler_SoundOptions_Buttons.cpp b/src/OpenSHC/UI/MenuItems/SoundOptions/MenuItemActionHandler_SoundOptions_Buttons.cpp new file mode 100644 index 0000000000..99e5b98d2b --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/SoundOptions/MenuItemActionHandler_SoundOptions_Buttons.cpp @@ -0,0 +1,74 @@ +#include "../SoundOptions.func.hpp" + +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/UI/MenuItems/SoundOptions.func.hpp" +#include "OpenSHC/UI/MenuTextInputState.func.hpp" +#include "OpenSHC/UI/Enums/SoundMenuClickType.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MenuTextInputState.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using OpenSHC::UI::Enums::SoundMenuClickType; + + // FUNCTION: STRONGHOLDCRUSADER 0x004940B0 + void SoundOptions::MenuItemActionHandler_SoundOptions_Buttons(SoundMenuClickType param_1, ...) + { + switch (param_1) { + case OpenSHC::UI::Enums::SMCT_TOGGLE_SOUND_ACTIVEUnk: + if (DAT_MenuTextInputState::instance.DAT_SoundActiveMenuVar != 0) { + DAT_MenuTextInputState::instance.DAT_SoundActiveMenuVar = 0; + MACRO_CALL_MEMBER(OpenSHC::Audio::MSS::SoundSystem_Func::deactivateSoundFromMenuFuncUnk, + DAT_SoundSystemState::ptr)(); + return; + } + DAT_MenuTextInputState::instance.DAT_SoundActiveMenuVar = 1; + MACRO_CALL_MEMBER( + OpenSHC::Audio::MSS::SoundSystem_Func::activateSoundFromMenuFuncUnk, DAT_SoundSystemState::ptr)(); + return; + case OpenSHC::UI::Enums::SMCT_TOGGLE_GENIE: { + int genieVoiceActive = FALSE; + if (DAT_MenuTextInputState::instance.DAT_GenieVoiceActiveMenuVar == 0) { + genieVoiceActive = TRUE; + } + DAT_MenuTextInputState::instance.DAT_GenieVoiceActiveMenuVar = genieVoiceActive; + DAT_GameCore::instance.genieVoiceActive = (OpenSHC::WindowsHelper::Enums::BOOLEnum)genieVoiceActive; + return; + } + case OpenSHC::UI::Enums::SMCT_SOUND_MENU_RETURNUnk: + MACRO_CALL_MEMBER(OpenSHC::UI::MenuTextInputState_Func::popModalDialog, DAT_MenuTextInputState::ptr)(); + return; + case OpenSHC::UI::Enums::SMCT_RESET_MUSIC_VOLUME: { + int local_8; + int local_4; + param_1 = (SoundMenuClickType)90; + MACRO_CALL(OpenSHC::UI::MenuItems::SoundOptions_Func::MenuItemActionHandler_SoundOptions_VolumeSlider)( + 0, 3, &local_4, &local_8, (int*)¶m_1); + return; + } + case OpenSHC::UI::Enums::SMCT_RESET_SFX_VOLUME: { + int local_8; + int local_4; + param_1 = (SoundMenuClickType)80; + MACRO_CALL(OpenSHC::UI::MenuItems::SoundOptions_Func::MenuItemActionHandler_SoundOptions_VolumeSlider)( + 1, 3, &local_4, &local_8, (int*)¶m_1); + return; + } + case OpenSHC::UI::Enums::SMCT_RESET_SPEECH_VOLUME: { + int local_8; + int local_4; + param_1 = (SoundMenuClickType)85; + MACRO_CALL(OpenSHC::UI::MenuItems::SoundOptions_Func::MenuItemActionHandler_SoundOptions_VolumeSlider)( + 2, 3, &local_4, &local_8, (int*)¶m_1); + return; + } + } + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/TextEditor/MenuItemRenderFunction_TextEditor_Scrollbar.cpp b/src/OpenSHC/UI/MenuItems/TextEditor/MenuItemRenderFunction_TextEditor_Scrollbar.cpp new file mode 100644 index 0000000000..f0dfbd6747 --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/TextEditor/MenuItemRenderFunction_TextEditor_Scrollbar.cpp @@ -0,0 +1,44 @@ +#include "../TextEditor.func.hpp" + +#include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/COL_VERY_SOFT_YELLOW.hpp" +#include "OpenSHC/Globals/DAT_ButtonH.hpp" +#include "OpenSHC/Globals/DAT_ButtonX.hpp" +#include "OpenSHC/Globals/DAT_ButtonY.hpp" +#include "OpenSHC/Globals/DAT_PencilRenderCore.hpp" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + // FUNCTION: STRONGHOLDCRUSADER 0x0045EF90 + void TextEditor::MenuItemRenderFunction_TextEditor_Scrollbar( + int param_1, int thumbYPos, int param_3, int thumbHeight, BOOLEnum isDragged) + { + int const height = DAT_ButtonH::instance; + int const y = DAT_ButtonY::instance; + int const x = DAT_ButtonX::instance; + int const top = y - 22; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawScrollbar, DAT_PencilRenderCore::ptr)( + x, y, height, thumbYPos, isDragged, thumbHeight, 0); + int const right = x + 20; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x, y - 1, right - 1, y - 1, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x, top, right - 1, top, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + int bottom = y + height; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x, bottom, right - 1, bottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + bottom = bottom + 21; + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x, bottom, right - 1, bottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + x - 1, top, x - 1, bottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawLine, DAT_PencilRenderCore::ptr)( + right, top, right, bottom, (ushort)(COL_VERY_SOFT_YELLOW::instance.shortValue)); + } + + } +} +} diff --git a/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_SetTextUnk.cpp b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_SetTextUnk.cpp new file mode 100644 index 0000000000..ce70ec343e --- /dev/null +++ b/src/OpenSHC/UI/MenuItems/Unused/MenuItemActionHandler_UnusedCreateMessageEvent_SetTextUnk.cpp @@ -0,0 +1,89 @@ +#include "../Unused.func.hpp" + +#include "OpenSHC/Map/MapPropertiesState.func.hpp" +#include "OpenSHC/Text/UserTextHandler.func.hpp" +#include "OpenSHC/UI/MenuModalComposition.func.hpp" +#include "OpenSHC/UI/Enums/MenuModalType.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_MenuModalComposition1.hpp" +#include "OpenSHC/Globals/DAT_MenuView_TriggerPrepare.hpp" +#include "OpenSHC/Globals/DAT_UserTextHandlerState.hpp" + +#include "stdlib.h" + +namespace OpenSHC { +namespace UI { + namespace MenuItems { + + using UI::Enums::MenuModalType; + using WindowsHelper::Enums::BOOLEnum; + + // FUNCTION: STRONGHOLDCRUSADER 0x004BFE20 + void Unused::MenuItemActionHandler_UnusedCreateMessageEvent_SetTextUnk(int param_1, ...) + { + switch (param_1) { + case 0x25: + if (!DAT_MapPropertiesState::instance.flag) { + if (DAT_MapPropertiesState::instance.value == 0xffffffff) { + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::removeEventAtIndex, + DAT_MapPropertiesState::ptr)(DAT_MapPropertiesState::instance.currentEventID); + } else { + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .header.year = atol(MACRO_CALL_MEMBER( + Text::UserTextHandler_Func::getTextArrayPointer, DAT_UserTextHandlerState::ptr)(0xb)); + } + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::sortEventsByDate, DAT_MapPropertiesState::ptr)(); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); + return; + } + if (DAT_MapPropertiesState::instance.flag == 1) { + if (DAT_MapPropertiesState::instance.value == 0xffffffff) { + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .data.scenario.actionData = -1; + } + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, + DAT_MenuModalComposition1::ptr)(UI::Enums::MMT_NEW_EVENT_ACTION, FALSE); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); + return; + } + DAT_GameCore::instance.descriptionStringTableIndex = DAT_MapPropertiesState::instance.value; + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + UI::Enums::MMT_NONE, FALSE); + DAT_MenuView_TriggerPrepare::instance = TRUE; + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); + return; + case 0x13: + if (DAT_MapPropertiesState::instance.flag) { + return; + } + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::removeEventAtIndex, DAT_MapPropertiesState::ptr)( + DAT_MapPropertiesState::instance.currentEventID); + MACRO_CALL_MEMBER(UI::MenuModalComposition_Func::activateModalDialog, DAT_MenuModalComposition1::ptr)( + UI::Enums::MMT_NONE, FALSE); + MACRO_CALL_MEMBER(Map::MapPropertiesState_Func::sortEventsByDate, DAT_MapPropertiesState::ptr)(); + MACRO_CALL_MEMBER(Text::UserTextHandler_Func::resetToTextIndex, DAT_UserTextHandlerState::ptr)(0xf); + return; + case -1: + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .header.month + = DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .header.month + + 1; + if (DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .header.month + >= 12) { + DAT_MapPropertiesState::instance.scenarioEvents[DAT_MapPropertiesState::instance.currentEventID] + .header.month = 0; + } + return; + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 47b2ecfdf6..d787fd415b 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -16275,7 +16275,7 @@ SHC_3BB0A8C1_0x004476AC | 0.0% | Pending SHC_3BB0A8C1_0x004476AD | 0.0% | Pending -SHC_3BB0A8C1_0x004476B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004476B0 | 89.0% | the original emits two renderText2 calls for the needed branch (3 / needed+4); splitting the call in source swaps the employees/needed registers (84.6); epilogue placed mid-function in the original SHC_3BB0A8C1_0x004479F8 | 0.0% | Pending @@ -18707,7 +18707,7 @@ SHC_3BB0A8C1_0x0045EF80 | 0.0% | Pending SHC_3BB0A8C1_0x0045EF84 | 0.0% | Pending -SHC_3BB0A8C1_0x0045EF90 | 0.0% | Pending +SHC_3BB0A8C1_0x0045EF90 | 82.4% | y and right - 1 swap ebp and edi SHC_3BB0A8C1_0x0045F080 | 100.0% | Reimplemented @@ -23935,7 +23935,7 @@ SHC_3BB0A8C1_0x004940A9 | 0.0% | Pending SHC_3BB0A8C1_0x004940AA | 0.0% | Pending -SHC_3BB0A8C1_0x004940B0 | 0.0% | Pending +SHC_3BB0A8C1_0x004940B0 | 86.6% | Zero kept in a register SHC_3BB0A8C1_0x004941A0 | 0.0% | Pending @@ -25897,7 +25897,7 @@ SHC_3BB0A8C1_0x004AEF5C | 0.0% | Pending SHC_3BB0A8C1_0x004AEF60 | 0.0% | Pending -SHC_3BB0A8C1_0x004AEF70 | 0.0% | Pending +SHC_3BB0A8C1_0x004AEF70 | 97.2% | AI name index loads scheduled differently SHC_3BB0A8C1_0x004AF4C0 | 100.0% | Reimplemented @@ -32105,9 +32105,9 @@ SHC_3BB0A8C1_0x004BFE12 | 0.0% | Pending SHC_3BB0A8C1_0x004BFE13 | 0.0% | Pending -SHC_3BB0A8C1_0x004BFE20 | 0.0% | Pending +SHC_3BB0A8C1_0x004BFE20 | 84.0% | we tail-merge the 0x13 arm into the identical 0x25 tail, the original keeps its own call sequence; break/if forms and case order score lower -SHC_3BB0A8C1_0x004BFFA0 | 0.0% | Pending +SHC_3BB0A8C1_0x004BFFA0 | 87.6% | the original pushes 0, 0, 0x12 before the branch and the colour as an immediate in each arm; ours keeps the colour in edx. Duplicating the call per arm, a ternary colour or month locals all score lower SHC_3BB0A8C1_0x004C0040 | 100.0% | Reimplemented, only the atol call target differs @@ -33245,7 +33245,7 @@ SHC_3BB0A8C1_0x004C1760 | 0.0% | Pending SHC_3BB0A8C1_0x004C1764 | 0.0% | Pending -SHC_3BB0A8C1_0x004C1770 | 0.0% | Pending +SHC_3BB0A8C1_0x004C1770 | 95.9% | jmp displacement to the tail-called clearAnyOtherModalDialogs differs; HeightLayer read is symbolised on our side only; loop-top alignment pad SHC_3BB0A8C1_0x004C1A7B | 0.0% | Pending @@ -38629,7 +38629,7 @@ SHC_3BB0A8C1_0x004F4180 | 0.0% | Pending SHC_3BB0A8C1_0x004F4270 | 0.0% | Pending -SHC_3BB0A8C1_0x004F4290 | 0.0% | Pending +SHC_3BB0A8C1_0x004F4290 | 70.7% | slider half: the original keeps size in ebp and the min pointer in a stack slot, and lays out the drag path after the click path epilogue; moving the offset init or sharing the final clamp scores lower SHC_3BB0A8C1_0x004F49D0 | 100.0% | Reimplemented