From a0ed9a8b8217b4855a78264c5f999e0ccaf40444 Mon Sep 17 00:00:00 2001 From: InspirationByte Date: Sun, 30 Jan 2022 11:48:02 +0300 Subject: [PATCH] - correct HUD constants based on screen height --- src_rebuild/Game/C/cutscene.c | 2 +- src_rebuild/Game/C/overmap.c | 41 ++++++++++++++++++----------------- src_rebuild/Game/C/system.c | 11 +--------- src_rebuild/Game/C/system.h | 27 +++++++++++++---------- 4 files changed, 39 insertions(+), 42 deletions(-) diff --git a/src_rebuild/Game/C/cutscene.c b/src_rebuild/Game/C/cutscene.c index 994160b3..1e5451e4 100644 --- a/src_rebuild/Game/C/cutscene.c +++ b/src_rebuild/Game/C/cutscene.c @@ -284,7 +284,7 @@ void DrawInGameCutscene(void) tile->w = 1200; #endif - tile->y0 = draw_mode.height - BlackBorderHeight; + tile->y0 = SCREEN_H - BlackBorderHeight; tile->h = BlackBorderHeight; addPrim(current->ot, tile); diff --git a/src_rebuild/Game/C/overmap.c b/src_rebuild/Game/C/overmap.c index 01fd3a61..35becc11 100644 --- a/src_rebuild/Game/C/overmap.c +++ b/src_rebuild/Game/C/overmap.c @@ -696,9 +696,13 @@ void DrawBigCompass(VECTOR *root, int angle) // [D] [T] void CopIndicator(int xpos, int strength) { + int startH, endH; int str2; POLY_F3 *poly; + startH = SCREEN_H; + endH = SCREEN_H - 30; + if (strength > 255) strength = 255; @@ -714,11 +718,11 @@ void CopIndicator(int xpos, int strength) poly->g0 = str2; poly->b0 = str2; poly->x0 = xpos - 12; - poly->y0 = 256; + poly->y0 = startH; poly->x1 = xpos; - poly->y1 = 226; + poly->y1 = endH; poly->x2 = xpos + 12; - poly->y2 = 256; + poly->y2 = startH; addPrim(current->ot + 1, poly); current->primptr += sizeof(POLY_F3); @@ -737,10 +741,10 @@ void CopIndicator(int xpos, int strength) poly->b0 = str2; poly->x0 = xpos - 12; - poly->y0 = 256; - poly->y1 = 226; + poly->y0 = startH; + poly->y1 = endH; poly->x2 = xpos + 12; - poly->y2 = 256; + poly->y2 = startH; poly->x1 = xpos; addPrim(current->ot + 1, poly); @@ -904,14 +908,13 @@ void InitMultiplayerMap(void) // [D] [T] void InitOverheadMap(void) { - int d; - int c; + int c, d; int tpage; if (NumPlayers > 1) - gMapYOffset = 96; + gMapYOffset = (SCREEN_H - MAP_SIZE_H) / 2 - 2;// 96; else - gMapYOffset = draw_mode.height - MAP_SIZE_H - 15; //181; + gMapYOffset = SCREEN_H - MAP_SIZE_H - 15; //181; if (gMultiplayerLevels) { @@ -991,17 +994,15 @@ void DrawMultiplayerMap(void) int i; u_char g; u_char r; - int yPos; + int xPos, yPos; VECTOR target; int px, py; map_x_offset = 0; map_z_offset = 0; - if (NumPlayers == 1) - yPos = gMapYOffset; - else - yPos = 96; + xPos = gMapXOffset; + yPos = gMapYOffset; DrawMultiplayerTargets(); @@ -1019,7 +1020,7 @@ void DrawMultiplayerMap(void) WorldToMultiplayerMap(&target, &target); - target.vx += gMapXOffset; + target.vx += xPos; target.vz += yPos; DrawPlayerDot(&target, -pl->dir, r, g, 0, 0x8); @@ -1035,12 +1036,12 @@ void DrawMultiplayerMap(void) setPolyFT4(poly); setSemiTrans(poly, 1); - poly->x0 = gMapXOffset; + poly->x0 = xPos; poly->y0 = yPos; - poly->x1 = gMapXOffset + MAP_SIZE_W; + poly->x1 = xPos + MAP_SIZE_W; poly->y1 = yPos; - poly->x2 = gMapXOffset; - poly->x3 = gMapXOffset + MAP_SIZE_W; + poly->x2 = xPos; + poly->x3 = xPos + MAP_SIZE_W; poly->y2 = yPos + 64; poly->y3 = yPos + 64; diff --git a/src_rebuild/Game/C/system.c b/src_rebuild/Game/C/system.c index 4fb7ccc6..ac185f3d 100644 --- a/src_rebuild/Game/C/system.c +++ b/src_rebuild/Game/C/system.c @@ -718,15 +718,6 @@ void UpdatePadData(void) #endif } -#define SCREEN_FB 512 -#define SCREEN_FB_H 256 - -#ifdef PAL_VERSION -#define SCREEN_H 256 -#else -#define SCREEN_H 240 -#endif` - // [D] [T] void SetupDrawBuffers(void) { @@ -810,7 +801,7 @@ void SetupDrawBufferData(int num_players) if (toggle) { otpt = (u_long*)_OT2; - primpt = (u_char*)_primTab2; // _primTab1 + 0x1E000 + primpt = (u_char*)_primTab2; // _primTab1 + PRIMTAB_SIZE } else { diff --git a/src_rebuild/Game/C/system.h b/src_rebuild/Game/C/system.h index d0980d8b..259a54cb 100644 --- a/src_rebuild/Game/C/system.h +++ b/src_rebuild/Game/C/system.h @@ -112,13 +112,26 @@ struct DB DISPENV disp; }; -extern DRAW_MODE draw_mode_pal; -extern DRAW_MODE draw_mode_ntsc; - extern DB MPBuff[2][2]; extern DB* last; extern DB* current; +extern DRAW_MODE draw_mode_pal; +extern DRAW_MODE draw_mode_ntsc; + +#define SCREEN_FB 512 +#define SCREEN_FB_H 256 + +#ifdef PAL_VERSION +#define SCREEN_H 256 +#define draw_mode draw_mode_pal +#define video_mode MODE_PAL +#else +#define SCREEN_H 240 +#define draw_mode draw_mode_ntsc +#define video_mode MODE_NTSC +#endif // PAL + // ordering table size #ifdef PSX #define OTSIZE 0x1080 @@ -140,14 +153,6 @@ extern DB* current; extern int citystart[8]; extern XYPAIR citylumps[8][4]; -#ifdef PAL_VERSION -#define draw_mode draw_mode_pal -#define video_mode MODE_PAL -#else -#define draw_mode draw_mode_ntsc -#define video_mode MODE_NTSC -#endif // PAL - #define CDSECTOR_SIZE 2048 extern void ClearMem(char *mem, int size); // 0x0007F3E8