summaryrefslogtreecommitdiffstats
path: root/src/entities/Ped.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-23 01:01:21 +0200
committeraap <aap@papnet.eu>2019-06-23 01:01:21 +0200
commit047fa20f28890176e0d86191b3a9fd459d967785 (patch)
tree78d7ce0c5ad0546648643fb8b2c901efee74d5e5 /src/entities/Ped.cpp
parentFixed little bug in Radar.cpp. (diff)
downloadre3-047fa20f28890176e0d86191b3a9fd459d967785.tar
re3-047fa20f28890176e0d86191b3a9fd459d967785.tar.gz
re3-047fa20f28890176e0d86191b3a9fd459d967785.tar.bz2
re3-047fa20f28890176e0d86191b3a9fd459d967785.tar.lz
re3-047fa20f28890176e0d86191b3a9fd459d967785.tar.xz
re3-047fa20f28890176e0d86191b3a9fd459d967785.tar.zst
re3-047fa20f28890176e0d86191b3a9fd459d967785.zip
Diffstat (limited to 'src/entities/Ped.cpp')
-rw-r--r--src/entities/Ped.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp
index 35e8e957..f3e212d4 100644
--- a/src/entities/Ped.cpp
+++ b/src/entities/Ped.cpp
@@ -388,8 +388,7 @@ void
CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
{
RwFrame *frame;
- RwFrame *fp;
- RwV3d zero;
+ RwV3d pos;
frame = GetNodeFrame(nodeId);
if (frame) {
@@ -398,20 +397,20 @@ CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
CPed::SpawnFlyingComponent(nodeId, unk);
RecurseFrameChildrenVisibilityCB(frame, 0);
- zero.x = 0.0f;
- zero.z = 0.0f;
- zero.y = 0.0f;
- for (fp = RwFrameGetParent(frame); fp; fp = RwFrameGetParent(frame))
- RwV3dTransformPoints(&zero, &zero, 1, &fp->modelling);
+ pos.x = 0.0f;
+ pos.z = 0.0f;
+ pos.y = 0.0f;
+ for (frame = RwFrameGetParent(frame); frame; frame = RwFrameGetParent(frame))
+ RwV3dTransformPoints(&pos, &pos, 1, RwFrameGetMatrix(frame));
if (CEntity::GetIsOnScreen()) {
- CParticle::AddParticle(PARTICLE_TEST, zero,
+ CParticle::AddParticle(PARTICLE_TEST, pos,
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,
+ pos,
CVector(0.0f, 0.0f, 0.03f),
nil, 0.0f, 0, 0, 0, 0);
}
@@ -642,10 +641,9 @@ CPed::Attack(void)
CAnimBlendAssociation *weaponAnimAssoc;
int32 weaponAnim;
float animStart;
- RwFrame *f;
+ RwFrame *frame;
eWeaponType ourWeaponType;
float weaponAnimTime;
- RwFrame *i;
eWeaponFire ourWeaponFire;
float animEnd;
CWeaponInfo *ourWeapon;
@@ -718,14 +716,12 @@ CPed::Attack(void)
firePos = GetMatrix() * firePos;
} else if (ourWeaponType != WEAPONTYPE_UNARMED) {
if (weaponAnimAssoc->animId == ANIM_KICK_FLOOR)
- f = GetNodeFrame(PED_FOOTR);
+ frame = GetNodeFrame(PED_FOOTR);
else
- f = GetNodeFrame(PED_HANDR);
+ frame = GetNodeFrame(PED_HANDR);
- while (f) {
- RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, &f->modelling);
- f = RwFrameGetParent(f);
- }
+ for (; frame; frame = RwFrameGetParent(frame))
+ RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, RwFrameGetMatrix(frame));
} else {
firePos = GetMatrix() * firePos;
}
@@ -773,8 +769,8 @@ CPed::Attack(void)
firePos = ourWeapon->m_vecFireOffset;
if (weaponAnimTime > 1.0f && weaponAnimTime - weaponAnimAssoc->timeStep <= 1.0f && weaponAnimAssoc->IsRunning()) {
- for (i = GetNodeFrame(PED_HANDR); i; i = RwFrameGetParent(i))
- RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, &i->modelling);
+ for (frame = GetNodeFrame(PED_HANDR); frame; frame = RwFrameGetParent(frame))
+ RwV3dTransformPoints((RwV3d*)firePos, (RwV3d*)firePos, 1, RwFrameGetMatrix(frame));
CVector gunshellPos(
firePos.x - 0.6f * GetForward().x,