- HUD overlays to support widescreen mapping (configurable)

This commit is contained in:
Ilya Shurumov 2020-11-16 23:15:28 +06:00
parent d8bd8840f1
commit cd1800de35
5 changed files with 44 additions and 9 deletions

View File

@ -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"

View File

@ -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);

View File

@ -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

View File

@ -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 },

View File

@ -16,6 +16,7 @@
#include <SDL_scancode.h>
#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)
{