Skip to content

Commit

Permalink
port: add centered HUD mode
Browse files Browse the repository at this point in the history
set Game.CenterHUD=1 in pd.ini to enable
  • Loading branch information
fgsfdsfgs committed Sep 22, 2023
1 parent 205032c commit ca88517
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
7 changes: 6 additions & 1 deletion port/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/game/bondgun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions src/game/game_1531a0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/game/hudmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/radar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 3 additions & 1 deletion src/include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ca88517

Please sign in to comment.