diff --git a/source-code/source/plugins/TLAC/Components/Drawing.h b/source-code/source/plugins/TLAC/Components/Drawing.h index 773f5f4..db93d0b 100644 --- a/source-code/source/plugins/TLAC/Components/Drawing.h +++ b/source-code/source/plugins/TLAC/Components/Drawing.h @@ -211,6 +211,33 @@ namespace TLAC::Components float height; }; void(*fillRectangle)(DrawParams* dtParam, RectangleBounds* rect) = (void(*)(DrawParams* dtParam, RectangleBounds* rect))0x140198d80; - void(*drawRectangle)(DrawParams* dtParam, RectangleBounds* rect) = (void(*)(DrawParams* dtParam, RectangleBounds* rect))0x140198320; + + // draws only a border -- use fillRectangle to fill contained pixels + void drawRectangle(DrawParams* dtParam, RectangleBounds* rect) + { + ((void(*)(DrawParams*, RectangleBounds*))0x140198320)(dtParam, rect); + } + + // draws only a border -- use fillRectangle to fill contained pixels + void drawRectangle(DrawParams* dtParam, RectangleBounds* rect, float thickness) + { + uint32_t oldFillColour = dtParam->fillColour; + dtParam->fillColour = dtParam->colour; + + // yes this seems pretty dodgy, but sega does it this way so... I guess it's the only way + RectangleBounds tempRect = { rect->x, rect->y, thickness, rect->height }; // left side + fillRectangle(dtParam, &tempRect); + + tempRect.x = rect->x + rect->width - thickness; // right side + fillRectangle(dtParam, &tempRect); + + tempRect = { rect->x + thickness, rect->y, rect->width - (thickness * 2), thickness }; // top side + fillRectangle(dtParam, &tempRect); + + tempRect.y = rect->y + rect->height - thickness; // left side + fillRectangle(dtParam, &tempRect); + + dtParam->fillColour = oldFillColour; + } #pragma pack(pop) } \ No newline at end of file diff --git a/source-code/source/plugins/TLAC/Components/Pause.cpp b/source-code/source/plugins/TLAC/Components/Pause.cpp index 1774daa..cfe0d20 100644 --- a/source-code/source/plugins/TLAC/Components/Pause.cpp +++ b/source-code/source/plugins/TLAC/Components/Pause.cpp @@ -251,24 +251,13 @@ namespace TLAC::Components const float selectBoxHeight = menuItemHeight; const float selectBoxThickness = 2; - const float selectBoxX1 = menuX - selectBoxWidth / 2; - const float selectBoxX2 = selectBoxX1 + selectBoxWidth - selectBoxThickness; - const float selectBoxY1 = selectBoxPos; - const float selectBoxY2 = selectBoxY1 + selectBoxThickness; - const float selectBoxY3 = selectBoxY1 + selectBoxHeight - selectBoxThickness; - const float selectBoxSideHeight = selectBoxHeight - 2 * selectBoxThickness; + const float selectBoxX = menuX - selectBoxWidth / 2; + const float selectBoxY = selectBoxPos; - // dirty hack using fillRectangle to get thickness (idk how to set it or it isn't possible to with drawRectangle) + rect = { selectBoxX, selectBoxY, selectBoxWidth, selectBoxHeight }; dtParams.colour = 0xc0ffff00; dtParams.fillColour = 0xc0ffff00; - rect = { selectBoxX1, selectBoxY1, selectBoxWidth, selectBoxThickness }; // top - fillRectangle(&dtParams, &rect); - rect = { selectBoxX1, selectBoxY3, selectBoxWidth, selectBoxThickness }; // bottom - fillRectangle(&dtParams, &rect); - rect = { selectBoxX1, selectBoxY2, selectBoxThickness, selectBoxSideHeight }; - fillRectangle(&dtParams, &rect); - rect = { selectBoxX2, selectBoxY2, selectBoxThickness, selectBoxSideHeight }; - fillRectangle(&dtParams, &rect); + drawRectangle(&dtParams, &rect, selectBoxThickness); // menu