From ca8851789a21dae69aa0c03cd5043446fba46a1e Mon Sep 17 00:00:00 2001 From: fgsfds Date: Fri, 22 Sep 2023 20:26:32 +0200 Subject: [PATCH] port: add centered HUD mode set Game.CenterHUD=1 in pd.ini to enable --- port/src/main.c | 7 ++++++- src/game/bondgun.c | 6 +++--- src/game/game_1531a0.c | 5 +++++ src/game/hudmsg.c | 6 +++--- src/game/radar.c | 2 +- src/include/data.h | 4 +++- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/port/src/main.c b/port/src/main.c index 47cc173d3..b92377ba8 100644 --- a/port/src/main.c +++ b/port/src/main.c @@ -72,9 +72,14 @@ static void gameLoadConfig(void) g_PlayerMouseAimMode = configGetIntClamped("Game.MouseAimMode", g_PlayerMouseAimMode, 0, 1); g_PlayerMouseAimSpeedX = configGetFloatClamped("Game.MouseAimSpeedX", g_PlayerMouseAimSpeedX, 0.f, 10.f); g_PlayerMouseAimSpeedY = configGetFloatClamped("Game.MouseAimSpeedY", g_PlayerMouseAimSpeedY, 0.f, 10.f); - g_ViShakeIntensityMult = configGetFloatClamped("Game.ScreenShakeIntensity", 1.f, 0.f, 100.f); g_PlayerFovAffectsZoom = configGetIntClamped("Game.FovAffectsZoom", g_PlayerFovAffectsZoom, 0, 1); g_PlayerFovZoomMultiplier = g_PlayerFovAffectsZoom ? g_PlayerDefaultFovY / 60.0f : 1.0f; + g_ViShakeIntensityMult = configGetFloatClamped("Game.ScreenShakeIntensity", 1.f, 0.f, 100.f); + const s32 center = configGetIntClamped("Game.CenterHUD", 0, 0, 1); + if (center) { + g_HudAlignModeL = G_ASPECT_CENTER_EXT; + g_HudAlignModeR = G_ASPECT_CENTER_EXT; + } } int main(int argc, const char **argv) diff --git a/src/game/bondgun.c b/src/game/bondgun.c index f342ffbb5..4a82c481d 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -12741,7 +12741,7 @@ Gfx *bgunDrawHud(Gfx *gdl) #ifndef PLATFORM_N64 if (playercount < 2) { - gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_RIGHT_EXT); + gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR); } #endif @@ -12995,7 +12995,7 @@ Gfx *bgunDrawHud(Gfx *gdl) #ifndef PLATFORM_N64 if (playercount < 2) { - gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_LEFT_EXT); + gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeL); } #endif @@ -13035,7 +13035,7 @@ Gfx *bgunDrawHud(Gfx *gdl) #ifndef PLATFORM_N64 if (playercount < 2) { - gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_RIGHT_EXT); + gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR); } #endif diff --git a/src/game/game_1531a0.c b/src/game/game_1531a0.c index e4082a6e2..a28ff87ee 100644 --- a/src/game/game_1531a0.c +++ b/src/game/game_1531a0.c @@ -142,6 +142,11 @@ u32 var8007fbbc = 0x0000003c; u32 var8007fbc0 = 0x44444400; u32 var8007fbc4 = 0xffffff00; +#ifndef PLATFORM_N64 +u32 g_HudAlignModeL = G_ASPECT_LEFT_EXT; +u32 g_HudAlignModeR = G_ASPECT_RIGHT_EXT; +#endif + void textInit(void) { // empty diff --git a/src/game/hudmsg.c b/src/game/hudmsg.c index 64ca1ea5d..aad03591c 100644 --- a/src/game/hudmsg.c +++ b/src/game/hudmsg.c @@ -191,7 +191,7 @@ Gfx *hudmsgRenderMissionTimer(Gfx *gdl, u32 alpha) #ifndef PLATFORM_N64 if (PLAYERCOUNT() < 2) { - gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_LEFT_EXT); + gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeL); } #endif @@ -1456,9 +1456,9 @@ Gfx *hudmsgsRender(Gfx *gdl) #ifndef PLATFORM_N64 if (playercount < 2 && msg->state >= HUDMSGSTATE_FADINGIN) { if (msg->alignh == HUDMSGALIGN_SCREENLEFT || msg->alignh == HUDMSGALIGN_LEFT) { - gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_LEFT_EXT); + gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeL); } else if (msg->alignh == HUDMSGALIGN_RIGHT) { - gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_RIGHT_EXT); + gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR); } else { gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_CENTER_EXT); } diff --git a/src/game/radar.c b/src/game/radar.c index e13aa5e45..e963747ba 100644 --- a/src/game/radar.c +++ b/src/game/radar.c @@ -323,7 +323,7 @@ Gfx *radarRender(Gfx *gdl) g_RadarY -= 6; } #ifndef PLATFORM_N64 - gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, G_ASPECT_RIGHT_EXT); + gSPExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT, g_HudAlignModeR); #endif } diff --git a/src/include/data.h b/src/include/data.h index 190e3a831..d47d1090c 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -536,10 +536,12 @@ extern f32 g_PlayerDefaultFovY; extern s32 g_PlayerMouseAimMode; extern f32 g_PlayerMouseAimSpeedX; extern f32 g_PlayerMouseAimSpeedY; -extern f32 g_ViShakeIntensityMult; extern s32 g_PlayerFovAffectsZoom; extern f32 g_PlayerFovZoomMultiplier; +extern f32 g_ViShakeIntensityMult; extern u32 g_TexFilter2D; +extern u32 g_HudAlignModeL; +extern u32 g_HudAlignModeR; #define TEX_FILTER_2D g_TexFilter2D #define ADJUST_ZOOM_FOV(x) ((x) * g_PlayerFovZoomMultiplier)