1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-07 17:34:55 +00:00

EmergencyPed, PedDebug, message fix

This commit is contained in:
erorcun 2020-10-21 21:27:13 +03:00
parent ff2665942e
commit 86002b093f
4 changed files with 72 additions and 38 deletions

View file

@ -142,7 +142,7 @@ enum eSound : uint16
SOUND_PED_TAXI_WAIT, SOUND_PED_TAXI_WAIT,
SOUND_PED_ATTACK, SOUND_PED_ATTACK,
SOUND_PED_DEFEND, SOUND_PED_DEFEND,
SOUND_140, SOUND_PED_HEALING,
SOUND_PED_LEAVE_VEHICLE, SOUND_PED_LEAVE_VEHICLE,
SOUND_PED_EVADE, SOUND_PED_EVADE,
SOUND_PED_FLEE_RUN, SOUND_PED_FLEE_RUN,

View file

@ -9,6 +9,8 @@
#include "CarCtrl.h" #include "CarCtrl.h"
#include "Accident.h" #include "Accident.h"
// --MIAMI: file done
CEmergencyPed::CEmergencyPed(uint32 type) : CPed(type) CEmergencyPed::CEmergencyPed(uint32 type) : CPed(type)
{ {
switch (type){ switch (type){
@ -97,7 +99,7 @@ CEmergencyPed::FiremanAI(void)
case EMERGENCY_PED_READY: case EMERGENCY_PED_READY:
nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist); nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist);
if (nearestFire) { if (nearestFire) {
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetSeek(nearestFire->m_vecPos, 1.0f); SetSeek(nearestFire->m_vecPos, 1.0f);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE; m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
@ -110,7 +112,7 @@ CEmergencyPed::FiremanAI(void)
case EMERGENCY_PED_DETERMINE_NEXT_STATE: case EMERGENCY_PED_DETERMINE_NEXT_STATE:
nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist); nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist);
if (nearestFire && nearestFire != m_pAttendedFire) { if (nearestFire && nearestFire != m_pAttendedFire) {
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetSeek(nearestFire->m_vecPos, 1.0f); SetSeek(nearestFire->m_vecPos, 1.0f);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -149,7 +151,7 @@ CEmergencyPed::FiremanAI(void)
#ifdef FIX_BUGS #ifdef FIX_BUGS
bIsRunning = false; bIsRunning = false;
#endif #endif
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetWanderPath(CGeneral::GetRandomNumber() & 7); SetWanderPath(CGeneral::GetRandomNumber() & 7);
m_pAttendedFire = nil; m_pAttendedFire = nil;
m_nEmergencyPedState = EMERGENCY_PED_READY; m_nEmergencyPedState = EMERGENCY_PED_READY;
@ -164,15 +166,20 @@ CEmergencyPed::MedicAI(void)
{ {
float distToEmergency; float distToEmergency;
if (!bInVehicle && IsPedInControl()) { if (!bInVehicle && IsPedInControl()) {
ScanForThreats(); ScanForDelayedResponseThreats();
if (m_threatEntity && m_threatEntity->IsPed() && ((CPed*)m_threatEntity)->IsPlayer()) { if (m_threatFlags && CTimer::GetTimeInMilliseconds() > m_threatCheckTimer) {
if (((CPed*)m_threatEntity)->GetWeapon()->IsTypeMelee()) { CheckThreatValidity();
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity); m_threatFlags = 0;
} else { m_threatCheckTimer = 0;
SetFlee(m_threatEntity, 6000); if (m_threatEntity && m_threatEntity->IsPed() && ((CPed*)m_threatEntity)->IsPlayer()) {
Say(SOUND_PED_FLEE_SPRINT); if (((CPed*)m_threatEntity)->GetWeapon()->IsTypeMelee()) {
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
} else {
SetFlee(m_threatEntity, 6000);
Say(SOUND_PED_FLEE_SPRINT);
}
return;
} }
return;
} }
} }
@ -225,8 +232,7 @@ CEmergencyPed::MedicAI(void)
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed); m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID); m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD); m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
SetSeek((headPos + midPos) * 0.5f, 1.0f); SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
SetObjective(OBJECTIVE_NONE);
bIsRunning = true; bIsRunning = true;
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE; m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
m_pAttendedAccident = nearestAccident; m_pAttendedAccident = nearestAccident;
@ -239,6 +245,7 @@ CEmergencyPed::MedicAI(void)
CPed* driver = m_pMyVehicle->pDriver; CPed* driver = m_pMyVehicle->pDriver;
if (driver && driver->m_nPedType != PEDTYPE_EMERGENCY && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { if (driver && driver->m_nPedType != PEDTYPE_EMERGENCY && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, driver); SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, driver);
} else if (m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER } else if (m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER
&& m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER
&& m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
@ -265,8 +272,7 @@ CEmergencyPed::MedicAI(void)
} }
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID); m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD); m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
SetSeek((headPos + midPos) * 0.5f, nearestAccident->m_nMedicsPerformingCPR * 0.5f + 1.0f); SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
SetObjective(OBJECTIVE_NONE);
bIsRunning = true; bIsRunning = true;
--m_pAttendedAccident->m_nMedicsAttending; --m_pAttendedAccident->m_nMedicsAttending;
++nearestAccident->m_nMedicsAttending; ++nearestAccident->m_nMedicsAttending;
@ -296,11 +302,11 @@ CEmergencyPed::MedicAI(void)
} else { } else {
m_pRevivedPed->m_bloodyFootprintCountOrDeathTime = CTimer::GetTimeInMilliseconds(); m_pRevivedPed->m_bloodyFootprintCountOrDeathTime = CTimer::GetTimeInMilliseconds();
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
m_nPedState = PED_CPR; SetPedState(PED_CPR);
m_nLastPedState = PED_CPR; m_nLastPedState = PED_CPR;
SetLookFlag(m_pRevivedPed, 0); SetLookFlag(m_pRevivedPed, 0);
SetLookTimer(500); SetLookTimer(500);
//Say(SOUND_PED_HEALING); Say(SOUND_PED_HEALING);
if (m_pAttendedAccident->m_nMedicsPerformingCPR) { if (m_pAttendedAccident->m_nMedicsPerformingCPR) {
SetIdle(); SetIdle();
m_nEmergencyPedState = EMERGENCY_PED_STAND_STILL; m_nEmergencyPedState = EMERGENCY_PED_STAND_STILL;
@ -355,12 +361,12 @@ CEmergencyPed::MedicAI(void)
break; break;
} }
m_nEmergencyPedState = EMERGENCY_PED_STOP_CPR; m_nEmergencyPedState = EMERGENCY_PED_STOP_CPR;
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
m_pVehicleAnim = nil; m_pVehicleAnim = nil;
if (!m_pRevivedPed->bBodyPartJustCameOff) { if (!m_pRevivedPed->bBodyPartJustCameOff) {
m_pRevivedPed->m_fHealth = 100.0f; m_pRevivedPed->m_fHealth = 100.0f;
m_pRevivedPed->m_nPedState = PED_NONE; m_pRevivedPed->SetPedState(PED_NONE);
m_pRevivedPed->m_nLastPedState = PED_WANDER_PATH; m_pRevivedPed->m_nLastPedState = PED_WANDER_PATH;
m_pRevivedPed->SetGetUp(); m_pRevivedPed->SetGetUp();
m_pRevivedPed->bUsesCollision = true; m_pRevivedPed->bUsesCollision = true;
@ -369,6 +375,8 @@ CEmergencyPed::MedicAI(void)
m_pRevivedPed->bIsPedDieAnimPlaying = false; m_pRevivedPed->bIsPedDieAnimPlaying = false;
m_pRevivedPed->bKnockedUpIntoAir = false; m_pRevivedPed->bKnockedUpIntoAir = false;
m_pRevivedPed->m_pCollidingEntity = nil; m_pRevivedPed->m_pCollidingEntity = nil;
m_pRevivedPed->bKnockedOffBike = false;
m_pRevivedPed->Say(SOUND_PED_ACCIDENTREACTION1);
} }
break; break;
case EMERGENCY_PED_STOP_CPR: case EMERGENCY_PED_STOP_CPR:
@ -389,7 +397,7 @@ CEmergencyPed::MedicAI(void)
break; break;
case EMERGENCY_PED_STOP: case EMERGENCY_PED_STOP:
m_bStartedToCPR = false; m_bStartedToCPR = false;
m_nPedState = PED_NONE; SetPedState(PED_NONE);
if (m_pAttendedAccident) { if (m_pAttendedAccident) {
m_pAttendedAccident->m_pVictim = nil; m_pAttendedAccident->m_pVictim = nil;
--m_pAttendedAccident->m_nMedicsAttending; --m_pAttendedAccident->m_nMedicsAttending;

View file

@ -7,11 +7,10 @@
#include "Sprite.h" #include "Sprite.h"
#include "Text.h" #include "Text.h"
// TODO(Miami)
static char ObjectiveText[][28] = { static char ObjectiveText[][28] = {
"No Obj", "No Obj",
"Wait on Foot", "Wait on Foot",
"Wait on Foot For Cop", "Wait on Foot for cop",
"Flee on Foot Till Safe", "Flee on Foot Till Safe",
"Guard Spot", "Guard Spot",
"Guard Area", "Guard Area",
@ -22,8 +21,8 @@ static char ObjectiveText[][28] = {
"Flee Char on Foot Till Safe", "Flee Char on Foot Till Safe",
"Flee Char on Foot Always", "Flee Char on Foot Always",
"GoTo Char on Foot", "GoTo Char on Foot",
"GoTo Char on Foot Walking", "GoTo Char on Foot walking",
"Hassle Char", "Hassle char",
"Follow Char in Formation", "Follow Char in Formation",
"Leave Car", "Leave Car",
"Enter Car as Passenger", "Enter Car as Passenger",
@ -40,14 +39,30 @@ static char ObjectiveText[][28] = {
"Guard Attack", "Guard Attack",
"Set Leader", "Set Leader",
"Follow Route", "Follow Route",
"Solicit", "Solicit vehicle",
"Take Taxi", "Take Taxi",
"Catch Train", "Catch Train",
"Buy IceCream", "Buy IceCream",
"Steal Any Car", "Steal Any Car",
"Steal Any Mission Car", "Steal any mission car",
"Mug Char", "Mug Char",
"Leave Car and Die", "Lv car die",
"Goto seat",
"Goto atm",
"Flee car",
"Sunbathe",
"Goto bus stop",
"Goto pizza",
"Goto shelter",
"Aim gun at",
"Wander",
"Wait on foot at shltr",
"Sprint to area",
"Kill char on boat",
"Solicit ped",
"Wait at bus stop",
"Goto ice cream van foot",
"Wait foot icecream van"
}; };
static char StateText[][18] = { static char StateText[][18] = {
@ -84,11 +99,11 @@ static char StateText[][18] = {
"Investigate", "Investigate",
"Step away", "Step away",
"On Fire", "On Fire",
"Sun Bathe", "Bathe",
"Flash", "Flash",
"Jog", "Jog",
"Answer Mobile", "Answer mobile",
"Unknown", "Hang out",
"STATES_NO_AI", "STATES_NO_AI",
"Abseil", "Abseil",
"Sit", "Sit",
@ -114,7 +129,7 @@ static char StateText[][18] = {
"Exit Car", "Exit Car",
"Hands Up", "Hands Up",
"Arrested", "Arrested",
"Deploying Stinger" "Deply stgr"
}; };
static char PersonalityTypeText[][18] = { static char PersonalityTypeText[][18] = {
@ -141,8 +156,7 @@ static char PersonalityTypeText[][18] = {
"Geek Girl", "Geek Girl",
"Old Girl", "Old Girl",
"Tough Girl", "Tough Girl",
"Tramp Male", "Tramp",
"Tramp Female",
"Tourist", "Tourist",
"Prostitute", "Prostitute",
"Criminal", "Criminal",
@ -151,8 +165,6 @@ static char PersonalityTypeText[][18] = {
"Psycho", "Psycho",
"Steward", "Steward",
"Sports Fan", "Sports Fan",
"Shopper",
"Old Shopper"
}; };
static char WaitStateText[][16] = { static char WaitStateText[][16] = {
@ -177,6 +189,21 @@ static char WaitStateText[][16] = {
"Play HandsCower", "Play HandsCower",
"Play Chat", "Play Chat",
"Finish Flee", "Finish Flee",
"Sit down",
"Sit down rvrs",
"Sit up",
"Sit idle",
"Use atm",
"Sunbth pre",
"Sunbth down",
"Sunbth idle",
"Riot",
"Fast fall",
"Bomber",
"Stripper",
"Ground attack",
"Lance sitting",
"Handsup simple"
}; };
void void

View file

@ -390,12 +390,11 @@ CMessages::InsertNumberInString(wchar *str, int32 n1, int32 n2, int32 n3, int32
if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') { if (str[c] == '~' && str[c + 1] == '1' && str[c + 2] == '~') {
#endif #endif
c += 3; c += 3;
for (int j = 0; j < outLen; j++) for (int j = 0; j < outLen; )
*(outstr++) = wNumStr[j++]; *(outstr++) = wNumStr[j++];
i++; i++;
switch (i) { switch (i) {
case 0: sprintf(numStr, "%d", n1); break;
case 1: sprintf(numStr, "%d", n2); break; case 1: sprintf(numStr, "%d", n2); break;
case 2: sprintf(numStr, "%d", n3); break; case 2: sprintf(numStr, "%d", n3); break;
case 3: sprintf(numStr, "%d", n4); break; case 3: sprintf(numStr, "%d", n4); break;