diff options
-rw-r--r-- | src/control/Garages.cpp | 10 | ||||
-rw-r--r-- | src/control/Garages.h | 5 | ||||
-rw-r--r-- | src/control/Pickups.cpp | 15 | ||||
-rw-r--r-- | src/control/Pickups.h | 16 | ||||
-rw-r--r-- | src/control/Script.cpp | 1673 | ||||
-rw-r--r-- | src/control/Script.h | 27 | ||||
-rw-r--r-- | src/core/Fire.cpp | 19 | ||||
-rw-r--r-- | src/core/Fire.h | 10 | ||||
-rw-r--r-- | src/core/Stats.cpp | 15 | ||||
-rw-r--r-- | src/core/Stats.h | 16 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 24 | ||||
-rw-r--r-- | src/peds/Ped.h | 18 | ||||
-rw-r--r-- | src/vehicles/Automobile.cpp | 4 | ||||
-rw-r--r-- | src/vehicles/Automobile.h | 4 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 2 | ||||
-rw-r--r-- | src/weapons/ProjectileInfo.cpp | 3 | ||||
-rw-r--r-- | src/weapons/ProjectileInfo.h | 1 |
17 files changed, 1816 insertions, 46 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index b7a1fa8b..ca1dae1b 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -78,6 +78,16 @@ WRAPPER void CGarages::PlayerArrestedOrDied() { EAXJMP(0x427F60); } WRAPPER int16 CGarages::AddOne(float, float, float, float, float, float, uint8, uint32) { EAXJMP(0x421FA0); } WRAPPER void CGarages::SetTargetCarForMissonGarage(int16, CVehicle*) { EAXJMP(0x426BD0); } WRAPPER bool CGarages::HasCarBeenDroppedOffYet(int16) { EAXJMP(0x426C20); } +WRAPPER void CGarages::DeActivateGarage(int16) { EAXJMP(0x426C40); } +WRAPPER void CGarages::ActivateGarage(int16) { EAXJMP(0x426C60); } + +int32 CGarages::QueryCarsCollected(int16 garage) +{ + return 0; +} + +WRAPPER bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) { EAXJMP(0x426D50); } +WRAPPER void CGarages::ChangeGarageType(int16 garage, int8 type) { EAXJMP(0x4222A0); } #if 0 WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); } diff --git a/src/control/Garages.h b/src/control/Garages.h index af592716..f9421ae8 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -35,4 +35,9 @@ public: static int16 AddOne(float, float, float, float, float, float, uint8, uint32); static void SetTargetCarForMissonGarage(int16, CVehicle*); static bool HasCarBeenDroppedOffYet(int16); + static void ActivateGarage(int16); + static void DeActivateGarage(int16); + static int32 QueryCarsCollected(int16); + static bool HasThisCarBeenCollected(int16, uint8); + static void ChangeGarageType(int16, int8); //TODO: eGarageType }; diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 52861e99..67c59101 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -46,8 +46,21 @@ uint8 aWeaponGreens[] = { 0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, 0, 25 uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
-WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }
+WRAPPER void CPacManPickups::Init(void) { EAXJMP(0x432760); }
WRAPPER void CPacManPickups::Update(void) { EAXJMP(0x432800); }
+WRAPPER void CPacManPickups::GeneratePMPickUps(CVector, float, int16, uint8) { EAXJMP(0x432AE0); }
+WRAPPER void CPacManPickups::GeneratePMPickUpsForRace(int32) { EAXJMP(0x432D50); }
+WRAPPER void CPacManPickups::GenerateOnePMPickUp(CVector) { EAXJMP(0x432F20); }
+WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }
+WRAPPER void CPacManPickups::DoCleanUpPacManStuff(void) { EAXJMP(0x433150); }
+WRAPPER void CPacManPickups::StartPacManRace(int32) { EAXJMP(0x433340); }
+WRAPPER void CPacManPickups::StartPacManRecord(void) { EAXJMP(0x433360); }
+WRAPPER uint32 CPacManPickups::QueryPowerPillsEatenInRace(void) { EAXJMP(0x4333A0); }
+WRAPPER void CPacManPickups::ResetPowerPillsEatenInRace(void) { EAXJMP(0x4333B0); }
+WRAPPER void CPacManPickups::CleanUpPacManStuff(void) { EAXJMP(0x4333C0); }
+WRAPPER void CPacManPickups::StartPacManScramble(CVector, float, int16) { EAXJMP(0x4333D0); }
+WRAPPER uint32 CPacManPickups::QueryPowerPillsCarriedByPlayer(void) { EAXJMP(0x4333F0); }
+WRAPPER void CPacManPickups::ResetPowerPillsCarriedByPlayer(void) { EAXJMP(0x433410); }
void
diff --git a/src/control/Pickups.h b/src/control/Pickups.h index 5f9814c3..4bb0ddff 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -105,6 +105,20 @@ extern uint16 CostOfWeapon[20]; class CPacManPickups
{
public:
- static void Render(void);
+ static void Init(void);
static void Update(void);
+ static void GeneratePMPickUps(CVector, float, int16, uint8);
+ static void GeneratePMPickUpsForRace(int32);
+ static void GenerateOnePMPickUp(CVector);
+ static void Render(void);
+ static void DoCleanUpPacManStuff(void);
+ static void StartPacManRace(int32);
+ static void StartPacManRecord(void);
+ static uint32 QueryPowerPillsEatenInRace(void);
+ static void ResetPowerPillsEatenInRace(void);
+ static void CleanUpPacManStuff(void);
+ static void StartPacManScramble(CVector, float, int16);
+ static uint32 QueryPowerPillsCarriedByPlayer(void);
+ static void ResetPowerPillsCarriedByPlayer(void);
+
};
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 15cf798b..c08eefe2 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -28,6 +28,7 @@ #include "Messages.h" #include "ModelIndices.h" #include "Pad.h" +#include "ParticleObject.h" #include "PedRoutes.h" #include "Phones.h" #include "Pickups.h" @@ -36,13 +37,16 @@ #include "PointLights.h" #include "Pools.h" #include "Population.h" +#include "ProjectileInfo.h" #include "Remote.h" #include "Restart.h" #include "Replay.h" #include "Shadows.h" +#include "Stats.h" #include "Streaming.h" #include "Text.h" #include "User.h" +#include "WaterLevel.h" #include "Weather.h" #include "World.h" #include "Zones.h" @@ -1664,13 +1668,23 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command) CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); /* To make it EXTRA random! */ +#ifdef FIX_BUGS + *ptr = CGeneral::GetRandomNumberInRange(0.0f, 1.0f); +#else *ptr = CGeneral::GetRandomNumber() / 65536.0f; /* Between 0 and 0.5 on PC (oh well...), never used in original script. */ +#endif + return 0; } case COMMAND_GENERATE_RANDOM_INT: +#ifdef FIX_BUGS + // Not a very good fix but before switching to PS2 rand, it sort of works + *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = CGeneral::GetRandomNumberInRange(0, 65535); +#else /* On PC between 0 and 32767, even though script expects values between 0 and 65536 */ *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = CGeneral::GetRandomNumber(); +#endif return 0; case COMMAND_CREATE_CHAR: { @@ -1712,7 +1726,7 @@ int8 CRunningScript::ProcessCommandsFrom100To199(int32 command) ped = new CCivilianPed(ScriptParams[0], ScriptParams[1]); ped->CharCreatedBy = MISSION_CHAR; ped->bRespondsToThreats = false; - ped->m_ped_flagG2 = false; + ped->bAllowMedicsToReviveMe = false; CVector pos = *(CVector*)&ScriptParams[2]; if (pos.z <= -100.0f) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -2755,7 +2769,7 @@ int8 CRunningScript::ProcessCommandsFrom200To299(int32 command) pPed = new CCivilianPed(ScriptParams[1], ScriptParams[2]); pPed->CharCreatedBy = MISSION_CHAR; pPed->bRespondsToThreats = false; - pPed->m_ped_flagG2 = false; + pPed->bAllowMedicsToReviveMe = false; pPed->GetPosition() = pVehicle->GetPosition(); pPed->SetOrientation(0.0f, 0.0f, 0.0f); pPed->SetPedState(PED_DRIVING); @@ -3890,6 +3904,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR); return 0; } @@ -3897,6 +3912,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR); return 0; } @@ -3904,6 +3920,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pObject); CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT); return 0; } @@ -3949,7 +3966,7 @@ int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) pPed = new CCivilianPed(ScriptParams[1], ScriptParams[2]); pPed->CharCreatedBy = MISSION_CHAR; pPed->bRespondsToThreats = false; - pPed->m_ped_flagG2 = false; + pPed->bAllowMedicsToReviveMe = false; pPed->GetPosition() = pVehicle->GetPosition(); pPed->SetOrientation(0.0f, 0.0f, 0.0f); pPed->SetPedState(PED_DRIVING); @@ -4959,10 +4976,8 @@ int8 CRunningScript::ProcessCommandsFrom500To599(int32 command) CollectParameters(&m_nIp, 1); char name[16]; strncpy(name, (char*)&CTheScripts::ScriptSpace[m_nIp], 8); - for (int i = 0; i < 8; i++) { - if (name[i] >= 'A' && name[i] <= 'Z') - name[i] += 'a' - 'A'; - } + for (int i = 0; i < 8; i++) + name[i] = tolower(name[i]); CStreaming::RequestSpecialChar(ScriptParams[0] - 1, name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED); m_nIp += 8; return 0; @@ -5156,6 +5171,1641 @@ int8 CRunningScript::ProcessCommandsFrom500To599(int32 command) } #endif +#if 0 +WRAPPER int8 CRunningScript::ProcessCommandsFrom600To699(int32 command) { EAXJMP(0x444B20); } +#else +int8 CRunningScript::ProcessCommandsFrom600To699(int32 command) +{ + switch (command){ + /* Collective commands are not implemented until LCS. + case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT: + case COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE: + case COMMAND_SET_COLL_OBJ_GUARD_SPOT: + case COMMAND_SET_COLL_OBJ_GUARD_AREA: + case COMMAND_SET_COLL_OBJ_WAIT_IN_CAR: + case COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT: + case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT: + case COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS: + case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS: + case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE: + case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE: + case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS: + case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS: + case COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT: + case COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT: + case COMMAND_SET_COLL_OBJ_LEAVE_CAR: + case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER: + case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER: + case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_IN_CAR: + case COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE: + case COMMAND_SET_COLL_OBJ_DESTROY_OBJECT: + case COMMAND_SET_COLL_OBJ_DESTROY_CAR: + case COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT: + case COMMAND_SET_COLL_OBJ_GOTO_AREA_IN_CAR: + case COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET: + case COMMAND_SET_COLL_OBJ_GUARD_ATTACK: + case COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE: + case COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT: + case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR: + case COMMAND_SET_COLL_OBJ_RUN_TO_AREA: + case COMMAND_SET_COLL_OBJ_RUN_TO_COORD: + case COMMAND_ADD_PEDS_IN_AREA_TO_COLL: + case COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL: + case COMMAND_CLEAR_COLL: + case COMMAND_IS_COLL_IN_CARS: + case COMMAND_LOCATE_COLL_ANY_MEANS_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_2D: + case COMMAND_LOCATE_COLL_IN_CAR_2D: + case COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D: + case COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D: + case COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D: + case COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D: + case COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D: + case COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D: + case COMMAND_LOCATE_COLL_IN_CAR_CAR_2D: + case COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D: + case COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D: + case COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D: + case COMMAND_IS_COLL_IN_AREA_2D: + case COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D: + case COMMAND_IS_COLL_IN_AREA_IN_CAR_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D: + case COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D: + case COMMAND_GET_NUMBER_OF_PEDS_IN_COLL: + */ + case COMMAND_SET_CHAR_HEED_THREATS: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + pPed->bRespondsToThreats = (ScriptParams[1] != 0); + return 0; + } + case COMMAND_SET_PLAYER_HEED_THREATS: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + assert(pPed); + pPed->bRespondsToThreats = (ScriptParams[1] != 0); + return 0; + } + case COMMAND_GET_CONTROLLER_MODE: + ScriptParams[0] = 0; + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_SET_CAN_RESPRAY_CAR: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0); + return 0; + } + case COMMAND_IS_TAXI: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + int mi = pVehicle->GetModelIndex(); + UpdateCompareFlag(mi == MI_TAXI || mi == MI_CABBIE || mi == MI_BORGNINE); + return 0; + } + case COMMAND_UNLOAD_SPECIAL_CHARACTER: + CollectParameters(&m_nIp, 1); + CStreaming::SetMissionDoesntRequireSpecialChar(ScriptParams[0] - 1); + return 0; + case COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER: + CDarkel::ResetModelsKilledByPlayer(); + return 0; + case COMMAND_GET_NUM_OF_MODELS_KILLED_BY_PLAYER: + CollectParameters(&m_nIp, 1); + ScriptParams[0] = CDarkel::QueryModelsKilledByPlayer(ScriptParams[0]); + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_ACTIVATE_GARAGE: + CollectParameters(&m_nIp, 1); + CGarages::ActivateGarage(ScriptParams[0]); + return 0; + case COMMAND_SWITCH_TAXI_TIMER: + { + CollectParameters(&m_nIp, 1); + if (ScriptParams[0] != 0){ + CWorld::Players[CWorld::PlayerInFocus].m_nSwitchTaxiTime = CTimer::GetTimeInMilliseconds(); + CWorld::Players[CWorld::PlayerInFocus].m_bSwitchTaxi = true; + }else{ + CWorld::Players[CWorld::PlayerInFocus].m_bSwitchTaxi = false; + } + return 0; + } + case COMMAND_CREATE_OBJECT_NO_OFFSET: + { + CollectParameters(&m_nIp, 4); + int mi = ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::UsedObjectArray[-ScriptParams[0]].index; + CObject* pObj = new CObject(mi, 0); + pObj->ObjectCreatedBy = MISSION_OBJECT; + CVector pos = *(CVector*)&ScriptParams[1]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + pObj->GetPosition() = pos; + pObj->SetOrientation(0.0f, 0.0f, 0.0f); + pObj->GetMatrix().UpdateRW(); + pObj->UpdateRwFrame(); + CTheScripts::ClearSpaceForMissionEntity(pos, pObj); + CWorld::Add(pObj); + ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj); + StoreParameters(&m_nIp, 1); + if (m_bIsMissionScript) + CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT); + return 0; + } + case COMMAND_IS_BOAT: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + UpdateCompareFlag(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + return 0; + } + case COMMAND_SET_CHAR_OBJ_GOTO_AREA_ANY_MEANS: + { + CollectParameters(&m_nIp, 5); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + float infX = *(float*)&ScriptParams[1]; + float infY = *(float*)&ScriptParams[2]; + float supX = *(float*)&ScriptParams[3]; + float supY = *(float*)&ScriptParams[4]; + if (infX > supX) { + infX = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[1]; + } + if (infY > supY) { + infY = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[2]; + } + CVector pos; + pos.x = (infX + supX) / 2; + pos.y = (infY + supY) / 2; + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + float radius = max(pos.x - infX, pos.y - infY); + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius); + return 0; + } + //case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS: + case COMMAND_IS_PLAYER_STOPPED: + { + CollectParameters(&m_nIp, 1); + CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; + UpdateCompareFlag(CTheScripts::IsPlayerStopped(pPlayer)); + return 0; + } + case COMMAND_IS_CHAR_STOPPED: + { + CollectParameters(&m_nIp, 1); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + UpdateCompareFlag(CTheScripts::IsPedStopped(pPed)); + return 0; + } + case COMMAND_MESSAGE_WAIT: + CollectParameters(&m_nIp, 2); + m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0]; + if (ScriptParams[1] != 0) + m_bSkipWakeTime = true; + return 1; + case COMMAND_ADD_PARTICLE_EFFECT: + { + CollectParameters(&m_nIp, 5); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= 100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CParticleObject::AddObject(ScriptParams[0], pos, ScriptParams[4] != 0); + return 0; + } + case COMMAND_SWITCH_WIDESCREEN: + CollectParameters(&m_nIp, 1); + if (ScriptParams[0] != 0) + TheCamera.SetWideScreenOn(); + else + TheCamera.SetWideScreenOff(); + return 0; + case COMMAND_ADD_SPRITE_BLIP_FOR_CAR: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + int id = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, ScriptParams[1]); + ScriptParams[0] = id; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_ADD_SPRITE_BLIP_FOR_CHAR: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + int id = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, ScriptParams[1]); + ScriptParams[0] = id; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_ADD_SPRITE_BLIP_FOR_OBJECT: + { + CollectParameters(&m_nIp, 2); + CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pObject); + CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + int id = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, ScriptParams[1]); + ScriptParams[0] = id; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT: + { + CollectParameters(&m_nIp, 4); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + int id = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, ScriptParams[3]); + ScriptParams[0] = id; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_ADD_SPRITE_BLIP_FOR_COORD: + { + CollectParameters(&m_nIp, 4); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + int id = CRadar::SetCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, ScriptParams[3]); + ScriptParams[0] = id; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_SET_CHAR_ONLY_DAMAGED_BY_PLAYER: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + pPed->bOnlyDamagedByPlayer = (ScriptParams[1] != 0); + return 0; + } + case COMMAND_SET_CAR_ONLY_DAMAGED_BY_PLAYER: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + pVehicle->bOnlyDamagedByPlayer = (ScriptParams[1] != 0); + return 0; + } + case COMMAND_SET_CHAR_PROOFS: + { + CollectParameters(&m_nIp, 6); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + pPed->bBulletProof = (ScriptParams[1] != 0); + pPed->bFireProof = (ScriptParams[2] != 0); + pPed->bExplosionProof = (ScriptParams[3] != 0); + pPed->bCollisionProof = (ScriptParams[4] != 0); + pPed->bMeleeProof = (ScriptParams[5] != 0); + return 0; + } + case COMMAND_SET_CAR_PROOFS: + { + CollectParameters(&m_nIp, 6); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + pVehicle->bBulletProof = (ScriptParams[1] != 0); + pVehicle->bFireProof = (ScriptParams[2] != 0); + pVehicle->bExplosionProof = (ScriptParams[3] != 0); + pVehicle->bCollisionProof = (ScriptParams[4] != 0); + pVehicle->bMeleeProof = (ScriptParams[5] != 0); + return 0; + } + case COMMAND_IS_PLAYER_IN_ANGLED_AREA_2D: + case COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_2D: + case COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_2D: + case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_2D: + case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_2D: + case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_2D: + case COMMAND_IS_PLAYER_IN_ANGLED_AREA_3D: + case COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_3D: + case COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_3D: + case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_3D: + case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_3D: + case COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_3D: + PlayerInAngledAreaCheckCommand(command, &m_nIp); + return 0; + case COMMAND_DEACTIVATE_GARAGE: + CollectParameters(&m_nIp, 1); + CGarages::DeActivateGarage(ScriptParams[0]); + return 0; + case COMMAND_GET_NUMBER_OF_CARS_COLLECTED_BY_GARAGE: + CollectParameters(&m_nIp, 1); + ScriptParams[0] = CGarages::QueryCarsCollected(ScriptParams[0]); + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_HAS_CAR_BEEN_TAKEN_TO_GARAGE: + CollectParameters(&m_nIp, 2); + UpdateCompareFlag(CGarages::HasThisCarBeenCollected(ScriptParams[0], ScriptParams[1] - 1)); + return 0; + default: + assert(0); + } + return -1; +} +#endif + +#if 0 +WRAPPER int8 CRunningScript::ProcessCommandsFrom700To799(int32 command) { EAXJMP(0x4458A0); } +#else +int8 CRunningScript::ProcessCommandsFrom700To799(int32 command) +{ + switch (command){ + case COMMAND_SET_SWAT_REQUIRED: + CollectParameters(&m_nIp, 1); + FindPlayerPed()->m_pWanted->m_bSwatRequired = (ScriptParams[0] != 0); + return 0; + case COMMAND_SET_FBI_REQUIRED: + CollectParameters(&m_nIp, 1); + FindPlayerPed()->m_pWanted->m_bFbiRequired = (ScriptParams[0] != 0); + return 0; + case COMMAND_SET_ARMY_REQUIRED: + CollectParameters(&m_nIp, 1); + FindPlayerPed()->m_pWanted->m_bArmyRequired = (ScriptParams[0] != 0); + return 0; + case COMMAND_IS_CAR_IN_WATER: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + UpdateCompareFlag(pVehicle->bIsInWater); + return 0; + } + case COMMAND_GET_CLOSEST_CHAR_NODE: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f)]; + *(CVector*)&ScriptParams[0] = pNode->pos; + StoreParameters(&m_nIp, 3); + return 0; + } + case COMMAND_GET_CLOSEST_CAR_NODE: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f)]; + *(CVector*)&ScriptParams[0] = pNode->pos; + StoreParameters(&m_nIp, 3); + return 0; + } + case COMMAND_CAR_GOTO_COORDINATES_ACCURATE: + { + CollectParameters(&m_nIp, 4); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + CVector pos = *(CVector*)&ScriptParams[1]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + pos.z += pVehicle->GetDistanceFromCentreOfMassToBaseOfModel(); + if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, pos, false)) + pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE; + else + pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ACCURATE; + pVehicle->m_status = STATUS_PHYSICS; + pVehicle->bEngineOn = true; + pVehicle->AutoPilot.m_nCruiseSpeed = min(6, pVehicle->AutoPilot.m_nCruiseSpeed); + pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); + return 0; + } + case COMMAND_START_PACMAN_RACE: + CollectParameters(&m_nIp, 1); + CPacManPickups::StartPacManRace(ScriptParams[0]); + return 0; + case COMMAND_START_PACMAN_RECORD: + CPacManPickups::StartPacManRecord(); + return 0; + case COMMAND_GET_NUMBER_OF_POWER_PILLS_EATEN: + ScriptParams[0] = CPacManPickups::QueryPowerPillsEatenInRace(); + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_CLEAR_PACMAN: + CPacManPickups::CleanUpPacManStuff(); + return 0; + case COMMAND_START_PACMAN_SCRAMBLE: + { + CollectParameters(&m_nIp, 5); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CPacManPickups::StartPacManScramble(pos, *(float*)&ScriptParams[3], ScriptParams[4]); + return 0; + } + case COMMAND_GET_NUMBER_OF_POWER_PILLS_CARRIED: + ScriptParams[0] = CPacManPickups::QueryPowerPillsCarriedByPlayer(); + return 0; + case COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_CARRIED: + CPacManPickups::ResetPowerPillsCarriedByPlayer(); + return 0; + case COMMAND_IS_CAR_ON_SCREEN: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + UpdateCompareFlag(TheCamera.IsSphereVisible(pVehicle->GetBoundCentre(), pVehicle->GetBoundRadius())); + return 0; + } + case COMMAND_IS_CHAR_ON_SCREEN: + { + CollectParameters(&m_nIp, 1); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + UpdateCompareFlag(TheCamera.IsSphereVisible(pPed->GetBoundCentre(), pPed->GetBoundRadius())); + return 0; + } + case COMMAND_IS_OBJECT_ON_SCREEN: + { + CollectParameters(&m_nIp, 1); + CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pObject); + UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius())); + return 0; + } + case COMMAND_GOSUB_FILE: + { + CollectParameters(&m_nIp, 2); + assert(m_nStackPointer < MAX_STACK_DEPTH); + m_anStack[m_nStackPointer++] = m_nIp; + m_nIp = ScriptParams[0]; + // ScriptParams[1] == filename + return 0; + } + case COMMAND_GET_GROUND_Z_FOR_3D_COORD: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + bool success; + *(float*)&ScriptParams[0] = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &success); + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_START_SCRIPT_FIRE: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + ScriptParams[0] = gFireManager.StartScriptFire(pos, nil, 0.8f, 1); + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_IS_SCRIPT_FIRE_EXTINGUISHED: + CollectParameters(&m_nIp, 1); + UpdateCompareFlag(gFireManager.IsScriptFireExtinguish(ScriptParams[0])); + return 0; + case COMMAND_REMOVE_SCRIPT_FIRE: + CollectParameters(&m_nIp, 1); + gFireManager.RemoveScriptFire(ScriptParams[0]); + return 0; + case COMMAND_SET_COMEDY_CONTROLS: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + pVehicle->bComedyControls = (ScriptParams[1] != 0); + return 0; + } + case COMMAND_BOAT_GOTO_COORDS: + { + CollectParameters(&m_nIp, 4); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + CBoat* pBoat = (CBoat*)pVehicle; + CVector pos = *(CVector*)&ScriptParams[1]; + if (pos.z <= -100.0f) + CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &pos.z, false); + pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS; + pBoat->AutoPilot.m_vecDestinationCoors = pos; + pBoat->m_status = STATUS_PHYSICS; + pBoat->AutoPilot.m_nCruiseSpeed = max(6, pBoat->AutoPilot.m_nCruiseSpeed); + pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); + return 0; + } + case COMMAND_BOAT_STOP: + { + CollectParameters(&m_nIp, 4); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + CBoat* pBoat = (CBoat*)pVehicle; + pBoat->AutoPilot.m_nCarMission = MISSION_NONE; + pBoat->m_status = STATUS_PHYSICS; + pBoat->bEngineOn = false; + pBoat->AutoPilot.m_nCruiseSpeed = 0; + return 0; + } + case COMMAND_IS_PLAYER_SHOOTING_IN_AREA: + { + CollectParameters(&m_nIp, 6); + CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + assert(pPed); + float x1, y1, x2, y2; + x1 = *(float*)&ScriptParams[1]; + y1 = *(float*)&ScriptParams[2]; + x2 = *(float*)&ScriptParams[3]; + y2 = *(float*)&ScriptParams[4]; + UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2)); + if (!ScriptParams[5]) + return 0; + CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f); + if (CTheScripts::DbgFlag) + CTheScripts::DrawDebugSquare(x1, y1, x2, y2); + return 0; + } + case COMMAND_IS_CHAR_SHOOTING_IN_AREA: + { + CollectParameters(&m_nIp, 6); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + float x1, y1, x2, y2; + x1 = *(float*)&ScriptParams[1]; + y1 = *(float*)&ScriptParams[2]; + x2 = *(float*)&ScriptParams[3]; + y2 = *(float*)&ScriptParams[4]; + UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2)); + if (!ScriptParams[5]) + return 0; + CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f); + if (CTheScripts::DbgFlag) + CTheScripts::DrawDebugSquare(x1, y1, x2, y2); + return 0; + } + case COMMAND_IS_CURRENT_PLAYER_WEAPON: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + assert(pPed); + UpdateCompareFlag(ScriptParams[1] == pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType); + return 0; + } + case COMMAND_IS_CURRENT_CHAR_WEAPON: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + UpdateCompareFlag(ScriptParams[1] == pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType); + return 0; + } + case COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_EATEN: + CPacManPickups::ResetPowerPillsEatenInRace(); + return 0; + case COMMAND_ADD_POWER_PILL: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CPacManPickups::GenerateOnePMPickUp(pos); + return 0; + } + case COMMAND_SET_BOAT_CRUISE_SPEED: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + CBoat* pBoat = (CBoat*)pVehicle; + pBoat->AutoPilot.m_nCruiseSpeed = ScriptParams[1]; + } + case COMMAND_GET_RANDOM_CHAR_IN_AREA: + { + CollectParameters(&m_nIp, 4); + int ped_handle = -1; + CVector pos = FindPlayerCoors(); + float x1, y1, x2, y2; + x1 = *(float*)&ScriptParams[1]; + y1 = *(float*)&ScriptParams[2]; + x2 = *(float*)&ScriptParams[3]; + y2 = *(float*)&ScriptParams[4]; + int i = CPools::GetPedPool()->GetSize(); + while (--i && ped_handle == -1){ + CPed* pPed = CPools::GetPedPool()->GetSlot(i); + if (!pPed) + continue; + if (CTheScripts::LastRandomPedId == CPools::GetPedPool()->GetIndex(pPed)) + continue; + if (pPed->CharCreatedBy != RANDOM_CHAR) + continue; + if (!pPed->IsPedInControl()) + continue; + if (pPed->bRemoveFromWorld) + continue; + if (pPed->bFadeOut) + continue; + if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) + continue; + if (!ThisIsAValidRandomPed(pPed->m_nPedType)) + continue; + if (pPed->bIsLeader || pPed->m_leader) + continue; + if (!pPed->IsWithinArea(x1, y1, x2, y2)) + continue; + if (pos.z - 5.0f > pPed->GetPosition().z) + continue; + if (pos.z + 5.0f < pPed->GetPosition().z) + continue; + ped_handle = CPools::GetPedPool()->GetIndex(pPed); + CTheScripts::LastRandomPedId = ped_handle; + pPed->CharCreatedBy = MISSION_CHAR; + pPed->bRespondsToThreats = false; + ++CPopulation::ms_nTotalMissionPeds; + if (m_bIsMissionScript) + CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR); + } + ScriptParams[0] = ped_handle; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_GET_RANDOM_CHAR_IN_ZONE: + { + char zone[8]; + strncpy(zone, (const char*)&CTheScripts::ScriptSpace[m_nIp], 8); + int nZone = CTheZones::FindZoneByLabelAndReturnIndex(zone); + if (nZone != -1) + m_nIp += 8; + CZone* pZone = CTheZones::GetZone(nZone); + int ped_handle = -1; + CVector pos = FindPlayerCoors(); + int i = CPools::GetPedPool()->GetSize(); + while (--i && ped_handle == -1) { + CPed* pPed = CPools::GetPedPool()->GetSlot(i); + if (!pPed) + continue; + if (CTheScripts::LastRandomPedId == CPools::GetPedPool()->GetIndex(pPed)) + continue; + if (pPed->CharCreatedBy != RANDOM_CHAR) + continue; + if (!pPed->IsPedInControl()) + continue; + if (pPed->bRemoveFromWorld) + continue; + if (pPed->bFadeOut) + continue; + if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) + continue; + if (!ThisIsAValidRandomPed(pPed->m_nPedType)) + continue; + if (pPed->bIsLeader || pPed->m_leader) + continue; + if (!CTheZones::PointLiesWithinZone(pPed->GetPosition(), pZone)) + continue; + if (pos.z - 5.0f > pPed->GetPosition().z) + continue; + if (pos.z + 5.0f < pPed->GetPosition().z) + continue; + ped_handle = CPools::GetPedPool()->GetIndex(pPed); + CTheScripts::LastRandomPedId = ped_handle; + pPed->CharCreatedBy = MISSION_CHAR; + pPed->bRespondsToThreats = false; + ++CPopulation::ms_nTotalMissionPeds; + if (m_bIsMissionScript) + CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR); + } + ScriptParams[0] = ped_handle; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_IS_PLAYER_IN_TAXI: + { + CollectParameters(&m_nIp, 1); + CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + assert(pPed); + UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->IsTaxi()); + return 0; + } + case COMMAND_IS_PLAYER_SHOOTING: + { + CollectParameters(&m_nIp, 1); + CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + assert(pPed); + UpdateCompareFlag(pPed->bIsShooting); + return 0; + } + case COMMAND_IS_CHAR_SHOOTING: + { + CollectParameters(&m_nIp, 1); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + UpdateCompareFlag(pPed->bIsShooting); + return 0; + } + case COMMAND_CREATE_MONEY_PICKUP: + { + CollectParameters(&m_nIp, 4); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + 0.5f; + CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, ScriptParams[3]); + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_SET_CHAR_ACCURACY: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + pPed->m_wepAccuracy = ScriptParams[1]; + return 0; + } + case COMMAND_GET_CAR_SPEED: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + *(float*)&ScriptParams[0] = pVehicle->GetSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_LOAD_CUTSCENE: + { + char name[8]; + strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], 8); + m_nIp += 8; + CCutsceneMgr::LoadCutsceneData(name); + return 0; + } + case COMMAND_CREATE_CUTSCENE_OBJECT: + { + CollectParameters(&m_nIp, 1); + CCutsceneObject* pCutObj = CCutsceneMgr::CreateCutsceneObject(ScriptParams[0]); + ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pCutObj); + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_SET_CUTSCENE_ANIM: + { + CollectParameters(&m_nIp, 1); + char name[8]; + CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pObject); + strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], 8); + m_nIp += 8; + CCutsceneMgr::SetCutsceneAnim(name, pObject); + return 0; + } + case COMMAND_START_CUTSCENE: + CCutsceneMgr::ms_cutsceneLoadStatus = 1; + return 0; + case COMMAND_GET_CUTSCENE_TIME: + ScriptParams[0] = CCutsceneMgr::GetCutsceneTimeInMilleseconds(); + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_HAS_CUTSCENE_FINISHED: + UpdateCompareFlag(CCutsceneMgr::HasCutsceneFinished()); + return 0; + case COMMAND_CLEAR_CUTSCENE: + CCutsceneMgr::DeleteCutsceneData(); + return 0; + case COMMAND_RESTORE_CAMERA_JUMPCUT: + TheCamera.RestoreWithJumpCut(); + return 0; + case COMMAND_CREATE_COLLECTABLE1: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + 0.5f; + CPickups::GenerateNewOne(pos, MI_COLLECTABLE1, PICKUP_COLLECTABLE1, 0); + return 0; + } + case COMMAND_SET_COLLECTABLE1_TOTAL: + CollectParameters(&m_nIp, 1); + CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = ScriptParams[0]; + return 0; + case COMMAND_IS_PROJECTILE_IN_AREA: + { + CollectParameters(&m_nIp, 6); + float infX = *(float*)&ScriptParams[0]; + float infY = *(float*)&ScriptParams[1]; + float infZ = *(float*)&ScriptParams[2]; + float supX = *(float*)&ScriptParams[3]; + float supY = *(float*)&ScriptParams[4]; + float supZ = *(float*)&ScriptParams[5]; + if (infX > supX) { + infX = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[0]; + } + if (infY > supY) { + infY = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[1]; + } + if (infZ > supZ) { + infZ = *(float*)&ScriptParams[5]; + supZ = *(float*)&ScriptParams[2]; + } + UpdateCompareFlag(CProjectileInfo::IsProjectileInRange(infX, supX, infY, supY, infZ, supZ, false)); + if (CTheScripts::DbgFlag) + CTheScripts::DrawDebugCube(infX, infY, infZ, supX, supY, supZ); + return 0; + } + case COMMAND_DESTROY_PROJECTILES_IN_AREA: + { + CollectParameters(&m_nIp, 6); + float infX = *(float*)&ScriptParams[0]; + float infY = *(float*)&ScriptParams[1]; + float infZ = *(float*)&ScriptParams[2]; + float supX = *(float*)&ScriptParams[3]; + float supY = *(float*)&ScriptParams[4]; + float supZ = *(float*)&ScriptParams[5]; + if (infX > supX) { + infX = *(float*)&ScriptParams[3]; + supX = *(float*)&ScriptParams[0]; + } + if (infY > supY) { + infY = *(float*)&ScriptParams[4]; + supY = *(float*)&ScriptParams[1]; + } + if (infZ > supZ) { + infZ = *(float*)&ScriptParams[5]; + supZ = *(float*)&ScriptParams[2]; + } + UpdateCompareFlag(CProjectileInfo::IsProjectileInRange(infX, supX, infY, supY, infZ, supZ, true)); + if (CTheScripts::DbgFlag) + CTheScripts::DrawDebugCube(infX, infY, infZ, supX, supY, supZ); + return 0; + } + case COMMAND_DROP_MINE: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + 0.5f; + CPickups::GenerateNewOne(pos, MI_CARMINE, PICKUP_MINE_INACTIVE, 0); + return 0; + } + case COMMAND_DROP_NAUTICAL_MINE: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= -100.0f) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + 0.5f; + CPickups::GenerateNewOne(pos, MI_NAUTICALMINE, PICKUP_MINE_INACTIVE, 0); + return 0; + } + case COMMAND_IS_CHAR_MODEL: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + UpdateCompareFlag(ScriptParams[1] == pPed->GetModelIndex()); + return 0; + } + case COMMAND_LOAD_SPECIAL_MODEL: + { + CollectParameters(&m_nIp, 1); + char name[8]; + strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], 8); + for (int i = 0; i < 8; i++) + name[i] = tolower(name[i]); + CStreaming::RequestSpecialModel(ScriptParams[0], name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED); + m_nIp += 8; + return 0; + } + case COMMAND_CREATE_CUTSCENE_HEAD: + { + CollectParameters(&m_nIp, 2); + CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pObject); + CCutsceneHead* pCutHead = CCutsceneMgr::AddCutsceneHead(pObject, ScriptParams[1]); + ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pCutHead); + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_SET_CUTSCENE_HEAD_ANIM: + { + CollectParameters(&m_nIp, 1); + CObject* pCutHead = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pCutHead); + char name[8]; + strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], 8); + m_nIp += 8; + CTimer::Stop(); + CCutsceneMgr::SetHeadAnim(name, pCutHead); + CTimer::Update(); + return 0; + } + case COMMAND_SIN: + CollectParameters(&m_nIp, 1); + *(float*)&ScriptParams[0] = Sin(DEGTORAD(*(float*)&ScriptParams[0])); + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_COS: + CollectParameters(&m_nIp, 1); + *(float*)&ScriptParams[0] = Cos(DEGTORAD(*(float*)&ScriptParams[0])); + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_GET_CAR_FORWARD_X: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + float forwardX = pVehicle->GetForward().x / pVehicle->GetForward().Magnitude2D(); + *(float*)&ScriptParams[0] = forwardX; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_GET_CAR_FORWARD_Y: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + float forwardY = pVehicle->GetForward().y / pVehicle->GetForward().Magnitude2D(); + *(float*)&ScriptParams[0] = forwardY; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_CHANGE_GARAGE_TYPE: + CollectParameters(&m_nIp, 2); + CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1]); + return 0; + case COMMAND_ACTIVATE_CRUSHER_CRANE: + { + CollectParameters(&m_nIp, 10); + float infX = *(float*)&ScriptParams[2]; + float infY = *(float*)&ScriptParams[3]; + float supX = *(float*)&ScriptParams[4]; + float supY = *(float*)&ScriptParams[5]; + if (infX > supX) { + infX = *(float*)&ScriptParams[4]; + supX = *(float*)&ScriptParams[2]; + } + if (infY > supY) { + infY = *(float*)&ScriptParams[5]; + supY = *(float*)&ScriptParams[3]; + } + CCranes::ActivateCrane(infX, supX, infY, supY, + *(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8], + DEGTORAD(*(float*)&ScriptParams[8]), true, false, + *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); + return 0; + } + case COMMAND_PRINT_WITH_2_NUMBERS: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 4); + CMessages::AddMessageWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_2_NUMBERS_NOW: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 4); + CMessages::AddMessageJumpQWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_2_NUMBERS_SOON: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 4); + CMessages::AddMessageSoonWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_3_NUMBERS: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 5); + CMessages::AddMessageWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_3_NUMBERS_NOW: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 5); + CMessages::AddMessageJumpQWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_3_NUMBERS_SOON: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 5); + CMessages::AddMessageSoonWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_4_NUMBERS: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 6); + CMessages::AddMessageWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_4_NUMBERS_NOW: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 6); + CMessages::AddMessageJumpQWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_4_NUMBERS_SOON: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 6); + CMessages::AddMessageSoonWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_5_NUMBERS: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 7); + CMessages::AddMessageWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1); + return 0; + } + case COMMAND_PRINT_WITH_5_NUMBERS_NOW: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 7); + CMessages::AddMessageJumpQWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1); + return 0; + } + case COMMAND_PRINT_WITH_5_NUMBERS_SOON: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 7); + CMessages::AddMessageSoonWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1); + return 0; + } + case COMMAND_PRINT_WITH_6_NUMBERS: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 8); + CMessages::AddMessageWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]); + return 0; + } + case COMMAND_PRINT_WITH_6_NUMBERS_NOW: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 8); + CMessages::AddMessageJumpQWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]); + return 0; + } + case COMMAND_PRINT_WITH_6_NUMBERS_SOON: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 8); + CMessages::AddMessageSoonWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]); + return 0; + } + case COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION: + { + CollectParameters(&m_nIp, 3); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, pTargetPed); + pPed->SetFormation((eFormation)ScriptParams[2]); + return 0; + } + case COMMAND_PLAYER_MADE_PROGRESS: + CollectParameters(&m_nIp, 1); + CStats::ProgressMade += ScriptParams[0]; + return 0; + case COMMAND_SET_PROGRESS_TOTAL: + CollectParameters(&m_nIp, 1); + CStats::TotalProgressInGame = ScriptParams[0]; + return 0; + case COMMAND_REGISTER_JUMP_DISTANCE: + CollectParameters(&m_nIp, 1); + CStats::MaximumJumpDistance = max(CStats::MaximumJumpDistance, *(float*)&ScriptParams[0]); + return 0; + case COMMAND_REGISTER_JUMP_HEIGHT: + CollectParameters(&m_nIp, 1); + CStats::MaximumJumpHeight = max(CStats::MaximumJumpHeight, *(float*)&ScriptParams[0]); + return 0; + case COMMAND_REGISTER_JUMP_FLIPS: + CollectParameters(&m_nIp, 1); + CStats::MaximumJumpFlips = max(CStats::MaximumJumpFlips, ScriptParams[0]); + return 0; + case COMMAND_REGISTER_JUMP_SPINS: + CollectParameters(&m_nIp, 1); + CStats::MaximumJumpSpins = max(CStats::MaximumJumpSpins, ScriptParams[0]); + return 0; + case COMMAND_REGISTER_JUMP_STUNT: + CollectParameters(&m_nIp, 1); + CStats::BestStuntJump = max(CStats::BestStuntJump, ScriptParams[0]); + return 0; + case COMMAND_REGISTER_UNIQUE_JUMP_FOUND: + ++CStats::NumberOfUniqueJumpsFound; + return 0; + case COMMAND_SET_UNIQUE_JUMPS_TOTAL: + CollectParameters(&m_nIp, 1); + CStats::TotalNumberOfUniqueJumps = ScriptParams[0]; + return 0; + case COMMAND_REGISTER_PASSENGER_DROPPED_OFF_TAXI: + ++CStats::PassengersDroppedOffWithTaxi; + return 0; + case COMMAND_REGISTER_MONEY_MADE_TAXI: + CollectParameters(&m_nIp, 1); + CStats::MoneyMadeWithTaxi += ScriptParams[0]; + return 0; + case COMMAND_REGISTER_MISSION_GIVEN: + ++CStats::MissionsGiven; + return 0; + case COMMAND_REGISTER_MISSION_PASSED: + { + char name[8]; + strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], 8); + m_nIp += 8; + strncpy(CStats::LastMissionPassedName, name, 8); + ++CStats::MissionsPassed; + CStats::CheckPointReachedSuccessfully(); + return 0; + } + case COMMAND_SET_CHAR_RUNNING: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + pPed->bIsRunning = (ScriptParams[1] != 0); + return 0; + } + case COMMAND_REMOVE_ALL_SCRIPT_FIRES: + gFireManager.RemoveAllScriptFires(); + return 0; + case COMMAND_IS_FIRST_CAR_COLOUR: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + UpdateCompareFlag(pVehicle->m_currentColour1 == ScriptParams[1]); + return 0; + } + case COMMAND_IS_SECOND_CAR_COLOUR: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + UpdateCompareFlag(pVehicle->m_currentColour2 == ScriptParams[1]); + return 0; + } + case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_WEAPON: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + if (!pPed) + printf("HAS_CHAR_BEEN_DAMAGED_BY_WEAPON - Character doesn't exist\n"); + UpdateCompareFlag(pPed && pPed->m_lastWepDam == ScriptParams[1]); + return 0; + } + case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_WEAPON: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + if (!pVehicle) + printf("HAS_CAR_BEEN_DAMAGED_BY_WEAPON - Vehicle doesn't exist\n"); + UpdateCompareFlag(pVehicle && pVehicle->m_nLastWeaponDamage == ScriptParams[1]); + return 0; + } + case COMMAND_IS_CHAR_IN_CHARS_GROUP: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[1]); + assert(pPed); + assert(pLeader); + UpdateCompareFlag(pPed->m_leader == pLeader); + return 0; + } + default: + assert(0); + } + return -1; +} +#endif + +#if 1 +WRAPPER int8 CRunningScript::ProcessCommandsFrom800To899(int32 command) { EAXJMP(0x448240); } +#else +int8 CRunningScript::ProcessCommandsFrom800To899(int32 command) +{ + switch (command) { + case COMMAND_IS_CHAR_IN_PLAYERS_GROUP: + case COMMAND_EXPLODE_CHAR_HEAD: + case COMMAND_EXPLODE_PLAYER_HEAD: + case COMMAND_ANCHOR_BOAT: + case COMMAND_SET_ZONE_GROUP: + case COMMAND_START_CAR_FIRE: + case COMMAND_START_CHAR_FIRE: + case COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_AREA: + case COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_ZONE: + case COMMAND_HAS_RESPRAY_HAPPENED: + case COMMAND_SET_CAMERA_ZOOM: + case COMMAND_CREATE_PICKUP_WITH_AMMO: + case COMMAND_SET_CAR_RAM_CAR: + case COMMAND_SET_CAR_BLOCK_CAR: + case COMMAND_SET_CHAR_OBJ_CATCH_TRAIN: + case COMMAND_SET_COLL_OBJ_CATCH_TRAIN: + case COMMAND_SET_PLAYER_NEVER_GETS_TIRED: + case COMMAND_SET_PLAYER_FAST_RELOAD: + case COMMAND_SET_CHAR_BLEEDING: + case COMMAND_SET_CAR_FUNNY_SUSPENSION: + case COMMAND_SET_CAR_BIG_WHEELS: + case COMMAND_SET_FREE_RESPRAYS: + case COMMAND_SET_PLAYER_VISIBLE: + case COMMAND_SET_CHAR_VISIBLE: + case COMMAND_SET_CAR_VISIBLE: + case COMMAND_IS_AREA_OCCUPIED: + case COMMAND_START_DRUG_RUN: + case COMMAND_HAS_DRUG_RUN_BEEN_COMPLETED: + case COMMAND_HAS_DRUG_PLANE_BEEN_SHOT_DOWN: + case COMMAND_SAVE_PLAYER_FROM_FIRES: + case COMMAND_DISPLAY_TEXT: + case COMMAND_SET_TEXT_SCALE: + case COMMAND_SET_TEXT_COLOUR: + case COMMAND_SET_TEXT_JUSTIFY: + case COMMAND_SET_TEXT_CENTRE: + case COMMAND_SET_TEXT_WRAPX: + case COMMAND_SET_TEXT_CENTRE_SIZE: + case COMMAND_SET_TEXT_BACKGROUND: + case COMMAND_SET_TEXT_BACKGROUND_COLOUR: + case COMMAND_SET_TEXT_BACKGROUND_ONLY_TEXT: + case COMMAND_SET_TEXT_PROPORTIONAL: + case COMMAND_SET_TEXT_FONT: + case COMMAND_INDUSTRIAL_PASSED: + case COMMAND_COMMERCIAL_PASSED: + case COMMAND_SUBURBAN_PASSED: + case COMMAND_ROTATE_OBJECT: + case COMMAND_SLIDE_OBJECT: + case COMMAND_REMOVE_CHAR_ELEGANTLY: + case COMMAND_SET_CHAR_STAY_IN_SAME_PLACE: + case COMMAND_IS_NASTY_GAME: + case COMMAND_UNDRESS_CHAR: + case COMMAND_DRESS_CHAR: + case COMMAND_START_CHASE_SCENE: + case COMMAND_STOP_CHASE_SCENE: + case COMMAND_IS_EXPLOSION_IN_AREA: + case COMMAND_IS_EXPLOSION_IN_ZONE: + case COMMAND_START_DRUG_DROP_OFF: + case COMMAND_HAS_DROP_OFF_PLANE_BEEN_SHOT_DOWN: + case COMMAND_FIND_DROP_OFF_PLANE_COORDINATES: + case COMMAND_CREATE_FLOATING_PACKAGE: + case COMMAND_PLACE_OBJECT_RELATIVE_TO_CAR: + case COMMAND_MAKE_OBJECT_TARGETTABLE: + case COMMAND_ADD_ARMOUR_TO_PLAYER: + case COMMAND_ADD_ARMOUR_TO_CHAR: + case COMMAND_OPEN_GARAGE: + case COMMAND_CLOSE_GARAGE: + case COMMAND_WARP_CHAR_FROM_CAR_TO_COORD: + case COMMAND_SET_VISIBILITY_OF_CLOSEST_OBJECT_OF_TYPE: + case COMMAND_HAS_CHAR_SPOTTED_CHAR: + case COMMAND_SET_CHAR_OBJ_HAIL_TAXI: + case COMMAND_HAS_OBJECT_BEEN_DAMAGED: + case COMMAND_START_KILL_FRENZY_HEADSHOT: + case COMMAND_ACTIVATE_MILITARY_CRANE: + case COMMAND_WARP_PLAYER_INTO_CAR: + case COMMAND_WARP_CHAR_INTO_CAR: + case COMMAND_SWITCH_CAR_RADIO: + case COMMAND_SET_AUDIO_STREAM: + case COMMAND_PRINT_WITH_2_NUMBERS_BIG: + case COMMAND_PRINT_WITH_3_NUMBERS_BIG: + case COMMAND_PRINT_WITH_4_NUMBERS_BIG: + case COMMAND_PRINT_WITH_5_NUMBERS_BIG: + case COMMAND_PRINT_WITH_6_NUMBERS_BIG: + case COMMAND_SET_CHAR_WAIT_STATE: + case COMMAND_SET_CAMERA_BEHIND_PLAYER: + case COMMAND_SET_MOTION_BLUR: + case COMMAND_PRINT_STRING_IN_STRING: + case COMMAND_CREATE_RANDOM_CHAR: + case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR: + case COMMAND_SET_2_REPEATED_PHONE_MESSAGES: + case COMMAND_SET_2_PHONE_MESSAGES: + case COMMAND_SET_3_REPEATED_PHONE_MESSAGES: + case COMMAND_SET_3_PHONE_MESSAGES: + case COMMAND_SET_4_REPEATED_PHONE_MESSAGES: + case COMMAND_SET_4_PHONE_MESSAGES: + case COMMAND_IS_SNIPER_BULLET_IN_AREA: + case COMMAND_GIVE_PLAYER_DETONATOR: + case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR: + case COMMAND_SET_OBJECT_VELOCITY: + case COMMAND_SET_OBJECT_COLLISION: + case COMMAND_IS_ICECREAM_JINGLE_ON: + default: + assert(0); + } + return -1; +} +#endif + +#if 1 +WRAPPER int8 CRunningScript::ProcessCommandsFrom900To999(int32 command) { EAXJMP(0x44CB80); } +#else +int8 CRunningScript::ProcessCommandsFrom900To999(int32 command) +{ + switch (command){ + case COMMAND_PRINT_STRING_IN_STRING_NOW: + case COMMAND_PRINT_STRING_IN_STRING_SOON: + case COMMAND_SET_5_REPEATED_PHONE_MESSAGES: + case COMMAND_SET_5_PHONE_MESSAGES: + case COMMAND_SET_6_REPEATED_PHONE_MESSAGES: + case COMMAND_SET_6_PHONE_MESSAGES: + case COMMAND_IS_POINT_OBSCURED_BY_A_MISSION_ENTITY: + case COMMAND_LOAD_ALL_MODELS_NOW: + case COMMAND_ADD_TO_OBJECT_VELOCITY: + case COMMAND_DRAW_SPRITE: + case COMMAND_DRAW_RECT: + case COMMAND_LOAD_SPRITE: + case COMMAND_LOAD_TEXTURE_DICTIONARY: + case COMMAND_REMOVE_TEXTURE_DICTIONARY: + case COMMAND_SET_OBJECT_DYNAMIC: + case COMMAND_SET_CHAR_ANIM_SPEED: + case COMMAND_PLAY_MISSION_PASSED_TUNE: + case COMMAND_CLEAR_AREA: + case COMMAND_FREEZE_ONSCREEN_TIMER: + case COMMAND_SWITCH_CAR_SIREN: + case COMMAND_SWITCH_PED_ROADS_ON_ANGLED: + case COMMAND_SWITCH_PED_ROADS_OFF_ANGLED: + case COMMAND_SWITCH_ROADS_ON_ANGLED: + case COMMAND_SWITCH_ROADS_OFF_ANGLED: + case COMMAND_SET_CAR_WATERTIGHT: + case COMMAND_ADD_MOVING_PARTICLE_EFFECT: + case COMMAND_SET_CHAR_CANT_BE_DRAGGED_OUT: + case COMMAND_TURN_CAR_TO_FACE_COORD: + case COMMAND_IS_CRANE_LIFTING_CAR: + case COMMAND_DRAW_SPHERE: + case COMMAND_SET_CAR_STATUS: + case COMMAND_IS_CHAR_MALE: + case COMMAND_SCRIPT_NAME: + case COMMAND_CHANGE_GARAGE_TYPE_WITH_CAR_MODEL: + case COMMAND_FIND_DRUG_PLANE_COORDINATES: + case COMMAND_SAVE_INT_TO_DEBUG_FILE: + case COMMAND_SAVE_FLOAT_TO_DEBUG_FILE: + case COMMAND_SAVE_NEWLINE_TO_DEBUG_FILE: + case COMMAND_POLICE_RADIO_MESSAGE: + case COMMAND_SET_CAR_STRONG: + case COMMAND_REMOVE_ROUTE: + case COMMAND_SWITCH_RUBBISH: + case COMMAND_REMOVE_PARTICLE_EFFECTS_IN_AREA: + case COMMAND_SWITCH_STREAMING: + case COMMAND_IS_GARAGE_OPEN: + case COMMAND_IS_GARAGE_CLOSED: + case COMMAND_START_CATALINA_HELI: + case COMMAND_CATALINA_HELI_TAKE_OFF: + case COMMAND_REMOVE_CATALINA_HELI: + case COMMAND_HAS_CATALINA_HELI_BEEN_SHOT_DOWN: + case COMMAND_SWAP_NEAREST_BUILDING_MODEL: + case COMMAND_SWITCH_WORLD_PROCESSING: + case COMMAND_REMOVE_ALL_PLAYER_WEAPONS: + case COMMAND_GRAB_CATALINA_HELI: + case COMMAND_CLEAR_AREA_OF_CARS: + case COMMAND_SET_ROTATING_GARAGE_DOOR: + case COMMAND_ADD_SPHERE: + case COMMAND_REMOVE_SPHERE: + case COMMAND_CATALINA_HELI_FLY_AWAY: + case COMMAND_SET_EVERYONE_IGNORE_PLAYER: + case COMMAND_STORE_CAR_CHAR_IS_IN_NO_SAVE: + case COMMAND_STORE_CAR_PLAYER_IS_IN_NO_SAVE: + case COMMAND_IS_PHONE_DISPLAYING_MESSAGE: + case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING: + case COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING: + case COMMAND_CREATE_RANDOM_CAR_FOR_CAR_PARK: + case COMMAND_IS_COLLISION_IN_MEMORY: + case COMMAND_SET_WANTED_MULTIPLIER: + case COMMAND_SET_CAMERA_IN_FRONT_OF_PLAYER: + case COMMAND_IS_CAR_VISIBLY_DAMAGED: + case COMMAND_DOES_OBJECT_EXIST: + case COMMAND_LOAD_SCENE: + case COMMAND_ADD_STUCK_CAR_CHECK: + case COMMAND_REMOVE_STUCK_CAR_CHECK: + case COMMAND_IS_CAR_STUCK: + case COMMAND_LOAD_MISSION_AUDIO: + case COMMAND_HAS_MISSION_AUDIO_LOADED: + case COMMAND_PLAY_MISSION_AUDIO: + case COMMAND_HAS_MISSION_AUDIO_FINISHED: + case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING: + case COMMAND_HAS_IMPORT_GARAGE_SLOT_BEEN_FILLED: + case COMMAND_CLEAR_THIS_PRINT: + case COMMAND_CLEAR_THIS_BIG_PRINT: + case COMMAND_SET_MISSION_AUDIO_POSITION: + case COMMAND_ACTIVATE_SAVE_MENU: + case COMMAND_HAS_SAVE_GAME_FINISHED: + case COMMAND_NO_SPECIAL_CAMERA_FOR_THIS_GARAGE: + case COMMAND_ADD_BLIP_FOR_PICKUP_OLD: + case COMMAND_ADD_BLIP_FOR_PICKUP: + case COMMAND_ADD_SPRITE_BLIP_FOR_PICKUP: + case COMMAND_SET_PED_DENSITY_MULTIPLIER: + case COMMAND_FORCE_RANDOM_PED_TYPE: + case COMMAND_SET_TEXT_DRAW_BEFORE_FADE: + case COMMAND_GET_COLLECTABLE1S_COLLECTED: + case COMMAND_REGISTER_EL_BURRO_TIME: + case COMMAND_SET_SPRITES_DRAW_BEFORE_FADE: + case COMMAND_SET_TEXT_RIGHT_JUSTIFY: + case COMMAND_PRINT_HELP: + case COMMAND_CLEAR_HELP: + case COMMAND_FLASH_HUD_OBJECT: + default: + assert(0); + } + return -1; +} +#endif + +#if 1 +WRAPPER int8 CRunningScript::ProcessCommandsFrom1000To1099(int32 command) { EAXJMP(0x588490); } +#else +int8 CRunningScript::ProcessCommandsFrom1000To1099(int32 command) +{ + switch (command){ + case COMMAND_FLASH_RADAR_BLIP: + case COMMAND_IS_CHAR_IN_CONTROL: + case COMMAND_SET_GENERATE_CARS_AROUND_CAMERA: + case COMMAND_CLEAR_SMALL_PRINTS: + case COMMAND_HAS_MILITARY_CRANE_COLLECTED_ALL_CARS: + case COMMAND_SET_UPSIDEDOWN_CAR_NOT_DAMAGED: + case COMMAND_CAN_PLAYER_START_MISSION: + case COMMAND_MAKE_PLAYER_SAFE_FOR_CUTSCENE: + case COMMAND_USE_TEXT_COMMANDS: + case COMMAND_SET_THREAT_FOR_PED_TYPE: + case COMMAND_CLEAR_THREAT_FOR_PED_TYPE: + case COMMAND_GET_CAR_COLOURS: + case COMMAND_SET_ALL_CARS_CAN_BE_DAMAGED: + case COMMAND_SET_CAR_CAN_BE_DAMAGED: + case COMMAND_MAKE_PLAYER_UNSAFE: + case COMMAND_LOAD_COLLISION: + case COMMAND_GET_BODY_CAST_HEALTH: + case COMMAND_SET_CHARS_CHATTING: + case COMMAND_MAKE_PLAYER_SAFE: + case COMMAND_SET_CAR_STAYS_IN_CURRENT_LEVEL: + case COMMAND_SET_CHAR_STAYS_IN_CURRENT_LEVEL: + case COMMAND_REGISTER_4X4_ONE_TIME: + case COMMAND_REGISTER_4X4_TWO_TIME: + case COMMAND_REGISTER_4X4_THREE_TIME: + case COMMAND_REGISTER_4X4_MAYHEM_TIME: + case COMMAND_REGISTER_LIFE_SAVED: + case COMMAND_REGISTER_CRIMINAL_CAUGHT: + case COMMAND_REGISTER_AMBULANCE_LEVEL: + case COMMAND_REGISTER_FIRE_EXTINGUISHED: + case COMMAND_TURN_PHONE_ON: + case COMMAND_REGISTER_LONGEST_DODO_FLIGHT: + case COMMAND_REGISTER_DEFUSE_BOMB_TIME: + case COMMAND_SET_TOTAL_NUMBER_OF_KILL_FRENZIES: + case COMMAND_BLOW_UP_RC_BUGGY: + case COMMAND_REMOVE_CAR_FROM_CHASE: + case COMMAND_IS_FRENCH_GAME: + case COMMAND_IS_GERMAN_GAME: + case COMMAND_CLEAR_MISSION_AUDIO: + case COMMAND_SET_FADE_IN_AFTER_NEXT_ARREST: + case COMMAND_SET_FADE_IN_AFTER_NEXT_DEATH: + case COMMAND_SET_GANG_PED_MODEL_PREFERENCE: + case COMMAND_SET_CHAR_USE_PEDNODE_SEEK: + case COMMAND_SWITCH_VEHICLE_WEAPONS: + case COMMAND_SET_GET_OUT_OF_JAIL_FREE: + case COMMAND_SET_FREE_HEALTH_CARE: + case COMMAND_IS_CAR_DOOR_CLOSED: + case COMMAND_LOAD_AND_LAUNCH_MISSION: + case COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL: + case COMMAND_SET_OBJECT_DRAW_LAST: + case COMMAND_GET_AMMO_IN_PLAYER_WEAPON: + case COMMAND_GET_AMMO_IN_CHAR_WEAPON: + case COMMAND_REGISTER_KILL_FRENZY_PASSED: + case COMMAND_SET_CHAR_SAY: + case COMMAND_SET_NEAR_CLIP: + case COMMAND_SET_RADIO_CHANNEL: + case COMMAND_OVERRIDE_HOSPITAL_LEVEL: + case COMMAND_OVERRIDE_POLICE_STATION_LEVEL: + case COMMAND_FORCE_RAIN: + case COMMAND_DOES_GARAGE_CONTAIN_CAR: + case COMMAND_SET_CAR_TRACTION: + case COMMAND_ARE_MEASUREMENTS_IN_METRES: + case COMMAND_CONVERT_METRES_TO_FEET: + case COMMAND_MARK_ROADS_BETWEEN_LEVELS: + case COMMAND_MARK_PED_ROADS_BETWEEN_LEVELS: + case COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS: + case COMMAND_SET_CHAR_AVOID_LEVEL_TRANSITIONS: + case COMMAND_IS_THREAT_FOR_PED_TYPE: + case COMMAND_CLEAR_AREA_OF_CHARS: + case COMMAND_SET_TOTAL_NUMBER_OF_MISSIONS: + case COMMAND_CONVERT_METRES_TO_FEET_INT: + case COMMAND_REGISTER_FASTEST_TIME: + case COMMAND_REGISTER_HIGHEST_SCORE: + case COMMAND_WARP_CHAR_INTO_CAR_AS_PASSENGER: + case COMMAND_IS_CAR_PASSENGER_SEAT_FREE: + case COMMAND_GET_CHAR_IN_CAR_PASSENGER_SEAT: + case COMMAND_SET_CHAR_IS_CHRIS_CRIMINAL: + case COMMAND_START_CREDITS: + case COMMAND_STOP_CREDITS: + case COMMAND_ARE_CREDITS_FINISHED: + case COMMAND_CREATE_SINGLE_PARTICLE: + case COMMAND_SET_CHAR_IGNORE_LEVEL_TRANSITIONS: + case COMMAND_GET_CHASE_CAR: + case COMMAND_START_BOAT_FOAM_ANIMATION: + case COMMAND_UPDATE_BOAT_FOAM_ANIMATION: + case COMMAND_SET_MUSIC_DOES_FADE: + case COMMAND_SET_INTRO_IS_PLAYING: + case COMMAND_SET_PLAYER_HOOKER: + case COMMAND_PLAY_END_OF_GAME_TUNE: + case COMMAND_STOP_END_OF_GAME_TUNE: + case COMMAND_GET_CAR_MODEL: + case COMMAND_IS_PLAYER_SITTING_IN_CAR: + case COMMAND_IS_PLAYER_SITTING_IN_ANY_CAR: + case COMMAND_SET_SCRIPT_FIRE_AUDIO: + case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED: + case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS: + case COMMAND_IS_PLAYER_LIFTING_A_PHONE: + case COMMAND_IS_CHAR_SITTING_IN_CAR: + case COMMAND_IS_CHAR_SITTING_IN_ANY_CAR: + case COMMAND_IS_PLAYER_ON_FOOT: + case COMMAND_IS_CHAR_ON_FOOT: + default: + assert(0); + } + return -1; +} +#endif + +#if 1 +WRAPPER int8 CRunningScript::ProcessCommandsFrom1100To1199(int32 command) { EAXJMP(0x589D00); } +#else +int8 CRunningScript::ProcessCommandsFrom1100To1199(int32 command) +{ + switch (command) { + case COMMAND_LOAD_COLLISION_WITH_SCREEN: + case COMMAND_LOAD_SPLASH_SCREEN: + case COMMAND_SET_CAR_IGNORE_LEVEL_TRANSITIONS: + case COMMAND_MAKE_CRAIGS_CAR_A_BIT_STRONGER: + case COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER: + case COMMAND_LOAD_END_OF_GAME_TUNE: + case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA: + case COMMAND_SET_OBJECT_ROTATION: + case COMMAND_GET_DEBUG_CAMERA_COORDINATES: + case COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR: + case COMMAND_IS_PLAYER_TARGETTING_ANY_CHAR: + case COMMAND_IS_PLAYER_TARGETTING_CHAR: + case COMMAND_IS_PLAYER_TARGETTING_OBJECT: + case COMMAND_TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME: + case COMMAND_DISPLAY_TEXT_WITH_NUMBER: + case COMMAND_DISPLAY_TEXT_WITH_2_NUMBERS: + case COMMAND_FAIL_CURRENT_MISSION: + case COMMAND_GET_CLOSEST_OBJECT_OF_TYPE: + case COMMAND_PLACE_OBJECT_RELATIVE_TO_OBJECT: + case COMMAND_SET_ALL_OCCUPANTS_OF_CAR_LEAVE_CAR: + case COMMAND_SET_INTERPOLATION_PARAMETERS: + case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_TOWARDS_POINT: + case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_AWAY_POINT: + case COMMAND_GET_DEBUG_CAMERA_POINT_AT: + case COMMAND_ATTACH_CHAR_TO_CAR: + case COMMAND_DETACH_CHAR_FROM_CAR: + case COMMAND_SET_CAR_STAY_IN_FAST_LANE: + case COMMAND_CLEAR_CHAR_LAST_WEAPON_DAMAGE: + case COMMAND_CLEAR_CAR_LAST_WEAPON_DAMAGE: + case COMMAND_GET_RANDOM_COP_IN_AREA: + case COMMAND_GET_RANDOM_COP_IN_ZONE: + case COMMAND_SET_CHAR_OBJ_FLEE_CAR: + case COMMAND_GET_DRIVER_OF_CAR: + case COMMAND_GET_NUMBER_OF_FOLLOWERS: + case COMMAND_GIVE_REMOTE_CONTROLLED_MODEL_TO_PLAYER: + case COMMAND_GET_CURRENT_PLAYER_WEAPON: + case COMMAND_GET_CURRENT_CHAR_WEAPON: + case COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_2D: + case COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_2D: + case COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_2D: + case COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_3D: + case COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_3D: + case COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_3D: + case COMMAND_SET_CAR_TEMP_ACTION: + case COMMAND_SET_CAR_HANDBRAKE_TURN_RIGHT: + case COMMAND_SET_CAR_HANDBRAKE_STOP: + case COMMAND_IS_CHAR_ON_ANY_BIKE: + case COMMAND_LOCATE_SNIPER_BULLET_2D: + case COMMAND_LOCATE_SNIPER_BULLET_3D: + case COMMAND_GET_NUMBER_OF_SEATS_IN_MODEL: + case COMMAND_IS_PLAYER_ON_ANY_BIKE: + case COMMAND_IS_CHAR_LYING_DOWN: + case COMMAND_CAN_CHAR_SEE_DEAD_CHAR: + case COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER: + default: + assert(0); + } + return -1; +} +#endif + int16 CRunningScript::GetPadState(uint16 pad, uint16 button) { CPad* pPad = CPad::GetPad(pad); @@ -5190,13 +6840,6 @@ bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle) return 0.01f * CTimer::GetTimeStep() >= pVehicle->m_fDistanceTravelled; } -WRAPPER int8 CRunningScript::ProcessCommandsFrom600To699(int32 command) { EAXJMP(0x444B20); } -WRAPPER int8 CRunningScript::ProcessCommandsFrom700To799(int32 command) { EAXJMP(0x4458A0); } -WRAPPER int8 CRunningScript::ProcessCommandsFrom800To899(int32 command) { EAXJMP(0x448240); } -WRAPPER int8 CRunningScript::ProcessCommandsFrom900To999(int32 command) { EAXJMP(0x44CB80); } -WRAPPER int8 CRunningScript::ProcessCommandsFrom1000To1099(int32 command) { EAXJMP(0x588490); } -WRAPPER int8 CRunningScript::ProcessCommandsFrom1100To1199(int32 command) { EAXJMP(0x589D00); } - WRAPPER void CRunningScript::LocatePlayerCommand(int32, uint32*) { EAXJMP(0x44FE10); } WRAPPER void CRunningScript::LocatePlayerCharCommand(int32, uint32*) { EAXJMP(0x4501E0); } WRAPPER void CRunningScript::LocatePlayerCarCommand(int32, uint32*) { EAXJMP(0x450540); } @@ -5224,6 +6867,8 @@ WRAPPER void CTheScripts::CleanUpThisObject(CObject*) { EAXJMP(0x454910); } WRAPPER void CTheScripts::ReadObjectNamesFromScript() { EAXJMP(0x454960); } WRAPPER void CTheScripts::UpdateObjectIndices() { EAXJMP(0x454AD0); } WRAPPER void CTheScripts::ReadMultiScriptFileOffsetsFromScript() { EAXJMP(0x454BC0); } +WRAPPER bool CTheScripts::IsPedStopped(CPed*) { EAXJMP(0x454670); } +WRAPPER bool CTheScripts::IsPlayerStopped(CPlayerInfo*) { EAXJMP(0x4546C0); } STARTPATCHES InjectHook(0x437AE0, &CMissionCleanup::Init, PATCH_JUMP); diff --git a/src/control/Script.h b/src/control/Script.h index 2c4ec2c0..fa8344ae 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -1,5 +1,6 @@ #pragma once #include "common.h" +#include "PedType.h" #include "Text.h" #include "Sprite2d.h" @@ -8,6 +9,7 @@ class CBuilding; class CVehicle; class CPed; class CObject; +class CPlayerInfo; struct CScriptRectangle { @@ -91,6 +93,27 @@ public: m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep; } + bool ThisIsAValidRandomPed(uint32 pedtype){ + switch (pedtype){ + case PEDTYPE_CIVMALE: + case PEDTYPE_CIVFEMALE: + case PEDTYPE_GANG1: + case PEDTYPE_GANG2: + case PEDTYPE_GANG3: + case PEDTYPE_GANG4: + case PEDTYPE_GANG5: + case PEDTYPE_GANG6: + case PEDTYPE_GANG7: + case PEDTYPE_GANG8: + case PEDTYPE_GANG9: + case PEDTYPE_CRIMINAL: + case PEDTYPE_PROSTITUTE: + return true; + default: + return false; + } + } + void CollectParameters(uint32*, int16); int32 CollectNextParameterWithoutIncreasingPC(uint32); int32* GetPointerToScriptVariable(uint32*, int16); @@ -339,6 +362,9 @@ public: static void Process(); static CRunningScript* StartTestScript(); static bool IsPlayerOnAMission(); + static bool IsPedStopped(CPed*); + static bool IsPlayerStopped(CPlayerInfo*); + static bool IsVehicleStopped(CVehicle*); static void ReadObjectNamesFromScript(); static void UpdateObjectIndices(); @@ -348,7 +374,6 @@ public: static void HighlightImportantArea(uint32, float, float, float, float, float); static void DrawDebugSquare(float, float, float, float); static void DrawDebugCube(float, float, float, float, float, float); - static bool IsVehicleStopped(CVehicle*); static int32 Read4BytesFromScript(uint32* pIp){ int32 retval = 0; diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp index 7657d8e9..5c777eab 100644 --- a/src/core/Fire.cpp +++ b/src/core/Fire.cpp @@ -9,6 +9,13 @@ WRAPPER void CFireManager::StartFire(CEntity* entityOnFire, CEntity* culprit, fl WRAPPER void CFireManager::Update(void) { EAXJMP(0x479310); } WRAPPER CFire* CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); } +uint32 CFireManager::GetTotalActiveFires() const +{ + return m_nTotalFires; +} + +WRAPPER void CFireManager::Update(void) { EAXJMP(0x479310); } + CFire* CFireManager::FindNearestFire(CVector vecPos, float* pDistance) { for (int i = 0; i < MAX_FIREMEN_ATTENDING; i++) { @@ -45,7 +52,17 @@ CFireManager::ExtinguishPoint(CVector point, float range) } } +WRAPPER CFire *CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); } +WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); } +WRAPPER void CFireManager::StartFire(CVector, float, uint8) { EAXJMP(0x479500); } +WRAPPER int32 CFireManager::StartScriptFire(const CVector& pos, CEntity* culprit, float, uint8) { EAXJMP(0x479E60); } +WRAPPER bool CFireManager::IsScriptFireExtinguish(int16) { EAXJMP(0x479FC0); } +WRAPPER void CFireManager::RemoveScriptFire(int16) { EAXJMP(0x479FE0); } +WRAPPER void CFireManager::RemoveAllScriptFires(void) { EAXJMP(0x47A000); } +WRAPPER void CFireManager::SetScriptFireAudio(int16, bool) { EAXJMP(0x47A040); } + STARTPATCHES InjectHook(0x479DB0, &CFireManager::ExtinguishPoint, PATCH_JUMP); InjectHook(0x479340, &CFireManager::FindNearestFire, PATCH_JUMP); -ENDPATCHES
\ No newline at end of file +ENDPATCHES + diff --git a/src/core/Fire.h b/src/core/Fire.h index e0ad7cdf..cd6de90c 100644 --- a/src/core/Fire.h +++ b/src/core/Fire.h @@ -31,11 +31,17 @@ class CFireManager CFire m_aFires[NUM_FIRES]; public: void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32); + void StartFire(CVector, float, uint8); void Update(void); CFire *FindFurthestFire_NeverMindFireMen(CVector coors, float, float); CFire *FindNearestFire(CVector, float*); - void ExtinguishPoint(CVector, float); - uint32 GetTotalActiveFires() const { return m_nTotalFires; } + void ExtinguishPoint(CVector, float); + int32 StartScriptFire(const CVector& pos, CEntity* culprit, float, uint8); + bool IsScriptFireExtinguish(int16); + void RemoveScriptFire(int16); + void RemoveAllScriptFires(void); + void SetScriptFireAudio(int16, bool); + void ExtinguishPoint(CVector, float); }; extern CFireManager &gFireManager; diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index aa3f21a9..17c3d9d7 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -14,6 +14,21 @@ int32 &CStats::TimesArrested = *(int32*)0x8E2BEC; int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C; int32& CStats::DistanceTravelledInVehicle = *(int32*)0x940574; int32& CStats::DistanceTravelledOnFoot = *(int32*)0x941518; +int32 &CStats::ProgressMade = *(int32*)0x8F6224; +int32 &CStats::TotalProgressInGame = *(int32*)0x885B2C; +float &CStats::MaximumJumpDistance = *(float*)0x8F2BDC; +float &CStats::MaximumJumpHeight = *(float*)0x940564; +int32 &CStats::MaximumJumpFlips = *(int32*)0x8F2524; +int32 &CStats::MaximumJumpSpins = *(int32*)0x8F29B0; +int32 &CStats::BestStuntJump = *(int32*)0x885B50; +int32 &CStats::NumberOfUniqueJumpsFound = *(int32*)0x885B74; +int32 &CStats::TotalNumberOfUniqueJumps = *(int32*)0x8E2DC0; +int32 &CStats::PassengersDroppedOffWithTaxi = *(int32*)0x940724; +int32 &CStats::MoneyMadeWithTaxi = *(int32*)0x941544; +int32 &CStats::MissionsGiven = *(int32*)0x9430E8; +int32 &CStats::MissionsPassed = *(int32*)0x940768; +char(&CStats::LastMissionPassedName)[8] = *(char(*)[8])*(uintptr*)0x70D828; +int32 &CStats::TotalLegitimateKills = *(int32*)0x8F6004; void CStats::AnotherKillFrenzyPassed() { diff --git a/src/core/Stats.h b/src/core/Stats.h index 13f97218..add4320b 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -16,8 +16,24 @@ public: static int32 &KillsSinceLastCheckpoint; static int32 &DistanceTravelledInVehicle; static int32 &DistanceTravelledOnFoot; + static int32 &ProgressMade; + static int32 &TotalProgressInGame; + static float &MaximumJumpDistance; + static float &MaximumJumpHeight; + static int32 &MaximumJumpFlips; + static int32 &MaximumJumpSpins; + static int32 &BestStuntJump; + static int32 &NumberOfUniqueJumpsFound; + static int32 &TotalNumberOfUniqueJumps; + static int32 &PassengersDroppedOffWithTaxi; + static int32 &MoneyMadeWithTaxi; + static int32 &MissionsGiven; + static int32 &MissionsPassed; + static char (&LastMissionPassedName)[8]; + static int32 &TotalLegitimateKills; public: static void AnotherKillFrenzyPassed(); static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; }; + static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; }; };
\ No newline at end of file diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index d1928c04..5d235507 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -497,7 +497,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bChangedSeat = false; bUpdateAnimHeading = false; bBodyPartJustCameOff = false; - m_ped_flagC40 = false; + bIsShooting = false; bFindNewNodeAfterStateRestore = false; bHasACamera = false; @@ -519,8 +519,8 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bFleeAfterExitingCar = false; bWanderPathAfterExitingCar = false; - m_ped_flagF2 = false; - m_ped_flagF4 = false; + bIsLeader = false; + bDontDragMeOutCar = false; m_ped_flagF8 = false; bWillBeQuickJacked = false; bCancelEnteringCar = false; @@ -528,7 +528,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bDuckAndCover = false; bStillOnValidPoly = false; - m_ped_flagG2 = true; + bAllowMedicsToReviveMe = true; bResetWalkAnims = false; bStartWanderPathOnFoot = false; bOnBoat = false; @@ -538,12 +538,12 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) m_ped_flagH1 = false; bHitSteepSlope = false; - m_ped_flagH4 = false; + bCullExtraFarAway = false; bClearObjective = false; bTryingToReachDryLand = false; bCollidedWithMyVehicle = false; bRichFromMugging = false; - m_ped_flagH80 = false; + bChrisCriminal = false; bShakeFist = false; bNoCriticalHits = false; @@ -7731,7 +7731,7 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) CPed *rfPassenger = veh->pPassengers[0]; if (!rfPassenger - || rfPassenger->m_leader != this && !rfPassenger->m_ped_flagF4 && (veh->VehicleCreatedBy != MISSION_VEHICLE || m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) + || rfPassenger->m_leader != this && !rfPassenger->bDontDragMeOutCar && (veh->VehicleCreatedBy != MISSION_VEHICLE || m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) || veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset) == 0) { if ((veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) == 0 @@ -9223,7 +9223,7 @@ CPed::ProcessControl(void) } CVisibilityPlugins::SetClumpAlpha(GetClump(), alpha); - m_ped_flagC40 = false; + bIsShooting = false; BuildPedLists(); bIsInWater = false; ProcessBuoyancy(); @@ -10776,7 +10776,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) } if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) { - if (pedToDragOut && !pedToDragOut->m_ped_flagF4) { + if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) { if (pedToDragOut->m_nPedState != PED_DRIVING) { ped->QuitEnteringCar(); pedToDragOut = nil; @@ -10807,9 +10807,9 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) } } else { if (pedToDragOut) { - if (pedToDragOut->m_nPedState != PED_DRIVING || pedToDragOut->m_ped_flagF4) { + if (pedToDragOut->m_nPedState != PED_DRIVING || pedToDragOut->bDontDragMeOutCar) { - // BUG: Player freezes in that condition due to it's objective isn't restored. It's an unfinished feature, used in VC. + // BUG: Player freezes in that condition due to its objective isn't restored. It's an unfinished feature, used in VC. ped->QuitEnteringCar(); pedToDragOut = nil; } else { @@ -15860,7 +15860,7 @@ CPed::SeekCar(void) break; case STATUS_ABANDONED: if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { - if (vehToSeek->pPassengers[0]->m_ped_flagF4) { + if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (IsPlayer()) CPed::SetEnterCar(vehToSeek, m_vehEnterType); } else { diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 42d2335e..49803418 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -317,7 +317,7 @@ public: uint8 bChangedSeat : 1; uint8 bUpdateAnimHeading : 1; uint8 bBodyPartJustCameOff : 1; - uint8 m_ped_flagC40 : 1; + uint8 bIsShooting : 1; uint8 bFindNewNodeAfterStateRestore : 1; uint8 bHasACamera : 1; // does ped possess a camera to document accidents involves fire/explosion @@ -339,16 +339,16 @@ public: uint8 bFleeAfterExitingCar : 1; uint8 bWanderPathAfterExitingCar : 1; - uint8 m_ped_flagF2 : 1; - uint8 m_ped_flagF4 : 1; // Unfinished feature from VC, probably bDontDragMeOutCar + uint8 bIsLeader : 1; + uint8 bDontDragMeOutCar : 1; uint8 m_ped_flagF8 : 1; uint8 bWillBeQuickJacked : 1; uint8 bCancelEnteringCar : 1; // after door is opened or couldn't be opened due to it's locked uint8 bObstacleShowedUpDuringKillObjective : 1; uint8 bDuckAndCover : 1; - uint8 bStillOnValidPoly : 1; - uint8 m_ped_flagG2 : 1; + uint8 bStillOnValidPoly : 1; // set if the polygon the ped is on is still valid for collision + uint8 bAllowMedicsToReviveMe : 1; uint8 bResetWalkAnims : 1; uint8 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found uint8 bOnBoat : 1; // not just driver, may be just standing @@ -358,12 +358,12 @@ public: uint8 m_ped_flagH1 : 1; uint8 bHitSteepSlope : 1; // has ped collided/is standing on a steep slope (surface type) - uint8 m_ped_flagH4 : 1; + uint8 bCullExtraFarAway : 1; // special ped only gets culled if it's extra far away (for roadblocks) uint8 bClearObjective : 1; - uint8 bTryingToReachDryLand : 1; + uint8 bTryingToReachDryLand : 1; // has ped just exited boat and trying to get to dry land uint8 bCollidedWithMyVehicle : 1; - uint8 bRichFromMugging : 1; // ped has lots of cash from mugging people - will drop money if someone points gun to him - uint8 m_ped_flagH80 : 1; + uint8 bRichFromMugging : 1; // ped has lots of cash cause they've been mugging people + uint8 bChrisCriminal : 1; // Is a criminal as killed during Chris' police mission (should be counted as such) uint8 bShakeFist : 1; // test shake hand at look entity uint8 bNoCriticalHits : 1; // if set, limbs won't came off diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index d528ecca..cfcfcf65 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -61,8 +61,8 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) m_fFireBlowUpTimer = 0.0f; field_4E0 = 0; bTaxiLight = m_sAllTaxiLights; - m_auto_flagA20 = false; - m_auto_flagA40 = false; + bFixedColour = false; + bBigWheels = false; bWaterTight = false; SetModelIndex(id); diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 534f28a4..561ab566 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -87,8 +87,8 @@ public: uint8 m_bombType : 3; uint8 bTaxiLight : 1; uint8 bHadDriver : 1; // for bombs - uint8 m_auto_flagA20 : 1; - uint8 m_auto_flagA40 : 1; + uint8 bFixedColour : 1; + uint8 bBigWheels : 1; uint8 bWaterTight : 1; // no damage for non-player peds uint8 bNotDamagedUpsideDown : 1; uint8 bMoreResistantToDamage : 1; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 2399e631..7e99258c 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -2,6 +2,7 @@ #include "Physical.h" #include "AutoPilot.h" +#include "ModelIndices.h" class CPed; class CFire; @@ -267,6 +268,7 @@ public: bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } + bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } static bool &bWheelsOnlyCheat; static bool &bAllDodosCheat; diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp index 198d9b67..7919b8ab 100644 --- a/src/weapons/ProjectileInfo.cpp +++ b/src/weapons/ProjectileInfo.cpp @@ -4,4 +4,5 @@ #include "Projectile.h" WRAPPER void CProjectileInfo::RemoveAllProjectiles(void) { EAXJMP(0x55BB80); } -WRAPPER bool CProjectileInfo::RemoveIfThisIsAProjectile(CObject *pObject) { EAXJMP(0x55BBD0); }
\ No newline at end of file +WRAPPER bool CProjectileInfo::RemoveIfThisIsAProjectile(CObject *pObject) { EAXJMP(0x55BBD0); } +WRAPPER bool CProjectileInfo::IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove) { EAXJMP(0x55BA50); } diff --git a/src/weapons/ProjectileInfo.h b/src/weapons/ProjectileInfo.h index 5db57fec..e1faf028 100644 --- a/src/weapons/ProjectileInfo.h +++ b/src/weapons/ProjectileInfo.h @@ -7,4 +7,5 @@ class CProjectileInfo public:
static bool RemoveIfThisIsAProjectile(CObject *pObject);
static void RemoveAllProjectiles(void);
+ static bool IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove);
};
\ No newline at end of file |