mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Add Hud Editor support for Three-Day Clock (#403)
* Hud Editor suppot for three day clock * support text based clock with hud editor
This commit is contained in:
@@ -49,7 +49,6 @@ static std::unordered_map<Ship::WindowBackend, const char*> windowBackendsMap =
|
||||
static const std::unordered_map<int32_t, const char*> clockTypeOptions = {
|
||||
{ CLOCK_TYPE_ORIGINAL, "Original" },
|
||||
{ CLOCK_TYPE_TEXT_BASED, "Text only" },
|
||||
{ CLOCK_TYPE_HIDDEN, "Hidden" },
|
||||
};
|
||||
|
||||
static const std::unordered_map<int32_t, const char*> alwaysWinDoggyraceOptions = {
|
||||
|
||||
@@ -17,6 +17,7 @@ HudEditorElement hudEditorElements[HUD_EDITOR_ELEMENT_MAX] = {
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_D_PAD, "D-Pad", "DPad", 271, 55, 255, 255, 255, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_MINIMAP, "Minimap", "Minimap", 295, 220, 0, 255, 255, 160),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_START, "Start Button", "Start", 136, 17, 255, 130, 60, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_CLOCK, "Three Day Clock", "Clock", 160, 206, 255, 255, 255, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_HEARTS, "Hearts", "Hearts", 30, 26, 255, 70, 50, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_MAGIC_METER, "Magic", "Magic", 18, 34, 0, 200, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_TIMERS, "Timers", "Timers", 26, 46, 255, 255, 255, 255),
|
||||
@@ -86,21 +87,30 @@ extern "C" void HudEditor_ModifyTextureStepValues(s16* dsdx, s16* dtdy) {
|
||||
*dtdy /= CVarGetFloat(hudEditorElements[hudEditorActiveElement].scaleCvar, 1.0f);
|
||||
}
|
||||
|
||||
// Modify matrix values based on the identity matrix (0,0) centered on the screen
|
||||
extern "C" void HudEditor_ModifyMatrixValues(f32* transX, f32* transY) {
|
||||
*transX = (f32)(SCREEN_WIDTH / 2) + *transX;
|
||||
*transY = (f32)(SCREEN_HEIGHT / 2) - *transY;
|
||||
|
||||
s16 newX = *transX;
|
||||
s16 newY = *transY;
|
||||
|
||||
HudEditor_ModifyRectPosValues(&newX, &newY);
|
||||
|
||||
*transX = (f32)newX - (SCREEN_WIDTH / 2);
|
||||
*transY = (f32)(SCREEN_HEIGHT / 2) - newY;
|
||||
}
|
||||
|
||||
extern "C" void HudEditor_ModifyKaleidoEquipAnimValues(s16* ulx, s16* uly, s16* shrinkRate) {
|
||||
// Normalize the kaleido matrix values to screen rectangle dimensions
|
||||
*ulx = (*ulx / 10) + (SCREEN_WIDTH / 2);
|
||||
*uly = (SCREEN_HEIGHT / 2) - (*uly / 10);
|
||||
// Kaleido values are a multiple of 10 on the identity matrix
|
||||
// Normalize them before passing to the modify matrix
|
||||
f32 transX = *ulx / 10;
|
||||
f32 transY = *uly / 10;
|
||||
|
||||
HudEditor_ModifyRectPosValues(ulx, uly);
|
||||
HudEditor_ModifyMatrixValues(&transX, &transY);
|
||||
|
||||
// Adjust the values to match the kaleido matrix (origin 0,0 at center of screen, +y going up)
|
||||
*ulx -= SCREEN_WIDTH / 2;
|
||||
// *uly = SCREEN_HEIGHT - *uly;
|
||||
*uly = (SCREEN_HEIGHT / 2) - *uly;
|
||||
|
||||
// Scale by 10 for kaleido animation logic
|
||||
*ulx *= 10;
|
||||
*uly *= 10;
|
||||
*ulx = transX * 10;
|
||||
*uly = transY * 10;
|
||||
|
||||
float scale = CVarGetFloat(hudEditorElements[hudEditorActiveElement].scaleCvar, 1.0f);
|
||||
// 320 is the vanilla start size, and 280 is the vanilla end size (or 160 for dpad)
|
||||
@@ -185,6 +195,7 @@ void HudEditorWindow::DrawElement() {
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_D_PAD].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_RIGHT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_MINIMAP].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_RIGHT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_START].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_RIGHT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_CLOCK].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_43);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_HEARTS].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_MAGIC_METER].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_TIMERS].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef enum {
|
||||
HUD_EDITOR_ELEMENT_D_PAD,
|
||||
HUD_EDITOR_ELEMENT_MINIMAP,
|
||||
HUD_EDITOR_ELEMENT_START,
|
||||
HUD_EDITOR_ELEMENT_CLOCK,
|
||||
HUD_EDITOR_ELEMENT_HEARTS,
|
||||
HUD_EDITOR_ELEMENT_MAGIC_METER,
|
||||
HUD_EDITOR_ELEMENT_TIMERS,
|
||||
@@ -59,6 +60,7 @@ void HudEditor_ModifyRectPosValuesFromBase(s16 baseX, s16 baseY, s16* rectLeft,
|
||||
void HudEditor_ModifyRectPosValues(s16* rectLeft, s16* rectTop);
|
||||
void HudEditor_ModifyRectSizeValues(s16* rectWidth, s16* rectHeight);
|
||||
void HudEditor_ModifyTextureStepValues(s16* dsdx, s16* dtdy);
|
||||
void HudEditor_ModifyMatrixValues(f32* transX, f32* transY);
|
||||
void HudEditor_ModifyKaleidoEquipAnimValues(s16* ulx, s16* uly, s16* shrinkRate);
|
||||
void HudEditor_ModifyDrawValuesFromBase(s16 baseX, s16 baseY, s16* rectLeft, s16* rectTop, s16* rectWidth, s16* rectHeight, s16* dsdx, s16* dtdy);
|
||||
void HudEditor_ModifyDrawValues(s16* rectLeft, s16* rectTop, s16* rectWidth, s16* rectHeight, s16* dsdx, s16* dtdy);
|
||||
|
||||
@@ -29,7 +29,6 @@ enum AlwaysWinDoggyRaceOptions {
|
||||
enum ClockTypeOptions {
|
||||
CLOCK_TYPE_ORIGINAL,
|
||||
CLOCK_TYPE_TEXT_BASED,
|
||||
CLOCK_TYPE_HIDDEN,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <libultraship/libultraship.h>
|
||||
#include "Enhancements/GameInteractor/GameInteractor.h"
|
||||
#include "2s2h/BenGui/HudEditor.h"
|
||||
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"
|
||||
#include "2s2h/Enhancements/Enhancements.h"
|
||||
#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h"
|
||||
#include "Enhancements/Enhancements.h"
|
||||
|
||||
extern "C" {
|
||||
#include <z64.h>
|
||||
@@ -14,13 +15,14 @@ extern PlayState* gPlayState;
|
||||
void RegisterTextBasedClock() {
|
||||
REGISTER_VB_SHOULD(GI_VB_PREVENT_CLOCK_DISPLAY, {
|
||||
|
||||
if (CVarGetInteger("gEnhancements.Graphics.ClockType", CLOCK_TYPE_ORIGINAL) == CLOCK_TYPE_HIDDEN) {
|
||||
*should = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (CVarGetInteger("gEnhancements.Graphics.ClockType", CLOCK_TYPE_ORIGINAL) == CLOCK_TYPE_TEXT_BASED) {
|
||||
*should = true;
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_IsActiveElementHidden()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((R_TIME_SPEED != 0) &&
|
||||
((gPlayState->msgCtx.msgMode == MSGMODE_NONE) ||
|
||||
((gPlayState->actorCtx.flags & ACTORCTX_FLAG_1) && !Play_InCsMode(gPlayState)) ||
|
||||
@@ -53,9 +55,19 @@ void RegisterTextBasedClock() {
|
||||
GfxPrint_SetColor(&printer, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
// Scale starting position values by 8 for use with hud editor
|
||||
s16 posX = 13 * 8;
|
||||
s16 posY = 26 * 8;
|
||||
|
||||
HudEditor_ModifyRectPosValues(&posX, &posY);
|
||||
|
||||
// scale back down and clamp to avoid negative values
|
||||
posX = std::max(posX / 8, 0);
|
||||
posY = std::max(posY / 8, 0);
|
||||
|
||||
if (CVarGetInteger("gEnhancements.Graphics.24HoursClock", 0)) {
|
||||
sprintf(formattedTime, "%02d:%02d", curHours, curMinutes);
|
||||
GfxPrint_SetPos(&printer, 14, 26);
|
||||
GfxPrint_SetPos(&printer, posX + 1, posY);
|
||||
} else { // Format hours and minutes for 12-hour AM/PM clock
|
||||
char amPm[3] = "am";
|
||||
if (curHours >= 12) {
|
||||
@@ -68,11 +80,11 @@ void RegisterTextBasedClock() {
|
||||
curHours = 12;
|
||||
}
|
||||
sprintf(formattedTime, "%02d:%02d%s", curHours, curMinutes, amPm);
|
||||
GfxPrint_SetPos(&printer, 13, 26);
|
||||
GfxPrint_SetPos(&printer, posX, posY);
|
||||
}
|
||||
|
||||
GfxPrint_Printf(&printer, "Day %d: %s", gSaveContext.save.day, formattedTime);
|
||||
GfxPrint_SetPos(&printer, 13, 27);
|
||||
GfxPrint_SetPos(&printer, posX, posY + 1);
|
||||
|
||||
// Crash Countdown
|
||||
if ((CURRENT_DAY >= 4) ||
|
||||
@@ -88,6 +100,8 @@ void RegisterTextBasedClock() {
|
||||
|
||||
CLOSE_DISPS(gPlayState->state.gfxCtx);
|
||||
}
|
||||
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+171
-17
@@ -617,7 +617,27 @@ Gfx* Gfx_DrawTexRect4b(Gfx* gfx, TexturePtr texture, s32 fmt, s16 textureWidth,
|
||||
gDPLoadTextureBlock_4b(gfx++, texture, fmt, textureWidth, textureHeight, 0, cms, G_TX_NOMIRROR | G_TX_WRAP, masks,
|
||||
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2,
|
||||
// #region 2S2H [Cosmetic] Hud Editor
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
if (CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar, HUD_EDITOR_ELEMENT_MODE_VANILLA) == HUD_EDITOR_ELEMENT_MODE_HIDDEN) {
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
return gfx;
|
||||
}
|
||||
|
||||
if (hudEditorActiveElement == HUD_EDITOR_ELEMENT_TIMERS ||
|
||||
hudEditorActiveElement == HUD_EDITOR_ELEMENT_TIMERS_MOON_CRASH) {
|
||||
HudEditor_ModifyDrawValuesFromBase(gSaveContext.timerX[sTimerId], gSaveContext.timerY[sTimerId], &rectLeft,
|
||||
&rectTop, &rectWidth, &rectHeight, &dsdx, &dtdy);
|
||||
} else {
|
||||
HudEditor_ModifyDrawValues(&rectLeft, &rectTop, &rectWidth, &rectHeight, &dsdx, &dtdy);
|
||||
}
|
||||
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// 2S2H [Cosmetic] Changed to Wide variant to support widescreen
|
||||
gSPWideTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2,
|
||||
G_TX_RENDERTILE, rects, 0, dsdx, dtdy);
|
||||
|
||||
return gfx;
|
||||
@@ -6032,6 +6052,7 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
|
||||
0, PRIMITIVE, 0);
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gThreeDayClockHourLinesTex, 4, 64, 35, 96, 180, 128, 35, 1,
|
||||
6, 0, 1 << 10, 1 << 10);
|
||||
|
||||
@@ -6043,6 +6064,7 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
|
||||
0, PRIMITIVE, 0);
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
//! @bug A texture height of 50 is given below. The texture is only 48 units height
|
||||
//! resulting in this reading into the next texture. This results in a white
|
||||
//! dot in the bottom center of the clock. For the three-day clock, this is
|
||||
@@ -6145,6 +6167,7 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 170, 100, sThreeDayClockAlpha);
|
||||
}
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, gThreeDayClockDiamondTex, 40, 32, 140, 190, 40, 32,
|
||||
1 << 10, 1 << 10);
|
||||
|
||||
@@ -6154,6 +6177,7 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha);
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, interfaceCtx->doActionSegment[DO_ACTION_SEG_CLOCK].mainTex, 48,
|
||||
27, 137, 192, 48, 27, 1 << 10, 1 << 10);
|
||||
|
||||
@@ -6193,8 +6217,23 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
|
||||
gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
|
||||
Matrix_Translate(0.0f, -86.0f, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, D_801BF980, MTXMODE_APPLY);
|
||||
// #region 2S2H [Cosmetic] Hud Editor clock star
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
f32 posX = 0.0f;
|
||||
f32 posY = -86.0f;
|
||||
|
||||
f32 elemScale = !HudEditor_IsActiveElementHidden() ? HudEditor_GetActiveElementScale() : 0.0f;
|
||||
HudEditor_ModifyMatrixValues(&posX, &posY);
|
||||
|
||||
Matrix_Translate(posX, posY, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(elemScale, elemScale, D_801BF980, MTXMODE_APPLY);
|
||||
} else {
|
||||
// #endregion
|
||||
Matrix_Translate(0.0f, -86.0f, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, D_801BF980, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
Matrix_RotateZF(-(timeInSeconds * 0.0175f) / 10.0f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
@@ -6210,9 +6249,39 @@ void Interface_DrawClock(PlayState* play) {
|
||||
* Section: Cuts off Three-Day Clock's Sun and Moon when they dip below the clock
|
||||
*/
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
// 2S2H [Cosmetic] Adjust the x values so the scissor stays the same size regardless of widescreen
|
||||
gDPSetScissor(OVERLAY_DISP++, G_SC_NON_INTERLACE, OTRConvertHUDXToScreenX(400 / 4), 620 / 4,
|
||||
OTRConvertHUDXToScreenX(880 / 4), R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF);
|
||||
// #region 2S2H [Cosmetic] Hud Editor clock sun/moon scissor
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
s16 rectLeft = 400 / 4;
|
||||
s16 rectTop = 620 / 4;
|
||||
s16 rectWidth = (880 / 4) - rectLeft;
|
||||
s16 rectHeight = R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF - rectTop;
|
||||
|
||||
HudEditor_ModifyRectPosValues(&rectLeft, &rectTop);
|
||||
HudEditor_ModifyRectSizeValues(&rectWidth, &rectHeight);
|
||||
|
||||
s16 widthRemoved = rectLeft;
|
||||
s16 heightRemoved = rectTop;
|
||||
|
||||
rectLeft = MAX(rectLeft, OTRGetRectDimensionFromLeftEdge(0));
|
||||
rectTop = MAX(rectTop, 0);
|
||||
|
||||
widthRemoved = rectLeft - widthRemoved;
|
||||
heightRemoved = rectTop - heightRemoved;
|
||||
rectWidth -= widthRemoved;
|
||||
rectHeight -= heightRemoved;
|
||||
|
||||
rectWidth = MIN(rectLeft + rectWidth, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH)) - rectLeft;
|
||||
rectHeight = MIN(rectTop + rectHeight, SCREEN_HEIGHT) - rectTop;
|
||||
|
||||
gDPSetScissor(OVERLAY_DISP++, G_SC_NON_INTERLACE, OTRConvertHUDXToScreenX(rectLeft), rectTop,
|
||||
OTRConvertHUDXToScreenX(rectLeft + rectWidth), rectTop + rectHeight);
|
||||
} else {
|
||||
// #endregion
|
||||
// 2S2H [Cosmetic] Adjust the x values so the scissor stays the same size regardless of widescreen
|
||||
gDPSetScissor(OVERLAY_DISP++, G_SC_NON_INTERLACE, OTRConvertHUDXToScreenX(400 / 4), 620 / 4,
|
||||
OTRConvertHUDXToScreenX(880 / 4), R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF);
|
||||
}
|
||||
|
||||
// determines the current hour
|
||||
for (sp1C6 = 0; sp1C6 <= 24; sp1C6++) {
|
||||
@@ -6242,8 +6311,18 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 100, 110, sThreeDayClockAlpha);
|
||||
|
||||
Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
// #region 2S2H [Cosmetic] Hud Editor clock sun
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
f32 elemScale = !HudEditor_IsActiveElementHidden() ? HudEditor_GetActiveElementScale() : 0.0f;
|
||||
HudEditor_ModifyMatrixValues(&sp1D8, &temp_f14);
|
||||
Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(elemScale, elemScale, 1.0f, MTXMODE_APPLY);
|
||||
} else {
|
||||
// #endregion
|
||||
Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[16], 4, 0);
|
||||
@@ -6260,8 +6339,18 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 55, sThreeDayClockAlpha);
|
||||
|
||||
Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
// #region 2S2H [Cosmetic] Hud Editor clock moon
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
f32 elemScale = !HudEditor_IsActiveElementHidden() ? HudEditor_GetActiveElementScale() : 0.0f;
|
||||
HudEditor_ModifyMatrixValues(&sp1D8, &temp_f14);
|
||||
Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(elemScale, elemScale, 1.0f, MTXMODE_APPLY);
|
||||
} else {
|
||||
Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[20], 4, 0);
|
||||
|
||||
@@ -6271,9 +6360,40 @@ void Interface_DrawClock(PlayState* play) {
|
||||
* Section: Cuts off Three-Day Clock's Hour Digits when they dip below the clock
|
||||
*/
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
// 2S2H [Cosmetic] Adjust the x values so the scissor stays the same size regardless of widescreen
|
||||
gDPSetScissor(OVERLAY_DISP++, G_SC_NON_INTERLACE, OTRConvertHUDXToScreenX(400 / 4), (620 / 4),
|
||||
OTRConvertHUDXToScreenX(880 / 4), R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF);
|
||||
|
||||
// #region 2S2H [Cosmetic] Hud Editor clock hour scissor
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
s16 rectLeft = 400 / 4;
|
||||
s16 rectTop = 620 / 4;
|
||||
s16 rectWidth = (880 / 4) - rectLeft;
|
||||
s16 rectHeight = R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF - rectTop;
|
||||
|
||||
HudEditor_ModifyRectPosValues(&rectLeft, &rectTop);
|
||||
HudEditor_ModifyRectSizeValues(&rectWidth, &rectHeight);
|
||||
|
||||
s16 widthRemoved = rectLeft;
|
||||
s16 heightRemoved = rectTop;
|
||||
|
||||
rectLeft = MAX(rectLeft, OTRGetRectDimensionFromLeftEdge(0));
|
||||
rectTop = MAX(rectTop, 0);
|
||||
|
||||
widthRemoved = rectLeft - widthRemoved;
|
||||
heightRemoved = rectTop - heightRemoved;
|
||||
rectWidth -= widthRemoved;
|
||||
rectHeight -= heightRemoved;
|
||||
|
||||
rectWidth = MIN(rectLeft + rectWidth, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH)) - rectLeft;
|
||||
rectHeight = MIN(rectTop + rectHeight, SCREEN_HEIGHT) - rectTop;
|
||||
|
||||
|
||||
gDPSetScissor(OVERLAY_DISP++, G_SC_NON_INTERLACE, OTRConvertHUDXToScreenX(rectLeft), rectTop,
|
||||
OTRConvertHUDXToScreenX(rectLeft + rectWidth), rectTop + rectHeight);
|
||||
} else {
|
||||
// 2S2H [Cosmetic] Adjust the x values so the scissor stays the same size regardless of widescreen
|
||||
gDPSetScissor(OVERLAY_DISP++, G_SC_NON_INTERLACE, OTRConvertHUDXToScreenX(400 / 4), (620 / 4),
|
||||
OTRConvertHUDXToScreenX(880 / 4), R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Section: Draws Three-Day Clock's Hour Digit Above the Sun
|
||||
@@ -6281,8 +6401,23 @@ void Interface_DrawClock(PlayState* play) {
|
||||
sp1CC = gSaveContext.save.time * 0.000096131f; // (2.0f * 3.15f / 0x10000)
|
||||
|
||||
// Rotates Three-Day Clock's Hour Digit To Above the Sun
|
||||
Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
// #region 2S2H [Cosmetic] Hud Editor clock sun hour
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
f32 posX = 0.0f;
|
||||
f32 posY = R_THREE_DAY_CLOCK_Y_POS / 10.0f;
|
||||
|
||||
f32 elemScale = !HudEditor_IsActiveElementHidden() ? HudEditor_GetActiveElementScale() : 0.0f;
|
||||
HudEditor_ModifyMatrixValues(&posX, &posY);
|
||||
|
||||
Matrix_Translate(posX, posY, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(elemScale, elemScale, 1.0f, MTXMODE_APPLY);
|
||||
} else {
|
||||
// #endregion
|
||||
Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
Matrix_RotateZF(-(sp1CC - 3.15f), MTXMODE_APPLY);
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
@@ -6307,8 +6442,23 @@ void Interface_DrawClock(PlayState* play) {
|
||||
*/
|
||||
|
||||
// Rotates Three-Day Clock's Hour Digit To Above the Moon
|
||||
Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
// #region 2S2H [Cosmetic] Hud Editor clock moon hour
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
f32 posX = 0.0f;
|
||||
f32 posY = R_THREE_DAY_CLOCK_Y_POS / 10.0f;
|
||||
|
||||
f32 elemScale = !HudEditor_IsActiveElementHidden() ? HudEditor_GetActiveElementScale() : 0.0f;
|
||||
HudEditor_ModifyMatrixValues(&posX, &posY);
|
||||
|
||||
Matrix_Translate(posX, posY, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(elemScale, elemScale, 1.0f, MTXMODE_APPLY);
|
||||
} else {
|
||||
// #endregion
|
||||
Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
Matrix_RotateZF(-sp1CC, MTXMODE_APPLY);
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
@@ -6412,6 +6562,7 @@ void Interface_DrawClock(PlayState* play) {
|
||||
gDPSetEnvColor(OVERLAY_DISP++, sFinalHoursClockFrameEnvRed, sFinalHoursClockFrameEnvGreen,
|
||||
sFinalHoursClockFrameEnvBlue, 0);
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gFinalHoursClockFrameTex, 3, 80, 13, 119, 202, 80, 13, 0,
|
||||
0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
@@ -6462,11 +6613,14 @@ void Interface_DrawClock(PlayState* play) {
|
||||
for (sp1C6 = 0; sp1C6 < 8; sp1C6++) {
|
||||
index = sFinalHoursDigitSlotPosXOffset[sp1C6];
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_CLOCK);
|
||||
OVERLAY_DISP =
|
||||
Gfx_DrawTexRectI8(OVERLAY_DISP, sFinalHoursDigitTextures[finalHoursClockSlots[sp1C6]], 8, 8,
|
||||
index, 205, 8, 8, 1 << 10, 1 << 10);
|
||||
}
|
||||
}
|
||||
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user