1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 17:00:01 +00:00

Merge pull request #687 from Nick007J/miami

CarCtrl done, Script update
This commit is contained in:
aap 2020-08-19 10:08:10 +02:00 committed by GitHub
commit dba992f388
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 188 additions and 107 deletions

View file

@ -81,6 +81,9 @@
#define OFFSCREEN_DESPAWN_RANGE (40.0f) #define OFFSCREEN_DESPAWN_RANGE (40.0f)
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f) #define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
//--MIAMI: file done
bool CCarCtrl::bMadDriversCheat;
int CCarCtrl::NumLawEnforcerCars; int CCarCtrl::NumLawEnforcerCars;
int CCarCtrl::NumAmbulancesOnDuty; int CCarCtrl::NumAmbulancesOnDuty;
int CCarCtrl::NumFiretrucksOnDuty; int CCarCtrl::NumFiretrucksOnDuty;
@ -664,7 +667,7 @@ CCarCtrl::GenerateOneRandomCar()
nMadDrivers = 6; nMadDrivers = 6;
break; break;
} }
if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers /* TODO(MIAMI): || mad drivers cheat */) { if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers || bMadDriversCheat) {
pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
pVehicle->AutoPilot.m_nCruiseSpeed += 10; pVehicle->AutoPilot.m_nCruiseSpeed += 10;
@ -2515,7 +2518,7 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
SteerAIBoatWithPhysicsAttackingPlayer(pVehicle, pSwerve, pAccel, pBrake, pHandbrake); SteerAIBoatWithPhysicsAttackingPlayer(pVehicle, pSwerve, pAccel, pBrake, pHandbrake);
return; return;
case MISSION_PLANE_FLYTOCOORS: case MISSION_PLANE_FLYTOCOORS:
//SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle); SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle);
return; return;
case MISSION_SLOWLY_DRIVE_TOWARDS_PLAYER_1: case MISSION_SLOWLY_DRIVE_TOWARDS_PLAYER_1:
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil,
@ -2737,6 +2740,51 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
pHeli->GetMatrix().GetUp() = up; pHeli->GetMatrix().GetUp() = up;
} }
void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
{
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
fForwardZ = clamp(fForwardZ, -0.3f, 0.3f);
float angle = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y);
while (angle > TWOPI)
angle -= TWOPI;
float difference = LimitRadianAngle(angle - pPlane->m_fOrientation);
float steer = difference > 0.0f ? 0.04f : -0.04f;
if (Abs(difference) < 0.2f)
steer *= 5.0f * Abs(difference);
pPlane->m_fPlaneSteer *= Pow(0.96, CTimer::GetTimeStep());
float steerChange = steer - pPlane->m_fPlaneSteer;
float maxChange = 0.003f * CTimer::GetTimeStep();
if (Abs(steerChange) < maxChange)
pPlane->m_fPlaneSteer = steer;
else if (steerChange < 0.0f)
pPlane->m_fPlaneSteer -= maxChange;
else
pPlane->m_fPlaneSteer += maxChange;
pPlane->m_fOrientation += pPlane->m_fPlaneSteer * CTimer::GetTimeStep();
CVector up(0.0f, 0.0f, 1.0f);
up.Normalise();
CVector forward(Cos(pPlane->m_fOrientation), Sin(pPlane->m_fOrientation), fForwardZ);
forward.Normalise();
CVector right = CrossProduct(forward, up);
right.z -= 5.0f * pPlane->m_fPlaneSteer;
right.Normalise();
up = CrossProduct(forward, right);
up.Normalise();
right = CrossProduct(forward, up);
pPlane->GetMatrix().GetRight() = right;
pPlane->GetMatrix().GetForward() = forward;
pPlane->GetMatrix().GetUp() = up;
float newSplit = 1.0f - Pow(0.95, CTimer::GetTimeStep());
float oldSplit = 1.0f - newSplit;
#ifdef FIX_BUGS
pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.GetCruiseSpeed() * 0.01f * forward * newSplit;
#else
pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.m_nCruiseSpeed * 0.01f * forward * newSplit;
#endif
pPlane->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
}
void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerve, float* pAccel, float* pBrake, bool* pHandbrake) void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerve, float* pAccel, float* pBrake, bool* pHandbrake)
{ {
CVector2D forward = pVehicle->GetForward(); CVector2D forward = pVehicle->GetForward();

View file

@ -145,6 +145,7 @@ public:
return angle; return angle;
} }
static bool bMadDriversCheat;
static int32 NumLawEnforcerCars; static int32 NumLawEnforcerCars;
static int32 NumAmbulancesOnDuty; static int32 NumAmbulancesOnDuty;
static int32 NumFiretrucksOnDuty; static int32 NumFiretrucksOnDuty;

View file

@ -3133,7 +3133,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{ {
CollectParameters(&m_nIp, 4); CollectParameters(&m_nIp, 4);
int32 index = ScriptParams[0]; int32 index = ScriptParams[0];
assert(index < NUMPLAYERS); script_assert(index < NUMPLAYERS);
printf("&&&&&&&&&&&&&Creating player: %d\n", index); printf("&&&&&&&&&&&&&Creating player: %d\n", index);
if (!CStreaming::HasModelLoaded(MI_PLAYER)) { if (!CStreaming::HasModelLoaded(MI_PLAYER)) {
CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY); CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
@ -5174,7 +5174,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
if (pPed->bInVehicle) if (pPed->bInVehicle)
return 0; return 0;
pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]);
@ -6000,7 +6000,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pVehicle); pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pVehicle);
@ -10450,7 +10450,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pPed->m_pMyVehicle); pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pPed->m_pMyVehicle);
return 0; return 0;
@ -10653,7 +10653,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->m_nPedMoney = ScriptParams[1]; pPed->m_nPedMoney = ScriptParams[1];
pPed->bMoneyHasBeenGivenByScript = true; pPed->bMoneyHasBeenGivenByScript = true;
return 0; return 0;
@ -10663,7 +10663,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{ {
CollectParameters(&m_nIp, 4); CollectParameters(&m_nIp, 4);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
CVector result = Multiply3x3(pObject->GetMatrix(), *(CVector*)&ScriptParams[1]) + pObject->GetPosition(); CVector result = Multiply3x3(pObject->GetMatrix(), *(CVector*)&ScriptParams[1]) + pObject->GetPosition();
*(CVector*)&ScriptParams[0] = result; *(CVector*)&ScriptParams[0] = result;
StoreParameters(&m_nIp, 3); StoreParameters(&m_nIp, 3);
@ -10696,7 +10696,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{ {
CollectParameters(&m_nIp, 4); CollectParameters(&m_nIp, 4);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
CVector result = Multiply3x3(pVehicle->GetMatrix(), *(CVector*)&ScriptParams[1]) + pVehicle->GetPosition(); CVector result = Multiply3x3(pVehicle->GetMatrix(), *(CVector*)&ScriptParams[1]) + pVehicle->GetPosition();
*(CVector*)&ScriptParams[0] = result; *(CVector*)&ScriptParams[0] = result;
StoreParameters(&m_nIp, 3); StoreParameters(&m_nIp, 3);
@ -11054,7 +11054,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
UpdateCompareFlag(ScriptParams[1] < pVehicle->m_nNumMaxPassengers && pVehicle->pPassengers[ScriptParams[1]] == nil); UpdateCompareFlag(ScriptParams[1] < pVehicle->m_nNumMaxPassengers && pVehicle->pPassengers[ScriptParams[1]] == nil);
return 0; return 0;
} }
@ -11205,7 +11205,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
return 0; return 0;
*/ */
case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED: case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED:
UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3); // TODO(MIAMI): more cheats! UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8); // TODO(MIAMI): more cheats!
return 0; return 0;
case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS: case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS:
{ {
@ -11897,7 +11897,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->m_ceaseAttackTimer = ScriptParams[1]; pPed->m_ceaseAttackTimer = ScriptParams[1];
return 0; return 0;
} }
@ -11933,7 +11933,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
pVehicle->m_nRouteSeed = ScriptParams[1]; pVehicle->m_nRouteSeed = ScriptParams[1];
return 0; return 0;
} }
@ -11950,7 +11950,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->ClearWeapons(); pPed->ClearWeapons();
return 0; return 0;
} }
@ -11958,7 +11958,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
bool bFound = false; bool bFound = false;
for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) { for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
if (pPed->GetWeapon(i).m_eWeaponType == ScriptParams[1]) { if (pPed->GetWeapon(i).m_eWeaponType == ScriptParams[1]) {
@ -11975,7 +11975,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle && pVehicle->m_vehType == VEHICLE_TYPE_CAR); script_assert(pVehicle && pVehicle->m_vehType == VEHICLE_TYPE_CAR);
((CAutomobile*)pVehicle)->bTankDetonateCars = ScriptParams[1]; ((CAutomobile*)pVehicle)->bTankDetonateCars = ScriptParams[1];
return 0; return 0;
} }
@ -11994,7 +11994,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
bool bOnFire = false; bool bOnFire = false;
if (pVehicle->m_pCarFire) if (pVehicle->m_pCarFire)
bOnFire = true; bOnFire = true;
@ -12009,7 +12009,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
bool bIsBurst = false; bool bIsBurst = false;
CBike* pBike = (CBike*)pVehicle; CBike* pBike = (CBike*)pVehicle;
if (pVehicle->m_vehType == VEHICLE_APPEARANCE_BIKE) { if (pVehicle->m_vehType == VEHICLE_APPEARANCE_BIKE) {
@ -12082,7 +12082,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 5); CollectParameters(&m_nIp, 5);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); script_assert(pVehicle && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
((CAutomobile*)pVehicle)->TellHeliToGoToCoors(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], ScriptParams[4]); ((CAutomobile*)pVehicle)->TellHeliToGoToCoors(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], ScriptParams[4]);
return 0; return 0;
} }
@ -12125,7 +12125,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT);
return 0; return 0;
} }
@ -12133,7 +12133,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT);
return 0; return 0;
} }
@ -12141,7 +12141,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
return 0; return 0;
} }
@ -12149,7 +12149,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
return 0; return 0;
} }
@ -12157,7 +12157,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE);
return 0; return 0;
} }
@ -12165,7 +12165,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
return 0; return 0;
} }
@ -12260,7 +12260,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
ScriptParams[0] = pPed->GetWeapon(ScriptParams[1]).m_eWeaponType; ScriptParams[0] = pPed->GetWeapon(ScriptParams[1]).m_eWeaponType;
ScriptParams[1] = pPed->GetWeapon(ScriptParams[1]).m_nAmmoTotal; ScriptParams[1] = pPed->GetWeapon(ScriptParams[1]).m_nAmmoTotal;
ScriptParams[2] = CPickups::ModelForWeapon((eWeaponType)ScriptParams[0]); ScriptParams[2] = CPickups::ModelForWeapon((eWeaponType)ScriptParams[0]);
@ -12280,10 +12280,11 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
float speed = *(float*)&ScriptParams[1] / GAME_SPEED_TO_CARAI_SPEED; float speed = *(float*)&ScriptParams[1] / GAME_SPEED_TO_CARAI_SPEED;
pVehicle->SetMoveSpeed(pVehicle->GetForward() * speed); pVehicle->SetMoveSpeed(pVehicle->GetForward() * speed);
// TODO(MIAMI): heli hack! if (pVehicle->IsRealHeli() && pVehicle->IsCar())
((CAutomobile*)pVehicle)->m_aWheelSpeed[1] = 0.22f;
return 0; return 0;
} }
case COMMAND_SET_AREA_VISIBLE: case COMMAND_SET_AREA_VISIBLE:
@ -12304,7 +12305,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
pVehicle->bPartOfConvoy = ScriptParams[1]; pVehicle->bPartOfConvoy = ScriptParams[1];
return 0; return 0;
} }
@ -12336,9 +12337,9 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
assert(pTargetPed); script_assert(pTargetPed);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING, pTargetPed); pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING, pTargetPed);
return 0; return 0;
@ -12348,7 +12349,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 4); CollectParameters(&m_nIp, 4);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
CVector result = Multiply3x3(pPed->GetMatrix(), *(CVector*)&ScriptParams[1]) + pPed->GetPosition(); CVector result = Multiply3x3(pPed->GetMatrix(), *(CVector*)&ScriptParams[1]) + pPed->GetPosition();
*(CVector*)&ScriptParams[0] = result; *(CVector*)&ScriptParams[0] = result;
StoreParameters(&m_nIp, 3); StoreParameters(&m_nIp, 3);
@ -12358,7 +12359,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
bool result = false; bool result = false;
if (pPed->bHasBeenPhotographed) { if (pPed->bHasBeenPhotographed) {
result = true; result = true;
@ -12371,9 +12372,9 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
assert(pTargetPed); script_assert(pTargetPed);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_AIM_GUN_AT, pTargetPed); pPed->SetObjective(OBJECTIVE_AIM_GUN_AT, pTargetPed);
return 0; return 0;
@ -12389,7 +12390,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && (pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI || pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE)); UpdateCompareFlag(pPed->bInVehicle && (pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI || pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE));
return 0; return 0;
} }
@ -12419,7 +12420,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); script_assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli());
float fAngle = DEGTORAD(*(float*)&ScriptParams[1] - 90.0f); float fAngle = DEGTORAD(*(float*)&ScriptParams[1] - 90.0f);
while (fAngle < 0.0f) while (fAngle < 0.0f)
fAngle += TWOPI; fAngle += TWOPI;
@ -12432,14 +12433,16 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); script_assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli());
pHeli->ClearHeliOrientation(); pHeli->ClearHeliOrientation();
return 0; return 0;
} }
case COMMAND_PLANE_GOTO_COORDS: case COMMAND_PLANE_GOTO_COORDS:
{ {
CollectParameters(&m_nIp, 5); CollectParameters(&m_nIp, 5);
debug("PLANE_GOTO_COORS is not implemented\n"); // TODO(MIAMI) CAutomobile* pPlane = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
script_assert(pPlane && pPlane->IsCar() && pPlane->IsRealPlane());
pPlane->TellPlaneToGoToCoors(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], ScriptParams[4]);
return 0; return 0;
} }
case COMMAND_GET_NTH_CLOSEST_CAR_NODE: case COMMAND_GET_NTH_CLOSEST_CAR_NODE:
@ -12471,7 +12474,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bIsFrozen = ScriptParams[1]; pPed->bIsFrozen = ScriptParams[1];
return 0; return 0;
} }
@ -12479,7 +12482,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bDrownsInWater = ScriptParams[1]; pPed->bDrownsInWater = ScriptParams[1];
return 0; return 0;
} }
@ -12487,7 +12490,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
pObject->bUseCollisionRecords = ScriptParams[1]; pObject->bUseCollisionRecords = ScriptParams[1];
return 0; return 0;
} }
@ -12495,7 +12498,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
UpdateCompareFlag(pObject->m_nCollisionRecords != 0); UpdateCompareFlag(pObject->m_nCollisionRecords != 0);
return 0; return 0;
} }
@ -12509,7 +12512,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
ScriptParams[0] = pPed->m_fArmour; ScriptParams[0] = pPed->m_fArmour;
StoreParameters(&m_nIp, 1); StoreParameters(&m_nIp, 1);
return 0; return 0;
@ -12519,7 +12522,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
pVehicle->bHeliMinimumTilt = ScriptParams[1]; pVehicle->bHeliMinimumTilt = ScriptParams[1];
return 0; return 0;
} }
@ -12527,7 +12530,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
pVehicle->AutoPilot.m_nSwitchDistance = ScriptParams[1]; pVehicle->AutoPilot.m_nSwitchDistance = ScriptParams[1];
return 0; return 0;
} }
@ -12535,7 +12538,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pCar&& pCar->IsCar()); script_assert(pCar&& pCar->IsCar());
pCar->PopBoot(); pCar->PopBoot();
return 0; return 0;
} }
@ -12568,7 +12571,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
UpdateCompareFlag(pObject->bIsInWater); UpdateCompareFlag(pObject->bIsInWater);
return 0; return 0;
} }
@ -12581,7 +12584,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 3); CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
if (ScriptParams[1]) { if (ScriptParams[1]) {
pPed->bIsDucking = true; pPed->bIsDucking = true;
pPed->SetDuck(ScriptParams[2], true); pPed->SetDuck(ScriptParams[2], true);
@ -12645,7 +12648,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bIsStaticWaitingForCollision); UpdateCompareFlag(pPed->bIsStaticWaitingForCollision);
return 0; return 0;
} }
@ -12653,7 +12656,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
UpdateCompareFlag(pVehicle->bIsStaticWaitingForCollision); UpdateCompareFlag(pVehicle->bIsStaticWaitingForCollision);
return 0; return 0;
} }
@ -12661,7 +12664,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
UpdateCompareFlag(pObject->bIsStaticWaitingForCollision); UpdateCompareFlag(pObject->bIsStaticWaitingForCollision);
return 0; return 0;
} }
@ -12684,7 +12687,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 3); CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bIsPlayerFriend = ScriptParams[2]; pPed->bIsPlayerFriend = ScriptParams[2];
return 0; return 0;
} }
@ -12692,7 +12695,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_DISPLAY_NTH_ONSCREEN_COUNTER_WITH_STRING: case COMMAND_DISPLAY_NTH_ONSCREEN_COUNTER_WITH_STRING:
{ {
char onscreen_str[12]; char onscreen_str[12];
assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
int16 var = CTheScripts::Read2BytesFromScript(&m_nIp); int16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
@ -12763,7 +12766,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->m_prevObjective == OBJECTIVE_NONE && pPed->m_objective == OBJECTIVE_NONE); UpdateCompareFlag(pPed->m_prevObjective == OBJECTIVE_NONE && pPed->m_objective == OBJECTIVE_NONE);
return 0; return 0;
} }
@ -12776,7 +12779,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++)
key[i] = tolower(key[i]); key[i] = tolower(key[i]);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
UpdateCompareFlag(strcmp(key, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName()) == 0); UpdateCompareFlag(strcmp(key, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName()) == 0);
return 0; return 0;
} }
@ -12791,7 +12794,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 3); CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
CVector pos; CVector pos;
pos.x = *(float*)&ScriptParams[1]; pos.x = *(float*)&ScriptParams[1];
pos.y = *(float*)&ScriptParams[2]; pos.y = *(float*)&ScriptParams[2];
@ -12824,7 +12827,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pCar&& pCar->IsCar()); script_assert(pCar&& pCar->IsCar());
pCar->CloseAllDoors(); pCar->CloseAllDoors();
return 0; return 0;
} }
@ -12846,7 +12849,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pCar && pCar->IsCar()); script_assert(pCar && pCar->IsCar());
pCar->PopBootUsingPhysics(); pCar->PopBootUsingPhysics();
return 0; return 0;
} }
@ -12855,7 +12858,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE); UpdateCompareFlag(pPed->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE);
return 0; return 0;
} }
@ -12863,7 +12866,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
pObject->m_pCollidingEntity = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); pObject->m_pCollidingEntity = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
return 0; return 0;
} }
@ -12872,7 +12875,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 5); CollectParameters(&m_nIp, 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(CWorld::IsWanderPathClear(pPed->GetPosition(), *(CVector*)&ScriptParams[0], *(float*)&ScriptParams[3], 4)); UpdateCompareFlag(CWorld::IsWanderPathClear(pPed->GetPosition(), *(CVector*)&ScriptParams[0], *(float*)&ScriptParams[3], 4));
return 0; return 0;
} }
@ -12885,7 +12888,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
} }
//case COMMAND_PRINT_HELP_FOREVER_WITH_NUMBER: //case COMMAND_PRINT_HELP_FOREVER_WITH_NUMBER:
default: default:
assert(0); script_assert(0);
} }
return -1; return -1;
} }
@ -12897,7 +12900,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 3); CollectParameters(&m_nIp, 3);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pTarget); script_assert(pTarget);
uint8 flag = 1 << (uint8)ScriptParams[1]; uint8 flag = 1 << (uint8)ScriptParams[1];
if (ScriptParams[2]) if (ScriptParams[2])
pTarget->m_gangFlags |= flag; pTarget->m_gangFlags |= flag;
@ -12943,7 +12946,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
pVehicle->bIsFrozen = ScriptParams[1]; pVehicle->bIsFrozen = ScriptParams[1];
return 0; return 0;
} }
@ -13011,7 +13014,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bStayInCarOnJack = ScriptParams[1]; pPed->bStayInCarOnJack = ScriptParams[1];
return 0; return 0;
} }
@ -13076,7 +13079,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bDontFight = !ScriptParams[1]; pPed->bDontFight = !ScriptParams[1];
return 0; return 0;
} }
@ -13084,7 +13087,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->ClearWaitState(); pPed->ClearWaitState();
return 0; return 0;
} }
@ -13119,7 +13122,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
pVehicle->bTyresDontBurst = !ScriptParams[1]; pVehicle->bTyresDontBurst = !ScriptParams[1];
return 0; return 0;
} }
@ -13127,7 +13130,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
pPed->bDoomAim = ScriptParams[1]; pPed->bDoomAim = ScriptParams[1];
return 0; return 0;
} }
@ -13166,7 +13169,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
CPhysical* pTestedEntity = pPed; CPhysical* pTestedEntity = pPed;
if (pPed->bInVehicle && pPed->m_pMyVehicle) if (pPed->bInVehicle && pPed->m_pMyVehicle)
@ -13198,7 +13201,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
if (pPed->GetPedState() == PED_FOLLOW_PATH) { if (pPed->GetPedState() == PED_FOLLOW_PATH) {
pPed->RestorePreviousState(); pPed->RestorePreviousState();
pPed->ClearFollowPath(); pPed->ClearFollowPath();
@ -13209,7 +13212,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bCanBeShotInVehicle = ScriptParams[1]; pPed->bCanBeShotInVehicle = ScriptParams[1];
return 0; return 0;
} }
@ -13248,7 +13251,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
pObject->bIsFrozen = ScriptParams[1]; pObject->bIsFrozen = ScriptParams[1];
return 0; return 0;
} }
@ -13384,7 +13387,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bIgnoreThreatsBehindObjects = ScriptParams[1]; pPed->bIgnoreThreatsBehindObjects = ScriptParams[1];
return 0; return 0;
} }
@ -13392,7 +13395,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
if (pPed->bInVehicle) { if (pPed->bInVehicle) {
if (pPed->GetWeapon(5).m_eWeaponType) { // TODO(MIAMI): enum if (pPed->GetWeapon(5).m_eWeaponType) { // TODO(MIAMI): enum
if (pPed->GetWeapon(5).m_nAmmoTotal < ScriptParams[1]) if (pPed->GetWeapon(5).m_nAmmoTotal < ScriptParams[1])
@ -13411,7 +13414,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); script_assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli());
pHeli->bHeliDestroyed = true; pHeli->bHeliDestroyed = true;
return 0; return 0;
} }
@ -13425,7 +13428,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
pObject->m_area = ScriptParams[1]; pObject->m_area = ScriptParams[1];
return 0; return 0;
} }
@ -13434,7 +13437,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bNeverEverTargetThisPed = ScriptParams[1]; pPed->bNeverEverTargetThisPed = ScriptParams[1];
return 0; return 0;
} }
@ -13455,7 +13458,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
pPed->bCrouchWhenScared = true; pPed->bCrouchWhenScared = true;
return 0; return 0;
} }
@ -13463,7 +13466,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle && UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle &&
pPed->m_pMyVehicle->IsLawEnforcementVehicle() && pPed->m_pMyVehicle->IsLawEnforcementVehicle() &&
pPed->m_pMyVehicle->GetModelIndex() != MI_PREDATOR); pPed->m_pMyVehicle->GetModelIndex() != MI_PREDATOR);
@ -13492,7 +13495,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->m_nWaitState == WAITSTATE_STUCK); UpdateCompareFlag(pPed->m_nWaitState == WAITSTATE_STUCK);
return 0; return 0;
} }
@ -13506,7 +13509,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
if (ScriptParams[1]) { if (ScriptParams[1]) {
pPed->bKindaStayInSamePlace = true; pPed->bKindaStayInSamePlace = true;
pPed->bStopAndShoot = true; pPed->bStopAndShoot = true;
@ -13522,7 +13525,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
if (ScriptParams[1]) { if (ScriptParams[1]) {
pVehicle->bIsFrozen = true; pVehicle->bIsFrozen = true;
pVehicle->bInfiniteMass = true; pVehicle->bInfiniteMass = true;
@ -13542,7 +13545,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
//case COMMAND_FREEZE_OBJECT_POSITION_AND_DONT_LOAD_COLLISION: //case COMMAND_FREEZE_OBJECT_POSITION_AND_DONT_LOAD_COLLISION:
//case COMMAND_SET_FADE_AND_JUMPCUT_AFTER_RC_EXPLOSION: //case COMMAND_SET_FADE_AND_JUMPCUT_AFTER_RC_EXPLOSION:
default: default:
assert(0); script_assert(0);
} }
return -1; return -1;
} }
@ -13558,7 +13561,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
if (!pPed->bInVehicle) { if (!pPed->bInVehicle) {
pPed->m_pVehicleAnim = nil; pPed->m_pVehicleAnim = nil;
pPed->RestartNonPartialAnims(); pPed->RestartNonPartialAnims();
@ -13617,9 +13620,9 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
assert(pVehicle); script_assert(pVehicle);
ScriptParams[0] = 0; ScriptParams[0] = 0;
if (pPed->m_objective == OBJECTIVE_NONE && !pPed->bHasAlreadyUsedAttractor) { if (pPed->m_objective == OBJECTIVE_NONE && !pPed->bHasAlreadyUsedAttractor) {
C2dEffect* pEffect = (C2dEffect*)GetPedAttractorManager()->GetEffectForIceCreamVan(pVehicle, pPed->GetPosition()); // has to be casted, because inner methods are const C2dEffect* pEffect = (C2dEffect*)GetPedAttractorManager()->GetEffectForIceCreamVan(pVehicle, pPed->GetPosition()); // has to be casted, because inner methods are const
@ -13661,7 +13664,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
if (pPed->m_attractor) if (pPed->m_attractor)
GetPedAttractorManager()->DeRegisterPed(pPed, pPed->m_attractor); GetPedAttractorManager()->DeRegisterPed(pPed, pPed->m_attractor);
return 0; return 0;
@ -13673,7 +13676,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bHasAlreadyUsedAttractor); UpdateCompareFlag(pPed->bHasAlreadyUsedAttractor);
return 0; return 0;
} }
@ -13681,7 +13684,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
if (ScriptParams[1]) { if (ScriptParams[1]) {
pVehicle->bDontLoadCollision = false; pVehicle->bDontLoadCollision = false;
if (m_bMissionFlag) { if (m_bMissionFlag) {
@ -13704,7 +13707,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
if (ScriptParams[1]) { if (ScriptParams[1]) {
pPed->bDontLoadCollision = false; pPed->bDontLoadCollision = false;
if (m_bMissionFlag) { if (m_bMissionFlag) {
@ -13734,7 +13737,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bBoughtIceCream); UpdateCompareFlag(pPed->bBoughtIceCream);
return 0; return 0;
} }
@ -13808,20 +13811,39 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
} }
//case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_ZONE: //case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_ZONE:
case COMMAND_UNLOCK_ALL_CAR_DOORS_IN_AREA: case COMMAND_UNLOCK_ALL_CAR_DOORS_IN_AREA:
{
CollectParameters(&m_nIp, 4); CollectParameters(&m_nIp, 4);
debug("UNLOCK_ALL_CAR_DOORS_IN_AREA not implemented\n"); // TODO(MIAMI) uint32 i = CPools::GetVehiclePool()->GetSize();
float infX = *(float*)&ScriptParams[0];
float infY = *(float*)&ScriptParams[1];
float supX = *(float*)&ScriptParams[2];
float supY = *(float*)&ScriptParams[3];
while (i--) {
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!pVehicle)
continue;
if (pVehicle->IsWithinArea(infX, infY, supX, supY))
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
}
return 0; return 0;
}
case COMMAND_SET_GANG_ATTACK_PLAYER_WITH_COPS: case COMMAND_SET_GANG_ATTACK_PLAYER_WITH_COPS:
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CGangs::SetWillAttackPlayerWithCops((ePedType)((int)PEDTYPE_GANG1 + ScriptParams[0]), !!ScriptParams[1]); CGangs::SetWillAttackPlayerWithCops((ePedType)((int)PEDTYPE_GANG1 + ScriptParams[0]), !!ScriptParams[1]);
return 0; return 0;
case COMMAND_SET_CHAR_FRIGHTENED_IN_JACKED_CAR: case COMMAND_SET_CHAR_FRIGHTENED_IN_JACKED_CAR:
assert(0); {
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
script_assert(pPed);
pPed->bHeldHostageInCar = ScriptParams[1];
return 0;
}
case COMMAND_SET_VEHICLE_TO_FADE_IN: case COMMAND_SET_VEHICLE_TO_FADE_IN:
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); script_assert(pVehicle);
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), ScriptParams[1]); CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), ScriptParams[1]);
return 0; return 0;
} }
@ -13835,7 +13857,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle && pPed->m_pMyVehicle == CGameLogic::pShortCutTaxi); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle && pPed->m_pMyVehicle == CGameLogic::pShortCutTaxi);
return 0; return 0;
} }
@ -13843,7 +13865,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); script_assert(pPed);
UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_DUCK_DOWN) != nil); UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_DUCK_DOWN) != nil);
return 0; return 0;
} }
@ -13883,7 +13905,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
return 0; return 0;
} }
default: default:
assert(0); script_assert(0);
} }
return -1; return -1;
} }
@ -14863,7 +14885,7 @@ void CRunningScript::LocateObjectCommand(int32 command, uint32* pIp)
} }
CollectParameters(pIp, b3D ? 8 : 6); CollectParameters(pIp, b3D ? 8 : 6);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
CVector pos = pObject->GetPosition(); CVector pos = pObject->GetPosition();
X = *(float*)&ScriptParams[1]; X = *(float*)&ScriptParams[1];
Y = *(float*)&ScriptParams[2]; Y = *(float*)&ScriptParams[2];
@ -15418,7 +15440,7 @@ void CRunningScript::ObjectInAreaCheckCommand(int32 command, uint32* pIp)
} }
CollectParameters(pIp, b3D ? 8 : 6); CollectParameters(pIp, b3D ? 8 : 6);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
assert(pObject); script_assert(pObject);
CVector pos = pObject->GetPosition(); CVector pos = pObject->GetPosition();
infX = *(float*)&ScriptParams[1]; infX = *(float*)&ScriptParams[1];
infY = *(float*)&ScriptParams[2]; infY = *(float*)&ScriptParams[2];
@ -15471,7 +15493,7 @@ void CRunningScript::ObjectInAreaCheckCommand(int32 command, uint32* pIp)
result = true; result = true;
break; break;
default: default:
assert(false); script_assert(false);
break; break;
} }
} }

View file

@ -42,6 +42,7 @@
#include "Gangs.h" #include "Gangs.h"
#include "platform.h" #include "platform.h"
#include "Stats.h" #include "Stats.h"
#include "CarCtrl.h"
#ifdef GTA_PS2 #ifdef GTA_PS2
#include "eetypes.h" #include "eetypes.h"
@ -437,6 +438,12 @@ void PinkCarsCheat()
gbPinkCars = true; gbPinkCars = true;
} }
void MadCarsCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
CCarCtrl::bMadDriversCheat = true;
}
void NoSeaBedCheat(void) void NoSeaBedCheat(void)
{ {
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
@ -1228,6 +1235,7 @@ void CPad::AddToPCCheatString(char c)
// "MIAMITRAFFIC" // "MIAMITRAFFIC"
else if (!Cheat_strncmp(KeyBoardCheatString, "FNMGNmWPNLVU")) { else if (!Cheat_strncmp(KeyBoardCheatString, "FNMGNmWPNLVU")) {
KeyBoardCheatString[0] = ' '; KeyBoardCheatString[0] = ' ';
MadCarsCheat();
} }
// "AHAIRDRESSERSCAR" // "AHAIRDRESSERSCAR"
else if (!Cheat_strncmp(KeyBoardCheatString, "UFJT_`VZF]QZPaUG")) { else if (!Cheat_strncmp(KeyBoardCheatString, "UFJT_`VZF]QZPaUG")) {
@ -3104,7 +3112,7 @@ void CPad::ResetCheats(void)
CVehicle::bCheat8 = false; CVehicle::bCheat8 = false;
gbBlackCars = false; gbBlackCars = false;
gbPinkCars = false; gbPinkCars = false;
CCarCtrl::bMadDriversCheat = false;
gbFastTime = false; gbFastTime = false;
CTimer::SetTimeScale(1.0f); CTimer::SetTimeScale(1.0f);
} }

View file

@ -143,7 +143,9 @@ void CStats::Init()
DistanceTravelledByBoat = 0; DistanceTravelledByBoat = 0;
DistanceTravelledByGolfCart = 0; DistanceTravelledByGolfCart = 0;
DistanceTravelledByHelicoptor = 0; DistanceTravelledByHelicoptor = 0;
DistanceTravelledByPlane = 0; // FIX: Wasn't initialized #ifdef FIX_BUGS
DistanceTravelledByPlane = 0;
#endif
LivesSavedWithAmbulance = 0; LivesSavedWithAmbulance = 0;
CriminalsCaught = 0; CriminalsCaught = 0;
HighestLevelVigilanteMission = 0; HighestLevelVigilanteMission = 0;

View file

@ -154,7 +154,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
m_fElasticity = 0.05f; m_fElasticity = 0.05f;
m_fBuoyancy = pHandling->fBuoyancy; m_fBuoyancy = pHandling->fBuoyancy;
m_fOrientation = m_auto_unk4 = 0.0f; m_fOrientation = m_fPlaneSteer = 0.0f;
m_nBusDoorTimerEnd = 0; m_nBusDoorTimerEnd = 0;
m_nBusDoorTimerStart = 0; m_nBusDoorTimerStart = 0;

View file

@ -54,7 +54,7 @@ public:
float m_fTraction; float m_fTraction;
float m_fTireTemperature; float m_fTireTemperature;
float m_fOrientation; // for heli and plane go-to float m_fOrientation; // for heli and plane go-to
float m_auto_unk4; // related to the above float m_fPlaneSteer; // related to the above
float m_fVelocityChangeForAudio; float m_fVelocityChangeForAudio;
float m_randomValues[6]; // used for what? float m_randomValues[6]; // used for what?
float m_fFireBlowUpTimer; float m_fFireBlowUpTimer;

2
vendor/librw vendored

@ -1 +1 @@
Subproject commit 5e299fb12e0ab85b5a32032544f58480a93a4a32 Subproject commit a78a02394e4c528a2ade867dfd0ffe04e32ec474