summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2019-08-02 22:23:05 +0200
committerFire-Head <Fire-Head@users.noreply.github.com>2019-08-02 22:23:05 +0200
commit73e2a4b035e19ace0ad5c55c58a15ee1d8265fee (patch)
treeeafd98b48c650c84139804ca89259ae61e00e3ea /src/core
parentfix (diff)
parentrestore original shadows fading (diff)
downloadre3-73e2a4b035e19ace0ad5c55c58a15ee1d8265fee.tar
re3-73e2a4b035e19ace0ad5c55c58a15ee1d8265fee.tar.gz
re3-73e2a4b035e19ace0ad5c55c58a15ee1d8265fee.tar.bz2
re3-73e2a4b035e19ace0ad5c55c58a15ee1d8265fee.tar.lz
re3-73e2a4b035e19ace0ad5c55c58a15ee1d8265fee.tar.xz
re3-73e2a4b035e19ace0ad5c55c58a15ee1d8265fee.tar.zst
re3-73e2a4b035e19ace0ad5c55c58a15ee1d8265fee.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Camera.cpp11
-rw-r--r--src/core/Camera.h2
-rw-r--r--src/core/Collision.cpp6
-rw-r--r--src/core/ControllerConfig.h2
-rw-r--r--src/core/Explosion.h12
-rw-r--r--src/core/Fire.cpp1
-rw-r--r--src/core/Fire.h3
-rw-r--r--src/core/PlayerInfo.cpp9
-rw-r--r--src/core/PlayerInfo.h11
-rw-r--r--src/core/User.cpp2
-rw-r--r--src/core/User.h2
-rw-r--r--src/core/Wanted.cpp13
-rw-r--r--src/core/World.cpp1
-rw-r--r--src/core/World.h1
-rw-r--r--src/core/config.h6
-rw-r--r--src/core/re3.cpp18
16 files changed, 80 insertions, 20 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index a66d6ac9..b5ba76db 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -1304,6 +1304,17 @@ CCam::GetWeaponFirstPersonOn()
return false;
}
+float
+CCamera::Find3rdPersonQuickAimPitch(void)
+{
+ float clampedFrontZ = clamp(Cams[ActiveCam].Front.z, -1.0f, 1.0f);
+
+ // float rot = atan2(clampedFrontZ, sqrt(1.0f - sq(clampedFrontZ)));
+ float rot = Asin(clampedFrontZ);
+
+ return -(DEGTORAD(((0.5f - m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV)) + rot);
+}
+
STARTPATCHES
InjectHook(0x42C760, (bool (CCamera::*)(const CVector &center, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP);
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 1a2aae79..3ce0d9a6 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -469,6 +469,8 @@ int m_iModeObbeCamIsInForCar;
void Restore(void);
void SetWidescreenOff(void);
+ float Find3rdPersonQuickAimPitch(void);
+
void dtor(void) { this->CCamera::~CCamera(); }
};
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index 7982e77d..cc360f79 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -2023,11 +2023,11 @@ CColModel::operator=(const CColModel &other)
numVerts = 0;
for(i = 0; i < other.numTriangles; i++){
if(other.triangles[i].a > numVerts)
- other.triangles[i].a = numVerts;
+ numVerts = other.triangles[i].a;
if(other.triangles[i].b > numVerts)
- other.triangles[i].b = numVerts;
+ numVerts = other.triangles[i].b;
if(other.triangles[i].c > numVerts)
- other.triangles[i].c = numVerts;
+ numVerts = other.triangles[i].c;
}
numVerts++;
if(vertices)
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index 8a434245..b064a381 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -22,7 +22,7 @@ public:
int32 m_ContSetOrder;
};
- bool field_0;
+ bool firstCapture;
char _pad0[3];
DIJOYSTATE2 m_OldState;
DIJOYSTATE2 m_NewState;
diff --git a/src/core/Explosion.h b/src/core/Explosion.h
index 69508490..93d60ab3 100644
--- a/src/core/Explosion.h
+++ b/src/core/Explosion.h
@@ -4,8 +4,16 @@ class CEntity;
enum eExplosionType
{
- EXPLOSION_3 = 3,
- EXPLOSION_4
+ EXPLOSION_GRENADE,
+ EXPLOSION_MOLOTOV,
+ EXPLOSION_ROCKET,
+ EXPLOSION_CAR,
+ EXPLOSION_CAR_QUICK,
+ EXPLOSION_HELI,
+ EXPLOSION_MINE,
+ EXPLOSION_BARREL,
+ EXPLOSION_TANK_GRENADE,
+ EXPLOSION_HELI_BOMB
};
class CExplosion
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index bc59de2f..a2894d43 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -7,3 +7,4 @@ CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); }
+WRAPPER CFire *CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); }
diff --git a/src/core/Fire.h b/src/core/Fire.h
index 9c9e1dec..040e9a25 100644
--- a/src/core/Fire.h
+++ b/src/core/Fire.h
@@ -4,6 +4,7 @@ class CEntity;
class CFire
{
+public:
bool m_bIsOngoing;
bool m_bExists;
bool m_bPropogationFlag;
@@ -18,7 +19,6 @@ class CFire
int field_28;
float field_2C;
-public:
void Extinguish(void);
};
@@ -26,5 +26,6 @@ class CFireManager
{
public:
void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32);
+ CFire *FindFurthestFire_NeverMindFireMen(CVector coors, float, float);
};
extern CFireManager &gFireManager;
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 81c7a199..d9a4c0b0 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -1,7 +1,9 @@
#include "common.h"
#include "patcher.h"
+#include "PlayerPed.h"
#include "PlayerInfo.h"
#include "Frontend.h"
+#include "Vehicle.h"
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
WRAPPER void CPlayerInfo::LoadPlayerSkin() { EAXJMP(0x4A1700); }
@@ -12,3 +14,10 @@ void CPlayerInfo::SetPlayerSkin(char *skin)
strncpy(m_aSkinName, skin, 32);
LoadPlayerSkin();
}
+
+CVector& CPlayerInfo::GetPos()
+{
+ if (m_pPed->bInVehicle && m_pPed->m_pMyVehicle)
+ return m_pPed->m_pMyVehicle->GetPosition();
+ return m_pPed->GetPosition();
+}
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index d8128424..decfb24c 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -20,7 +20,7 @@ public:
CPlayerPed *m_pPed;
CVehicle *m_pRemoteVehicle;
CColModel m_ColModel;
- CVehicle *m_pVehicleEx;
+ CVehicle *m_pVehicleEx; // vehicle using the col model above
char m_aPlayerName[70];
int32 m_nMoney;
int32 m_nVisibleMoney;
@@ -45,10 +45,10 @@ public:
int8 field_225;
int8 field_226;
int8 field_227;
- int32 m_nTimeLostRemoteCar;
- int32 m_nTimeLastHealthLoss;
- int32 m_nTimeLastArmourLoss;
- int32 field_240;
+ uint32 m_nTimeLostRemoteCar;
+ uint32 m_nTimeLastHealthLoss;
+ uint32 m_nTimeLastArmourLoss;
+ uint32 m_nTimeTankShotGun;
int32 m_nUpsideDownCounter;
int32 field_248;
int16 m_nTrafficMultiplier;
@@ -70,6 +70,7 @@ public:
void LoadPlayerSkin();
void AwardMoneyForExplosion(CVehicle *vehicle);
void SetPlayerSkin(char* skin);
+ CVector& GetPos();
};
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
diff --git a/src/core/User.cpp b/src/core/User.cpp
index c9cb97cc..f40a06db 100644
--- a/src/core/User.cpp
+++ b/src/core/User.cpp
@@ -13,6 +13,8 @@ COnscreenTimer& CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238;
CPager& CUserDisplay::Pager = *(CPager*)0x8F2744;
CCurrentVehicle& CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8;
+WRAPPER void CPager::AddMessage(wchar*, uint16, uint16, uint16) { EAXJMP(0x52B940); }
+
void COnscreenTimer::Init() {
m_bDisabled = false;
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
diff --git a/src/core/User.h b/src/core/User.h
index 8b744c7e..cac2a318 100644
--- a/src/core/User.h
+++ b/src/core/User.h
@@ -52,6 +52,8 @@ class CCurrentVehicle
class CPager
{
+public:
+ void AddMessage(wchar*, uint16, uint16, uint16);
};
class CUserDisplay
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index 7b865311..26b115e3 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -40,19 +40,19 @@ CWanted::Initialise()
bool
CWanted::AreSwatRequired()
{
- return m_nWantedLevel >= 4;
+ return m_nWantedLevel == 4 || m_bSwatRequired;
}
bool
CWanted::AreFbiRequired()
{
- return m_nWantedLevel >= 5;
+ return m_nWantedLevel == 5 || m_bFbiRequired;
}
bool
CWanted::AreArmyRequired()
{
- return m_nWantedLevel >= 6;
+ return m_nWantedLevel == 6 || m_bArmyRequired;
}
int32
@@ -77,6 +77,8 @@ void
CWanted::SetWantedLevel(int32 level)
{
ClearQdCrimes();
+ if (level > MaximumWantedLevel)
+ level = MaximumWantedLevel;
switch (level) {
case 0:
m_nChaos = 0;
@@ -100,8 +102,6 @@ CWanted::SetWantedLevel(int32 level)
m_nChaos = 3220;
break;
default:
- if (level > MaximumWantedLevel)
- m_nChaos = MaximumWantedLevel;
break;
}
UpdateWantedLevel();
@@ -275,6 +275,9 @@ CWanted::UpdateWantedLevel()
{
int32 CurrWantedLevel = m_nWantedLevel;
+ if (m_nChaos > nMaximumWantedLevel)
+ m_nChaos = nMaximumWantedLevel;
+
if (m_nChaos >= 0 && m_nChaos < 40) {
m_nWantedLevel = 0;
m_MaximumLawEnforcerVehicles = 0;
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 829a64d4..0440a951 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -29,6 +29,7 @@ bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
+WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); }
void
CWorld::Add(CEntity *ent)
diff --git a/src/core/World.h b/src/core/World.h
index fd9d6fc3..e4f46589 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -103,6 +103,7 @@ public:
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
static void RemoveReferencesToDeletedObject(CEntity*);
+ static void FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
diff --git a/src/core/config.h b/src/core/config.h
index 38682e22..07c86c0d 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -64,6 +64,8 @@ enum Config {
NUMRADARBLIPS = 32,
NUMPICKUPS = 336,
NUMEVENTS = 64,
+
+ NUM_CARGENS = 160
};
// We'll use this once we're ready to become independent of the game
@@ -117,7 +119,7 @@ enum Config {
# define CHATTYSPLASH // print what the game is loading
#endif
-//#define FIX_BUGS // fix bugs in the game, TODO: use this more
+#define FIX_BUGS // fix bugs in the game, TODO: use this more
#define KANGAROO_CHEAT
#define ASPECT_RATIO_SCALE
-#define USE_DEBUG_SCRIPT_LOADER \ No newline at end of file
+#define USE_DEBUG_SCRIPT_LOADER
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index a0032bc6..35b3cfa4 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -150,6 +150,18 @@ FixCar(void)
((CAutomobile*)veh)->Fix();
}
+static int engineStatus;
+static void
+SetEngineStatus(void)
+{
+ CVehicle *veh = FindPlayerVehicle();
+ if(veh == nil)
+ return;
+ if(!veh->IsCar())
+ return;
+ ((CAutomobile*)veh)->Damage.SetEngineStatus(engineStatus);
+}
+
static void
ToggleComedy(void)
{
@@ -295,9 +307,13 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); });
+ DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); });
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
+ DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
+ DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
-
+ DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
+ DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);