Skip to content

Commit

Permalink
bb .ini hello defines
Browse files Browse the repository at this point in the history
  • Loading branch information
Fire-Head committed Jan 8, 2021
1 parent 148383f commit 368d2f3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 78 deletions.
15 changes: 3 additions & 12 deletions src/core/Radar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,21 +1297,12 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i
} else
#endif
{
#ifdef ASPECT_RATIO_SCALE
// The values are from an early screenshot taken before R* broke radar
#define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH))
#define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT))
#else
#define _RADAR_WIDTH RADAR_WIDTH
#define _RADAR_HEIGHT RADAR_HEIGHT
#endif

#ifdef FIX_BUGS
out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(_RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
#else
out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(_RADAR_WIDTH) + RADAR_LEFT;
out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
#endif
out.y = (1.0f - in.y) * 0.5f * SCREEN_SCALE_Y(_RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + _RADAR_HEIGHT);
out.y = (1.0f - in.y) * 0.5f * SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
}
}

Expand Down
18 changes: 18 additions & 0 deletions src/core/Radar.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,26 @@ VALIDATE_SIZE(sRadarTrace, 0x30);
#else
#define RADAR_BOTTOM (47.0f)
#endif

#ifdef FIX_RADAR
/*
The values are from an early screenshot taken before R* broke radar
*/
#define RADAR_WIDTH (82.0f)
#define RADAR_HEIGHT (82.0f)
#else
/*
broken since forever, someone tried to fix size for 640x512(PAL)
http://aap.rockstarvision.com/pics/gta3/ps2screens/gta3_interface.jpg
but failed:
http://aap.rockstarvision.com/pics/gta3/artwork/gta3_artwork_16.jpg
most likely the guy used something like this:
int y = 82 * (640.0/512.0)/(640.0/480.0);
int x = y * (640.0/512.0);
*/
#define RADAR_WIDTH (94.0f)
#define RADAR_HEIGHT (76.0f)
#endif

class CRadar
{
Expand Down
6 changes: 1 addition & 5 deletions src/core/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#include "skeleton.h"
#include "Draw.h"

#if defined(ASPECT_RATIO_SCALE)
#if defined(PROPER_SCALING) || defined(PS2_HUD)
#ifdef FORCE_PC_SCALING
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448)
Expand Down Expand Up @@ -176,10 +176,6 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#ifdef ASPECT_RATIO_SCALE
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
#define SCALE_AND_CENTER_X(x) ((SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) ? (x) : (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X((x)))
#ifndef FORCE_PC_SCALING
#undef SCREEN_SCALE_Y
#define SCREEN_SCALE_Y(a) CDraw::ScaleY(SCREEN_STRETCH_Y(a))
#endif
#else
#define SCREEN_SCALE_AR(a) (a)
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
Expand Down
4 changes: 4 additions & 0 deletions src/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ enum Config {
//# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
// NB: keep this enabled unless your map IDEs have these flags baked in
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio).
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
#define PS2_ALPHA_TEST // emulate ps2 alpha test
Expand All @@ -254,6 +255,8 @@ enum Config {
#define SCREEN_DROPLETS // neo water droplets
#endif

#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)

#ifndef EXTENDED_COLOURFILTER
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
#endif
Expand Down Expand Up @@ -282,6 +285,7 @@ enum Config {
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
// #define BETA_SLIDING_TEXT
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define FIX_RADAR // use radar size from early version before R* broke it
// #define XBOX_SUBTITLES // the infamous outlines
#define RADIO_OFF_TEXT
#define PC_MENU
Expand Down
12 changes: 0 additions & 12 deletions src/core/re3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ void LoadINISettings()
CustomPipes::LightmapMult = CheckAndReadIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult);
CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
#endif

#ifdef ASPECT_RATIO_SCALE
CDraw::ms_nScalingMode = CheckAndReadIniInt("Draw", "ScalingMode", CDraw::ms_nScalingMode);
CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar);
CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSpritesAspectRatio", CDraw::ms_bFixSprites);
#endif
}

void SaveINISettings()
Expand Down Expand Up @@ -259,12 +253,6 @@ void SaveINISettings()
CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed);
#endif

#ifdef ASPECT_RATIO_SCALE
CheckAndSaveIniInt("Draw", "ScalingMode", CDraw::ms_nScalingMode, changed);
CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed);
CheckAndSaveIniInt("Draw", "FixSpritesAspectRatio", CDraw::ms_bFixSprites, changed);
#endif

if (changed)
cfg.write_file("re3.ini");
}
Expand Down
20 changes: 1 addition & 19 deletions src/render/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ uint8 CDraw::FadeRed;
uint8 CDraw::FadeGreen;
uint8 CDraw::FadeBlue;

#ifdef ASPECT_RATIO_SCALE
int32 CDraw::ms_nScalingMode = SCL_PS2;
int32 CDraw::ms_bFixRadar = true;
int32 CDraw::ms_bFixSprites = true;
#endif

float
CDraw::FindAspectRatio(void)
{
Expand Down Expand Up @@ -81,16 +75,4 @@ CDraw::SetFOV(float fov)
ms_fScaledFOV = fov;
#endif
ms_fFOV = fov;
}

#ifdef ASPECT_RATIO_SCALE
float CDraw::ScaleY(float y)
{
switch ( ms_nScalingMode )
{
case SCL_PC: return y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC);
default:
return y;
}
}
#endif
}
15 changes: 0 additions & 15 deletions src/render/Draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ enum eAspectRatio
AR_MAX,
};

enum eSpriteScalingMode
{
SCL_PC,
SCL_PS2,
};

class CDraw
{
private:
Expand All @@ -40,11 +34,6 @@ class CDraw
static uint8 FadeRed;
static uint8 FadeGreen;
static uint8 FadeBlue;
#ifdef ASPECT_RATIO_SCALE
static int32 ms_nScalingMode;
static int32 ms_bFixRadar;
static int32 ms_bFixSprites;
#endif

static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; }
static float GetNearClipZ(void) { return ms_fNearClipZ; }
Expand All @@ -67,8 +56,4 @@ class CDraw
#else
static float GetAspectRatio(void) { return FindAspectRatio(); }
#endif

#ifdef ASPECT_RATIO_SCALE
static float ScaleY(float y);
#endif
};
12 changes: 2 additions & 10 deletions src/render/Hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,18 +1059,10 @@ void CHud::Draw()
/*
DrawRadar
*/
#ifdef ASPECT_RATIO_SCALE
// The values are from an early screenshot taken before R* broke radar
#define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH))
#define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT))
#else
#define _RADAR_WIDTH RADAR_WIDTH
#define _RADAR_HEIGHT RADAR_HEIGHT
#endif
if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) {
CRadar::DrawMap();
CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(_RADAR_WIDTH), SCREEN_SCALE_Y(_RADAR_HEIGHT));
rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + _RADAR_HEIGHT));
CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT));
rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));

#ifdef PS2_HUD
#ifdef FIX_BUGS
Expand Down
9 changes: 4 additions & 5 deletions src/render/Sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
// this is used to scale correctly if you zoom in with sniper rifle
float fovScale = fov / CDraw::GetFOV();

#ifdef FIX_SPRITES
*outw = fovScale * recip * SCREEN_HEIGHT;
#else
*outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH;
*outh = fovScale * recip * SCREEN_HEIGHT;

#ifdef ASPECT_RATIO_SCALE
if ( CDraw::ms_bFixSprites )
*outw = fovScale * recip * SCREEN_HEIGHT;
#endif
*outh = fovScale * recip * SCREEN_HEIGHT;

return true;
}
Expand Down

0 comments on commit 368d2f3

Please sign in to comment.