From c878b6bcc925e000ae2b16190bb62cb485d5bac7 Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Fri, 6 Dec 2024 15:15:35 -0300 Subject: [PATCH] widescreen team help arrows --- src/engine/fox_display.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/engine/fox_display.c b/src/engine/fox_display.c index e8ecce74..48c8f25d 100644 --- a/src/engine/fox_display.c +++ b/src/engine/fox_display.c @@ -35,7 +35,7 @@ void KillBoss(void); #endif void Display_DrawHelpAlert(void) { - bool sp7C; + bool centered; // Enemy pos is centered, so both help arrows should be displayed f32 sp78; f32 sp74; Vec3f sp68; @@ -44,11 +44,13 @@ void Display_DrawHelpAlert(void) { if ((gPlayState == PLAY_PAUSE) || (gTeamHelpActor == NULL)) { return; } + if ((gTeamHelpActor->obj.status != OBJ_ACTIVE) || (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_ACTIVE)) { gTeamHelpActor = NULL; gTeamHelpTimer = 0; return; } + if (gTeamHelpTimer != 0) { gTeamHelpTimer--; if (gTeamHelpTimer == 0) { @@ -67,9 +69,9 @@ void Display_DrawHelpAlert(void) { Matrix_MultVec3f(gCalcMatrix, &sp68, &sp5C); - sp7C = false; + centered = false; if ((sp5C.z < 0.0f) && (sp5C.z > -12000.0f) && (fabsf(sp5C.x) < fabsf(sp5C.z * 0.4f))) { - sp7C = true; + centered = true; } RCP_SetupDL(&gMasterDisp, SETUPDL_12); @@ -86,19 +88,19 @@ void Display_DrawHelpAlert(void) { break; } - switch (sp7C) { + switch (centered) { case false: if (gTeamHelpActor->sfxSource[0] > 0.0f) { - sp78 = 20.0f; + sp78 = 20.0f * OTRGetAspectRatio()-8; sp74 = M_PI / 2; } else { - sp78 = -20.0f; + sp78 = -20.0f * OTRGetAspectRatio()+8; sp74 = -M_PI / 2; } Matrix_Push(&gGfxMatrix); // @port: Tag the transform. - FrameInterpolation_RecordOpenChild("Display_DrawHelpAlert", sp7C); + FrameInterpolation_RecordOpenChild("Display_DrawHelpAlert", centered); Matrix_Translate(gGfxMatrix, sp78, 0.0f, -50.0f, MTXF_APPLY); Matrix_RotateZ(gGfxMatrix, sp74, MTXF_APPLY); @@ -112,20 +114,22 @@ void Display_DrawHelpAlert(void) { break; case true: + // right arrow (both at the same time) Matrix_Push(&gGfxMatrix); // @port: Tag the transform. - FrameInterpolation_RecordOpenChild("Display_DrawHelpAlert", sp7C); - - Matrix_Translate(gGfxMatrix, 20.0f, 0.0f, -50.0f, MTXF_APPLY); + FrameInterpolation_RecordOpenChild("Display_DrawHelpAlert", centered); + Matrix_Translate(gGfxMatrix, 20.0f * OTRGetAspectRatio() - 8, 0.0f, -50.0f, MTXF_APPLY); Matrix_RotateZ(gGfxMatrix, -M_PI / 2, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 0.03f, 0.03f, 0.03f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_1023700); Matrix_Pop(&gGfxMatrix); sp78 = -20.0f; + + // left arrow (both in simultaneous) Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, -20.0f, 0.0f, -50.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, -20.0f * OTRGetAspectRatio() + 8, 0.0f, -50.0f, MTXF_APPLY); Matrix_RotateZ(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 0.03f, 0.03f, 0.03f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); @@ -136,23 +140,23 @@ void Display_DrawHelpAlert(void) { FrameInterpolation_RecordCloseChild(); break; } - - switch (sp7C) { + + switch (centered) { case false: RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255); if (sp78 < 0.0f) { - Graphics_DisplaySmallText(43 - 19, 106, 1.0f, 1.0f, "HELP!!"); + Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdge(38.0f), 106, 1.0f, 1.0f, "HELP!!"); } else { - Graphics_DisplaySmallText(SCREEN_WIDTH - 43 - 19, 106, 1.0f, 1.0f, "HELP!!"); + Graphics_DisplaySmallText(OTRGetRectDimensionFromRightEdge(248), 106, 1.0f, 1.0f, "HELP!!"); } break; case true: RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255); - Graphics_DisplaySmallText(43 - 19, 106, 1.0f, 1.0f, "HELP!!"); - Graphics_DisplaySmallText(SCREEN_WIDTH - 43 - 19, 106, 1.0f, 1.0f, "HELP!!"); + Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdge(38.0f) , 106, 1.0f, 1.0f, "HELP!!"); + Graphics_DisplaySmallText(OTRGetRectDimensionFromRightEdge(248), 106, 1.0f, 1.0f, "HELP!!"); break; } }