summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/animation/AnimManager.cpp2
-rw-r--r--src/animation/AnimationId.h2
-rw-r--r--src/audio/AudioLogic.cpp53
-rw-r--r--src/audio/AudioManager.h2
-rw-r--r--src/audio/soundlist.h138
-rw-r--r--src/control/PathFind.cpp10
-rw-r--r--src/control/PathFind.h5
-rw-r--r--src/control/Script.cpp31
-rw-r--r--src/core/Frontend.cpp55
-rw-r--r--src/core/Frontend.h2
-rw-r--r--src/core/MenuScreens.h10
-rw-r--r--src/core/PlayerInfo.cpp2
-rw-r--r--src/modelinfo/ModelIndices.h1
-rw-r--r--src/peds/CopPed.cpp7
-rw-r--r--src/peds/EmergencyPed.cpp2
-rw-r--r--src/peds/Ped.cpp1183
-rw-r--r--src/peds/Ped.h29
-rw-r--r--src/peds/PlayerPed.cpp14
-rw-r--r--src/peds/Population.cpp13
-rw-r--r--src/peds/Population.h1
-rw-r--r--src/render/Hud.cpp2
-rw-r--r--src/vehicles/Automobile.cpp17
-rw-r--r--src/vehicles/Bike.h2
-rw-r--r--src/vehicles/Train.cpp4
-rw-r--r--src/weapons/Weapon.cpp137
-rw-r--r--src/weapons/Weapon.h1
26 files changed, 1088 insertions, 637 deletions
diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp
index fab28c8d..c2f1c8bc 100644
--- a/src/animation/AnimManager.cpp
+++ b/src/animation/AnimManager.cpp
@@ -158,7 +158,7 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_CAR_CRAWLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CRAWLOUT_RHS2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_ROLLOUT_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
- { ANIM_CAR_ROLLOUT_LHS2, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
+ { ANIM_CAR_ROLLOUT_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
{ ANIM_GETUP1, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_GETUP2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_GETUP3, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
diff --git a/src/animation/AnimationId.h b/src/animation/AnimationId.h
index a84aa3e8..18d31cae 100644
--- a/src/animation/AnimationId.h
+++ b/src/animation/AnimationId.h
@@ -146,7 +146,7 @@ enum AnimationId
ANIM_CAR_CRAWLOUT_RHS,
ANIM_CAR_CRAWLOUT_RHS2,
ANIM_CAR_ROLLOUT_LHS,
- ANIM_CAR_ROLLOUT_LHS2, // was this meant to be RHS?
+ ANIM_CAR_ROLLOUT_RHS, // was this meant to be RHS?
ANIM_GETUP1,
ANIM_GETUP2,
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 2767c7ef..6fe63fae 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -1639,27 +1639,31 @@ cAudioManager::UsesSirenSwitching(int32 model) const
}
}
-void
+bool
cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
{
const float SOUND_INTENSITY = 110.0f;
if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
CVehicle *veh = params->m_pVehicle;
- if (veh->m_bSirenOrAlarm == false && veh->m_nAlarmState <= 0)
- return;
+ if (veh->m_bSirenOrAlarm == false && !veh->IsAlarmOn())
+ return true;
+
+ if (veh->IsAlarmOn()) {
+ if (CTimer::GetTimeInMilliseconds() > veh->m_bRainAudioCounter)
+ veh->m_bRainAudioCounter = CTimer::GetTimeInMilliseconds() + 750;
+
+ if (veh->m_bRainAudioCounter < CTimer::GetTimeInMilliseconds() + 375)
+ return true;
+ }
-#ifdef FIX_BUGS
- if (params->m_pVehicle->GetStatus() == STATUS_WRECKED)
- return;
-#endif
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(veh->bIsDrowning ? 20 : 80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 5;
if (UsesSiren(params->m_nIndex)) {
if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED)
- return;
+ return true;
if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) {
m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST;
if (params->m_nIndex == FBICAR)
@@ -1689,8 +1693,11 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
- }
- }
+ return true;
+ } else
+ return true;
+ } else
+ return false;
}
bool
@@ -2144,8 +2151,8 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
maxDist = SQR(SOUND_INTENSITY);
break;
}*/
- case SOUND_18:
- case SOUND_19: {
+ case SOUND_TRAIN_DOOR_CLOSE:
+ case SOUND_TRAIN_DOOR_OPEN: {
const float SOUND_INTENSITY = 35.0f;
m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
@@ -2235,7 +2242,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
break;
}
case SOUND_BOMB_TIMED_ACTIVATED:
- case SOUND_55:
+ case SOUND_91:
case SOUND_BOMB_ONIGNITION_ACTIVATED:
case SOUND_BOMB_TICK: {
const float SOUND_INTENSITY = 50.0f;
@@ -2259,14 +2266,14 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
pedParams.m_fDistance = params->m_fDistance;
SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND);
continue;
- case SOUND_PED_BODYCAST_HIT:
+ /* case SOUND_PED_BODYCAST_HIT:
pedParams.m_pPed = nil;
pedParams.m_bDistanceCalculated = false;
pedParams.m_fDistance = 0.0f;
pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated;
pedParams.m_fDistance = params->m_fDistance;
SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT);
- continue;
+ continue; */
case SOUND_WATER_FALL: {
const float SOUND_INTENSITY = 40.0f;
m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1;
@@ -2499,7 +2506,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
if (LastAccel > 20) {
oneShotVol = LastVol;
- PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17, oneShotVol);
+ PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_BOAT_SLOWDOWN, oneShotVol);
}
} else {
emittingVol = 105 * padAccelerate / 255 + 15;
@@ -3604,8 +3611,6 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_bRequireReflection = true;
break;
case SOUND_WEAPON_AK47_BULLET_ECHO:
- case SOUND_WEAPON_UZI_BULLET_ECHO:
- case SOUND_WEAPON_M16_BULLET_ECHO:
m_sQueueSample.m_nSampleIndex = SFX_UZI_END_LEFT;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nCounter = iSound++;
@@ -3781,11 +3786,11 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
if (sound != SOUND_PAGER) {
switch (sound) {
- case SOUND_AMMUNATION_WELCOME_1:
+ /*case SOUND_AMMUNATION_WELCOME_1:
case SOUND_AMMUNATION_WELCOME_2:
case SOUND_AMMUNATION_WELCOME_3:
emittingVol = MAX_VOLUME;
- break;
+ break; */
default:
if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false))
emittingVol = MAX_VOLUME;
@@ -4664,10 +4669,6 @@ cAudioManager::ProcessFrontEnd()
m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT_LEFT;
stereo = true;
break;
- case SOUND_FRONTEND_MENU_DENIED:
- m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT_LEFT;
- stereo = true;
- break;
case SOUND_FRONTEND_MENU_SUCCESS:
m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT_LEFT;
stereo = true;
@@ -4687,7 +4688,7 @@ cAudioManager::ProcessFrontEnd()
case SOUND_FRONTEND_RADIO_CHANGE:
m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK;
break;
- //case SOUND_A0:
+ //case SOUND_HUD_SOUND:
// m_sQueueSample.m_nSampleIndex = SFX_INFO;
// break;
default:
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 0b24c2e9..b0078bc4 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -339,7 +339,7 @@ public:
void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params);
bool ProcessVehicleRoadNoise(cVehicleParams *params);
- void ProcessVehicleSirenOrAlarm(cVehicleParams *params);
+ bool ProcessVehicleSirenOrAlarm(cVehicleParams *params);
void ProcessVehicleSkidding(cVehicleParams *params);
void ProcessWaterCannon(int32);
void ProcessWeather(int32 id);
diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h
index 6d1ff6e3..f812cf72 100644
--- a/src/audio/soundlist.h
+++ b/src/audio/soundlist.h
@@ -16,8 +16,10 @@ enum eSound : uint16
SOUND_CAR_DOOR_OPEN_BACK_RIGHT,
SOUND_CAR_WINDSHIELD_CRACK,
SOUND_CAR_JUMP,
- SOUND_E,
- SOUND_F,
+ SOUND_CAR_JUMP_2,
+ SOUND_CAR_TYRE_POP,
+ SOUND_16,
+ SOUND_17,
SOUND_CAR_ENGINE_START,
SOUND_CAR_LIGHT_BREAK,
SOUND_CAR_HYDRAULIC_1,
@@ -25,12 +27,14 @@ enum eSound : uint16
SOUND_CAR_HYDRAULIC_3,
SOUND_CAR_JERK,
SOUND_CAR_SPLASH,
- SOUND_17,
- SOUND_18,
- SOUND_19,
+ SOUND_BOAT_SLOWDOWN,
+ SOUND_TRAIN_DOOR_CLOSE,
+ SOUND_TRAIN_DOOR_OPEN,
SOUND_CAR_TANK_TURRET_ROTATE,
SOUND_CAR_BOMB_TICK,
SOUND_PLANE_ON_GROUND,
+ SOUND_31,
+ SOUND_32,
SOUND_STEP_START,
SOUND_STEP_END,
SOUND_FALL_LAND,
@@ -47,13 +51,15 @@ enum eSound : uint16
SOUND_FIGHT_PUNCH_FROM_BEHIND_42,
SOUND_FIGHT_KNEE_OR_KICK_43,
SOUND_FIGHT_KICK_44,
- SOUND_2D,
+ SOUND_49,
SOUND_WEAPON_BAT_ATTACK,
+ SOUND_WEAPON_UNK_MELEE_ATTACK,
+ SOUND_WEAPON_CHAINSAW_ATTACK,
+ SOUND_WEAPON_CHAINSAW_IDLE,
+ SOUND_WEAPON_CHAINSAW_MADECONTACT,
SOUND_WEAPON_SHOT_FIRED,
SOUND_WEAPON_RELOAD,
SOUND_WEAPON_AK47_BULLET_ECHO,
- SOUND_WEAPON_UZI_BULLET_ECHO,
- SOUND_WEAPON_M16_BULLET_ECHO,
SOUND_WEAPON_FLAMETHROWER_FIRE,
SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM,
SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM,
@@ -66,8 +72,8 @@ enum eSound : uint16
SOUND_GARAGE_BOMB1_SET,
SOUND_GARAGE_BOMB2_SET,
SOUND_GARAGE_BOMB3_SET,
- SOUND_40,
- SOUND_41,
+ SOUND_70,
+ SOUND_71,
SOUND_GARAGE_VEHICLE_DECLINED,
SOUND_GARAGE_VEHICLE_ACCEPTED,
SOUND_GARAGE_DOOR_CLOSED,
@@ -76,8 +82,8 @@ enum eSound : uint16
SOUND_PICKUP_WEAPON_BOUGHT,
SOUND_PICKUP_WEAPON,
SOUND_PICKUP_HEALTH,
- SOUND_4A,
- SOUND_4B,
+ SOUND_80,
+ SOUND_81,
SOUND_PICKUP_ADRENALINE,
SOUND_PICKUP_ARMOUR,
SOUND_PICKUP_BONUS,
@@ -87,7 +93,7 @@ enum eSound : uint16
SOUND_PICKUP_PACMAN_PACKAGE,
SOUND_PICKUP_FLOAT_PACKAGE,
SOUND_BOMB_TIMED_ACTIVATED,
- SOUND_55,
+ SOUND_91,
SOUND_BOMB_ONIGNITION_ACTIVATED,
SOUND_BOMB_TICK,
SOUND_RAMPAGE_START,
@@ -99,48 +105,62 @@ enum eSound : uint16
SOUND_EVIDENCE_PICKUP,
SOUND_UNLOAD_GOLD,
SOUND_PAGER,
- SOUND_PED_DEATH, // 103 in VC
- SOUND_PED_DAMAGE, // 104 in VC
- SOUND_PED_HIT, // 105 in VC
- SOUND_PED_LAND, // hopefully 106 in VC
+ SOUND_PED_DEATH,
+ SOUND_PED_DAMAGE,
+ SOUND_PED_HIT,
+ SOUND_PED_LAND,
SOUND_PED_BULLET_HIT,
- SOUND_PED_BOMBER,
- SOUND_PED_BURNING, // 108 in VC
- SOUND_PED_ARREST_FBI,
- SOUND_PED_ARREST_SWAT,
+ SOUND_PED_BURNING,
+ SOUND_PED_PLAYER_REACTTOCOP,
SOUND_PED_ARREST_COP,
+ SOUND_111,
+ SOUND_PED_COP_HELIPILOTPHRASE,
+ SOUND_PED_PULLOUTWEAPON,
SOUND_PED_HELI_PLAYER_FOUND,
+ SOUND_115,
+ SOUND_PED_ON_FIRE,
+ SOUND_PED_AIMING,
SOUND_PED_HANDS_UP,
SOUND_PED_HANDS_COWER,
- SOUND_PED_FLEE_SPRINT, // 120 in VC
+ SOUND_PED_FLEE_SPRINT,
SOUND_PED_CAR_JACKING,
SOUND_PED_MUGGING,
SOUND_PED_CAR_JACKED,
SOUND_PED_ROBBED,
- SOUND_PED_TAXI_WAIT, // 137 in VC
+ SOUND_PED_ACCIDENTREACTION1,
+ SOUND_PED_UNK_126,
+ SOUND_PED_PLAYER_AFTERSEX,
+ SOUND_PED_PLAYER_BEFORESEX,
+ SOUND_PED_COP_UNK_129, // also used for medics
+ SOUND_PED_COP_MANYCOPSAROUND, // also used for medics
+ SOUND_PED_GUNAIMEDAT2,
+ SOUND_PED_COP_ALONE, // also used for medics
+ SOUND_PED_GUNAIMEDAT3,
+ SOUND_PED_COP_REACTION,
+ SOUND_PED_COP_LITTLECOPSAROUND, // also used for medics
+ SOUND_PED_PLAYER_FARFROMCOPS, // also used for medics
+ SOUND_PED_TAXI_WAIT,
SOUND_PED_ATTACK,
SOUND_PED_DEFEND,
- SOUND_PED_PURSUIT_ARMY,
- SOUND_PED_PURSUIT_FBI,
- SOUND_PED_PURSUIT_SWAT,
- SOUND_PED_PURSUIT_COP,
- SOUND_PED_HEALING,
- SOUND_PED_7B,
+ SOUND_140,
SOUND_PED_LEAVE_VEHICLE,
- SOUND_PED_EVADE, // 142 in VC
+ SOUND_PED_EVADE,
SOUND_PED_FLEE_RUN,
- SOUND_PED_CAR_COLLISION, // 144-145-146 in VC
+ SOUND_PED_CAR_COLLISION,
+ SOUND_PED_BOAT_COLLISION,
+ SOUND_PED_HORN_ACTIVE,
+ SOUND_PED_147,
SOUND_PED_SOLICIT,
+ SOUND_PED_149,
+ SOUND_PED_150,
SOUND_PED_EXTINGUISHING_FIRE,
SOUND_PED_WAIT_DOUBLEBACK,
+ SOUND_153,
SOUND_PED_CHAT_SEXY,
SOUND_PED_CHAT_EVENT,
+ SOUND_PED_PED_COLLISION,
SOUND_PED_CHAT,
- SOUND_PED_BODYCAST_HIT,
SOUND_PED_TAXI_CALL,
- SOUND_INJURED_PED_MALE_OUCH,
- SOUND_INJURED_PED_FEMALE,
- SOUND_INJURED_PED_MALE_PRISON,
SOUND_RACE_START_3,
SOUND_RACE_START_2,
SOUND_RACE_START_1,
@@ -151,25 +171,43 @@ enum eSound : uint16
SOUND_CAR_PED_COLLISION,
SOUND_CLOCK_TICK,
SOUND_PART_MISSION_COMPLETE,
- SOUND_FRONTEND_MENU_STARTING,
+ SOUND_FRONTEND_MENU_STARTING, // same with SOUND_HUD_SOUND
+
+ // TODO(Miami): What are 170-175??
+
+ SOUND_FRONTEND_NO_RADIO = 176, // those 3 are all same sound
+ SOUND_FRONTEND_RADIO_CHANGE,
+ SOUND_FRONTEND_RADIO_CHANGE_2,
+ SOUND_HUD_SOUND,
+ SOUND_180,
+ SOUND_181,
+ SOUND_182,
+ SOUND_LIGHTNING,
+ SOUND_BULLETTRACE_1,
+ SOUND_BULLETTRACE_2,
+ SOUND_186, // makes same sound with 40
+ SOUND_187, // makes same sound with 46
+ SOUND_MELEE_ATTACK_START,
+ SOUND_189,
+ SOUND_WEAPON_MINIGUN_ATTACK,
+ SOUND_WEAPON_MINIGUN_2,
+ SOUND_WEAPON_MINIGUN_3,
+ SOUND_AMMUNATION_IMRAN_ARM_BOMB,
+ SOUND_194,
+
+ // TODO(Miami): They're frontend sounds but names are copy-paste and incorrect
SOUND_FRONTEND_MENU_COMPLETED,
- SOUND_FRONTEND_MENU_DENIED,
+ SOUND_FRONTEND_FAIL,
SOUND_FRONTEND_MENU_SUCCESS,
SOUND_FRONTEND_EXIT,
- SOUND_9A,
- SOUND_9B,
SOUND_FRONTEND_AUDIO_TEST,
- SOUND_FRONTEND_FAIL,
- SOUND_FRONTEND_NO_RADIO,
- SOUND_FRONTEND_RADIO_CHANGE,
- SOUND_A0,
- SOUND_AMMUNATION_WELCOME_1,
- SOUND_AMMUNATION_WELCOME_2,
- SOUND_AMMUNATION_WELCOME_3,
- SOUND_LIGHTNING,
- SOUND_A5,
- SOUND_TOTAL_SOUNDS,
- SOUND_NO_SOUND,
+
+ SOUND_INJURED_PED_MALE_OUCH,
+ SOUND_INJURED_PED_FEMALE,
+ SOUND_SET_202,
+ SOUND_SET_203,
+ SOUND_TOTAL_SOUNDS = 204,
+ SOUND_NO_SOUND = 205,
};
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 4a948032..0dd9359c 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -23,7 +23,6 @@ CPathFind ThePaths;
#define NUMDETACHED_PEDS 1214
#define NUMTEMPEXTERNALNODES 4600
-
CPathInfoForObject *InfoForTileCars;
CPathInfoForObject *InfoForTilePeds;
@@ -1861,6 +1860,15 @@ CPathFind::DisplayPathData(void)
}
}
+CVector
+CPathFind::TakeWidthIntoAccountForWandering(CPathNode* nextNode, uint16 random)
+{
+ CVector pos = nextNode->GetPosition();
+ float newX = (nextNode->GetPedNodeWidth() * ((random % 16) - 7)) + pos.x;
+ float newY = (nextNode->GetPedNodeWidth() * (((random / 16) % 16) - 7)) + pos.y;
+ return CVector(newX, newY, pos.z);
+}
+
CPathNode*
CPathFind::GetNode(int16 index)
{
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index e481f4c6..2896237a 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -62,7 +62,7 @@ struct CPathNode
int16 z;
int16 distance; // in path search
int16 firstLink;
- int8 width;
+ uint8 width;
int8 group;
uint8 numLinks : 4;
@@ -89,6 +89,7 @@ struct CPathNode
float GetZ(void) { return z/8.0f; }
bool HasDivider(void) { return width != 0; }
float GetDividerWidth(void) { return width/(2*8.0f); }
+ float GetPedNodeWidth(void) { return width*(31.f/(500.f * 8.f)); }
CPathNode *GetPrev(void);
CPathNode *GetNext(void);
void SetPrev(CPathNode *node);
@@ -253,6 +254,8 @@ public:
void Save(uint8 *buf, uint32 *size);
void Load(uint8 *buf, uint32 size);
+ static CVector TakeWidthIntoAccountForWandering(CPathNode*, uint16);
+
CPathNode *GetNode(int16 index);
int16 GetIndex(CPathNode *node);
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index d238f276..f59701b3 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -9913,13 +9913,21 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
StoreParameters(&m_nIp, 3);
return 0;
case COMMAND_ATTACH_CHAR_TO_CAR:
- // TODO(MIAMI)
- assert(0);
+ {
+ CollectParameters(&m_nIp, 8);
+ CPed *pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CVehicle *pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
+ pPed->AttachPedToEntity(pVehicle, *(CVector*)&ScriptParams[2], ScriptParams[5], DEGTORAD(ScriptParams[6]), (eWeaponType)ScriptParams[7]);
return 0;
+ }
case COMMAND_DETACH_CHAR_FROM_CAR:
- // TODO(MIAMI)
- assert(0);
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed *pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ if (pPed && pPed->m_attachedTo)
+ pPed->DettachPedFromEntity();
return 0;
+ }
case COMMAND_SET_CAR_CHANGE_LANE: // for some reason changed in SA
{
CollectParameters(&m_nIp, 2);
@@ -10964,14 +10972,15 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
- debug("SET_CHAR_SHUFFLE_INTO_DRIVERS_SEAT is not implemented\n");
+ pPed->PedShuffle();
return 0;
}
case COMMAND_ATTACH_CHAR_TO_OBJECT:
{
CollectParameters(&m_nIp, 8);
- debug("ATTACH_CHAR_TO_OBJECT is not implemented\n");
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ pPed->AttachPedToEntity(pObject, *(CVector*)&ScriptParams[2], ScriptParams[5], DEGTORAD(ScriptParams[6]), (eWeaponType)ScriptParams[7]);
return 0;
}
case COMMAND_SET_CHAR_AS_PLAYER_FRIEND:
@@ -11309,7 +11318,11 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
case COMMAND_SET_CHAR_ANSWERING_MOBILE:
{
CollectParameters(&m_nIp, 2);
- debug("SET_CHAR_ANSWERING_MOBILE not implemented\n"); // TODO(MIAMI)
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ if (ScriptParams[1])
+ pPed->SetAnswerMobile();
+ else
+ pPed->ClearAnswerMobile();
return 0;
}
case COMMAND_SET_PLAYER_DRUNKENNESS:
@@ -11988,7 +12001,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_ADD_BIG_GUN_FLASH:
{
CollectParameters(&m_nIp, 6);
- debug("ADD_BIG_GUN_FLASH not implemented\n"); // TODO(MIAMI)
+ CWeapon::AddGunFlashBigGuns(*(CVector*)&ScriptParams[0], *(CVector*)&ScriptParams[3]);
return 0;
}
case COMMAND_HAS_CHAR_BOUGHT_ICE_CREAM:
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index af326d79..ce665185 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -319,7 +319,7 @@ CMenuManager::PageUpList(bool playSoundOnSuccess)
if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) {
if (m_nFirstVisibleRowOnList > 0) {
if(playSoundOnSuccess)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nFirstVisibleRowOnList = Max(0, m_nFirstVisibleRowOnList - MAX_VISIBLE_LIST_ROW);
m_nSelectedListRow = Min(m_nSelectedListRow, m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1);
@@ -337,7 +337,7 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) {
if (m_nFirstVisibleRowOnList < m_nTotalListRow - MAX_VISIBLE_LIST_ROW) {
if(playSoundOnSuccess)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nFirstVisibleRowOnList = Min(m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW, m_nTotalListRow - MAX_VISIBLE_LIST_ROW);
m_nSelectedListRow = Max(m_nSelectedListRow, m_nFirstVisibleRowOnList);
@@ -1297,13 +1297,14 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
}
#ifdef IMPROVED_VIDEOMODE
if (m_nSelectedScreenMode != m_nPrefsWindowed) {
- if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "SCRFOR") != 0
+ if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_POS") != 0
&& m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) {
m_nSelectedScreenMode = m_nPrefsWindowed;
}
}
#endif
+ // TODO(Miami): check
// Sliders
int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
@@ -1935,7 +1936,7 @@ CMenuManager::DrawControllerSetupScreen()
float curOptY = i * rowHeight + yStart;
if (m_nMousePosY > MENU_Y(curOptY) && m_nMousePosY < MENU_Y(rowHeight + curOptY)) {
if (m_nPrevOption != i && m_nCurrExLayer == HOVEROPTION_LIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nPrevOption = i;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
@@ -1949,7 +1950,7 @@ CMenuManager::DrawControllerSetupScreen()
if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(370.0f)) {
#endif
if (m_nSelectedContSetupColumn != CONTSETUP_PED_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
#ifdef FIX_BUGS
@@ -1958,7 +1959,7 @@ CMenuManager::DrawControllerSetupScreen()
} else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(370.0f) && m_nMousePosX < SCREEN_WIDTH) {
#endif
if (m_nSelectedContSetupColumn != CONTSETUP_VEHICLE_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
@@ -2653,7 +2654,7 @@ CMenuManager::DrawPlayerSetupScreen()
SaveSettings();
}
} else {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = rowIdx;
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
@@ -2809,7 +2810,7 @@ CMenuManager::DrawPlayerSetupScreen()
&& m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26))
|| m_nCurrExLayer == HOVEROPTION_BACK) {
if (m_nHoverOption != HOVEROPTION_BACK)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nHoverOption = HOVEROPTION_BACK;
@@ -2820,7 +2821,7 @@ CMenuManager::DrawPlayerSetupScreen()
&& m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26))
|| m_nCurrExLayer == HOVEROPTION_USESKIN) {
if (m_nHoverOption != HOVEROPTION_USESKIN)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nHoverOption = HOVEROPTION_USESKIN;
@@ -3588,7 +3589,7 @@ CMenuManager::ProcessButtonPresses(void)
++m_nPrevOption;
}
m_nOptionHighlightTransitionBlend = 0;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
}
}
@@ -3641,7 +3642,7 @@ CMenuManager::ProcessButtonPresses(void)
}
if (CPad::GetPad(0)->GetTabJustDown()) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_bShowMouse = false;
switch (m_nCurrExLayer) {
case HOVEROPTION_BACK:
@@ -3677,7 +3678,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!m_bPressedUpOnList) {
m_bPressedUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
ScrollUpListByOne();
}
} else {
@@ -3699,7 +3700,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!m_bPressedDownOnList) {
m_bPressedDownOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
ScrollDownListByOne();
}
} else {
@@ -3715,7 +3716,7 @@ CMenuManager::ProcessButtonPresses(void)
m_bPressedPgUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
PageUpList(false);
}
}
@@ -3727,14 +3728,14 @@ CMenuManager::ProcessButtonPresses(void)
m_bPressedPgDnOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
PageDownList(false);
}
}
if (CPad::GetPad(0)->GetHome()) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = 0;
}
@@ -3744,7 +3745,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetEnd()) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW;
}
@@ -3838,12 +3839,12 @@ CMenuManager::ProcessButtonPresses(void)
} else {
if (CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
goDown = true;
m_nOptionHighlightTransitionBlend = 0;
} else if (CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
goUp = true;
m_nOptionHighlightTransitionBlend = 0;
}
@@ -4118,14 +4119,14 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef PS2_LIKE_MENU
if (CPad::GetPad(0)->GetLeftMouseJustDown() && hoveredBottomBarOption != -1) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
bottomBarActive = false;
curBottomBarOption = hoveredBottomBarOption;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, false);
return;
} else if (bottomBarActive) {
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
bottomBarActive = false;
// If there's a menu change with fade ongoing, finish it now
@@ -4135,7 +4136,7 @@ CMenuManager::ProcessButtonPresses(void)
} else if (CPad::GetPad(0)->GetLeftJustDown() || CPad::GetPad(0)->GetAnaloguePadLeft() || CPad::GetPad(0)->GetDPadLeftJustDown()
|| CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
if (curBottomBarOption > 0)
curBottomBarOption--;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true);
@@ -4143,7 +4144,7 @@ CMenuManager::ProcessButtonPresses(void)
} else if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown()
|| CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
if (curBottomBarOption < bbTabCount-1)
curBottomBarOption++;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true);
@@ -4703,7 +4704,7 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_SCREENRES:
if (m_bGameNotLoaded) {
RwChar** videoMods = _psGetVideoModeList();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
if (changeValueBy > 0) {
do {
++m_nDisplayVideoMode;
@@ -4723,7 +4724,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
#ifdef IMPROVED_VIDEOMODE
case MENUACTION_SCREENMODE:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
m_nSelectedScreenMode = !m_nSelectedScreenMode;
break;
#endif
@@ -4732,7 +4733,7 @@ CMenuManager::ProcessButtonPresses(void)
m_nPrefsAudio3DProviderIndex += changeValueBy;
m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
break;
case MENUACTION_SPEAKERCONF:
if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) {
@@ -4757,7 +4758,7 @@ CMenuManager::ProcessButtonPresses(void)
} else {
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
}
}
}
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 20ada82b..33a229a7 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -344,7 +344,7 @@ enum eCheckHover
enum
{
#ifdef LEGACY_MENU_OPTIONS
- NUM_MENUROWS = 13,
+ NUM_MENUROWS = 14,
#else
NUM_MENUROWS = 12,
#endif
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index 2d23b199..cae65316 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -57,8 +57,14 @@ CMenuScreen aScreens[] = {
MENUACTION_RADARMODE, "FED_RDR", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 228 + Y_OFFSET, MENUALIGN_LEFT,
MENUACTION_HUD, "FED_HUD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 253 + Y_OFFSET, MENUALIGN_LEFT,
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 278 + Y_OFFSET, MENUALIGN_LEFT,
+#ifdef IMPROVED_VIDEOMODE
+ MENUACTION_SCREENMODE, "FED_POS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 303 + Y_OFFSET, MENUALIGN_LEFT,
+ MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 320, 328 + Y_OFFSET, MENUALIGN_CENTER,
+ MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 320, 353 + Y_OFFSET, MENUALIGN_CENTER,
+#else
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 320, 303 + Y_OFFSET, MENUALIGN_CENTER,
- MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 320, 328 + Y_OFFSET, 3
+ MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 320, 328 + Y_OFFSET, MENUALIGN_CENTER,
+#endif
},
#undef Y_OFFSET
@@ -75,7 +81,7 @@ CMenuScreen aScreens[] = {
// TODO(Miami): This is still my implementation
// MENUPAGE_MAP = 6
- { "FEG_MAP", MENUPAGE_NONE, 2,
+ { "FEH_MAP", MENUPAGE_NONE, 2,
MENUACTION_UNK110, "", SAVESLOT_NONE, 0, 0, 0, 0, // to prevent cross/enter to go back
MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 0, 0, 0,
},
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 08c8ac36..0be5f73e 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -402,7 +402,7 @@ CPlayerInfo::Process(void)
else
enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
- if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) {
+ if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) {
if (m_pPed->bInVehicle) {
if (!m_pRemoteVehicle) {
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index e7285b2f..e7ba9814 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -348,6 +348,7 @@ enum
MI_BODYPARTB,
MI_AIRTRAIN_VLO = 257,
+ MI_MOBILE = 258,
NUM_DEFAULT_MODELS = 300
};
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 6fb858f6..ae1f6c61 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -101,7 +101,7 @@ CCopPed::SetArrestPlayer(CPed *player)
{
if (!IsPedInControl() || !player)
return;
-
+ /*
switch (m_nCopType) {
case COP_FBI:
Say(SOUND_PED_ARREST_FBI);
@@ -112,7 +112,7 @@ CCopPed::SetArrestPlayer(CPed *player)
default:
Say(SOUND_PED_ARREST_COP);
break;
- }
+ } */
if (player->EnteringCar()) {
if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer)
return;
@@ -605,6 +605,7 @@ CCopPed::ProcessControl(void)
if (IsPedInControl())
SetIdle();
}
+ /*
if (m_bIsInPursuit) {
if (player->m_nPedState != PED_ARRESTED && !player->DyingOrDead()) {
switch (m_nCopType) {
@@ -622,7 +623,7 @@ CCopPed::ProcessControl(void)
break;
}
}
- }
+ } */
if (IsPedInControl()) {
CopAI();
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index 1988366d..44c3d066 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -308,7 +308,7 @@ CEmergencyPed::MedicAI(void)
m_nLastPedState = PED_CPR;
SetLookFlag(m_pRevivedPed, 0);
SetLookTimer(500);
- Say(SOUND_PED_HEALING);
+ //Say(SOUND_PED_HEALING);
if (m_pAttendedAccident->m_nMedicsPerformingCPR) {
SetIdle();
m_nEmergencyPedState = EMERGENCY_PED_STAND_STILL;
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 72f9bfae..61e52a0d 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -61,6 +61,7 @@
#include "PedAttractor.h"
#include "Debug.h"
#include "GameLogic.h"
+#include "Bike.h"
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
@@ -487,6 +488,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_fleeFromPosX = 0;
m_fleeFromPosY = 0;
m_fleeTimer = 0;
+ pThreatEx = nil;
m_vecSeekPosEx = CVector(0.0f, 0.0f, 0.0f);
m_distanceToCountSeekDoneEx = 0.0f;
m_nWaitState = WAITSTATE_FALSE;
@@ -831,6 +833,7 @@ CPed::IsPlayer(void)
m_nPedType == PEDTYPE_PLAYER3 || m_nPedType == PEDTYPE_PLAYER4;
}
+// --MIAMI: Done
bool
CPed::UseGroundColModel(void)
{
@@ -840,12 +843,14 @@ CPed::UseGroundColModel(void)
m_nPedState == PED_DEAD;
}
+// --MIAMI: Done
bool
CPed::CanSetPedState(void)
{
return !DyingOrDead() && m_nPedState != PED_ARRESTED && !EnteringCar() && m_nPedState != PED_STEAL_CAR;
}
+// --MIAMI: Done
bool
CPed::IsPedInControl(void)
{
@@ -854,6 +859,7 @@ CPed::IsPedInControl(void)
&& m_fHealth > 0.0f;
}
+// --MIAMI: Done
bool
CPed::CanStrafeOrMouseControl(void)
{
@@ -862,9 +868,10 @@ CPed::CanStrafeOrMouseControl(void)
return false;
#endif
return m_nPedState == PED_NONE || m_nPedState == PED_IDLE || m_nPedState == PED_FLEE_POS || m_nPedState == PED_FLEE_ENTITY ||
- m_nPedState == PED_ATTACK || m_nPedState == PED_FIGHT || m_nPedState == PED_AIM_GUN || m_nPedState == PED_JUMP;
+ m_nPedState == PED_ATTACK || m_nPedState == PED_FIGHT || m_nPedState == PED_AIM_GUN || m_nPedState == PED_JUMP || m_nPedState == PED_ANSWER_MOBILE;
}
+// --MIAMI: Done
void
CPed::AddWeaponModel(int id)
{
@@ -1059,6 +1066,7 @@ CPed::SetLookFlag(float direction, bool keepTryingToLook)
}
}
+// --MIAMI: Done
void
CPed::SetLookTimer(int time)
{
@@ -1137,6 +1145,8 @@ CPed::Avoid(void)
}
}
+
+// --MIAMI: Done
void
CPed::ClearAimFlag(void)
{
@@ -1144,6 +1154,7 @@ CPed::ClearAimFlag(void)
bIsAimingGun = false;
bIsRestoringGun = true;
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
+ m_lookTimer = 0;
}
if (IsPlayer())
@@ -1486,9 +1497,7 @@ CPed::Attack(void)
|| weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep > delayBetweenAnimAndFire) {
if (ourWeaponType == WEAPONTYPE_CHAINSAW) {
-#ifndef AUDIO_NOT_READY
- DMAudio.PlayOneShot(m_audioEntityId, 52, 0.0f);
-#endif
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_CHAINSAW_ATTACK, 0.0f);
} else if (weaponAnimTime <= delayBetweenAnimAndFire || weaponAnimTime - weaponAnimAssoc->timeStep > delayBetweenAnimAndFire || !weaponAnimAssoc->IsRunning()) {
if (weaponAnimAssoc->speed < 1.0f)
weaponAnimAssoc->speed = 1.0f;
@@ -1558,7 +1567,7 @@ CPed::Attack(void)
} else {
CVector firePos = ourWeapon->m_vecFireOffset;
- if (weaponAnimAssoc->animId == 206)
+ if (weaponAnimAssoc->animId == ANIM_MELEE_ATTACK_2ND)
firePos.z = 0.7f * ourWeapon->m_fRadius - 1.0f;
firePos = GetMatrix() * firePos;
@@ -1568,12 +1577,12 @@ CPed::Attack(void)
if (m_pDamageEntity)
damagerType = m_pDamageEntity->GetType();
- DMAudio.PlayOneShot(m_audioEntityId, 54, (float)damagerType);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_CHAINSAW_MADECONTACT, (float)damagerType);
if (IsPlayer()) {
CPad::GetPad(0)->StartShake(240, 180);
}
} else {
- DMAudio.PlayOneShot(m_audioEntityId, 53, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_CHAINSAW_IDLE, 0.0f);
if (IsPlayer()) {
CPad::GetPad(0)->StartShake(240, 90);
}
@@ -1645,22 +1654,7 @@ CPed::Attack(void)
bIsPointingGunAt = false;
m_shootTimer = CTimer::GetTimeInMilliseconds();
#ifdef AUDIO_NOT_READY
- switch (ourWeaponType) {
- case WEAPONTYPE_UZI:
- case WEAPONTYPE_TEC9:
- case WEAPONTYPE_SILENCED_INGRAM:
- case WEAPONTYPE_MP5:
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
- break;
- case WEAPONTYPE_RUGER:
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
- break;
- case WEAPONTYPE_M4:
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
- break;
- default:
- break;
- }
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
#else
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, GetWeapon()->m_eWeaponType);
#endif
@@ -1711,22 +1705,7 @@ CPed::Attack(void)
if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < animLoopEnd) {
#ifdef AUDIO_NOT_READY
- switch (ourWeaponType) {
- case WEAPONTYPE_UZI:
- case WEAPONTYPE_TEC9:
- case WEAPONTYPE_SILENCED_INGRAM:
- case WEAPONTYPE_MP5:
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
- break;
- case WEAPONTYPE_RUGER:
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
- break;
- case WEAPONTYPE_M4:
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
- break;
- default:
- break;
- }
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
#else
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, ourWeaponType);
#endif
@@ -2803,6 +2782,7 @@ CPed::CalculateNewOrientation(void)
SetHeading(m_fRotationCur);
}
+// --MIAMI: Done
float
CPed::WorkOutHeadingForMovingFirstPerson(float offset)
{
@@ -2918,6 +2898,7 @@ CPed::CalculateNewVelocity(void)
}
}
+// --MIAMI: Done, but what is TODO_CHAR??
bool
CPed::CanBeDeleted(void)
{
@@ -2929,11 +2910,14 @@ CPed::CanBeDeleted(void)
return true;
case MISSION_CHAR:
return false;
+ case TODO_CHAR:
+ return false;
default:
return true;
}
}
+// --MIAMI: Done
bool
CPed::CanPedDriveOff(void)
{
@@ -2950,7 +2934,7 @@ CPed::CanPedDriveOff(void)
return true;
}
-#ifdef VC_PED_PORTS
+// --MIAMI: Done
bool
CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil)
{
@@ -2982,20 +2966,6 @@ CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil)
CVector forwardPos = pos + forwardOffset;
return CWorld::GetIsLineOfSightClear(pos, forwardPos, true, false, false, true, false, false, false);
}
-#else
-bool
-CPed::CanPedJumpThis(CEntity *unused)
-{
- CVector2D forward(-Sin(m_fRotationCur), Cos(m_fRotationCur));
- CVector pos = GetPosition();
- CVector forwardPos(
- forward.x + pos.x,
- forward.y + pos.y,
- pos.z);
-
- return CWorld::GetIsLineOfSightClear(pos, forwardPos, true, false, false, true, false, false, false);
-}
-#endif
bool
CPed::CanPedReturnToState(void)
@@ -3004,6 +2974,7 @@ CPed::CanPedReturnToState(void)
m_nPedState != PED_FIGHT && m_nPedState != PED_STEP_AWAY && m_nPedState != PED_SNIPER_MODE && m_nPedState != PED_LOOK_ENTITY;
}
+// --MIAMI: Done
bool
CPed::CanSeeEntity(CEntity *entity, float threshold = CAN_SEE_ENTITY_ANGLE_THRESHOLD)
{
@@ -3300,18 +3271,17 @@ CPed::SetObjective(eObjective newObj, void *entity)
}
}
+// --MIAMI: Done
void
CPed::SetIdle(void)
{
if (m_nPedState != PED_IDLE && m_nPedState != PED_MUG && m_nPedState != PED_FLEE_ENTITY) {
-#ifdef VC_PED_PORTS
if (m_nPedState == PED_AIM_GUN)
ClearPointGunAt();
- m_nLastPedState = PED_NONE;
-#endif
- m_nPedState = PED_IDLE;
+ SetPedState(PED_IDLE);
SetMoveState(PEDMOVE_STILL);
+ m_nLastPedState = PED_NONE;
}
if (m_nWaitState == WAITSTATE_FALSE) {
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(2000, 4000);
@@ -3619,6 +3589,7 @@ CPed::TurnBody(void)
return turnDone;
}
+// --MIAMI: Done
void
CPed::Chat(void)
{
@@ -3777,6 +3748,7 @@ CPed::FacePhone(void)
#endif
}
+// --MIAMI: Done
CPed *
CPed::CheckForDeadPeds(void)
{
@@ -3792,6 +3764,7 @@ CPed::CheckForDeadPeds(void)
return nil;
}
+// --MIAMI: Done
bool
CPed::CheckForExplosions(CVector2D &area)
{
@@ -3836,6 +3809,7 @@ CPed::CheckForExplosions(CVector2D &area)
return false;
}
+// --MIAMI: Done
CPed *
CPed::CheckForGunShots(void)
{
@@ -3851,6 +3825,7 @@ CPed::CheckForGunShots(void)
return nil;
}
+// --MIAMI: Done
PointBlankNecessity
CPed::CheckForPointBlankPeds(CPed *pedToVerify)
{
@@ -3894,6 +3869,7 @@ CPed::CheckForPointBlankPeds(CPed *pedToVerify)
return NO_POINT_BLANK_PED;
}
+// --MIAMI: Done
bool
CPed::CheckIfInTheAir(void)
{
@@ -3915,13 +3891,30 @@ CPed::CheckIfInTheAir(void)
return !foundGround;
}
+// --MIAMI: Done
+void
+CPed::CheckThreatValidity(void)
+{
+ if (m_threatEntity && !IsEntityPointerValid(m_threatEntity)) {
+ m_threatFlags = 0;
+ m_threatEntity = 0;
+ }
+ if (m_pEventEntity && !IsEntityPointerValid(m_pEventEntity)) {
+ m_threatFlags = 0;
+ m_pEventEntity = 0;
+ }
+ if (!m_threatEntity && !m_pEventEntity)
+ m_threatFlags = 0;
+}
+
+// --MIAMI: Done
void
CPed::ClearAll(void)
{
if (!IsPedInControl() && m_nPedState != PED_DEAD)
return;
- m_nPedState = PED_NONE;
+ SetPedState(PED_NONE);
m_nMoveState = PEDMOVE_NONE;
m_pSeekTarget = nil;
m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
@@ -3929,16 +3922,13 @@ CPed::ClearAll(void)
m_fleeFromPosY = 0.0f;
m_fleeFrom = nil;
m_fleeTimer = 0;
+ pThreatEx = nil;
bUsesCollision = true;
-#ifdef VC_PED_PORTS
ClearPointGunAt();
-#else
- ClearAimFlag();
- ClearLookFlag();
-#endif
bIsPointingGunAt = false;
bRenderPedInCar = true;
bKnockedUpIntoAir = false;
+ b158_4 = false;
m_pCollidingEntity = nil;
}
@@ -4014,6 +4004,7 @@ CPed::StopNonPartialAnims(void)
}
}
+// --MIAMI: Done
void
CPed::SetStoredState(void)
{
@@ -4025,9 +4016,11 @@ 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;
+ if (m_nPedState != PED_IDLE) {
+ m_nLastPedState = m_nPedState;
+ if (m_nMoveState >= m_nPrevMoveState)
+ m_nPrevMoveState = m_nMoveState;
+ }
}
void
@@ -4783,11 +4776,15 @@ CPed::ClearSeek(void)
bRunningToPhone = false;
}
+// --MIAMI: Done
bool
CPed::SetWanderPath(int8 pathStateDest)
{
uint8 nextPathState;
+ if (IsPlayer())
+ return false;
+
if (IsPedInControl()) {
if (bKindaStayInSamePlace) {
SetIdle();
@@ -4816,7 +4813,7 @@ CPed::SetWanderPath(int8 pathStateDest)
// We did it, save next path state and return true
m_nPathDir = nextPathState;
- m_nPedState = PED_WANDER_PATH;
+ SetPedState(PED_WANDER_PATH);
SetMoveState(PEDMOVE_WALK);
bIsRunning = false;
return true;
@@ -4865,6 +4862,7 @@ CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg)
((CPed*)arg)->m_headingRate = ((CPed*)arg)->m_pedStats->m_headingChangeRate;
}
+// --MIAMI: Done
void
CPed::RestorePreviousState(void)
{
@@ -4875,7 +4873,7 @@ CPed::RestorePreviousState(void)
return;
if (InVehicle()) {
- m_nPedState = PED_DRIVING;
+ SetPedState(PED_DRIVING);
m_nLastPedState = PED_NONE;
} else {
if (m_nLastPedState == PED_NONE) {
@@ -4892,21 +4890,23 @@ CPed::RestorePreviousState(void)
SetIdle();
break;
case PED_WANDER_PATH:
- m_nPedState = PED_WANDER_PATH;
+ SetPedState(PED_WANDER_PATH);
bIsRunning = false;
if (!bFindNewNodeAfterStateRestore) {
if (m_pNextPathNode) {
- CVector diff = m_pNextPathNode->GetPosition() - GetPosition();
+ CVector nextNode = CPathFind::TakeWidthIntoAccountForWandering(m_pNextPathNode, m_randomSeed);
+ CVector diff = nextNode - GetPosition();
if (diff.MagnitudeSqr() < sq(7.0f)) {
SetMoveState(PEDMOVE_WALK);
break;
}
}
}
- SetWanderPath(CGeneral::GetRandomNumber() & 7);
+ SetWanderPath(m_nPedState == PED_FOLLOW_PATH ? m_nPathDir : CGeneral::GetRandomNumber() & 7);
break;
default:
- m_nPedState = m_nLastPedState;
+ PedState oldState = m_nLastPedState;
+ SetPedState(oldState);
SetMoveState((eMoveState) m_nPrevMoveState);
break;
}
@@ -5734,34 +5734,57 @@ CPed::FightStrike(CVector &touchedNodePos)
return false;
}
+// --MIAMI: Done
void
CPed::SetFall(int extraTime, AnimationId animId, uint8 evenIfNotInControl)
{
+ if (m_attachedTo)
+ return;
+
if (!IsPedInControl() && (!evenIfNotInControl || DyingOrDead()))
return;
ClearLookFlag();
ClearAimFlag();
SetStoredState();
- m_nPedState = PED_FALL;
- CAnimBlendAssociation *fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), animId);
-
- if (fallAssoc) {
- fallAssoc->SetCurrentTime(0.0f);
- fallAssoc->blendAmount = 0.0f;
- fallAssoc->blendDelta = 8.0f;
- fallAssoc->SetRun();
+ SetPedState(PED_FALL);
+ CAnimBlendAssociation *fallAssoc = nil;
+ if (animId == NUM_STD_ANIMS) {
+ if (IsPlayer()) {
+ fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLOUT_LHS);
+ if (!fallAssoc)
+ fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLOUT_RHS);
+ }
} else {
- fallAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, animId, 8.0f);
+ fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), animId);
+
+ if (fallAssoc) {
+ fallAssoc->SetCurrentTime(0.0f);
+ fallAssoc->blendAmount = 0.0f;
+ fallAssoc->blendDelta = 8.0f;
+ fallAssoc->SetRun();
+ }
+ else {
+ fallAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, animId, 8.0f);
+ }
+ if (animId == ANIM_BIKE_FALL_R)
+ fallAssoc->SetCurrentTime(0.4f);
}
if (extraTime == -1) {
m_getUpTimer = UINT32_MAX;
} else if (fallAssoc) {
if (IsPlayer()) {
- m_getUpTimer = 1000.0f * fallAssoc->hierarchy->totalLength
- + CTimer::GetTimeInMilliseconds()
- + 500.0f;
+ if (fallAssoc->animId != ANIM_CAR_ROLLOUT_LHS && fallAssoc->animId != ANIM_CAR_ROLLOUT_RHS) {
+ m_getUpTimer = 1000.0f * fallAssoc->hierarchy->totalLength
+ + CTimer::GetTimeInMilliseconds()
+ + 500.0f;
+ } else {
+ m_getUpTimer = 1000.0f * fallAssoc->hierarchy->totalLength
+ + CTimer::GetTimeInMilliseconds()
+ - 1000.0f * fallAssoc->currentTime
+ + 100.0f;
+ }
} else {
m_getUpTimer = 1000.0f * fallAssoc->hierarchy->totalLength
+ CTimer::GetTimeInMilliseconds()
@@ -5846,6 +5869,9 @@ CPed::SetWaitState(eWaitState state, void *time)
if (!IsPedInControl())
return;
+ if (m_nWaitState == WAITSTATE_RIOT && state == WAITSTATE_FALSE)
+ return;
+
if (state != m_nWaitState)
FinishedWaitCB(nil, this);
@@ -5871,11 +5897,16 @@ CPed::SetWaitState(eWaitState state, void *time)
case WAITSTATE_LOOK_SHOP:
case WAITSTATE_LOOK_ACCIDENT:
case WAITSTATE_FACEOFF_GANG:
+ case WAITSTATE_RIOT:
+ case WAITSTATE_STRIPPER:
break;
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;
@@ -5909,8 +5940,12 @@ 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
+ // Random char as passenger? Cop, medic etc.?
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective();
RestorePreviousState();
@@ -5922,7 +5957,10 @@ 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;
@@ -5964,7 +6002,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;
case WAITSTATE_SIT_DOWN:
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_SEAT_DOWN, 4.0f);
@@ -5995,10 +6036,8 @@ CPed::SetWaitState(eWaitState state, void *time)
case WAITSTATE_SUN_BATHE_PRE:
case WAITSTATE_SUN_BATHE_DOWN:
case WAITSTATE_SUN_BATHE_IDLE:
- case WAITSTATE_RIOT:
case WAITSTATE_FAST_FALL:
case WAITSTATE_BOMBER:
- case WAITSTATE_STRIPPER:
case WAITSTATE_GROUND_ATTACK:
case WAITSTATE_LANCESITTING:
case WAITSTATE_PLAYANIM_HANDSUP_SIMPLE:
@@ -6068,73 +6107,56 @@ CPed::PlayHitSound(CPed *hitTo)
DMAudio.PlayOneShot(m_audioEntityId, soundId, 0.0f);
}
+// --MIAMI: Done except ifdef
void
CPed::Say(uint16 audio)
{
uint16 audioToPlay = audio;
- if (IsPlayer()) {
+ 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;
- // Ofc this part isn't in VC.
+ } else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
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;
+ 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;
}
- } 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
+
+ // See VC Ped Speech patch
+#ifdef FIX_BUGS
|| CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
- + m_lastSoundStart
- + (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) {
+ + (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;
}
}
@@ -6402,7 +6424,7 @@ CPed::CollideWithPed(CPed *collideWith)
}
}
-// --MIAMI: Done except commented thing
+// --MIAMI: Done
void
CPed::CreateDeadPedMoney(void)
{
@@ -6411,8 +6433,7 @@ CPed::CreateDeadPedMoney(void)
int skin = GetModelIndex();
- // TODO(Miami): New flag
- if ((skin >= MI_COP && skin <= MI_FIREMAN) || CharCreatedBy == MISSION_CHAR || bInVehicle)
+ if ((skin >= MI_COP && skin <= MI_FIREMAN) || (CharCreatedBy == MISSION_CHAR && !bMoneyHasBeenGivenByScript) || bInVehicle)
return;
int money = m_nPedMoney;
@@ -6424,6 +6445,7 @@ CPed::CreateDeadPedMoney(void)
m_nPedMoney = 0;
}
+// --MIAMI: Done
void
CPed::CreateDeadPedPickupCoors(float *x, float *y, float *z)
{
@@ -6475,6 +6497,7 @@ CPed::CreateDeadPedPickupCoors(float *x, float *y, float *z)
#undef NUMBER_OF_ATTEMPTS
}
+// --MIAMI: Done
void
CPed::CreateDeadPedWeaponPickups(void)
{
@@ -6499,6 +6522,7 @@ CPed::CreateDeadPedWeaponPickups(void)
ClearWeapons();
}
+// --MIAMI: Done
void
CPed::SetAttackTimer(uint32 time)
{
@@ -6540,6 +6564,26 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType);
}
+// --MIAMI: Done
+void
+CPed::BuyIceCream(void)
+{
+ if (m_carInObjective) {
+ CPed *driver = m_carInObjective->pDriver;
+ if (driver && CTimer::GetTimeInMilliseconds() > m_standardTimer) {
+ SetChat(driver, 8000);
+ driver->SetChat(this, 8000);
+ return;
+ }
+ SetObjective(OBJECTIVE_NONE);
+ SetWanderPath(CGeneral::GetRandomNumberInRange(0, 8));
+ } else {
+ SetObjective(OBJECTIVE_NONE);
+ SetWanderPath(CGeneral::GetRandomNumberInRange(0, 8));
+ }
+}
+
+// --MIAMI: Done
void
CPed::SetBuyIceCream(void)
{
@@ -6549,37 +6593,19 @@ CPed::SetBuyIceCream(void)
if (!m_carInObjective)
return;
-#ifdef FIX_ICECREAM
-
- // Simulating BuyIceCream
- CPed* driver = m_carInObjective->pDriver;
- if (driver) {
- m_nPedState = PED_BUY_ICECREAM;
- bFindNewNodeAfterStateRestore = true;
- SetObjectiveTimer(8000);
- SetChat(driver, 8000);
- driver->SetChat(this, 8000);
- return;
- }
-#endif
-
- // Side of the Ice Cream van
- m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI;
-
- if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) {
- m_standardTimer = CTimer::GetTimeInMilliseconds() + 3000;
- m_nPedState = PED_BUY_ICECREAM;
- }
+ SetPedState(PED_BUY_ICECREAM);
}
+// --MIAMI: Done
void
CPed::SetChat(CEntity *chatWith, uint32 time)
{
if(m_nPedState != PED_CHAT)
SetStoredState();
- m_nPedState = PED_CHAT;
+ SetPedState(PED_CHAT);
SetMoveState(PEDMOVE_STILL);
+ m_lookTimer = 0;
SetLookFlag(chatWith, true);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
@@ -6745,7 +6771,7 @@ CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
return retVal;
}
-// TODO(Miami): Ducking doesn't work, fix this
+// --MIAMI: Done
bool
CPed::DuckAndCover(void)
{
@@ -6776,6 +6802,9 @@ CPed::DuckAndCover(void)
}
return false;
}
+
+ int16 lastVehicle = 0;
+ CEntity* vehicles[8];
bool justDucked = false;
CVehicle *foundVeh = nil;
@@ -6784,20 +6813,59 @@ CPed::DuckAndCover(void)
ClearDuck(true);
bCrouchWhenShooting = false;
-
+ bool duckingWithoutVeh = false;
if (CTimer::GetTimeInMilliseconds() > m_leaveCarTimer) {
- CVector pos = GetPosition();
- int16 lastVehicle;
- CEntity *vehicles[8];
- CWorld::FindObjectsInRange(pos, CHECK_NEARBY_THINGS_MAX_DIST, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
+
+ for(int i = 0; i < 6; i++) {
+ CPlayerPed *player = (CPlayerPed*)m_pedInObjective;
+
+ if (player->m_pPedAtSafePos[i] == this) {
+ duckingWithoutVeh = true;
+ CVector &safePos = player->m_vecSafePos[i];
+ bool notRunningToSafePos = false;
+
+ if (m_vecSeekPos.x != safePos.x && m_vecSeekPos.y != safePos.y && m_vecSeekPos.z != safePos.z)
+ notRunningToSafePos = true;
+
+ if (!notRunningToSafePos) {
+ CVector target = player->m_vecSafePos[i];
+ SetSeek(target, 1.0f);
+ duckingWithoutVeh = true;
+ m_attackTimer = CTimer::GetTimeInMilliseconds() + 6000;
+ bDuckAndCover = true;
+ }
+ break;
+ }
+ }
+ if (!duckingWithoutVeh) {
+ for (int i = 0; i < 6; i++) {
+ CPlayerPed* player = (CPlayerPed*)m_pedInObjective;
+ if (!player->m_pPedAtSafePos[i] && player->m_vecSafePos[i].x != 0.0f) {
+ player->m_pPedAtSafePos[i] = this;
+ CVector target = player->m_vecSafePos[i];
+ SetSeek(target, 1.0f);
+ m_headingRate = 15.0f;
+ ClearPointGunAt();
+ duckingWithoutVeh = 1;
+ bIsRunning = true;
+ bDuckAndCover = true;
+ justDucked = true;
+ m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 500;
+ break;
+ }
+ }
+ }
+ if (!duckingWithoutVeh) {
+ CVector pos = GetPosition();
+ CWorld::FindObjectsInRange(pos, CHECK_NEARBY_THINGS_MAX_DIST, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
+ }
for (int i = 0; i < lastVehicle; i++) {
CVehicle *veh = (CVehicle*) vehicles[i];
- if (veh->m_vecMoveSpeed.Magnitude() <= 0.02f
- && !veh->bIsBus
- && !veh->bIsVan
- && !veh->bIsBig
+ if (veh->IsCar() && veh->m_vecMoveSpeed.Magnitude() <= 0.02f
+ && !veh->bIsBus && !veh->bIsVan && !veh->bIsBig
&& veh->m_numPedsUseItAsCover < 3) {
+
float dist = (GetPosition() - veh->GetPosition()).MagnitudeSqr();
if (dist < maxDist) {
maxDist = dist;
@@ -6838,25 +6906,25 @@ CPed::DuckAndCover(void)
else
duckPos = duckAtRightSide;
- if (CWorld::TestSphereAgainstWorld(duckPos, 0.5f, nil, true, true, true, false, false, false)
- && CWorld::GetIsLineOfSightClear(GetPosition(), duckPos, 1, 0, 0, 1, 0, 0, 0)) {
+ if (CWorld::TestSphereAgainstWorld(duckPos, 0.5f, nil, true, true, true, false, false, false)) {
SetSeek(duckPos, 1.0f);
m_headingRate = 15.0f;
bIsRunning = true;
bDuckAndCover = true;
justDucked = true;
m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 500;
- if (foundVeh->bIsLawEnforcer)
+ if (foundVeh->bIsLawEnforcer) {
m_carInObjective = foundVeh;
-
- // BUG? Shouldn't we register the reference?
+ m_carInObjective->RegisterReference((CEntity**)&m_carInObjective);
+ }
m_pSeekTarget = foundVeh;
+ m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget);
ClearPointGunAt();
} else {
m_duckAndCoverTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(10000, 15000);
bDuckAndCover = false;
}
- } else {
+ } else if (!duckingWithoutVeh) {
bDuckAndCover = false;
}
}
@@ -6864,8 +6932,13 @@ CPed::DuckAndCover(void)
if (!justDucked && !bDuckAndCover)
return false;
- if (!Seek())
- return true;
+ if (!Seek()) {
+ if (m_nMoveState == PEDMOVE_STILL) {
+ bDuckAndCover = false;
+ return false;
+ } else
+ return true;
+ }
bKindaStayInSamePlace = true;
bDuckAndCover = false;
@@ -6882,9 +6955,12 @@ CPed::DuckAndCover(void)
}
m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(3000, 6000);
+ bCrouchWhenShooting = true;
+ SetDuck(CGeneral::GetRandomNumberInRange(2000, 5000), true);
return false;
}
+// --MIAMI: Done
void
CPed::EndFight(uint8 endType)
{
@@ -6894,6 +6970,9 @@ CPed::EndFight(uint8 endType)
m_lastFightMove = FIGHTMOVE_NULL;
RestorePreviousState();
CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_IDLE);
+ if (!animAssoc)
+ animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCHRELOAD);
+
if (animAssoc)
animAssoc->flags |= ASSOC_DELETEFADEDOUT;
@@ -7106,17 +7185,65 @@ CPed::ExitCar(void)
}
}
+// --MIAMI: Done
void
CPed::Fall(void)
{
- if (m_getUpTimer != UINT32_MAX && CTimer::GetTimeInMilliseconds() > m_getUpTimer
-#ifdef VC_PED_PORTS
- && bIsStanding
-#endif
- )
+ if (m_getUpTimer != UINT32_MAX && CTimer::GetTimeInMilliseconds() > m_getUpTimer && bIsStanding)
ClearFall();
- // VC plays animations ANIM_STD_FALL_ONBACK and ANIM_STD_FALL_ONFRONT in here, which doesn't exist in III.
+ CAnimBlendAssociation *firstPartialAssoc;
+ CAnimBlendAssociation *fallAssoc;
+
+ if (IsPlayer() && (bKnockedUpIntoAir || b158_4) && !bIsStanding) {
+ firstPartialAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_PARTIAL);
+
+ // What???
+ if (firstPartialAssoc && (firstPartialAssoc->animId == ANIM_FALL_BACK || firstPartialAssoc->animId == ANIM_FALL_FRONT))
+ fallAssoc = firstPartialAssoc;
+ else
+ fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_BACK);
+
+ if (!fallAssoc)
+ fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FRONT);
+
+ if (fallAssoc || !firstPartialAssoc || 0.8f * firstPartialAssoc->hierarchy->totalLength >= firstPartialAssoc->currentTime) {
+ if (fallAssoc) {
+ if (fallAssoc->blendAmount > 0.3f && fallAssoc->blendDelta >= 0.0f) {
+ float time = fallAssoc->currentTime;
+
+ if (time > 0.667f && time - fallAssoc->timeStep <= 0.667f) {
+ fallAssoc->SetCurrentTime(0.0f);
+ fallAssoc->SetRun();
+ }
+ }
+ }
+ } else if (firstPartialAssoc->flags & ASSOC_FRONTAL) {
+ CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FALL_FRONT, 8.0f);
+ } else {
+ CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FALL_BACK, 8.0f);
+ }
+ } else if ((bKnockedUpIntoAir || b158_4) && bIsStanding && !bWasStanding) {
+ fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_BACK);
+
+ if (!fallAssoc)
+ fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FRONT);
+
+ if (fallAssoc) {
+ bKnockedUpIntoAir = false;
+ b158_4 = false;
+ fallAssoc->speed = 3.0f;
+ if (IsPlayer())
+ Say(SOUND_PED_LAND);
+
+ } else {
+ firstPartialAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_PARTIAL);
+ if (firstPartialAssoc && !firstPartialAssoc->IsRunning()) {
+ bKnockedUpIntoAir = false;
+ b158_4 = false;
+ }
+ }
+ }
}
void
@@ -8678,6 +8805,7 @@ CPed::Idle(void)
m_moved = CVector2D(0.0f, 0.0f);
}
+// --MIAMI: Done
void
CPed::InTheAir(void)
{
@@ -8691,17 +8819,11 @@ CPed::InTheAir(void)
if (m_vecMoveSpeed.z < 0.0f && !bIsPedDieAnimPlaying) {
if (!DyingOrDead()) {
if (CWorld::ProcessLineOfSight(ourPos, bitBelow, foundCol, foundEnt, true, true, false, true, false, false, false)) {
- if (GetPosition().z - foundCol.point.z < 1.3f
-#ifdef VC_PED_PORTS
- || bIsStanding
-#endif
- )
+ if (GetPosition().z - foundCol.point.z < 1.3f || bIsStanding)
SetLanding();
- } else {
- if (!RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL)) {
- if (m_vecMoveSpeed.z < -0.1f)
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FALL_FALL, 4.0f);
- }
+ } else if (m_nPedState != PED_ABSEIL && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL)) {
+ if (m_vecMoveSpeed.z < -0.1f)
+ CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FALL_FALL, 4.0f);
}
}
}
@@ -10077,14 +10199,13 @@ 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();
}
break;
}
-#endif
+
if (m_pedInObjective &&
(m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT)) {
@@ -10842,11 +10963,13 @@ CPed::ProcessControl(void)
CalculateNewOrientation();
}
UpdatePosition();
- if (IsPedInControl() && !bIsStanding && !m_pDamageEntity && CheckIfInTheAir()) {
- SetInTheAir();
-#ifdef VC_PED_PORTS
- bHeadStuckInCollision = false;
-#endif
+ if (IsPedInControl() && !bIsStanding && !m_pDamageEntity) {
+ if (m_attachedTo) {
+ bIsInTheAir = false;
+ } else if (CheckIfInTheAir()) {
+ SetInTheAir();
+ bHeadStuckInCollision = false;
+ }
}
#ifdef VC_PED_PORTS
if (bHeadStuckInCollision) {
@@ -10911,7 +11034,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:
@@ -10920,7 +11043,6 @@ CPed::ProcessControl(void)
case PED_FOLLOW_ROUTE:
case PED_CPR:
case PED_SOLICIT:
- case PED_BUY_ICECREAM:
case PED_STEP_AWAY:
case PED_UNKNOWN:
case PED_STATES_NO_AI:
@@ -11011,6 +11133,9 @@ CPed::ProcessControl(void)
case PED_SEEK_IN_BOAT:
SeekBoatPosition();
break;
+ case PED_BUY_ICECREAM:
+ BuyIceCream();
+ break;
case PED_INVESTIGATE:
InvestigateEvent();
break;
@@ -11031,6 +11156,9 @@ CPed::ProcessControl(void)
m_pFire->Extinguish();
}
break;
+ case PED_ANSWER_MOBILE:
+ AnswerMobile();
+ break;
case PED_FALL:
Fall();
break;
@@ -11053,147 +11181,55 @@ CPed::ProcessControl(void)
return;
}
- if (m_pMyVehicle->pDriver != this) {
- LookForSexyPeds();
- LookForSexyCars();
- break;
- }
-
- // TODO(Miami): Start KILL_CHAR_ON_BOAT objective
-
- CPad* pad = CPad::GetPad(0);
-
#ifdef CAR_AIRBREAK
- if (!pad->ArePlayerControlsDisabled()) {
- if (pad->GetHorn()) {
- float c = Cos(m_fRotationCur);
- float s = Sin(m_fRotationCur);
- m_pMyVehicle->GetRight() = CVector(1.0f, 0.0f, 0.0f);
- m_pMyVehicle->GetForward() = CVector(0.0f, 1.0f, 0.0f);
- m_pMyVehicle->GetUp() = CVector(0.0f, 0.0f, 1.0f);
- if (pad->GetAccelerate()) {
- m_pMyVehicle->ApplyMoveForce(GetForward() * 30.0f);
- } else if (pad->GetBrake()) {
- m_pMyVehicle->ApplyMoveForce(-GetForward() * 30.0f);
- } else {
- int16 lr = pad->GetSteeringLeftRight();
- if (lr < 0) {
- //m_pMyVehicle->ApplyTurnForce(20.0f * -GetRight(), GetForward());
- m_pMyVehicle->ApplyMoveForce(-GetRight() * 30.0f);
- } else if (lr > 0) {
- m_pMyVehicle->ApplyMoveForce(GetRight() * 30.0f);
- } else {
- m_pMyVehicle->ApplyMoveForce(0.0f, 0.0f, 50.0f);
+ if (IsPlayer()) {
+ CPad* pad = CPad::GetPad(0);
+ if (!pad->ArePlayerControlsDisabled()) {
+ if (pad->GetHorn()) {
+ float c = Cos(m_fRotationCur);
+ float s = Sin(m_fRotationCur);
+ m_pMyVehicle->GetRight() = CVector(1.0f, 0.0f, 0.0f);
+ m_pMyVehicle->GetForward() = CVector(0.0f, 1.0f, 0.0f);
+ m_pMyVehicle->GetUp() = CVector(0.0f, 0.0f, 1.0f);
+ if (pad->GetAccelerate()) {
+ m_pMyVehicle->ApplyMoveForce(GetForward() * 30.0f);
+ }
+ else if (pad->GetBrake()) {
+ m_pMyVehicle->ApplyMoveForce(-GetForward() * 30.0f);
+ }
+ else {
+ int16 lr = pad->GetSteeringLeftRight();
+ if (lr < 0) {
+ //m_pMyVehicle->ApplyTurnForce(20.0f * -GetRight(), GetForward());
+ m_pMyVehicle->ApplyMoveForce(-GetRight() * 30.0f);
+ }
+ else if (lr > 0) {
+ m_pMyVehicle->ApplyMoveForce(GetRight() * 30.0f);
+ }
+ else {
+ m_pMyVehicle->ApplyMoveForce(0.0f, 0.0f, 50.0f);
+ }
}
}
}
}
#endif
- // TODO(Miami): This part moved to DriveVehicle in VC
- float steerAngle = m_pMyVehicle->m_fSteerAngle;
- CAnimBlendAssociation *lDriveAssoc;
- CAnimBlendAssociation *rDriveAssoc;
- CAnimBlendAssociation *lbAssoc;
- CAnimBlendAssociation *sitAssoc;
- if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT)) {
- sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT);
-
- if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
- break;
- }
-
- lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_L);
- rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_R);
- lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_BOAT_LB);
- } else if (m_pMyVehicle->bLowVehicle) {
- sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LSIT);
-
- if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
- break;
- }
-
- lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_LOW_L);
- lbAssoc = nil;
- rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_LOW_R);
+ if (m_pMyVehicle->pDriver == this) {
+ DriveVehicle();
+ if (!m_pMyVehicle)
+ return;
} else {
- sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_SIT);
-
- if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
- break;
- }
-
- lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_L);
- rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_R);
- lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LB);
- }
-
- if (lbAssoc &&
- TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON
- && TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_LEFT) {
- lbAssoc->blendDelta = -1000.0f;
+ LookForSexyPeds();
+ LookForSexyCars();
}
-
- CAnimBlendAssociation *driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_L);
- if (!driveByAssoc)
- driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_R);
- if (!driveByAssoc)
- driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_LOW_L);
- if (!driveByAssoc)
- driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_LOW_R);
-
- if (m_pMyVehicle->bLowVehicle || m_pMyVehicle->m_fGasPedal >= 0.0f || driveByAssoc) {
- if (steerAngle == 0.0f || driveByAssoc) {
- if (lDriveAssoc)
- lDriveAssoc->blendAmount = 0.0f;
- if (rDriveAssoc)
- rDriveAssoc->blendAmount = 0.0f;
-
- } else if (steerAngle <= 0.0f) {
- if (lDriveAssoc)
- lDriveAssoc->blendAmount = 0.0f;
-
- if (rDriveAssoc)
- rDriveAssoc->blendAmount = clamp(steerAngle * -100.0f / 61.0f, 0.0f, 1.0f);
- else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
- CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT_R);
- else if (m_pMyVehicle->bLowVehicle)
- CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_R);
- else
- CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_R);
-
- } else {
- if (rDriveAssoc)
- rDriveAssoc->blendAmount = 0.0f;
-
- if (lDriveAssoc)
- lDriveAssoc->blendAmount = clamp(steerAngle * 100.0f / 61.0f, 0.0f, 1.0f);
- else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
- CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT_L);
- else if (m_pMyVehicle->bLowVehicle)
- CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_L);
- else
- CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_L);
- }
-
- if (lbAssoc)
- lbAssoc->blendDelta = -4.0f;
- } else {
-
- if ((TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_1STPERSON
- || TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking != LOOKING_LEFT)
- && (!lbAssoc || lbAssoc->blendAmount < 1.0f && lbAssoc->blendDelta <= 0.0f)) {
-
- if(m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_BOAT_LB, 4.0f);
- else
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_LB, 4.0f);
- }
+ if (!IsPlayer() && m_pMyVehicle->IsBoat()
+ && FindPlayerPed()->m_pCurrentPhysSurface == m_pMyVehicle
+ && CharCreatedBy != MISSION_CHAR || !bIsPlayerFriend) {
+ SetObjective(OBJ_50, FindPlayerPed());
+ Say(SOUND_PED_CAR_JACKED);
}
- // TODO(Miami): This part belongs to DriveVehicle
- if (!m_pMyVehicle)
- return;
break;
}
case PED_DIE:
@@ -11252,6 +11288,7 @@ CPed::ProcessControl(void)
ServiceTalking();
}
+// --MIAMI: Done
void
CPed::SetInTheAir(void)
{
@@ -11616,6 +11653,7 @@ CPed::SetJump(void)
}
}
+// --MIAMI: Done
bool
CPed::ServiceTalkingWhenDead(void)
{
@@ -15584,6 +15622,7 @@ CPed::WanderRange(void)
}
}
+// --MIAMI: Done
bool
CPed::WillChat(CPed *stranger)
{
@@ -15600,6 +15639,10 @@ CPed::WillChat(CPed *stranger)
return true;
if (m_nPedType == PEDTYPE_CRIMINAL)
return false;
+ if (stranger->m_nPedType == PEDTYPE_COP)
+ return false;
+ if (stranger->IsPlayer())
+ return false;
if ((IsGangMember() || stranger->IsGangMember()) && m_nPedType != stranger->m_nPedType)
return false;
return true;
@@ -16571,6 +16614,7 @@ CPed::ScanForInterestingStuff(void)
}
}
+// --MIAMI: Done except comments
uint32
CPed::ScanForThreats(void)
{
@@ -16583,22 +16627,26 @@ CPed::ScanForThreats(void)
return PED_FLAG_EXPLOSION;
}
- CPed *shooter = nil;
- if ((fearFlags & PED_FLAG_GUN) && (shooter = CheckForGunShots()) && (m_nPedType != shooter->m_nPedType || m_nPedType == PEDTYPE_CIVMALE || m_nPedType == PEDTYPE_CIVFEMALE)) {
-//TODO(MIAMI): just a quick fix for heli weapons
-if(shooter->IsPed()){
- if (!IsGangMember()) {
- m_threatEntity = shooter;
- m_threatEntity->RegisterReference((CEntity **) &m_threatEntity);
- return PED_FLAG_GUN;
- }
+ if (fearFlags & PED_FLAG_GUN) {
+ CPed *shooter = CheckForGunShots();
+ if (shooter && (m_nPedType != shooter->m_nPedType || m_nPedType == PEDTYPE_CIVMALE || m_nPedType == PEDTYPE_CIVFEMALE)) {
+ if (!IsGangMember()) {
+ m_threatEntity = shooter;
+ m_threatEntity->RegisterReference((CEntity**)&m_threatEntity);
+ return PED_FLAG_GUN;
+ }
- if (CPedType::GetFlag(shooter->m_nPedType) & fearFlags) {
- m_threatEntity = shooter;
- m_threatEntity->RegisterReference((CEntity **) &m_threatEntity);
- return CPedType::GetFlag(shooter->m_nPedType);
+ if (CPedType::GetFlag(shooter->m_nPedType) & fearFlags || m_nPedType == PEDTYPE_GANG5) {
+
+ // TODO(Miami)
+ // if (m_threatEntity)
+ // m_threatEntity->CleanUpOldReference(&m_threatEntity);
+
+ m_threatEntity = shooter;
+ m_threatEntity->RegisterReference((CEntity**)&m_threatEntity);
+ return CPedType::GetFlag(shooter->m_nPedType);
+ }
}
-}
}
CPed *deadPed = nil;
@@ -16611,32 +16659,6 @@ if(shooter->IsPed()){
uint32 flagsOfSomePed = 0;
CPed *pedToFearFrom = nil;
-#ifndef VC_PED_PORTS
- for (int i = 0; i < m_numNearPeds; i++) {
- if (CharCreatedBy != RANDOM_CHAR || m_nearPeds[i]->CharCreatedBy != MISSION_CHAR || m_nearPeds[i]->IsPlayer()) {
- CPed *nearPed = m_nearPeds[i];
-
- // BUG: WTF Rockstar?! Putting this here will result in returning the flags of farthest ped to us, since m_nearPeds is sorted by distance.
- // Fixed at the bottom of the function.
- flagsOfSomePed = CPedType::GetFlag(nearPed->m_nPedType);
-
- if (CPedType::GetFlag(nearPed->m_nPedType) & fearFlags) {
- if (nearPed->m_fHealth > 0.0f && OurPedCanSeeThisOne(m_nearPeds[i])) {
- // FIX: Taken from VC
-#ifdef FIX_BUGS
- float nearPedDistSqr = (nearPed->GetPosition() - ourPos).MagnitudeSqr2D();
-#else
- float nearPedDistSqr = (CVector2D(ourPos) - explosionPos).MagnitudeSqr();
-#endif
- if (sq(closestPedDist) > nearPedDistSqr) {
- closestPedDist = Sqrt(nearPedDistSqr);
- pedToFearFrom = m_nearPeds[i];
- }
- }
- }
- }
- }
-#else
bool weSawOurEnemy = false;
bool weMaySeeOurEnemy = false;
float closestEnemyDist = 60.0f;
@@ -16653,7 +16675,7 @@ if(shooter->IsPed()){
if (flagsOfSomePed & fearFlags) {
if (m_nearPeds[i]->m_fHealth > 0.0f) {
- // VC also has ability to include objects to line of sight check here (via last bit of flagsL)
+ // TODO(Miami): include objects to line of sight check here (via last bit of flagsL)
if (OurPedCanSeeThisOne(m_nearPeds[i])) {
if (m_nearPeds[i]->m_nPedState == PED_ATTACK) {
if (m_nearPeds[i]->m_pedInObjective == this) {
@@ -16680,8 +16702,8 @@ if(shooter->IsPed()){
CColPoint foundCol;
CEntity *foundEnt;
+ // TODO(Miami): include objects to line of sight check here (via last bit of flagsL)
// We don't see him yet but he's behind a ped, vehicle or object
- // VC also has ability to include objects to line of sight check here (via last bit of flagsL)
if (!CWorld::ProcessLineOfSight(ourPos, nearPed->GetPosition(), foundCol, foundEnt,
true, false, false, false, false, false, false)) {
@@ -16709,7 +16731,7 @@ if(shooter->IsPed()){
}
}
}
-#endif
+
int16 lastVehicle;
CEntity* vehicles[8];
CWorld::FindObjectsInRange(ourPos, 20.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
@@ -16723,6 +16745,8 @@ if(shooter->IsPed()){
// BUG: Same bug as above. Fixed at the bottom of function.
flagsOfSomePed = CPedType::GetFlag(driver->m_nPedType);
if (CPedType::GetFlag(driver->m_nPedType) & fearFlags) {
+
+ // TODO(Miami): Last param
if (driver->m_fHealth > 0.0f && OurPedCanSeeThisOne(nearVeh->pDriver)) {
// FIX: Taken from VC
#ifdef FIX_BUGS
@@ -16920,16 +16944,14 @@ CPed::SeekCar(void)
}
}
+// --MIAMI: Done except ifdef
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 (!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;
@@ -16941,6 +16963,10 @@ CPed::ServiceTalking(void)
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;
}
@@ -17611,6 +17637,7 @@ CPed::SpawnFlyingComponent(int pedNode, int8 direction)
return obj;
}
+// --MIAMI: Done
void
CPed::WarpPedIntoCar(CVehicle *car)
{
@@ -17619,7 +17646,7 @@ CPed::WarpPedIntoCar(CVehicle *car)
m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle);
m_carInObjective = car;
m_carInObjective->RegisterReference((CEntity **) &m_carInObjective);
- m_nPedState = PED_DRIVING;
+ SetPedState(m_nPedState);
bUsesCollision = false;
bIsInTheAir = false;
bVehExitWillBeInstant = true;
@@ -17628,6 +17655,10 @@ CPed::WarpPedIntoCar(CVehicle *car)
car->pDriver->RegisterReference((CEntity **) &car->pDriver);
} else if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
+ if (car->IsBike() && !car->pPassengers[0]) {
+ car->pPassengers[0] = this;
+ car->pPassengers[0]->RegisterReference((CEntity**) &car->pPassengers[0]);
+ }
for (int i = 0; i < 4; i++) {
if (!car->pPassengers[i]) {
car->pPassengers[i] = this;
@@ -17980,6 +18011,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
}
}
+// --MIAMI: Done
void
CPed::WanderPath(void)
{
@@ -17992,7 +18024,7 @@ CPed::WanderPath(void)
if (m_nMoveState == PEDMOVE_STILL || m_nMoveState == PEDMOVE_NONE)
SetMoveState(PEDMOVE_WALK);
}
- m_vecSeekPos = m_pNextPathNode->GetPosition();
+ m_vecSeekPos = CPathFind::TakeWidthIntoAccountForWandering(m_pNextPathNode, m_randomSeed);
m_vecSeekPos.z += 1.0f;
// Only returns true when ped is stuck(not stopped) I think, then we should assign new direction or wait state to him.
@@ -18012,6 +18044,8 @@ CPed::WanderPath(void)
CPathNode *nodeWeWouldntPrefer = nil;
uint8 dirToSet = 9; // means undefined
uint8 dirWeWouldntPrefer2 = 9; // means undefined
+ uint8 tryCount = 0;
+
if (randVal <= 90) {
if (randVal > 80) {
m_nPathDir += 2;
@@ -18027,7 +18061,13 @@ CPed::WanderPath(void)
ThePaths.FindNextNodeWandering(PATH_PED, GetPosition(), &m_pLastPathNode, &m_pNextPathNode,
m_nPathDir, &dirToSet);
- uint8 tryCount = 0;
+ if (((CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->m_pedStatType == PEDSTAT_SKATER) {
+ if (m_pNextPathNode) {
+ CVector unpacked(m_pNextPathNode->GetPosition() / 8.f);
+ if (!CPopulation::IsSkateable(unpacked))
+ m_pNextPathNode = nil;
+ }
+ }
// NB: SetWanderPath checks for m_nPathDir == dirToStartWith, this one checks for tryCount > 7
while (!m_pNextPathNode) {
@@ -18055,6 +18095,13 @@ CPed::WanderPath(void)
m_pNextPathNode = nil;
}
}
+ if (((CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->m_pedStatType == PEDSTAT_SKATER) {
+ if (m_pNextPathNode) {
+ CVector unpacked(m_pNextPathNode->GetPosition() / 8.f);
+ if (!CPopulation::IsSkateable(unpacked))
+ m_pNextPathNode = nil;
+ }
+ }
}
}
@@ -18318,31 +18365,13 @@ CPed::Solicit(void)
}
}
-// Seperate function in VC, more logical. Not sure is it inlined in III.
+// --MIAMI: Done
void
CPed::SetExitBoat(CVehicle *boat)
{
-#ifndef VC_PED_PORTS
- m_nPedState = PED_IDLE;
- CVector firstPos = GetPosition();
- CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f);
- if (boat->GetModelIndex() == MI_SPEEDER && boat->IsUpsideDown()) {
- m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS, 8.0f);
- m_pVehicleAnim->SetFinishCallback(CPed::PedSetOutCarCB, this);
- m_vehEnterType = CAR_DOOR_RF;
- m_nPedState = PED_EXIT_CAR;
- } else {
- m_vehEnterType = CAR_DOOR_RF;
- CPed::PedSetOutCarCB(nil, this);
- bIsStanding = true;
- m_pCurSurface = boat;
- m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface);
+ if (m_nPedState == PED_FOLLOW_PATH) {
+ ClearFollowPath();
}
- SetPosition(firstPos);
- SetMoveState(PEDMOVE_STILL);
- m_vecMoveSpeed = boat->m_vecMoveSpeed;
- bTryingToReachDryLand = true;
-#else
m_nPedState = PED_IDLE;
CVector newPos = GetPosition();
RemoveInCarAnims();
@@ -18358,10 +18387,10 @@ CPed::SetExitBoat(CVehicle *boat)
m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface);
m_pCurrentPhysSurface = boat;
} else {
-/* if (boat->m_modelIndex != MI_SKIMMER || boat->bIsInWater) {
+ if (boat->m_modelIndex != MI_SKIMMER || boat->bIsInWater) {
if (boat->m_modelIndex == MI_SKIMMER)
- newPos.z += 2.0f
-*/
+ newPos.z += 2.0f;
+
m_vehEnterType = CAR_DOOR_RF;
PedSetOutCarCB(nil, this);
bIsStanding = true;
@@ -18372,7 +18401,6 @@ CPed::SetExitBoat(CVehicle *boat)
CEntity *foundEnt = nil;
if (CWorld::ProcessVerticalLine(newPos, newPos.z - 1.4f, foundCol, foundEnt, false, true, false, false, false, false, nil))
newPos.z = FEET_OFFSET + foundCol.point.z;
-/* // VC specific
} else {
m_vehEnterType = CAR_DOOR_RF;
PedSetOutCarCB(nil, this);
@@ -18382,7 +18410,7 @@ CPed::SetExitBoat(CVehicle *boat)
float upMult = 1.04f + boatCol->boundingBox.min.z;
float rightMult = 0.6f * boatCol->boundingBox.max.x;
newPos = upMult * boat->GetUp() + rightMult * boat->GetRight() + boat->GetPosition();
- GetPosition() = newPos;
+ SetPosition(newPos);
if (m_pMyVehicle) {
PositionPedOutOfCollision();
} else {
@@ -18392,15 +18420,10 @@ CPed::SetExitBoat(CVehicle *boat)
}
return;
}
-*/ }
+ }
SetPosition(newPos);
SetMoveState(PEDMOVE_STILL);
m_vecMoveSpeed = boat->m_vecMoveSpeed;
-#endif
-
- // TODO(Miami):
- // Not there in VC.
- //CWaterLevel::FreeBoatWakeArray();
}
void
@@ -18579,7 +18602,7 @@ CPed::ClearFollowPath()
m_nCurPathNode = 0;
}
-// --MIAMI: Done except bikes
+// --MIAMI: Done
void
CPed::AddInCarAnims(CVehicle* car, bool isDriver)
{
@@ -18594,9 +18617,11 @@ CPed::AddInCarAnims(CVehicle* car, bool isDriver)
group = ASSOCGRP_STD;
} else if (car->IsBike()) {
if (isDriver) {
- // TODO(Miami): Bikes
+ m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ((CBike*)car)->m_bikeAnimType, ANIM_BIKE_RIDE, 100.0f);
+ StopNonPartialAnims();
} else {
- // TODO(Miami): Bikes
+ m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ((CBike*)car)->m_bikeAnimType, ANIM_BIKE_PASSENGER, 100.0f);
+ StopNonPartialAnims();
}
} else {
if (isDriver) {
@@ -18619,26 +18644,89 @@ CPed::AddInCarAnims(CVehicle* car, bool isDriver)
StopNonPartialAnims();
}
+// --MIAMI: Done
bool
CPed::CanBeDamagedByThisGangMember(CPed* who)
{
return m_gangFlags & (1 << (uint8)(who->m_nPedType - PEDTYPE_GANG1));
}
+// --MIAMI: Done
void
CPed::Undress(const char* name)
{
int mi = GetModelIndex();
CAnimBlendAssociation* pAnim = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_PHONE_OUT);
- //if (pAnim)
- // FinishTalkingOnMobileCB(pAnim, this); // TODO(MIAMI)
+ if (pAnim)
+ FinishTalkingOnMobileCB(pAnim, this);
+
DeleteRwObject();
- if (m_nPedType == PEDTYPE_PLAYER1)
+ if (IsPlayer())
mi = MI_PLAYER;
CStreaming::RequestSpecialModel(mi, name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED);
CWorld::Remove(this);
}
+// --MIAMI: Done
+void
+FinishTalkingOnMobileCB(CAnimBlendAssociation *assoc, void *arg)
+{
+ CPed *ped = (CPed*)arg;
+ if (ped->m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
+ ped->RemoveWeaponModel(MI_MOBILE);
+ ped->SetCurrentWeapon(ped->m_storedWeapon);
+ ped->m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
+ }
+ ped->m_lookTimer = 0;
+}
+
+// --MIAMI: Done
+void
+StartTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg)
+{
+ CPed* ped = (CPed*)arg;
+ if (ped->m_nPedState == PED_ANSWER_MOBILE)
+ CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 4.0f);
+}
+
+// --MIAMI: Done
+void
+CPed::SetAnswerMobile(void)
+{
+ if (m_nPedState != PED_ANSWER_MOBILE && !DyingOrDead()) {
+ SetPedState(PED_ANSWER_MOBILE);
+ RemoveWeaponAnims(GetWeapon()->m_eWeaponType, -4.0f);
+ CAnimBlendAssociation *assoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
+ assoc->SetFinishCallback(StartTalkingOnMobileCB, this);
+ m_lookTimer = INT32_MAX;
+ if (m_storedWeapon == WEAPONTYPE_UNIDENTIFIED)
+ m_storedWeapon = GetWeapon()->m_eWeaponType;
+
+ RemoveWeaponModel(-1);
+ }
+}
+
+// --MIAMI: Done
+void
+CPed::ClearAnswerMobile(void)
+{
+ if (m_nLastPedState == PED_ANSWER_MOBILE)
+ m_nLastPedState = PED_NONE;
+
+ if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_PHONE_TALK)) {
+ CAnimBlendAssociation *assoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_PHONE_OUT, 8.0f);
+ assoc->SetFinishCallback(FinishTalkingOnMobileCB, this);
+ } else
+ FinishTalkingOnMobileCB(nil, this);
+
+ if (m_nPedState == PED_ANSWER_MOBILE) {
+ m_nPedState = PED_IDLE;
+ RestorePreviousState();
+ m_pMyVehicle = nil;
+ }
+}
+
+// --MIAMI: Done
void
CPed::Dress(void)
{
@@ -18654,6 +18742,249 @@ CPed::Dress(void)
m_headingRate = m_pedStats->m_headingChangeRate;
}
+// --MIAMI: Done
+void
+CPed::AnswerMobile(void)
+{
+ if (!IsPedInControl())
+ return;
+
+ CAnimBlendAssociation *phoneInAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_PHONE_IN);
+ CAnimBlendAssociation *phoneOutAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_PHONE_OUT);
+ CAnimBlendAssociation *phoneTalkAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_PHONE_TALK);
+ if (phoneInAssoc || phoneTalkAssoc || phoneOutAssoc) {
+ if (phoneInAssoc) {
+ if (phoneInAssoc->currentTime >= 0.85f && !m_pWeaponModel) {
+ CBaseModelInfo *phoneModel = CModelInfo::GetModelInfo(MI_MOBILE);
+ m_pWeaponModel = (RpAtomic*)phoneModel->CreateInstance();
+ phoneModel->AddRef();
+ m_wepModelID = MI_MOBILE;
+
+ // They copied AddWeaponModel and forgot that here
+ // bool unused = IsPlayer();
+ }
+ } else if (phoneOutAssoc) {
+ if (phoneOutAssoc->currentTime >= 0.5f && phoneOutAssoc->currentTime - phoneOutAssoc->timeStep < 0.5f) {
+ RemoveWeaponModel(MI_MOBILE);
+ SetCurrentWeapon(m_storedWeapon);
+ m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
+ }
+ }
+ } else {
+ CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 4.0f);
+ }
+}
+
+// --MIAMI: Done except commented thing
+void
+CPed::AttachPedToEntity(CEntity *ent, CVector offset, uint16 type, float rot, eWeaponType weapon)
+{
+ if (!ent || bInVehicle)
+ return;
+
+ m_attachedTo = ent;
+ m_attachedTo->RegisterReference(&m_attachedTo);
+ m_vecAttachOffset = offset;
+ m_attachType = type;
+ m_attachRot = rot;
+ if (IsPlayer()) {
+ bUsesCollision = false;
+ } else if (ent->IsVehicle()) {
+ m_pCollidingEntity = ent;
+ }
+
+ if (IsPlayer()) {
+ m_objective = OBJECTIVE_NONE;
+ m_prevObjective = OBJECTIVE_NONE;
+ }
+ SetStoredState();
+ SetPedState(PED_IDLE);
+ CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
+
+ if (m_storedWeapon == WEAPONTYPE_UNIDENTIFIED) {
+ m_storedWeapon = GetWeapon()->m_eWeaponType;
+ m_attachWepAmmo = GetWeapon()->m_nAmmoTotal;
+ }
+ if (IsPlayer()) {
+ GiveWeapon(weapon, 30000, 1);
+#ifndef FIX_BUGS
+ ((CPlayerPed*)this)->m_nSelectedWepSlot = weapon;
+#else
+ ((CPlayerPed*)this)->m_nSelectedWepSlot = GetWeaponSlot(weapon);
+#endif
+ ((CPlayerPed*)this)->MakeChangesForNewWeapon(weapon);
+ TheCamera.SetNewPlayerWeaponMode(CCam::MODE_HELICANNON_1STPERSON, 0, 0);
+ SetPedState(PED_SNIPER_MODE);
+ } else {
+ GiveWeapon(weapon, 30000, true);
+ SetCurrentWeapon(weapon);
+ }
+
+ // TODO(Miami)
+ // PositionAttachedPed();
+}
+
+// --MIAMI: Done
+void
+CPed::DettachPedFromEntity(void)
+{
+ m_attachedTo = nil;
+ if (m_nPedState == PED_DIE) {
+ m_pCollidingEntity = m_attachedTo;
+ ApplyMoveForce(m_attachedTo->GetForward() * -4.0f);
+ bIsStanding = false;
+ } else if (m_nPedState != PED_DEAD) {
+ RestorePreviousState();
+ CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
+ bUsesCollision = true;
+ if (m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
+ GetWeapon()->m_nAmmoInClip = 0;
+ GetWeapon()->m_nAmmoTotal = 0;
+ SetCurrentWeapon(m_storedWeapon);
+ GetWeapon()->m_nAmmoTotal = m_attachWepAmmo;
+ m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
+ }
+ }
+}
+
+// --MIAMI: Done
+void
+CPed::PedShuffle(void)
+{
+ if (m_pMyVehicle->pPassengers[0] == this) {
+ CPed *driver = m_pMyVehicle->pDriver;
+ if (!driver || driver->m_objective == OBJECTIVE_LEAVE_VEHICLE) {
+ m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, m_pMyVehicle->bLowVehicle ? ANIM_CAR_LSHUFFLE_RHS : ANIM_CAR_SHUFFLE_RHS);
+ m_objective = OBJECTIVE_ENTER_CAR_AS_DRIVER;
+ m_pMyVehicle->RemovePassenger(this);
+ bInVehicle = false;
+ m_pVehicleAnim->SetFinishCallback(PedSetInCarCB, this);
+ }
+ }
+}
+
+void
+CPed::DriveVehicle(void)
+{
+ if (bOffscreen)
+ return;
+
+ CVehicle *veh = m_pMyVehicle;
+ if (veh->IsBike()) {
+
+ // TODO(Miami): Bikes
+ return;
+ }
+
+ if (!IsPlayer())
+ return;
+
+ float steerAngle = m_pMyVehicle->m_fSteerAngle;
+ CAnimBlendAssociation* lDriveAssoc;
+ CAnimBlendAssociation* rDriveAssoc;
+ CAnimBlendAssociation* lbAssoc;
+ CAnimBlendAssociation* sitAssoc;
+ if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT)) {
+ sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT);
+
+ if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
+ return;
+ }
+
+ lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_L);
+ rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_R);
+ lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_BOAT_LB);
+ }
+ else if (m_pMyVehicle->bLowVehicle) {
+ sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LSIT);
+
+ if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
+ return;
+ }
+
+ lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_LOW_L);
+ lbAssoc = nil;
+ rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_LOW_R);
+ }
+ else {
+ sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_SIT);
+
+ if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
+ return;
+ }
+
+ lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_L);
+ rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_R);
+ lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LB);
+ }
+
+ if (lbAssoc &&
+ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON
+ && TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_LEFT) {
+ lbAssoc->blendDelta = -1000.0f;
+ }
+
+ CAnimBlendAssociation* driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_L);
+ if (!driveByAssoc)
+ driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_R);
+ if (!driveByAssoc)
+ driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_LOW_L);
+ if (!driveByAssoc)
+ driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_LOW_R);
+
+ if (m_pMyVehicle->bLowVehicle || m_pMyVehicle->m_fGasPedal >= 0.0f || driveByAssoc) {
+ if (steerAngle == 0.0f || driveByAssoc) {
+ if (lDriveAssoc)
+ lDriveAssoc->blendAmount = 0.0f;
+ if (rDriveAssoc)
+ rDriveAssoc->blendAmount = 0.0f;
+
+ }
+ else if (steerAngle <= 0.0f) {
+ if (lDriveAssoc)
+ lDriveAssoc->blendAmount = 0.0f;
+
+ if (rDriveAssoc)
+ rDriveAssoc->blendAmount = clamp(steerAngle * -100.0f / 61.0f, 0.0f, 1.0f);
+ else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
+ CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT_R);
+ else if (m_pMyVehicle->bLowVehicle)
+ CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_R);
+ else
+ CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_R);
+
+ }
+ else {
+ if (rDriveAssoc)
+ rDriveAssoc->blendAmount = 0.0f;
+
+ if (lDriveAssoc)
+ lDriveAssoc->blendAmount = clamp(steerAngle * 100.0f / 61.0f, 0.0f, 1.0f);
+ else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
+ CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT_L);
+ else if (m_pMyVehicle->bLowVehicle)
+ CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_L);
+ else
+ CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_L);
+ }
+
+ if (lbAssoc)
+ lbAssoc->blendDelta = -4.0f;
+ }
+ else {
+
+ if ((TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_1STPERSON
+ || TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking != LOOKING_LEFT)
+ && (!lbAssoc || lbAssoc->blendAmount < 1.0f && lbAssoc->blendDelta <= 0.0f)) {
+
+ if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
+ CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_BOAT_LB, 4.0f);
+ else
+ CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_LB, 4.0f);
+ }
+ }
+}
+
bool
IsPedPointerValid_NotInWorld(CPed* pPed)
{
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index bbc5334b..0ac6f930 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -245,6 +245,7 @@ enum eObjective : uint32 {
enum {
RANDOM_CHAR = 1,
MISSION_CHAR,
+ TODO_CHAR, // TODO(Miami)
};
enum PedLineUpPhase {
@@ -281,7 +282,7 @@ enum PedState
PED_PURSUE,
PED_FOLLOW_PATH,
PED_SNIPER_MODE,
- PED_ROCKET_ODE,
+ PED_ROCKET_MODE,
PED_DUMMY,
PED_PAUSE,
PED_ATTACK,
@@ -301,12 +302,17 @@ enum PedState
PED_INVESTIGATE,
PED_STEP_AWAY,
PED_ON_FIRE,
+ PED_SUN_BATHE,
+ PED_FLASH,
+ PED_JOG,
+ PED_ANSWER_MOBILE,
PED_UNKNOWN, // Same with IDLE, but also infects up to 5 peds with same pedType and WANDER_PATH, so they become stone too. HANG_OUT in Fire_Head's idb
PED_STATES_NO_AI,
- // One of these states isn't on PS2 - start
+ PED_ABSEIL,
+ PED_SIT,
PED_JUMP,
PED_FALL,
PED_GETUP,
@@ -317,7 +323,6 @@ enum PedState
PED_ENTER_TRAIN,
PED_EXIT_TRAIN,
PED_ARREST_PLAYER,
- // One of these states isn't on PS2 - end
PED_DRIVING,
PED_PASSENGER,
@@ -332,6 +337,7 @@ enum PedState
PED_EXIT_CAR,
PED_HANDS_UP,
PED_ARRESTED,
+ PED_DEPLOY_STINGER
};
enum eMoveState {
@@ -518,7 +524,6 @@ public:
uint16 m_nPathNodes;
int16 m_nCurPathNode;
int8 m_nPathDir;
-public:
CPathNode *m_pLastPathNode;
CPathNode *m_pNextPathNode;
float m_fHealth;
@@ -559,6 +564,7 @@ public:
float m_fleeFromPosY;
CEntity *m_fleeFrom;
uint32 m_fleeTimer;
+ CEntity* pThreatEx; // TODO(Miami): What is this?
CEntity* m_collidingEntityWhileFleeing;
uint32 m_collidingThingTimer;
CEntity *m_pCollidingEntity;
@@ -825,6 +831,15 @@ public:
void RequestDelayedWeapon();
void AddInCarAnims(CVehicle* car, bool isDriver);
bool CanBeDamagedByThisGangMember(CPed*);
+ void AnswerMobile(void);
+ void BuyIceCream(void);
+ void CheckThreatValidity(void);
+ void ClearAnswerMobile(void);
+ void SetAnswerMobile(void);
+ void AttachPedToEntity(CEntity*, CVector, uint16, float, eWeaponType);
+ void DettachPedFromEntity();
+ void PedShuffle();
+ void DriveVehicle();
// Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
@@ -908,11 +923,7 @@ public:
void UpdatePosition(void);
CObject *SpawnFlyingComponent(int, int8);
void SetCarJack_AllClear(CVehicle*, uint32, uint32);
-#ifdef VC_PED_PORTS
bool CanPedJumpThis(CEntity*, CVector*);
-#else
- bool CanPedJumpThis(CEntity*);
-#endif
void SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float, float, int);
void ClearWaitState(void);
@@ -1063,6 +1074,8 @@ public:
#endif
};
+void FinishTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg);
+void StartTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg);
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);
// TODO(Miami): Change those when Ped struct is done
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index a24c7fa3..38ba2bf9 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -46,7 +46,7 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_pWanted->Initialise();
m_pArrestingCop = nil;
m_currentWeapon = WEAPONTYPE_UNARMED;
- m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
+ m_nSelectedWepSlot = 0;
m_nSpeedTimer = 0;
m_bSpeedTimerFlag = false;
@@ -1163,6 +1163,9 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
}
#ifdef FREE_CAM
+ static int8 changedHeadingRate = 0;
+ if (changedHeadingRate == 2) changedHeadingRate = 1;
+
// Rotate player/arm when shooting. We don't have auto-rotation anymore
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
@@ -1186,6 +1189,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#endif
} else {
m_fRotationDest = limitedCam;
+ changedHeadingRate = 2;
m_headingRate = 12.5f;
// Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly)
@@ -1204,10 +1208,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
}
} else if (weaponInfo->m_bCanAimWithArm)
ClearPointGunAt();
- else
- RestoreHeadingRate();
}
}
+ if (changedHeadingRate == 1) {
+ changedHeadingRate = 0;
+ RestoreHeadingRate();
+ }
#endif
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
@@ -1453,7 +1459,7 @@ CPlayerPed::ProcessControl(void)
case PED_WANDER_PATH:
case PED_PURSUE:
case PED_FOLLOW_PATH:
- case PED_ROCKET_ODE:
+ case PED_ROCKET_MODE:
case PED_DUMMY:
case PED_PAUSE:
case PED_FACE_PHONE:
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 40ceb6c3..ca530494 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -22,6 +22,7 @@
#include "DummyObject.h"
#include "Script.h"
#include "Shadows.h"
+#include "SurfaceTable.h"
#define MIN_CREATION_DIST 40.0f // not for start of the game (look at the GeneratePedsAtStartOfGame)
#define CREATION_RANGE 10.0f // added over the MIN_CREATION_DIST.
@@ -1101,3 +1102,15 @@ CPopulation::AddDeadPedInFrontOfCar(const CVector& pos, CVehicle* pCulprit)
CVisibilityPlugins::SetClumpAlpha(pPed->GetClump(), 0);
return pPed;
}
+
+bool
+CPopulation::IsSkateable(CVector const& pos)
+{
+ CColPoint foundCol;
+ CEntity* foundEnt = nil;
+ CWorld::ProcessVerticalLine(pos + CVector(0.f, 0.f, 2.f), pos.z - 2.0f, foundCol, foundEnt, true, false, false, false, false, false, nil);
+ if (!foundEnt)
+ return false;
+
+ return foundCol.surfaceB == SURFACE_TARMAC || foundCol.surfaceB == SURFACE_PAVEMENT;
+} \ No newline at end of file
diff --git a/src/peds/Population.h b/src/peds/Population.h
index ae4aa44c..910baa1d 100644
--- a/src/peds/Population.h
+++ b/src/peds/Population.h
@@ -89,6 +89,7 @@ public:
static void ConvertAllObjectsToDummyObjects(void);
static bool TestRoomForDummyObject(CObject*);
static bool TestSafeForRealObject(CDummyObject*);
+ static bool IsSkateable(CVector const&);
static CPed* AddDeadPedInFrontOfCar(const CVector& pos, CVehicle* pCulprit);
};
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 94899ce7..f500b57a 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -1144,7 +1144,7 @@ void CHud::DrawAfterFade()
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
- DMAudio.PlayFrontEndSound(SOUND_A0, 0);
+ DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
break;
case 1:
case 2:
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 4ebf2737..8bf2a414 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -1447,8 +1447,7 @@ CAutomobile::ProcessControl(void)
gun.FireProjectile(this, &source, 0.0f);
CStats::RoundsFiredByPlayer++;
-//TODO(MIAMI):
-// DMAudio.PlayOneShot(m_audioEntityId, 55, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
m_nGunFiringTime = CTimer::GetTimeInMilliseconds();
// Hunter gun
}else if(CPad::GetPad(0)->GetHandBrake() && CTimer::GetTimeInMilliseconds() > m_nGunFiringTime+60){
@@ -1458,8 +1457,7 @@ CAutomobile::ProcessControl(void)
gun.FireInstantHit(this, &source);
gun.AddGunshell(this, source, CVector2D(0.0f, 0.1f), 0.025f);
CStats::RoundsFiredByPlayer++;
-//TODO(MIAMI):
-// DMAudio.PlayOneShot(m_audioEntityId, 55, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
m_nGunFiringTime = CTimer::GetTimeInMilliseconds();
}
}else if(GetModelIndex() == MI_SEASPAR && GetStatus() == STATUS_PLAYER){
@@ -1471,8 +1469,7 @@ CAutomobile::ProcessControl(void)
gun.FireInstantHit(this, &source);
gun.AddGunshell(this, source, CVector2D(0.0f, 0.1f), 0.025f);
CStats::RoundsFiredByPlayer++;
-//TODO(MIAMI):
-// DMAudio.PlayOneShot(m_audioEntityId, 55, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
m_nGunFiringTime = CTimer::GetTimeInMilliseconds();
}
}
@@ -3032,7 +3029,7 @@ CAutomobile::ProcessControlInputs(uint8 pad)
if(!CPad::GetPad(pad)->GetExitVehicle() ||
pDriver && pDriver->m_pVehicleAnim && (pDriver->m_pVehicleAnim->animId == ANIM_CAR_ROLLOUT_LHS ||
- pDriver->m_pVehicleAnim->animId == ANIM_CAR_ROLLOUT_LHS2))
+ pDriver->m_pVehicleAnim->animId == ANIM_CAR_ROLLOUT_RHS))
bIsHandbrakeOn = !!CPad::GetPad(pad)->GetHandBrake();
else
bIsHandbrakeOn = true;
@@ -4838,8 +4835,7 @@ CAutomobile::BurstTyre(uint8 wheel, bool applyForces)
if(status == WHEEL_STATUS_OK){
Damage.SetWheelStatus(wheel, WHEEL_STATUS_BURST);
CStats::TyresPopped++;
-// TODO(MIAMI)
-// DMAudio.PlayOneShot(m_audioEntityId, SOUND_15, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_TYRE_POP, 0.0f);
if(GetStatus() == STATUS_SIMPLE){
SetStatus(STATUS_PHYSICS);
@@ -5411,8 +5407,7 @@ CAutomobile::SetPanelDamage(int32 component, ePanels panel, bool noFlyingCompone
if(m_aCarNodes[component] == nil)
return;
if(status == PANEL_STATUS_SMASHED1){
-// TODO(MIAMI)
-// DMAudio.PlayOneShot(m_audioEntityId, SOUND_12, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_WINDSHIELD_CRACK, 0.0f);
// show damaged part
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_DAM);
}else if(status == PANEL_STATUS_MISSING){
diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h
index ba93fda0..c524a89c 100644
--- a/src/vehicles/Bike.h
+++ b/src/vehicles/Bike.h
@@ -36,7 +36,7 @@ public:
CVector wheelieNormal;
CVector wheelieRight;
tBikeHandlingData *pBikeHandling;
- int32 m_bikeAnimType;
+ AssocGroupId m_bikeAnimType;
uint8 m_wheelStatus[2];
CColPoint m_aWheelColPoints[4];
float m_aSuspensionSpringRatio[4];
diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp
index 5dab70c5..550c02a5 100644
--- a/src/vehicles/Train.cpp
+++ b/src/vehicles/Train.cpp
@@ -204,7 +204,7 @@ CTrain::ProcessControl(void)
if(m_bTrainStopping){
m_nDoorTimer = CTimer::GetTimeInMilliseconds() + 1000;
m_nDoorState = TRAIN_DOOR_OPENING;
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_18, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_TRAIN_DOOR_CLOSE, 0.0f);
}
break;
@@ -221,7 +221,7 @@ CTrain::ProcessControl(void)
if(!m_bTrainStopping){
m_nDoorTimer = CTimer::GetTimeInMilliseconds() + 1000;
m_nDoorState = TRAIN_DOOR_CLOSING;
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_19, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_TRAIN_DOOR_OPEN, 0.0f);
}
break;
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index ee786f5f..114a2240 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -824,9 +824,6 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
int32 accuracy = shooterPed->m_wepAccuracy;
int32 inaccuracy = 100-accuracy;
- if ( accuracy != 100 )
- FindPlayerPed(); //what ?
-
CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt;
if ( threatAttack->IsPed() )
{
@@ -911,10 +908,19 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
}
}
- if ( victim && shooter->IsPed() && victim == ((CPed*)shooter)->m_leader )
- return false;
+ if (victim && shooter->IsPed())
+ {
+ if (victim == ((CPed*)shooter)->m_leader)
+ return false;
+
+ if (victim->IsPed() && ((CPed*)shooter)->IsGangMember() && !((CPed*)victim)->CanBeDamagedByThisGangMember((CPed*)shooter))
+ return false;
+ }
- CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_PED, shooter, (CPed *)shooter, 1000);
+ if (shooter->IsPed())
+ CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_PED, shooter, (CPed*)shooter, 1000);
+ else if (shooter->IsVehicle() && ((CVehicle*)shooter)->pDriver)
+ CEventList::RegisterEvent(EVENT_GUNSHOT, EVENT_ENTITY_VEHICLE, shooter, ((CVehicle*)shooter)->pDriver, 1000);
if ( shooter == FindPlayerPed() )
{
@@ -935,59 +941,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
if ( info->m_nFiringRate >= 50 && !(++counter & 1) )
{
- CPointLights::AddLight(CPointLights::LIGHT_POINT,
- *fireSource, CVector(0.0f, 0.0f, 0.0f), 5.0f,
- 1.0f, 0.8f, 0.0f, CPointLights::FOG_NONE, false);
-
- CVector gunflashPos = *fireSource;
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.08f);
- gunflashPos += CVector(0.06f*ahead.x, 0.06f*ahead.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
- gunflashPos += CVector(0.06f*ahead.x, 0.06f*ahead.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
-
- gunflashPos = *fireSource;
- gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
- gunflashPos.z += 0.04f;
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
- gunflashPos.z += 0.04f;
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
- gunflashPos.z += 0.03f;
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
-
- gunflashPos = *fireSource;
- gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
- gunflashPos.z -= 0.04f;
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
- gunflashPos.z -= 0.04f;
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
- gunflashPos.z -= 0.03f;
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
-
- CVector offset = CrossProduct(CVector(ahead.x, ahead.y, 0.0f), CVector(0.0f, 0.0f, 5.0f));
- offset.Normalise2D();
-
- gunflashPos = *fireSource;
- gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
- gunflashPos += CVector(0.06f*offset.x, 0.06f*offset.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
- gunflashPos += CVector(0.04f*offset.x, 0.04f*offset.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
- gunflashPos += CVector(0.03f*offset.x, 0.03f*offset.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
-
- gunflashPos = *fireSource;
- gunflashPos += CVector(-0.1f*ahead.x, -0.1f*ahead.y, 0.0f);
- gunflashPos -= CVector(0.06f*offset.x, 0.06f*offset.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
- gunflashPos -= CVector(0.04f*offset.x, 0.04f*offset.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
- gunflashPos -= CVector(0.03f*offset.x, 0.03f*offset.y, 0.0f);
- CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
-
- CVector gunsmokePos = *fireSource;
- float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
- CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x*rnd, ahead.y*rnd, 0.0f));
+ AddGunFlashBigGuns(*fireSource, *fireSource + target);
CVector gunshellPos = *fireSource;
gunshellPos -= CVector(0.65f*ahead.x, 0.65f*ahead.y, 0.0f);
@@ -2761,6 +2715,71 @@ CWeapon::ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPo
return CWorld::ProcessLineOfSight(point1, point2, point, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects);
}
+void
+CWeapon::AddGunFlashBigGuns(CVector start, CVector end)
+{
+ CPointLights::AddLight(CPointLights::LIGHT_POINT,
+ start, CVector(0.0f, 0.0f, 0.0f), 5.0f,
+ 1.0f, 0.8f, 0.0f, CPointLights::FOG_NONE, false);
+ CVector gunflashPos = start;
+
+ CVector shootVec = end - start;
+
+ // Wtf did you do there R*?
+ shootVec.Normalise();
+ CVector2D ahead = shootVec;
+ ahead.Normalise();
+
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.08f);
+ gunflashPos += CVector(0.06f * ahead.x, 0.06f * ahead.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
+ gunflashPos += CVector(0.06f * ahead.x, 0.06f * ahead.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.06f);
+
+ gunflashPos = start;
+ gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
+ gunflashPos.z += 0.04f;
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
+ gunflashPos.z += 0.04f;
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
+ gunflashPos.z += 0.03f;
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
+
+ gunflashPos = start;
+ gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
+ gunflashPos.z -= 0.04f;
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
+ gunflashPos.z -= 0.04f;
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
+ gunflashPos.z -= 0.03f;
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
+
+ CVector offset = CrossProduct(CVector(ahead.x, ahead.y, 0.0f), CVector(0.0f, 0.0f, 5.0f));
+ offset.Normalise2D();
+
+ gunflashPos = start;
+ gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
+ gunflashPos += CVector(0.06f * offset.x, 0.06f * offset.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
+ gunflashPos += CVector(0.04f * offset.x, 0.04f * offset.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
+ gunflashPos += CVector(0.03f * offset.x, 0.03f * offset.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
+
+ gunflashPos = start;
+ gunflashPos += CVector(-0.1f * ahead.x, -0.1f * ahead.y, 0.0f);
+ gunflashPos -= CVector(0.06f * offset.x, 0.06f * offset.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.04f);
+ gunflashPos -= CVector(0.04f * offset.x, 0.04f * offset.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.03f);
+ gunflashPos -= CVector(0.03f * offset.x, 0.03f * offset.y, 0.0f);
+ CParticle::AddParticle(PARTICLE_GUNFLASH_NOANIM, gunflashPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.02f);
+
+ CVector gunsmokePos = start;
+ float rnd = CGeneral::GetRandomNumberInRange(0.05f, 0.25f);
+ CParticle::AddParticle(PARTICLE_GUNSMOKE2, gunsmokePos, CVector(ahead.x * rnd, ahead.y * rnd, 0.0f));
+}
+
#ifdef COMPATIBLE_SAVES
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h
index 8680fdcf..b6ce2903 100644
--- a/src/weapons/Weapon.h
+++ b/src/weapons/Weapon.h
@@ -68,6 +68,7 @@ public:
bool HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo);
static void BlowUpExplosiveThings(CEntity *thing);
bool HasWeaponAmmoToBeUsed(void);
+ static void AddGunFlashBigGuns(CVector, CVector);
static bool IsShotgun(int weapon) { return weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_SPAS12_SHOTGUN || weapon == WEAPONTYPE_STUBBY_SHOTGUN; }