diff --git a/src/OpenSHC/UI/DisplayElements/RenderNoRushDisplayElementUnk.cpp b/src/OpenSHC/UI/DisplayElements/RenderNoRushDisplayElementUnk.cpp index 8781daff55..f47f64828e 100644 --- a/src/OpenSHC/UI/DisplayElements/RenderNoRushDisplayElementUnk.cpp +++ b/src/OpenSHC/UI/DisplayElements/RenderNoRushDisplayElementUnk.cpp @@ -2,8 +2,6 @@ #include "OpenSHC/Audio/SFX/SFXState.func.hpp" #include "OpenSHC/Text/TextManager.func.hpp" -#include "OpenSHC/UI/Helpers.func.hpp" -#include "OpenSHC/UI/Rendering.func.hpp" #include "OpenSHC/UI/Rendering/PencilRenderCore.func.hpp" #include "OpenSHC/DE/SHCDE/eTextSections.hpp" #include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" @@ -26,13 +24,6 @@ namespace OpenSHC { namespace UI { namespace DisplayElements { - using OpenSHC::DE::SHCDE::eTextSections; - using OpenSHC::Rendering::ScreenResolutionEnum; - using OpenSHC::Rendering::Enums::RenderTarget; - using OpenSHC::Text::TextAlignment; - using OpenSHC::UI::Enums::DisplayElementID; - using OpenSHC::WindowsHelper::Enums::BOOLEnum; - // FUNCTION: STRONGHOLDCRUSADER 0x004B20B0 void RenderNoRushDisplayElementUnk(int posX, int posY, DWORD elementState) { @@ -52,36 +43,50 @@ namespace UI { + 50; int x = posX + 800; DAT_PencilRenderCore::instance.surfaceTarget = OpenSHC::Rendering::Enums::RT_MAP_GAME; + // Separate ifs, not an else-if chain (an else-if chain: quick_diff 0.9797 -> 0.9054) if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x768) { x += 112; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x1024) { x -= 240; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x1200) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x1200) { x -= 400; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x720) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1280x720) { x -= 240; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1440x900) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1440x900) { x -= 320; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1080) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1080) { x -= 560; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1200) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1920x1200) { x -= 560; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1440) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1440) { x -= 880; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1600) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_2560x1600) { x -= 880; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1366x768) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1366x768) { x -= 283; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1680x1050) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1680x1050) { x -= 440; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x900) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1600x900) { x -= 400; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x600) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1024x600) { x -= 112; - } else if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1360x768) { + } + if (DAT_WindowAndDirectDraw::instance.currentGameResolution == OpenSHC::Rendering::SRE_1360x768) { x -= 280; } - x += -18 - (barWidth / 2); + x -= 18 + barWidth / 2; int const left = x - (barWidth / 2); MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawBlendedBlackBox, DAT_PencilRenderCore::ptr)(left - 7, posY - 5, (barWidth / 2) + 5 + x, posY + 30, 16); diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp new file mode 100644 index 0000000000..12ba34baca --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderBanner.cpp @@ -0,0 +1,74 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" + +#include "OpenSHC/Globals/DAT_GMImageHeaders.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/GMFirstPictureIndex.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // The banner is 8 rows of 8 by 8 pixel tiles. Each y has a left, a middle and a right picture in + // GID_INTERFACE_ICONS_3, followed by their three alpha masks; these are the rows' first pictures. + enum { + BANNER_TILE_SIZE = 8, + BANNER_HEIGHT = 64, + BANNER_TOP_PICTURES = 48, + BANNER_MIDDLE_PICTURES = 54, + BANNER_BOTTOM_PICTURES = 60, + BANNER_CAP_PICTURE = 91, + BANNER_CAP_MASK = 92 + }; + + // FUNCTION: STRONGHOLDCRUSADER 0x00468FE0 + void PencilRenderCore::drawHeaderBanner(int xPos, int yPos, int width, int unusedUnk) + { + // The banner is one tile inside the box at the top and on both sides; width becomes the banner's own. + yPos += BANNER_TILE_SIZE; + int const left = xPos + BANNER_TILE_SIZE; + width -= 2 * BANNER_TILE_SIZE; + for (int y = 0; y < BANNER_HEIGHT; y += BANNER_TILE_SIZE) { + int rowPictures; + if (y == 0) { + rowPictures = BANNER_TOP_PICTURES; + } else if (y == BANNER_HEIGHT - BANNER_TILE_SIZE) { + rowPictures = BANNER_BOTTOM_PICTURES; + } else { + rowPictures = BANNER_MIDDLE_PICTURES; + } + for (int x = 0; x < width; x += BANNER_TILE_SIZE) { + // Nested, not a flat else-if chain (a flat chain: quick_diff 1.0000 -> 0.9827) + int picture = rowPictures; + if (x != 0) { + if (x == width - BANNER_TILE_SIZE) { + picture = rowPictures + 2; + } else { + picture = rowPictures + 1; + } + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, picture, + x + left, y + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, picture + 3, 0); + } + } + // An end cap 3 pixels in from each end of the banner + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_PICTURE, + left + 3, yPos + 9, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_MASK, 0); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_PICTURE, + left + - DAT_GMImageHeaders::instance + .imh[GMFirstPictureIndex::instance[OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3] + + BANNER_CAP_PICTURE - 1] + .width + + width - 3, + yPos + 9, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_MASK, 0); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp new file mode 100644 index 0000000000..e53326dd71 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawHeaderTextBanner.cpp @@ -0,0 +1,86 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/Text/TextManager.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Rendering/Colors/ColorsEnum.hpp" +#include "OpenSHC/Text/TextAlignment.hpp" + +#include "OpenSHC/Globals/DAT_GMImageHeaders.hpp" +#include "OpenSHC/Globals/DAT_TextManagerObject.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/GMFirstPictureIndex.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // The banner is 8 rows of 8 by 8 pixel tiles. Each y has a left, a middle and a right picture in + // GID_INTERFACE_ICONS_3, followed by their three alpha masks; these are the rows' first pictures. + enum { + BANNER_TILE_SIZE = 8, + BANNER_HEIGHT = 64, + BANNER_TOP_PICTURES = 48, + BANNER_MIDDLE_PICTURES = 54, + BANNER_BOTTOM_PICTURES = 60, + BANNER_CAP_PICTURE = 91, + BANNER_CAP_MASK = 92, + BANNER_TEXT_FONT_SIZE = 15 + }; + + // FUNCTION: STRONGHOLDCRUSADER 0x00475CC0 + void PencilRenderCore::drawHeaderTextBanner( + int textGroupIndex, int textNumInGroup, int xPos, int yPos, int width, int height) + { + // drawHeaderBanner's banner, with a text centred on it + // The banner is one tile inside the box at the top and on both sides; width becomes the banner's own. + yPos += BANNER_TILE_SIZE; + int const left = xPos + BANNER_TILE_SIZE; + width -= 2 * BANNER_TILE_SIZE; + for (int y = 0; y < BANNER_HEIGHT; y += BANNER_TILE_SIZE) { + int rowPictures; + if (y == 0) { + rowPictures = BANNER_TOP_PICTURES; + } else if (y == BANNER_HEIGHT - BANNER_TILE_SIZE) { + rowPictures = BANNER_BOTTOM_PICTURES; + } else { + rowPictures = BANNER_MIDDLE_PICTURES; + } + for (int x = 0; x < width; x += BANNER_TILE_SIZE) { + // Nested, not a flat else-if chain (a flat chain: quick_diff 0.9909 -> 0.9774) + int picture = rowPictures; + if (x != 0) { + if (x == width - BANNER_TILE_SIZE) { + picture = rowPictures + 2; + } else { + picture = rowPictures + 1; + } + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, picture, + x + left, y + yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, picture + 3, 0); + } + } + // An end cap 3 pixels in from each end of the banner + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_PICTURE, + left + 3, yPos + 9, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_MASK, 0); + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_PICTURE, + left + - DAT_GMImageHeaders::instance + .imh[GMFirstPictureIndex::instance[OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3] + + BANNER_CAP_PICTURE - 1] + .width + + width - 3, + yPos + 9, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, BANNER_CAP_MASK, 0); + 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::eTextSections)textGroupIndex, textNumInGroup), + width / 2 + left, yPos + 14, OpenSHC::Text::TTA_CENTER, OpenSHC::Rendering::Colors::COL_C2F0EB, + BANNER_TEXT_FONT_SIZE, FALSE, 0); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp new file mode 100644 index 0000000000..397b2c60f7 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawScrollbar.cpp @@ -0,0 +1,100 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/DE/SHCDE/eGM.hpp" +#include "OpenSHC/IO/Graphics/GmID.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // Pictures in GID_INTERFACE_ICONS_3. The track's two and the small thumb are each followed by its alpha mask; + // the thumb's top, middle row and bottom are followed by their three masks. + enum { + SCROLLBAR_TRACK_PICTURE = 79, + SCROLLBAR_TRACK_ROW_PICTURE = 95, + SCROLLBAR_SMALL_THUMB_PICTURE = 89, + SCROLLBAR_THUMB_TOP_PICTURE = 100, + SCROLLBAR_THUMB_ROW_PICTURE = 101, + SCROLLBAR_THUMB_BOTTOM_PICTURE = 102, + SCROLLBAR_TRACK_PICTURE_HEIGHT = 20, + SCROLLBAR_SMALL_THUMB_HEIGHT = 20, + SCROLLBAR_THUMB_END_HEIGHT = 10 + }; + + // FUNCTION: STRONGHOLDCRUSADER 0x004690E0 + void PencilRenderCore::drawScrollbar( + uint xPos, int yPos, int height, int thumbYPos, BOOLEnum isDragged, int thumbHeight, int blendStrength) + { + int const top = yPos; + int const bottom = yPos + height; + // The track in whole pictures, then single rows down to the bottom + for (; yPos <= bottom - SCROLLBAR_TRACK_PICTURE_HEIGHT; yPos += SCROLLBAR_TRACK_PICTURE_HEIGHT) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_TRACK_PICTURE, xPos, yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_TRACK_PICTURE + 1, blendStrength); + } + for (; yPos < bottom; ++yPos) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_TRACK_ROW_PICTURE, xPos, yPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_TRACK_ROW_PICTURE + 1, blendStrength); + } + // A dragged thumb is drawn without its masks + if (isDragged) { + if (thumbHeight <= SCROLLBAR_SMALL_THUMB_HEIGHT) { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, SCROLLBAR_SMALL_THUMB_PICTURE, xPos, top + thumbYPos); + return; + } + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, SCROLLBAR_THUMB_TOP_PICTURE, xPos, top + thumbYPos); + // The top and bottom pieces are 10 pixels high, single middle rows fill the rest + thumbYPos += SCROLLBAR_THUMB_END_HEIGHT; + thumbHeight -= SCROLLBAR_THUMB_END_HEIGHT; + for (int row = SCROLLBAR_THUMB_END_HEIGHT; row < thumbHeight; ++row) { + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, SCROLLBAR_THUMB_ROW_PICTURE, xPos, top + thumbYPos); + ++thumbYPos; + } + MACRO_CALL_MEMBER( + OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGM, DAT_TextureRenderCoreObject::ptr)( + OpenSHC::DE::SHCDE::GM_INTERFACE_ICONS3, SCROLLBAR_THUMB_BOTTOM_PICTURE, xPos, top + thumbYPos); + return; + } + if (thumbHeight <= SCROLLBAR_SMALL_THUMB_HEIGHT) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_SMALL_THUMB_PICTURE, xPos, top + thumbYPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_SMALL_THUMB_PICTURE + 1, blendStrength); + return; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_THUMB_TOP_PICTURE, xPos, top + thumbYPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_THUMB_TOP_PICTURE + 3, blendStrength); + // The top and bottom pieces are 10 pixels high, single middle rows fill the rest + thumbYPos += SCROLLBAR_THUMB_END_HEIGHT; + thumbHeight -= SCROLLBAR_THUMB_END_HEIGHT; + for (int row = SCROLLBAR_THUMB_END_HEIGHT; row < thumbHeight; ++row) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_THUMB_ROW_PICTURE, xPos, top + thumbYPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_THUMB_ROW_PICTURE + 3, blendStrength); + ++thumbYPos; + } + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::TextureRenderCore_Func::renderGMWithAlphaMask, + DAT_TextureRenderCoreObject::ptr)(OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_THUMB_BOTTOM_PICTURE, xPos, top + thumbYPos, OpenSHC::IO::Graphics::GID_INTERFACE_ICONS_3, + SCROLLBAR_THUMB_BOTTOM_PICTURE + 3, blendStrength); + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencil.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencil.cpp new file mode 100644 index 0000000000..6e1c878cb9 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/setupPencil.cpp @@ -0,0 +1,134 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/Rendering/Enums/RenderTarget.hpp" + +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // The map surface is 4056 pixels wide. + enum { MAP_SURFACE_WIDTH = 4056 }; + + // FUNCTION: STRONGHOLDCRUSADER 0x00468C80 + BOOLEnum PencilRenderCore::setupPencil(int left, int top, int right, int bottom, ushort color) + { + this->drawColor = color; + // Clips the corners to the surface; right and bottom are inclusive. + if (this->surfaceTarget != OpenSHC::Rendering::Enums::RT_SCREEN_MENU) { + if (left < 0) { + if (right < 0) { + return FALSE; + } + left = 0; + } else if (left >= MAP_SURFACE_WIDTH) { + if (right >= MAP_SURFACE_WIDTH) { + return FALSE; + } + left = MAP_SURFACE_WIDTH - 1; + } + if (right < 0) { + right = 0; + } else if (right >= MAP_SURFACE_WIDTH) { + right = MAP_SURFACE_WIDTH - 1; + } + if (top < DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.start) { + if (bottom < DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.start) { + return FALSE; + } + top = DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.start; + } + if (top >= DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.end) { + if (bottom >= DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.end) { + return FALSE; + } + top = DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.end - 1; + } + if (bottom < DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.start) { + bottom = DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.start; + } + if (bottom >= DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.end) { + bottom = DAT_TextureRenderCoreObject::instance.mapGameSurfaceHeightRange.end - 1; + } + } else { + if (left < 0) { + if (right < 0) { + return FALSE; + } + left = 0; + } + if (left >= DAT_WindowAndDirectDraw::instance.resolutionX) { + if (right >= DAT_WindowAndDirectDraw::instance.resolutionX) { + return FALSE; + } + left = DAT_WindowAndDirectDraw::instance.resolutionX - 1; + } + if (right < 0) { + right = 0; + } + if (right >= DAT_WindowAndDirectDraw::instance.resolutionX) { + right = DAT_WindowAndDirectDraw::instance.resolutionX - 1; + } + if (top < DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.start) { + if (bottom < DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.start) { + return FALSE; + } + top = DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.start; + } + if (top >= DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.end) { + if (bottom >= DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.end) { + return FALSE; + } + top = DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.end - 1; + } + if (bottom < DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.start) { + bottom = DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.start; + } + if (bottom >= DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.end) { + bottom = DAT_TextureRenderCoreObject::instance.screenMenuSurfaceHeightRange.end - 1; + } + } + if (top > bottom) { + this->currentHeight_0x2c = top - bottom; + } else { + this->currentHeight_0x2c = bottom - top; + } + if (left > right) { + this->currentWidth_0x28 = left - right; + } else { + this->currentWidth_0x28 = right - left; + } + this->currentX = left; + this->currentY = top; + if (left <= right) { + this->moveDirectionXUnk_0x20 = 1; + } else { + this->moveDirectionXUnk_0x20 = -1; + } + if (top <= bottom) { + this->moveDirectionYUnk_0x24 = 1; + } else { + this->moveDirectionYUnk_0x24 = -1; + } + if (left > right) { + this->drawStartX = right; + this->drawEndX = left; + } else { + this->drawStartX = left; + this->drawEndX = right; + } + if (top > bottom) { + this->drawStartY = bottom; + this->drawEndY = top; + } else { + this->drawEndY = bottom; + this->drawStartY = top; + } + return TRUE; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 4a0c6c0d6a..9e06feb3cf 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -20099,7 +20099,7 @@ SHC_3BB0A8C1_0x00468C40 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00468C50 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00468C80 | 0.0% | Pending +SHC_3BB0A8C1_0x00468C80 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00468DE0 | 100.0% | Reimplemented @@ -20111,9 +20111,9 @@ SHC_3BB0A8C1_0x00468F20 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00468F70 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00468FE0 | 0.0% | Pending +SHC_3BB0A8C1_0x00468FE0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004690E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004690E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00469290 | 0.0% | Pending @@ -21933,7 +21933,7 @@ SHC_3BB0A8C1_0x00475B90 | 0.0% | Pending SHC_3BB0A8C1_0x00475BE0 | 0.0% | Pending -SHC_3BB0A8C1_0x00475CC0 | 0.0% | Pending +SHC_3BB0A8C1_0x00475CC0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00475E00 | 0.0% | Pending @@ -26001,7 +26001,7 @@ SHC_3BB0A8C1_0x004B1E60 | 0.0% | Pending SHC_3BB0A8C1_0x004B1EB0 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004B20B0 | 83.1% | shared arm fold direction +SHC_3BB0A8C1_0x004B20B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004B2280 | 100.0% | Reimplemented