summaryrefslogtreecommitdiffstats
path: root/src/peds/Ped.cpp
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2020-06-29 08:37:53 +0200
committerGitHub <noreply@github.com>2020-06-29 08:37:53 +0200
commit860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb (patch)
tree6a8f83b0d46e97b198f095b7624deecca75051e7 /src/peds/Ped.cpp
parentrestore Text.cpp (diff)
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.gz
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.bz2
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.lz
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.xz
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.zst
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.zip
Diffstat (limited to '')
-rw-r--r--src/peds/Ped.cpp547
1 files changed, 85 insertions, 462 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index fd8fd540..cf254cf4 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -57,56 +57,15 @@
#include "Timecycle.h"
#include "ParticleObject.h"
#include "Floater.h"
+#include "Range2D.h"
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
CPed *gapTempPedList[50];
uint16 gnNumTempPedList;
-CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
-
-// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
-PedAudioData CommentWaitTime[39] = {
- {500, 800, 500, 2},
- {500, 800, 500, 2},
- {500, 800, 500, 2},
- {500, 800, 500, 2},
- {100, 2, 100, 2},
- {700, 500, 1000, 500},
- {700, 500, 1000, 500},
- {5000, 2000, 15000, 3000},
- {5000, 2000, 15000, 3000},
- {5000, 2000, 15000, 3000},
- {6000, 6000, 6000, 6000},
- {1000, 1000, 2000, 2000},
- {1000, 500, 2000, 1500},
- {1000, 500, 2000, 1500},
- {800, 200, 1000, 500},
- {800, 200, 1000, 500},
- {800, 400, 2000, 1000},
- {800, 400, 2000, 1000},
- {400, 300, 2000, 1000},
- {2000, 1000, 2500, 1500},
- {200, 200, 200, 200},
- {6000, 3000, 5000, 6000},
- {6000, 3000, 9000, 5000},
- {6000, 3000, 9000, 5000},
- {6000, 3000, 9000, 5000},
- {400, 300, 4000, 1000},
- {400, 300, 4000, 1000},
- {400, 300, 4000, 1000},
- {1000, 500, 3000, 1000},
- {1000, 500, 1000, 1000},
- {3000, 2000, 3000, 2000},
- {1000, 500, 3000, 6000},
- {1000, 500, 2000, 4000},
- {1000, 500, 2000, 5000},
- {1000, 500, 3000, 2000},
- {1600, 1000, 2000, 2000},
- {3000, 2000, 5000, 3000},
- {1000, 1000, 1000, 1000},
- {1000, 1000, 5000, 5000},
-};
+static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
+
uint16 nPlayerInComboMove;
RpClump *flyingClumpTemp;
@@ -159,228 +118,11 @@ void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->N
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); }
-static char ObjectiveText[][28] = {
- "No Obj",
- "Wait on Foot",
- "Flee on Foot Till Safe",
- "Guard Spot",
- "Guard Area",
- "Wait in Car",
- "Wait in Car then Getout",
- "Kill Char on Foot",
- "Kill Char Any Means",
- "Flee Char on Foot Till Safe",
- "Flee Char on Foot Always",
- "GoTo Char on Foot",
- "Follow Char in Formation",
- "Leave Car",
- "Enter Car as Passenger",
- "Enter Car as Driver",
- "Follow Car in Car",
- "Fire at Obj from Vehicle",
- "Destroy Obj",
- "Destroy Car",
- "GoTo Area Any Means",
- "GoTo Area on Foot",
- "Run to Area",
- "GoTo Area in Car",
- "Follow Car on Foot Woffset",
- "Guard Attack",
- "Set Leader",
- "Follow Route",
- "Solicit",
- "Take Taxi",
- "Catch Train",
- "Buy IceCream",
- "Steal Any Car",
- "Mug Char",
-#ifdef VC_PED_PORTS
- "Leave Car and Die"
-#endif
-};
-
-static char StateText[][18] = {
- "None",
- "Idle",
- "Look Entity",
- "Look Heading",
- "Wander Range",
- "Wander Path",
- "Seek Pos",
- "Seek Entity",
- "Flee Pos",
- "Flee Entity",
- "Pursue",
- "Follow Path",
- "Sniper Mode",
- "Rocket Mode",
- "Dummy",
- "Pause",
- "Attack",
- "Fight",
- "Face Phone",
- "Make Call",
- "Chat",
- "Mug",
- "AimGun",
- "AI Control",
- "Seek Car",
- "Seek InBoat",
- "Follow Route",
- "C.P.R.",
- "Solicit",
- "Buy IceCream",
- "Investigate",
- "Step away",
- "On Fire",
- "Unknown",
- "STATES_NO_AI",
- "Jump",
- "Fall",
- "GetUp",
- "Stagger",
- "Dive away",
- "STATES_NO_ST",
- "Enter Train",
- "Exit Train",
- "Arrest Plyr",
- "Driving",
- "Passenger",
- "Taxi Passngr",
- "Open Door",
- "Die",
- "Dead",
- "CarJack",
- "Drag fm Car",
- "Enter Car",
- "Steal Car",
- "Exit Car",
- "Hands Up",
- "Arrested",
-};
-
-static char PersonalityTypeText[][18] = {
- "Player",
- "Cop",
- "Medic",
- "Fireman",
- "Gang 1",
- "Gang 2",
- "Gang 3",
- "Gang 4",
- "Gang 5",
- "Gang 6",
- "Gang 7",
- "Street Guy",
- "Suit Guy",
- "Sensible Guy",
- "Geek Guy",
- "Old Guy",
- "Tough Guy",
- "Street Girl",
- "Suit Girl",
- "Sensible Girl",
- "Geek Girl",
- "Old Girl",
- "Tough Girl",
- "Tramp Male",
- "Tramp Female",
- "Tourist",
- "Prostitute",
- "Criminal",
- "Busker",
- "Taxi Driver",
- "Psycho",
- "Steward",
- "Sports Fan",
- "Shopper",
- "Old Shopper"
-};
-
-static char WaitStateText[][16] = {
- "No Wait",
- "Traffic Lights",
- "Pause CrossRoad",
- "Look CrossRoad",
- "Look Ped",
- "Look Shop",
- "Look Accident",
- "FaceOff Gang",
- "Double Back",
- "Hit Wall",
- "Turn 180deg",
- "Surprised",
- "Ped Stuck",
- "Look About",
- "Play Duck",
- "Play Cower",
- "Play Taxi",
- "Play HandsUp",
- "Play HandsCower",
- "Play Chat",
- "Finish Flee",
-};
-
#ifdef TOGGLEABLE_BETA_FEATURES
bool CPed::bPopHeadsOnHeadshot = false;
bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
#endif
-#ifndef MASTER
-int nDisplayDebugInfo = 0;
-
-void
-CPed::SwitchDebugDisplay(void)
-{
- nDisplayDebugInfo = !nDisplayDebugInfo;
-}
-
-void
-CPed::DebugRenderOnePedText(void)
-{
- if ((GetPosition() - TheCamera.GetPosition()).MagnitudeSqr() < sq(30.0f)) {
- float width, height;
- RwV3d screenCoords;
- CVector bitAbove = GetPosition();
- bitAbove.z += 2.0f;
- if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) {
-
- float lineHeight = SCREEN_SCALE_Y(Min(height/100.0f, 0.7f) * 22.0f);
-
- DefinedState();
- CFont::SetPropOn();
- CFont::SetBackgroundOn();
-
- // Originally both of them were being divided by 60.0f.
- float xScale = Min(width / 240.0f, 0.7f);
- float yScale = Min(height / 80.0f, 0.7f);
-
- CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale));
- CFont::SetCentreOn();
- CFont::SetCentreSize(SCREEN_WIDTH);
- CFont::SetJustifyOff();
- CFont::SetColor(CRGBA(255, 255, 0, 255));
- CFont::SetBackGroundOnlyTextOn();
- CFont::SetFontStyle(0);
- AsciiToUnicode(StateText[m_nPedState], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y, gUString);
- AsciiToUnicode(ObjectiveText[m_objective], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + lineHeight, gUString);
- AsciiToUnicode(PersonalityTypeText[m_pedStats->m_type], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + 2 * lineHeight, gUString);
- AsciiToUnicode(WaitStateText[m_nWaitState], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + 3 * lineHeight, gUString);
- if (m_nPedState == PED_SEEK_POS || m_nPedState == PED_SEEK_ENTITY) {
- sprintf(gString, "Safe distance to target: %.2f", m_distanceToCountSeekDone);
- AsciiToUnicode(gString, gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + 4 * lineHeight, gUString);
- }
- DefinedState();
- }
- }
-}
-#endif
-
CPed::~CPed(void)
{
CWorld::Remove(this);
@@ -441,10 +183,13 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedType = pedType;
m_lastSoundStart = 0;
m_soundStart = 0;
- m_lastQueuedSound = SOUND_TOTAL_PED_SOUNDS;
- m_queuedSound = SOUND_TOTAL_PED_SOUNDS;
+ m_lastQueuedSound = SOUND_NO_SOUND;
+ m_queuedSound = SOUND_NO_SOUND;
m_objective = OBJECTIVE_NONE;
m_prevObjective = OBJECTIVE_NONE;
+#ifdef FIX_BUGS
+ m_objectiveTimer = 0;
+#endif
CharCreatedBy = RANDOM_CHAR;
m_leader = nil;
m_pedInObjective = nil;
@@ -498,6 +243,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedState = PED_IDLE;
m_nLastPedState = PED_NONE;
m_nMoveState = PEDMOVE_STILL;
+#ifdef FIX_BUGS
+ m_nPrevMoveState = PEDMOVE_NONE;
+#endif
m_nStoredMoveState = PEDMOVE_NONE;
m_pFire = nil;
m_pPointGunAt = nil;
@@ -1087,6 +835,9 @@ CPed::ClearAimFlag(void)
bIsAimingGun = false;
bIsRestoringGun = true;
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
+#ifdef VC_PED_PORTS
+ m_lookTimer = 0;
+#endif
}
if (IsPlayer())
@@ -1682,11 +1433,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
switch (component) {
case CAR_DOOR_RF:
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos.x += seatOffset;
vehDoorOffset.x = -vehDoorOffset.x;
break;
@@ -1698,11 +1445,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break;
case CAR_DOOR_LF:
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
break;
@@ -1712,11 +1455,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break;
default:
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
}
return vehDoorPos - vehDoorOffset;
@@ -2037,7 +1776,7 @@ particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times)
switch (ped->m_nSurfaceTouched)
{
case SURFACE_TARMAC:
- case SURFACE_DIRT:
+ case SURFACE_GRAVEL:
case SURFACE_PAVEMENT:
case SURFACE_SAND:
for (int i = 0; i < times; ++i) {
@@ -2190,7 +1929,7 @@ CPed::PlayFootSteps(void)
}
}
- if (m_nSurfaceTouched == SURFACE_PUDDLE) {
+ if (m_nSurfaceTouched == SURFACE_WATER) {
float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude();
if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) {
#ifdef PC_PARTICLE
@@ -2380,7 +2119,7 @@ CPed::SetupLighting(void)
#ifndef MASTER
// Originally this was being called through iteration of Sectors, but putting it here is better.
- if (nDisplayDebugInfo && !IsPlayer())
+ if (GetDebugDisplay() != 0 && !IsPlayer())
DebugRenderOnePedText();
#endif
@@ -2514,37 +2253,37 @@ CPed::CalculateNewVelocity(void)
if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) {
#endif
LimbOrientation newUpperLegs;
- newUpperLegs.phi = localWalkAngle;
+ newUpperLegs.yaw = localWalkAngle;
- if (newUpperLegs.phi < -DEGTORAD(100.0f)) {
- newUpperLegs.phi += PI;
- } else if (newUpperLegs.phi > DEGTORAD(100.0f)) {
- newUpperLegs.phi -= PI;
+ if (newUpperLegs.yaw < -DEGTORAD(100.0f)) {
+ newUpperLegs.yaw += PI;
+ } else if (newUpperLegs.yaw > DEGTORAD(100.0f)) {
+ newUpperLegs.yaw -= PI;
}
- if (newUpperLegs.phi > -DEGTORAD(50.0f) && newUpperLegs.phi < DEGTORAD(50.0f)) {
+ if (newUpperLegs.yaw > -DEGTORAD(50.0f) && newUpperLegs.yaw < DEGTORAD(50.0f)) {
#ifdef PED_SKIN
if(IsClumpSkinned(GetClump())){
/*
// this looks shit
- newUpperLegs.theta = 0.0f;
+ newUpperLegs.pitch = 0.0f;
RwV3d axis = { -1.0f, 0.0f, 0.0f };
- RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT);
*/
- newUpperLegs.theta = 0.1f;
+ newUpperLegs.pitch = 0.1f;
RwV3d Xaxis = { 1.0f, 0.0f, 0.0f };
RwV3d Zaxis = { 0.0f, 0.0f, 1.0f };
- RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
bDontAcceptIKLookAts = true;
}else
#endif
{
- newUpperLegs.theta = 0.0f;
+ newUpperLegs.pitch = 0.0f;
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGL], &newUpperLegs, false);
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGR], &newUpperLegs, false);
}
@@ -2588,7 +2327,7 @@ CPed::CanPedDriveOff(void)
bool
CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil)
{
- if (m_nSurfaceTouched == SURFACE_PUDDLE)
+ if (m_nSurfaceTouched == SURFACE_WATER)
return true;
CVector pos = GetPosition();
@@ -3648,9 +3387,14 @@ CPed::SetStoredState(void)
if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL)
m_nMoveState = PEDMOVE_WALK;
}
- m_nLastPedState = m_nPedState;
- if (m_nMoveState >= m_nPrevMoveState)
- m_nPrevMoveState = m_nMoveState;
+#ifdef VC_PED_PORTS
+ if (m_nPedState != PED_IDLE)
+#endif
+ {
+ m_nLastPedState = m_nPedState;
+ if (m_nMoveState >= m_nPrevMoveState)
+ m_nPrevMoveState = m_nMoveState;
+ }
}
void
@@ -5419,7 +5163,10 @@ CPed::SetWaitState(eWaitState state, void *time)
case WAITSTATE_DOUBLEBACK:
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 3500;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
break;
case WAITSTATE_HITWALL:
m_headingRate = 2.0f;
@@ -5453,7 +5200,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective();
@@ -5466,7 +5216,11 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
+
break;
case WAITSTATE_PLAYANIM_COWER:
waitAnim = ANIM_HANDSCOWER;
@@ -5508,7 +5262,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 2500;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
break;
default:
m_nWaitState = WAITSTATE_FALSE;
@@ -5537,7 +5294,7 @@ CPed::PlayHitSound(CPed *hitTo)
S42 = SOUND_FIGHT_PUNCH_FROM_BEHIND_42,
S43 = SOUND_FIGHT_KNEE_OR_KICK_43,
S44 = SOUND_FIGHT_KICK_44,
- NO_SND = SOUND_TOTAL_PED_SOUNDS
+ NO_SND = SOUND_NO_SOUND
};
uint16 hitSoundsByFightMoves[12][10] = {
{S39,S42,S43,S43,S39,S39,S39,S39,S39,S42},
@@ -5577,78 +5334,6 @@ CPed::PlayHitSound(CPed *hitTo)
}
void
-CPed::Say(uint16 audio)
-{
- uint16 audioToPlay = audio;
-
- if (IsPlayer()) {
-
- // Ofc this part isn't in VC.
- switch (audio) {
- case SOUND_PED_DEATH:
- audioToPlay = SOUND_PED_DAMAGE;
- break;
- case SOUND_PED_DAMAGE:
- case SOUND_PED_HIT:
- case SOUND_PED_LAND:
- break;
- case SOUND_PED_BULLET_HIT:
- case SOUND_PED_CAR_JACKED:
- case SOUND_PED_DEFEND:
- audioToPlay = SOUND_PED_HIT;
- break;
- default:
- return;
- }
- } else {
- if (3.0f + TheCamera.GetPosition().z < GetPosition().z)
- return;
-
- if (TheCamera.m_CameraAverageSpeed > 1.65f) {
-#ifdef VC_PED_PORTS
- if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND)
-#endif
- return;
-
- } else if (TheCamera.m_CameraAverageSpeed > 1.25f) {
- if (audio != SOUND_PED_DEATH &&
-#ifdef VC_PED_PORTS
- audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND &&
-#endif
- audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE)
- return;
-
- } else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
- switch (audio) {
- case SOUND_PED_DEATH:
-#ifdef VC_PED_PORTS
- case SOUND_PED_DAMAGE:
- case SOUND_PED_HIT:
- case SOUND_PED_LAND:
-#endif
- case SOUND_PED_BURNING:
- case SOUND_PED_FLEE_SPRINT:
- case SOUND_PED_TAXI_WAIT:
- case SOUND_PED_EVADE:
- case SOUND_PED_CAR_COLLISION:
- break;
- default:
- return;
- }
- }
- }
-
- if (audioToPlay < m_queuedSound) {
- if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH
- || CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
- + m_lastSoundStart
- + (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) {
- m_queuedSound = audioToPlay;
- }
- }
-}
-
-void
CPed::CollideWithPed(CPed *collideWith)
{
CAnimBlendAssociation *animAssoc;
@@ -6072,6 +5757,9 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
m_nPedState = PED_CHAT;
SetMoveState(PEDMOVE_STILL);
+#ifdef VC_PED_PORTS
+ m_lookTimer = 0;
+#endif
SetLookFlag(chatWith, true);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
@@ -6080,10 +5768,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
void
CPed::SetDead(void)
{
-#ifdef VC_PED_PORTS
- if (!RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DROWN))
-#endif
- bUsesCollision = false;
+ bUsesCollision = false;
m_fHealth = 0.0f;
if (m_nPedState == PED_DRIVING)
@@ -6187,6 +5872,9 @@ CPed::Die(void)
uint8
CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
{
+#ifdef FIX_BUGS
+ return 1;
+#else
uint8 retVal = 2;
float headZ = GetNodePosition(PED_HEAD).z;
@@ -6202,6 +5890,7 @@ CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
retVal = 0;
return retVal;
+#endif
}
bool
@@ -8955,11 +8644,11 @@ CPed::LookForInterestingNodes(void)
return false;
}
- switch (effect->attractor.flags) {
- case ATTRACTORFLAG_ICECREAM:
+ switch (effect->attractor.type) {
+ case ATTRACTORTYPE_ICECREAM:
SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace);
break;
- case ATTRACTORFLAG_STARE:
+ case ATTRACTORTYPE_STARE:
SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f,
CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500),
angleToFace);
@@ -9578,17 +9267,6 @@ CPed::ProcessControl(void)
float oldDestRot = CGeneral::LimitRadianAngle(m_fRotationDest);
-#ifdef VC_PED_PORTS
- if (m_nPedState == PED_FOLLOW_PATH) {
- if (DotProduct(m_vecDamageNormal, GetForward()) < -0.866f && CanPedJumpThis(collidingEnt, &m_vecDamageNormal)) {
- SetJump();
-
- // Moved break into here, for compatibility with III
- break;
- }
- // break;
- }
-#endif
if (m_pedInObjective &&
(m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT)) {
@@ -10414,7 +10092,7 @@ CPed::ProcessControl(void)
case PED_SEEK_ENTITY:
case PED_PURSUE:
case PED_SNIPER_MODE:
- case PED_ROCKET_ODE:
+ case PED_ROCKET_MODE:
case PED_DUMMY:
case PED_FACE_PHONE:
case PED_MAKE_CALL:
@@ -11055,7 +10733,7 @@ CPed::SetJump(void)
#ifdef VC_PED_PORTS
m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) &&
#endif
- (m_nSurfaceTouched != SURFACE_STONE || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
+ (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
SetStoredState();
m_nPedState = PED_JUMP;
CAnimBlendAssociation *jumpAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_JUMP_LAUNCH, 8.0f);
@@ -11064,12 +10742,6 @@ CPed::SetJump(void)
}
}
-bool
-CPed::ServiceTalkingWhenDead(void)
-{
- return m_queuedSound == SOUND_PED_DEATH;
-}
-
void
CPed::RemoveInCarAnims(void)
{
@@ -14781,7 +14453,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif
m_nSurfaceTouched = intersectionPoint.surfaceB;
- if (m_nSurfaceTouched == SURFACE_STONE) {
+ if (m_nSurfaceTouched == SURFACE_STEEP_CLIFF) {
bHitSteepSlope = true;
m_vecDamageNormal = intersectionPoint.normal;
}
@@ -14889,7 +14561,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
#endif
sphereNormal.Normalise();
collidingPoints[sphere].normal = sphereNormal;
- if (collidingPoints[sphere].surfaceB == SURFACE_STONE)
+ if (collidingPoints[sphere].surfaceB == SURFACE_STEEP_CLIFF)
bHitSteepSlope = true;
}
}
@@ -14939,17 +14611,9 @@ CPed::WanderRange(void)
bool arrived = Seek();
if (arrived) {
Idle();
- if (((m_randomSeed % 256) + 3 * CTimer::GetFrameCounter()) % 1000 > 997) {
-
- int xDiff = Abs(m_wanderRangeBounds[1].x - m_wanderRangeBounds[0].x);
- int yDiff = Abs(m_wanderRangeBounds[1].y - m_wanderRangeBounds[0].y);
-
- CVector newCoords(
- (CGeneral::GetRandomNumber() % xDiff) + m_wanderRangeBounds[0].x,
- (CGeneral::GetRandomNumber() % yDiff) + m_wanderRangeBounds[0].y,
- GetPosition().z);
-
- SetSeek(newCoords, 2.5f);
+ if ((m_randomSeed + 3 * CTimer::GetFrameCounter()) % 1000 > 997) {
+ CVector2D newCoords2D = m_wanderRangeBounds->GetRandomPointInRange();
+ SetSeek(CVector(newCoords2D.x, newCoords2D.y, GetPosition().z), 2.5f);
}
}
}
@@ -15031,11 +14695,7 @@ CPed::SeekBoatPosition(void)
CVehicleModelInfo *boatModel = m_carInObjective->GetModelInfo();
CVector enterOffset;
- if (boatModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- enterOffset = boatModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- enterOffset = boatModel->m_positions[CAR_POS_FRONTSEAT];
-
+ enterOffset = boatModel->GetFrontSeatPosn();
enterOffset.x = 0.0f;
CMatrix boatMat(m_carInObjective->GetMatrix());
SetMoveState(PEDMOVE_WALK);
@@ -16274,34 +15934,6 @@ CPed::SeekCar(void)
}
void
-CPed::ServiceTalking(void)
-{
- if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
- if (CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber")) {
- if (m_nPedState == PED_ON_FIRE)
- m_queuedSound = SOUND_PED_BURNING;
- } else {
- m_queuedSound = SOUND_PED_BOMBER;
- }
- if (m_queuedSound != SOUND_TOTAL_PED_SOUNDS) {
- if (m_queuedSound == SOUND_PED_DEATH)
- m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
-
- if (CTimer::GetTimeInMilliseconds() > m_soundStart) {
- DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f);
- m_lastSoundStart = CTimer::GetTimeInMilliseconds();
- m_soundStart =
- CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime
- + CTimer::GetTimeInMilliseconds()
- + CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime);
- m_lastQueuedSound = m_queuedSound;
- m_queuedSound = SOUND_TOTAL_PED_SOUNDS;
- }
- }
- }
-}
-
-void
CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
{
if (m_nPedState == PED_DEAD) {
@@ -16749,7 +16381,7 @@ CPed::UpdatePosition(void)
velocityChange = m_moved + velocityOfSurface - m_vecMoveSpeed;
m_fRotationCur += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep();
m_fRotationDest += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep();
- } else if (m_nSurfaceTouched != SURFACE_STONE || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) {
+ } else if (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) {
velocityChange = m_moved - m_vecMoveSpeed;
} else {
// Ped got damaged by steep slope
@@ -16817,29 +16449,20 @@ CPed::SetPedPositionInCar(void)
CMatrix newMat(m_pMyVehicle->GetMatrix());
CVector seatPos;
if (m_pMyVehicle->pDriver == this) {
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ seatPos = vehModel->GetFrontSeatPosn();
if (!m_pMyVehicle->IsBoat() && m_pMyVehicle->m_vehType != VEHICLE_TYPE_BIKE)
seatPos.x = -seatPos.x;
} else if (m_pMyVehicle->pPassengers[0] == this) {
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
+ seatPos = vehModel->GetFrontSeatPosn();
} else if (m_pMyVehicle->pPassengers[1] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
seatPos.x = -seatPos.x;
} else {
if (m_pMyVehicle->pPassengers[2] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
- } else if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) {
- seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
} else {
- seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
+ seatPos = vehModel->GetFrontSeatPosn();
}
}
newMat.GetPosition() += Multiply3x3(newMat, seatPos);