summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--premake5.lua22
-rw-r--r--src/animation/CutsceneMgr.cpp2
-rw-r--r--src/control/AutoPilot.cpp16
-rw-r--r--src/control/CarCtrl.cpp144
-rw-r--r--src/control/PathFind.cpp167
-rw-r--r--src/control/PathFind.h12
-rw-r--r--src/control/TrafficLights.cpp334
-rw-r--r--src/control/TrafficLights.h7
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/Timer.h1
-rw-r--r--src/core/common.h2
-rw-r--r--src/core/main.cpp7
-rw-r--r--src/core/re3.cpp7
-rw-r--r--src/objects/ParticleObject.cpp2
-rw-r--r--src/render/Timecycle.h2
-rw-r--r--src/rw/ClumpRead.cpp (renamed from src/core/RwClumpRead.cpp)0
-rw-r--r--src/rw/Lights.cpp (renamed from src/render/Lights.cpp)0
-rw-r--r--src/rw/Lights.h (renamed from src/render/Lights.h)0
-rw-r--r--src/rw/NodeName.cpp (renamed from src/core/NodeName.cpp)0
-rw-r--r--src/rw/NodeName.h (renamed from src/core/NodeName.h)0
-rw-r--r--src/rw/RwHelper.cpp (renamed from src/core/RwHelper.cpp)0
-rw-r--r--src/rw/RwHelper.h (renamed from src/core/RwHelper.h)0
-rw-r--r--src/rw/RwMatFX.cpp (renamed from src/core/RwMatFX.cpp)0
-rw-r--r--src/rw/TexRead.cpp (renamed from src/core/RwTexRead.cpp)14
-rw-r--r--src/rw/TxdStore.cpp (renamed from src/core/TxdStore.cpp)0
-rw-r--r--src/rw/TxdStore.h (renamed from src/core/TxdStore.h)0
-rw-r--r--src/rw/VisibilityPlugins.cpp (renamed from src/render/VisibilityPlugins.cpp)0
-rw-r--r--src/rw/VisibilityPlugins.h (renamed from src/render/VisibilityPlugins.h)0
-rw-r--r--src/rw/rw.cpp (renamed from src/core/rw.cpp)428
30 files changed, 1044 insertions, 126 deletions
diff --git a/README.md b/README.md
index 88d99dcd..b83fcac9 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,6 @@ CPools - save/loading
CRecordDataForChase
CRecordDataForGame
CRoadBlocks
-CTrafficLights
CWeapon
CWorld
GenericLoad
diff --git a/premake5.lua b/premake5.lua
index 9e3609b6..4ec2eca1 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -1,5 +1,5 @@
workspace "re3"
- configurations { "Debug", "Release", "ReleaseFH" }
+ configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW" }
location "build"
files { "src/*.*" }
@@ -13,6 +13,7 @@ workspace "re3"
files { "src/objects/*.*" }
files { "src/peds/*.*" }
files { "src/render/*.*" }
+ files { "src/rw/*.*" }
files { "src/save/*.*" }
files { "src/skel/*.*" }
files { "src/skel/win/*.*" }
@@ -32,6 +33,7 @@ workspace "re3"
includedirs { "src/objects" }
includedirs { "src/peds" }
includedirs { "src/render" }
+ includedirs { "src/rw" }
includedirs { "src/save/" }
includedirs { "src/skel/" }
includedirs { "src/skel/win" }
@@ -47,6 +49,12 @@ workspace "re3"
libdirs { "dxsdk/lib" }
libdirs { "milessdk/lib" }
+
+ filter "configurations:DebugRW or configurations:ReleaseRW"
+ defines { "RWLIBS" }
+ libdirs { "rwsdk/lib/d3d8/release" }
+ links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp" }
+ filter {}
pbcommands = {
"setlocal EnableDelayedExpansion",
@@ -102,3 +110,15 @@ project "re3"
staticruntime "on"
targetextension ".asi"
setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "scripts/")
+
+ filter "configurations:DebugRW"
+ defines { "DEBUG" }
+ staticruntime "on"
+ symbols "On"
+ setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
+
+ filter "configurations:ReleaseRW"
+ defines { "NDEBUG" }
+ optimize "On"
+ staticruntime "on"
+ setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
diff --git a/src/animation/CutsceneMgr.cpp b/src/animation/CutsceneMgr.cpp
index 0e35599b..6f8e9790 100644
--- a/src/animation/CutsceneMgr.cpp
+++ b/src/animation/CutsceneMgr.cpp
@@ -410,7 +410,7 @@ CCutsceneMgr::Update(void)
if (!ms_running) return;
- ms_cutsceneTimer += CTimer::GetTimeStepNonClipped() * 0.02f;
+ ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds();
if (CGeneral::faststricmp(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
if (CPad::GetPad(0)->GetCrossJustDown()
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
diff --git a/src/control/AutoPilot.cpp b/src/control/AutoPilot.cpp
index 70099291..b5bca21d 100644
--- a/src/control/AutoPilot.cpp
+++ b/src/control/AutoPilot.cpp
@@ -12,17 +12,17 @@ void CAutoPilot::ModifySpeed(float speed)
float positionBetweenNodes = (float)(CTimer::GetTimeInMilliseconds() - m_nTimeEnteredCurve) / m_nTimeToSpendOnCurrentCurve;
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[m_nNextPathNodeInfo];
- float currentPathLinkForwardX = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dirX;
- float currentPathLinkForwardY = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dirY;
- float nextPathLinkForwardX = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dirX;
- float nextPathLinkForwardY = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dirY;
+ float currentPathLinkForwardX = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dir.x;
+ float currentPathLinkForwardY = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dir.y;
+ float nextPathLinkForwardX = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dir.x;
+ float nextPathLinkForwardY = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dir.y;
CVector positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurrentLink->posY - ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurrentLink->pos.x + ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurrentLink->pos.y - ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index cdcfbba6..264f1f3f 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -393,25 +393,25 @@ CCarCtrl::GenerateOneRandomCar()
pCar->GetRight() = CVector(forwardY, -forwardX, 0.0f);
pCar->GetUp() = CVector(0.0f, 0.0f, 1.0f);
- float currentPathLinkForwardX = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dirX;
- float currentPathLinkForwardY = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dirY;
- float nextPathLinkForwardX = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dirX;
- float nextPathLinkForwardY = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dirY;
+ float currentPathLinkForwardX = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dir.x;
+ float currentPathLinkForwardY = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dir.y;
+ float nextPathLinkForwardX = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dir.x;
+ float nextPathLinkForwardY = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dir.y;
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo];
CVector positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurrentLink->posY - ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurrentLink->pos.x + ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurrentLink->pos.y - ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurrentLink->dirX * pCar->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurrentLink->dirY * pCar->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pCar->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pCar->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurrentLink->dir.x * pCar->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurrentLink->dir.y * pCar->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pCar->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pCar->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pCar->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -763,17 +763,17 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
return;
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
- float currentPathLinkForwardX = pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float currentPathLinkForwardY = pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float currentPathLinkForwardX = pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float currentPathLinkForwardY = pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
CVector positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
CVector directionCurrentLink(currentPathLinkForwardX, currentPathLinkForwardY, 0.0f);
CVector directionNextLink(nextPathLinkForwardX, nextPathLinkForwardY, 0.0f);
@@ -1553,8 +1553,8 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nNextDirection = -1;
lanesOnNextNode = pNextLink->numRightLanes;
}
- float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
- float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
+ float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
+ float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
if (lanesOnNextNode >= 0){
if ((CGeneral::GetRandomNumber() & 0x600) == 0){
/* 25% chance vehicle will try to switch lane */
@@ -1574,17 +1574,17 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane(
- pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH), /* ...what about Y? */
- pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH), /* ...what about Y? */
+ pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH),
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH),
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -1725,10 +1725,10 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
pVehicle->AutoPilot.m_nNextDirection = -1;
lanesOnNextNode = pNextLink->numRightLanes;
}
- float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
- float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirY;
- float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
- float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirY;
+ float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
+ float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.y;
+ float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
+ float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.y;
if (lanesOnNextNode >= 0) {
CVector2D dist = pNextPathNode->pos - pCurNode->pos;
if (dist.MagnitudeSqr() >= SQR(7.0f)){
@@ -1755,17 +1755,17 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane(
- pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -1814,10 +1814,10 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nNextDirection = -1;
lanesOnNextNode = pNextLink->numRightLanes;
}
- float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
- float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirY;
- float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
- float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirY;
+ float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
+ float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.y;
+ float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
+ float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.y;
if (lanesOnNextNode >= 0) {
CVector2D dist = pNextPathNode->pos - pCurNode->pos;
if (dist.MagnitudeSqr() >= SQR(7.0f) && (CGeneral::GetRandomNumber() & 0x600) == 0) {
@@ -1835,17 +1835,17 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane(
- pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -2192,16 +2192,16 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
forward.Normalise();
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
- CVector2D currentPathLinkForward(pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection,
- pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection);
- float nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ CVector2D currentPathLinkForward(pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection,
+ pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection);
+ float nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
CVector2D positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
+ pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
CVector2D positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX);
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX);
CVector2D distanceToNextNode = (CVector2D)pVehicle->GetPosition() - positionOnCurrentLinkIncludingLane;
float scalarDistanceToNextNode = distanceToNextNode.Magnitude();
CVector2D distanceBetweenNodes = positionOnNextLinkIncludingLane - positionOnCurrentLinkIncludingLane;
@@ -2230,16 +2230,16 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
}
pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
scalarDistanceToNextNode = CVector2D(
- pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y - pVehicle->GetPosition().x,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x - pVehicle->GetPosition().y).Magnitude();
+ pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y - pVehicle->GetPosition().x,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x - pVehicle->GetPosition().y).Magnitude();
pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
- currentPathLinkForward.x = pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- currentPathLinkForward.y = pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ currentPathLinkForward.x = pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ currentPathLinkForward.y = pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
}
- positionOnCurrentLinkIncludingLane.x = pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y;
- positionOnCurrentLinkIncludingLane.y = pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x;
+ positionOnCurrentLinkIncludingLane.x = pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y;
+ positionOnCurrentLinkIncludingLane.y = pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x;
CVector2D projectedPosition = positionOnCurrentLinkIncludingLane - currentPathLinkForward * scalarDistanceToNextNode * 0.4f;
if (scalarDistanceToNextNode > DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN){
projectedPosition.x = positionOnCurrentLinkIncludingLane.x;
@@ -2281,8 +2281,8 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
CCarAI::CarHasReasonToStop(pVehicle);
speedStyleMultiplier = 0.0f;
}
- CVector2D trajectory(pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
+ CVector2D trajectory(pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
trajectory -= pVehicle->GetPosition();
float speedAngleMultiplier = FindSpeedMultiplier(
CGeneral::GetATanOfXY(trajectory.x, trajectory.y) - angleForward,
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 608a209a..61cd3d4e 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -5,8 +5,13 @@
#include "Camera.h"
#include "Vehicle.h"
#include "World.h"
+#include "Lines.h" // for debug
#include "PathFind.h"
+bool gbShowPedPaths;
+bool gbShowCarPaths;
+bool gbShowCarPathsLinks;
+
CPathFind &ThePaths = *(CPathFind*)0x8F6754;
WRAPPER bool CPedPath::CalcPedRoute(uint8, CVector, CVector, CVector*, int16*, int16) { EAXJMP(0x42E680); }
@@ -466,20 +471,20 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// IMPROVE: use a goto here
// Find existing car path link
for(k = 0; k < m_numCarPathLinks; k++){
- if(m_carPathLinks[k].dirX == tempnodes[j].dirX &&
- m_carPathLinks[k].dirY == tempnodes[j].dirY &&
- m_carPathLinks[k].posX == tempnodes[j].pos.x &&
- m_carPathLinks[k].posY == tempnodes[j].pos.y){
+ if(m_carPathLinks[k].dir.x == tempnodes[j].dirX &&
+ m_carPathLinks[k].dir.y == tempnodes[j].dirY &&
+ m_carPathLinks[k].pos.x == tempnodes[j].pos.x &&
+ m_carPathLinks[k].pos.y == tempnodes[j].pos.y){
m_carPathConnections[m_numConnections] = k;
k = m_numCarPathLinks;
}
}
// k is m_numCarPathLinks+1 if we found one
if(k == m_numCarPathLinks){
- m_carPathLinks[m_numCarPathLinks].dirX = tempnodes[j].dirX;
- m_carPathLinks[m_numCarPathLinks].dirY = tempnodes[j].dirY;
- m_carPathLinks[m_numCarPathLinks].posX = tempnodes[j].pos.x;
- m_carPathLinks[m_numCarPathLinks].posY = tempnodes[j].pos.y;
+ m_carPathLinks[m_numCarPathLinks].dir.x = tempnodes[j].dirX;
+ m_carPathLinks[m_numCarPathLinks].dir.y = tempnodes[j].dirY;
+ m_carPathLinks[m_numCarPathLinks].pos.x = tempnodes[j].pos.x;
+ m_carPathLinks[m_numCarPathLinks].pos.y = tempnodes[j].pos.y;
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes;
m_carPathLinks[m_numCarPathLinks].numRightLanes = tempnodes[j].numRightLanes;
@@ -529,20 +534,20 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// IMPROVE: use a goto here
// Find existing car path link
for(k = 0; k < m_numCarPathLinks; k++){
- if(m_carPathLinks[k].dirX == dx &&
- m_carPathLinks[k].dirY == dy &&
- m_carPathLinks[k].posX == posx &&
- m_carPathLinks[k].posY == posy){
+ if(m_carPathLinks[k].dir.x == dx &&
+ m_carPathLinks[k].dir.y == dy &&
+ m_carPathLinks[k].pos.x == posx &&
+ m_carPathLinks[k].pos.y == posy){
m_carPathConnections[m_numConnections] = k;
k = m_numCarPathLinks;
}
}
// k is m_numCarPathLinks+1 if we found one
if(k == m_numCarPathLinks){
- m_carPathLinks[m_numCarPathLinks].dirX = dx;
- m_carPathLinks[m_numCarPathLinks].dirY = dy;
- m_carPathLinks[m_numCarPathLinks].posX = posx;
- m_carPathLinks[m_numCarPathLinks].posY = posy;
+ m_carPathLinks[m_numCarPathLinks].dir.x = dx;
+ m_carPathLinks[m_numCarPathLinks].dir.y = dy;
+ m_carPathLinks[m_numCarPathLinks].pos.x = posx;
+ m_carPathLinks[m_numCarPathLinks].pos.y = posy;
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
m_carPathLinks[m_numCarPathLinks].numRightLanes = -1;
@@ -760,8 +765,8 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
{
int i;
for(i = 0; i < m_numCarPathLinks; i++)
- if(x1 < m_carPathLinks[i].posX && m_carPathLinks[i].posX < x2 &&
- y1 < m_carPathLinks[i].posY && m_carPathLinks[i].posY < y2)
+ if(x1 < m_carPathLinks[i].pos.x && m_carPathLinks[i].pos.x < x2 &&
+ y1 < m_carPathLinks[i].pos.y && m_carPathLinks[i].pos.y < y2)
m_carPathLinks[i].bBridgeLights = enable;
}
@@ -1444,6 +1449,132 @@ CPathFind::Load(uint8 *buf, uint32 size)
m_pathNodes[i].bBetweenLevels = false;
}
+void
+CPathFind::DisplayPathData(void)
+{
+ // Not the function from mobm_carPathLinksile but my own!
+
+ int i, j, k;
+ // Draw 50 units around camera
+ CVector pos = TheCamera.GetPosition();
+ const float maxDist = 50.0f;
+
+ // Render car path nodes
+ if(gbShowCarPaths)
+ for(i = 0; i < m_numCarPathNodes; i++){
+ if((m_pathNodes[i].pos - pos).MagnitudeSqr() > SQR(maxDist))
+ continue;
+
+ CVector n1 = m_pathNodes[i].pos;
+ n1.z += 0.3f;
+
+ // Draw node itself
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n1.x, n1.y, n1.z + 1.0f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ for(j = 0; j < m_pathNodes[i].numLinks; j++){
+ k = m_connections[m_pathNodes[i].firstLink + j];
+ CVector n2 = m_pathNodes[k].pos;
+ n2.z += 0.3f;
+ // Draw links to neighbours
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n2.x, n2.y, n2.z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ }
+ }
+
+ // Render car path nodes
+ if(gbShowCarPathsLinks)
+ for(i = 0; i < m_numCarPathLinks; i++){
+ CVector2D n1_2d = m_carPathLinks[i].pos;
+ if((n1_2d - pos).MagnitudeSqr() > SQR(maxDist))
+ continue;
+
+ int ni = m_carPathLinks[i].pathNodeIndex;
+ CVector pn1 = m_pathNodes[ni].pos;
+ pn1.z += 0.3f;
+ CVector n1(n1_2d.x, n1_2d.y, pn1.z);
+ n1.z += 0.3f;
+
+ // Draw car node itself
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n1.x, n1.y, n1.z + 1.0f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z + 0.5f,
+ n1.x+m_carPathLinks[i].dir.x, n1.y+m_carPathLinks[i].dir.y, n1.z + 0.5f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ // Draw connection to car path node
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ pn1.x, pn1.y, pn1.z,
+ 0xFF0000FF, 0xFFFFFFFF);
+
+ // traffic light type
+ uint32 col = 0xFF;
+ if((m_carPathLinks[i].trafficLightType&0x7F) == 1)
+ col += 0xFF000000;
+ if((m_carPathLinks[i].trafficLightType&0x7F) == 2)
+ col += 0x00FF0000;
+ if(m_carPathLinks[i].trafficLightType & 0x80)
+ col += 0x0000FF00;
+ CLines::RenderLineWithClipping(n1.x+0.2f, n1.y, n1.z,
+ n1.x+0.2f, n1.y, n1.z + 1.0f,
+ col, col);
+
+ for(j = 0; j < m_pathNodes[ni].numLinks; j++){
+ k = m_carPathConnections[m_pathNodes[ni].firstLink + j];
+ CVector2D n2_2d = m_carPathLinks[k].pos;
+ int nk = m_carPathLinks[k].pathNodeIndex;
+ CVector pn2 = m_pathNodes[nk].pos;
+ pn2.z += 0.3f;
+ CVector n2(n2_2d.x, n2_2d.y, pn2.z);
+ n2.z += 0.3f;
+
+ // Draw links to neighbours
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n2.x, n2.y, n2.z,
+ 0xFF00FFFF, 0xFF00FFFF);
+ }
+ }
+
+ // Render ped path nodes
+ if(gbShowPedPaths)
+ for(i = m_numCarPathNodes; i < m_numPathNodes; i++){
+ if((m_pathNodes[i].pos - pos).MagnitudeSqr() > SQR(maxDist))
+ continue;
+
+ CVector n1 = m_pathNodes[i].pos;
+ n1.z += 0.3f;
+
+ // Draw node itself
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n1.x, n1.y, n1.z + 1.0f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ for(j = 0; j < m_pathNodes[i].numLinks; j++){
+ k = m_connections[m_pathNodes[i].firstLink + j];
+ CVector n2 = m_pathNodes[k].pos;
+ n2.z += 0.3f;
+ // Draw links to neighbours
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n2.x, n2.y, n2.z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ // Draw connection flags
+ CVector mid = (n1+n2)/2.0f;
+ uint32 col = 0xFF;
+ if(m_connectionFlags[m_pathNodes[i].firstLink + j].bCrossesRoad)
+ col += 0x00FF0000;
+ if(m_connectionFlags[m_pathNodes[i].firstLink + j].bTrafficLight)
+ col += 0xFF000000;
+ CLines::RenderLineWithClipping(mid.x, mid.y, mid.z,
+ mid.x, mid.y, mid.z + 1.0f,
+ col, col);
+ }
+ }
+}
+
STARTPATCHES
InjectHook(0x4294A0, &CPathFind::Init, PATCH_JUMP);
InjectHook(0x42D580, &CPathFind::AllocatePathFindInfoMem, PATCH_JUMP);
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index c51cb7c7..81467cdf 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -84,10 +84,8 @@ union CConnectionFlags
struct CCarPathLink
{
- float posX;
- float posY;
- float dirX;
- float dirY;
+ CVector2D pos;
+ CVector2D dir;
int16 pathNodeIndex;
int8 numLeftLanes;
int8 numRightLanes;
@@ -208,7 +206,13 @@ public:
bool TestCoorsCloseness(CVector target, uint8 type, CVector start);
void Save(uint8 *buf, uint32 *size);
void Load(uint8 *buf, uint32 size);
+
+ void DisplayPathData(void);
};
static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
extern CPathFind &ThePaths;
+
+extern bool gbShowPedPaths;
+extern bool gbShowCarPaths;
+extern bool gbShowCarPathsLinks;
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index 2cd09a03..ab9cd92d 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -1,23 +1,335 @@
#include "common.h"
#include "patcher.h"
-#include "TrafficLights.h"
+#include "General.h"
+#include "Camera.h"
+#include "World.h"
+#include "PathFind.h"
#include "Timer.h"
+#include "Clock.h"
+#include "Weather.h"
+#include "Timecycle.h"
+#include "Pointlights.h"
+#include "Shadows.h"
+#include "Coronas.h"
+#include "SpecialFX.h"
#include "Vehicle.h"
+#include "TrafficLights.h"
+
+// TODO: figure out the meaning of this
+enum { SOME_FLAG = 0x80 };
+
+void
+CTrafficLights::DisplayActualLight(CEntity *ent)
+{
+ if(ent->GetUp().z < 0.96f || ent->bRenderDamaged)
+ return;
+
+ int phase;
+ if(FindTrafficLightType(ent) == 1)
+ phase = LightForCars1();
+ else
+ phase = LightForCars2();
+
+ int i;
+ CBaseModelInfo *mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
+ float x = mi->Get2dEffect(0)->pos.x;
+ float yMin = mi->Get2dEffect(0)->pos.y;
+ float yMax = mi->Get2dEffect(0)->pos.y;
+ float zMin = mi->Get2dEffect(0)->pos.z;
+ float zMax = mi->Get2dEffect(0)->pos.z;
+ for(i = 1; i < 6; i++){
+ assert(mi->Get2dEffect(i));
+ yMin = min(yMin, mi->Get2dEffect(i)->pos.y);
+ yMax = max(yMax, mi->Get2dEffect(i)->pos.y);
+ zMin = min(zMin, mi->Get2dEffect(i)->pos.z);
+ zMax = max(zMax, mi->Get2dEffect(i)->pos.z);
+ }
+
+ CVector pos1, pos2;
+ uint8 r, g;
+ int id;
+ switch(phase){
+ case CAR_LIGHTS_GREEN:
+ r = 0;
+ g = 255;
+ pos1 = ent->GetMatrix() * CVector(x, yMax, zMin);
+ pos2 = ent->GetMatrix() * CVector(x, yMin, zMin);
+ id = 0;
+ break;
+ case CAR_LIGHTS_YELLOW:
+ r = 255;
+ g = 128;
+ pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin+zMax)/2.0f);
+ pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin+zMax)/2.0f);
+ id = 1;
+ break;
+ case CAR_LIGHTS_RED:
+ default:
+ r = 255;
+ g = 0;
+ pos1 = ent->GetMatrix() * CVector(x, yMax, zMax);
+ pos2 = ent->GetMatrix() * CVector(x, yMin, zMax);
+ id = 2;
+ break;
+ }
+
+ if(CClock::GetHours() > 19 || CClock::GetHours() < 6 || CWeather::Foggyness > 0.05f)
+ CPointLights::AddLight(CPointLights::LIGHT_POINT,
+ pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f,
+ r/255.0f, g/255.0f, 0/255.0f, CPointLights::FOG_NORMAL, true);
+
+ CShadows::StoreStaticShadow((uintptr)ent,
+ SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1,
+ 8.0f, 0.0f, 0.0f, -8.0f, 128,
+ r*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
+ g*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
+ 0*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
+ 12.0f, 1.0f, 40.0f, false, 0.0f);
+
+ if(DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f)
+ CCoronas::RegisterCorona((uintptr)ent + id,
+ r*CTimeCycle::GetSpriteBrightness()*0.7f,
+ g*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 0*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 255,
+ pos1, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
+ CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
+ CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
+ else
+ CCoronas::RegisterCorona((uintptr)ent + id + 3,
+ r*CTimeCycle::GetSpriteBrightness()*0.7f,
+ g*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 0*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 255,
+ pos2, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
+ CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
+ CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
+
+ CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
+ CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
+
+ static const float top = -0.127f;
+ static const float bot = -0.539f;
+ static const float mid = bot + (top-bot)/3.0f;
+ static const float left = 1.256f;
+ static const float right = 0.706f;
+ phase = CTrafficLights::LightForPeds();
+ if(phase == PED_LIGHTS_DONT_WALK){
+ CVector p0(2.7f, right, top);
+ CVector p1(2.7f, left, top);
+ CVector p2(2.7f, right, mid);
+ CVector p3(2.7f, left, mid);
+ CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
+ SHINYTEXT_WALK, 255, 0, 0, 60.0f);
+ }else if(phase == PED_LIGHTS_WALK || CTimer::GetTimeInMilliseconds() & 0x100){
+ CVector p0(2.7f, right, mid);
+ CVector p1(2.7f, left, mid);
+ CVector p2(2.7f, right, bot);
+ CVector p3(2.7f, left, bot);
+ CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
+ 1.0f, 0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f,
+ SHINYTEXT_WALK, 255, 255, 255, 60.0f);
+ }
+}
+
+void
+CTrafficLights::ScanForLightsOnMap(void)
+{
+ int x, y;
+ int i, j, l;
+ CPtrNode *node;
+
+ for(x = 0; x < NUMSECTORS_X; x++)
+ for(y = 0; y < NUMSECTORS_Y; y++){
+ CPtrList &list = CWorld::GetSector(x, y)->m_lists[ENTITYLIST_DUMMIES];
+ for(node = list.first; node; node = node->next){
+ CEntity *light = (CEntity*)node->item;
+ if(light->GetModelIndex() != MI_TRAFFICLIGHTS)
+ continue;
+
+ // Check cars
+ for(i = 0; i < ThePaths.m_numCarPathLinks; i++){
+ CVector2D dist = ThePaths.m_carPathLinks[i].pos - light->GetPosition();
+ float dotY = Abs(DotProduct2D(dist, light->GetForward())); // forward is direction of car light
+ float dotX = DotProduct2D(dist, light->GetRight()); // towards base of light
+ // it has to be on the correct side of the node and also not very far away
+ if(dotX < 0.0f && dotX > -15.0f && dotY < 3.0f){
+ float dz = ThePaths.m_pathNodes[ThePaths.m_carPathLinks[i].pathNodeIndex].pos.z -
+ light->GetPosition().z;
+ if(dz < 15.0f){
+ ThePaths.m_carPathLinks[i].trafficLightType = FindTrafficLightType(light);
+ // Find two neighbour nodes of this one
+ int n1 = -1;
+ int n2 = -1;
+ for(j = 0; j < ThePaths.m_numPathNodes; j++)
+ for(l = 0; l < ThePaths.m_pathNodes[j].numLinks; l++)
+ if(ThePaths.m_carPathConnections[ThePaths.m_pathNodes[j].firstLink + l] == i){
+ if(n1 == -1)
+ n1 = j;
+ else
+ n2 = j;
+ }
+ // What's going on here?
+ if(ThePaths.m_pathNodes[n1].numLinks <= ThePaths.m_pathNodes[n2].numLinks)
+ n1 = n2;
+ if(ThePaths.m_carPathLinks[i].pathNodeIndex != n1)
+ ThePaths.m_carPathLinks[i].trafficLightType |= SOME_FLAG;
+ }
+ }
+ }
+
+ // Check peds
+ for(i = ThePaths.m_numCarPathNodes; i < ThePaths.m_numPathNodes; i++){
+ float dist1, dist2;
+ dist1 = Abs(ThePaths.m_pathNodes[i].pos.x - light->GetPosition().x) +
+ Abs(ThePaths.m_pathNodes[i].pos.y - light->GetPosition().y);
+ if(dist1 < 50.0f){
+ for(l = 0; l < ThePaths.m_pathNodes[i].numLinks; l++){
+ j = ThePaths.m_pathNodes[i].firstLink + l;
+ if(ThePaths.m_connectionFlags[j].bCrossesRoad){
+ dist2 = Abs(ThePaths.m_pathNodes[j].pos.x - light->GetPosition().x) +
+ Abs(ThePaths.m_pathNodes[j].pos.y - light->GetPosition().y);
+ if(dist1 < 15.0f || dist2 < 15.0f)
+ ThePaths.m_connectionFlags[j].bTrafficLight = true;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+bool
+CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
+{
+ int node, type;
-WRAPPER void CTrafficLights::DisplayActualLight(CEntity *ent) { EAXJMP(0x455800); }
-WRAPPER void CTrafficLights::ScanForLightsOnMap(void) { EAXJMP(0x454F40); }
-WRAPPER bool CTrafficLights::ShouldCarStopForLight(CVehicle*, bool) { EAXJMP(0x455350); }
-WRAPPER bool CTrafficLights::ShouldCarStopForBridge(CVehicle*) { EAXJMP(0x456460); }
+ node = vehicle->AutoPilot.m_nNextPathNodeInfo;
+ type = ThePaths.m_carPathLinks[node].trafficLightType;
+ if(type){
+ if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) &&
+ (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode))
+ if(alwaysStop ||
+ (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
+ (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
+ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
+ ThePaths.m_carPathLinks[node].dir);
+ if(vehicle->AutoPilot.m_nNextDirection == -1){
+ if(dist > 0.0f && dist < 8.0f)
+ return true;
+ }else{
+ if(dist < 0.0f && dist > -8.0f)
+ return true;
+ }
+ }
+ }
+
+ node = vehicle->AutoPilot.m_nCurrentPathNodeInfo;
+ type = ThePaths.m_carPathLinks[node].trafficLightType;
+ if(type){
+ if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) &&
+ (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode))
+ if(alwaysStop ||
+ (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
+ (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
+ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
+ ThePaths.m_carPathLinks[node].dir);
+ if(vehicle->AutoPilot.m_nCurrentDirection == -1){
+ if(dist > 0.0f && dist < 8.0f)
+ return true;
+ }else{
+ if(dist < 0.0f && dist > -8.0f)
+ return true;
+ }
+ }
+ }
+
+ if(vehicle->m_status == STATUS_PHYSICS){
+ node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
+ type = ThePaths.m_carPathLinks[node].trafficLightType;
+ if(type){
+ if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) &&
+ (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode))
+ if(alwaysStop ||
+ (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
+ (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
+ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
+ ThePaths.m_carPathLinks[node].dir);
+ if(vehicle->AutoPilot.m_nPreviousDirection == -1){
+ if(dist > 0.0f && dist < 6.0f)
+ return true;
+ }else{
+ if(dist < 0.0f && dist > -6.0f)
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+bool
+CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle)
+{
+ return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights &&
+ !ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights;
+}
+
+int
+CTrafficLights::FindTrafficLightType(CEntity *light)
+{
+ float orientation = RADTODEG(CGeneral::GetATanOfXY(light->GetForward().x, light->GetForward().y));
+ if((orientation > 60.0f && orientation < 60.0f + 90.0f) ||
+ (orientation > 240.0f && orientation < 240.0f + 90.0f))
+ return 1;
+ return 2;
+}
uint8
CTrafficLights::LightForPeds(void)
{
- uint32 period = CTimer::GetTimeInMilliseconds() & 0x3FFF; // Equals to % 16384
+ uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
- if (period >= 15384)
- return PED_LIGHTS_WALK_BLINK;
- else if (period >= 12000)
+ if(period < 12000)
+ return PED_LIGHTS_DONT_WALK;
+ else if(period < 16384 - 1000)
return PED_LIGHTS_WALK;
else
- return PED_LIGHTS_DONT_WALK;
-} \ No newline at end of file
+ return PED_LIGHTS_WALK_BLINK;
+}
+
+uint8
+CTrafficLights::LightForCars1(void)
+{
+ uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
+
+ if(period < 5000)
+ return CAR_LIGHTS_GREEN;
+ else if(period < 5000 + 1000)
+ return CAR_LIGHTS_YELLOW;
+ else
+ return CAR_LIGHTS_RED;
+}
+
+uint8
+CTrafficLights::LightForCars2(void)
+{
+ uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
+
+ if(period < 6000)
+ return CAR_LIGHTS_RED;
+ else if(period < 12000 - 1000)
+ return CAR_LIGHTS_GREEN;
+ else if(period < 12000)
+ return CAR_LIGHTS_YELLOW;
+ else
+ return CAR_LIGHTS_RED;
+}
+
+STARTPATCHES
+ InjectHook(0x455760, &CTrafficLights::LightForCars1, PATCH_JUMP);
+ InjectHook(0x455790, &CTrafficLights::LightForCars2, PATCH_JUMP);
+ InjectHook(0x4557D0, &CTrafficLights::LightForPeds, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/control/TrafficLights.h b/src/control/TrafficLights.h
index 06505ed6..f3df6cd5 100644
--- a/src/control/TrafficLights.h
+++ b/src/control/TrafficLights.h
@@ -7,6 +7,10 @@ enum {
PED_LIGHTS_WALK,
PED_LIGHTS_WALK_BLINK,
PED_LIGHTS_DONT_WALK,
+
+ CAR_LIGHTS_GREEN = 0,
+ CAR_LIGHTS_YELLOW,
+ CAR_LIGHTS_RED
};
class CTrafficLights
@@ -14,7 +18,10 @@ class CTrafficLights
public:
static void DisplayActualLight(CEntity *ent);
static void ScanForLightsOnMap(void);
+ static int FindTrafficLightType(CEntity *light);
static uint8 LightForPeds(void);
+ static uint8 LightForCars1(void);
+ static uint8 LightForCars2(void);
static bool ShouldCarStopForLight(CVehicle*, bool);
static bool ShouldCarStopForBridge(CVehicle*);
};
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index dc9ef74f..cfdea46a 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -3511,7 +3511,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
Up = CVector(0.0f, 0.0f, 1.0f);
if(TheCamera.m_bStartingSpline)
- m_fTimeElapsedFloat += CTimer::GetTimeStepInMilliseconds();
+ m_fTimeElapsedFloat += CTimer::GetTimeStepNonClippedInMilliseconds();
else{
m_fTimeElapsedFloat = 0.0f;
m_uiFinishTime = MS(TheCamera.m_arrPathArray[2].m_arr_PathData[10*((int)TheCamera.m_arrPathArray[2].m_arr_PathData[0]-1) + 1]);
diff --git a/src/core/Timer.h b/src/core/Timer.h
index 7b35f79a..b119bfb2 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -21,6 +21,7 @@ public:
static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
+ static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; }
static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
static const uint32 &GetFrameCounter(void) { return m_FrameCounter; }
static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
diff --git a/src/core/common.h b/src/core/common.h
index 6ea88f2f..7688b182 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -74,9 +74,11 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
}
+#ifndef RWLIBS
// little hack
extern void **rwengine;
#define RwEngineInstance (*rwengine)
+#endif
#include "skeleton.h"
#include "Draw.h"
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 93e4c71c..f09c2e0a 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1,8 +1,7 @@
#include "common.h"
#include "rpmatfx.h"
-#include "rpskin.h"
#include "rphanim.h"
-#include "rtbmp.h"
+#include "rpskin.h"
#include "patcher.h"
#include "main.h"
#include "CdStream.h"
@@ -54,6 +53,7 @@
#include "Frontend.h"
#include "AnimViewer.h"
#include "Script.h"
+#include "PathFind.h"
#include "Debug.h"
#include "Console.h"
#include "timebars.h"
@@ -788,8 +788,11 @@ void
RenderDebugShit(void)
{
CTheScripts::RenderTheScriptDebugLines();
+#ifndef FINAL
if(gbShowCollisionLines)
CRenderer::RenderCollisionLines();
+ ThePaths.DisplayPathData();
+#endif
}
void
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index a35a9fd9..00674b19 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -25,7 +25,11 @@
#include <list>
+#ifndef RWLIBS
void **rwengine = *(void***)0x5A10E1;
+#else
+extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList);
+#endif
DebugMenuAPI gDebugMenuAPI;
@@ -352,6 +356,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)0x95CD43, nil);
+ DebugMenuAddVarBool8("Debug", "Show Ped Paths", (int8*)&gbShowPedPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Paths", (int8*)&gbShowCarPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Path Links", (int8*)&gbShowCarPathsLinks, nil);
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
diff --git a/src/objects/ParticleObject.cpp b/src/objects/ParticleObject.cpp
index 9f7bcda5..60827411 100644
--- a/src/objects/ParticleObject.cpp
+++ b/src/objects/ParticleObject.cpp
@@ -154,7 +154,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_nRemoveTimer = 0;
if ( color.alpha != 0 )
- pobj->m_Color, color;
+ pobj->m_Color = color;
else
pobj->m_Color.alpha = 0;
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index f126dca6..ed4a026b 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -119,8 +119,10 @@ public:
static int GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; }
static float GetSunSize(void) { return m_fCurrentSunSize; }
static float GetSpriteBrightness(void) { return m_fCurrentSpriteBrightness; }
+ static float GetSpriteSize(void) { return m_fCurrentSpriteSize; }
static int GetShadowStrength(void) { return m_nCurrentShadowStrength; }
static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
+ static int GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
static float GetFarClip(void) { return m_fCurrentFarClip; }
static float GetFogStart(void) { return m_fCurrentFogStart; }
diff --git a/src/core/RwClumpRead.cpp b/src/rw/ClumpRead.cpp
index c9f027e7..c9f027e7 100644
--- a/src/core/RwClumpRead.cpp
+++ b/src/rw/ClumpRead.cpp
diff --git a/src/render/Lights.cpp b/src/rw/Lights.cpp
index cd83a898..cd83a898 100644
--- a/src/render/Lights.cpp
+++ b/src/rw/Lights.cpp
diff --git a/src/render/Lights.h b/src/rw/Lights.h
index 6fdd51de..6fdd51de 100644
--- a/src/render/Lights.h
+++ b/src/rw/Lights.h
diff --git a/src/core/NodeName.cpp b/src/rw/NodeName.cpp
index 2aea3c83..2aea3c83 100644
--- a/src/core/NodeName.cpp
+++ b/src/rw/NodeName.cpp
diff --git a/src/core/NodeName.h b/src/rw/NodeName.h
index 1a3e057b..1a3e057b 100644
--- a/src/core/NodeName.h
+++ b/src/rw/NodeName.h
diff --git a/src/core/RwHelper.cpp b/src/rw/RwHelper.cpp
index 44866f4f..44866f4f 100644
--- a/src/core/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
diff --git a/src/core/RwHelper.h b/src/rw/RwHelper.h
index a9f0bdf4..a9f0bdf4 100644
--- a/src/core/RwHelper.h
+++ b/src/rw/RwHelper.h
diff --git a/src/core/RwMatFX.cpp b/src/rw/RwMatFX.cpp
index ca9a633b..ca9a633b 100644
--- a/src/core/RwMatFX.cpp
+++ b/src/rw/RwMatFX.cpp
diff --git a/src/core/RwTexRead.cpp b/src/rw/TexRead.cpp
index ef1ac197..50b99d47 100644
--- a/src/core/RwTexRead.cpp
+++ b/src/rw/TexRead.cpp
@@ -147,7 +147,11 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
}
#ifdef GTA_PC
+#ifdef RWLIBS
+extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
+#else
WRAPPER RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags) { EAXJMP(0x59A350); }
+#endif
void
ReadVideoCardCapsFile(uint32 &cap32, uint32 &cap24, uint32 &cap16, uint32 &cap8)
@@ -260,11 +264,13 @@ CreateTxdImageForVideoCard()
RwStream *img = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, "models\\txd.img");
if (img == nil) {
- if (_dwOperatingSystemVersion == OS_WINNT || _dwOperatingSystemVersion == OS_WIN2000 || _dwOperatingSystemVersion == OS_WINXP) {
+ // original code does otherwise and it leaks
+ delete []buf;
+ delete pDir;
+
+ if (_dwOperatingSystemVersion == OS_WINNT || _dwOperatingSystemVersion == OS_WIN2000 || _dwOperatingSystemVersion == OS_WINXP)
DealWithTxdWriteError(0, TXDSTORESIZE, "CVT_CRT");
- delete []buf;
- delete pDir;
- }
+
return false;
}
diff --git a/src/core/TxdStore.cpp b/src/rw/TxdStore.cpp
index c751147d..c751147d 100644
--- a/src/core/TxdStore.cpp
+++ b/src/rw/TxdStore.cpp
diff --git a/src/core/TxdStore.h b/src/rw/TxdStore.h
index 12ac708f..12ac708f 100644
--- a/src/core/TxdStore.h
+++ b/src/rw/TxdStore.h
diff --git a/src/render/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index f8b1f6b2..f8b1f6b2 100644
--- a/src/render/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
diff --git a/src/render/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h
index 65d2675a..65d2675a 100644
--- a/src/render/VisibilityPlugins.h
+++ b/src/rw/VisibilityPlugins.h
diff --git a/src/core/rw.cpp b/src/rw/rw.cpp
index 52bcf5bb..3875f2a1 100644
--- a/src/core/rw.cpp
+++ b/src/rw/rw.cpp
@@ -11,7 +11,8 @@ typedef RwV3d *(*rwVectorsMultFn) (RwV3d * pointsOut,
const RwV3d * pointsIn,
RwInt32 numPoints,
const RwMatrix * matrix);
-
+
+#ifndef RWLIBS
WRAPPER void _rwObjectHasFrameSetFrame(void* object, RwFrame* frame) { EAXJMP(0x5BC950); }
WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { EAXJMP(0x59E690); }
@@ -412,4 +413,427 @@ WRAPPER RxNodeDefinition* RxNodeDefinitionGetAtomicEnumerateLights() { EAXJMP(0x
WRAPPER RxNodeDefinition* RxNodeDefinitionGetMaterialScatter() { EAXJMP(0x5DDAA0); }
WRAPPER RxNodeDefinition* RxNodeDefinitionGetLight() { EAXJMP(0x5DF040); }
WRAPPER RxNodeDefinition* RxNodeDefinitionGetPostLight() { EAXJMP(0x5DF560); }
-WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); } \ No newline at end of file
+WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); }
+#else
+
+extern "C"
+{
+ void* _rwFrameOpen(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwFrameClose(void* instance, RwInt32 offset, RwInt32 size);
+ RwFrame* _rwFrameCloneAndLinkClones(RwFrame* root);
+ RwFrame* _rwFramePurgeClone(RwFrame* root);
+ RwBool RwFrameDirty(RwFrame const* frame);
+ void _rwFrameInit(RwFrame* frame);
+ RwBool _rwMatrixSetMultFn(rwMatrixMultFn multMat);
+ void* _rwMatrixClose(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwMatrixOpen(void* instance, RwInt32 offset, RwInt32 size);
+ RwBool _rwVectorSetMultFn(rwVectorMultFn multPoint, rwVectorsMultFn multPoints, rwVectorMultFn multVector, rwVectorsMultFn multVectors);
+ void* _rwVectorClose(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwVectorOpen(void* instance, RwInt32 offset, RwInt32 size);
+ RwBool _rwPluginRegistryOpen();
+ RwBool _rwPluginRegistryClose();
+}
+
+STARTPATCHES
+InjectHook(0x5BC950, &_rwObjectHasFrameSetFrame, PATCH_JUMP);
+InjectHook(0x59E690, &AtomicDefaultRenderCallBack, PATCH_JUMP);
+InjectHook(0x59E6C0, &_rpAtomicResyncInterpolatedSphere, PATCH_JUMP);
+InjectHook(0x59E800, &RpAtomicGetWorldBoundingSphere, PATCH_JUMP);
+InjectHook(0x59ED50, &RpClumpGetNumAtomics, PATCH_JUMP);
+InjectHook(0x59ED80, &RpClumpRender, PATCH_JUMP);
+InjectHook(0x59EDD0, &RpClumpForAllAtomics, PATCH_JUMP);
+InjectHook(0x59EE10, &RpClumpForAllCameras, PATCH_JUMP);
+InjectHook(0x59EE60, &RpClumpForAllLights, PATCH_JUMP);
+InjectHook(0x59EEB0, &RpAtomicCreate, PATCH_JUMP);
+InjectHook(0x59EFA0, &RpAtomicSetGeometry, PATCH_JUMP);
+InjectHook(0x59F020, &RpAtomicDestroy, PATCH_JUMP);
+InjectHook(0x59F0A0, &RpAtomicClone, PATCH_JUMP);
+InjectHook(0x59F1B0, &RpClumpClone, PATCH_JUMP);
+InjectHook(0x59F490, &RpClumpCreate, PATCH_JUMP);
+InjectHook(0x59F500, &RpClumpDestroy, PATCH_JUMP);
+InjectHook(0x59F680, &RpClumpAddAtomic, PATCH_JUMP);
+InjectHook(0x59F6B0, &RpClumpRemoveAtomic, PATCH_JUMP);
+InjectHook(0x59F6E0, &RpClumpRemoveLight, PATCH_JUMP);
+InjectHook(0x59FC50, &RpClumpStreamRead, PATCH_JUMP);
+InjectHook(0x5A0510, &RpAtomicRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0540, &RpClumpRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0570, &RpAtomicRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5A05A0, &RpAtomicSetStreamAlwaysCallBack, PATCH_JUMP);
+InjectHook(0x5A05C0, &RpAtomicSetStreamRightsCallBack, PATCH_JUMP);
+InjectHook(0x5A05E0, &RpAtomicGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5A0600, &RpAtomicSetFrame, PATCH_JUMP);
+InjectHook(0x5A0DC0, &RwEngineRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0DF0, &RwEngineGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5A0E10, &RwEngineGetNumSubSystems, PATCH_JUMP);
+InjectHook(0x5A0E40, &RwEngineGetSubSystemInfo, PATCH_JUMP);
+InjectHook(0x5A0E70, &RwEngineGetCurrentSubSystem, PATCH_JUMP);
+InjectHook(0x5A0EA0, &RwEngineSetSubSystem, PATCH_JUMP);
+InjectHook(0x5A0ED0, &RwEngineGetNumVideoModes, PATCH_JUMP);
+InjectHook(0x5A0F00, &RwEngineGetVideoModeInfo, PATCH_JUMP);
+InjectHook(0x5A0F30, &RwEngineGetCurrentVideoMode, PATCH_JUMP);
+InjectHook(0x5A0F60, &RwEngineSetVideoMode, PATCH_JUMP);
+InjectHook(0x5A0F90, &RwEngineStop, PATCH_JUMP);
+InjectHook(0x5A0FE0, &RwEngineStart, PATCH_JUMP);
+InjectHook(0x5A1070, &RwEngineClose, PATCH_JUMP);
+InjectHook(0x5A10E0, &RwEngineOpen, PATCH_JUMP);
+InjectHook(0x5A1290, &RwEngineTerm, PATCH_JUMP);
+InjectHook(0x5A12D0, &RwEngineInit, PATCH_JUMP);
+InjectHook(0x5A15E0, &_rwFrameOpen, PATCH_JUMP);
+InjectHook(0x5A1650, &_rwFrameClose, PATCH_JUMP);
+InjectHook(0x5A1690, &_rwFrameCloneAndLinkClones, PATCH_JUMP);
+InjectHook(0x5A1880, &_rwFramePurgeClone, PATCH_JUMP);
+InjectHook(0x5A1930, &RwFrameDirty, PATCH_JUMP);
+InjectHook(0x5A1950, &_rwFrameInit, PATCH_JUMP);
+InjectHook(0x5A1A00, &RwFrameCreate, PATCH_JUMP);
+InjectHook(0x5A1A30, &RwFrameDestroy, PATCH_JUMP);
+InjectHook(0x5A1BF0, &RwFrameDestroyHierarchy, PATCH_JUMP);
+InjectHook(0x5A1C60, &RwFrameUpdateObjects, PATCH_JUMP);
+InjectHook(0x5A1CE0, &RwFrameGetLTM, PATCH_JUMP);
+InjectHook(0x5A1D00, &RwFrameAddChild, PATCH_JUMP);
+InjectHook(0x5A1ED0, &RwFrameRemoveChild, PATCH_JUMP);
+InjectHook(0x5A1FC0, &RwFrameForAllChildren, PATCH_JUMP);
+InjectHook(0x5A2000, &RwFrameTranslate, PATCH_JUMP);
+InjectHook(0x5A20A0, &RwFrameScale, PATCH_JUMP);
+InjectHook(0x5A2140, &RwFrameTransform, PATCH_JUMP);
+InjectHook(0x5A21E0, &RwFrameRotate, PATCH_JUMP);
+InjectHook(0x5A2280, &RwFrameSetIdentity, PATCH_JUMP);
+InjectHook(0x5A2340, &RwFrameForAllObjects, PATCH_JUMP);
+InjectHook(0x5A2380, &RwFrameRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A23B0, &_rwMatrixSetMultFn, PATCH_JUMP);
+InjectHook(0x5A2520, &_rwMatrixDeterminant, PATCH_JUMP);
+InjectHook(0x5A2570, &_rwMatrixOrthogonalError, PATCH_JUMP);
+InjectHook(0x5A25D0, &_rwMatrixNormalError, PATCH_JUMP);
+InjectHook(0x5A2660, &_rwMatrixIdentityError, PATCH_JUMP);
+InjectHook(0x5A2730, &_rwMatrixClose, PATCH_JUMP);
+InjectHook(0x5A2770, &_rwMatrixOpen, PATCH_JUMP);
+InjectHook(0x5A2820, &RwMatrixOptimize, PATCH_JUMP);
+InjectHook(0x5A28E0, &RwMatrixUpdate, PATCH_JUMP);
+InjectHook(0x5A28F0, &RwMatrixMultiply, PATCH_JUMP);
+InjectHook(0x5A2960, &RwMatrixRotateOneMinusCosineSine, PATCH_JUMP);
+InjectHook(0x5A2BF0, &RwMatrixRotate, PATCH_JUMP);
+InjectHook(0x5A2C90, &RwMatrixInvert, PATCH_JUMP);
+InjectHook(0x5A2EE0, &RwMatrixScale, PATCH_JUMP);
+InjectHook(0x5A3070, &RwMatrixTranslate, PATCH_JUMP);
+InjectHook(0x5A31C0, &RwMatrixTransform, PATCH_JUMP);
+InjectHook(0x5A3300, &RwMatrixDestroy, PATCH_JUMP);
+InjectHook(0x5A3330, &RwMatrixCreate, PATCH_JUMP);
+InjectHook(0x5A3450, &_rwVectorSetMultFn, PATCH_JUMP);
+InjectHook(0x5A3600, &_rwV3dNormalize, PATCH_JUMP);
+InjectHook(0x5A36A0, &RwV3dLength, PATCH_JUMP);
+InjectHook(0x5A3710, &_rwSqrt, PATCH_JUMP);
+InjectHook(0x5A3770, &_rwInvSqrt, PATCH_JUMP);
+InjectHook(0x5A37D0, &RwV3dTransformPoints, PATCH_JUMP);
+InjectHook(0x5A37E0, &RwV3dTransformVectors, PATCH_JUMP);
+InjectHook(0x5A37F0, &_rwVectorClose, PATCH_JUMP);
+InjectHook(0x5A3860, &_rwVectorOpen, PATCH_JUMP);
+InjectHook(0x5A3AD0, &RwStreamRead, PATCH_JUMP);
+InjectHook(0x5A3C30, &RwStreamWrite, PATCH_JUMP);
+InjectHook(0x5A3DF0, &RwStreamSkip, PATCH_JUMP);
+InjectHook(0x5A3F10, &RwStreamClose, PATCH_JUMP);
+InjectHook(0x5A3FE0, &RwStreamOpen, PATCH_JUMP);
+InjectHook(0x5A43A0, &RwIm2DGetNearScreenZ, PATCH_JUMP);
+InjectHook(0x5A43B0, &RwIm2DGetFarScreenZ, PATCH_JUMP);
+InjectHook(0x5A43C0, &RwRenderStateSet, PATCH_JUMP);
+InjectHook(0x5A4410, &RwRenderStateGet, PATCH_JUMP);
+InjectHook(0x5A4420, &RwIm2DRenderLine, PATCH_JUMP);
+InjectHook(0x5A4430, &RwIm2DRenderPrimitive, PATCH_JUMP);
+InjectHook(0x5A4440, &RwIm2DRenderIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5A5020, &RwCameraEndUpdate, PATCH_JUMP);
+InjectHook(0x5A5030, &RwCameraBeginUpdate, PATCH_JUMP);
+InjectHook(0x5A5040, &RwCameraSetViewOffset, PATCH_JUMP);
+InjectHook(0x5A5070, &RwCameraSetNearClipPlane, PATCH_JUMP);
+InjectHook(0x5A5140, &RwCameraSetFarClipPlane, PATCH_JUMP);
+InjectHook(0x5A5170, &RwCameraFrustumTestSphere, PATCH_JUMP);
+InjectHook(0x5A51E0, &RwCameraClear, PATCH_JUMP);
+InjectHook(0x5A5210, &RwCameraShowRaster, PATCH_JUMP);
+InjectHook(0x5A5240, &RwCameraSetProjection, PATCH_JUMP);
+InjectHook(0x5A52B0, &RwCameraSetViewWindow, PATCH_JUMP);
+InjectHook(0x5A52F0, &RwCameraRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A5320, &RwCameraDestroy, PATCH_JUMP);
+InjectHook(0x5A5360, &RwCameraCreate, PATCH_JUMP);
+InjectHook(0x5A7100, &RwTextureSetMipmapping, PATCH_JUMP);
+InjectHook(0x5A7120, &RwTextureGetMipmapping, PATCH_JUMP);
+InjectHook(0x5A7130, &RwTextureSetAutoMipmapping, PATCH_JUMP);
+InjectHook(0x5A7150, &RwTextureGetAutoMipmapping, PATCH_JUMP);
+InjectHook(0x5A7160, &RwTexDictionaryCreate, PATCH_JUMP);
+InjectHook(0x5A7200, &RwTexDictionaryDestroy, PATCH_JUMP);
+InjectHook(0x5A7290, &RwTexDictionaryForAllTextures, PATCH_JUMP);
+InjectHook(0x5A72D0, &RwTextureCreate, PATCH_JUMP);
+InjectHook(0x5A7330, &RwTextureDestroy, PATCH_JUMP);
+InjectHook(0x5A73B0, &RwTextureSetName, PATCH_JUMP);
+InjectHook(0x5A7420, &RwTextureSetMaskName, PATCH_JUMP);
+InjectHook(0x5A7490, &RwTexDictionaryAddTexture, PATCH_JUMP);
+InjectHook(0x5A74D0, &RwTexDictionaryFindNamedTexture, PATCH_JUMP);
+InjectHook(0x5A7550, &RwTexDictionarySetCurrent, PATCH_JUMP);
+InjectHook(0x5A7570, &RwTexDictionaryGetCurrent, PATCH_JUMP);
+InjectHook(0x5A7580, &RwTextureRead, PATCH_JUMP);
+InjectHook(0x5A7780, &RwTextureRasterGenerateMipmaps, PATCH_JUMP);
+InjectHook(0x5A9120, &RwImageCreate, PATCH_JUMP);
+InjectHook(0x5A9180, &RwImageDestroy, PATCH_JUMP);
+InjectHook(0x5A91E0, &RwImageAllocatePixels, PATCH_JUMP);
+InjectHook(0x5A92A0, &RwImageFreePixels, PATCH_JUMP);
+InjectHook(0x5A92D0, &RwImageMakeMask, PATCH_JUMP);
+InjectHook(0x5A93A0, &RwImageApplyMask, PATCH_JUMP);
+InjectHook(0x5A9750, &RwImageSetPath, PATCH_JUMP);
+InjectHook(0x5A9810, &RwImageRead, PATCH_JUMP);
+InjectHook(0x5A9B40, &RwImageFindFileType, PATCH_JUMP);
+InjectHook(0x5A9C10, &RwImageReadMaskedImage, PATCH_JUMP);
+InjectHook(0x5A9F50, &RwImageCopy, PATCH_JUMP);
+InjectHook(0x5AA130, &RwImageGammaCorrect, PATCH_JUMP);
+InjectHook(0x5AA2C0, &RwImageSetGamma, PATCH_JUMP);
+InjectHook(0x5AA4E0, &_rwStreamWriteVersionedChunkHeader, PATCH_JUMP);
+InjectHook(0x5AA540, &RwStreamFindChunk, PATCH_JUMP);
+InjectHook(0x5AA640, &RwMemLittleEndian32, PATCH_JUMP);
+InjectHook(0x5AA650, &RwMemNative32, PATCH_JUMP);
+InjectHook(0x5AA660, &RwMemFloat32ToReal, PATCH_JUMP);
+InjectHook(0x5AA680, &RwStreamWriteReal, PATCH_JUMP);
+InjectHook(0x5AA720, &RwStreamWriteInt32, PATCH_JUMP);
+InjectHook(0x5AA740, &RwStreamReadReal, PATCH_JUMP);
+InjectHook(0x5AA7B0, &RwStreamReadInt32, PATCH_JUMP);
+InjectHook(0x5AA800, &RwTextureStreamGetSize, PATCH_JUMP);
+InjectHook(0x5AA870, &RwTextureStreamWrite, PATCH_JUMP);
+InjectHook(0x5AAA40, &RwTextureStreamRead, PATCH_JUMP);
+InjectHook(0x5AB020, &RwTexDictionaryStreamWrite, PATCH_JUMP);
+InjectHook(0x5AC890, &RpMorphTargetCalcBoundingSphere, PATCH_JUMP);
+InjectHook(0x5AC9A0, &RpGeometryAddMorphTargets, PATCH_JUMP);
+InjectHook(0x5ACB60, &RpGeometryTriangleSetVertexIndices, PATCH_JUMP);
+InjectHook(0x5ACB90, &RpGeometryTriangleSetMaterial, PATCH_JUMP);
+InjectHook(0x5ACBF0, &RpGeometryForAllMaterials, PATCH_JUMP);
+InjectHook(0x5ACC30, &RpGeometryLock, PATCH_JUMP);
+InjectHook(0x5ACC60, &RpGeometryUnlock, PATCH_JUMP);
+InjectHook(0x5ACD10, &RpGeometryCreate, PATCH_JUMP);
+InjectHook(0x5ACF40, &_rpGeometryAddRef, PATCH_JUMP);
+InjectHook(0x5ACF50, &RpGeometryDestroy, PATCH_JUMP);
+InjectHook(0x5ACFF0, &RpGeometryRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AD020, &RpGeometryRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5AD050, &RpGeometryStreamRead, PATCH_JUMP);
+InjectHook(0x5AD6D0, &RwRasterGetCurrentContext, PATCH_JUMP);
+InjectHook(0x5AD6F0, &RwRasterUnlock, PATCH_JUMP);
+InjectHook(0x5AD710, &RwRasterRenderFast, PATCH_JUMP);
+InjectHook(0x5AD750, &RwRasterUnlockPalette, PATCH_JUMP);
+InjectHook(0x5AD780, &RwRasterDestroy, PATCH_JUMP);
+InjectHook(0x5AD7C0, &RwRasterPushContext, PATCH_JUMP);
+InjectHook(0x5AD810, &RwRasterRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AD840, &RwRasterLockPalette, PATCH_JUMP);
+InjectHook(0x5AD870, &RwRasterPopContext, PATCH_JUMP);
+InjectHook(0x5AD8C0, &RwRasterGetNumLevels, PATCH_JUMP);
+InjectHook(0x5AD900, &RwRasterShowRaster, PATCH_JUMP);
+InjectHook(0x5AD930, &RwRasterCreate, PATCH_JUMP);
+InjectHook(0x5AD9D0, &RwRasterLock, PATCH_JUMP);
+InjectHook(0x5ADC30, &RpMaterialCreate, PATCH_JUMP);
+InjectHook(0x5ADCB0, &RpMaterialDestroy, PATCH_JUMP);
+InjectHook(0x5ADD10, &RpMaterialSetTexture, PATCH_JUMP);
+InjectHook(0x5ADD40, &RpMaterialRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5ADD70, &RpMaterialRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5ADDA0, &RpMaterialStreamRead, PATCH_JUMP);
+InjectHook(0x5AE0B0, &_rpSectorDefaultRenderCallBack, PATCH_JUMP);
+InjectHook(0x5AE100, &_rpWorldForAllGlobalLights, PATCH_JUMP);
+InjectHook(0x5AE150, &_rpWorldSectorForAllLocalLights, PATCH_JUMP);
+InjectHook(0x5AE190, &RpWorldUnlock, PATCH_JUMP);
+InjectHook(0x5AE2B0, &RpWorldSectorGetWorld, PATCH_JUMP);
+InjectHook(0x5AE340, &RpWorldDestroy, PATCH_JUMP);
+InjectHook(0x5AE6A0, &RpWorldCreate, PATCH_JUMP);
+InjectHook(0x5AEA40, &RpWorldRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AEA70, &RpWorldRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5AEAA0, &RpWorldPluginAttach, PATCH_JUMP);
+InjectHook(0x5AFB80, &RpWorldAddCamera, PATCH_JUMP);
+InjectHook(0x5AFBB0, &RpWorldRemoveCamera, PATCH_JUMP);
+InjectHook(0x5AFC10, &RpAtomicGetWorld, PATCH_JUMP);
+InjectHook(0x5AFC20, &RpWorldAddClump, PATCH_JUMP);
+InjectHook(0x5AFDA0, &RpWorldAddLight, PATCH_JUMP);
+InjectHook(0x5AFDF0, &RpWorldRemoveLight, PATCH_JUMP);
+InjectHook(0x5AFE70, &RtBMPImageRead, PATCH_JUMP);
+InjectHook(0x5B07D0, &RpSkinPluginAttach, PATCH_JUMP);
+InjectHook(0x5B1050, &RpSkinAtomicSetHAnimHierarchy, PATCH_JUMP);
+InjectHook(0x5B1070, &RpSkinAtomicGetHAnimHierarchy, PATCH_JUMP);
+InjectHook(0x5B1080, &RpSkinGeometryGetSkin, PATCH_JUMP);
+InjectHook(0x5B1090, &RpSkinGeometrySetSkin, PATCH_JUMP);
+InjectHook(0x5B10D0, &RpSkinGetSkinToBoneMatrices, PATCH_JUMP);
+InjectHook(0x5B10E0, &RpHAnimHierarchyCreate, PATCH_JUMP);
+InjectHook(0x5B11F0, &RpHAnimFrameGetHierarchy, PATCH_JUMP);
+InjectHook(0x5B1200, &RpHAnimHierarchySetCurrentAnim, PATCH_JUMP);
+InjectHook(0x5B12B0, &RpHAnimHierarchySubAnimTime, PATCH_JUMP);
+InjectHook(0x5B1480, &RpHAnimHierarchyAddAnimTime, PATCH_JUMP);
+InjectHook(0x5B1780, &RpHAnimHierarchyUpdateMatrices, PATCH_JUMP);
+InjectHook(0x5B1C10, &RpHAnimAnimationStreamRead, PATCH_JUMP);
+InjectHook(0x5B1D50, &RpHAnimPluginAttach, PATCH_JUMP);
+InjectHook(0x5B2640, &RpMatFXPluginAttach, PATCH_JUMP);
+InjectHook(0x5B3750, &RpMatFXAtomicEnableEffects, PATCH_JUMP);
+InjectHook(0x5B3780, &RpMatFXMaterialSetEffects, PATCH_JUMP);
+InjectHook(0x5B38D0, &RpMatFXMaterialSetupEnvMap, PATCH_JUMP);
+InjectHook(0x5B3A40, &RpMatFXMaterialSetBumpMapTexture, PATCH_JUMP);
+InjectHook(0x5B3CF0, &RwD3D8SetRenderState, PATCH_JUMP);
+InjectHook(0x5B3D40, &RwD3D8GetRenderState, PATCH_JUMP);
+InjectHook(0x5B3D60, &RwD3D8SetTextureStageState, PATCH_JUMP);
+InjectHook(0x5B53A0, &RwD3D8SetTexture, PATCH_JUMP);
+InjectHook(0x5B6720, &RwIm3DTransform, PATCH_JUMP);
+InjectHook(0x5B67F0, &RwIm3DEnd, PATCH_JUMP);
+InjectHook(0x5B6820, &RwIm3DRenderIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5B6980, &RwIm3DRenderLine, PATCH_JUMP);
+InjectHook(0x5B6A50, &RwIm3DSetTransformPipeline, PATCH_JUMP);
+InjectHook(0x5B6AC0, &RwIm3DSetRenderPipeline, PATCH_JUMP);
+InjectHook(0x5B95D0, &RwD3D8EngineSetRefreshRate, PATCH_JUMP);
+InjectHook(0x5B9640, &RwD3D8CameraAttachWindow, PATCH_JUMP);
+InjectHook(0x5BAEB0, &RwD3D8DeviceSupportsDXTTexture, PATCH_JUMP);
+InjectHook(0x5BAF90, &RwD3D8SetVertexShader, PATCH_JUMP);
+InjectHook(0x5BAFD0, &RwD3D8SetPixelShader, PATCH_JUMP);
+InjectHook(0x5BB010, &RwD3D8SetStreamSource, PATCH_JUMP);
+InjectHook(0x5BB060, &RwD3D8SetIndices, PATCH_JUMP);
+InjectHook(0x5BB0B0, &RwD3D8DrawIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5BB140, &RwD3D8DrawPrimitive, PATCH_JUMP);
+InjectHook(0x5BB1D0, &RwD3D8SetTransform, PATCH_JUMP);
+InjectHook(0x5BB310, &RwD3D8GetTransform, PATCH_JUMP);
+InjectHook(0x5BB340, &RwD3D8SetTransformWorld, PATCH_JUMP);
+InjectHook(0x5BB490, &RwD3D8SetSurfaceProperties, PATCH_JUMP);
+InjectHook(0x5BB7A0, &RwD3D8SetLight, PATCH_JUMP);
+InjectHook(0x5BB890, &RwD3D8EnableLight, PATCH_JUMP);
+InjectHook(0x5BB9F0, &RwD3D8DynamicVertexBufferCreate, PATCH_JUMP);
+InjectHook(0x5BBAE0, &RwD3D8DynamicVertexBufferDestroy, PATCH_JUMP);
+InjectHook(0x5BBB10, &RwD3D8IndexBufferCreate, PATCH_JUMP);
+InjectHook(0x5BBB40, &RwD3D8CreatePixelShader, PATCH_JUMP);
+InjectHook(0x5BBB90, &RwD3D8DeletePixelShader, PATCH_JUMP);
+InjectHook(0x5BBC00, &RwD3D8SetPixelShaderConstant, PATCH_JUMP);
+InjectHook(0x5BBC30, &RwD3D8GetCaps, PATCH_JUMP);
+InjectHook(0x5BBC40, &RwD3D8CameraIsSphereFullyInsideFrustum, PATCH_JUMP);
+InjectHook(0x5BBCA0, &RwD3D8CameraIsBBoxFullyInsideFrustum, PATCH_JUMP);
+InjectHook(0x5BBD30, &RwD3D8DynamicVertexBufferLock, PATCH_JUMP);
+InjectHook(0x5BBEB0, &RwD3D8DynamicVertexBufferUnlock, PATCH_JUMP);
+InjectHook(0x5BBED0, &_rwIntelSSEsupported, PATCH_JUMP);
+InjectHook(0x5BBF10, &RwImageSetFromRaster, PATCH_JUMP);
+InjectHook(0x5BBF50, &RwRasterSetFromImage, PATCH_JUMP);
+InjectHook(0x5BBF80, &RwImageFindRasterFormat, PATCH_JUMP);
+InjectHook(0x5BBFF0, &RwFrameRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5BC020, &_rwFrameListDeinitialize, PATCH_JUMP);
+InjectHook(0x5BC050, &_rwFrameListStreamRead, PATCH_JUMP);
+InjectHook(0x5BC300, &RpLightSetRadius, PATCH_JUMP);
+InjectHook(0x5BC320, &RpLightSetColor, PATCH_JUMP);
+InjectHook(0x5BC370, &RpLightGetConeAngle, PATCH_JUMP);
+InjectHook(0x5BC5B0, &RpLightRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5BC5E0, &RpLightStreamRead, PATCH_JUMP);
+InjectHook(0x5BC780, &RpLightDestroy, PATCH_JUMP);
+InjectHook(0x5BC7C0, &RpLightCreate, PATCH_JUMP);
+InjectHook(0x5BE280, &_rwD3D8TexDictionaryEnableRasterFormatConversion, PATCH_JUMP);
+InjectHook(0x5BF110, &RwOsGetFileInterface, PATCH_JUMP);
+InjectHook(0x5C1720, &RwFreeListDestroy, PATCH_JUMP);
+InjectHook(0x5C1790, &RwFreeListCreate, PATCH_JUMP);
+InjectHook(0x5C19F0, &RwFreeListPurge, PATCH_JUMP);
+InjectHook(0x5C1B90, &RwFreeListPurgeAllFreeLists, PATCH_JUMP);
+InjectHook(0x5C1D40, &RwFreeListForAllUsed, PATCH_JUMP);
+InjectHook(0x5C2780, &_rxPipelineClose, PATCH_JUMP);
+InjectHook(0x5C27E0, &_rxPipelineOpen, PATCH_JUMP);
+InjectHook(0x5C2AD0, &RxHeapGetGlobalHeap, PATCH_JUMP);
+InjectHook(0x5C2AE0, &RxPacketCreate, PATCH_JUMP);
+InjectHook(0x5C2B10, &RxClusterSetExternalData, PATCH_JUMP);
+InjectHook(0x5C2B70, &RxClusterSetData, PATCH_JUMP);
+InjectHook(0x5C2BD0, &RxClusterInitializeData, PATCH_JUMP);
+InjectHook(0x5C2C40, &RxClusterResizeData, PATCH_JUMP);
+InjectHook(0x5C2C90, &RxClusterLockWrite, PATCH_JUMP);
+InjectHook(0x5C2D60, &RxPipelineExecute, PATCH_JUMP);
+InjectHook(0x5C2E00, &RxPipelineCreate, PATCH_JUMP);
+InjectHook(0x5C2E70, &_rxPipelineDestroy, PATCH_JUMP);
+InjectHook(0x5C3080, &RwResourcesFreeResEntry, PATCH_JUMP);
+InjectHook(0x5C30F0, &_rwResourcesPurge, PATCH_JUMP);
+InjectHook(0x5C3170, &RwResourcesAllocateResEntry, PATCH_JUMP);
+InjectHook(0x5C3360, &RwResourcesEmptyArena, PATCH_JUMP);
+InjectHook(0x5C3450, &_rwPluginRegistryOpen, PATCH_JUMP);
+InjectHook(0x5C3480, &_rwPluginRegistryClose, PATCH_JUMP);
+InjectHook(0x5C3590, &_rwPluginRegistryGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5C35C0, &_rwPluginRegistryAddPlugin, PATCH_JUMP);
+InjectHook(0x5C37F0, &_rwPluginRegistryInitObject, PATCH_JUMP);
+InjectHook(0x5C3850, &_rwPluginRegistryDeInitObject, PATCH_JUMP);
+InjectHook(0x5C3880, &_rwPluginRegistryCopyObject, PATCH_JUMP);
+InjectHook(0x5C3910, &RwErrorSet, PATCH_JUMP);
+InjectHook(0x5C3970, &_rwerror, PATCH_JUMP);
+InjectHook(0x5C3980, &_rwPluginRegistryAddPluginStream, PATCH_JUMP);
+InjectHook(0x5C39C0, &_rwPluginRegistryAddPlgnStrmlwysCB, PATCH_JUMP);
+InjectHook(0x5C39F0, &_rwPluginRegistryAddPlgnStrmRightsCB, PATCH_JUMP);
+InjectHook(0x5C3A20, & _rwPluginRegistryReadDataChunks, PATCH_JUMP);
+InjectHook(0x5C3B50, & _rwPluginRegistryInvokeRights, PATCH_JUMP);
+InjectHook(0x5C3BA0, &_rwPluginRegistryGetSize, PATCH_JUMP);
+InjectHook(0x5C3BE0, &_rwPluginRegistryWriteDataChunks, PATCH_JUMP);
+InjectHook(0x5C3CB0, &_rwPluginRegistrySkipDataChunks, PATCH_JUMP);
+InjectHook(0x5C3D30, &RwCameraStreamRead, PATCH_JUMP);
+InjectHook(0x5C5570, &RwBBoxCalculate, PATCH_JUMP);
+InjectHook(0x5C72B0, &RwImageResample, PATCH_JUMP);
+InjectHook(0x5C7B30, &RwImageCreateResample, PATCH_JUMP);
+InjectHook(0x5D9240, &RxRenderStateVectorSetDefaultRenderStateVector, PATCH_JUMP);
+InjectHook(0x5D9340, &RxRenderStateVectorCreate, PATCH_JUMP);
+InjectHook(0x5D9410, &RxRenderStateVectorDestroy, PATCH_JUMP);
+InjectHook(0x5D9460, &RxRenderStateVectorLoadDriverState, PATCH_JUMP);
+InjectHook(0x5D95D0, &_rxEmbeddedPacketBetweenPipelines, PATCH_JUMP);
+InjectHook(0x5D9740, &_rxEmbeddedPacketBetweenNodes, PATCH_JUMP);
+InjectHook(0x5D9810, &_rxPacketDestroy, PATCH_JUMP);
+InjectHook(0x5C8B10, &_rpMaterialListDeinitialize, PATCH_JUMP);
+InjectHook(0x5C8B70, &_rpMaterialListInitialize, PATCH_JUMP);
+InjectHook(0x5C8B80, &_rpMaterialListGetMaterial, PATCH_JUMP);
+InjectHook(0x5C8B90, &_rpMaterialListAppendMaterial, PATCH_JUMP);
+InjectHook(0x5C8C50, &_rpMaterialListFindMaterialIndex, PATCH_JUMP);
+InjectHook(0x5C8C80, &_rpMaterialListStreamRead, PATCH_JUMP);
+InjectHook(0x5C8FE0, &_rpMeshHeaderCreate, PATCH_JUMP);
+InjectHook(0x5C8FF0, &_rpMeshClose, PATCH_JUMP);
+InjectHook(0x5C9020, &_rpMeshOpen, PATCH_JUMP);
+InjectHook(0x5C9140, &_rpBuildMeshCreate, PATCH_JUMP);
+InjectHook(0x5C9220, &_rpBuildMeshDestroy, PATCH_JUMP);
+InjectHook(0x5C9260, &_rpMeshDestroy, PATCH_JUMP);
+InjectHook(0x5C92A0, &_rpBuildMeshAddTriangle, PATCH_JUMP);
+InjectHook(0x5C9380, &_rpMeshHeaderForAllMeshes, PATCH_JUMP);
+InjectHook(0x5C93C0, &_rpMeshWrite, PATCH_JUMP);
+InjectHook(0x5C9510, &_rpMeshRead, PATCH_JUMP);
+InjectHook(0x5C96E0, &_rpMeshSize, PATCH_JUMP);
+InjectHook(0x5C9730, &RpBuildMeshGenerateDefaultTriStrip, PATCH_JUMP);
+InjectHook(0x5CAE10, &_rpTriListMeshGenerate, PATCH_JUMP);
+InjectHook(0x5CB230, &_rpMeshOptimise, PATCH_JUMP);
+InjectHook(0x5CB2B0, &RpWorldSectorRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5CB2E0, &RpWorldSectorRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5CB630, &RpWorldSetDefaultSectorPipeline, PATCH_JUMP);
+InjectHook(0x5CB670, &RpAtomicSetDefaultPipeline, PATCH_JUMP);
+InjectHook(0x5CDEE0, &RpHAnimStdKeyFrameToMatrix, PATCH_JUMP);
+InjectHook(0x5CE000, &RpHAnimStdKeyFrameInterpolate, PATCH_JUMP);
+InjectHook(0x5CE420, &RpHAnimStdKeyFrameBlend, PATCH_JUMP);
+InjectHook(0x5CE820, &RpHAnimStdKeyFrameStreamRead, PATCH_JUMP);
+InjectHook(0x5CE8C0, &RpHAnimStdKeyFrameStreamWrite, PATCH_JUMP);
+InjectHook(0x5CE930, &RpHAnimStdKeyFrameStreamGetSize, PATCH_JUMP);
+InjectHook(0x5CE950, &RpHAnimStdKeyFrameMulRecip, PATCH_JUMP);
+InjectHook(0x5CEAB0, &RpHAnimStdKeyFrameAdd, PATCH_JUMP);
+InjectHook(0x5D1070, &RxHeapFree, PATCH_JUMP);
+InjectHook(0x5D1260, &RxHeapAlloc, PATCH_JUMP);
+InjectHook(0x5D14D0, &RxHeapRealloc, PATCH_JUMP);
+InjectHook(0x5D1680, &_rxHeapReset, PATCH_JUMP);
+InjectHook(0x5D16F0, &RxHeapDestroy, PATCH_JUMP);
+InjectHook(0x5D1750, &RxHeapCreate, PATCH_JUMP);
+InjectHook(0x5D1EC0, &RxPipelineNodeFindOutputByName, PATCH_JUMP);
+InjectHook(0x5D1F20, &RxPipelineNodeFindInput, PATCH_JUMP);
+InjectHook(0x5D1F30, &RxPipelineNodeRequestCluster, PATCH_JUMP);
+InjectHook(0x5D1FA0, &RxLockedPipeUnlock, PATCH_JUMP);
+InjectHook(0x5D29F0, &RxPipelineLock, PATCH_JUMP);
+InjectHook(0x5D2B10, &RxPipelineFindNodeByName, PATCH_JUMP);
+InjectHook(0x5D2BA0, &RxLockedPipeAddFragment, PATCH_JUMP);
+InjectHook(0x5D2EE0, &RxLockedPipeAddPath, PATCH_JUMP);
+InjectHook(0x5D31C0, &RxNodeDefinitionGetImmRenderSetup, PATCH_JUMP);
+InjectHook(0x5D35C0, &RxNodeDefinitionGetImmMangleTriangleIndices, PATCH_JUMP);
+InjectHook(0x5D3C60, &RxNodeDefinitionGetCullTriangle, PATCH_JUMP);
+InjectHook(0x5D4F80, &RxNodeDefinitionGetClipTriangle, PATCH_JUMP);
+InjectHook(0x5D51C0, &RxNodeDefinitionGetSubmitTriangle, PATCH_JUMP);
+InjectHook(0x5D5400, &RxNodeDefinitionGetImmInstance, PATCH_JUMP);
+InjectHook(0x5D6000, &RxNodeDefinitionGetTransform, PATCH_JUMP);
+InjectHook(0x5D61C0, &RxNodeDefinitionGetImmStash, PATCH_JUMP);
+InjectHook(0x5D6470, &RxNodeDefinitionGetImmMangleLineIndices, PATCH_JUMP);
+InjectHook(0x5D7230, &RxNodeDefinitionGetClipLine, PATCH_JUMP);
+InjectHook(0x5D74C0, &RxNodeDefinitionGetSubmitLine, PATCH_JUMP);
+InjectHook(0x5D9C90, &_rwD3D8LightsOpen, PATCH_JUMP);
+InjectHook(0x5D9EF0, &_rwD3D8LightsClose, PATCH_JUMP);
+InjectHook(0x5D9F80, &_rwD3D8LightsGlobalEnable, PATCH_JUMP);
+InjectHook(0x5DA210, &_rwD3D8LightLocalEnable, PATCH_JUMP);
+InjectHook(0x5DA450, &_rwD3D8LightsEnable, PATCH_JUMP);
+InjectHook(0x5DAAC0, &RxNodeDefinitionGetD3D8WorldSectorAllInOne, PATCH_JUMP);
+InjectHook(0x5DC500, &RxNodeDefinitionGetD3D8AtomicAllInOne, PATCH_JUMP);
+InjectHook(0x5DCC50, &RxNodeDefinitionGetWorldSectorInstance, PATCH_JUMP);
+InjectHook(0x5DCD80, &RxNodeDefinitionGetWorldSectorEnumerateLights, PATCH_JUMP);
+InjectHook(0x5DD800, &RxNodeDefinitionGetAtomicInstance, PATCH_JUMP);
+InjectHook(0x5DD9B0, &RxNodeDefinitionGetAtomicEnumerateLights, PATCH_JUMP);
+InjectHook(0x5DDAA0, &RxNodeDefinitionGetMaterialScatter, PATCH_JUMP);
+InjectHook(0x5DF040, &RxNodeDefinitionGetLight, PATCH_JUMP);
+InjectHook(0x5DF560, &RxNodeDefinitionGetPostLight, PATCH_JUMP);
+InjectHook(0x5DFC60, &RxD3D8AllInOneSetRenderCallBack, PATCH_JUMP);
+ENDPATCHES
+#endif \ No newline at end of file