summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-26 21:03:15 +0200
committerSergeanur <s.anureev@yandex.ua>2020-04-26 21:03:15 +0200
commitf0890b11122291a22d6a65f349281cf1aed49bd0 (patch)
tree3b418b522c5fd097abac916693e59808ea4f5b4f /src/render
parentMore japanese (diff)
parentRemove little hack (diff)
downloadre3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.gz
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.bz2
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.lz
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.xz
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.tar.zst
re3-f0890b11122291a22d6a65f349281cf1aed49bd0.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Antennas.cpp16
-rw-r--r--src/render/Clouds.cpp35
-rw-r--r--src/render/Clouds.h12
-rw-r--r--src/render/Console.cpp5
-rw-r--r--src/render/Console.h2
-rw-r--r--src/render/Coronas.cpp52
-rw-r--r--src/render/Coronas.h16
-rw-r--r--src/render/Credits.cpp16
-rw-r--r--src/render/Credits.h4
-rw-r--r--src/render/Draw.cpp25
-rw-r--r--src/render/Draw.h16
-rw-r--r--src/render/Fluff.cpp42
-rw-r--r--src/render/Fluff.h2
-rw-r--r--src/render/Font.cpp117
-rw-r--r--src/render/Font.h12
-rw-r--r--src/render/Glass.cpp55
-rw-r--r--src/render/Glass.h1
-rw-r--r--src/render/Hud.cpp125
-rw-r--r--src/render/Instance.cpp9
-rw-r--r--src/render/Instance.h14
-rw-r--r--src/render/Lines.cpp2
-rw-r--r--src/render/MBlur.cpp16
-rw-r--r--src/render/MBlur.h6
-rw-r--r--src/render/Particle.cpp75
-rw-r--r--src/render/Particle.h13
-rw-r--r--src/render/ParticleMgr.cpp13
-rw-r--r--src/render/ParticleMgr.h84
-rw-r--r--src/render/ParticleType.h77
-rw-r--r--src/render/PlayerSkin.cpp11
-rw-r--r--src/render/PointLights.cpp17
-rw-r--r--src/render/PointLights.h4
-rw-r--r--src/render/RenderBuffer.cpp21
-rw-r--r--src/render/RenderBuffer.h12
-rw-r--r--src/render/Renderer.cpp58
-rw-r--r--src/render/Renderer.h16
-rw-r--r--src/render/Rubbish.cpp6
-rw-r--r--src/render/Shadows.cpp118
-rw-r--r--src/render/Shadows.h37
-rw-r--r--src/render/Skidmarks.cpp5
-rw-r--r--src/render/SpecialFX.cpp41
-rw-r--r--src/render/Sprite.cpp50
-rw-r--r--src/render/Sprite.h8
-rw-r--r--src/render/Sprite2d.cpp50
-rw-r--r--src/render/Sprite2d.h14
-rw-r--r--src/render/Timecycle.cpp203
-rw-r--r--src/render/Timecycle.h184
-rw-r--r--src/render/WaterCannon.cpp28
-rw-r--r--src/render/WaterCannon.h1
-rw-r--r--src/render/WaterLevel.cpp35
-rw-r--r--src/render/WaterLevel.h2
-rw-r--r--src/render/WeaponEffects.cpp106
-rw-r--r--src/render/WeaponEffects.h27
-rw-r--r--src/render/Weather.cpp58
-rw-r--r--src/render/Weather.h50
54 files changed, 785 insertions, 1239 deletions
diff --git a/src/render/Antennas.cpp b/src/render/Antennas.cpp
index d564c196..452069a0 100644
--- a/src/render/Antennas.cpp
+++ b/src/render/Antennas.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "Antennas.h"
CAntenna CAntennas::aAntennas[NUMANTENNAS];
@@ -123,17 +123,3 @@ CAntenna::Update(CVector dir, CVector basepos)
pos[i] = newpos;
}
}
-
-STARTPATCHES
- InjectHook(0x4F64D0, &CAntennas::Init, PATCH_JUMP);
- InjectHook(0x4F6550, &CAntennas::Update, PATCH_JUMP);
- InjectHook(0x4F66C0, &CAntennas::RegisterOne, PATCH_JUMP);
- InjectHook(0x4F6590, &CAntennas::Render, PATCH_JUMP);
- InjectHook(0x4F6830, &CAntenna::Update, PATCH_JUMP);
-
- // give to cheetah for testing
-// Patch<int>(0x535B50+1, 105);
-// Patch<float>(0x535B57+7, -0.84);
-// Patch<float>(0x535B74+7, 0.78);
-// Patch<float>(0x535B69+7, 0.24);
-ENDPATCHES
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index 39866294..cb08a997 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "Sprite.h"
#include "Sprite2d.h"
#include "General.h"
@@ -16,15 +16,15 @@
#define SMALLSTRIPHEIGHT 4.0f
#define HORIZSTRIPHEIGHT 48.0f
-RwTexture **gpCloudTex = (RwTexture**)0x9411C0; //[5];
+RwTexture *gpCloudTex[5];
-float &CClouds::CloudRotation = *(float*)0x8F5F40;
-uint32 &CClouds::IndividualRotation = *(uint32*)0x943078;
+float CClouds::CloudRotation;
+uint32 CClouds::IndividualRotation;
-float &CClouds::ms_cameraRoll = *(float*)0x8F29CC;
-float &CClouds::ms_horizonZ = *(float*)0x8F31C0;
-CRGBA &CClouds::ms_colourTop = *(CRGBA*)0x94143C;
-CRGBA &CClouds::ms_colourBottom = *(CRGBA*)0x8F2C38;
+float CClouds::ms_cameraRoll;
+float CClouds::ms_horizonZ;
+CRGBA CClouds::ms_colourTop;
+CRGBA CClouds::ms_colourBottom;
void
CClouds::Init(void)
@@ -233,7 +233,7 @@ CClouds::Render(void)
szx*55.0f, szy*55.0f,
tr, tg, tb, br, bg, bb, 0.0f, -1.0f,
1.0f/screenpos.z,
- IndividualRotation/65336.0f * 2*3.14f + ms_cameraRoll,
+ (uint16)IndividualRotation/65336.0f * 6.28f + ms_cameraRoll,
fluffyalpha);
bCloudOnScreen[i] = true;
}else
@@ -388,7 +388,7 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
ms_colourBottom.b = topblue;
ms_colourBottom.a = alpha;
- botpos = min(SCREEN_HEIGHT, topedge);
+ botpos = Min(SCREEN_HEIGHT, topedge);
CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos),
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
}
@@ -415,27 +415,18 @@ CClouds::RenderHorizon(void)
if(ms_horizonZ > SCREEN_HEIGHT)
return;
- float z1 = min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT);
+ float z1 = Min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT);
CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1),
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
// This is just weird
float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT +
- SCREEN_HEIGHT/300.0f * max(TheCamera.GetPosition().z, 0.0f);
+ SCREEN_HEIGHT/300.0f * Max(TheCamera.GetPosition().z, 0.0f);
float b = TheCamera.GetUp().z < 0.0f ?
SCREEN_HEIGHT :
SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
- z2 = min(z2, SCREEN_HEIGHT);
+ z2 = Min(z2, SCREEN_HEIGHT);
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
}
-
-STARTPATCHES
- InjectHook(0x4F6C10, CClouds::Init, PATCH_JUMP);
- InjectHook(0x4F6CA0, CClouds::Shutdown, PATCH_JUMP);
- InjectHook(0x4F6CE0, CClouds::Update, PATCH_JUMP);
- InjectHook(0x4F6D90, CClouds::Render, PATCH_JUMP);
- InjectHook(0x4F7F00, CClouds::RenderBackground, PATCH_JUMP);
- InjectHook(0x4F85F0, CClouds::RenderHorizon, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Clouds.h b/src/render/Clouds.h
index c8000569..4d8cd2c8 100644
--- a/src/render/Clouds.h
+++ b/src/render/Clouds.h
@@ -3,13 +3,13 @@
class CClouds
{
public:
- static float &CloudRotation;
- static uint32 &IndividualRotation;
+ static float CloudRotation;
+ static uint32 IndividualRotation;
- static float &ms_cameraRoll;
- static float &ms_horizonZ;
- static CRGBA &ms_colourTop;
- static CRGBA &ms_colourBottom;
+ static float ms_cameraRoll;
+ static float ms_horizonZ;
+ static CRGBA ms_colourTop;
+ static CRGBA ms_colourBottom;
static void Init(void);
static void Shutdown(void);
diff --git a/src/render/Console.cpp b/src/render/Console.cpp
index d4940955..5ae5d763 100644
--- a/src/render/Console.cpp
+++ b/src/render/Console.cpp
@@ -1,5 +1,6 @@
#include "common.h"
-#include "patcher.h"
+#include <stdarg.h>
+
#include "Console.h"
#include "Font.h"
#include "Timer.h"
@@ -8,7 +9,7 @@
#define CONSOLE_Y_POS (10.0f)
#define CONSOLE_LINE_HEIGHT (12.0f)
-CConsole &TheConsole = *(CConsole*)0x8F6498;
+CConsole TheConsole;
void
CConsole::AddLine(char *s, uint8 r, uint8 g, uint8 b)
diff --git a/src/render/Console.h b/src/render/Console.h
index c454d75e..b4fa60c4 100644
--- a/src/render/Console.h
+++ b/src/render/Console.h
@@ -22,4 +22,4 @@ public:
void Init() { m_nCurrentLine = 0; m_nLineCount = 0; }
};
-extern CConsole &TheConsole;
+extern CConsole TheConsole;
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index 68994b0b..de3b5c78 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "General.h"
#include "TxdStore.h"
@@ -48,16 +48,16 @@ FlareDef HeadLightsFlareDef[] = {
};
-RwTexture **gpCoronaTexture = (RwTexture**)0x5FAF44; //[9]
+RwTexture *gpCoronaTexture[9] = { nil, nil, nil, nil, nil, nil, nil, nil, nil };
-float &CCoronas::LightsMult = *(float*)0x5FB088; // 1.0
-float &CCoronas::SunScreenX = *(float*)0x8F4358;
-float &CCoronas::SunScreenY = *(float*)0x8F4354;
-bool &CCoronas::bSmallMoon = *(bool*)0x95CD49;
-bool &CCoronas::SunBlockedByClouds = *(bool*)0x95CD73;
-int &CCoronas::bChangeBrightnessImmediately = *(int*)0x8E2C30;
+float CCoronas::LightsMult = 1.0f;
+float CCoronas::SunScreenX;
+float CCoronas::SunScreenY;
+bool CCoronas::bSmallMoon;
+bool CCoronas::SunBlockedByClouds;
+int CCoronas::bChangeBrightnessImmediately;
-CRegisteredCorona *CCoronas::aCoronas = (CRegisteredCorona*)0x72E518;
+CRegisteredCorona CCoronas::aCoronas[NUMCORONAS];
const char aCoronaSpriteNames[][32] = {
"coronastar",
@@ -106,7 +106,7 @@ CCoronas::Update(void)
int i;
static int LastCamLook = 0;
- LightsMult = min(LightsMult + 0.03f * CTimer::GetTimeStep(), 1.0f);
+ LightsMult = Min(LightsMult + 0.03f * CTimer::GetTimeStep(), 1.0f);
int CamLook = 0;
if(TheCamera.Cams[TheCamera.ActiveCam].LookingLeft) CamLook |= 1;
@@ -118,7 +118,7 @@ CCoronas::Update(void)
if(LastCamLook != CamLook)
bChangeBrightnessImmediately = 3;
else
- bChangeBrightnessImmediately = max(bChangeBrightnessImmediately-1, 0);
+ bChangeBrightnessImmediately = Max(bChangeBrightnessImmediately-1, 0);
LastCamLook = CamLook;
for(i = 0; i < NUMCORONAS; i++)
@@ -305,7 +305,7 @@ CCoronas::Render(void)
// render corona itself
if(aCoronas[i].texture){
- float fogscale = CWeather::Foggyness*min(spriteCoors.z, 40.0f)/40.0f + 1.0f;
+ float fogscale = CWeather::Foggyness*Min(spriteCoors.z, 40.0f)/40.0f + 1.0f;
if(CCoronas::aCoronas[i].id == SUN_CORE)
spriteCoors.z = 0.95f * RwCameraGetFarClipPlane(Scene.camera);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aCoronas[i].texture));
@@ -316,7 +316,7 @@ CCoronas::Render(void)
float f = 1.0f - aCoronas[i].someAngle*2.0f/PI;
float wscale = 6.0f*sq(sq(sq(f))) + 0.5f;
float hscale = 0.35f - (wscale - 0.5f) * 0.06f;
- hscale = max(hscale, 0.15f);
+ hscale = Max(hscale, 0.15f);
CSprite::RenderOneXLUSprite(spriteCoors.x, spriteCoors.y, spriteCoors.z,
spritew * aCoronas[i].size * wscale,
@@ -466,7 +466,7 @@ CCoronas::RenderReflections(void)
float spritew, spriteh;
if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
float drawDist = 0.75f * aCoronas[i].drawDist;
- drawDist = min(drawDist, 50.0f);
+ drawDist = Min(drawDist, 50.0f);
if(spriteCoors.z < drawDist){
float fadeDistance = drawDist / 2.0f;
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
@@ -545,25 +545,25 @@ CRegisteredCorona::Update(void)
(CCoronas::SunBlockedByClouds && id == CCoronas::SUN_CORONA ||
!CWorld::GetIsLineOfSightClear(coors, TheCamera.GetPosition(), true, false, false, false, false, false))){
// Corona is blocked, fade out
- fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
+ fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
}else if(offScreen){
// Same when off screen
- fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
+ fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
}else{
// Visible
if(alpha > fadeAlpha){
// fade in
- fadeAlpha = min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
+ fadeAlpha = Min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
if(CCoronas::bChangeBrightnessImmediately)
fadeAlpha = alpha;
}else if(alpha < fadeAlpha){
// too visible, decrease alpha but not below alpha
- fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), alpha);
+ fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), alpha);
}
// darken scene when the sun is visible
if(id == CCoronas::SUN_CORONA)
- CCoronas::LightsMult = max(CCoronas::LightsMult - CTimer::GetTimeStep()*0.06f, 0.6f);
+ CCoronas::LightsMult = Max(CCoronas::LightsMult - CTimer::GetTimeStep()*0.06f, 0.6f);
}
// remove if invisible
@@ -572,17 +572,3 @@ CRegisteredCorona::Update(void)
firstUpdate = false;
registeredThisFrame = false;
}
-
-STARTPATCHES
- InjectHook(0x4F9F90, CCoronas::Init, PATCH_JUMP);
- InjectHook(0x4FA050, CCoronas::Shutdown, PATCH_JUMP);
- InjectHook(0x4F8EC0, CCoronas::Update, PATCH_JUMP);
- InjectHook(0x4FA0E0, (void (*)(uint32, uint8, uint8, uint8, uint8, const CVector&, float, float, RwTexture*, int8, uint8, uint8, uint8, float))CCoronas::RegisterCorona, PATCH_JUMP);
- InjectHook(0x4FA080, (void (*)(uint32, uint8, uint8, uint8, uint8, const CVector&, float, float, uint8, int8, uint8, uint8, uint8, float))CCoronas::RegisterCorona, PATCH_JUMP);
- InjectHook(0x4FA2D0, CCoronas::UpdateCoronaCoors, PATCH_JUMP);
- InjectHook(0x4F8FB0, CCoronas::Render, PATCH_JUMP);
- InjectHook(0x4F9B40, CCoronas::RenderReflections, PATCH_JUMP);
- InjectHook(0x4FA380, CCoronas::DoSunAndMoon, PATCH_JUMP);
-
- InjectHook(0x4F8C40, &CRegisteredCorona::Update, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Coronas.h b/src/render/Coronas.h
index 359a34ed..4b49e40e 100644
--- a/src/render/Coronas.h
+++ b/src/render/Coronas.h
@@ -1,6 +1,6 @@
#pragma once
-extern RwTexture **gpCoronaTexture; //[9]
+extern RwTexture *gpCoronaTexture[9];
struct CRegisteredCorona
{
@@ -42,7 +42,7 @@ static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error");
class CCoronas
{
- static CRegisteredCorona *aCoronas; //[NUMCORONAS];
+ static CRegisteredCorona aCoronas[NUMCORONAS];
public:
enum {
SUN_CORE = 1,
@@ -77,12 +77,12 @@ public:
STREAK_ON,
};
- static float &LightsMult;
- static float &SunScreenY;
- static float &SunScreenX;
- static bool &bSmallMoon;
- static bool &SunBlockedByClouds;
- static int &bChangeBrightnessImmediately;
+ static float LightsMult;
+ static float SunScreenY;
+ static float SunScreenX;
+ static bool bSmallMoon;
+ static bool SunBlockedByClouds;
+ static int bChangeBrightnessImmediately;
static void Init(void);
static void Shutdown(void);
diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp
index b423fcc0..dc0b0252 100644
--- a/src/render/Credits.cpp
+++ b/src/render/Credits.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "Timer.h"
#include "Font.h"
#include "Frontend.h"
@@ -8,8 +8,8 @@
#include "Text.h"
#include "Credits.h"
-bool &CCredits::bCreditsGoing = *(bool*)0x95CDD3;
-uint32 &CCredits::CreditsStartTime = *(uint32*)0x8F2528;
+bool CCredits::bCreditsGoing;
+uint32 CCredits::CreditsStartTime;
void
CCredits::Init(void)
@@ -497,13 +497,3 @@ bool CCredits::AreCreditsDone(void)
{
return !bCreditsGoing;
}
-
-STARTPATCHES
- InjectHook(0x4FE7A0, CCredits::Init, PATCH_JUMP);
- InjectHook(0x4FE760, CCredits::Start, PATCH_JUMP);
- InjectHook(0x4FE780, CCredits::Stop, PATCH_JUMP);
- InjectHook(0x4FE790, CCredits::AreCreditsDone, PATCH_JUMP);
- InjectHook(0x4FADF0, CCredits::Render, PATCH_JUMP);
- InjectHook(0x4FE710, CCredits::PrintCreditSpace, PATCH_JUMP);
- InjectHook(0x4FE620, CCredits::PrintCreditText, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Credits.h b/src/render/Credits.h
index c39fb035..e049ce76 100644
--- a/src/render/Credits.h
+++ b/src/render/Credits.h
@@ -2,8 +2,8 @@
class CCredits
{
- static bool &bCreditsGoing;
- static uint32 &CreditsStartTime;
+ static bool bCreditsGoing;
+ static uint32 CreditsStartTime;
public:
static void Init(void);
static void Start(void);
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index 862fc024..b31cc624 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "Draw.h"
#include "Frontend.h"
#include "Camera.h"
@@ -8,15 +8,15 @@
float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
#endif
-float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
-float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
-float &CDraw::ms_fFOV = *(float*)0x5FBC6C;
-float &CDraw::ms_fLODDistance = *(float*)0x8F2C30;
+float CDraw::ms_fNearClipZ;
+float CDraw::ms_fFarClipZ;
+float CDraw::ms_fFOV = 45.0f;
+float CDraw::ms_fLODDistance;
-uint8 &CDraw::FadeValue = *(uint8*)0x95CD68;
-uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
-uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
-uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
+uint8 CDraw::FadeValue;
+uint8 CDraw::FadeRed;
+uint8 CDraw::FadeGreen;
+uint8 CDraw::FadeBlue;
float
CDraw::FindAspectRatio(void)
@@ -66,10 +66,3 @@ CDraw::SetFOV(float fov)
ms_fFOV = fov;
#endif
}
-
-STARTPATCHES
- InjectHook(0x4FE7B0, CDraw::SetFOV, PATCH_JUMP);
-
- Nop(0x46B618, 2);
- Patch<float>(0x5F0A64, 1.3333334f);
-ENDPATCHES
diff --git a/src/render/Draw.h b/src/render/Draw.h
index 50e1e294..55958a2a 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -13,11 +13,11 @@ enum eAspectRatio
class CDraw
{
private:
- static float &ms_fNearClipZ;
- static float &ms_fFarClipZ;
- static float &ms_fFOV;
+ static float ms_fNearClipZ;
+ static float ms_fFarClipZ;
+ static float ms_fFOV;
public:
- static float &ms_fLODDistance; // set but unused?
+ static float ms_fLODDistance; // set but unused?
#ifdef ASPECT_RATIO_SCALE
// we use this variable to scale a lot of 2D elements
@@ -25,10 +25,10 @@ public:
static float ms_fAspectRatio;
#endif
- static uint8 &FadeValue;
- static uint8 &FadeRed;
- static uint8 &FadeGreen;
- static uint8 &FadeBlue;
+ static uint8 FadeValue;
+ static uint8 FadeRed;
+ static uint8 FadeGreen;
+ static uint8 FadeBlue;
static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; }
static float GetNearClipZ(void) { return ms_fNearClipZ; }
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index e2899532..9f3f6929 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -1,6 +1,6 @@
#include "common.h"
#include "main.h"
-#include "patcher.h"
+
#include "Entity.h"
#include "Fluff.h"
#include "Camera.h"
@@ -159,12 +159,12 @@ void CMovingThings::Update()
int block = CTimer::GetFrameCounter() % TIME_SPAN;
for (i = (block * NUMMOVINGTHINGS) / TIME_SPAN; i < ((block + 1) * NUMMOVINGTHINGS) / TIME_SPAN; i++) {
- if (aMovingThings[i].field_A == 1)
+ if (aMovingThings[i].m_nHidden == 1)
aMovingThings[i].Update();
}
for (i = 0; i < CMovingThings::Num; i++) {
- if (aMovingThings[i].field_A == 0)
+ if (aMovingThings[i].m_nHidden == 0)
aMovingThings[i].Update();
}
@@ -212,14 +212,14 @@ void CMovingThing::Update()
m_pEntity->UpdateRwFrame();
if (SQR(m_pEntity->GetPosition().x - TheCamera.GetPosition().x) + SQR(m_pEntity->GetPosition().y - TheCamera.GetPosition().y) < 40000.0f) {
- if (field_A == 1) {
+ if (m_nHidden == 1) {
AddToList(&CMovingThings::StartCloseList);
- field_A = 0;
+ m_nHidden = 0;
}
} else {
- if (field_A == 0) {
+ if (m_nHidden == 0) {
RemoveFromList();
- field_A = 1;
+ m_nHidden = 1;
}
}
}
@@ -864,31 +864,3 @@ void CDigitalClock::Render()
CSprite::FlushSpriteBuffer();
}
}
-
-STARTPATCHES
-InjectHook(0x4FF290, &CMovingThing::Update, PATCH_JUMP);
-InjectHook(0x4FF320, &CMovingThing::AddToList, PATCH_JUMP);
-InjectHook(0x4FF340, &CMovingThing::RemoveFromList, PATCH_JUMP);
-
-InjectHook(0x4FE7C0, &CMovingThings::Init, PATCH_JUMP);
-InjectHook(0x4FF020, &CMovingThings::Shutdown, PATCH_JUMP);
-InjectHook(0x4FF0D0, &CMovingThings::Update, PATCH_JUMP);
-InjectHook(0x4FF210, &CMovingThings::Render, PATCH_JUMP);
-
-InjectHook(0x4FF360, &FindTunnelMessage, PATCH_JUMP);
-InjectHook(0x4FF390, &FindBridgeMessage, PATCH_JUMP);
-InjectHook(0x4FF3C0, &FindTimeMessage, PATCH_JUMP);
-InjectHook(0x4FF450, &FindDigitalClockMessage, PATCH_JUMP);
-
-InjectHook(0x4FF610, &CScrollBar::Init, PATCH_JUMP);
-InjectHook(0x4FF6E0, &CScrollBar::Update, PATCH_JUMP);
-InjectHook(0x4FFCE0, &CScrollBar::Render, PATCH_JUMP);
-
-InjectHook(0x5000D0, &CTowerClock::Init, PATCH_JUMP);
-InjectHook(0x500130, &CTowerClock::Update, PATCH_JUMP);
-InjectHook(0x5001D0, &CTowerClock::Render, PATCH_JUMP);
-
-InjectHook(0x5004F0, &CDigitalClock::Init, PATCH_JUMP);
-InjectHook(0x500550, &CDigitalClock::Update, PATCH_JUMP);
-InjectHook(0x5005F0, &CDigitalClock::Render, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Fluff.h b/src/render/Fluff.h
index 7ab2d81d..fe3ab256 100644
--- a/src/render/Fluff.h
+++ b/src/render/Fluff.h
@@ -8,7 +8,7 @@ public:
CMovingThing *m_pNext;
CMovingThing *m_pPrev;
int16 m_nType;
- int16 field_A;
+ int16 m_nHidden;
CVector m_vecPosn;
CEntity* m_pEntity;
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index 6067a020..458974ae 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -1,26 +1,22 @@
#include "common.h"
-#include "patcher.h"
+
#include "Sprite2d.h"
#include "TxdStore.h"
#include "Font.h"
-CFontDetails &CFont::Details = *(CFontDetails*)0x8F317C;
-int16 &CFont::NewLine = *(int16*)0x95CC94;
-#ifdef MORE_LANGUAGES
-CSprite2d CFont::Sprite[4];
-#else
-CSprite2d *CFont::Sprite = (CSprite2d*)0x95CC04;
-#endif
+CFontDetails CFont::Details;
+int16 CFont::NewLine;
+CSprite2d CFont::Sprite[MAX_FONTS];
#ifdef MORE_LANGUAGES
uint8 CFont::LanguageSet = FONT_LANGSET_EFIGS;
int32 CFont::Slot = -1;
#define JAP_TERMINATION (0x8000 | '~')
-int16 CFont::Size[2][3][193] = {
+int16 CFont::Size[LANGSET_MAX][MAX_FONTS][193] = {
{
#else
-int16 CFont::Size[3][193] = {
+int16 CFont::Size[MAX_FONTS][193] = {
#endif
{
13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31,
@@ -117,6 +113,56 @@ int16 CFont::Size[3][193] = {
21, 32, 21, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 11, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19 },
+ },
+
+ {
+ {
+ 13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31,
+ 23, 16, 22, 21, 24, 23, 23, 20, 23, 22, 10, 35, 26, 26, 26, 26,
+ 30, 26, 24, 23, 24, 22, 21, 24, 26, 10, 20, 26, 22, 29, 26, 25,
+ 23, 25, 24, 24, 22, 25, 24, 29, 29, 23, 25, 37, 22, 37, 35, 37,
+ 35, 21, 22, 21, 21, 22, 13, 22, 21, 10, 16, 22, 11, 32, 21, 21,
+ 23, 22, 16, 20, 14, 21, 20, 30, 25, 21, 21, 33, 33, 33, 33, 35,
+ 27, 27, 27, 27, 32, 24, 23, 23, 23, 23, 11, 11, 11, 11, 26, 26,
+ 26, 26, 26, 26, 26, 25, 26, 21, 21, 21, 21, 32, 23, 22, 22, 22,
+ 22, 11, 11, 11, 11, 22, 22, 22, 22, 22, 22, 22, 22, 26, 21, 24,
+ 12, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 18, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+ 20
+ },
+
+ {
+ 13, 9, 21, 35, 23, 35, 35, 11, 35, 35, 25, 35, 11, 17, 13, 33,
+ 28, 14, 22, 21, 24, 23, 23, 21, 23, 22, 10, 35, 13, 35, 13, 33,
+ 5, 25, 22, 23, 24, 21, 21, 24, 24, 9, 20, 24, 21, 27, 25, 25,
+ 22, 25, 23, 20, 23, 23, 23, 31, 23, 23, 23, 37, 33, 37, 35, 37,
+ 35, 21, 19, 19, 21, 19, 17, 21, 21, 8, 17, 18, 14, 24, 21, 21,
+ 20, 22, 19, 20, 20, 19, 20, 26, 21, 20, 21, 33, 33, 33, 33, 35,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 16
+ },
+
+ {
+ 15, 14, 16, 25, 19, 26, 22, 11, 18, 18, 27, 26, 13, 19, 9, 27,
+ 19, 18, 19, 19, 22, 19, 20, 18, 19, 20, 12, 32, 15, 32, 15, 35,
+ 15, 19, 19, 19, 19, 19, 16, 19, 20, 9, 19, 20, 14, 29, 19, 20,
+ 19, 19, 19, 19, 21, 19, 20, 32, 20, 19, 19, 33, 31, 39, 37, 39,
+ 37, 21, 21, 21, 23, 21, 19, 23, 23, 10, 19, 20, 16, 26, 23, 23,
+ 20, 20, 20, 22, 21, 22, 22, 26, 22, 22, 23, 35, 35, 35, 35, 37,
+ 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9, 9, 9, 9, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 30, 19, 19, 19, 19,
+ 19, 10, 10, 10, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 35,
+ 12, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19
+ }
}
#endif
};
@@ -164,6 +210,9 @@ CFont::Initialise(void)
default:
CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD");
break;
+ case FONT_LANGSET_POLISH:
+ CTxdStore::LoadTxd(slot, "MODELS/FONTS_P.TXD");
+ break;
case FONT_LANGSET_RUSSIAN:
CTxdStore::LoadTxd(slot, "MODELS/FONTS_R.TXD");
break;
@@ -222,6 +271,9 @@ CFont::ReloadFonts(uint8 set)
default:
CTxdStore::LoadTxd(Slot, "MODELS/FONTS.TXD");
break;
+ case FONT_LANGSET_POLISH:
+ CTxdStore::LoadTxd(Slot, "MODELS/FONTS_P.TXD");
+ break;
case FONT_LANGSET_RUSSIAN:
CTxdStore::LoadTxd(Slot, "MODELS/FONTS_R.TXD");
break;
@@ -1427,48 +1479,3 @@ CFont::SetDropColor(const CRGBA &col)
if (Details.alphaFade < 255.0f)
Details.dropColor.a *= Details.alphaFade / 255.0f;
}
-
-STARTPATCHES
-
- InjectHook(0x500A40, CFont::Initialise, PATCH_JUMP);
- InjectHook(0x500BA0, CFont::Shutdown, PATCH_JUMP);
- InjectHook(0x500BE0, CFont::InitPerFrame, PATCH_JUMP);
- InjectHook(0x500C30, CFont::PrintChar, PATCH_JUMP);
- InjectHook(0x500F50, (void (*)(float, float, wchar*))CFont::PrintString, PATCH_JUMP);
- InjectHook(0x501260, CFont::GetNumberLines, PATCH_JUMP);
- InjectHook(0x5013B0, CFont::GetTextRect, PATCH_JUMP);
- //InjectHook(0x501730, (void (*)(float, float, wchar*, wchar*, float))CFont::PrintString, PATCH_JUMP);
- InjectHook(0x5017E0, CFont::GetCharacterWidth, PATCH_JUMP);
- InjectHook(0x501840, CFont::GetCharacterSize, PATCH_JUMP);
- InjectHook(0x5018A0, CFont::GetStringWidth, PATCH_JUMP);
- InjectHook(0x501960, CFont::GetNextSpace, PATCH_JUMP);
- InjectHook(0x5019A0, CFont::ParseToken, PATCH_JUMP);
- InjectHook(0x501B50, CFont::DrawFonts, PATCH_JUMP);
- InjectHook(0x501E80, CFont::character_code, PATCH_JUMP);
-
- InjectHook(0x501B80, CFont::SetScale, PATCH_JUMP);
- InjectHook(0x501BA0, CFont::SetSlantRefPoint, PATCH_JUMP);
- InjectHook(0x501BC0, CFont::SetSlant, PATCH_JUMP);
- InjectHook(0x501BD0, CFont::SetColor, PATCH_JUMP);
- InjectHook(0x501C60, CFont::SetJustifyOn, PATCH_JUMP);
- InjectHook(0x501C80, CFont::SetJustifyOff, PATCH_JUMP);
- InjectHook(0x501C90, CFont::SetCentreOn, PATCH_JUMP);
- InjectHook(0x501CB0, CFont::SetCentreOff, PATCH_JUMP);
- InjectHook(0x501CC0, CFont::SetWrapx, PATCH_JUMP);
- InjectHook(0x501CD0, CFont::SetCentreSize, PATCH_JUMP);
- InjectHook(0x501CE0, CFont::SetBackgroundOn, PATCH_JUMP);
- InjectHook(0x501CF0, CFont::SetBackgroundOff, PATCH_JUMP);
- InjectHook(0x501D00, CFont::SetBackgroundColor, PATCH_JUMP);
- InjectHook(0x501D30, CFont::SetBackGroundOnlyTextOn, PATCH_JUMP);
- InjectHook(0x501D40, CFont::SetBackGroundOnlyTextOff, PATCH_JUMP);
- InjectHook(0x501D50, CFont::SetRightJustifyOn, PATCH_JUMP);
- InjectHook(0x501D70, CFont::SetRightJustifyOff, PATCH_JUMP);
- InjectHook(0x501D90, CFont::SetPropOff, PATCH_JUMP);
- InjectHook(0x501DA0, CFont::SetPropOn, PATCH_JUMP);
- InjectHook(0x501DB0, CFont::SetFontStyle, PATCH_JUMP);
- InjectHook(0x501DC0, CFont::SetRightJustifyWrap, PATCH_JUMP);
- InjectHook(0x501DD0, CFont::SetAlphaFade, PATCH_JUMP);
- InjectHook(0x501DE0, CFont::SetDropColor, PATCH_JUMP);
- InjectHook(0x501E70, CFont::SetDropShadowPosition, PATCH_JUMP);
-
-ENDPATCHES
diff --git a/src/render/Font.h b/src/render/Font.h
index 7c1d089f..73e9522a 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -34,6 +34,7 @@ enum {
#ifdef MORE_LANGUAGES
FONT_JAPANESE,
#endif
+ MAX_FONTS
};
enum {
@@ -47,7 +48,9 @@ enum
{
FONT_LANGSET_EFIGS,
FONT_LANGSET_RUSSIAN,
+ FONT_LANGSET_POLISH,
FONT_LANGSET_JAPANESE
+ LANGSET_MAX
};
#endif
@@ -56,19 +59,20 @@ enum
class CFont
{
#ifdef MORE_LANGUAGES
- static int16 Size[2][3][193];
+ static int16 Size[LANGSET_MAX][MAX_FONTS][193];
public:
static uint8 LanguageSet;
private:
static int32 Slot;
static CSprite2d Sprite[4];
#else
- static int16 Size[3][193];
+ static int16 Size[MAX_FONTS][193];
static CSprite2d* Sprite; //[3]
#endif
- static int16 &NewLine;
+ static int16 NewLine;
+ static CSprite2d Sprite[MAX_FONTS];
public:
- static CFontDetails& Details;
+ static CFontDetails Details;
static void Initialise(void);
static void Shutdown(void);
diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp
index 41d31985..9a4dbcfe 100644
--- a/src/render/Glass.cpp
+++ b/src/render/Glass.cpp
@@ -1,12 +1,12 @@
#include "common.h"
-#include "patcher.h"
+
#include "Glass.h"
#include "Timer.h"
#include "Object.h"
#include "General.h"
#include "AudioScriptObject.h"
#include "World.h"
-#include "TimeCycle.h"
+#include "Timecycle.h"
#include "Particle.h"
#include "Camera.h"
#include "RenderBuffer.h"
@@ -404,6 +404,7 @@ CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity)
void
CGlass::RenderEntityInGlass(CEntity *entity)
{
+ ASSERT(entity!=nil);
CObject *object = (CObject *)entity;
if ( object->bGlassBroken )
@@ -419,7 +420,7 @@ CGlass::RenderEntityInGlass(CEntity *entity)
uint8 alpha = CalcAlphaWithNormal(&fwdNorm);
CColModel *col = object->GetColModel();
-
+ ASSERT(col!=nil);
if ( col->numTriangles >= 2 )
{
CVector a = object->GetMatrix() * col->vertices[0];
@@ -523,6 +524,8 @@ CGlass::RenderEntityInGlass(CEntity *entity)
int32
CGlass::CalcAlphaWithNormal(CVector *normal)
{
+ ASSERT(normal!=nil);
+
float fwdDir = 2.0f * DotProduct(*normal, TheCamera.GetForward());
float fwdDot = DotProduct(TheCamera.GetForward()-fwdDir*(*normal), CVector(0.57f, 0.57f, -0.57f));
return int32(lerp(fwdDot*fwdDot*fwdDot*fwdDot*fwdDot*fwdDot, 20.0f, 255.0f));
@@ -597,6 +600,8 @@ CGlass::RenderReflectionPolys(void)
void
CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, CVector point, bool explosion)
{
+ ASSERT(entity!=nil);
+
CObject *object = (CObject *)entity;
if ( object->bGlassBroken )
@@ -605,18 +610,19 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed,
object->bGlassCracked = true;
CColModel *col = object->GetColModel();
-
+ ASSERT(col!=nil);
+
CVector a = object->GetMatrix() * col->vertices[0];
CVector b = object->GetMatrix() * col->vertices[1];
CVector c = object->GetMatrix() * col->vertices[2];
CVector d = object->GetMatrix() * col->vertices[3];
- float minx = min(min(a.x, b.x), min(c.x, d.x));
- float maxx = max(max(a.x, b.x), max(c.x, d.x));
- float miny = min(min(a.y, b.y), min(c.y, d.y));
- float maxy = max(max(a.y, b.y), max(c.y, d.y));
- float minz = min(min(a.z, b.z), min(c.z, d.z));
- float maxz = max(max(a.z, b.z), max(c.z, d.z));
+ float minx = Min(Min(a.x, b.x), Min(c.x, d.x));
+ float maxx = Max(Max(a.x, b.x), Max(c.x, d.x));
+ float miny = Min(Min(a.y, b.y), Min(c.y, d.y));
+ float maxy = Max(Max(a.y, b.y), Max(c.y, d.y));
+ float minz = Min(Min(a.z, b.z), Min(c.z, d.z));
+ float maxz = Max(Max(a.z, b.z), Max(c.z, d.z));
if ( amount > 300.0f )
@@ -647,6 +653,8 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed,
void
CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount)
{
+ ASSERT(entity!=nil);
+
CObject *object = (CObject *)entity;
if ( amount > 50.0f && !object->bGlassCracked )
@@ -659,6 +667,8 @@ CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount)
void
CGlass::WasGlassHitByBullet(CEntity *entity, CVector point)
{
+ ASSERT(entity!=nil);
+
CObject *object = (CObject *)entity;
if ( IsGlass(object->GetModelIndex()) )
@@ -679,6 +689,8 @@ CGlass::WasGlassHitByBullet(CEntity *entity, CVector point)
void
CGlass::WindowRespondsToExplosion(CEntity *entity, CVector point)
{
+ ASSERT(entity!=nil);
+
CObject *object = (CObject *)entity;
CVector distToGlass = object->GetPosition() - point;
@@ -696,26 +708,3 @@ CGlass::WindowRespondsToExplosion(CEntity *entity, CVector point)
object->bGlassCracked = true;
}
}
-
-STARTPATCHES
- InjectHook(0x501F20, CGlass::Init, PATCH_JUMP);
- InjectHook(0x502050, CGlass::Update, PATCH_JUMP);
- InjectHook(0x502080, &CFallingGlassPane::Update, PATCH_JUMP);
- InjectHook(0x502350, CGlass::Render, PATCH_JUMP);
- InjectHook(0x502490, CGlass::FindFreePane, PATCH_JUMP);
- InjectHook(0x5024C0, &CFallingGlassPane::Render, PATCH_JUMP);
- InjectHook(0x502AC0, CGlass::GeneratePanesForWindow, PATCH_JUMP);
- InjectHook(0x5033F0, CGlass::AskForObjectToBeRenderedInGlass, PATCH_JUMP);
- InjectHook(0x503420, CGlass::RenderEntityInGlass, PATCH_JUMP);
- InjectHook(0x503C90, CGlass::CalcAlphaWithNormal, PATCH_JUMP);
- InjectHook(0x503D60, CGlass::RenderHiLightPolys, PATCH_JUMP);
- InjectHook(0x503DE0, CGlass::RenderShatteredPolys, PATCH_JUMP);
- InjectHook(0x503E70, CGlass::RenderReflectionPolys, PATCH_JUMP);
- InjectHook(0x503F10, CGlass::WindowRespondsToCollision, PATCH_JUMP);
- InjectHook(0x504630, CGlass::WindowRespondsToSoftCollision, PATCH_JUMP);
- InjectHook(0x504670, CGlass::WasGlassHitByBullet, PATCH_JUMP);
- InjectHook(0x504790, CGlass::WindowRespondsToExplosion, PATCH_JUMP);
- //InjectHook(0x504880, `global constructor keyed to'glass.cpp, PATCH_JUMP);
- //InjectHook(0x5048D0, CFallingGlassPane::~CFallingGlassPane, PATCH_JUMP);
- //InjectHook(0x5048E0, CFallingGlassPane::CFallingGlassPane, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Glass.h b/src/render/Glass.h
index dccd9d3d..51c5aae9 100644
--- a/src/render/Glass.h
+++ b/src/render/Glass.h
@@ -13,7 +13,6 @@ public:
uint8 m_nTriIndex;
bool m_bActive;
bool m_bShattered;
- char _pad0[1];
CFallingGlassPane() { }
~CFallingGlassPane() { }
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index a2db6640..a2a74109 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "Camera.h"
#include "DMAudio.h"
#include "Clock.h"
@@ -21,52 +21,52 @@
#include "User.h"
#include "World.h"
-wchar CHud::m_HelpMessage[256]; // = (wchar*)0x86B888;
-wchar CHud::m_LastHelpMessage[256]; // = (wchar*)0x6E8F28;
-uint32 CHud::m_HelpMessageState; // = *(int32*)0x880E1C;
-uint32 CHud::m_HelpMessageTimer; // = *(int32*)0x880FA4;
-int32 CHud::m_HelpMessageFadeTimer; // = *(int32*)0x8F6258;
-wchar CHud::m_HelpMessageToPrint[256]; // = (wchar*)0x664480;
-float CHud::m_fHelpMessageTime; // *(float *)0x8E2C28;
-bool CHud::m_HelpMessageQuick; // = *(bool*)0x95CCF7;
-uint32 CHud::m_ZoneState; // = *(int32*)0x8F29AC;
+wchar CHud::m_HelpMessage[256];
+wchar CHud::m_LastHelpMessage[256];
+uint32 CHud::m_HelpMessageState;
+uint32 CHud::m_HelpMessageTimer;
+int32 CHud::m_HelpMessageFadeTimer;
+wchar CHud::m_HelpMessageToPrint[256];
+float CHud::m_fHelpMessageTime;
+bool CHud::m_HelpMessageQuick;
+uint32 CHud::m_ZoneState;
int32 CHud::m_ZoneFadeTimer;
-uint32 CHud::m_ZoneNameTimer; // = *(int32*)0x8F1A50;
-wchar *CHud::m_pZoneName; // = *(wchar**)0x8E2C2C;
-wchar *CHud::m_pLastZoneName; // = (wchar*)0x8F432C;
+uint32 CHud::m_ZoneNameTimer;
+wchar *CHud::m_pZoneName;
+wchar *CHud::m_pLastZoneName;
wchar *CHud::m_ZoneToPrint;
-uint32 CHud::m_VehicleState; // = *(int32*)0x940560;
+uint32 CHud::m_VehicleState;
int32 CHud::m_VehicleFadeTimer;
-uint32 CHud::m_VehicleNameTimer; // = *(int32*)0x8F2A14;
-wchar *CHud::m_VehicleName; // = *(wchar**)0x942FB4;
-wchar *CHud::m_pLastVehicleName; // = *(wchar**)0x8E2DD8;
+uint32 CHud::m_VehicleNameTimer;
+wchar *CHud::m_VehicleName;
+wchar *CHud::m_pLastVehicleName;
wchar *CHud::m_pVehicleNameToPrint;
-wchar CHud::m_Message[256];// = (wchar*)0x72E318;
-wchar CHud::m_PagerMessage[256]; // = (wchar*)0x878840;
-bool CHud::m_Wants_To_Draw_Hud; // (bool*)0x95CD89;
-bool CHud::m_Wants_To_Draw_3dMarkers; // = *(bool*)0x95CD62;
-wchar CHud::m_BigMessage[6][128]; // = *(wchar(*)[6][128]) * (uintptr*)0x664CE0;
-int16 CHud::m_ItemToFlash; // = *(int16*)0x95CC82;
+wchar CHud::m_Message[256];
+wchar CHud::m_PagerMessage[256];
+bool CHud::m_Wants_To_Draw_Hud;
+bool CHud::m_Wants_To_Draw_3dMarkers;
+wchar CHud::m_BigMessage[6][128];
+int16 CHud::m_ItemToFlash;
// These aren't really in CHud
float CHud::BigMessageInUse[6];
float CHud::BigMessageAlpha[6];
float CHud::BigMessageX[6];
-float CHud::OddJob2OffTimer; // = *(float*)0x942FA0;
-bool CHud::CounterOnLastFrame; // = *(int8*)0x95CD67;
-float CHud::OddJob2XOffset; // = *(float*)0x8F1B5C;
-uint16 CHud::CounterFlashTimer; // = *(int16*)0x95CC20;
-uint16 CHud::OddJob2Timer; // = *(int16*)0x95CC52;
-bool CHud::TimerOnLastFrame; //= *(int8*)0x95CDA7;
-int16 CHud::OddJob2On; //= *(int16*)0x95CC78;
-uint16 CHud::TimerFlashTimer; //= *(int16*)0x95CC6C;
-int16 CHud::PagerSoundPlayed; //= *(int16*)0x95CC4A;
-int32 CHud::SpriteBrightness; //= *(int32*)0x95CC54;
-float CHud::PagerXOffset; //= *(float*)0x941590;
-int16 CHud::PagerTimer; //= *(int16*)0x95CC3A;
-int16 CHud::PagerOn; //= *(int16*)0x95CCA0;
-
-CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; // = (CSprite2d*)0x95CB9C;
+float CHud::OddJob2OffTimer;
+bool CHud::CounterOnLastFrame;
+float CHud::OddJob2XOffset;
+uint16 CHud::CounterFlashTimer;
+uint16 CHud::OddJob2Timer;
+bool CHud::TimerOnLastFrame;
+int16 CHud::OddJob2On;
+uint16 CHud::TimerFlashTimer;
+int16 CHud::PagerSoundPlayed;
+int32 CHud::SpriteBrightness;
+float CHud::PagerXOffset;
+int16 CHud::PagerTimer;
+int16 CHud::PagerOn;
+
+CSprite2d CHud::Sprites[NUM_HUD_SPRITES];
struct
{
@@ -98,8 +98,8 @@ struct
{"siterocket", "siterocket"}
};
-RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
-RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20;
+RwTexture *gpSniperSightTex;
+RwTexture *gpRocketSightTex;
void CHud::Draw()
{
@@ -136,7 +136,7 @@ void CHud::Draw()
if (DrawCrossHair || DrawCrossHairPC) {
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
- SpriteBrightness = min(SpriteBrightness+1, 30);
+ SpriteBrightness = Min(SpriteBrightness+1, 30);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
@@ -144,12 +144,10 @@ void CHud::Draw()
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect;
if (DrawCrossHairPC && TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()) {
-#ifndef ASPECT_RATIO_SCALE
float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY;
-#else
- float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH;
- float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f);
+#ifdef ASPECT_RATIO_SCALE
+ f3rdY -= SCREEN_SCALE_Y(2.0f);
#endif
if (FindPlayerPed() && WeaponType == WEAPONTYPE_M16) {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f);
@@ -475,7 +473,12 @@ void CHud::Draw()
break;
}
+
+#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) {
+#else
+ if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide zone name if wasted/busted text is displaying
+#endif
m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@@ -565,7 +568,11 @@ void CHud::Draw()
break;
}
+#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) {
+#else
+ if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide vehicle name if wasted/busted text is displaying
+#endif
m_VehicleNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@@ -708,7 +715,7 @@ void CHud::Draw()
} else {
int counter = atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer);
#ifdef FIX_BUGS
- counter = min(counter, 100);
+ counter = Min(counter, 100);
#endif
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 80));
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(counter) / 2.0f + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET + 50.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255));
@@ -1204,7 +1211,7 @@ void CHud::DrawAfterFade()
OddJob2On = 2;
}
else {
- fStep = min(40.0f, OddJob2XOffset / 6.0f);
+ fStep = Min(40.0f, OddJob2XOffset / 6.0f);
OddJob2XOffset = OddJob2XOffset - fStep;
}
break;
@@ -1215,7 +1222,7 @@ void CHud::DrawAfterFade()
}
break;
case 3:
- fStep = max(30.0f, OddJob2XOffset / 5.0f);
+ fStep = Max(30.0f, OddJob2XOffset / 5.0f);
OddJob2XOffset = OddJob2XOffset - fStep;
@@ -1238,10 +1245,17 @@ void CHud::DrawAfterFade()
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONTJAP(FONT_BANK));
+#ifdef BETA_SLIDING_TEXT
+ CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
+
+ CFont::SetColor(CRGBA(156, 91, 40, 255));
+ CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
+#else
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
CFont::SetColor(CRGBA(156, 91, 40, 255));
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
+#endif
}
}
@@ -1490,18 +1504,3 @@ void CHud::Shutdown()
int HudTXD = CTxdStore::FindTxdSlot("hud");
CTxdStore::RemoveTxdSlot(HudTXD);
}
-
-STARTPATCHES
- InjectHook(0x5052A0, &CHud::Draw, PATCH_JUMP);
- InjectHook(0x509030, &CHud::DrawAfterFade, PATCH_JUMP);
- InjectHook(0x504F90, &CHud::GetRidOfAllHudMessages, PATCH_JUMP);
- InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP);
- InjectHook(0x504CC0, &CHud::ReInitialise, PATCH_JUMP);
- InjectHook(0x50A250, &CHud::SetBigMessage, PATCH_JUMP);
- InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP);
- InjectHook(0x50A210, &CHud::SetMessage, PATCH_JUMP);
- InjectHook(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP);
- InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP);
- InjectHook(0x5051D0, &CHud::SetZoneName, PATCH_JUMP);
- InjectHook(0x504C50, &CHud::Shutdown, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Instance.cpp b/src/render/Instance.cpp
new file mode 100644
index 00000000..be6d73d6
--- /dev/null
+++ b/src/render/Instance.cpp
@@ -0,0 +1,9 @@
+#include "common.h"
+
+#include "Instance.h"
+
+void
+CInstance::Shutdown()
+{
+ GetMatrix().Detach();
+}
diff --git a/src/render/Instance.h b/src/render/Instance.h
new file mode 100644
index 00000000..01dfb6a2
--- /dev/null
+++ b/src/render/Instance.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "Placeable.h"
+
+// unused
+
+class CInstance : public CPlaceable
+{
+public:
+ int m_modelIndex;
+public:
+ ~CInstance() = default;
+ void Shutdown();
+};
diff --git a/src/render/Lines.cpp b/src/render/Lines.cpp
index ea433048..b5c85149 100644
--- a/src/render/Lines.cpp
+++ b/src/render/Lines.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "Lines.h"
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index d28671fa..c3a25bce 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -1,14 +1,14 @@
#include "common.h"
-#include "patcher.h"
+
#include "RwHelper.h"
#include "Camera.h"
#include "MBlur.h"
// Originally taken from RW example 'mblur'
-RwRaster *&CMBlur::pFrontBuffer = *(RwRaster**)0x8E2C48;
-bool &CMBlur::ms_bJustInitialised = *(bool*)0x95CDAB;
-bool &CMBlur::BlurOn = *(bool*)0x95CDAD;
+RwRaster *CMBlur::pFrontBuffer;
+bool CMBlur::ms_bJustInitialised;
+bool CMBlur::BlurOn;
static RwIm2DVertex Vertex[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
@@ -213,11 +213,3 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
}
-
-STARTPATCHES
- InjectHook(0x50AE40, CMBlur::MotionBlurOpen, PATCH_JUMP);
- InjectHook(0x50B170, CMBlur::MotionBlurClose, PATCH_JUMP);
- InjectHook(0x50A800, CMBlur::CreateImmediateModeData, PATCH_JUMP);
- InjectHook(0x50AD70, CMBlur::MotionBlurRender, PATCH_JUMP);
- InjectHook(0x50A9C0, CMBlur::OverlayRender, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/MBlur.h b/src/render/MBlur.h
index 42827f99..e8a5bef8 100644
--- a/src/render/MBlur.h
+++ b/src/render/MBlur.h
@@ -3,9 +3,9 @@
class CMBlur
{
public:
- static RwRaster *&pFrontBuffer;
- static bool &ms_bJustInitialised;
- static bool &BlurOn;
+ static RwRaster *pFrontBuffer;
+ static bool ms_bJustInitialised;
+ static bool BlurOn;
public:
static void MotionBlurOpen(RwCamera *cam);
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 6956a887..c855c860 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "General.h"
#include "Timer.h"
#include "TxdStore.h"
@@ -12,9 +12,6 @@
#include "ParticleObject.h"
#include "Particle.h"
-#ifdef TOGGLEABLE_BETA_FEATURES
-bool CParticle::bEnableBannedParticles = false;
-#endif
#define MAX_PARTICLES_ON_SCREEN (1000)
@@ -204,26 +201,21 @@ RwRaster *gpGunShellRaster;
RwRaster *gpWakeOldRaster;
-//RwRaster *gpPointlightRaster; // CPointLights::RenderFogEffect
-RwRaster *&gpPointlightRaster = *(RwRaster **)0x8F5FE0;
+RwRaster *gpPointlightRaster; // CPointLights::RenderFogEffect
-//RwTexture *gpRainDropTex[MAX_RAINDROP_FILES]; // CWeather::RenderRainStreaks
-RwTexture * (&gpRainDropTex)[MAX_RAINDROP_FILES] = *(RwTexture * (*)[MAX_RAINDROP_FILES])*(int *)0x880660;
+RwTexture *gpRainDropTex[MAX_RAINDROP_FILES]; // CWeather::RenderRainStreaks
RwRaster *gpRainDropRaster[MAX_RAINDROP_FILES];
-//Float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; //
-float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8;
+float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE];
CParticle *CParticle::m_pUnusedListHead;
-//Float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; //
-//Float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; /
-float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358;
-float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18;
+float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE];
+float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE];
int32 Randomizer;
@@ -393,8 +385,12 @@ void CParticle::Initialise()
gpFlame5Tex = RwTextureRead("flame5", nil);
+#ifdef FIX_BUGS
+ gpFlame5Raster = RwTextureGetRaster(gpFlame5Tex);
+#else
gpFlame5Raster = RwTextureGetRaster(gpFlame1Tex); // copy-paste bug ?
-
+#endif
+
gpRainDropSmallTex = RwTextureRead("rainsmall", nil);
gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex);
@@ -772,9 +768,8 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
{
if ( CTimer::GetIsPaused() )
return NULL;
-#ifdef TOGGLEABLE_BETA_FEATURES
- if(!bEnableBannedParticles)
-#endif
+
+#ifdef PC_PARTICLE
if ( ( type == PARTICLE_ENGINE_SMOKE
|| type == PARTICLE_ENGINE_SMOKE2
|| type == PARTICLE_ENGINE_STEAM
@@ -787,6 +782,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
{
return nil;
}
+#endif
CParticle *pParticle = m_pUnusedListHead;
@@ -858,6 +854,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
pParticle->m_nRotation = nRotation;
+// PC only
if ( pParticle->m_nRotation >= 360 )
pParticle->m_nRotation -= 360;
else if ( pParticle->m_nRotation < 0 )
@@ -1353,12 +1350,13 @@ void CParticle::Update()
particle->m_nAlpha = clamp(particle->m_nAlpha - psystem->m_nFadeAlphaAmount,
0, 255);
-
+#ifdef PC_PARTICLE
if ( particle->m_nAlpha == 0 )
{
bRemoveParticle = true;
continue;
}
+#endif
}
else
++particle->m_nFadeAlphaTimer;
@@ -1453,18 +1451,15 @@ void CParticle::Render()
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
-
+#ifdef PC_PARTICLE
bool particleBanned = false;
-
+#endif
CParticle *particle = psystem->m_pParticles;
RwRaster **frames = psystem->m_ppRaster;
-
+#ifdef PC_PARTICLE
tParticleType type = psystem->m_Type;
-#ifdef TOGGLEABLE_BETA_FEATURES
- if (!bEnableBannedParticles)
-#endif
if ( type == PARTICLE_ENGINE_SMOKE
|| type == PARTICLE_ENGINE_SMOKE2
|| type == PARTICLE_ENGINE_STEAM
@@ -1476,7 +1471,8 @@ void CParticle::Render()
{
particleBanned = true;
}
-
+#endif
+
if ( particle )
{
if ( (flags & DRAW_OPAQUE) != (psystem->Flags & DRAW_OPAQUE)
@@ -1517,10 +1513,11 @@ void CParticle::Render()
while ( particle != nil )
{
bool canDraw = true;
+#ifdef PC_PARTICLE
if ( particle->m_nAlpha == 0 )
canDraw = false;
-
+#endif
if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil )
{
RwRaster *curFrame = frames[particle->m_nCurrentFrame];
@@ -1543,7 +1540,7 @@ void CParticle::Render()
particle->m_fSize * 63.0f,
particle->m_Color,
particle->m_nColorIntensity,
- (float)particle->m_nRotation,
+ (float)particle->m_nRotation, //DEGTORAD((float)particle->m_nRotation) ps2
particle->m_nAlpha);
}
else
@@ -1569,8 +1566,10 @@ void CParticle::Render()
if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
{
+#ifdef PC_PARTICLE
if ( (!particleBanned || SCREEN_WIDTH * fParticleScaleLimit >= w)
&& SCREEN_HEIGHT * fParticleScaleLimit >= h )
+#endif
{
if ( particle->m_nRotation != 0 )
{
@@ -1581,7 +1580,7 @@ void CParticle::Render()
particle->m_Color.blue,
particle->m_nColorIntensity,
1.0f / coors.z,
- float(particle->m_nRotation),
+ float(particle->m_nRotation), // DEGTORAD((float)particle->m_nRotation) ps2
particle->m_nAlpha);
}
else if ( psystem->Flags & SCREEN_TRAIL )
@@ -1606,7 +1605,6 @@ void CParticle::Render()
fTrailLength = fDist;
- //Float fRot = Atan2( vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
float fRot = Asin(vecDist.x / fDist);
fRotation = fRot;
@@ -1658,7 +1656,6 @@ void CParticle::Render()
fTrailLength = fDist;
- //Float fRot = Atan2(vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
float fRot = Asin(vecDist.x / fDist);
fRotation = fRot;
@@ -1854,19 +1851,3 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr
0.3f, color, 0, 0, 0, 0);
}
}
-
-STARTPATCHES
- //InjectHook(0x50C410, &CParticle::ctor, PATCH_JUMP);
- //InjectHook(0x50C420, &CParticle::dtor, PATCH_JUMP);
- InjectHook(0x50C430, CParticle::ReloadConfig, PATCH_JUMP);
- InjectHook(0x50C570, CParticle::Initialise, PATCH_JUMP);
- InjectHook(0x50CF40, CParticle::Shutdown, PATCH_JUMP);
- //InjectHook(0x50D140, CParticle::AddParticle, PATCH_JUMP);
- InjectHook(0x50D190, (CParticle *(*)(tParticleType, CVector const&, CVector const&, CEntity*, float, RwRGBA const&, int, int, int, int))CParticle::AddParticle, PATCH_JUMP);
- InjectHook(0x50DCF0, CParticle::Update, PATCH_JUMP);
- InjectHook(0x50EE20, CParticle::Render, PATCH_JUMP);
- InjectHook(0x50F6E0, CParticle::RemovePSystem, PATCH_JUMP);
- InjectHook(0x50F720, CParticle::RemoveParticle, PATCH_JUMP);
- InjectHook(0x50F760, CParticle::AddJetExplosion, PATCH_JUMP);
- InjectHook(0x50FAA0, CParticle::AddYardieDoorSmoke, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Particle.h b/src/render/Particle.h
index 310ef0d4..b71dc717 100644
--- a/src/render/Particle.h
+++ b/src/render/Particle.h
@@ -24,7 +24,6 @@ public:
uint16 m_nZRotationTimer;
float m_fCurrentZRadius;
uint16 m_nZRadiusTimer;
- char _pad0[2];
float m_fSize;
float m_fExpansionRate;
uint16 m_nFadeToBlackTimer;
@@ -36,7 +35,6 @@ public:
int16 m_nRotationStep;
int16 m_nRotation;
RwRGBA m_Color;
- char _pad1[2];
CParticle *m_pNext;
CParticle()
@@ -49,16 +47,11 @@ public:
;
}
- //static float ms_afRandTable[RAND_TABLE_SIZE];
- static float (&ms_afRandTable)[RAND_TABLE_SIZE];
+ static float ms_afRandTable[RAND_TABLE_SIZE];
static CParticle *m_pUnusedListHead;
- /*
static float m_SinTable[SIN_COS_TABLE_SIZE];
static float m_CosTable[SIN_COS_TABLE_SIZE];
- */
- static float (&m_SinTable)[SIN_COS_TABLE_SIZE];
- static float (&m_CosTable)[SIN_COS_TABLE_SIZE];
static float Sin(int32 value) { return m_SinTable[value]; }
static float Cos(int32 value) { return m_CosTable[value]; }
@@ -96,10 +89,6 @@ public:
static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize);
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
-
-#ifndef MASTER
- static bool bEnableBannedParticles;
-#endif
};
VALIDATE_SIZE(CParticle, 0x68); \ No newline at end of file
diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp
index 7a1804de..3387d471 100644
--- a/src/render/ParticleMgr.cpp
+++ b/src/render/ParticleMgr.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "FileMgr.h"
#include "ParticleMgr.h"
@@ -8,8 +8,7 @@ cParticleSystemMgr mod_ParticleSystemManager;
const char *ParticleFilename = "PARTICLE.CFG";
-//cParticleSystemMgr::cParticleSystemMgr()
-void cParticleSystemMgr::ctor()
+cParticleSystemMgr::cParticleSystemMgr()
{
memset(this, 0, sizeof(*this));
}
@@ -91,7 +90,7 @@ void cParticleSystemMgr::LoadParticleData()
break;
case CFG_PARAM_INITIAL_COLOR_VARIATION:
- entry->m_InitialColorVariation = min(atoi(value), 100);
+ entry->m_InitialColorVariation = Min(atoi(value), 100);
break;
case CFG_PARAM_FADE_DESTINATION_COLOR_R:
@@ -242,9 +241,3 @@ void cParticleSystemMgr::LoadParticleData()
lineEnd++;
}
}
-
-STARTPATCHES
- InjectHook(0x50FCB0, &cParticleSystemMgr::ctor, PATCH_JUMP);
- InjectHook(0x50FCD0, &cParticleSystemMgr::Initialise, PATCH_JUMP);
- InjectHook(0x50FDF0, &cParticleSystemMgr::LoadParticleData, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h
index 5e8da1e4..70845a56 100644
--- a/src/render/ParticleMgr.h
+++ b/src/render/ParticleMgr.h
@@ -1,82 +1,8 @@
#pragma once
-class CParticle;
+#include "ParticleType.h"
-enum tParticleType
-{
- PARTICLE_SPARK = 0,
- PARTICLE_SPARK_SMALL,
- PARTICLE_WHEEL_DIRT,
- PARTICLE_WHEEL_WATER,
- PARTICLE_BLOOD,
- PARTICLE_BLOOD_SMALL,
- PARTICLE_BLOOD_SPURT,
- PARTICLE_DEBRIS,
- PARTICLE_DEBRIS2,
- PARTICLE_WATER,
- PARTICLE_FLAME,
- PARTICLE_FIREBALL,
- PARTICLE_GUNFLASH,
- PARTICLE_GUNFLASH_NOANIM,
- PARTICLE_GUNSMOKE,
- PARTICLE_GUNSMOKE2,
- PARTICLE_SMOKE,
- PARTICLE_SMOKE_SLOWMOTION,
- PARTICLE_GARAGEPAINT_SPRAY,
- PARTICLE_SHARD,
- PARTICLE_SPLASH,
- PARTICLE_CARFLAME,
- PARTICLE_STEAM,
- PARTICLE_STEAM2,
- PARTICLE_STEAM_NY,
- PARTICLE_STEAM_NY_SLOWMOTION,
- PARTICLE_ENGINE_STEAM,
- PARTICLE_RAINDROP,
- PARTICLE_RAINDROP_SMALL,
- PARTICLE_RAIN_SPLASH,
- PARTICLE_RAIN_SPLASH_BIGGROW,
- PARTICLE_RAIN_SPLASHUP,
- PARTICLE_WATERSPRAY,
- PARTICLE_EXPLOSION_MEDIUM,
- PARTICLE_EXPLOSION_LARGE,
- PARTICLE_EXPLOSION_MFAST,
- PARTICLE_EXPLOSION_LFAST,
- PARTICLE_CAR_SPLASH,
- PARTICLE_BOAT_SPLASH,
- PARTICLE_BOAT_THRUSTJET,
- PARTICLE_BOAT_WAKE,
- PARTICLE_WATER_HYDRANT,
- PARTICLE_WATER_CANNON,
- PARTICLE_EXTINGUISH_STEAM,
- PARTICLE_PED_SPLASH,
- PARTICLE_PEDFOOT_DUST,
- PARTICLE_HELI_DUST,
- PARTICLE_HELI_ATTACK,
- PARTICLE_ENGINE_SMOKE,
- PARTICLE_ENGINE_SMOKE2,
- PARTICLE_CARFLAME_SMOKE,
- PARTICLE_FIREBALL_SMOKE,
- PARTICLE_PAINT_SMOKE,
- PARTICLE_TREE_LEAVES,
- PARTICLE_CARCOLLISION_DUST,
- PARTICLE_CAR_DEBRIS,
- PARTICLE_HELI_DEBRIS,
- PARTICLE_EXHAUST_FUMES,
- PARTICLE_RUBBER_SMOKE,
- PARTICLE_BURNINGRUBBER_SMOKE,
- PARTICLE_BULLETHIT_SMOKE,
- PARTICLE_GUNSHELL_FIRST,
- PARTICLE_GUNSHELL,
- PARTICLE_GUNSHELL_BUMP1,
- PARTICLE_GUNSHELL_BUMP2,
- PARTICLE_TEST,
- PARTICLE_BIRD_FRONT,
- PARTICLE_RAINDROP_2D,
-
- MAX_PARTICLES,
- PARTICLE_FIRST = PARTICLE_SPARK,
- PARTICLE_LAST = PARTICLE_RAINDROP_2D
-};
+class CParticle;
enum
{
@@ -120,7 +46,6 @@ struct tParticleSystemData
uint16 m_nFinalAnimationFrame;
uint16 m_nAnimationSpeed;
uint16 m_nRotationSpeed;
- char _pad1[2];
float m_fGravitationalAcceleration;
int32 m_nFrictionDecceleration;
int32 m_nLifeSpan;
@@ -134,7 +59,6 @@ struct tParticleSystemData
RwRGBA m_RenderColouring;
uint8 m_InitialColorVariation;
RwRGBA m_FadeDestinationColor;
- char _pad2[3];
uint32 m_ColorFadeTime;
RwRaster **m_ppRaster;
@@ -194,11 +118,11 @@ class cParticleSystemMgr
public:
tParticleSystemData m_aParticles[MAX_PARTICLES];
- cParticleSystemMgr() { ctor(); } void ctor();
+ cParticleSystemMgr();
void Initialise();
void LoadParticleData();
- //void RangeCheck(tParticleSystemData *pData);
+ void RangeCheck(tParticleSystemData *pData) { }
};
VALIDATE_SIZE(cParticleSystemMgr, 0x2420);
diff --git a/src/render/ParticleType.h b/src/render/ParticleType.h
new file mode 100644
index 00000000..8d352c44
--- /dev/null
+++ b/src/render/ParticleType.h
@@ -0,0 +1,77 @@
+#pragma once
+
+enum tParticleType
+{
+ PARTICLE_SPARK = 0,
+ PARTICLE_SPARK_SMALL,
+ PARTICLE_WHEEL_DIRT,
+ PARTICLE_WHEEL_WATER,
+ PARTICLE_BLOOD,
+ PARTICLE_BLOOD_SMALL,
+ PARTICLE_BLOOD_SPURT,
+ PARTICLE_DEBRIS,
+ PARTICLE_DEBRIS2,
+ PARTICLE_WATER,
+ PARTICLE_FLAME,
+ PARTICLE_FIREBALL,
+ PARTICLE_GUNFLASH,
+ PARTICLE_GUNFLASH_NOANIM,
+ PARTICLE_GUNSMOKE,
+ PARTICLE_GUNSMOKE2,
+ PARTICLE_SMOKE,
+ PARTICLE_SMOKE_SLOWMOTION,
+ PARTICLE_GARAGEPAINT_SPRAY,
+ PARTICLE_SHARD,
+ PARTICLE_SPLASH,
+ PARTICLE_CARFLAME,
+ PARTICLE_STEAM,
+ PARTICLE_STEAM2,
+ PARTICLE_STEAM_NY,
+ PARTICLE_STEAM_NY_SLOWMOTION,
+ PARTICLE_ENGINE_STEAM,
+ PARTICLE_RAINDROP,
+ PARTICLE_RAINDROP_SMALL,
+ PARTICLE_RAIN_SPLASH,
+ PARTICLE_RAIN_SPLASH_BIGGROW,
+ PARTICLE_RAIN_SPLASHUP,
+ PARTICLE_WATERSPRAY,
+ PARTICLE_EXPLOSION_MEDIUM,
+ PARTICLE_EXPLOSION_LARGE,
+ PARTICLE_EXPLOSION_MFAST,
+ PARTICLE_EXPLOSION_LFAST,
+ PARTICLE_CAR_SPLASH,
+ PARTICLE_BOAT_SPLASH,
+ PARTICLE_BOAT_THRUSTJET,
+ PARTICLE_BOAT_WAKE,
+ PARTICLE_WATER_HYDRANT,
+ PARTICLE_WATER_CANNON,
+ PARTICLE_EXTINGUISH_STEAM,
+ PARTICLE_PED_SPLASH,
+ PARTICLE_PEDFOOT_DUST,
+ PARTICLE_HELI_DUST,
+ PARTICLE_HELI_ATTACK,
+ PARTICLE_ENGINE_SMOKE,
+ PARTICLE_ENGINE_SMOKE2,
+ PARTICLE_CARFLAME_SMOKE,
+ PARTICLE_FIREBALL_SMOKE,
+ PARTICLE_PAINT_SMOKE,
+ PARTICLE_TREE_LEAVES,
+ PARTICLE_CARCOLLISION_DUST,
+ PARTICLE_CAR_DEBRIS,
+ PARTICLE_HELI_DEBRIS,
+ PARTICLE_EXHAUST_FUMES,
+ PARTICLE_RUBBER_SMOKE,
+ PARTICLE_BURNINGRUBBER_SMOKE,
+ PARTICLE_BULLETHIT_SMOKE,
+ PARTICLE_GUNSHELL_FIRST,
+ PARTICLE_GUNSHELL,
+ PARTICLE_GUNSHELL_BUMP1,
+ PARTICLE_GUNSHELL_BUMP2,
+ PARTICLE_TEST,
+ PARTICLE_BIRD_FRONT,
+ PARTICLE_RAINDROP_2D,
+
+ MAX_PARTICLES,
+ PARTICLE_FIRST = PARTICLE_SPARK,
+ PARTICLE_LAST = PARTICLE_RAINDROP_2D
+}; \ No newline at end of file
diff --git a/src/render/PlayerSkin.cpp b/src/render/PlayerSkin.cpp
index 2cba45fe..94af1fd1 100644
--- a/src/render/PlayerSkin.cpp
+++ b/src/render/PlayerSkin.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "PlayerSkin.h"
#include "TxdStore.h"
@@ -163,12 +163,3 @@ CPlayerSkin::RenderFrontendSkinEdit(void)
SetAmbientColours(&AmbientColor);
RpClumpRender(gpPlayerClump);
}
-
-STARTPATCHES
-InjectHook(0x59B9B0, &CPlayerSkin::Initialise, PATCH_JUMP);
-InjectHook(0x59B9E0, &CPlayerSkin::Shutdown, PATCH_JUMP);
-InjectHook(0x59B9F0, &CPlayerSkin::GetSkinTexture, PATCH_JUMP);
-InjectHook(0x59BC70, &CPlayerSkin::BeginFrontendSkinEdit, PATCH_JUMP);
-InjectHook(0x59BCB0, &CPlayerSkin::EndFrontendSkinEdit, PATCH_JUMP);
-InjectHook(0x59BCE0, &CPlayerSkin::RenderFrontendSkinEdit, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp
index a015ec54..b92e7e83 100644
--- a/src/render/PointLights.cpp
+++ b/src/render/PointLights.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "Lights.h"
#include "Camera.h"
@@ -10,8 +10,8 @@
#include "Timer.h"
#include "PointLights.h"
-int16 &CPointLights::NumLights = *(int16*)0x95CC3E;
-CRegisteredPointLight *CPointLights::aLights = (CRegisteredPointLight*)0x7096D0;
+int16 CPointLights::NumLights;
+CRegisteredPointLight CPointLights::aLights[NUMPOINTLIGHTS];
void
CPointLights::InitPerFrame(void)
@@ -98,7 +98,7 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors)
if(aLights[i].type == LIGHT_DIRECTIONAL){
float dot = -DotProduct(dir, aLights[i].dir);
- intensity *= max((dot-0.5f)*2.0f, 0.0f);
+ intensity *= Max((dot-0.5f)*2.0f, 0.0f);
}
if(intensity > 0.0f)
@@ -114,7 +114,7 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors)
return ret;
}
-extern RwRaster *&gpPointlightRaster;
+extern RwRaster *gpPointlightRaster;
void
CPointLights::RemoveLightsAffectingObject(void)
@@ -284,10 +284,3 @@ CPointLights::RenderFogEffect(void)
}
}
}
-
-STARTPATCHES
- InjectHook(0x510790, CPointLights::AddLight, PATCH_JUMP);
- InjectHook(0x510960, CPointLights::GenerateLightsAffectingObject, PATCH_JUMP);
- InjectHook(0x510C20, CPointLights::RemoveLightsAffectingObject, PATCH_JUMP);
- InjectHook(0x510C30, CPointLights::RenderFogEffect, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/PointLights.h b/src/render/PointLights.h
index c1dad87f..215e1dc9 100644
--- a/src/render/PointLights.h
+++ b/src/render/PointLights.h
@@ -18,8 +18,8 @@ static_assert(sizeof(CRegisteredPointLight) == 0x2C, "CRegisteredPointLight: err
class CPointLights
{
public:
- static int16 &NumLights;
- static CRegisteredPointLight *aLights; //[NUMPOINTLIGHTS]
+ static int16 NumLights;
+ static CRegisteredPointLight aLights[NUMPOINTLIGHTS];
enum {
LIGHT_POINT,
diff --git a/src/render/RenderBuffer.cpp b/src/render/RenderBuffer.cpp
index f6499451..6120dfe2 100644
--- a/src/render/RenderBuffer.cpp
+++ b/src/render/RenderBuffer.cpp
@@ -1,15 +1,15 @@
#include "common.h"
-#include "patcher.h"
+
#include "RenderBuffer.h"
-int32 &TempBufferVerticesStored = *(int32*)0x8F5F78;
-int32 &TempBufferIndicesStored = *(int32*)0x8F1A4C;
+int32 TempBufferVerticesStored;
+int32 TempBufferIndicesStored;
-RwIm3DVertex *TempBufferRenderVertices = (RwIm3DVertex*)0x862330;
-RwImVertexIndex *TempBufferRenderIndexList = (RwImVertexIndex*)0x846288;
+RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
+RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
-int &RenderBuffer::VerticesToBeStored = *(int*)0x8F59C4;
-int &RenderBuffer::IndicesToBeStored = *(int*)0x8E28B0;
+int RenderBuffer::VerticesToBeStored;
+int RenderBuffer::IndicesToBeStored;
void
RenderBuffer::ClearRenderBuffer(void)
@@ -50,10 +50,3 @@ RenderBuffer::RenderStuffInBuffer(void)
}
ClearRenderBuffer();
}
-
-STARTPATCHES
- InjectHook(0x517620, RenderBuffer::ClearRenderBuffer, PATCH_JUMP);
- InjectHook(0x517640, RenderBuffer::StartStoring, PATCH_JUMP);
- InjectHook(0x5176B0, RenderBuffer::StopStoring, PATCH_JUMP);
- InjectHook(0x5177C0, RenderBuffer::RenderStuffInBuffer, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/RenderBuffer.h b/src/render/RenderBuffer.h
index 2b8a9f86..485d24e3 100644
--- a/src/render/RenderBuffer.h
+++ b/src/render/RenderBuffer.h
@@ -1,8 +1,8 @@
class RenderBuffer
{
public:
- static int &VerticesToBeStored;
- static int &IndicesToBeStored;
+ static int VerticesToBeStored;
+ static int IndicesToBeStored;
static void ClearRenderBuffer(void);
static void StartStoring(int numIndices, int numVertices, RwImVertexIndex **indexStart, RwIm3DVertex **vertexStart);
static void StopStoring(void);
@@ -12,7 +12,7 @@ public:
#define TEMPBUFFERVERTSIZE 256
#define TEMPBUFFERINDEXSIZE 1024
-extern int32 &TempBufferVerticesStored;
-extern int32 &TempBufferIndicesStored;
-extern RwIm3DVertex *TempBufferRenderVertices;
-extern RwImVertexIndex *TempBufferRenderIndexList; \ No newline at end of file
+extern int32 TempBufferVerticesStored;
+extern int32 TempBufferIndicesStored;
+extern RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
+extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; \ No newline at end of file
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index d7834065..3d308c52 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "Lights.h"
#include "ModelInfo.h"
@@ -39,16 +39,17 @@ struct EntityInfo
float sort;
};
-CLinkList<EntityInfo> &gSortedVehiclesAndPeds = *(CLinkList<EntityInfo>*)0x629AC0;
+CLinkList<EntityInfo> gSortedVehiclesAndPeds;
-int32 &CRenderer::ms_nNoOfVisibleEntities = *(int32*)0x940730;
-CEntity *(&CRenderer::ms_aVisibleEntityPtrs)[NUMVISIBLEENTITIES] = *(CEntity * (*)[NUMVISIBLEENTITIES]) * (uintptr*)0x6E9920;
-CEntity *(&CRenderer::ms_aInVisibleEntityPtrs)[NUMINVISIBLEENTITIES] = *(CEntity * (*)[NUMINVISIBLEENTITIES]) * (uintptr*)0x880B50;
-int32 &CRenderer::ms_nNoOfInVisibleEntities = *(int32*)0x8F1B78;
+int32 CRenderer::ms_nNoOfVisibleEntities;
+CEntity *CRenderer::ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
+CEntity *CRenderer::ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
+int32 CRenderer::ms_nNoOfInVisibleEntities;
-CVector &CRenderer::ms_vecCameraPosition = *(CVector*)0x8E2C3C;
-CVehicle *&CRenderer::m_pFirstPersonVehicle = *(CVehicle**)0x885B80;
-bool &CRenderer::m_loadingPriority = *(bool*)0x95CD86;
+CVector CRenderer::ms_vecCameraPosition;
+CVehicle *CRenderer::m_pFirstPersonVehicle;
+bool CRenderer::m_loadingPriority;
+float CRenderer::ms_lodDistScale = 1.2f;
void
CRenderer::Init(void)
@@ -193,8 +194,6 @@ CRenderer::RenderRoads(void)
DeActivateDirectional();
SetAmbientColours();
- ThePaths.m_pathNodes[-1].group = 6;
-
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
t = (CTreadable*)ms_aVisibleEntityPtrs[i];
if(t->IsBuilding() && t->GetIsATreadable()){
@@ -1206,40 +1205,3 @@ CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset)
if(reset)
ReSetAmbientAndDirectionalColours();
}
-
-STARTPATCHES
- InjectHook(0x4A7680, CRenderer::Init, PATCH_JUMP);
- InjectHook(0x4A76A0, CRenderer::Shutdown, PATCH_JUMP);
-
- InjectHook(0x4A7B90, CRenderer::RenderOneRoad, PATCH_JUMP);
- InjectHook(0x4A7BA0, CRenderer::RenderOneNonRoad, PATCH_JUMP);
- InjectHook(0x4A7B20, CRenderer::RenderFirstPersonVehicle, PATCH_JUMP);
- InjectHook(0x4A78B0, CRenderer::RenderRoads, PATCH_JUMP);
- InjectHook(0x4A7930, CRenderer::RenderEverythingBarRoads, PATCH_JUMP);
- InjectHook(0x4A7AA0, CRenderer::RenderVehiclesButNotBoats, PATCH_JUMP);
- InjectHook(0x4A7AE0, CRenderer::RenderBoats, PATCH_JUMP);
- InjectHook(0x4A7910, CRenderer::RenderFadingInEntities, PATCH_JUMP);
-
- InjectHook(0x4A9350, CRenderer::SetupEntityVisibility, PATCH_JUMP);
- InjectHook(0x4A9920, CRenderer::SetupBigBuildingVisibility, PATCH_JUMP);
-
- InjectHook(0x4A76B0, CRenderer::ConstructRenderList, PATCH_JUMP);
- InjectHook(0x4A7840, CRenderer::PreRender, PATCH_JUMP);
- InjectHook(0x4A8970, CRenderer::ScanWorld, PATCH_JUMP);
- InjectHook(0x4AA240, CRenderer::RequestObjectsInFrustum, PATCH_JUMP);
- InjectHook(0x4A7F30, CRenderer::ScanSectorPoly, PATCH_JUMP);
- InjectHook(0x4A9300, CRenderer::ScanBigBuildingList, PATCH_JUMP);
- InjectHook(0x4A9BB0, CRenderer::ScanSectorList, PATCH_JUMP);
- InjectHook(0x4A9E30, CRenderer::ScanSectorList_Priority, PATCH_JUMP);
- InjectHook(0x4AA0A0, CRenderer::ScanSectorList_Subway, PATCH_JUMP);
- InjectHook(0x4AA1D0, CRenderer::ScanSectorList_RequestModels, PATCH_JUMP);
-
- InjectHook(0x4AA940, CRenderer::SortBIGBuildings, PATCH_JUMP);
- InjectHook(0x4AA990, CRenderer::SortBIGBuildingsForSectorList, PATCH_JUMP);
-
- InjectHook(0x4A9840, CRenderer::ShouldModelBeStreamed, PATCH_JUMP);
- InjectHook(0x4AAA00, CRenderer::IsEntityCullZoneVisible, PATCH_JUMP);
- InjectHook(0x4AAAA0, CRenderer::IsVehicleCullZoneVisible, PATCH_JUMP);
-
- InjectHook(0x4A7CF0, CRenderer::RemoveVehiclePedLights, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Renderer.h b/src/render/Renderer.h
index 42c154ec..362741e3 100644
--- a/src/render/Renderer.h
+++ b/src/render/Renderer.h
@@ -20,17 +20,17 @@ class CPtrList;
class CRenderer
{
- static int32 &ms_nNoOfVisibleEntities;
- static CEntity *(&ms_aVisibleEntityPtrs)[NUMVISIBLEENTITIES];
- static int32 &ms_nNoOfInVisibleEntities;
- static CEntity *(&ms_aInVisibleEntityPtrs)[NUMINVISIBLEENTITIES];
+ static int32 ms_nNoOfVisibleEntities;
+ static CEntity *ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
+ static int32 ms_nNoOfInVisibleEntities;
+ static CEntity *ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
- static CVector &ms_vecCameraPosition;
- static CVehicle *&m_pFirstPersonVehicle;
+ static CVector ms_vecCameraPosition;
+ static CVehicle *m_pFirstPersonVehicle;
public:
- static float ms_lodDistScale; // defined in Frontend.cpp
- static bool &m_loadingPriority;
+ static float ms_lodDistScale;
+ static bool m_loadingPriority;
static void Init(void);
static void Shutdown(void);
diff --git a/src/render/Rubbish.cpp b/src/render/Rubbish.cpp
index 65d8b2dd..d21dd558 100644
--- a/src/render/Rubbish.cpp
+++ b/src/render/Rubbish.cpp
@@ -1,6 +1,6 @@
#include "common.h"
#include "main.h"
-#include "patcher.h"
+
#include "General.h"
#include "Timer.h"
#include "Weather.h"
@@ -217,9 +217,9 @@ CRubbish::Update(void)
// FRAMETIME
if(bRubbishInvisible)
- RubbishVisibility = max(RubbishVisibility-5, 0);
+ RubbishVisibility = Max(RubbishVisibility-5, 0);
else
- RubbishVisibility = min(RubbishVisibility+5, 255);
+ RubbishVisibility = Min(RubbishVisibility+5, 255);
// Spawn a new sheet
COneSheet *sheet = StartEmptyList.m_next;
diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp
index e14b0453..d5970ebe 100644
--- a/src/render/Shadows.cpp
+++ b/src/render/Shadows.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "TxdStore.h"
#include "Timer.h"
@@ -13,6 +13,9 @@
#include "Weather.h"
#include "ModelIndices.h"
#include "RenderBuffer.h"
+#ifdef FIX_BUGS
+#include "Replay.h"
+#endif
#include "PointLights.h"
#include "SpecialFX.h"
#include "Shadows.h"
@@ -20,43 +23,31 @@
SETTWEAKPATH("Shadows");
TWEAKBOOL(gbPrintShite);
-#if 1
RwImVertexIndex ShadowIndexList[24];
-#else
-RwImVertexIndex (&ShadowIndexList)[24] = *(RwImVertexIndex (*)[24])*(int *)0x649188;
-#endif
-RwTexture *&gpShadowCarTex = *(RwTexture **)0x8F2C90;
-RwTexture *&gpShadowPedTex = *(RwTexture **)0x8F59D0;
-RwTexture *&gpShadowHeliTex = *(RwTexture **)0x8E2A90;
-RwTexture *&gpShadowExplosionTex = *(RwTexture **)0x8F2A00;
-RwTexture *&gpShadowHeadLightsTex = *(RwTexture **)0x95CB98;
-RwTexture *&gpOutline1Tex = *(RwTexture **)0x8F1B24;
-RwTexture *&gpOutline2Tex = *(RwTexture **)0x8F1B04;
-RwTexture *&gpOutline3Tex = *(RwTexture **)0x8F1B08;
-RwTexture *&gpBloodPoolTex = *(RwTexture **)0x9415F8;
-RwTexture *&gpReflectionTex = *(RwTexture **)0x8F582C;
-RwTexture *&gpGoalMarkerTex = *(RwTexture **)0x94142C;
-RwTexture *&gpWalkDontTex = *(RwTexture **)0x95CB4C;
-RwTexture *&gpCrackedGlassTex = *(RwTexture **)0x95CB94;
-RwTexture *&gpPostShadowTex = *(RwTexture **)0x8F59D4;
-RwTexture *&gpGoalTex = *(RwTexture**)0x94142C;
-
-#if 1
+RwTexture *gpShadowCarTex;
+RwTexture *gpShadowPedTex;
+RwTexture *gpShadowHeliTex;
+RwTexture *gpShadowExplosionTex;
+RwTexture *gpShadowHeadLightsTex;
+RwTexture *gpOutline1Tex;
+RwTexture *gpOutline2Tex;
+RwTexture *gpOutline3Tex;
+RwTexture *gpBloodPoolTex;
+RwTexture *gpReflectionTex;
+RwTexture *gpGoalMarkerTex;
+RwTexture *gpWalkDontTex;
+RwTexture *gpCrackedGlassTex;
+RwTexture *gpPostShadowTex;
+RwTexture *gpGoalTex;
+
int16 CShadows::ShadowsStoredToBeRendered;
CStoredShadow CShadows::asShadowsStored [MAX_STOREDSHADOWS];
CPolyBunch CShadows::aPolyBunches [MAX_POLYBUNCHES];
CStaticShadow CShadows::aStaticShadows [MAX_STATICSHADOWS];
CPolyBunch *CShadows::pEmptyBunchList;
CPermanentShadow CShadows::aPermanentShadows[MAX_PERMAMENTSHADOWS];
-#else
-int16 &CShadows::ShadowsStoredToBeRendered = *(int16*)0x95CCEE;
-CStoredShadow (&CShadows::asShadowsStored)[MAX_STOREDSHADOWS] = *(CStoredShadow (*)[MAX_STOREDSHADOWS])*(int *)0x779058;
-CPolyBunch (&CShadows::aPolyBunches)[MAX_POLYBUNCHES] = *(CPolyBunch (*)[MAX_POLYBUNCHES])*(int *)0x86F4C8;
-CStaticShadow (&CShadows::aStaticShadows)[MAX_STATICSHADOWS] = *(CStaticShadow (*)[MAX_STATICSHADOWS])*(int *)0x773BE8;
-CPolyBunch *&CShadows::pEmptyBunchList = *(CPolyBunch**)0x8F435C;
-CPermanentShadow (&CShadows::aPermanentShadows)[MAX_PERMAMENTSHADOWS] = *(CPermanentShadow (*)[MAX_PERMAMENTSHADOWS])*(int *)0x712040;
-#endif
+
void
CShadows::Init(void)
@@ -728,10 +719,10 @@ CShadows::RenderStoredShadows(void)
float fStartY = shadowPos.y - fHeight;
float fEndY = shadowPos.y + fHeight;
- int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
- int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
- int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
- int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
+ int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
+ int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
+ int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
+ int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
CWorld::AdvanceCurrentScanCode();
@@ -874,10 +865,10 @@ CShadows::GeneratePolysForStaticShadow(int16 nStaticShadowID)
float fStartY = shadowPos.y - fHeight;
float fEndY = shadowPos.y + fHeight;
- int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
- int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
- int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
- int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
+ int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
+ int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
+ int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
+ int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
CWorld::AdvanceCurrentScanCode();
@@ -1017,11 +1008,11 @@ CShadows::CastShadowEntity(CEntity *pEntity, float fStartX, float fStartY, floa
Points[3].x = (fLengthRight - fFrontRight) - fSideRight;
Points[3].y = (fLengthForward - fFrontForward) - fSideForward;
- float MinX = min(min(Points[0].x, Points[1].x), min(Points[2].x, Points[3].x));
- float MaxX = max(max(Points[0].x, Points[1].x), max(Points[2].x, Points[3].x));
+ float MinX = Min(Min(Points[0].x, Points[1].x), Min(Points[2].x, Points[3].x));
+ float MaxX = Max(Max(Points[0].x, Points[1].x), Max(Points[2].x, Points[3].x));
- float MinY = min(min(Points[0].y, Points[1].y), min(Points[2].y, Points[3].y));
- float MaxY = max(max(Points[0].y, Points[1].y), max(Points[2].y, Points[3].y));
+ float MinY = Min(Min(Points[0].y, Points[1].y), Min(Points[2].y, Points[3].y));
+ float MaxY = Max(Max(Points[0].y, Points[1].y), Max(Points[2].y, Points[3].y));
float MaxZ = pPosn->z - pEntity->GetPosition().z;
float MinZ = MaxZ - fZDistance;
@@ -1621,6 +1612,10 @@ CShadows::CalcPedShadowValues(CVector vecLightDir,
void
CShadows::RenderExtraPlayerShadows(void)
{
+#ifdef FIX_BUGS
+ if (CReplay::IsPlayingBack())
+ return;
+#endif
if ( CTimeCycle::GetLightShadowStrength() != 0 )
{
CVehicle *pCar = FindPlayerVehicle();
@@ -1647,9 +1642,9 @@ CShadows::RenderExtraPlayerShadows(void)
int32 nColorStrength;
if ( fLightDist < fRadius*0.5f )
- nColorStrength = CTimeCycle::GetLightShadowStrength();
+ nColorStrength = (5*CTimeCycle::GetLightShadowStrength()/8);
else
- nColorStrength = int32(CTimeCycle::GetLightShadowStrength() * fMult);
+ nColorStrength = int32((5*CTimeCycle::GetLightShadowStrength()/8) * fMult);
float fInv = 1.0f / fLightDist;
vecLight.x *= fInv;
@@ -1768,40 +1763,7 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur
{
ASSERT(pPosn != NULL);
- C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, max(fFrontX, -fSideY),
+ C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, Max(fFrontX, -fSideY),
0, 128, 255, 128,
2048, 0.2f, 0);
}
-
-
-STARTPATCHES
- InjectHook(0x512AB0, CShadows::Init, PATCH_JUMP);
- InjectHook(0x512F20, CShadows::Shutdown, PATCH_JUMP);
- InjectHook(0x512FD0, CShadows::AddPermanentShadow, PATCH_JUMP);
- InjectHook(0x5130A0, CShadows::StoreStaticShadow, PATCH_JUMP);
- InjectHook(0x513550, (void(*)(uint8, CVector *, float, float, float, float, int16, uint8, uint8, uint8))CShadows::StoreShadowToBeRendered, PATCH_JUMP);
- InjectHook(0x513750, (void(*)(uint8, RwTexture *, CVector *, float, float, float, float, int16, uint8, uint8, uint8, float, bool, float))CShadows::StoreShadowToBeRendered, PATCH_JUMP);
- InjectHook(0x513830, CShadows::StoreShadowForCar, PATCH_JUMP);
- InjectHook(0x513A70, CShadows::StoreCarLightShadow, PATCH_JUMP);
- InjectHook(0x513C50, CShadows::StoreShadowForPed, PATCH_JUMP);
- InjectHook(0x513CB0, CShadows::StoreShadowForPedObject, PATCH_JUMP);
- InjectHook(0x513E00, CShadows::StoreShadowForTree, PATCH_JUMP);
- InjectHook(0x513E10, CShadows::StoreShadowForPole, PATCH_JUMP);
- InjectHook(0x513FC0, CShadows::SetRenderModeForShadowType, PATCH_JUMP);
- InjectHook(0x514010, CShadows::RenderStoredShadows, PATCH_JUMP);
- InjectHook(0x5145F0, CShadows::RenderStaticShadows, PATCH_JUMP);
- InjectHook(0x514910, CShadows::GeneratePolysForStaticShadow, PATCH_JUMP);
- InjectHook(0x514C90, CShadows::CastShadowSectorList, PATCH_JUMP);
- InjectHook(0x514E30, CShadows::CastShadowEntity, PATCH_JUMP);
- InjectHook(0x516BE0, CShadows::UpdateStaticShadows, PATCH_JUMP);
- InjectHook(0x516C40, CShadows::UpdatePermanentShadows, PATCH_JUMP);
- InjectHook(0x516E70, &CStaticShadow::Free, PATCH_JUMP);
- InjectHook(0x516EB0, CShadows::CalcPedShadowValues, PATCH_JUMP);
- InjectHook(0x516F90, CShadows::RenderExtraPlayerShadows, PATCH_JUMP);
- InjectHook(0x517570, CShadows::TidyUpShadows, PATCH_JUMP);
- InjectHook(0x517810, CShadows::RenderIndicatorShadow, PATCH_JUMP);
- //InjectHook(0x517900, &CPermanentShadow::CPermanentShadow, PATCH_JUMP);
- //InjectHook(0x517910, &CStaticShadow::CStaticShadow, PATCH_JUMP);
- //InjectHook(0x517920, &CPolyBunch::CPolyBunch, PATCH_JUMP);
- //InjectHook(0x517940, &CStoredShadow::CStoredShadow, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/render/Shadows.h b/src/render/Shadows.h
index fb41ebbc..65274879 100644
--- a/src/render/Shadows.h
+++ b/src/render/Shadows.h
@@ -6,7 +6,6 @@
#define MAX_PERMAMENTSHADOWS 48
-struct RwTexture;
class CEntity;
enum eShadowType
@@ -47,7 +46,6 @@ public:
uint8 bRendered : 1;
//uint8 bDrawOnBuildings : 1;
} m_nFlags;
- char _pad0;
RwTexture *m_pTexture;
CStoredShadow()
@@ -59,11 +57,9 @@ class CPolyBunch
{
public:
int16 m_nNumVerts;
- char _pad0[2];
CVector m_aVerts[7];
uint8 m_aU[7];
uint8 m_aV[7];
- char _pad1[2];
CPolyBunch *m_pNext;
CPolyBunch()
@@ -83,7 +79,6 @@ public:
float m_fZDistance;
float m_fScale;
uint8 m_nType;
- char _pad0;
int16 m_nIntensity; // unsigned ?
uint8 m_nRed;
uint8 m_nGreen;
@@ -91,7 +86,6 @@ public:
bool m_bJustCreated;
bool m_bRendered;
bool m_bTemp;
- char _pad1[2];
RwTexture *m_pTexture;
CStaticShadow()
@@ -114,7 +108,6 @@ public:
uint8 m_nRed;
uint8 m_nGreen;
uint8 m_nBlue;
- char _pad0[2];
uint32 m_nTimeCreated;
uint32 m_nLifeTime;
RwTexture *m_pTexture;
@@ -175,18 +168,18 @@ public:
static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity);
};
-extern RwTexture *&gpShadowCarTex;
-extern RwTexture *&gpShadowPedTex;
-extern RwTexture *&gpShadowHeliTex;
-extern RwTexture *&gpShadowExplosionTex;
-extern RwTexture *&gpShadowHeadLightsTex;
-extern RwTexture *&gpOutline1Tex;
-extern RwTexture *&gpOutline2Tex;
-extern RwTexture *&gpOutline3Tex;
-extern RwTexture *&gpBloodPoolTex;
-extern RwTexture *&gpReflectionTex;
-extern RwTexture *&gpGoalMarkerTex;
-extern RwTexture *&gpWalkDontTex;
-extern RwTexture *&gpCrackedGlassTex;
-extern RwTexture *&gpPostShadowTex;
-extern RwTexture *&gpGoalTex;
+extern RwTexture *gpShadowCarTex;
+extern RwTexture *gpShadowPedTex;
+extern RwTexture *gpShadowHeliTex;
+extern RwTexture *gpShadowExplosionTex;
+extern RwTexture *gpShadowHeadLightsTex;
+extern RwTexture *gpOutline1Tex;
+extern RwTexture *gpOutline2Tex;
+extern RwTexture *gpOutline3Tex;
+extern RwTexture *gpBloodPoolTex;
+extern RwTexture *gpReflectionTex;
+extern RwTexture *gpGoalMarkerTex;
+extern RwTexture *gpWalkDontTex;
+extern RwTexture *gpCrackedGlassTex;
+extern RwTexture *gpPostShadowTex;
+extern RwTexture *gpGoalTex;
diff --git a/src/render/Skidmarks.cpp b/src/render/Skidmarks.cpp
index 41ee5d1d..f3479536 100644
--- a/src/render/Skidmarks.cpp
+++ b/src/render/Skidmarks.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "TxdStore.h"
#include "Timer.h"
@@ -214,7 +214,8 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
aSkidmarks[i].m_pos[aSkidmarks[i].m_last] = pos;
CVector2D dist = aSkidmarks[i].m_pos[aSkidmarks[i].m_last] - aSkidmarks[i].m_pos[aSkidmarks[i].m_last-1];
- dist.Normalise();
+ dist.NormaliseSafe();
+ fwd.NormaliseSafe();
CVector2D right(dist.y, -dist.x);
float turn = DotProduct2D(fwd, right);
turn = Abs(turn) + 1.0f;
diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp
index 9189a7c2..fc081fa3 100644
--- a/src/render/SpecialFX.cpp
+++ b/src/render/SpecialFX.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "SpecialFX.h"
#include "RenderBuffer.h"
#include "Timer.h"
@@ -117,8 +117,14 @@ CSpecialFX::Update(void)
if(FindPlayerPed() &&
FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_BASEBALLBAT &&
- FindPlayerPed()->GetWeapon()->m_eWeaponState == WEAPONSTATE_FIRING)
- RwFrameForAllObjects(FindPlayerPed()->GetNodeFrame(PED_HANDR), LookForBatCB, CModelInfo::GetModelInfo(MI_BASEBALL_BAT));
+ FindPlayerPed()->GetWeapon()->m_eWeaponState == WEAPONSTATE_FIRING){
+#ifdef PED_SKIN
+ if(IsClumpSkinned(FindPlayerPed()->GetClump())){
+ LookForBatCB((RwObject*)FindPlayerPed()->m_pWeaponModel, CModelInfo::GetModelInfo(MI_BASEBALL_BAT));
+ }else
+#endif
+ RwFrameForAllObjects(FindPlayerPed()->m_pFrames[PED_HANDR]->frame, LookForBatCB, CModelInfo::GetModelInfo(MI_BASEBALL_BAT));
+ }
}
void
@@ -1151,32 +1157,3 @@ CSpecialParticleStuff::UpdateBoatFoamAnimation(CMatrix* pMatrix)
dZ = 2.0f;
}
}
-
-STARTPATCHES
- InjectHook(0x518DE0, &CBulletTraces::Init, PATCH_JUMP);
- InjectHook(0x518E90, &CBulletTraces::AddTrace, PATCH_JUMP);
- InjectHook(0x518F20, &CBulletTraces::Render, PATCH_JUMP);
- InjectHook(0x519240, &CBulletTraces::Update, PATCH_JUMP);
-
- InjectHook(0x51B070, &C3dMarker::AddMarker, PATCH_JUMP);
- InjectHook(0x51B170, &C3dMarker::DeleteMarkerObject, PATCH_JUMP);
- InjectHook(0x51B1B0, &C3dMarker::Render, PATCH_JUMP);
- InjectHook(0x51B2B0, C3dMarkers::Init, PATCH_JUMP);
- InjectHook(0x51B480, C3dMarkers::PlaceMarker, PATCH_JUMP);
- InjectHook(0x51BB80, C3dMarkers::PlaceMarkerSet, PATCH_JUMP);
- InjectHook(0x51B400, C3dMarkers::Render, PATCH_JUMP);
- InjectHook(0x51B3B0, C3dMarkers::Shutdown, PATCH_JUMP);
-
- InjectHook(0x5197A0, CBrightLights::Init, PATCH_JUMP);
- InjectHook(0x51A410, CBrightLights::RegisterOne, PATCH_JUMP);
- InjectHook(0x5197B0, CBrightLights::Render, PATCH_JUMP);
- InjectHook(0x51A3B0, CBrightLights::RenderOutGeometryBuffer, PATCH_JUMP);
-
- InjectHook(0x51A5A0, CShinyTexts::Init, PATCH_JUMP);
- InjectHook(0x51AAB0, CShinyTexts::RegisterOne, PATCH_JUMP);
- InjectHook(0x51A5B0, CShinyTexts::Render, PATCH_JUMP);
- InjectHook(0x51AA50, CShinyTexts::RenderOutGeometryBuffer, PATCH_JUMP);
-
- InjectHook(0x51AF70, CMoneyMessages::Init, PATCH_JUMP);
- InjectHook(0x51B030, CMoneyMessages::Render, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index 8ac2315f..30eaf840 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -1,14 +1,14 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "Draw.h"
#include "Camera.h"
#include "Sprite.h"
-float &CSprite::m_f2DNearScreenZ = *(float*)0x8F1ABC;
-float &CSprite::m_f2DFarScreenZ = *(float*)0x8F2C94;
-float &CSprite::m_fRecipNearClipPlane = *(float*)0x8F5FFC;
-int32 &CSprite::m_bFlushSpriteBufferSwitchZTest = *(int32*)0x8F5FB0;
+float CSprite::m_f2DNearScreenZ;
+float CSprite::m_f2DFarScreenZ;
+float CSprite::m_fRecipNearClipPlane;
+int32 CSprite::m_bFlushSpriteBufferSwitchZTest;
float
CSprite::CalcHorizonCoors(void)
@@ -40,9 +40,9 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
}
#define SPRITEBUFFERSIZE 64
-static int32 &nSpriteBufferIndex = *(int32*)0x649A80;
-static RwIm2DVertex *SpriteBufferVerts = (RwIm2DVertex*)0x649A84; //[SPRITEBUFFERSIZE*6];
-static RwIm2DVertex *verts = (RwIm2DVertex*)0x64C484; //[4];
+static int32 nSpriteBufferIndex;
+static RwIm2DVertex SpriteBufferVerts[SPRITEBUFFERSIZE*6];
+static RwIm2DVertex verts[4];
void
CSprite::InitSpriteBuffer(void)
@@ -137,8 +137,8 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r
void
CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
- float c = Cos(DEGTORAD(rotation));
- float s = Sin(DEGTORAD(rotation));
+ float c = Cos(rotation);
+ float s = Sin(rotation);
float xs[4];
float ys[4];
@@ -315,8 +315,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = Cos(DEGTORAD(rotation));
- float s = Sin(DEGTORAD(rotation));
+ float c = Cos(rotation);
+ float s = Sin(rotation);
float xs[4];
float ys[4];
@@ -367,8 +367,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, float w, float h, uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2, float cx, float cy, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = Cos(DEGTORAD(rotation));
- float s = Sin(DEGTORAD(rotation));
+ float c = Cos(rotation);
+ float s = Sin(rotation);
float xs[4];
float ys[4];
@@ -398,11 +398,11 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, f
// 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;
cf[0] = clamp(cf[0], 0.0f, 1.0f);
- cf[1] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
+ cf[1] = (cx*(-c+s) + cy*( c+s))*0.5f + 0.5f;
cf[1] = clamp(cf[1], 0.0f, 1.0f);
- cf[2] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
+ cf[2] = (cx*( c+s) + cy*( c-s))*0.5f + 0.5f;
cf[2] = clamp(cf[2], 0.0f, 1.0f);
- cf[3] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
+ cf[3] = (cx*( c-s) + cy*(-c-s))*0.5f + 0.5f;
cf[3] = clamp(cf[3], 0.0f, 1.0f);
float screenz = m_f2DNearScreenZ +
@@ -593,19 +593,3 @@ CSprite::RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w
if(nSpriteBufferIndex >= SPRITEBUFFERSIZE)
FlushSpriteBuffer();
}
-
-STARTPATCHES
- InjectHook(0x51C4A0, CSprite::CalcHorizonCoors, PATCH_JUMP);
- InjectHook(0x51C3A0, CSprite::CalcScreenCoors, PATCH_JUMP);
- InjectHook(0x51C590, CSprite::InitSpriteBuffer, PATCH_JUMP);
- InjectHook(0x51C5B0, CSprite::InitSpriteBuffer2D, PATCH_JUMP);
- InjectHook(0x51C520, CSprite::FlushSpriteBuffer, PATCH_JUMP);
- InjectHook(0x51C960, CSprite::RenderOneXLUSprite, PATCH_JUMP);
- InjectHook(0x51D110, CSprite::RenderOneXLUSprite_Rotate_Aspect, PATCH_JUMP);
- InjectHook(0x51C5D0, CSprite::RenderBufferedOneXLUSprite, PATCH_JUMP);
- InjectHook(0x51D5B0, CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension, PATCH_JUMP);
- InjectHook(0x51CCD0, CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect, PATCH_JUMP);
- InjectHook(0x51D9E0, CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours, PATCH_JUMP);
- InjectHook(0x51E3C0, CSprite::RenderBufferedOneXLUSprite2D, PATCH_JUMP);
- InjectHook(0x51E490, CSprite::RenderBufferedOneXLUSprite2D_Rotate_Dimension, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Sprite.h b/src/render/Sprite.h
index 33953ff3..ec4c1d1b 100644
--- a/src/render/Sprite.h
+++ b/src/render/Sprite.h
@@ -2,10 +2,10 @@
class CSprite
{
- static float &m_f2DNearScreenZ;
- static float &m_f2DFarScreenZ;
- static float &m_fRecipNearClipPlane;
- static int32 &m_bFlushSpriteBufferSwitchZTest;
+ static float m_f2DNearScreenZ;
+ static float m_f2DFarScreenZ;
+ static float m_fRecipNearClipPlane;
+ static int32 m_bFlushSpriteBufferSwitchZTest;
public:
static float CalcHorizonCoors(void);
static bool CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, bool farclip);
diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp
index 3f21516a..52b85018 100644
--- a/src/render/Sprite2d.cpp
+++ b/src/render/Sprite2d.cpp
@@ -1,17 +1,17 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "Draw.h"
#include "Camera.h"
#include "Sprite2d.h"
-RwIm2DVertex *CSprite2d::maVertices = (RwIm2DVertex*)0x6E9168;
-float &CSprite2d::RecipNearClip = *(float*)0x880DB4;
-int32 &CSprite2d::mCurrentBank = *(int32*)0x8F1AF4;
-RwTexture **CSprite2d::mpBankTextures = (RwTexture**)0x774DC0;
-int32 *CSprite2d::mCurrentSprite = (int32*)0x6F4500;
-int32 *CSprite2d::mBankStart = (int32*)0x774BE8;
-RwIm2DVertex *CSprite2d::maBankVertices = (RwIm2DVertex*)0x8429F8;
+RwIm2DVertex CSprite2d::maVertices[8];
+float CSprite2d::RecipNearClip;
+int32 CSprite2d::mCurrentBank;
+RwTexture *CSprite2d::mpBankTextures[10];
+int32 CSprite2d::mCurrentSprite[10];
+int32 CSprite2d::mBankStart[10];
+RwIm2DVertex CSprite2d::maBankVertices[500];
void
CSprite2d::SetRecipNearClip(void)
@@ -474,37 +474,3 @@ void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3,
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEGOURAUD);
}
-
-STARTPATCHES
-#define C4 const CRGBA&, const CRGBA&, const CRGBA&, const CRGBA&
-#define F8 float, float, float, float, float, float, float, float
-
- InjectHook(0x51EA20, CSprite2d::SetRecipNearClip, PATCH_JUMP);
- InjectHook(0x51EAE0, CSprite2d::InitPerFrame, PATCH_JUMP);
- InjectHook(0x51EB70, CSprite2d::GetBank, PATCH_JUMP);
- InjectHook(0x51EBC0, CSprite2d::AddSpriteToBank, PATCH_JUMP);
- InjectHook(0x51EC50, CSprite2d::DrawBank, PATCH_JUMP);
-
- InjectHook(0x51EA00, &CSprite2d::Delete, PATCH_JUMP);
- InjectHook(0x51F950, &CSprite2d::SetRenderState, PATCH_JUMP);
- InjectHook(0x51EA40, (void (CSprite2d::*)(const char*))&CSprite2d::SetTexture, PATCH_JUMP);
- InjectHook(0x51EA70, (void (CSprite2d::*)(const char*,const char*))&CSprite2d::SetTexture, PATCH_JUMP);
- InjectHook(0x51EAA0, &CSprite2d::SetAddressing, PATCH_JUMP);
-
- InjectHook(0x51EE90, (void (*)(const CRect&, C4, uint32))CSprite2d::SetVertices, PATCH_JUMP);
- InjectHook(0x51F220, (void (*)(const CRect&, C4, F8))CSprite2d::SetVertices, PATCH_JUMP);
- InjectHook(0x51F070, (void (*)(F8, C4))CSprite2d::SetVertices, PATCH_JUMP);
- InjectHook(0x51F3E0, (void (*)(int, float*, float*, const CRGBA&))CSprite2d::SetVertices, PATCH_JUMP);
- InjectHook(0x51F490, CSprite2d::SetMaskVertices, PATCH_JUMP);
- InjectHook(0x51F720, (void (*)(RwIm2DVertex*, const CRect&, C4, F8))CSprite2d::SetVertices, PATCH_JUMP);
-
- InjectHook(0x51ECE0, (void (CSprite2d::*)(float, float, float, float, const CRGBA &))&CSprite2d::Draw, PATCH_JUMP);
- InjectHook(0x51ED50, (void (CSprite2d::*)(const CRect &, const CRGBA &))&CSprite2d::Draw, PATCH_JUMP);
- InjectHook(0x51ED90, (void (CSprite2d::*)(const CRect &, const CRGBA &, F8))&CSprite2d::Draw, PATCH_JUMP);
- InjectHook(0x51EDF0, (void (CSprite2d::*)(const CRect &, C4))&CSprite2d::Draw, PATCH_JUMP);
- InjectHook(0x51EE40, (void (CSprite2d::*)(F8, const CRGBA &))&CSprite2d::Draw, PATCH_JUMP);
-
- InjectHook(0x51F970, (void (*)(const CRect&, const CRGBA&))CSprite2d::DrawRect, PATCH_JUMP);
- InjectHook(0x51FA00, (void (*)(const CRect&, C4))CSprite2d::DrawRect, PATCH_JUMP);
- InjectHook(0x51FA80, CSprite2d::DrawRectXLU, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Sprite2d.h b/src/render/Sprite2d.h
index 268c7d2b..0e12d441 100644
--- a/src/render/Sprite2d.h
+++ b/src/render/Sprite2d.h
@@ -2,13 +2,13 @@
class CSprite2d
{
- static float &RecipNearClip;
- static int32 &mCurrentBank;
- static RwTexture **mpBankTextures; //[10];
- static int32 *mCurrentSprite; //[10];
- static int32 *mBankStart; //[10];
- static RwIm2DVertex *maBankVertices; //[500];
- static RwIm2DVertex *maVertices; //[4];
+ static float RecipNearClip;
+ static int32 mCurrentBank;
+ static RwTexture *mpBankTextures[10];
+ static int32 mCurrentSprite[10];
+ static int32 mBankStart[10];
+ static RwIm2DVertex maBankVertices[500];
+ static RwIm2DVertex maVertices[8];
public:
RwTexture *m_pTexture;
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index 7ab3e91e..cf3426d7 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "main.h"
#include "Clock.h"
#include "Weather.h"
@@ -10,101 +10,101 @@
#include "FileMgr.h"
#include "Timecycle.h"
-int (*CTimeCycle::m_nAmbientRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86AF78;
-int (*CTimeCycle::m_nAmbientGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x665308;
-int (*CTimeCycle::m_nAmbientBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72CF88;
-int (*CTimeCycle::m_nDirectionalRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FAB78;
-int (*CTimeCycle::m_nDirectionalGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F4528;
-int (*CTimeCycle::m_nDirectionalBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83CE58;
-int (*CTimeCycle::m_nSkyTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FB90;
-int (*CTimeCycle::m_nSkyTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x8460A8;
-int (*CTimeCycle::m_nSkyTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87B158;
-int (*CTimeCycle::m_nSkyBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FA960;
-int (*CTimeCycle::m_nSkyBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70D6A8;
-int (*CTimeCycle::m_nSkyBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83D288;
-int (*CTimeCycle::m_nSunCoreRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x878360;
-int (*CTimeCycle::m_nSunCoreGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE088;
-int (*CTimeCycle::m_nSunCoreBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x773A68;
-int (*CTimeCycle::m_nSunCoronaRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x664B60;
-int (*CTimeCycle::m_nSunCoronaGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F01E0;
-int (*CTimeCycle::m_nSunCoronaBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E6340;
-float (*CTimeCycle::m_fSunSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733510;
-float (*CTimeCycle::m_fSpriteSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87F820;
-float (*CTimeCycle::m_fSpriteBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x6E96F0;
-short (*CTimeCycle::m_nShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x83CFD8;
-short (*CTimeCycle::m_nLightShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x72B0F8;
-short (*CTimeCycle::m_nTreeShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x733450;
-float (*CTimeCycle::m_fFogStart)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8806C8;
-float (*CTimeCycle::m_fFarClip)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8804E0;
-float (*CTimeCycle::m_fLightsOnGroundBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x83D108;
-int (*CTimeCycle::m_nLowCloudsRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x726770;
-int (*CTimeCycle::m_nLowCloudsGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87BF08;
-int (*CTimeCycle::m_nLowCloudsBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FA10;
-int (*CTimeCycle::m_nFluffyCloudsTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70F2B0;
-int (*CTimeCycle::m_nFluffyCloudsTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72D288;
-int (*CTimeCycle::m_nFluffyCloudsTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86B108;
-int (*CTimeCycle::m_nFluffyCloudsBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E8DA8;
-int (*CTimeCycle::m_nFluffyCloudsBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x715AA8;
-int (*CTimeCycle::m_nFluffyCloudsBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE2D0;
-float (*CTimeCycle::m_fBlurRed)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87C7E0;
-float (*CTimeCycle::m_fBlurGreen)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x774C10;
-float (*CTimeCycle::m_fBlurBlue)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8784E0;
-float (*CTimeCycle::m_fBlurAlpha)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733690;
-
-float &CTimeCycle::m_fCurrentAmbientRed = *(float*)0x8F29B4;
-float &CTimeCycle::m_fCurrentAmbientGreen = *(float*)0x94144C;
-float &CTimeCycle::m_fCurrentAmbientBlue = *(float*)0x942FC0;
-float &CTimeCycle::m_fCurrentDirectionalRed = *(float*)0x8F29D8;
-float &CTimeCycle::m_fCurrentDirectionalGreen = *(float*)0x940594;
-float &CTimeCycle::m_fCurrentDirectionalBlue = *(float*)0x942FAC;
-int &CTimeCycle::m_nCurrentSkyTopRed = *(int*)0x9403C0;
-int &CTimeCycle::m_nCurrentSkyTopGreen = *(int*)0x943074;
-int &CTimeCycle::m_nCurrentSkyTopBlue = *(int*)0x8F29B8;
-int &CTimeCycle::m_nCurrentSkyBottomRed = *(int*)0x9414D0;
-int &CTimeCycle::m_nCurrentSkyBottomGreen = *(int*)0x8F2BD0;
-int &CTimeCycle::m_nCurrentSkyBottomBlue = *(int*)0x8F625C;
-int &CTimeCycle::m_nCurrentSunCoreRed = *(int*)0x8F2534;
-int &CTimeCycle::m_nCurrentSunCoreGreen = *(int*)0x8F6264;
-int &CTimeCycle::m_nCurrentSunCoreBlue = *(int*)0x94149C;
-int &CTimeCycle::m_nCurrentSunCoronaRed = *(int*)0x8F2C1C;
-int &CTimeCycle::m_nCurrentSunCoronaGreen = *(int*)0x885B54;
-int &CTimeCycle::m_nCurrentSunCoronaBlue = *(int*)0x880F60;
-float &CTimeCycle::m_fCurrentSunSize = *(float*)0x940588;
-float &CTimeCycle::m_fCurrentSpriteSize = *(float*)0x8F1AA8;
-float &CTimeCycle::m_fCurrentSpriteBrightness = *(float*)0x8F5FDC;
-int &CTimeCycle::m_nCurrentShadowStrength = *(int*)0x95CC76;
-int &CTimeCycle::m_nCurrentLightShadowStrength = *(int*)0x95CC66;
-int &CTimeCycle::m_nCurrentTreeShadowStrength = *(int*)0x95CC86;
-float &CTimeCycle::m_fCurrentFogStart = *(float*)0x8F1AE0;
-float &CTimeCycle::m_fCurrentFarClip = *(float*)0x8F5FD8;
-float &CTimeCycle::m_fCurrentLightsOnGroundBrightness = *(float*)0x8F1B60;
-int &CTimeCycle::m_nCurrentLowCloudsRed = *(int*)0x95CB54;
-int &CTimeCycle::m_nCurrentLowCloudsGreen = *(int*)0x95CB48;
-int &CTimeCycle::m_nCurrentLowCloudsBlue = *(int*)0x95CC1C;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopRed = *(int*)0x8F2550;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopGreen = *(int*)0x8F59CC;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopBlue = *(int*)0x941434;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomRed = *(int*)0x8F1A38;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomGreen = *(int*)0x8E28B8;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomBlue = *(int*)0x8F3960;
-float &CTimeCycle::m_fCurrentBlurRed = *(float*)0x8F6000;
-float &CTimeCycle::m_fCurrentBlurGreen = *(float*)0x9405A0;
-float &CTimeCycle::m_fCurrentBlurBlue = *(float*)0x8F250C;
-float &CTimeCycle::m_fCurrentBlurAlpha = *(float*)0x940728;
-int &CTimeCycle::m_nCurrentFogColourRed = *(int*)0x940714;
-int &CTimeCycle::m_nCurrentFogColourGreen = *(int*)0x8E2A60;
-int &CTimeCycle::m_nCurrentFogColourBlue = *(int*)0x8F57EC;
-
-int &CTimeCycle::m_FogReduction = *(int*)0x880FB8;
-
-int &CTimeCycle::m_CurrentStoredValue = *(int*)0x94057C;
-CVector *CTimeCycle::m_VectorToSun = (CVector*)0x665548; // [16]
-float *CTimeCycle::m_fShadowFrontX = (float*)0x72CE90;
-float *CTimeCycle::m_fShadowFrontY = (float*)0x72CE50;
-float *CTimeCycle::m_fShadowSideX = (float*)0x87C708;
-float *CTimeCycle::m_fShadowSideY = (float*)0x87C6C8;
-float *CTimeCycle::m_fShadowDisplacementX = (float*)0x6F0748;
-float *CTimeCycle::m_fShadowDisplacementY = (float*)0x6F0788;
+int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurAlpha[NUMHOURS][NUMWEATHERS];
+
+float CTimeCycle::m_fCurrentAmbientRed;
+float CTimeCycle::m_fCurrentAmbientGreen;
+float CTimeCycle::m_fCurrentAmbientBlue;
+float CTimeCycle::m_fCurrentDirectionalRed;
+float CTimeCycle::m_fCurrentDirectionalGreen;
+float CTimeCycle::m_fCurrentDirectionalBlue;
+int CTimeCycle::m_nCurrentSkyTopRed;
+int CTimeCycle::m_nCurrentSkyTopGreen;
+int CTimeCycle::m_nCurrentSkyTopBlue;
+int CTimeCycle::m_nCurrentSkyBottomRed;
+int CTimeCycle::m_nCurrentSkyBottomGreen;
+int CTimeCycle::m_nCurrentSkyBottomBlue;
+int CTimeCycle::m_nCurrentSunCoreRed;
+int CTimeCycle::m_nCurrentSunCoreGreen;
+int CTimeCycle::m_nCurrentSunCoreBlue;
+int CTimeCycle::m_nCurrentSunCoronaRed;
+int CTimeCycle::m_nCurrentSunCoronaGreen;
+int CTimeCycle::m_nCurrentSunCoronaBlue;
+float CTimeCycle::m_fCurrentSunSize;
+float CTimeCycle::m_fCurrentSpriteSize;
+float CTimeCycle::m_fCurrentSpriteBrightness;
+int CTimeCycle::m_nCurrentShadowStrength;
+int CTimeCycle::m_nCurrentLightShadowStrength;
+int CTimeCycle::m_nCurrentTreeShadowStrength;
+float CTimeCycle::m_fCurrentFogStart;
+float CTimeCycle::m_fCurrentFarClip;
+float CTimeCycle::m_fCurrentLightsOnGroundBrightness;
+int CTimeCycle::m_nCurrentLowCloudsRed;
+int CTimeCycle::m_nCurrentLowCloudsGreen;
+int CTimeCycle::m_nCurrentLowCloudsBlue;
+int CTimeCycle::m_nCurrentFluffyCloudsTopRed;
+int CTimeCycle::m_nCurrentFluffyCloudsTopGreen;
+int CTimeCycle::m_nCurrentFluffyCloudsTopBlue;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomRed;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomGreen;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
+float CTimeCycle::m_fCurrentBlurRed;
+float CTimeCycle::m_fCurrentBlurGreen;
+float CTimeCycle::m_fCurrentBlurBlue;
+float CTimeCycle::m_fCurrentBlurAlpha;
+int CTimeCycle::m_nCurrentFogColourRed;
+int CTimeCycle::m_nCurrentFogColourGreen;
+int CTimeCycle::m_nCurrentFogColourBlue;
+
+int CTimeCycle::m_FogReduction;
+
+int CTimeCycle::m_CurrentStoredValue;
+CVector CTimeCycle::m_VectorToSun[16];
+float CTimeCycle::m_fShadowFrontX[16];
+float CTimeCycle::m_fShadowFrontY[16];
+float CTimeCycle::m_fShadowSideX[16];
+float CTimeCycle::m_fShadowSideY[16];
+float CTimeCycle::m_fShadowDisplacementX[16];
+float CTimeCycle::m_fShadowDisplacementY[16];
void
@@ -290,7 +290,7 @@ CTimeCycle::Update(void)
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL);
if(m_FogReduction != 0)
- m_fCurrentFarClip = max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
+ m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
@@ -311,12 +311,7 @@ CTimeCycle::Update(void)
if(TheCamera.GetForward().z < -0.9f ||
!CWeather::bScriptsForceRain && (CCullZones::PlayerNoRain() || CCullZones::CamNoRain() || CCutsceneMgr::IsRunning()))
- m_FogReduction = min(m_FogReduction+1, 64);
+ m_FogReduction = Min(m_FogReduction+1, 64);
else
- m_FogReduction = max(m_FogReduction-1, 0);
+ m_FogReduction = Max(m_FogReduction-1, 0);
}
-
-STARTPATCHES
- InjectHook(0x4ABAE0, CTimeCycle::Initialise, PATCH_JUMP);
- InjectHook(0x4ABF40, CTimeCycle::Update, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index ed4a026b..28a0b7dd 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -2,102 +2,102 @@
class CTimeCycle
{
- static int (*m_nAmbientRed)[NUMWEATHERS];
- static int (*m_nAmbientGreen)[NUMWEATHERS];
- static int (*m_nAmbientBlue)[NUMWEATHERS];
- static int (*m_nDirectionalRed)[NUMWEATHERS];
- static int (*m_nDirectionalGreen)[NUMWEATHERS];
- static int (*m_nDirectionalBlue)[NUMWEATHERS];
- static int (*m_nSkyTopRed)[NUMWEATHERS];
- static int (*m_nSkyTopGreen)[NUMWEATHERS];
- static int (*m_nSkyTopBlue)[NUMWEATHERS];
- static int (*m_nSkyBottomRed)[NUMWEATHERS];
- static int (*m_nSkyBottomGreen)[NUMWEATHERS];
- static int (*m_nSkyBottomBlue)[NUMWEATHERS];
- static int (*m_nSunCoreRed)[NUMWEATHERS];
- static int (*m_nSunCoreGreen)[NUMWEATHERS];
- static int (*m_nSunCoreBlue)[NUMWEATHERS];
- static int (*m_nSunCoronaRed)[NUMWEATHERS];
- static int (*m_nSunCoronaGreen)[NUMWEATHERS];
- static int (*m_nSunCoronaBlue)[NUMWEATHERS];
- static float (*m_fSunSize)[NUMWEATHERS];
- static float (*m_fSpriteSize)[NUMWEATHERS];
- static float (*m_fSpriteBrightness)[NUMWEATHERS];
- static short (*m_nShadowStrength)[NUMWEATHERS];
- static short (*m_nLightShadowStrength)[NUMWEATHERS];
- static short (*m_nTreeShadowStrength)[NUMWEATHERS];
- static float (*m_fFogStart)[NUMWEATHERS];
- static float (*m_fFarClip)[NUMWEATHERS];
- static float (*m_fLightsOnGroundBrightness)[NUMWEATHERS];
- static int (*m_nLowCloudsRed)[NUMWEATHERS];
- static int (*m_nLowCloudsGreen)[NUMWEATHERS];
- static int (*m_nLowCloudsBlue)[NUMWEATHERS];
- static int (*m_nFluffyCloudsTopRed)[NUMWEATHERS];
- static int (*m_nFluffyCloudsTopGreen)[NUMWEATHERS];
- static int (*m_nFluffyCloudsTopBlue)[NUMWEATHERS];
- static int (*m_nFluffyCloudsBottomRed)[NUMWEATHERS];
- static int (*m_nFluffyCloudsBottomGreen)[NUMWEATHERS];
- static int (*m_nFluffyCloudsBottomBlue)[NUMWEATHERS];
- static float (*m_fBlurRed)[NUMWEATHERS];
- static float (*m_fBlurGreen)[NUMWEATHERS];
- static float (*m_fBlurBlue)[NUMWEATHERS];
- static float (*m_fBlurAlpha)[NUMWEATHERS];
+ static int m_nAmbientRed[NUMHOURS][NUMWEATHERS];
+ static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+ static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+ static float m_fSunSize[NUMHOURS][NUMWEATHERS];
+ static float m_fSpriteSize[NUMHOURS][NUMWEATHERS];
+ static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
+ static short m_nShadowStrength[NUMHOURS][NUMWEATHERS];
+ static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+ static short m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
+ static float m_fFogStart[NUMHOURS][NUMWEATHERS];
+ static float m_fFarClip[NUMHOURS][NUMWEATHERS];
+ static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
+ static int m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+ static int m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurRed[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurGreen[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurBlue[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurAlpha[NUMHOURS][NUMWEATHERS];
- static float &m_fCurrentAmbientRed;
- static float &m_fCurrentAmbientGreen;
- static float &m_fCurrentAmbientBlue;
- static float &m_fCurrentDirectionalRed;
- static float &m_fCurrentDirectionalGreen;
- static float &m_fCurrentDirectionalBlue;
- static int &m_nCurrentSkyTopRed;
- static int &m_nCurrentSkyTopGreen;
- static int &m_nCurrentSkyTopBlue;
- static int &m_nCurrentSkyBottomRed;
- static int &m_nCurrentSkyBottomGreen;
- static int &m_nCurrentSkyBottomBlue;
- static int &m_nCurrentSunCoreRed;
- static int &m_nCurrentSunCoreGreen;
- static int &m_nCurrentSunCoreBlue;
- static int &m_nCurrentSunCoronaRed;
- static int &m_nCurrentSunCoronaGreen;
- static int &m_nCurrentSunCoronaBlue;
- static float &m_fCurrentSunSize;
- static float &m_fCurrentSpriteSize;
- static float &m_fCurrentSpriteBrightness;
- static int &m_nCurrentShadowStrength;
- static int &m_nCurrentLightShadowStrength;
- static int &m_nCurrentTreeShadowStrength;
- static float &m_fCurrentFogStart;
- static float &m_fCurrentFarClip;
- static float &m_fCurrentLightsOnGroundBrightness;
- static int &m_nCurrentLowCloudsRed;
- static int &m_nCurrentLowCloudsGreen;
- static int &m_nCurrentLowCloudsBlue;
- static int &m_nCurrentFluffyCloudsTopRed;
- static int &m_nCurrentFluffyCloudsTopGreen;
- static int &m_nCurrentFluffyCloudsTopBlue;
- static int &m_nCurrentFluffyCloudsBottomRed;
- static int &m_nCurrentFluffyCloudsBottomGreen;
- static int &m_nCurrentFluffyCloudsBottomBlue;
- static float &m_fCurrentBlurRed;
- static float &m_fCurrentBlurGreen;
- static float &m_fCurrentBlurBlue;
- static float &m_fCurrentBlurAlpha;
- static int &m_nCurrentFogColourRed;
- static int &m_nCurrentFogColourGreen;
- static int &m_nCurrentFogColourBlue;
+ static float m_fCurrentAmbientRed;
+ static float m_fCurrentAmbientGreen;
+ static float m_fCurrentAmbientBlue;
+ static float m_fCurrentDirectionalRed;
+ static float m_fCurrentDirectionalGreen;
+ static float m_fCurrentDirectionalBlue;
+ static int m_nCurrentSkyTopRed;
+ static int m_nCurrentSkyTopGreen;
+ static int m_nCurrentSkyTopBlue;
+ static int m_nCurrentSkyBottomRed;
+ static int m_nCurrentSkyBottomGreen;
+ static int m_nCurrentSkyBottomBlue;
+ static int m_nCurrentSunCoreRed;
+ static int m_nCurrentSunCoreGreen;
+ static int m_nCurrentSunCoreBlue;
+ static int m_nCurrentSunCoronaRed;
+ static int m_nCurrentSunCoronaGreen;
+ static int m_nCurrentSunCoronaBlue;
+ static float m_fCurrentSunSize;
+ static float m_fCurrentSpriteSize;
+ static float m_fCurrentSpriteBrightness;
+ static int m_nCurrentShadowStrength;
+ static int m_nCurrentLightShadowStrength;
+ static int m_nCurrentTreeShadowStrength;
+ static float m_fCurrentFogStart;
+ static float m_fCurrentFarClip;
+ static float m_fCurrentLightsOnGroundBrightness;
+ static int m_nCurrentLowCloudsRed;
+ static int m_nCurrentLowCloudsGreen;
+ static int m_nCurrentLowCloudsBlue;
+ static int m_nCurrentFluffyCloudsTopRed;
+ static int m_nCurrentFluffyCloudsTopGreen;
+ static int m_nCurrentFluffyCloudsTopBlue;
+ static int m_nCurrentFluffyCloudsBottomRed;
+ static int m_nCurrentFluffyCloudsBottomGreen;
+ static int m_nCurrentFluffyCloudsBottomBlue;
+ static float m_fCurrentBlurRed;
+ static float m_fCurrentBlurGreen;
+ static float m_fCurrentBlurBlue;
+ static float m_fCurrentBlurAlpha;
+ static int m_nCurrentFogColourRed;
+ static int m_nCurrentFogColourGreen;
+ static int m_nCurrentFogColourBlue;
- static int &m_FogReduction;
+ static int m_FogReduction;
public:
- static int &m_CurrentStoredValue;
- static CVector *m_VectorToSun; // [16]
- static float *m_fShadowFrontX; // [16]
- static float *m_fShadowFrontY; // [16]
- static float *m_fShadowSideX; // [16]
- static float *m_fShadowSideY; // [16]
- static float *m_fShadowDisplacementX; // [16]
- static float *m_fShadowDisplacementY; // [16]
+ static int m_CurrentStoredValue;
+ static CVector m_VectorToSun[16];
+ static float m_fShadowFrontX[16];
+ static float m_fShadowFrontY[16];
+ static float m_fShadowSideX[16];
+ static float m_fShadowSideY[16];
+ static float m_fShadowDisplacementX[16];
+ static float m_fShadowDisplacementY[16];
static float GetAmbientRed(void) { return m_fCurrentAmbientRed; }
static float GetAmbientGreen(void) { return m_fCurrentAmbientGreen; }
diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp
index e848fb43..2ef10d77 100644
--- a/src/render/WaterCannon.cpp
+++ b/src/render/WaterCannon.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "WaterCannon.h"
#include "Vector.h"
#include "General.h"
@@ -195,14 +195,14 @@ void CWaterCannon::PushPeds(void)
{
if ( m_abUsed[i] )
{
- minx = min(minx, m_avecPos[i].x);
- maxx = max(maxx, m_avecPos[i].x);
+ minx = Min(minx, m_avecPos[i].x);
+ maxx = Max(maxx, m_avecPos[i].x);
- miny = min(miny, m_avecPos[i].y);
- maxy = max(maxy, m_avecPos[i].y);
+ miny = Min(miny, m_avecPos[i].y);
+ maxy = Max(maxy, m_avecPos[i].y);
- minz = min(minz, m_avecPos[i].z);
- maxz = max(maxz, m_avecPos[i].z);
+ minz = Min(minz, m_avecPos[i].z);
+ maxz = Max(maxz, m_avecPos[i].z);
}
}
@@ -304,17 +304,3 @@ void CWaterCannons::Render(void)
aCannons[i].Render();
}
}
-
-STARTPATCHES
- InjectHook(0x521A30, &CWaterCannon::Init, PATCH_JUMP);
- InjectHook(0x521B80, &CWaterCannon::Update_OncePerFrame, PATCH_JUMP);
- InjectHook(0x521CC0, &CWaterCannon::Update_NewInput, PATCH_JUMP);
- InjectHook(0x521D30, &CWaterCannon::Render, PATCH_JUMP);
- InjectHook(0x5220B0, &CWaterCannon::PushPeds, PATCH_JUMP);
- InjectHook(0x522440, CWaterCannons::Init, PATCH_JUMP);
- InjectHook(0x522470, CWaterCannons::UpdateOne, PATCH_JUMP);
- InjectHook(0x522510, CWaterCannons::Update, PATCH_JUMP);
- InjectHook(0x522550, CWaterCannons::Render, PATCH_JUMP);
- //InjectHook(0x522B40, `global constructor keyed to'watercannon.cpp, PATCH_JUMP);
- //InjectHook(0x522B60, CWaterCannon::CWaterCannon, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/render/WaterCannon.h b/src/render/WaterCannon.h
index 826dc78e..d2d20863 100644
--- a/src/render/WaterCannon.h
+++ b/src/render/WaterCannon.h
@@ -13,7 +13,6 @@ public:
int32 m_nId;
int16 m_nCur;
- char _pad0[2];
uint32 m_nTimeCreated;
CVector m_avecPos[NUM_SEGMENTPOINTS];
CVector m_avecVelocity[NUM_SEGMENTPOINTS];
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index a1c2af93..d7035ab1 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -21,7 +21,7 @@
#include "RenderBuffer.h"
#include <rpworld.h>
#include "WaterLevel.h"
-#include "patcher.h"
+
float TEXTURE_ADDU;
float TEXTURE_ADDV;
@@ -39,8 +39,8 @@ int16 CWaterLevel::nGeomUsed;
//RwTexture *gpWaterTex;
//RwRaster *gpWaterRaster;
-RwTexture *&gpWaterTex = *(RwTexture **)0x64D070;
-RwRaster *&gpWaterRaster = *(RwRaster **)0x8F5FD4;
+RwTexture *gpWaterTex;
+RwRaster *gpWaterRaster;
const float fAdd1 = 180.0f;
@@ -979,7 +979,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
SMALL_SECTOR_SIZE / 2,
apBoatList) )
{
- float fWakeColor = fAdd1 - max(255.0f - float(color.blue + color.red + color.green) / 3, fAdd2);
+ float fWakeColor = fAdd1 - Max(255.0f - float(color.blue + color.red + color.green) / 3, fAdd2);
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
RpGeometry *geom = apGeomArray[nGeomUsed++];
@@ -1035,9 +1035,9 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
RwRGBAAssign(&wakeColor, &color);
- wakeColor.red = min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
- wakeColor.green = min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
- wakeColor.blue = min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
+ wakeColor.red = Min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
+ wakeColor.green = Min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
+ wakeColor.blue = Min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
RwRGBAAssign(&geomPreLights[9*i+j], &wakeColor);
@@ -1114,7 +1114,7 @@ CWaterLevel::CalcDistanceToWater(float fX, float fY)
fSectorY + SMALL_SECTOR_SIZE - fY
);
- fDistSqr = min(vecDist.MagnitudeSqr(), fDistSqr);
+ fDistSqr = Min(vecDist.MagnitudeSqr(), fDistSqr);
}
}
}
@@ -1234,22 +1234,3 @@ CWaterLevel::FreeBoatWakeArray()
nGeomUsed = 0;
}
-
-STARTPATCHES
- InjectHook(0x554EA0, &CWaterLevel::Initialise, PATCH_JUMP);
- InjectHook(0x554FE0, &CWaterLevel::Shutdown, PATCH_JUMP);
- InjectHook(0x555010, &CWaterLevel::CreateWavyAtomic, PATCH_JUMP);
- InjectHook(0x5552A0, &CWaterLevel::DestroyWavyAtomic, PATCH_JUMP);
- InjectHook(0x5552C0, (bool (*)(float,float,float,float*,bool))&CWaterLevel::GetWaterLevel, PATCH_JUMP);
- InjectHook(0x555440, &CWaterLevel::GetWaterLevelNoWaves, PATCH_JUMP);
- InjectHook(0x5554E0, &CWaterLevel::RenderWater, PATCH_JUMP);
- InjectHook(0x556C30, &CWaterLevel::RenderOneFlatSmallWaterPoly, PATCH_JUMP);
- InjectHook(0x556E80, &CWaterLevel::RenderOneFlatLargeWaterPoly, PATCH_JUMP);
- InjectHook(0x5570D0, &CWaterLevel::RenderOneFlatHugeWaterPoly, PATCH_JUMP);
- InjectHook(0x557320, &CWaterLevel::RenderOneFlatExtraHugeWaterPoly, PATCH_JUMP);
- InjectHook(0x557570, &CWaterLevel::RenderOneWavySector, PATCH_JUMP);
- InjectHook(0x557C30, &CWaterLevel::CalcDistanceToWater, PATCH_JUMP);
- InjectHook(0x557EA0, &CWaterLevel::RenderAndEmptyRenderBuffer, PATCH_JUMP);
- InjectHook(0x557F00, &CWaterLevel::AllocateBoatWakeArray, PATCH_JUMP);
- InjectHook(0x5581C0, &CWaterLevel::FreeBoatWakeArray, PATCH_JUMP);
-ENDPATCHES
diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h
index 827e83d2..a471bc52 100644
--- a/src/render/WaterLevel.h
+++ b/src/render/WaterLevel.h
@@ -64,7 +64,7 @@
#define MAX_BOAT_WAKES 8
-extern RwRaster*& gpWaterRaster;
+extern RwRaster* gpWaterRaster;
class CWaterLevel
{
diff --git a/src/render/WeaponEffects.cpp b/src/render/WeaponEffects.cpp
deleted file mode 100644
index 2ed9e662..00000000
--- a/src/render/WeaponEffects.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "WeaponEffects.h"
-#include "TxdStore.h"
-#include "Sprite.h"
-
-RwTexture *gpCrossHairTex;
-RwRaster *gpCrossHairRaster;
-
-CWeaponEffects gCrossHair;
-
-CWeaponEffects::CWeaponEffects()
-{
-
-}
-
-CWeaponEffects::~CWeaponEffects()
-{
-
-}
-
-void
-CWeaponEffects::Init(void)
-{
- gCrossHair.m_bActive = false;
- gCrossHair.m_vecPos = CVector(0.0f, 0.0f, 0.0f);
- gCrossHair.m_nRed = 0;
- gCrossHair.m_nGreen = 0;
- gCrossHair.m_nBlue = 0;
- gCrossHair.m_nAlpha = 255;
- gCrossHair.m_fSize = 1.0f;
- gCrossHair.m_fRotation = 0.0f;
-
-
- CTxdStore::PushCurrentTxd();
- int32 slot = CTxdStore::FindTxdSlot("particle");
- CTxdStore::SetCurrentTxd(slot);
-
- gpCrossHairTex = RwTextureRead("crosshair", nil);
- gpCrossHairRaster = RwTextureGetRaster(gpCrossHairTex);
-
- CTxdStore::PopCurrentTxd();
-}
-
-void
-CWeaponEffects::Shutdown(void)
-{
- RwTextureDestroy(gpCrossHairTex);
-}
-
-void
-CWeaponEffects::MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint8 alpha, float size)
-{
- gCrossHair.m_bActive = true;
- gCrossHair.m_vecPos = pos;
- gCrossHair.m_nRed = red;
- gCrossHair.m_nGreen = green;
- gCrossHair.m_nBlue = blue;
- gCrossHair.m_nAlpha = alpha;
- gCrossHair.m_fSize = size;
-}
-
-void
-CWeaponEffects::ClearCrossHair(void)
-{
- gCrossHair.m_bActive = false;
-}
-
-void
-CWeaponEffects::Render(void)
-{
- if ( gCrossHair.m_bActive )
- {
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)gpCrossHairRaster);
-
- RwV3d pos;
- float w, h;
- if ( CSprite::CalcScreenCoors(gCrossHair.m_vecPos, &pos, &w, &h, true) )
- {
- float recipz = 1.0f / pos.z;
- CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z,
- gCrossHair.m_fSize * w, gCrossHair.m_fSize * h,
- gCrossHair.m_nRed, gCrossHair.m_nGreen, gCrossHair.m_nBlue, 255,
- recipz, 255);
- }
-
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
- }
-}
-
-STARTPATCHES
- //InjectHook(0x564C40, CWeaponEffects::CWeaponEffects, PATCH_JUMP);
- //InjectHook(0x564C50, CWeaponEffects::~CWeaponEffects, PATCH_JUMP);
- InjectHook(0x564C60, CWeaponEffects::Init, PATCH_JUMP);
- InjectHook(0x564CF0, CWeaponEffects::Shutdown, PATCH_JUMP);
- InjectHook(0x564D00, CWeaponEffects::MarkTarget, PATCH_JUMP);
- InjectHook(0x564D60, CWeaponEffects::ClearCrossHair, PATCH_JUMP);
- InjectHook(0x564D70, CWeaponEffects::Render, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/render/WeaponEffects.h b/src/render/WeaponEffects.h
deleted file mode 100644
index 31c5a309..00000000
--- a/src/render/WeaponEffects.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-class CWeaponEffects
-{
-public:
- bool m_bActive;
- char _pad[3];
- CVector m_vecPos;
- uint8 m_nRed;
- uint8 m_nGreen;
- uint8 m_nBlue;
- uint8 m_nAlpha;
- float m_fSize;
- float m_fRotation;
-
-public:
- CWeaponEffects();
- ~CWeaponEffects();
-
- static void Init(void);
- static void Shutdown(void);
- static void MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint8 alpha, float size);
- static void ClearCrossHair(void);
- static void Render(void);
-};
-
-VALIDATE_SIZE(CWeaponEffects, 0x1C); \ No newline at end of file
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index b440e77c..b4031705 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -1,5 +1,5 @@
#include "common.h"
-#include "patcher.h"
+
#include "Weather.h"
#include "Camera.h"
@@ -18,35 +18,35 @@
#include "World.h"
#include "ZoneCull.h"
-int32 &CWeather::SoundHandle = *(int32*)0x5FFBC4;
+int32 CWeather::SoundHandle = -1;
-int32 &CWeather::WeatherTypeInList = *(int32*)0x8F626C;
-int16 &CWeather::OldWeatherType = *(int16*)0x95CCEC;
-int16 &CWeather::NewWeatherType = *(int16*)0x95CC70;
-int16 &CWeather::ForcedWeatherType = *(int16*)0x95CC80;
+int32 CWeather::WeatherTypeInList;
+int16 CWeather::OldWeatherType;
+int16 CWeather::NewWeatherType;
+int16 CWeather::ForcedWeatherType;
-bool &CWeather::LightningFlash = *(bool*)0x95CDA3;
-bool &CWeather::LightningBurst = *(bool*)0x95CDAC;
-uint32 &CWeather::LightningStart = *(uint32*)0x8F5F84;
-uint32 &CWeather::LightningFlashLastChange = *(uint32*)0x8E2C0C;
-uint32 &CWeather::WhenToPlayLightningSound = *(uint32*)0x8F57E4;
-uint32 &CWeather::LightningDuration = *(uint32*)0x940578;
+bool CWeather::LightningFlash;
+bool CWeather::LightningBurst;
+uint32 CWeather::LightningStart;
+uint32 CWeather::LightningFlashLastChange;
+uint32 CWeather::WhenToPlayLightningSound;
+uint32 CWeather::LightningDuration;
-float &CWeather::Foggyness = *(float*)0x885AF4;
-float &CWeather::CloudCoverage = *(float*)0x8E2818;
-float &CWeather::Wind = *(float*)0x8E2BF8;
-float &CWeather::Rain = *(float*)0x8E2BFC;
-float &CWeather::InterpolationValue = *(float*)0x8F2520;
-float &CWeather::WetRoads = *(float*)0x8F5FF8;
-float &CWeather::Rainbow = *(float*)0x940598;
+float CWeather::Foggyness;
+float CWeather::CloudCoverage;
+float CWeather::Wind;
+float CWeather::Rain;
+float CWeather::InterpolationValue;
+float CWeather::WetRoads;
+float CWeather::Rainbow;
-bool &CWeather::bScriptsForceRain = *(bool*)0x95CD7D;
-bool &CWeather::Stored_StateStored = *(bool*)0x95CDC1;
+bool CWeather::bScriptsForceRain;
+bool CWeather::Stored_StateStored;
-float &CWeather::Stored_InterpolationValue = *(float*)0x942F54;
-int16 &CWeather::Stored_OldWeatherType = *(int16*)0x95CC68;
-int16 &CWeather::Stored_NewWeatherType = *(int16*)0x95CCAE;
-float &CWeather::Stored_Rain = *(float*)0x885B4C;
+float CWeather::Stored_InterpolationValue;
+int16 CWeather::Stored_OldWeatherType;
+int16 CWeather::Stored_NewWeatherType;
+float CWeather::Stored_Rain;
tRainStreak Streaks[NUM_RAIN_STREAKS];
@@ -126,7 +126,7 @@ void CWeather::Update(void)
if (ForcedWeatherType >= 0)
NewWeatherType = ForcedWeatherType;
else {
- WeatherTypeInList = (WeatherTypeInList + 1) % ARRAYSIZE(WeatherTypesList);
+ WeatherTypeInList = (WeatherTypeInList + 1) % ARRAY_SIZE(WeatherTypesList);
NewWeatherType = WeatherTypesList[WeatherTypeInList];
#ifdef FIX_BUGS
}
@@ -163,7 +163,7 @@ void CWeather::Update(void)
else {
// 0.125 probability
LightningBurst = false;
- LightningDuration = min(CTimer::GetFrameCounter() - LightningStart, 20);
+ LightningDuration = Min(CTimer::GetFrameCounter() - LightningStart, 20);
LightningFlash = false;
WhenToPlayLightningSound = CTimer::GetTimeInMilliseconds() + 150 * (20 - LightningDuration);
}
@@ -219,9 +219,9 @@ void CWeather::Update(void)
fNewRain = 0.0f;
if (Rain != fNewRain) { // ok to use comparasion
if (Rain < fNewRain)
- Rain = min(fNewRain, Rain + RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
+ Rain = Min(fNewRain, Rain + RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
else
- Rain = max(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
+ Rain = Max(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
}
// Clouds
diff --git a/src/render/Weather.h b/src/render/Weather.h
index 9e4ea378..9c670317 100644
--- a/src/render/Weather.h
+++ b/src/render/Weather.h
@@ -16,34 +16,34 @@ public:
WEATHER_FOGGY = 3,
WEATHER_TOTAL = 4
};
- static int32 &SoundHandle;
+ static int32 SoundHandle;
- static int32 &WeatherTypeInList;
- static int16 &OldWeatherType;
- static int16 &NewWeatherType;
- static int16 &ForcedWeatherType;
+ static int32 WeatherTypeInList;
+ static int16 OldWeatherType;
+ static int16 NewWeatherType;
+ static int16 ForcedWeatherType;
- static bool &LightningFlash;
- static bool &LightningBurst;
- static uint32 &LightningStart;
- static uint32 &LightningFlashLastChange;
- static uint32 &WhenToPlayLightningSound;
- static uint32 &LightningDuration;
+ static bool LightningFlash;
+ static bool LightningBurst;
+ static uint32 LightningStart;
+ static uint32 LightningFlashLastChange;
+ static uint32 WhenToPlayLightningSound;
+ static uint32 LightningDuration;
- static float &Foggyness;
- static float &CloudCoverage;
- static float &Wind;
- static float &Rain;
- static float &InterpolationValue;
- static float &WetRoads;
- static float &Rainbow;
+ static float Foggyness;
+ static float CloudCoverage;
+ static float Wind;
+ static float Rain;
+ static float InterpolationValue;
+ static float WetRoads;
+ static float Rainbow;
- static bool &bScriptsForceRain;
- static bool &Stored_StateStored;
- static float &Stored_InterpolationValue;
- static int16 &Stored_OldWeatherType;
- static int16 &Stored_NewWeatherType;
- static float &Stored_Rain;
+ static bool bScriptsForceRain;
+ static bool Stored_StateStored;
+ static float Stored_InterpolationValue;
+ static int16 Stored_OldWeatherType;
+ static int16 Stored_NewWeatherType;
+ static float Stored_Rain;
static void RenderRainStreaks(void);
static void Update(void);
@@ -68,4 +68,4 @@ struct tRainStreak
uint32 timer;
};
-extern RwTexture* (&gpRainDropTex)[4]; \ No newline at end of file
+extern RwTexture* gpRainDropTex[4]; \ No newline at end of file