diff --git a/src/engine/fox_hud.c b/src/engine/fox_hud.c index bbf8de24..363f7555 100644 --- a/src/engine/fox_hud.c +++ b/src/engine/fox_hud.c @@ -210,22 +210,35 @@ void HUD_TeamDownWrench_Draw(s32 arg0) { } } } else { - f32 x = 48.0f; - f32 y = 0.0f; - HUD_MatrixTranslateCoordLeft(&x, &y); - y = -81.0f; - Lib_InitOrtho(&gMasterDisp); - Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, x, y, -600.0f, MTXF_APPLY); - Matrix_RotateZ(gGfxMatrix, M_PI / 4, MTXF_APPLY); - Matrix_Scale(gGfxMatrix, 0.31f, 0.31f, 1.0f, MTXF_APPLY); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aDownWrenchDL); - Matrix_RotateZ(gGfxMatrix, 3 * M_PI / 2, MTXF_APPLY); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aDownWrenchDL); - Matrix_Pop(&gGfxMatrix); - Lib_InitPerspective(&gMasterDisp); + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + f32 x = 48.0f; + f32 y = 0.0f; + HUD_MatrixTranslateCoordLeft(&x, &y); + y = -81.0f; + Lib_InitOrtho(&gMasterDisp); + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, x, y, -600.0f, MTXF_APPLY); + Matrix_RotateZ(gGfxMatrix, M_PI / 4, MTXF_APPLY); + Matrix_Scale(gGfxMatrix, 0.31f, 0.31f, 1.0f, MTXF_APPLY); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, aDownWrenchDL); + Matrix_RotateZ(gGfxMatrix, 3 * M_PI / 2, MTXF_APPLY); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, aDownWrenchDL); + Matrix_Pop(&gGfxMatrix); + Lib_InitPerspective(&gMasterDisp); + } else { + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, -234.0f, -167.0f, -600.0f, MTXF_APPLY); + Matrix_RotateZ(gGfxMatrix, M_PI / 4, MTXF_APPLY); + Matrix_Scale(gGfxMatrix, 0.68f, 0.68f, 1.0f, MTXF_APPLY); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, aDownWrenchDL); + Matrix_RotateZ(gGfxMatrix, 3 * M_PI / 2, MTXF_APPLY); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, aDownWrenchDL); + Matrix_Pop(&gGfxMatrix); + } } } @@ -2262,7 +2275,12 @@ void HUD_RadioCharacterName_Draw(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_76_OPTIONAL); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); - f32 xPos = OTRGetRectDimensionFromLeftEdgeOverride(73.0f); + f32 xPos; + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + xPos = OTRGetRectDimensionFromLeftEdgeOverride(73.0f); + } else { + xPos = 73.0f; + } switch ((s32) gRadioMsgRadioId) { case RCID_FOX: @@ -2635,20 +2653,31 @@ void HUD_RadioDamage_Draw(void) { } if ((D_80161788 != 0) || (D_8016178C != 0)) { - RCP_SetupDL(&gMasterDisp, SETUPDL_12); - gDPSetPrimColor(gMasterDisp++, 0, 0, r, g, b, alpha); - f32 x = 48.0f; - f32 y = 0.0f; - HUD_MatrixTranslateCoordLeft(&x, &y); - y = -81.0f; - Lib_InitOrtho(&gMasterDisp); - Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, x, y, -139.4f, MTXF_APPLY); - Matrix_Scale(gGfxMatrix, 2.25f, 2.25f, 2.25f, MTXF_APPLY); - Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, sRadioDamageDL); - Matrix_Pop(&gGfxMatrix); - Lib_InitPerspective(&gMasterDisp); + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + RCP_SetupDL(&gMasterDisp, SETUPDL_12); + gDPSetPrimColor(gMasterDisp++, 0, 0, r, g, b, alpha); + f32 x = 48.0f; + f32 y = 0.0f; + HUD_MatrixTranslateCoordLeft(&x, &y); + y = -81.0f; + Lib_InitOrtho(&gMasterDisp); + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, x, y, -139.4f, MTXF_APPLY); + Matrix_Scale(gGfxMatrix, 2.25f, 2.25f, 2.25f, MTXF_APPLY); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, sRadioDamageDL); + Matrix_Pop(&gGfxMatrix); + Lib_InitPerspective(&gMasterDisp); + } else { + RCP_SetupDL(&gMasterDisp, SETUPDL_12); + gDPSetPrimColor(gMasterDisp++, 0, 0, r, g, b, alpha); + Matrix_Push(&gGfxMatrix); + Matrix_Translate(gGfxMatrix, -53.9f, -38.5f, -139.4f, MTXF_APPLY); + Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 1.0f, MTXF_APPLY); + Matrix_SetGfxMtx(&gMasterDisp); + gSPDisplayList(gMasterDisp++, sRadioDamageDL); + Matrix_Pop(&gGfxMatrix); + } } } diff --git a/src/engine/fox_radio.c b/src/engine/fox_radio.c index 365b98b3..e60f80c1 100644 --- a/src/engine/fox_radio.c +++ b/src/engine/fox_radio.c @@ -130,36 +130,61 @@ void Radio_PlayMessage(u16* msg, RadioCharacterId character) { } void Radio_CalculatePositions() { - switch (gGameState) { - case GSTATE_TITLE: - gRadioPrintPosY = 176; - gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeOverride(85.0f); - gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeOverride(80.0f); - gRadioTextBoxPosY = 174.0f; - gRadioTextBoxScaleX = 4.63f; - gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeOverride(32.0f); - gRadioPortraitPosY = 174.0f; - break; + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + switch (gGameState) { + case GSTATE_TITLE: + gRadioPrintPosY = 176; + gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeOverride(85.0f); + gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeOverride(80.0f); + gRadioTextBoxPosY = 174.0f; + gRadioTextBoxScaleX = 4.63f; + gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeOverride(32.0f); + gRadioPortraitPosY = 174.0f; + break; - case GSTATE_ENDING: - gRadioPrintPosY = 176; - gRadioPrintPosX = 85.0f; - gRadioTextBoxPosX = 80.0f; - gRadioTextBoxPosY = 174.0f; - gRadioTextBoxScaleX = 4.63f; - gRadioPortraitPosX = 32.0f; - gRadioPortraitPosY = 174.0f; - break; + case GSTATE_ENDING: + gRadioPrintPosY = 176; + gRadioPrintPosX = 85.0f; + gRadioTextBoxPosX = 80.0f; + gRadioTextBoxPosY = 174.0f; + gRadioTextBoxScaleX = 4.63f; + gRadioPortraitPosX = 32.0f; + gRadioPortraitPosY = 174.0f; + break; - case GSTATE_PLAY: - gRadioPrintPosY = 180; - gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeOverride(79.0f); - gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeOverride(74.0f); - gRadioTextBoxPosY = 178.0f; - gRadioTextBoxScaleX = 4.53f; - gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeOverride(26.0f); - gRadioPortraitPosY = 178.0f; - break; + case GSTATE_PLAY: + gRadioPrintPosY = 180; + gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeOverride(79.0f); + gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeOverride(74.0f); + gRadioTextBoxPosY = 178.0f; + gRadioTextBoxScaleX = 4.53f; + gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeOverride(26.0f); + gRadioPortraitPosY = 178.0f; + break; + } + } else { + switch (gGameState) { + case GSTATE_TITLE: + case GSTATE_ENDING: + gRadioPrintPosY = 176; + gRadioPrintPosX = 85; + gRadioTextBoxPosX = 80.0f; + gRadioTextBoxPosY = 174.0f; + gRadioTextBoxScaleX = 4.63f; + gRadioPortraitPosX = 32.0f; + gRadioPortraitPosY = 174.0f; + break; + + case GSTATE_PLAY: + gRadioPrintPosY = 180; + gRadioPrintPosX = 79; + gRadioTextBoxPosX = 74.0f; + gRadioTextBoxPosY = 178.0f; + gRadioTextBoxScaleX = 4.53f; + gRadioPortraitPosX = 26.0f; + gRadioPortraitPosY = 178.0f; + break; + } } } @@ -718,12 +743,20 @@ void Radio_Draw(void) { (gCurrentRadioPortrait != RCID_1000)) { RCP_SetupDL(&gMasterDisp, SETUPDL_76_OPTIONAL); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255); - Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeOverride(31.0f), 167, 1.0f, 1.0f, "DOWN"); + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeOverride(31.0f), 167, 1.0f, 1.0f, "DOWN"); + } else { + Graphics_DisplaySmallText(31, 167, 1.0f, 1.0f, "DOWN"); + } HUD_TeamDownWrench_Draw(1); } if (((gCurrentRadioPortrait != RCID_STATIC) && (gCurrentRadioPortrait != RCID_STATIC + 1)) && (gCurrentRadioPortrait != RCID_1000)) { - HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeOverride(22.0f), 165.0f, gTeamShields[idx]); + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeOverride(22.0f), 165.0f, gTeamShields[idx]); + } else { + HUD_TeamShields_Draw(22.0f, 165.0f, gTeamShields[idx]); + } } } @@ -767,12 +800,20 @@ void Radio_Draw(void) { (gCurrentRadioPortrait != RCID_STATIC + 1) && (gCurrentRadioPortrait != RCID_1000)) { RCP_SetupDL(&gMasterDisp, SETUPDL_76_OPTIONAL); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255); - Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeOverride(31.0f), 167, 1.0f, 1.0f, "DOWN"); + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeOverride(31.0f), 167, 1.0f, 1.0f, "DOWN"); + } else { + Graphics_DisplaySmallText(31.0f, 167, 1.0f, 1.0f, "DOWN"); + } } if (((gCurrentRadioPortrait != RCID_STATIC) && (gCurrentRadioPortrait != RCID_STATIC + 1)) && (gCurrentRadioPortrait != RCID_1000)) { - HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeOverride(22.0f), 165.0f, - gActors[idx].health * 2.55f); + if (CVarGetInteger("gRadioCommBox.expand", 0) == 1) { + HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeOverride(22.0f), 165.0f, + gActors[idx].health * 2.55f); + } else { + HUD_TeamShields_Draw(22.0f, 165.0f, gActors[idx].health * 2.55f); + } } } if (((gCurrentRadioPortrait != RCID_STATIC) && (gCurrentRadioPortrait != RCID_STATIC + 1)) && diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 67dfb7e1..b9bc2c32 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -570,6 +570,10 @@ static const char* hudAspects[] = { "Expand", "Custom", "Original (4:3)", "Widescreen (16:9)", "Nintendo 3DS (5:3)", "16:10 (8:5)", "Ultrawide (21:9)" }; +static const char* radioCommBox[] = { + "Original", "Expand" +}; + void DrawEnhancementsMenu() { if (UIWidgets::BeginMenu("Enhancements")) { @@ -622,6 +626,21 @@ void DrawEnhancementsMenu() { } if (UIWidgets::BeginMenu("HUD")) { + if (UIWidgets::CVarCombobox("Radio Communication Box", "gRadioCommBox.Selection", radioCommBox, + { + .tooltip = "Which Aspect Ratio to use when drawing the Radio Communication Box", + .defaultIndex = 0, + })) { + switch (CVarGetInteger("gRadioCommBox.Selection", 0)) { + case 0: + CVarSetInteger("gRadioCommBox.expand", 0); + break; + case 1: + CVarSetInteger("gRadioCommBox.expand", 1); + break; + } + } + if (UIWidgets::CVarCombobox("HUD Aspect Ratio", "gHUDAspectRatio.Selection", hudAspects, { .tooltip = "Which Aspect Ratio to use when drawing the HUD (Radar, gauges and radio messages)",