use forced aspect ratio instead

This commit is contained in:
Kiloku 2025-01-11 11:17:45 -03:00 committed by Lywx
parent 63fa98d02f
commit 2d538fac86
4 changed files with 50 additions and 50 deletions

View File

@ -119,7 +119,7 @@ Gfx sRadioDamageDL[] = {
};
void HUD_MatrixTranslateCoordLeft(f32* transX, f32* transY) {
*transX = OTRGetRectDimensionFromLeftEdgeCentered(*transX) - (SCREEN_WIDTH / 2.0f);
*transX = OTRGetRectDimensionFromLeftEdgeForcedAspect(*transX, 4.0f/3) - (SCREEN_WIDTH / 2.0f);
*transY = (SCREEN_HEIGHT / 2.0f) - *transY;
}
@ -976,9 +976,9 @@ void HUD_LivesCount2_Draw(f32 x, f32 y, s32 number) {
x2 += (2 - i) * 4;
if (gShowLevelClearStatusScreen == 0) {
x0 = OTRGetDimensionFromRightEdgeCentered(x0);
x1 = OTRGetDimensionFromRightEdgeCentered(x1);
x2 = OTRGetDimensionFromRightEdgeCentered(x2);
x0 = OTRGetDimensionFromRightEdgeForcedAspect(x0, 4.0f/3);
x1 = OTRGetDimensionFromRightEdgeForcedAspect(x1, 4.0f/3);
x2 = OTRGetDimensionFromRightEdgeForcedAspect(x2, 4.0f/3);
}
Lib_TextureRect_CI4(&gMasterDisp, sLivesCounterTexs[form], sLivesCounterTLUTs[form], 16, 16, x0, y0, 1.0f, 1.0f);
@ -1236,7 +1236,7 @@ void HUD_LevelClearStatusScreen_Draw(void) {
RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT);
gDPSetPrimColor(gMasterDisp++, 0, 0, 90, 160, 200, 255);
HUD_Number_Draw(OTRGetRectDimensionFromLeftEdgeCentered(24.0f), 30.0f + 3.0f, D_801617C0[5], 1.0f, false, 999);
HUD_Number_Draw(OTRGetRectDimensionFromLeftEdgeForcedAspect(24.0f, 4.0f/3), 30.0f + 3.0f, D_801617C0[5], 1.0f, false, 999);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
Lib_TextureRect_IA8(&gMasterDisp, aTextEnemiesDown, 64, 25, x0, y0 + 4.0f, 1.0f, 1.0f);
@ -1498,8 +1498,8 @@ void HUD_PauseScreen_Update(void) {
sPauseScreenTimer[0] = 0;
case 3:
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdgeCentered(0), 0,
OTRGetDimensionFromRightEdgeCentered(SCREEN_WIDTH), SCREEN_HEIGHT, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdgeForcedAspect(0, 4.0f/3), 0,
OTRGetDimensionFromRightEdgeForcedAspect(SCREEN_WIDTH, 4.0f/3), SCREEN_HEIGHT, 0, 0, 0, 255);
gFillScreenAlphaTarget = 0;
@ -1548,8 +1548,8 @@ void HUD_PauseScreen_Update(void) {
break;
case 4:
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdgeCentered(0), 0,
OTRGetDimensionFromRightEdgeCentered(SCREEN_WIDTH), SCREEN_HEIGHT, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdgeForcedAspect(0, 4.0f/3), 0,
OTRGetDimensionFromRightEdgeForcedAspect(SCREEN_WIDTH, 4.0f/3), SCREEN_HEIGHT, 0, 0, 0, 255);
if (sPauseScreenTimer[0] < 140) {
break;
}
@ -1567,8 +1567,8 @@ void HUD_PauseScreen_Update(void) {
}
case 5:
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdgeCentered(0), 0,
OTRGetDimensionFromRightEdgeCentered(SCREEN_WIDTH), SCREEN_HEIGHT, 0, 0, 0, 255);
Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdgeForcedAspect(0, 4.0f/3), 0,
OTRGetDimensionFromRightEdgeForcedAspect(SCREEN_WIDTH, 4.0f/3), SCREEN_HEIGHT, 0, 0, 0, 255);
for (i = 0; i < 6; i++) {
if (gPrevPlanetTeamShields[i] == -1) {
@ -2033,22 +2033,22 @@ s32 HUD_RadarMarks_Update(void) {
switch (gCurrentLevel) {
case LEVEL_CORNERIA:
gHudOffsetRect = OTRGetDimensionFromRightEdgeCentered(0.0f);
gHudOffsetRect = OTRGetDimensionFromRightEdgeForcedAspect(0.0f, 4.0f/3);
gHudOffsetPers = gHudOffsetRect * 2.15f;
break;
case LEVEL_SECTOR_Z:
gHudOffsetRect = OTRGetDimensionFromRightEdgeCentered(0.0f);
gHudOffsetRect = OTRGetDimensionFromRightEdgeForcedAspect(0.0f, 4.0f/3);
gHudOffsetPers = gHudOffsetRect * 5.50f;
break;
case LEVEL_BOLSE:
gHudOffsetRect = OTRGetDimensionFromRightEdgeCentered(0.0f);
gHudOffsetRect = OTRGetDimensionFromRightEdgeForcedAspect(0.0f, 4.0f/3);
gHudOffsetPers = gHudOffsetRect * 2.70f;
break;
default:
gHudOffsetRect = OTRGetDimensionFromRightEdgeCentered(0.0f);
gHudOffsetRect = OTRGetDimensionFromRightEdgeForcedAspect(0.0f, 4.0f/3);
gHudOffsetPers = gHudOffsetRect * 3.35f;
break;
}
@ -2250,7 +2250,7 @@ void HUD_RadioCharacterName_Draw(void) {
RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
f32 xPos = OTRGetRectDimensionFromLeftEdgeCentered(73.0f);
f32 xPos = OTRGetRectDimensionFromLeftEdgeForcedAspect(73.0f, 4.0f/3);
switch ((s32) gRadioMsgRadioId) {
case RCID_FOX:
@ -2435,7 +2435,7 @@ void HUD_PlayerShieldGauge_Update(void) {
}
void HUD_PlayerShieldGauge_Draw(f32 x, f32 y) {
x = OTRGetRectDimensionFromLeftEdgeCentered(x);
x = OTRGetRectDimensionFromLeftEdgeForcedAspect(x, 4.0f/3);
RCP_SetupDL(&gMasterDisp, SETUPDL_75);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
HUD_ShieldGaugeBars_Draw(x + 7.0f, y + 2.0f, D_801617A8, 1.0f, D_801617AC);
@ -3011,16 +3011,16 @@ void HUD_BoostGauge_Draw(f32 xPos, f32 yPos) {
sp68 = 24.0f;
switch (gPlayerNum) {
case 1:
xPos = OTRGetRectDimensionFromLeftEdgeCentered(xPos);
xPos = OTRGetRectDimensionFromLeftEdgeForcedAspect(xPos, 4.0f/3);
break;
case 2:
xPos = OTRGetRectDimensionFromLeftEdgeCentered(xPos);
xPos = OTRGetRectDimensionFromLeftEdgeForcedAspect(xPos, 4.0f/3);
break;
case 3:
xPos = OTRGetDimensionFromRightEdgeCentered(xPos);
xPos = OTRGetDimensionFromRightEdgeForcedAspect(xPos, 4.0f/3);
break;
case 4:
xPos = OTRGetDimensionFromRightEdgeCentered(xPos);
xPos = OTRGetDimensionFromRightEdgeForcedAspect(xPos, 4.0f/3);
break;
}
} else {
@ -3028,7 +3028,7 @@ void HUD_BoostGauge_Draw(f32 xPos, f32 yPos) {
sp60 = 2.0f;
sp68 = 40.0f;
playerNum = 4; // index for Single Player
xPos = OTRGetDimensionFromRightEdgeCentered(xPos);
xPos = OTRGetDimensionFromRightEdgeForcedAspect(xPos, 4.0f/3);
boostGaugeXpos[playerNum] = xPos;
boostGaugeYpos[playerNum] = yPos;
}
@ -3174,14 +3174,14 @@ void HUD_DrawBossHealth(void) {
temp4 = sp3C + 6.0f;
temp5 = temp1 + 10.0f;
temp2 = OTRGetRectDimensionFromLeftEdgeCentered(temp2);
temp4 = OTRGetRectDimensionFromLeftEdgeCentered(temp4);
temp2 = OTRGetRectDimensionFromLeftEdgeForcedAspect(temp2, 4.0f/3);
temp4 = OTRGetRectDimensionFromLeftEdgeForcedAspect(temp4, 4.0f/3);
RCP_SetupDL(&gMasterDisp, SETUPDL_78_POINT);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
Lib_TextureRect_CI4(&gMasterDisp, D_1011A40, D_1011AB0, 32, 7, temp2, temp3, 1.0f, 1.0f);
f32 border = sp3C;
border = OTRGetRectDimensionFromLeftEdgeCentered(border);
border = OTRGetRectDimensionFromLeftEdgeForcedAspect(border, 4.0f/3);
RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT);
Lib_TextureRect_IA8(&gMasterDisp, D_1002040, 40, 12, border, temp1, 1.0f, 1.0f);
@ -3214,7 +3214,7 @@ void HUD_DrawBossHealth(void) {
if (D_801616C4 >= 0.88f) {
temp6 = sp3C + 8.0f;
temp7 = 101.0f - ((2200.0f / 69.0f) * D_801616C8) + temp1;
temp6 = OTRGetRectDimensionFromLeftEdgeCentered(temp6);
temp6 = OTRGetRectDimensionFromLeftEdgeForcedAspect(temp6, 4.0f/3);
if (D_801616C8 > 0.0f) {
// LTODO: FIX BOSS BAR
Lib_TextureRect_RGBA16(&gMasterDisp, D_Tex_800D99F8, 32, 32, temp6 + 0.5f, temp7, 0.2f, D_801616C8);
@ -3408,7 +3408,7 @@ void HUD_BombCounter_Draw(f32 x, f32 y) {
f32 temp_fv0;
f32 temp;
x = OTRGetDimensionFromRightEdgeCentered(x);
x = OTRGetDimensionFromRightEdgeForcedAspect(x, 4.0f/3);
// Max bombs
if (gBombCount[gPlayerNum] > 9) {
@ -5521,7 +5521,7 @@ void HUD_Score_Draw(f32 x, f32 y) {
f32 y1;
f32 xScale;
x = OTRGetRectDimensionFromLeftEdgeCentered(x);
x = OTRGetRectDimensionFromLeftEdgeForcedAspect(x, 4.0f/3);
if (gHitCount > gDisplayedHitCount) {
temp3 = gDisplayedHitCount + 1;

View File

@ -126,11 +126,11 @@ void Radio_PlayMessage(u16* msg, RadioCharacterId character) {
switch (gGameState) {
case GSTATE_TITLE:
gRadioPrintPosY = 176;
gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeCentered(85.0f);
gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeCentered(80.0f);
gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeForcedAspect(85.0f, 4.0f/3);
gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeForcedAspect(80.0f, 4.0f/3);
gRadioTextBoxPosY = 174.0f;
gRadioTextBoxScaleX = 4.63f;
gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeCentered(32.0f);
gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeForcedAspect(32.0f, 4.0f/3);
gRadioPortraitPosY = 174.0f;
break;
@ -146,11 +146,11 @@ void Radio_PlayMessage(u16* msg, RadioCharacterId character) {
case GSTATE_PLAY:
gRadioPrintPosY = 180;
gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeCentered(79.0f);
gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeCentered(74.0f);
gRadioPrintPosX = OTRGetRectDimensionFromLeftEdgeForcedAspect(79.0f, 4.0f/3);
gRadioTextBoxPosX = OTRGetRectDimensionFromLeftEdgeForcedAspect(74.0f, 4.0f/3);
gRadioTextBoxPosY = 178.0f;
gRadioTextBoxScaleX = 4.53f;
gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeCentered(26.0f);
gRadioPortraitPosX = OTRGetRectDimensionFromLeftEdgeForcedAspect(26.0f, 4.0f/3);
gRadioPortraitPosY = 178.0f;
break;
}
@ -712,12 +712,12 @@ void Radio_Draw(void) {
(gCurrentRadioPortrait != RCID_1000)) {
RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255);
Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeCentered(31.0f), 167, 1.0f, 1.0f, "DOWN");
Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeForcedAspect(31.0f, 4.0f/3), 167, 1.0f, 1.0f, "DOWN");
HUD_TeamDownWrench_Draw(1);
}
if (((gCurrentRadioPortrait != RCID_STATIC) && (gCurrentRadioPortrait != RCID_STATIC + 1)) &&
(gCurrentRadioPortrait != RCID_1000)) {
HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeCentered(22.0f), 165.0f, gTeamShields[idx]);
HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeForcedAspect(22.0f, 4.0f/3), 165.0f, gTeamShields[idx]);
}
}
@ -761,11 +761,11 @@ void Radio_Draw(void) {
(gCurrentRadioPortrait != RCID_STATIC + 1) && (gCurrentRadioPortrait != RCID_1000)) {
RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255);
Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeCentered(31.0f), 167, 1.0f, 1.0f, "DOWN");
Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeForcedAspect(31.0f, 4.0f/3), 167, 1.0f, 1.0f, "DOWN");
}
if (((gCurrentRadioPortrait != RCID_STATIC) && (gCurrentRadioPortrait != RCID_STATIC + 1)) &&
(gCurrentRadioPortrait != RCID_1000)) {
HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeCentered(22.0f), 165.0f, gActors[idx].health * 2.55f);
HUD_TeamShields_Draw(OTRGetRectDimensionFromLeftEdgeForcedAspect(22.0f, 4.0f/3), 165.0f, gActors[idx].health * 2.55f);
}
}
if (((gCurrentRadioPortrait != RCID_STATIC) && (gCurrentRadioPortrait != RCID_STATIC + 1)) &&

View File

@ -547,12 +547,12 @@ extern "C" float OTRGetDimensionFromRightEdge(float v) {
(gfx_native_dimensions.width - v));
}
extern "C" float OTRGetDimensionFromLeftEdgeCentered(float v) {
return (gfx_native_dimensions.width / 2 - gfx_native_dimensions.height / 2 + (v));
extern "C" float OTRGetDimensionFromLeftEdgeForcedAspect(float v, float aspectRatio) {
return (gfx_native_dimensions.width / 2 - gfx_native_dimensions.height / 2 * (aspectRatio > 0 ? aspectRatio : OTRGetAspectRatio()) + (v));
}
extern "C" float OTRGetDimensionFromRightEdgeCentered(float v) {
return (gfx_native_dimensions.width / 2 + gfx_native_dimensions.height / 2 -
extern "C" float OTRGetDimensionFromRightEdgeForcedAspect(float v, float aspectRatio) {
return (gfx_native_dimensions.width / 2 + gfx_native_dimensions.height / 2 * (aspectRatio > 0 ? aspectRatio : OTRGetAspectRatio()) -
(gfx_native_dimensions.width - v));
}
// Gets the width of the current render target area
@ -573,12 +573,12 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
return ((int) ceilf(OTRGetDimensionFromRightEdge(v)));
}
extern "C" int16_t OTRGetRectDimensionFromLeftEdgeCentered(float v) {
return ((int) floorf(OTRGetDimensionFromLeftEdgeCentered(v)));
extern "C" int16_t OTRGetRectDimensionFromLeftEdgeForcedAspect(float v, float aspectRatio) {
return ((int) floorf(OTRGetDimensionFromLeftEdgeForcedAspect(v, aspectRatio)));
}
extern "C" int16_t OTRGetRectDimensionFromRightEdgeCentered(float v) {
return ((int) ceilf(OTRGetDimensionFromRightEdgeCentered(v)));
extern "C" int16_t OTRGetRectDimensionFromRightEdgeForcedAspect(float v, float aspectRatio) {
return ((int) ceilf(OTRGetDimensionFromRightEdgeForcedAspect(v, aspectRatio)));
}
extern "C" int32_t OTRConvertHUDXToScreenX(int32_t v) {

View File

@ -59,10 +59,10 @@ float OTRGetDimensionFromLeftEdge(float v);
float OTRGetDimensionFromRightEdge(float v);
int16_t OTRGetRectDimensionFromLeftEdge(float v);
int16_t OTRGetRectDimensionFromRightEdge(float v);
float OTRGetDimensionFromLeftEdgeCentered(float v);
float OTRGetDimensionFromRightEdgeCentered(float v);
int16_t OTRGetRectDimensionFromLeftEdgeCentered(float v);
int16_t OTRGetRectDimensionFromRightEdgeCentered(float v);
float OTRGetDimensionFromLeftEdgeForcedAspect(float v, float aspectRatio);
float OTRGetDimensionFromRightEdgeForcedAspect(float v, float aspectRatio);
int16_t OTRGetRectDimensionFromLeftEdgeForcedAspect(float v, float aspectRatio);
int16_t OTRGetRectDimensionFromRightEdgeForcedAspect(float v, float aspectRatio);
uint32_t OTRGetGameRenderWidth();
uint32_t OTRGetGameRenderHeight();
void* GameEngine_Malloc(size_t size);