mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-27 13:25:41 +00:00
Merge branch 'master' into miami
# Conflicts: # src/peds/Ped.cpp
This commit is contained in:
commit
07c6752cf7
4 changed files with 464 additions and 352 deletions
353
src/peds/Ped.cpp
353
src/peds/Ped.cpp
|
@ -74,48 +74,6 @@ static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
|
||||||
// TODO(Miami)
|
// TODO(Miami)
|
||||||
#define AUDIO_NOT_READY
|
#define AUDIO_NOT_READY
|
||||||
|
|
||||||
// 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},
|
|
||||||
};
|
|
||||||
uint16 nPlayerInComboMove;
|
uint16 nPlayerInComboMove;
|
||||||
|
|
||||||
RpClump *flyingClumpTemp;
|
RpClump *flyingClumpTemp;
|
||||||
|
@ -144,228 +102,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, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
|
||||||
void CPed::operator delete(void *p, int handle) { 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
|
#ifdef TOGGLEABLE_BETA_FEATURES
|
||||||
bool CPed::bPopHeadsOnHeadshot = false;
|
bool CPed::bPopHeadsOnHeadshot = false;
|
||||||
bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
|
bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
|
||||||
#endif
|
#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)
|
CPed::~CPed(void)
|
||||||
{
|
{
|
||||||
CWorld::Remove(this);
|
CWorld::Remove(this);
|
||||||
|
@ -2744,7 +2485,7 @@ CPed::SetupLighting(void)
|
||||||
|
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
// Originally this was being called through iteration of Sectors, but putting it here is better.
|
// Originally this was being called through iteration of Sectors, but putting it here is better.
|
||||||
if (nDisplayDebugInfo && !IsPlayer())
|
if (GetDebugDisplay() != 0 && !IsPlayer())
|
||||||
DebugRenderOnePedText();
|
DebugRenderOnePedText();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -6108,61 +5849,6 @@ CPed::PlayHitSound(CPed *hitTo)
|
||||||
DMAudio.PlayOneShot(m_audioEntityId, soundId, 0.0f);
|
DMAudio.PlayOneShot(m_audioEntityId, soundId, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done except ifdef
|
|
||||||
void
|
|
||||||
CPed::Say(uint16 audio)
|
|
||||||
{
|
|
||||||
uint16 audioToPlay = audio;
|
|
||||||
|
|
||||||
if (3.0f + TheCamera.GetPosition().z < GetPosition().z)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (TheCamera.m_CameraAverageSpeed > 1.65f) {
|
|
||||||
if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND)
|
|
||||||
return;
|
|
||||||
|
|
||||||
} else if (TheCamera.m_CameraAverageSpeed > 1.25f) {
|
|
||||||
if (audio != SOUND_PED_DEATH &&
|
|
||||||
audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND &&
|
|
||||||
audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
} else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
|
|
||||||
switch (audio) {
|
|
||||||
case SOUND_PED_DEATH:
|
|
||||||
case SOUND_PED_DAMAGE:
|
|
||||||
case SOUND_PED_HIT:
|
|
||||||
case SOUND_PED_LAND:
|
|
||||||
case SOUND_PED_BURNING:
|
|
||||||
case SOUND_PED_FLEE_SPRINT:
|
|
||||||
case SOUND_PED_TAXI_WAIT:
|
|
||||||
case SOUND_PED_EVADE:
|
|
||||||
case SOUND_PED_CAR_COLLISION:
|
|
||||||
case SOUND_PED_BOAT_COLLISION:
|
|
||||||
case SOUND_PED_HORN_ACTIVE:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (audioToPlay < m_queuedSound) {
|
|
||||||
if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH
|
|
||||||
|
|
||||||
// See VC Ped Speech patch
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
|| CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
|
|
||||||
+ (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime)
|
|
||||||
#else
|
|
||||||
|| CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
|
|
||||||
+ (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nMaxRandomDelayTime)
|
|
||||||
#endif
|
|
||||||
+ m_lastSoundStart <= CTimer::GetTimeInMilliseconds()) {
|
|
||||||
m_queuedSound = audioToPlay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CPed::CollideWithPed(CPed *collideWith)
|
CPed::CollideWithPed(CPed *collideWith)
|
||||||
{
|
{
|
||||||
|
@ -11654,13 +11340,6 @@ CPed::SetJump(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool
|
|
||||||
CPed::ServiceTalkingWhenDead(void)
|
|
||||||
{
|
|
||||||
return m_queuedSound == SOUND_PED_DEATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --MIAMI: Done
|
// --MIAMI: Done
|
||||||
void
|
void
|
||||||
CPed::RemoveInCarAnims(void)
|
CPed::RemoveInCarAnims(void)
|
||||||
|
@ -16937,36 +16616,6 @@ CPed::SeekCar(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done except ifdef
|
|
||||||
void
|
|
||||||
CPed::ServiceTalking(void)
|
|
||||||
{
|
|
||||||
if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
|
|
||||||
if (!CGame::germanGame && m_pFire)
|
|
||||||
m_queuedSound = SOUND_PED_BURNING;
|
|
||||||
|
|
||||||
if (m_queuedSound != SOUND_NO_SOUND) {
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (m_queuedSound == SOUND_PED_PLAYER_BEFORESEX && IsPlayer())
|
|
||||||
m_soundStart += 2000;
|
|
||||||
|
|
||||||
m_lastQueuedSound = m_queuedSound;
|
|
||||||
m_queuedSound = SOUND_NO_SOUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
|
CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1064,8 +1064,21 @@ public:
|
||||||
|
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
// Mobile things
|
// Mobile things
|
||||||
|
void DebugDrawPedDestination(CPed *, int, int);
|
||||||
|
void DebugDrawPedDesiredHeading(CPed *, int, int);
|
||||||
|
void DebugDrawCollisionRadius(float, float, float, float, int);
|
||||||
|
void DebugDrawVisionRange(CVector, float);
|
||||||
|
void DebugDrawVisionSimple(CVector, float);
|
||||||
|
void DebugDrawLook();
|
||||||
|
void DebugDrawPedPsyche();
|
||||||
|
void DebugDrawDebugLines();
|
||||||
|
|
||||||
static void SwitchDebugDisplay(void);
|
static void SwitchDebugDisplay(void);
|
||||||
|
static int GetDebugDisplay(void);
|
||||||
|
|
||||||
|
void DebugDrawLookAtPoints();
|
||||||
void DebugRenderOnePedText(void);
|
void DebugRenderOnePedText(void);
|
||||||
|
void DebugRenderClosePedText();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
|
140
src/peds/PedChat.cpp
Normal file
140
src/peds/PedChat.cpp
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
#include "common.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "DMAudio.h"
|
||||||
|
#include "General.h"
|
||||||
|
#include "Ped.h"
|
||||||
|
|
||||||
|
// 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},
|
||||||
|
};
|
||||||
|
|
||||||
|
// --MIAMI: Done
|
||||||
|
bool
|
||||||
|
CPed::ServiceTalkingWhenDead(void)
|
||||||
|
{
|
||||||
|
return m_queuedSound == SOUND_PED_DEATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --MIAMI: Done except ifdef
|
||||||
|
void
|
||||||
|
CPed::ServiceTalking(void)
|
||||||
|
{
|
||||||
|
if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
|
||||||
|
if (!CGame::germanGame && m_pFire)
|
||||||
|
m_queuedSound = SOUND_PED_BURNING;
|
||||||
|
|
||||||
|
if (m_queuedSound != SOUND_NO_SOUND) {
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (m_queuedSound == SOUND_PED_PLAYER_BEFORESEX && IsPlayer())
|
||||||
|
m_soundStart += 2000;
|
||||||
|
|
||||||
|
m_lastQueuedSound = m_queuedSound;
|
||||||
|
m_queuedSound = SOUND_NO_SOUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --MIAMI: Done except ifdef
|
||||||
|
void
|
||||||
|
CPed::Say(uint16 audio)
|
||||||
|
{
|
||||||
|
uint16 audioToPlay = audio;
|
||||||
|
|
||||||
|
if (3.0f + TheCamera.GetPosition().z < GetPosition().z)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (TheCamera.m_CameraAverageSpeed > 1.65f) {
|
||||||
|
if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND)
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (TheCamera.m_CameraAverageSpeed > 1.25f) {
|
||||||
|
if (audio != SOUND_PED_DEATH &&
|
||||||
|
audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND &&
|
||||||
|
audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
|
||||||
|
switch (audio) {
|
||||||
|
case SOUND_PED_DEATH:
|
||||||
|
case SOUND_PED_DAMAGE:
|
||||||
|
case SOUND_PED_HIT:
|
||||||
|
case SOUND_PED_LAND:
|
||||||
|
case SOUND_PED_BURNING:
|
||||||
|
case SOUND_PED_FLEE_SPRINT:
|
||||||
|
case SOUND_PED_TAXI_WAIT:
|
||||||
|
case SOUND_PED_EVADE:
|
||||||
|
case SOUND_PED_CAR_COLLISION:
|
||||||
|
case SOUND_PED_BOAT_COLLISION:
|
||||||
|
case SOUND_PED_HORN_ACTIVE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (audioToPlay < m_queuedSound) {
|
||||||
|
if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH
|
||||||
|
|
||||||
|
// See VC Ped Speech patch
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
|| CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
|
||||||
|
+ (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime)
|
||||||
|
#else
|
||||||
|
|| CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
|
||||||
|
+ (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nMaxRandomDelayTime)
|
||||||
|
#endif
|
||||||
|
+ m_lastSoundStart <= CTimer::GetTimeInMilliseconds()) {
|
||||||
|
m_queuedSound = audioToPlay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
310
src/peds/PedDebug.cpp
Normal file
310
src/peds/PedDebug.cpp
Normal file
|
@ -0,0 +1,310 @@
|
||||||
|
#include "common.h"
|
||||||
|
#ifndef MASTER
|
||||||
|
#include "main.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "Font.h"
|
||||||
|
#include "Ped.h"
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "Text.h"
|
||||||
|
|
||||||
|
|
||||||
|
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",
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawPedDestination(CPed *, int, int)
|
||||||
|
{
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawPedDesiredHeading(CPed *, int, int)
|
||||||
|
{
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawCollisionRadius(float, float, float, float, int)
|
||||||
|
{
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawVisionRange(CVector a1, float)
|
||||||
|
{
|
||||||
|
for (int i = a1.x - 90; i < a1.x + 89; i += 30) {
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawVisionSimple(CVector, float)
|
||||||
|
{
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawLook()
|
||||||
|
{
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawPedPsyche()
|
||||||
|
{
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawDebugLines()
|
||||||
|
{
|
||||||
|
#ifndef FINAL
|
||||||
|
// TODO: something was here
|
||||||
|
#endif // !FINAL
|
||||||
|
}
|
||||||
|
|
||||||
|
int nDisplayDebugInfo = 0;
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::SwitchDebugDisplay(void)
|
||||||
|
{
|
||||||
|
if (++nDisplayDebugInfo > 2)
|
||||||
|
nDisplayDebugInfo = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
CPed::GetDebugDisplay(void)
|
||||||
|
{
|
||||||
|
return nDisplayDebugInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugDrawLookAtPoints()
|
||||||
|
{
|
||||||
|
// TODO: mobile code
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPed::DebugRenderClosePedText()
|
||||||
|
{
|
||||||
|
// TODO: mobile code
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in a new issue