summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-16 23:12:14 +0200
committeraap <aap@papnet.eu>2019-06-16 23:12:14 +0200
commit93223b2baca75e53b88ca5d5a7ac7a2412368657 (patch)
tree8ea5583b630f800507037b83a7cbf03b3afde66c /src
parentMerge pull request #16 from erorcun/master (diff)
downloadre3-93223b2baca75e53b88ca5d5a7ac7a2412368657.tar
re3-93223b2baca75e53b88ca5d5a7ac7a2412368657.tar.gz
re3-93223b2baca75e53b88ca5d5a7ac7a2412368657.tar.bz2
re3-93223b2baca75e53b88ca5d5a7ac7a2412368657.tar.lz
re3-93223b2baca75e53b88ca5d5a7ac7a2412368657.tar.xz
re3-93223b2baca75e53b88ca5d5a7ac7a2412368657.tar.zst
re3-93223b2baca75e53b88ca5d5a7ac7a2412368657.zip
Diffstat (limited to 'src')
-rw-r--r--src/PedStat.h9
-rw-r--r--src/audio/DMAudio.h8
-rw-r--r--src/entities/Ped.cpp61
-rw-r--r--src/entities/Ped.h15
-rw-r--r--src/entities/PedIK.h7
5 files changed, 44 insertions, 56 deletions
diff --git a/src/PedStat.h b/src/PedStat.h
index 23c75a2b..3045e494 100644
--- a/src/PedStat.h
+++ b/src/PedStat.h
@@ -1,7 +1,7 @@
#pragma once
-#include "common.h"
-struct PedStat {
+struct PedStat
+{
uint32 m_id;
char m_name[24];
int32 m_fleeDistance;
@@ -13,8 +13,5 @@ struct PedStat {
int32 m_attackStrength;
int32 m_defendWeakness;
int16 m_flags;
- uint8 unknown1;
- uint8 unknown2;
};
-
-static_assert(sizeof(PedStat) == 0x34, "PedStat: error"); \ No newline at end of file
+static_assert(sizeof(PedStat) == 0x34, "PedStat: error");
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index d2e3a22e..b9e60b60 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -1,6 +1,7 @@
#pragma once
-enum eSound : int16 {
+enum eSound
+{
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2,
@@ -180,8 +181,7 @@ public:
void ReleaseDigitalHandle(void);
void ReacquireDigitalHandle(void);
void Service(void);
- void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB,
- float impulse, float speed);
+ void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB, float impulse, float speed);
void ResetTimers(UInt32 timerval);
Bool IsAudioInitialised(void);
Char GetCDAudioDriveLetter(void);
@@ -189,4 +189,4 @@ public:
void ChangeMusicMode(UInt8 mode);
void PlayFrontEndSound(uint32, uint32);
};
-extern cDMAudio& DMAudio;
+extern cDMAudio &DMAudio;
diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp
index fbd59b3e..8d51c1f2 100644
--- a/src/entities/Ped.cpp
+++ b/src/entities/Ped.cpp
@@ -1,10 +1,12 @@
#include "common.h"
#include "patcher.h"
-#include "Ped.h"
#include "Pools.h"
#include "Particle.h"
#include "Stats.h"
#include "World.h"
+#include "PedStat.h"
+#include "DMaudio.h"
+#include "Ped.h"
Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44;
Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A;
@@ -14,9 +16,9 @@ void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
-WRAPPER void CPed::Say(eSound audio) { EAXJMP(0x4E5A10); }
+WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); }
WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); }
-WRAPPER void CPed::SpawnFlyingComponent(int, signed char) { EAXJMP(0x4EB060); }
+WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); }
static char ObjectiveText[34][28] = {
"No Obj",
@@ -250,38 +252,27 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer)
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 150;
CParticle::AddParticle(PARTICLE_TEST, pos2,
- CVector(
- 0.0f,
- 0.0f,
- 0.0f
- ), NULL, 0.2f, 0, 0, 0, 0);
+ CVector(0.0f, 0.0f, 0.0f), nil, 0.2f, 0, 0, 0, 0);
if (CEntity::GetIsOnScreen()) {
for(int i=0; i < 32; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
- pos2,
- CVector(
- 0.0f,
- 0.0f,
- 0.03f
- ), NULL, 0.0f, 0, 0, 0, 0);
+ pos2, CVector(0.0f, 0.0f, 0.03f),
+ nil, 0.0f, 0, 0, 0, 0);
}
for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_DEBRIS2,
- pos2,
- CVector(
- 0.0f,
- 0.0f,
- 0.01f
- ), NULL, 0.0f, 0, 0, 0, 0);
+ pos2,
+ CVector(0.0f, 0.0f, 0.01f),
+ nil, 0.0f, 0, 0, 0, 0);
}
}
}
}
void
-CPed::RemoveBodyPart(PedNode nodeId, char arg4)
+CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
{
RwFrame *frame;
RwFrame *fp;
@@ -291,7 +282,7 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4)
if (frame) {
if (CGame::nastyGame) {
if (nodeId != PED_HEAD)
- CPed::SpawnFlyingComponent(nodeId, arg4);
+ CPed::SpawnFlyingComponent(nodeId, unk);
RecurseFrameChildrenVisibilityCB(frame, 0);
zero.x = 0.0f;
@@ -302,20 +293,14 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4)
if (CEntity::GetIsOnScreen()) {
CParticle::AddParticle(PARTICLE_TEST, zero,
- CVector(
- 0.0f,
- 0.0f,
- 0.0f
- ), NULL, 0.2f, 0, 0, 0, 0);
+ CVector(0.0f, 0.0f, 0.0f),
+ nil, 0.2f, 0, 0, 0, 0);
for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
zero,
- CVector(
- 0.0f,
- 0.0f,
- 0.03f
- ), NULL, 0.0f, 0, 0, 0, 0);
+ CVector(0.0f, 0.0f, 0.03f),
+ nil, 0.0f, 0, 0, 0, 0);
}
}
m_ped_flagC20 = 1;
@@ -329,11 +314,9 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4)
RwObject*
CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data)
{
- RwObject *result = object;
- if (!data)
+ if (data == 0)
RpAtomicSetFlags(object, 0);
-
- return result;
+ return object;
}
RwFrame*
@@ -356,7 +339,7 @@ CPed::SetLookFlag(CPed *to, bool set)
m_lookTimer = 0;
m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) {
- m_pedIK.m_flags &= ~(1 << 2);
+ m_pedIK.m_flags &= ~CPedIK::FLAG_4;
}
}
}
@@ -372,7 +355,7 @@ CPed::SetLookFlag(float angle, bool set)
m_lookTimer = 0;
m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) {
- m_pedIK.m_flags &= ~(1 << 2);
+ m_pedIK.m_flags &= ~CPedIK::FLAG_4;
}
}
}
@@ -411,7 +394,7 @@ CPed::OurPedCanSeeThisOne(CEntity* who)
return 0;
ourPos.z += 1.0f;
- return CWorld::ProcessLineOfSight(ourPos, itsPos, colpoint, ent, 1, 0, 0, 0, 0, 0, 0) == 0;
+ return !CWorld::ProcessLineOfSight(ourPos, itsPos, colpoint, ent, 1, 0, 0, 0, 0, 0, 0);
}
STARTPATCHES
diff --git a/src/entities/Ped.h b/src/entities/Ped.h
index 2143fa93..6a2f8ef1 100644
--- a/src/entities/Ped.h
+++ b/src/entities/Ped.h
@@ -2,12 +2,12 @@
#include "Physical.h"
#include "Weapon.h"
-#include "PathFind.h"
#include "PedIK.h"
#include "AnimManager.h"
#include "AnimBlendClumpData.h"
-#include "PedStat.h"
-#include "DMAudio.h"
+
+struct PedStat;
+struct CPathNode;
enum {
PED_MAX_WEAPONS = 13
@@ -234,25 +234,26 @@ public:
static void *operator new(size_t);
static void operator delete(void*, size_t);
+ // TODO: enum!
bool IsPlayer(void) { return m_nPedType == 0 || m_nPedType== 1 || m_nPedType == 2 || m_nPedType == 3; }
bool UseGroundColModel(void);
void AddWeaponModel(int id);
void AimGun();
void KillPedWithCar(CVehicle *veh, float impulse);
- void Say(eSound audio);
+ void Say(uint16 audio);
void SetLookFlag(CPed *to, bool set);
void SetLookFlag(float angle, bool set);
void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
- void RemoveBodyPart(PedNode nodeId, char arg4);
- void SpawnFlyingComponent(int, signed char);
+ void RemoveBodyPart(PedNode nodeId, int8 unknown);
+ void SpawnFlyingComponent(int, int8 unknown);
bool OurPedCanSeeThisOne(CEntity* who);
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data);
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
- RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }
+ RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }
static Bool &bNastyLimbsCheat;
static Bool &bPedCheat2;
diff --git a/src/entities/PedIK.h b/src/entities/PedIK.h
index ecb17777..67aaa469 100644
--- a/src/entities/PedIK.h
+++ b/src/entities/PedIK.h
@@ -12,6 +12,13 @@ class CPed;
class CPedIK
{
public:
+ // TODO
+ enum {
+ FLAG_1,
+ FLAG_2,
+ FLAG_4,
+ };
+
CPed* m_ped;
LimbOrientation m_headOrient;
LimbOrientation m_torsoOrient;