summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-03 13:13:55 +0200
committeraap <aap@papnet.eu>2019-07-03 13:13:55 +0200
commit25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c (patch)
tree32f12eb5067af7c6ec08d16b2675a426096a9ad9
parentMerge pull request #90 from GTAmodding/revert-88-master (diff)
downloadre3-25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c.tar
re3-25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c.tar.gz
re3-25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c.tar.bz2
re3-25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c.tar.lz
re3-25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c.tar.xz
re3-25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c.tar.zst
re3-25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c.zip
-rw-r--r--src/Radar.cpp4
-rw-r--r--src/common.h40
-rw-r--r--src/config.h52
-rw-r--r--src/main.cpp40
-rw-r--r--src/render/Draw.cpp34
-rw-r--r--src/render/Draw.h20
-rw-r--r--src/render/Hud.cpp4
-rw-r--r--src/render/Sprite.cpp66
-rw-r--r--src/skel/win/win.cpp42
-rw-r--r--src/skel/win/win.h4
10 files changed, 172 insertions, 134 deletions
diff --git a/src/Radar.cpp b/src/Radar.cpp
index ec02144e..a071b96b 100644
--- a/src/Radar.cpp
+++ b/src/Radar.cpp
@@ -899,8 +899,8 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
// Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0)
void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
{
- // FIX: game doesn't scale RADAR_LEFT here
- out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
+ // FIX? scale RADAR_LEFT here somehow
+ out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
}
diff --git a/src/common.h b/src/common.h
index f959de42..7f304e90 100644
--- a/src/common.h
+++ b/src/common.h
@@ -67,27 +67,37 @@ extern void **rwengine;
In theory should look good on any screen.
*/
+#define DEFAULT_SCREEN_WIDTH (640)
+#define DEFAULT_SCREEN_HEIGHT (448)
+#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
+
+// game uses maximumWidth/Height, but this probably won't work
+// with RW windowed mode
+// TODO: get rid of one of the two
+#define SCREENW (RsGlobal.width)
+#define SCREENH (RsGlobal.height)
+#define SCREEN_WIDTH ((float)RsGlobal.width)
+#define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
-#define SCREENW (RsGlobal.maximumWidth)
-#define SCREENH (RsGlobal.maximumHeight)
+// This scales from PS2 pixel coordinates to the real resolution
+#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)
+#define SCREEN_STRETCH_Y(a) ((a) * (float) SCREEN_HEIGHT / DEFAULT_SCREEN_HEIGHT)
+#define SCREEN_STRETCH_FROM_RIGHT(a) (SCREEN_WIDTH - SCREEN_STRETCH_X(a))
+#define SCREEN_STRETCH_FROM_BOTTOM(a) (SCREEN_HEIGHT - SCREEN_STRETCH_Y(a))
-#define DEFAULT_SCREEN_WIDTH (640)
-#define DEFAULT_SCREEN_HEIGHT (448)
-#define SCREEN_WIDTH float(RsGlobal.width)
-#define SCREEN_HEIGHT float(RsGlobal.height)
-#define SCREEN_STRETCH_X(a) float((a) * (SCREEN_WIDTH / float(DEFAULT_SCREEN_WIDTH)))
-#define SCREEN_STRETCH_Y(a) float((a) * (SCREEN_HEIGHT / float(DEFAULT_SCREEN_HEIGHT)))
-#define SCREEN_STRETCH_FROM_RIGHT(a) float(SCREEN_WIDTH - SCREEN_STRETCH_X(a))
-#define SCREEN_STRETCH_FROM_BOTTOM(a) float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a))
-
-#define SCREEN_MULTIPLIER (CDraw::GetScreenMult())
-#define SCREEN_SCALE(a) float((a) * (4.0f / 3.0f) / SCREEN_ASPECT_RATIO)
-#define SCREEN_SCALE_X(a) SCREEN_SCALE(SCREEN_STRETCH_X(a) * SCREEN_MULTIPLIER)
-#define SCREEN_SCALE_Y(a) (SCREEN_STRETCH_Y(a) * SCREEN_MULTIPLIER)
+// This scales from PS2 pixel coordinates while optionally maintaining the aspect ratio
+#define SCREEN_SCALE_X(a) SCREEN_SCALE_AR(SCREEN_STRETCH_X(a))
+#define SCREEN_SCALE_Y(a) SCREEN_STRETCH_Y(a)
#define SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - SCREEN_SCALE_X(a))
#define SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - SCREEN_SCALE_Y(a))
+#ifdef ASPECT_RATIO_SCALE
+#define SCREEN_SCALE_AR(a) ((a) * (4.0f / 3.0f) / SCREEN_ASPECT_RATIO)
+#else
+#define SCREEN_SCALE_AR(a) (a)
+#endif
+
#include "math/Vector.h"
#include "math/Vector2D.h"
#include "math/Matrix.h"
diff --git a/src/config.h b/src/config.h
index b43a3a9f..a753b678 100644
--- a/src/config.h
+++ b/src/config.h
@@ -62,20 +62,52 @@ enum Config {
NUMPICKUPS = 336,
};
+
// We don't expect to compile for PS2 or Xbox
// but it might be interesting for documentation purposes
#define GTA_PC
//#define GTA_PS2
//#define GTA_XBOX
-#define GTA3_1_1_PATCH
-#define USE_PS2_RAND
-#define RANDOMSPLASH
-#define CHATTYSPLASH
-//#define FIX_BUGS
-//#define NO_CDCHECK
-#define NO_MOVIES
-//#define USE_MY_DOCUMENTS
-#define NASTY_GAME
-#define PS2_MATFX
+// This enables things from the PS2 version on PC
+#define GTA_PS2_STUFF
+
+// This is enabled for all released games.
+// any debug stuff that isn't left in any game is not in FINAL
+//#define FINAL
+
+// This is enabled for all released games except mobile
+// any debug stuff that is only left in mobile, is not in MASTER
+//#define MASTER
+
+#if defined GTA_PS2
+# define RANDOMSPLASH
+#elif defined GTA_PC
+# define GTA3_1_1_PATCH
+# ifdef GTA_PS2_STUFF
+# define USE_PS2_RAND
+# define RANDOMSPLASH // use random splash as on PS2
+# define PS2_MATFX
+# endif
+#elif defined GTA_XBOX
+#endif
+
+#ifdef MASTER
+ // only in master builds
+#else
+ // not in master builds
+#endif
+
+#ifdef FINAL
+ // in all games
+# define USE_MY_DOCUMENTS // use my documents directory for user files
+#else
+ // not in any game
+# define NASTY_GAME // nasty game for all languages
+# define NO_MOVIES // disable intro videos
+# define CHATTYSPLASH // print what the game is loading
+#endif
+
+#define FIX_BUGS // fix bugs in the game, TODO: use this more
#define KANGAROO_CHEAT
+#define ASPECT_RATIO_SCALE
diff --git a/src/main.cpp b/src/main.cpp
index 307d0b66..de3d8b62 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -48,14 +48,8 @@
#include "RpAnimBlend.h"
#include "Frontend.h"
-#define DEFAULT_VIEWWINDOW (tan(CDraw::GetFOV() * (360.0f / PI)))
+#define DEFAULT_VIEWWINDOW (tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
-#ifdef WIDE_SCREEN
-#define DEFAULT_ASPECTRATIO (16.0f/9.0f)
-#else
-#define DEFAULT_ASPECTRATIO (4.0f/3.0f)
-#endif
-
GlobalScene &Scene = *(GlobalScene*)0x726768;
@@ -100,6 +94,10 @@ InitialiseGame(void)
void
Idle(void *arg)
{
+#ifdef ASPECT_RATIO_SCALE
+ CDraw::SetAspectRatio(CDraw::FindAspectRatio());
+#endif
+
CTimer::Update();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -160,9 +158,8 @@ Idle(void *arg)
Render2dStuff();
}else{
- float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
- CDraw::CalculateAspectRatio();
- CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
+ float viewWindow = DEFAULT_VIEWWINDOW;
+ CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@@ -170,7 +167,9 @@ Idle(void *arg)
}
RenderMenus();
+#ifndef FINAL
PrintGameVersion();
+#endif
DoFade();
Render2dStuffAfterFade();
CCredits::Render();
@@ -183,6 +182,10 @@ Idle(void *arg)
void
FrontendIdle(void)
{
+#ifdef ASPECT_RATIO_SCALE
+ CDraw::SetAspectRatio(CDraw::FindAspectRatio());
+#endif
+
CTimer::Update();
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
@@ -193,9 +196,8 @@ FrontendIdle(void)
if(RsGlobal.quit)
return;
- float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
- CDraw::CalculateAspectRatio();
- CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
+ float viewWindow = DEFAULT_VIEWWINDOW;
+ CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@@ -203,7 +205,9 @@ FrontendIdle(void)
DefinedState();
RenderMenus();
+#ifndef FINAL
PrintGameVersion();
+#endif
DoFade();
Render2dStuffAfterFade();
CFont::DrawFonts();
@@ -216,9 +220,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
- float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
- CDraw::CalculateAspectRatio();
- CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
+ CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@@ -236,9 +238,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
- float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
- CDraw::CalculateAspectRatio();
- CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
+ CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@@ -782,7 +782,7 @@ AppEventHandler(RsEvent event, void *param)
{
CameraSize(Scene.camera, (RwRect *)param,
- DEFAULT_VIEWWINDOW, DEFAULT_ASPECTRATIO);
+ DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
return rsEVENTPROCESSED;
}
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index 90875299..922d96d4 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -4,8 +4,9 @@
#include "Frontend.h"
#include "Camera.h"
-float CDraw::ms_fAspectRatio;
-float CDraw::ms_fScreenMultiplier;
+#ifdef ASPECT_RATIO_SCALE
+float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
+#endif
float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
@@ -16,26 +17,25 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
-void
-CDraw::CalculateAspectRatio()
+float
+CDraw::FindAspectRatio(void)
{
- SetScreenMult(DEFAULT_SCALE);
-
if(FrontEndMenuManager.m_PrefsUseWideScreen)
- ms_fAspectRatio = 16.0f/9.0f;
+ return 16.0f/9.0f;
else
- ms_fAspectRatio = 4.0f/3.0f;
+ return 4.0f/3.0f;
}
-static float hFov2vFov(float hfov)
+// convert a 4:3 hFOV to vFOV,
+// then convert that vFOV to hFOV for our aspect ratio,
+// i.e. HOR+
+float
+CDraw::ConvertFOV(float hfov)
{
- float w = SCREENW;
- float h = SCREENH;
-
// => tan(hFOV/2) = tan(vFOV/2)*aspectRatio
// => tan(vFOV/2) = tan(hFOV/2)/aspectRatio
- float ar1 = 4.0/3.0;
- float ar2 = w/h;
+ float ar1 = DEFAULT_ASPECT_RATIO;
+ float ar2 = GetAspectRatio();
hfov = DEGTORAD(hfov);
float vfov = atan(tan(hfov/2) / ar1) *2;
hfov = atan(tan(vfov/2) * ar2) *2;
@@ -45,9 +45,11 @@ static float hFov2vFov(float hfov)
void
CDraw::SetFOV(float fov)
{
-// TODO: fix FOV here or somewhere else?
-// ms_fFOV = hFov2vFov(fov);
+#ifdef ASPECT_RATIO_SCALE
+ ms_fFOV = ConvertFOV(fov);
+#else
ms_fFOV = fov;
+#endif
}
STARTPATCHES
diff --git a/src/render/Draw.h b/src/render/Draw.h
index 1fcb5212..3349c6c9 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -1,16 +1,18 @@
#pragma once
-#define HUD_SCALE 0.8f
-#define DEFAULT_SCALE 1.0f
-
class CDraw
{
private:
static float &ms_fNearClipZ;
static float &ms_fFarClipZ;
static float &ms_fFOV;
+ static float ms_fLODDistance; // unused
+
+#ifdef ASPECT_RATIO_SCALE
+ // we use this variable to scale a lot of 2D elements
+ // so better cache it
static float ms_fAspectRatio;
- static float ms_fScreenMultiplier;
+#endif
public:
static uint8 &FadeValue;
@@ -26,8 +28,12 @@ public:
static void SetFOV(float fov);
static float GetFOV(void) { return ms_fFOV; }
- static void CalculateAspectRatio();
+ static float FindAspectRatio(void);
+#ifdef ASPECT_RATIO_SCALE
+ static float ConvertFOV(float fov);
static float GetAspectRatio(void) { return ms_fAspectRatio; }
- static void SetScreenMult(float mult) { ms_fScreenMultiplier = mult; };
- static float GetScreenMult(void) { return ms_fScreenMultiplier; };
+ static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; }
+#else
+ static float GetAspectRatio(void) { return FindAspectRatio(); }
+#endif
};
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 2547ab2b..e5a44221 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -787,8 +787,8 @@ void CHud::Draw()
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));
- // FIX: game doesn't scale RADAR_LEFT here
- rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
+ // FIX? scale RADAR_LEFT here somehow
+ rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
rect.Grow(4.0f);
Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255));
CRadar::DrawBlips();
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index 57a8a22f..d917117a 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -16,7 +16,7 @@ CSprite::CalcHorizonCoors(void)
CVector p = TheCamera.GetPosition() + CVector(TheCamera.CamFrontXNorm, TheCamera.CamFrontYNorm, 0.0f)*3000.0f;
p.z = 0.0f;
p = TheCamera.m_viewMatrix * p;
- return p.y * RsGlobal.maximumHeight / p.z;
+ return p.y * SCREEN_HEIGHT / p.z;
}
bool
@@ -27,13 +27,13 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
if(out->z <= CDraw::GetNearClipZ() + 1.0f) return false;
if(out->z >= CDraw::GetFarClipZ() && farclip) return false;
float recip = 1.0f/out->z;
- out->x *= RsGlobal.maximumWidth * recip;
- out->y *= RsGlobal.maximumHeight * recip;
+ out->x *= SCREEN_WIDTH * recip;
+ out->y *= SCREEN_HEIGHT * recip;
// What is this? size?
*outw = 70.0f/CDraw::GetFOV();
*outh = 70.0f/CDraw::GetFOV();
- *outw *= RsGlobal.maximumWidth * recip;
- *outh *= RsGlobal.maximumHeight * recip;
+ *outw *= SCREEN_WIDTH * recip;
+ *outh *= SCREEN_HEIGHT * recip;
return true;
}
@@ -99,17 +99,17 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r
us[i] = -xs[i] / (2.0f*w);
xs[i] = 0.0f;
}
- if(xs[i] > RsGlobal.maximumWidth){
- us[i] = 1.0f - (xs[i]-RsGlobal.maximumWidth) / (2.0f*w);
- xs[i] = RsGlobal.maximumWidth;
+ if(xs[i] > SCREEN_WIDTH){
+ us[i] = 1.0f - (xs[i]-SCREEN_WIDTH) / (2.0f*w);
+ xs[i] = SCREEN_WIDTH;
}
if(ys[i] < 0.0f){
vs[i] = -ys[i] / (2.0f*h);
ys[i] = 0.0f;
}
- if(ys[i] > RsGlobal.maximumHeight){
- vs[i] = 1.0f - (ys[i]-RsGlobal.maximumHeight) / (2.0f*h);
- ys[i] = RsGlobal.maximumHeight;
+ if(ys[i] > SCREEN_HEIGHT){
+ vs[i] = 1.0f - (ys[i]-SCREEN_HEIGHT) / (2.0f*h);
+ ys[i] = SCREEN_HEIGHT;
}
}
@@ -169,10 +169,10 @@ CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, fl
// No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
- if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth &&
- xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return;
- if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight &&
- ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return;
+ if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
+ xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
+ if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
+ ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
float screenz = m_f2DNearScreenZ +
(z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() /
@@ -221,17 +221,17 @@ CSprite::RenderBufferedOneXLUSprite(float x, float y, float z, float w, float h,
us[i] = -xs[i] / (2.0f*w);
xs[i] = 0.0f;
}
- if(xs[i] > RsGlobal.maximumWidth){
- us[i] = 1.0f - (xs[i]-RsGlobal.maximumWidth) / (2.0f*w);
- xs[i] = RsGlobal.maximumWidth;
+ if(xs[i] > SCREEN_WIDTH){
+ us[i] = 1.0f - (xs[i]-SCREEN_WIDTH) / (2.0f*w);
+ xs[i] = SCREEN_WIDTH;
}
if(ys[i] < 0.0f){
vs[i] = -ys[i] / (2.0f*h);
ys[i] = 0.0f;
}
- if(ys[i] > RsGlobal.maximumHeight){
- vs[i] = 1.0f - (ys[i]-RsGlobal.maximumHeight) / (2.0f*h);
- ys[i] = RsGlobal.maximumHeight;
+ if(ys[i] > SCREEN_HEIGHT){
+ vs[i] = 1.0f - (ys[i]-SCREEN_HEIGHT) / (2.0f*h);
+ ys[i] = SCREEN_HEIGHT;
}
}
@@ -283,10 +283,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(float x, float y, float z,
// No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
- if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth &&
- xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return;
- if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight &&
- ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return;
+ if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
+ xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
+ if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
+ ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
float screenz = m_f2DNearScreenZ +
(z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() /
@@ -335,10 +335,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, flo
// No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
- if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth &&
- xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return;
- if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight &&
- ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return;
+ if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
+ xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
+ if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
+ ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
float screenz = m_f2DNearScreenZ +
(z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() /
@@ -388,10 +388,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, f
// No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
- if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth &&
- xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return;
- if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight &&
- ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return;
+ if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
+ xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
+ if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
+ ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
// Colour factors, cx/y is the direction in which colours change from rgb1 to rgb2
cf[0] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index 9638e53a..0481e104 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -626,9 +626,7 @@ psInitialise(void)
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
-#ifndef NASTY_GAME
- InitialiseLanguage();
-#endif
+ InitialiseLanguage();
FrontEndMenuManager.LoadSettings();
@@ -1262,7 +1260,7 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
ASSERT(d3d != nil);
- INT refreshRate = -1;
+ UINT refreshRate = INT_MAX;
D3DFORMAT format;
if ( depth == 32 )
@@ -1284,12 +1282,9 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
{
if ( mode.RefreshRate == 0 )
return 0;
-#pragma warning( push )
-#pragma warning( disable : 4018)
if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 )
refreshRate = mode.RefreshRate;
-#pragma warning( pop )
}
}
@@ -1540,8 +1535,6 @@ CommandLineToArgv(RwChar *cmdLine, RwInt32 *argCount)
*/
void InitialiseLanguage()
{
-#pragma warning( push )
-#pragma warning( disable : 4302)
WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID());
WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID());
WORD primLayout = PRIMARYLANGID((DWORD)GetKeyboardLayout(0));
@@ -1549,7 +1542,6 @@ void InitialiseLanguage()
WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID());
WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID());
WORD subLayout = SUBLANGID((DWORD)GetKeyboardLayout(0));
-#pragma warning( pop )
if ( primUserLCID == LANG_GERMAN
|| primSystemLCID == LANG_GERMAN
@@ -1573,6 +1565,12 @@ void InitialiseLanguage()
|| subSystemLCID == SUBLANG_ENGLISH_AUS
|| subLayout == SUBLANG_ENGLISH_AUS )
CGame::noProstitutes = true;
+
+#ifdef NASTY_GAME
+ CGame::nastyGame = true;
+ CMenuManager::m_PrefsAllowNastyGame = true;
+ CGame::noProstitutes = false;
+#endif
int32 lang;
@@ -2420,14 +2418,10 @@ void _InputInitialiseJoys()
}
}
-#pragma warning( push )
-#pragma warning( disable : 4700)
-HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
+void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
{
- HRESULT hr;
-
DIDEVICEOBJECTINSTANCE objInst;
-
+
objInst.dwSize = sizeof( DIDEVICEOBJECTINSTANCE );
DIPROPRANGE range;
@@ -2445,7 +2439,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_X, DIPH_BYOFFSET ) ) )
{
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
- return S_FALSE;
+ return;
else
;
}
@@ -2457,7 +2451,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Y, DIPH_BYOFFSET ) ) )
{
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
- return S_FALSE;
+ return;
else
;
}
@@ -2469,7 +2463,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Z, DIPH_BYOFFSET ) ) )
{
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
- return S_FALSE;
+ return;
else
AllValidWinJoys.m_aJoys[num].m_bHasAxisZ = true; // z rightStickPos.x
}
@@ -2481,15 +2475,12 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_RZ, DIPH_BYOFFSET ) ) )
{
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
- return S_FALSE;
+ return;
else
AllValidWinJoys.m_aJoys[num].m_bHasAxisR = true; // r rightStickPos.y
}
}
-
- return hr;
}
-#pragma warning( pop )
HRESULT _InputAddJoys()
{
@@ -2973,9 +2964,7 @@ void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs)
}
}
-#pragma warning( push )
-#pragma warning( disable : 4805)
-BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown)
+BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown)
{
*rs = rsNULL;
switch ( key )
@@ -3002,7 +2991,6 @@ BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown)
return TRUE;
}
-#pragma warning( pop )
BOOL _InputIsExtended(INT flag)
{
diff --git a/src/skel/win/win.h b/src/skel/win/win.h
index 371b9e44..a1f37bfd 100644
--- a/src/skel/win/win.h
+++ b/src/skel/win/win.h
@@ -63,14 +63,14 @@ HRESULT _InputInitialise();
HRESULT _InputInitialiseMouse();
HRESULT CapturePad(RwInt32 padID);
void _InputInitialiseJoys();
-HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
+void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
HRESULT _InputAddJoys();
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
void _InputShutdown();
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs);;
-BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown);
+BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);
BOOL _InputIsExtended(INT flag);
void InitialiseLanguage();