diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/dimBox.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/dimBox.cpp new file mode 100644 index 0000000000..c02d7a8a3e --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/dimBox.cpp @@ -0,0 +1,22 @@ +#include "../PencilRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00471050 + void PencilRenderCore::dimBox(int left, int top, int right, int bottom) + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencilSurface, this)(); + if (!MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencil, this)( + left, top, right, bottom, 0)) { + return; + } + for (; this->currentHeight_0x2c >= 0; --this->currentHeight_0x2c, ++this->drawStartY) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::dimHorizontalLine, this)(); + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawColorBox.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawColorBox.cpp new file mode 100644 index 0000000000..b738c5b1fb --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawColorBox.cpp @@ -0,0 +1,22 @@ +#include "../PencilRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00470E90 + void PencilRenderCore::drawColorBox(int left, int top, int right, int bottom, ushort color) + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencilSurface, this)(); + if (!MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencil, this)( + left, top, right, bottom, color)) { + return; + } + for (; this->currentHeight_0x2c >= 0; --this->currentHeight_0x2c, ++this->drawStartY) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawHorizontalLine, this)(); + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawDiagonalHeigherThanWideUnk.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawDiagonalHeigherThanWideUnk.cpp new file mode 100644 index 0000000000..f8b69ea995 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawDiagonalHeigherThanWideUnk.cpp @@ -0,0 +1,29 @@ +#include "../PencilRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00471220 + void PencilRenderCore::drawDiagonalHeigherThanWideUnk() + { + // Bresenham, the major axis moved in each arm, as the original does (once after the if does not match) + int const straightStep = this->currentWidth_0x28 * 2; + int const diagonalStep = straightStep - this->currentHeight_0x2c * 2; + int error = straightStep - this->currentHeight_0x2c; + for (; this->currentHeight_0x2c >= 0; --this->currentHeight_0x2c) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawCurrentPixel, this)(); + if (error > 0) { + this->currentX += this->moveDirectionXUnk_0x20; + this->currentY += this->moveDirectionYUnk_0x24; + error += diagonalStep; + } else { + this->currentY += this->moveDirectionYUnk_0x24; + error += straightStep; + } + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawDiagonalWiderThanHighUnk.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawDiagonalWiderThanHighUnk.cpp new file mode 100644 index 0000000000..880061cf10 --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawDiagonalWiderThanHighUnk.cpp @@ -0,0 +1,29 @@ +#include "../PencilRenderCore.func.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x00471280 + void PencilRenderCore::drawDiagonalWiderThanHighUnk() + { + // Bresenham, the major axis moved in each arm, as the original does (once after the if does not match) + int const straightStep = this->currentHeight_0x2c * 2; + int const diagonalStep = straightStep - this->currentWidth_0x28 * 2; + int error = straightStep - this->currentWidth_0x28; + for (; this->currentWidth_0x28 >= 0; --this->currentWidth_0x28) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawCurrentPixel, this)(); + if (error > 0) { + this->currentX += this->moveDirectionXUnk_0x20; + this->currentY += this->moveDirectionYUnk_0x24; + error += diagonalStep; + } else { + this->currentX += this->moveDirectionXUnk_0x20; + error += straightStep; + } + } + } + + } +} +} diff --git a/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4OverWholeScreen.cpp b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4OverWholeScreen.cpp new file mode 100644 index 0000000000..e35093dceb --- /dev/null +++ b/src/OpenSHC/UI/Rendering/PencilRenderCore/drawPixelPattern4x4OverWholeScreen.cpp @@ -0,0 +1,26 @@ +#include "../PencilRenderCore.func.hpp" + +#include "OpenSHC/Globals/DAT_WindowAndDirectDraw.hpp" + +namespace OpenSHC { +namespace UI { + namespace Rendering { + + // FUNCTION: STRONGHOLDCRUSADER 0x004712E0 + void PencilRenderCore::drawPixelPattern4x4OverWholeScreen() + { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::setupPencilSurface, this)(); + // The 4x4 pattern tiled over the whole screen + for (this->currentY = 0; this->currentY < DAT_WindowAndDirectDraw::instance.resolutionY; + this->currentY += 4) { + for (this->currentX = 0; this->currentX < DAT_WindowAndDirectDraw::instance.resolutionX; + this->currentX += 4) { + MACRO_CALL_MEMBER(OpenSHC::UI::Rendering::PencilRenderCore_Func::drawPixelPattern4x4, this)( + this->currentX, this->currentY); + } + } + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 6e036f9340..f932867514 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -21265,7 +21265,7 @@ SHC_3BB0A8C1_0x00470B30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00470BC0 | 100.0% | Reimplemented, requires SHC_3BB0A8C1_0x0046CCD0 to be active -SHC_3BB0A8C1_0x00470E90 | 0.0% | Pending +SHC_3BB0A8C1_0x00470E90 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00470EE0 | 0.0% | Pending @@ -21273,17 +21273,17 @@ SHC_3BB0A8C1_0x00470FC0 | 0.0% | Pending SHC_3BB0A8C1_0x00471000 | 0.0% | Pending -SHC_3BB0A8C1_0x00471050 | 0.0% | Pending +SHC_3BB0A8C1_0x00471050 | 100.0% | Reimplemented SHC_3BB0A8C1_0x004710A0 | 0.0% | Pending SHC_3BB0A8C1_0x004711B0 | 0.0% | Pending -SHC_3BB0A8C1_0x00471220 | 0.0% | Pending +SHC_3BB0A8C1_0x00471220 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00471280 | 0.0% | Pending +SHC_3BB0A8C1_0x00471280 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x004712E0 | 0.0% | Pending +SHC_3BB0A8C1_0x004712E0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00471340 | 0.0% | Pending