From cd1800de35e15b335cdcc4a620f35845028b798c Mon Sep 17 00:00:00 2001 From: Ilya Shurumov Date: Mon, 16 Nov 2020 23:15:28 +0600 Subject: [PATCH] - HUD overlays to support widescreen mapping (configurable) --- src_rebuild/GAME/C/MOTION_C.C | 5 ++--- src_rebuild/GAME/C/OVERLAY.C | 39 +++++++++++++++++++++++++++++---- src_rebuild/GAME/C/OVERLAY.H | 2 ++ src_rebuild/GAME/C/PAUSE.C | 4 ++-- src_rebuild/redriver2_psxpc.cpp | 3 +++ 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src_rebuild/GAME/C/MOTION_C.C b/src_rebuild/GAME/C/MOTION_C.C index 75a62a95..c27a6d8f 100644 --- a/src_rebuild/GAME/C/MOTION_C.C +++ b/src_rebuild/GAME/C/MOTION_C.C @@ -5,7 +5,6 @@ #include "STRINGS.H" #include "MISSION.H" #include "TEXTURE.H" -#include "OVERMAP.H" #include "CAMERA.H" #include "SHADOW.H" #include "DEBRIS.H" @@ -14,8 +13,8 @@ #include "SKY.H" #include "PLAYERS.H" #include "MAIN.H" -#include "MOTION_C.H" -#include "CONVERT.H" + +#include "CARS.H" #include "INLINE_C.H" diff --git a/src_rebuild/GAME/C/OVERLAY.C b/src_rebuild/GAME/C/OVERLAY.C index 9e0c5ce2..083403a1 100644 --- a/src_rebuild/GAME/C/OVERLAY.C +++ b/src_rebuild/GAME/C/OVERLAY.C @@ -16,6 +16,10 @@ #include "FELONY.H" #include "SCORES.H" +#ifndef PSX +#include "EMULATOR.H" +#endif + COLOUR_BAND felonyColour[3] = { { { 0, 0, 255, 0 }, 0, 0 }, @@ -59,20 +63,26 @@ PERCENTAGE_BAR FelonyBar; PERCENTAGE_BAR ProxyBar; int gDoOverlays = 1; - +int gWidescreenHudAlignment = 0; // [A] custom widescreen alignment by PSX hack #define PERCENTAGE_BAR_WIDTH 102 #define PERCENTAGE_BAR_HEIGHT 10 -const int gOverlayXPos = 16; -const int gOverlayXOppPos = 208; // 320 - 16 - PERCENTAGE_BAR_WIDTH; - +// [A] +int gOverlayXPos = 16; +int gOverlayXOppPos = 208; // [D] [T] void InitOverlays(void) { gDoOverlays = 1; + // [A] init defaults + gOverlayXPos = 16; + gOverlayXOppPos = 208; + gMapXOffset = 249; + gMapYOffset = 181; + InitPercentageBar(&PlayerDamageBar, MaxPlayerDamage[0], playerDamageColour, "Damage"); PlayerDamageBar.xpos = gOverlayXPos; @@ -162,6 +172,27 @@ void DisplayOverlays(void) if (!gDoOverlays) return; +#ifndef PSX + if(gWidescreenHudAlignment) + { + // align to PSX-mapped screen coordinates + RECT16 emuViewport; + Emulator_GetPSXWidescreenMappedViewport(emuViewport); + + // recalc pos + gOverlayXPos = 16 + emuViewport.x; + gOverlayXOppPos = emuViewport.w - 16 - PERCENTAGE_BAR_WIDTH; + gMapXOffset = emuViewport.w - 16 - MAP_SIZE_W; + + // set up + PlayerDamageBar.xpos = gOverlayXPos; + Player2DamageBar.xpos = gOverlayXPos; + FelonyBar.xpos = gOverlayXPos; + DamageBar.xpos = gOverlayXOppPos; + ProxyBar.xpos = gOverlayXPos; + } +#endif + DrawPercentageBar(&PlayerDamageBar); DrawPercentageBar(&Player2DamageBar); DrawPercentageBar(&DamageBar); diff --git a/src_rebuild/GAME/C/OVERLAY.H b/src_rebuild/GAME/C/OVERLAY.H index e8d32dc0..003f6996 100644 --- a/src_rebuild/GAME/C/OVERLAY.H +++ b/src_rebuild/GAME/C/OVERLAY.H @@ -7,6 +7,8 @@ extern PERCENTAGE_BAR DamageBar; extern PERCENTAGE_BAR FelonyBar; extern PERCENTAGE_BAR ProxyBar; +extern int gWidescreenHudAlignment; + extern char OverlayFlashValue; extern void InitOverlays(); // 0x00014A58 diff --git a/src_rebuild/GAME/C/PAUSE.C b/src_rebuild/GAME/C/PAUSE.C index c23b5a3e..1fff152b 100644 --- a/src_rebuild/GAME/C/PAUSE.C +++ b/src_rebuild/GAME/C/PAUSE.C @@ -274,9 +274,9 @@ MENU_ITEM MainPauseItems[] = { NULL, 128u, 0u, NULL, MENU_QUIT_NONE, NULL } }; -MENU_ITEM MultiplayerPauseItems[7] = +MENU_ITEM MultiplayerPauseItems[] = { - { "Resume", 1u, 2u, NULL, MENU_QUIT_CONTINUE, NULL }, + { "Continue", 1u, 2u, NULL, MENU_QUIT_CONTINUE, NULL }, { "Restart", 65u, 2u, NULL, MENU_QUIT_NONE, &YesNoRestartHeader }, { "Sfx Volume", 13u, 2u, (pauseFunc)&SfxVolume, MENU_QUIT_NONE, NULL }, { "Music Volume", 21u, 2u, (pauseFunc)&MusicVolume, MENU_QUIT_NONE, NULL }, diff --git a/src_rebuild/redriver2_psxpc.cpp b/src_rebuild/redriver2_psxpc.cpp index d4e29f10..2966a165 100644 --- a/src_rebuild/redriver2_psxpc.cpp +++ b/src_rebuild/redriver2_psxpc.cpp @@ -16,6 +16,7 @@ #include #include "C/CUTSCENE.H" +#include "C/OVERLAY.H" // eq engine console output @@ -426,6 +427,8 @@ int main(int argc, char** argv) ini_sget(config, "game", "drawDistance", "%d", &gDrawDistance); ini_sget(config, "game", "freeCamera", "%d", &enableFreecamera); ini_sget(config, "game", "driver1music", "%d", &gDriver1Music); + ini_sget(config, "game", "widescreenHUD", "%d", &gWidescreenHudAlignment); + if (dataFolderStr) {