some more cleanup

This commit is contained in:
aap 2019-06-16 23:12:14 +02:00
parent c417dfa1c3
commit 93223b2bac
5 changed files with 44 additions and 56 deletions

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "common.h"
struct PedStat { struct PedStat
{
uint32 m_id; uint32 m_id;
char m_name[24]; char m_name[24];
int32 m_fleeDistance; int32 m_fleeDistance;
@ -13,8 +13,5 @@ struct PedStat {
int32 m_attackStrength; int32 m_attackStrength;
int32 m_defendWeakness; int32 m_defendWeakness;
int16 m_flags; int16 m_flags;
uint8 unknown1;
uint8 unknown2;
}; };
static_assert(sizeof(PedStat) == 0x34, "PedStat: error"); static_assert(sizeof(PedStat) == 0x34, "PedStat: error");

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
enum eSound : int16 { enum eSound
{
SOUND_CAR_DOOR_CLOSE_BONNET = 0, SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1, SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2,
@ -180,8 +181,7 @@ public:
void ReleaseDigitalHandle(void); void ReleaseDigitalHandle(void);
void ReacquireDigitalHandle(void); void ReacquireDigitalHandle(void);
void Service(void); void Service(void);
void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB, void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB, float impulse, float speed);
float impulse, float speed);
void ResetTimers(UInt32 timerval); void ResetTimers(UInt32 timerval);
Bool IsAudioInitialised(void); Bool IsAudioInitialised(void);
Char GetCDAudioDriveLetter(void); Char GetCDAudioDriveLetter(void);

View File

@ -1,10 +1,12 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "Ped.h"
#include "Pools.h" #include "Pools.h"
#include "Particle.h" #include "Particle.h"
#include "Stats.h" #include "Stats.h"
#include "World.h" #include "World.h"
#include "PedStat.h"
#include "DMaudio.h"
#include "Ped.h"
Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44; Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44;
Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A; 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); } 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::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::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] = { static char ObjectiveText[34][28] = {
"No Obj", "No Obj",
@ -250,38 +252,27 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer)
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 150; m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 150;
CParticle::AddParticle(PARTICLE_TEST, pos2, CParticle::AddParticle(PARTICLE_TEST, pos2,
CVector( CVector(0.0f, 0.0f, 0.0f), nil, 0.2f, 0, 0, 0, 0);
0.0f,
0.0f,
0.0f
), NULL, 0.2f, 0, 0, 0, 0);
if (CEntity::GetIsOnScreen()) { if (CEntity::GetIsOnScreen()) {
for(int i=0; i < 32; i++) { for(int i=0; i < 32; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
pos2, pos2, CVector(0.0f, 0.0f, 0.03f),
CVector( nil, 0.0f, 0, 0, 0, 0);
0.0f,
0.0f,
0.03f
), NULL, 0.0f, 0, 0, 0, 0);
} }
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_DEBRIS2, CParticle::AddParticle(PARTICLE_DEBRIS2,
pos2, pos2,
CVector( CVector(0.0f, 0.0f, 0.01f),
0.0f, nil, 0.0f, 0, 0, 0, 0);
0.0f,
0.01f
), NULL, 0.0f, 0, 0, 0, 0);
} }
} }
} }
} }
void void
CPed::RemoveBodyPart(PedNode nodeId, char arg4) CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
{ {
RwFrame *frame; RwFrame *frame;
RwFrame *fp; RwFrame *fp;
@ -291,7 +282,7 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4)
if (frame) { if (frame) {
if (CGame::nastyGame) { if (CGame::nastyGame) {
if (nodeId != PED_HEAD) if (nodeId != PED_HEAD)
CPed::SpawnFlyingComponent(nodeId, arg4); CPed::SpawnFlyingComponent(nodeId, unk);
RecurseFrameChildrenVisibilityCB(frame, 0); RecurseFrameChildrenVisibilityCB(frame, 0);
zero.x = 0.0f; zero.x = 0.0f;
@ -302,20 +293,14 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4)
if (CEntity::GetIsOnScreen()) { if (CEntity::GetIsOnScreen()) {
CParticle::AddParticle(PARTICLE_TEST, zero, CParticle::AddParticle(PARTICLE_TEST, zero,
CVector( CVector(0.0f, 0.0f, 0.0f),
0.0f, nil, 0.2f, 0, 0, 0, 0);
0.0f,
0.0f
), NULL, 0.2f, 0, 0, 0, 0);
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
zero, zero,
CVector( CVector(0.0f, 0.0f, 0.03f),
0.0f, nil, 0.0f, 0, 0, 0, 0);
0.0f,
0.03f
), NULL, 0.0f, 0, 0, 0, 0);
} }
} }
m_ped_flagC20 = 1; m_ped_flagC20 = 1;
@ -329,11 +314,9 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4)
RwObject* RwObject*
CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data) CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data)
{ {
RwObject *result = object; if (data == 0)
if (!data)
RpAtomicSetFlags(object, 0); RpAtomicSetFlags(object, 0);
return object;
return result;
} }
RwFrame* RwFrame*
@ -356,7 +339,7 @@ CPed::SetLookFlag(CPed *to, bool set)
m_lookTimer = 0; m_lookTimer = 0;
m_ped_flagA20_look = set; m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) { 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_lookTimer = 0;
m_ped_flagA20_look = set; m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) { 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; return 0;
ourPos.z += 1.0f; 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 STARTPATCHES

View File

@ -2,12 +2,12 @@
#include "Physical.h" #include "Physical.h"
#include "Weapon.h" #include "Weapon.h"
#include "PathFind.h"
#include "PedIK.h" #include "PedIK.h"
#include "AnimManager.h" #include "AnimManager.h"
#include "AnimBlendClumpData.h" #include "AnimBlendClumpData.h"
#include "PedStat.h"
#include "DMAudio.h" struct PedStat;
struct CPathNode;
enum { enum {
PED_MAX_WEAPONS = 13 PED_MAX_WEAPONS = 13
@ -234,19 +234,20 @@ public:
static void *operator new(size_t); static void *operator new(size_t);
static void operator delete(void*, 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 IsPlayer(void) { return m_nPedType == 0 || m_nPedType== 1 || m_nPedType == 2 || m_nPedType == 3; }
bool UseGroundColModel(void); bool UseGroundColModel(void);
void AddWeaponModel(int id); void AddWeaponModel(int id);
void AimGun(); void AimGun();
void KillPedWithCar(CVehicle *veh, float impulse); void KillPedWithCar(CVehicle *veh, float impulse);
void Say(eSound audio); void Say(uint16 audio);
void SetLookFlag(CPed *to, bool set); void SetLookFlag(CPed *to, bool set);
void SetLookFlag(float angle, bool set); void SetLookFlag(float angle, bool set);
void SetLookTimer(int time); void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2); void SetDie(AnimationId anim, float arg1, float arg2);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, char arg4); void RemoveBodyPart(PedNode nodeId, int8 unknown);
void SpawnFlyingComponent(int, signed char); void SpawnFlyingComponent(int, int8 unknown);
bool OurPedCanSeeThisOne(CEntity* who); bool OurPedCanSeeThisOne(CEntity* who);
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data);

View File

@ -12,6 +12,13 @@ class CPed;
class CPedIK class CPedIK
{ {
public: public:
// TODO
enum {
FLAG_1,
FLAG_2,
FLAG_4,
};
CPed* m_ped; CPed* m_ped;
LimbOrientation m_headOrient; LimbOrientation m_headOrient;
LimbOrientation m_torsoOrient; LimbOrientation m_torsoOrient;