diff options
author | aap <aap@papnet.eu> | 2020-05-21 10:32:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-21 10:32:11 +0200 |
commit | bc4d62894014d06f24786c59606c05a8fec7d5c8 (patch) | |
tree | df2197b26038bf47d91998bbb173f519e81ec5b6 /src/control/Script.cpp | |
parent | Pickup and audio fix (diff) | |
parent | script revision (diff) | |
download | re3-bc4d62894014d06f24786c59606c05a8fec7d5c8.tar re3-bc4d62894014d06f24786c59606c05a8fec7d5c8.tar.gz re3-bc4d62894014d06f24786c59606c05a8fec7d5c8.tar.bz2 re3-bc4d62894014d06f24786c59606c05a8fec7d5c8.tar.lz re3-bc4d62894014d06f24786c59606c05a8fec7d5c8.tar.xz re3-bc4d62894014d06f24786c59606c05a8fec7d5c8.tar.zst re3-bc4d62894014d06f24786c59606c05a8fec7d5c8.zip |
Diffstat (limited to 'src/control/Script.cpp')
-rw-r--r-- | src/control/Script.cpp | 879 |
1 files changed, 624 insertions, 255 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1ea68dd3..eb94918e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -75,14 +75,8 @@ #include "main.h" #define PICKUP_PLACEMENT_OFFSET 0.5f -#define PED_FIND_Z_OFFSET 10.0f - -#define SPHERE_MARKER_R 0 -#define SPHERE_MARKER_G 128 -#define SPHERE_MARKER_B 255 -#define SPHERE_MARKER_A 128 -#define SPHERE_MARKER_PULSE_PERIOD 2048 -#define SPHERE_MARKER_PULSE_FRACTION 0.1f +#define PED_FIND_Z_OFFSET 5.0f +#define COP_PED_FIND_Z_OFFSET 10.0f #ifdef USE_PRECISE_MEASUREMENT_CONVERTION #define METERS_IN_FOOT 0.3048f @@ -2978,22 +2972,21 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) int8 CRunningScript::ProcessCommands300To399(int32 command) { switch (command) { - /* Not implemented. - case COMMAND_SET_CHAR_INVINCIBLE: - case COMMAND_SET_PLAYER_INVINCIBLE: - case COMMAND_SET_CHAR_GRAPHIC_TYPE: - case COMMAND_SET_PLAYER_GRAPHIC_TYPE: - */ + //case COMMAND_SET_CHAR_INVINCIBLE: + //case COMMAND_SET_PLAYER_INVINCIBLE: + //case COMMAND_SET_CHAR_GRAPHIC_TYPE: + //case COMMAND_SET_PLAYER_GRAPHIC_TYPE: + /* case COMMAND_HAS_PLAYER_BEEN_ARRESTED: CollectParameters(&m_nIp, 1); UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_BUSTED); return 0; - /* Not implemented. - case COMMAND_STOP_CHAR_DRIVING: - case COMMAND_KILL_CHAR: - case COMMAND_SET_FAVOURITE_CAR_MODEL_FOR_CHAR: - case COMMAND_SET_CHAR_OCCUPATION: */ + //case COMMAND_STOP_CHAR_DRIVING: + //case COMMAND_KILL_CHAR: + //case COMMAND_SET_FAVOURITE_CAR_MODEL_FOR_CHAR: + //case COMMAND_SET_CHAR_OCCUPATION: + /* case COMMAND_CHANGE_CAR_LOCK: { CollectParameters(&m_nIp, 2); @@ -3009,6 +3002,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) *(float*)&ScriptParams[2], *(float*)&ScriptParams[3]); return 0; + */ case COMMAND_IS_CAR_MODEL: { CollectParameters(&m_nIp, 2); @@ -3017,11 +3011,10 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) UpdateCompareFlag(pVehicle->GetModelIndex() == ScriptParams[1]); return 0; } - /* Not implemented. - case COMMAND_IS_CAR_REMAP: - case COMMAND_HAS_CAR_JUST_SUNK: - case COMMAND_SET_CAR_NO_COLLIDE: - */ + //case COMMAND_IS_CAR_REMAP: + //case COMMAND_HAS_CAR_JUST_SUNK: + //case COMMAND_SET_CAR_NO_COLLIDE: + /* case COMMAND_IS_CAR_DEAD_IN_AREA_2D: { CollectParameters(&m_nIp, 6); @@ -3060,35 +3053,39 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2); return 0; } - /* Not implemented. - case COMMAND_IS_TRAILER_ATTACHED: - case COMMAND_IS_CAR_ON_TRAILER: - case COMMAND_HAS_CAR_GOT_WEAPON: - case COMMAND_PARK: - case COMMAND_HAS_PARK_FINISHED: - case COMMAND_KILL_ALL_PASSENGERS: - case COMMAND_SET_CAR_BULLETPROOF: - case COMMAND_SET_CAR_FLAMEPROOF: - case COMMAND_SET_CAR_ROCKETPROOF: - case COMMAND_IS_CARBOMB_ACTIVE: - case COMMAND_GIVE_CAR_ALARM: - case COMMAND_PUT_CAR_ON_TRAILER: */ + //case COMMAND_IS_TRAILER_ATTACHED: + //case COMMAND_IS_CAR_ON_TRAILER: + //case COMMAND_HAS_CAR_GOT_WEAPON: + //case COMMAND_PARK: + //case COMMAND_HAS_PARK_FINISHED: + //case COMMAND_KILL_ALL_PASSENGERS: + //case COMMAND_SET_CAR_BULLETPROOF: + //case COMMAND_SET_CAR_FLAMEPROOF: + //case COMMAND_SET_CAR_ROCKETPROOF: + //case COMMAND_IS_CARBOMB_ACTIVE: + //case COMMAND_GIVE_CAR_ALARM: + //case COMMAND_PUT_CAR_ON_TRAILER: + /* case COMMAND_IS_CAR_CRUSHED: CollectParameters(&m_nIp, 1); UpdateCompareFlag(CGarages::HasCarBeenCrushed(ScriptParams[0])); return 0; - /* Not implemented. - case COMMAND_CREATE_GANG_CAR: */ + //case COMMAND_CREATE_GANG_CAR: case COMMAND_CREATE_CAR_GENERATOR: + { CollectParameters(&m_nIp, 12); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z > MAP_Z_LOW_LIMIT) + pos.z += 0.015f; ScriptParams[0] = CTheCarGenerators::CreateCarGenerator( - *(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], + pos.x, pos.y, pos.z, *(float*)&ScriptParams[3], ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7], ScriptParams[8], ScriptParams[9], ScriptParams[10], ScriptParams[11]); StoreParameters(&m_nIp, 1); return 0; + } case COMMAND_SWITCH_CAR_GENERATOR: { CollectParameters(&m_nIp, 2); @@ -3103,6 +3100,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) } return 0; } + /* case COMMAND_ADD_PAGER_MESSAGE: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -3110,11 +3108,14 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CUserDisplay::Pager.AddMessage(text, ScriptParams[0], ScriptParams[1], ScriptParams[2]); return 0; } + */ case COMMAND_DISPLAY_ONSCREEN_TIMER: { assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); m_nIp++; - CUserDisplay::OnscnTimer.AddClock(CTheScripts::Read2BytesFromScript(&m_nIp), nil); + uint32 offset = CTheScripts::Read2BytesFromScript(&m_nIp); + CollectParameters(&m_nIp, 1); + CUserDisplay::OnscnTimer.AddClock(offset, nil, ScriptParams[0] != 0); return 0; } case COMMAND_CLEAR_ONSCREEN_TIMER: @@ -3130,7 +3131,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) m_nIp++; int32 counter = CTheScripts::Read2BytesFromScript(&m_nIp); CollectParameters(&m_nIp, 1); - CUserDisplay::OnscnTimer.AddCounter(counter, ScriptParams[0], nil); + CUserDisplay::OnscnTimer.AddCounter(counter, ScriptParams[0], nil, 0); return 0; } case COMMAND_CLEAR_ONSCREEN_COUNTER: @@ -3166,9 +3167,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) } return 0; } - /* Not implemented. - case COMMAND_IS_CHAR_IN_GANG_ZONE: - */ + //case COMMAND_IS_CHAR_IN_GANG_ZONE: case COMMAND_IS_CHAR_IN_ZONE: { CollectParameters(&m_nIp, 1); @@ -3183,10 +3182,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) UpdateCompareFlag(CTheZones::PointLiesWithinZone(&pos, CTheZones::GetNavigationZone(zone))); return 0; } - /* Not implemented. - case COMMAND_SET_CAR_DENSITY: - case COMMAND_SET_PED_DENSITY: - */ + //case COMMAND_SET_CAR_DENSITY: + //case COMMAND_SET_PED_DENSITY: case COMMAND_POINT_CAMERA_AT_PLAYER: { CollectParameters(&m_nIp, 3); @@ -3198,24 +3195,26 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); + if (pVehicle) + TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); return 0; } case COMMAND_POINT_CAMERA_AT_CHAR: { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); - TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); + if (pPed) + TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); return 0; } case COMMAND_RESTORE_CAMERA: TheCamera.Restore(); return 0; + /* case COMMAND_SHAKE_PAD: CPad::GetPad(ScriptParams[0])->StartShake(ScriptParams[1], ScriptParams[2]); return 0; + */ case COMMAND_SET_ZONE_PED_INFO: { char label[12]; @@ -3238,6 +3237,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 1); CTimer::SetTimeScale(*(float*)&ScriptParams[0]); return 0; + /* case COMMAND_IS_CAR_IN_AIR: { CollectParameters(&m_nIp, 1); @@ -3247,6 +3247,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) UpdateCompareFlag(pCar->GetAllWheelsOffGround()); return 0; } + */ case COMMAND_SET_FIXED_CAMERA_POSITION: { CollectParameters(&m_nIp, 6); @@ -3269,7 +3270,6 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); - // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); StoreParameters(&m_nIp, 1); @@ -3280,23 +3280,23 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); - // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_ADD_BLIP_FOR_OBJECT_OLD: { CollectParameters(&m_nIp, 3); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); assert(pObject); - // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); ScriptParams[0] = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_REMOVE_BLIP: CollectParameters(&m_nIp, 1); CRadar::ClearBlip(ScriptParams[0]); @@ -3315,7 +3315,6 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - // Useless call CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); ScriptParams[0] = CRadar::SetCoordBlip(BLIP_COORD, pos, ScriptParams[3], (eBlipDisplay)ScriptParams[4]); StoreParameters(&m_nIp, 1); @@ -3366,6 +3365,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CRestart::OverrideNextRestart(pos, angle); return 0; } + /* case COMMAND_DRAW_SHADOW: { CollectParameters(&m_nIp, 10); @@ -3384,11 +3384,11 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) float frontY = y; float sideX = y; float sideY = x; - /* Not very nicely named intermediate variables. */ CShadows::StoreShadowToBeRendered(ScriptParams[0], &pos, frontX, frontY, sideX, sideY, ScriptParams[6], ScriptParams[7], ScriptParams[8], ScriptParams[9]); return 0; } + */ case COMMAND_GET_PLAYER_HEADING: { CollectParameters(&m_nIp, 1); @@ -3402,10 +3402,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - if (pPed->bInVehicle){ - // Is assertion required? + assert(pPed); + if (pPed->bInVehicle) return 0; - } pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); return 0; @@ -3425,10 +3424,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); - if (pPed->bInVehicle) { - // Is assertion required? + if (pPed->bInVehicle) return 0; - } pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); return 0; @@ -3473,6 +3470,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CWorld::Add(pObject); return 0; } + /* case COMMAND_IS_PLAYER_TOUCHING_OBJECT: { CollectParameters(&m_nIp, 2); @@ -3494,12 +3492,14 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject)); return 0; } + */ case COMMAND_SET_PLAYER_AMMO: { CollectParameters(&m_nIp, 3); CWorld::Players[0].m_pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]); return 0; } + /* case COMMAND_SET_CHAR_AMMO: { CollectParameters(&m_nIp, 3); @@ -3507,16 +3507,16 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]); return 0; } - /* Not implemented. - case COMMAND_SET_CAR_AMMO: - case COMMAND_LOAD_CAMERA_SPLINE: - case COMMAND_MOVE_CAMERA_ALONG_SPLINE: - case COMMAND_GET_CAMERA_POSITION_ALONG_SPLINE: */ + //case COMMAND_SET_CAR_AMMO: + //case COMMAND_LOAD_CAMERA_SPLINE: + //case COMMAND_MOVE_CAMERA_ALONG_SPLINE: + //case COMMAND_GET_CAMERA_POSITION_ALONG_SPLINE: case COMMAND_DECLARE_MISSION_FLAG: CTheScripts::OnAMissionFlag = CTheScripts::Read2BytesFromScript(&++m_nIp); return 0; - //case COMMAND_DECLARE_MISSION_FLAG_FOR_CONTACT: + case COMMAND_DECLARE_MISSION_FLAG_FOR_CONTACT: + return 0; //case COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT: case COMMAND_IS_PLAYER_HEALTH_GREATER: { @@ -3546,7 +3546,6 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); - // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); @@ -3559,7 +3558,6 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); - // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); @@ -3572,7 +3570,6 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); assert(pObject); - // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); @@ -3586,7 +3583,6 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - // Useless call CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 2, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); @@ -3600,7 +3596,6 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - // Useless call CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); @@ -3615,6 +3610,15 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_ADD_ONE_OFF_SOUND: { CollectParameters(&m_nIp, 4); + // TODO(MIAMI) + // SOUND_PART_MISSION_COMPLETE == 1 + // SOUND_RACE_START_3 == 7 + // SOUND_RACE_START_2 == 8 + // SOUND_RACE_START_1 == 9 + // SOUND_RACE_START_GO == 10 + // SOUND_AMMUNATION_BUY_WEAPON == 13 + // SOUND_AMMUNATION_BUY_WEAPON_DENIED == 14 + // SOUND_AMMUNATION_IMRAN_ARM_BOMB == 16 switch (ScriptParams[3]) { case SCRIPT_SOUND_EVIDENCE_PICKUP: DMAudio.PlayFrontEndSound(SOUND_EVIDENCE_PICKUP, 0); @@ -3640,11 +3644,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) default: break; } -#ifdef FIX_BUGS - /* BUG: if audio is not initialized, this object will not be freed. */ if (!DMAudio.IsAudioInitialised()) return 0; -#endif cAudioScriptObject* obj = new cAudioScriptObject(); obj->Posn = *(CVector*)&ScriptParams[0]; obj->AudioId = ScriptParams[3]; @@ -3655,11 +3656,15 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_ADD_CONTINUOUS_SOUND: { CollectParameters(&m_nIp, 4); - cAudioScriptObject* obj = new cAudioScriptObject(); - obj->Posn = *(CVector*)&ScriptParams[0]; - obj->AudioId = ScriptParams[3]; - obj->AudioEntity = DMAudio.CreateLoopingScriptObject(obj); - ScriptParams[0] = CPools::GetAudioScriptObjectPool()->GetIndex(obj); + if (DMAudio.IsAudioInitialised()) { + cAudioScriptObject* obj = new cAudioScriptObject(); + obj->Posn = *(CVector*)&ScriptParams[0]; + obj->AudioId = ScriptParams[3]; + obj->AudioEntity = DMAudio.CreateLoopingScriptObject(obj); + ScriptParams[0] = CPools::GetAudioScriptObjectPool()->GetIndex(obj); + } + else + ScriptParams[0] = -1; StoreParameters(&m_nIp, 1); return 0; } @@ -3738,6 +3743,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_GUARD_SPOT, pos); return 0; } + /* case COMMAND_SET_CHAR_OBJ_GUARD_AREA: { CollectParameters(&m_nIp, 5); @@ -3773,6 +3779,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_WAIT_IN_CAR); return 0; } + */ case COMMAND_IS_PLAYER_IN_AREA_ON_FOOT_2D: case COMMAND_IS_PLAYER_IN_AREA_IN_CAR_2D: case COMMAND_IS_PLAYER_STOPPED_IN_AREA_2D: @@ -3821,11 +3828,10 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); pPed->SetCurrentWeapon(pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2])); - if (pPed->bInVehicle) + if (pPed->bInVehicle && pPed->m_pMyVehicle) pPed->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType)->m_nModelId); return 0; } - /* Not implemented */ //case COMMAND_GIVE_WEAPON_TO_CAR: case COMMAND_SET_PLAYER_CONTROL: { @@ -3833,14 +3839,10 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; if (ScriptParams[1]){ pPlayer->MakePlayerSafe(false); - // TODO(MIAMI): Four Iron hack + if (strcmp(m_abScriptName, "serg1") == 0) // Four Iron + pPlayer->m_pPed->ClearFollowPath(); }else{ pPlayer->MakePlayerSafe(true); - if (strcmp(m_abScriptName, "camera") == 0){ - pPlayer->m_pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f); - pPlayer->m_pPed->SetTurnSpeed(0.0f, 0.0f, 0.0f); - CAnimManager::BlendAnimation((RpClump*)pPlayer->m_pPed->m_rwObject, pPlayer->m_pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f); - } } return 0; } @@ -3875,7 +3877,6 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) } return 0; } - /* Not implemented */ //case COMMAND_SET_CURRENT_CAR_WEAPON: case COMMAND_GET_OBJECT_COORDINATES: { @@ -4065,9 +4066,11 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->CharCreatedBy = MISSION_CHAR; pPed->bRespondsToThreats = false; pPed->bAllowMedicsToReviveMe = false; + pPed->bIsPlayerFriend = false; + if (pVehicle->bIsBus) + pPed->bRenderPedInCar = false; pPed->SetPosition(pVehicle->GetPosition()); pPed->SetOrientation(0.0f, 0.0f, 0.0f); - pPed->SetPedState(PED_DRIVING); CPopulation::ms_nTotalMissionPeds++; if (ScriptParams[3] >= 0) pVehicle->AddPassenger(pPed, ScriptParams[3]); @@ -4076,8 +4079,8 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->m_pMyVehicle = pVehicle; pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle); pPed->bInVehicle = true; - pPed->SetPedState(PED_DRIVING); pVehicle->SetStatus(STATUS_PHYSICS); + pPed->SetPedState(PED_DRIVING); pPed->bUsesCollision = false; pPed->AddInCarAnims(pVehicle, false); pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition()); @@ -4128,6 +4131,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget); return 0; } + /* case COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE: { CollectParameters(&m_nIp, 2); @@ -4138,6 +4142,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget); return 0; } + */ case COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE: { CollectParameters(&m_nIp, 2); @@ -4218,11 +4223,18 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); return 0; } - /* Not implemented. - case COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_IN_CAR: - case COMMAND_SET_CHAR_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE: + //case COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_IN_CAR: + //case COMMAND_SET_CHAR_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE: case COMMAND_SET_CHAR_OBJ_DESTROY_OBJECT: - */ + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + pPed->bScriptObjectiveCompleted = false; + pPed->SetObjective(OBJECTIVE_DESTROY_OBJ, pVehicle); + return 0; + } case COMMAND_SET_CHAR_OBJ_DESTROY_CAR: { CollectParameters(&m_nIp, 2); @@ -4233,6 +4245,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_DESTROY_CAR, pVehicle); return 0; } + /* case COMMAND_SET_CHAR_OBJ_GOTO_AREA_ON_FOOT: { CollectParameters(&m_nIp, 5); @@ -4259,11 +4272,10 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius); return 0; } - /* Not implemented. - case COMMAND_SET_CHAR_OBJ_GOTO_AREA_IN_CAR: - case COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET: - case COMMAND_SET_CHAR_OBJ_GUARD_ATTACK: */ + //case COMMAND_SET_CHAR_OBJ_GOTO_AREA_IN_CAR: + //case COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET: + //case COMMAND_SET_CHAR_OBJ_GUARD_ATTACK: case COMMAND_SET_CHAR_AS_LEADER: { CollectParameters(&m_nIp, 2); @@ -4326,9 +4338,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) CMessages::AddMessageJumpQWithNumber(text, ScriptParams[1], ScriptParams[2], ScriptParams[0], -1, -1, -1, -1, -1); return 0; } - /* Not implemented. - case COMMAND_PRINT_WITH_NUMBER_SOON: - */ + //case COMMAND_PRINT_WITH_NUMBER_SOON: case COMMAND_SWITCH_ROADS_ON: { CollectParameters(&m_nIp, 6); @@ -4406,7 +4416,16 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); - pVehicle->bIsHeavy = (ScriptParams[1] != 0); + if (ScriptParams[1] != 0) { + pVehicle->bIsHeavy = true; + pVehicle->m_fMass = 3.0f * pVehicle->pHandling->fMass; + pVehicle->m_fTurnMass = 5.0f * pVehicle->pHandling->fTurnMass; + } + else { + pVehicle->bIsHeavy = false; + pVehicle->m_fMass = pVehicle->pHandling->fMass; + pVehicle->m_fTurnMass = pVehicle->pHandling->fTurnMass; + } return 0; } case COMMAND_CLEAR_CHAR_THREAT_SEARCH: @@ -4417,6 +4436,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->m_fearFlags = 0; return 0; } + /* case COMMAND_ACTIVATE_CRANE: { CollectParameters(&m_nIp, 10); @@ -4444,16 +4464,15 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) CCranes::DeActivateCrane(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); return 0; } + */ case COMMAND_SET_MAX_WANTED_LEVEL: { CollectParameters(&m_nIp, 1); CWanted::SetMaximumWantedLevel(ScriptParams[0]); return 0; } - /* Debug commands? - case COMMAND_SAVE_VAR_INT: - case COMMAND_SAVE_VAR_FLOAT: - */ + //case COMMAND_SAVE_VAR_INT: + //case COMMAND_SAVE_VAR_FLOAT: case COMMAND_IS_CAR_IN_AIR_PROPER: { CollectParameters(&m_nIp, 1); @@ -4505,6 +4524,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) } return 0; } + /* case COMMAND_ADD_PAGER_MESSAGE_WITH_NUMBER: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -4513,6 +4533,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) ScriptParams[1], ScriptParams[2], ScriptParams[3]); return 0; } + */ case COMMAND_START_KILL_FRENZY: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -4657,7 +4678,6 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, target); return 0; } - /* Not implemented*/ //case COMMAND_SET_CHAR_OBJ_GOTO_COORD_IN_CAR: case COMMAND_CREATE_PICKUP: { @@ -4697,6 +4717,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CMessages::AddBigMessageQ(text, ScriptParams[0], ScriptParams[1] - 1); return 0; } + /* case COMMAND_PRINT_WITH_NUMBER_BIG_Q: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -4705,6 +4726,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) ScriptParams[0], -1, -1, -1, -1, -1); return 0; } + */ case COMMAND_SET_GARAGE: { CollectParameters(&m_nIp, 9); @@ -4720,6 +4742,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_SET_GARAGE_WITH_CAR_MODEL: { CollectParameters(&m_nIp, 10); @@ -4735,6 +4758,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_SET_TARGET_CAR_FOR_MISSION_GARAGE: { CollectParameters(&m_nIp, 2); @@ -4792,6 +4816,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) return 0; } #endif // GTA_PS2 + /* case COMMAND_SET_ALL_TAXI_LIGHTS: CollectParameters(&m_nIp, 1); CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0); @@ -4805,6 +4830,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum return 0; } + */ case COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR: CollectParameters(&m_nIp, 2); CPad::GetPad(ScriptParams[0])->bApplyBrakes = (ScriptParams[1] != 0); @@ -4848,7 +4874,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; assert(pPed); - ScriptParams[0] = pPed->m_fHealth; // correct cast float to int + ScriptParams[0] = pPed->m_fHealth; StoreParameters(&m_nIp, 1); return 0; } @@ -4857,7 +4883,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); - ScriptParams[0] = pPed->m_fHealth; // correct cast float to int + ScriptParams[0] = pPed->m_fHealth; StoreParameters(&m_nIp, 1); return 0; } @@ -4866,19 +4892,21 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); - ScriptParams[0] = pVehicle->m_fHealth; // correct cast float to int + ScriptParams[0] = pVehicle->m_fHealth; StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_IS_CAR_ARMED_WITH_BOMB: { CollectParameters(&m_nIp, 2); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pCar); assert(pCar->m_vehType == VEHICLE_TYPE_CAR); - UpdateCompareFlag(pCar->m_bombType == ScriptParams[1]); //TODO: enum + UpdateCompareFlag(pCar->m_bombType == ScriptParams[1]); return 0; } + */ case COMMAND_CHANGE_CAR_COLOUR: { CollectParameters(&m_nIp, 3); @@ -4992,14 +5020,15 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pSourcePed->RestorePreviousState(); return 0; } + /* case COMMAND_SWITCH_HELICOPTER: CollectParameters(&m_nIp, 1); CHeli::ActivateHeli(ScriptParams[0] != 0); return 0; - - //case COMMAND_SET_GANG_ATTITUDE: - //case COMMAND_SET_GANG_GANG_ATTITUDE: - //case COMMAND_SET_GANG_PLAYER_ATTITUDE: + */ + //case COMMAND_SET_GANG_ATTITUDE: + //case COMMAND_SET_GANG_GANG_ATTITUDE: + //case COMMAND_SET_GANG_PLAYER_ATTITUDE: case COMMAND_SET_GANG_PED_MODELS: CollectParameters(&m_nIp, 3); CGangs::SetGangPedModels(ScriptParams[0], ScriptParams[1], ScriptParams[2]); @@ -5012,6 +5041,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 3); CGangs::SetGangWeapons(ScriptParams[0], (eWeaponType)ScriptParams[1], (eWeaponType)ScriptParams[2]); return 0; + /* case COMMAND_SET_CHAR_OBJ_RUN_TO_AREA: { CollectParameters(&m_nIp, 5); @@ -5038,6 +5068,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos, radius); return 0; } + */ case COMMAND_SET_CHAR_OBJ_RUN_TO_COORD: { CollectParameters(&m_nIp, 3); @@ -5051,6 +5082,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos); return 0; } + /* case COMMAND_IS_PLAYER_TOUCHING_OBJECT_ON_FOOT: { CollectParameters(&m_nIp, 2); @@ -5079,6 +5111,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(isTouching); return 0; } + */ case COMMAND_LOAD_SPECIAL_CHARACTER: { CollectParameters(&m_nIp, 1); @@ -5096,6 +5129,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(CStreaming::HasSpecialCharLoaded(ScriptParams[0] - 1)); return 0; } + /* case COMMAND_FLASH_CAR: { CollectParameters(&m_nIp, 2); @@ -5120,10 +5154,12 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pObject->bHasBlip = (ScriptParams[1] != 0); return 0; } + */ case COMMAND_IS_PLAYER_IN_REMOTE_MODE: CollectParameters(&m_nIp, 1); UpdateCompareFlag(CWorld::Players[ScriptParams[0]].IsPlayerInRemoteMode()); return 0; + /* case COMMAND_ARM_CAR_WITH_BOMB: { CollectParameters(&m_nIp, 2); @@ -5134,6 +5170,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed(); return 0; } + */ case COMMAND_SET_CHAR_PERSONALITY: { CollectParameters(&m_nIp, 2); @@ -5154,6 +5191,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->m_animGroup = (AssocGroupId)ScriptParams[1]; return 0; } + /* case COMMAND_SET_ANIM_GROUP_FOR_PLAYER: { CollectParameters(&m_nIp, 2); @@ -5162,6 +5200,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->m_animGroup = (AssocGroupId)ScriptParams[1]; return 0; } + */ case COMMAND_REQUEST_MODEL: { CollectParameters(&m_nIp, 1); @@ -5196,6 +5235,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_SET_REPEATED_PHONE_MESSAGE: { CollectParameters(&m_nIp, 1); @@ -5216,6 +5256,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(gPhoneInfo.HasMessageBeenDisplayed(ScriptParams[0])); return 0; } + */ case COMMAND_TURN_PHONE_OFF: { CollectParameters(&m_nIp, 1); @@ -5229,7 +5270,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8], - 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); + 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); // TODO(MIAMI): more params return 0; } case COMMAND_DRAW_LIGHT: @@ -5249,6 +5290,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_RESTORE_CLOCK: CClock::RestoreClock(); return 0; + /* case COMMAND_RESTART_CRITICAL_MISSION: { CollectParameters(&m_nIp, 4); @@ -5261,6 +5303,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CWorld::Players[CWorld::PlayerInFocus].PlayerFailedCriticalMission(); return 0; } + */ case COMMAND_IS_PLAYER_PLAYING: { CollectParameters(&m_nIp, 1); @@ -5369,6 +5412,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0); return 0; } + /* case COMMAND_IS_TAXI: { CollectParameters(&m_nIp, 1); @@ -5377,6 +5421,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) UpdateCompareFlag(pVehicle->IsTaxi()); return 0; } + */ case COMMAND_UNLOAD_SPECIAL_CHARACTER: CollectParameters(&m_nIp, 1); CStreaming::SetMissionDoesntRequireSpecialChar(ScriptParams[0] - 1); @@ -5389,6 +5434,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) ScriptParams[0] = CDarkel::QueryModelsKilledByPlayer(ScriptParams[0]); StoreParameters(&m_nIp, 1); return 0; + /* case COMMAND_ACTIVATE_GARAGE: CollectParameters(&m_nIp, 1); CGarages::ActivateGarage(ScriptParams[0]); @@ -5404,6 +5450,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) } return 0; } + */ case COMMAND_CREATE_OBJECT_NO_OFFSET: { CollectParameters(&m_nIp, 4); @@ -5417,6 +5464,9 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) pObj->SetOrientation(0.0f, 0.0f, 0.0f); pObj->GetMatrix().UpdateRW(); pObj->UpdateRwFrame(); + CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(mi); + if (pModelInfo->IsBuilding() && ((CSimpleModelInfo*)pModelInfo)->m_isBigBuilding) + pObj->SetupBigBuilding(); CTheScripts::ClearSpaceForMissionEntity(pos, pObj); CWorld::Add(pObj); ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj); @@ -5425,6 +5475,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT); return 0; } + /* case COMMAND_IS_BOAT: { CollectParameters(&m_nIp, 1); @@ -5459,6 +5510,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) 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: { @@ -5466,7 +5518,9 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; UpdateCompareFlag(CTheScripts::IsPlayerStopped(pPlayer)); return 0; + } + /* case COMMAND_IS_CHAR_STOPPED: { CollectParameters(&m_nIp, 1); @@ -5489,6 +5543,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CParticleObject::AddObject(ScriptParams[0], pos, ScriptParams[4] != 0); return 0; } + */ case COMMAND_SWITCH_WIDESCREEN: CollectParameters(&m_nIp, 1); if (ScriptParams[0] != 0) @@ -5496,6 +5551,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) else TheCamera.SetWideScreenOff(); return 0; + /* case COMMAND_ADD_SPRITE_BLIP_FOR_CAR: { CollectParameters(&m_nIp, 2); @@ -5532,6 +5588,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT: { CollectParameters(&m_nIp, 4); @@ -5612,6 +5669,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) 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]); @@ -5625,6 +5683,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CollectParameters(&m_nIp, 2); UpdateCompareFlag(CGarages::HasThisCarBeenCollected(ScriptParams[0], ScriptParams[1] - 1)); return 0; + */ default: assert(0); } @@ -5634,6 +5693,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) int8 CRunningScript::ProcessCommands700To799(int32 command) { switch (command){ + /* case COMMAND_SET_SWAT_REQUIRED: CollectParameters(&m_nIp, 1); FindPlayerPed()->m_pWanted->m_bSwatRequired = (ScriptParams[0] != 0); @@ -5646,6 +5706,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 1); FindPlayerPed()->m_pWanted->m_bArmyRequired = (ScriptParams[0] != 0); return 0; + */ case COMMAND_IS_CAR_IN_WATER: { CollectParameters(&m_nIp, 1); @@ -5690,10 +5751,11 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ACCURATE; pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->bEngineOn = true; - pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed); + pVehicle->AutoPilot.m_nCruiseSpeed = Max(1, 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]); @@ -5724,6 +5786,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_CARRIED: CPacManPickups::ResetPowerPillsCarriedByPlayer(); return 0; + */ case COMMAND_IS_CAR_ON_SCREEN: { CollectParameters(&m_nIp, 1); @@ -5748,6 +5811,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius())); return 0; } + /* case COMMAND_GOSUB_FILE: { CollectParameters(&m_nIp, 2); @@ -5757,6 +5821,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) // ScriptParams[1] == filename return 0; } + */ case COMMAND_GET_GROUND_Z_FOR_3D_COORD: { CollectParameters(&m_nIp, 3); @@ -5784,6 +5849,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 1); gFireManager.RemoveScriptFire(ScriptParams[0]); return 0; + /* case COMMAND_SET_COMEDY_CONTROLS: { CollectParameters(&m_nIp, 2); @@ -5792,6 +5858,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pVehicle->bComedyControls = (ScriptParams[1] != 0); return 0; } + */ case COMMAND_BOAT_GOTO_COORDS: { CollectParameters(&m_nIp, 4); @@ -5805,7 +5872,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS; pBoat->AutoPilot.m_vecDestinationCoors = pos; pBoat->SetStatus(STATUS_PHYSICS); - pBoat->AutoPilot.m_nCruiseSpeed = Max(6, pBoat->AutoPilot.m_nCruiseSpeed); + pBoat->AutoPilot.m_nCruiseSpeed = Max(1, pBoat->AutoPilot.m_nCruiseSpeed); pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; } @@ -5861,7 +5928,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); + UpdateCompareFlag(ScriptParams[1] == pPed->GetWeapon()->m_eWeaponType); return 0; } case COMMAND_IS_CURRENT_CHAR_WEAPON: @@ -5869,9 +5936,10 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); - UpdateCompareFlag(ScriptParams[1] == pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType); + UpdateCompareFlag(ScriptParams[1] == pPed->GetWeapon()->m_eWeaponType); return 0; } + /* case COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_EATEN: CPacManPickups::ResetPowerPillsEatenInRace(); return 0; @@ -5884,6 +5952,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CPacManPickups::GenerateOnePMPickUp(pos); return 0; } + */ case COMMAND_SET_BOAT_CRUISE_SPEED: { CollectParameters(&m_nIp, 2); @@ -5894,6 +5963,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pBoat->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1]; return 0; } + /* case COMMAND_GET_RANDOM_CHAR_IN_AREA: { CollectParameters(&m_nIp, 4); @@ -5942,6 +6012,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_GET_RANDOM_CHAR_IN_ZONE: { char zone[KEY_LENGTH_IN_SCRIPT]; @@ -5950,6 +6021,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) if (nZone != -1) m_nIp += KEY_LENGTH_IN_SCRIPT; CZone* pZone = CTheZones::GetNavigationZone(nZone); + CollectParameters(&m_nIp, 3); int ped_handle = -1; CVector pos = FindPlayerCoors(); int i = CPools::GetPedPool()->GetSize(); @@ -5967,9 +6039,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) continue; if (pPed->bFadeOut) continue; -// if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) -// continue; - if (!ThisIsAValidRandomPed(pPed->m_nPedType)) + if (pPed->m_nWaitState != WAITSTATE_FALSE) + continue; + if (!ThisIsAValidRandomPed(pPed->m_nPedType, ScriptParams[0], ScriptParams[1], ScriptParams[2])) continue; if (pPed->bIsLeader || pPed->m_leader) continue; @@ -5979,6 +6051,10 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) continue; if (pos.z + PED_FIND_Z_OFFSET < pPed->GetPosition().z) continue; + bool found; + CWorld::FindRoofZFor3DCoord(pos.x, pos.y, pos.z, &found); + if (found) + continue; ped_handle = CPools::GetPedPool()->GetIndex(pPed); CTheScripts::LastRandomPedId = ped_handle; pPed->CharCreatedBy = MISSION_CHAR; @@ -6099,6 +6175,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 1); CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = ScriptParams[0]; return 0; + /* case COMMAND_IS_PROJECTILE_IN_AREA: { CollectParameters(&m_nIp, 6); @@ -6169,6 +6246,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CPickups::GenerateNewOne(pos, MI_NAUTICALMINE, PICKUP_MINE_INACTIVE, 0); return 0; } + */ case COMMAND_IS_CHAR_MODEL: { CollectParameters(&m_nIp, 2); @@ -6188,16 +6266,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) m_nIp += KEY_LENGTH_IN_SCRIPT; return 0; } - case COMMAND_CREATE_CUTSCENE_HEAD: - { - assert(0); - return 0; - } - case COMMAND_SET_CUTSCENE_HEAD_ANIM: - { - assert(0); - return 0; - } + //case COMMAND_CREATE_CUTSCENE_HEAD: + //case COMMAND_SET_CUTSCENE_HEAD_ANIM: case COMMAND_SIN: CollectParameters(&m_nIp, 1); *(float*)&ScriptParams[0] = Sin(DEGTORAD(*(float*)&ScriptParams[0])); @@ -6230,6 +6300,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 2); CGarages::ChangeGarageType(ScriptParams[0], (eGarageType)ScriptParams[1], 0); return 0; + /* case COMMAND_ACTIVATE_CRUSHER_CRANE: { CollectParameters(&m_nIp, 10); @@ -6258,6 +6329,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6265,6 +6337,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6272,6 +6345,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6279,6 +6353,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6293,6 +6368,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6300,6 +6376,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6335,6 +6412,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6342,6 +6420,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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); @@ -6367,6 +6446,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pPed->SetFormation((eFormation)ScriptParams[2]); return 0; } + */ case COMMAND_PLAYER_MADE_PROGRESS: CollectParameters(&m_nIp, 1); CStats::ProgressMade += ScriptParams[0]; @@ -6374,6 +6454,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_SET_PROGRESS_TOTAL: CollectParameters(&m_nIp, 1); CStats::TotalProgressInGame = ScriptParams[0]; + if (CGame::germanGame) + CStats::TotalProgressInGame -= 2; return 0; case COMMAND_REGISTER_JUMP_DISTANCE: CollectParameters(&m_nIp, 1); @@ -6420,6 +6502,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) strncpy(CStats::LastMissionPassedName, name, KEY_LENGTH_IN_SCRIPT); ++CStats::MissionsPassed; CStats::CheckPointReachedSuccessfully(); + CTheScripts::LastMissionPassedTime = CTimer::GetTimeInMilliseconds(); + //CGameLogic::RemoveShortCutDropOffPointForMission() // TODO(MIAMI) return 0; } case COMMAND_SET_CHAR_RUNNING: @@ -6433,6 +6517,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_REMOVE_ALL_SCRIPT_FIRES: gFireManager.RemoveAllScriptFires(); return 0; + /* case COMMAND_IS_FIRST_CAR_COLOUR: { CollectParameters(&m_nIp, 2); @@ -6449,22 +6534,37 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) 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]); + bool result = false; if (!pPed) printf("HAS_CHAR_BEEN_DAMAGED_BY_WEAPON - Character doesn't exist\n"); - UpdateCompareFlag(pPed && pPed->m_lastWepDam == ScriptParams[1]); + else { + if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON) + result = CheckDamagedWeaponType(ScriptParams[1], pPed->m_lastWepDam); + else + result = ScriptParams[1] == pPed->m_lastWepDam; + } + UpdateCompareFlag(result); return 0; } case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_WEAPON: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + bool result = false; if (!pVehicle) printf("HAS_CAR_BEEN_DAMAGED_BY_WEAPON - Vehicle doesn't exist\n"); - UpdateCompareFlag(pVehicle && pVehicle->m_nLastWeaponDamage == ScriptParams[1]); + else { + if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON) + result = CheckDamagedWeaponType(ScriptParams[1], pVehicle->m_nLastWeaponDamage); + else + result = ScriptParams[1] == pVehicle->m_nLastWeaponDamage; + } + UpdateCompareFlag(result); return 0; } case COMMAND_IS_CHAR_IN_CHARS_GROUP: @@ -6501,17 +6601,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); - if (pPed->m_nPedState == PED_DRIVING) { - pPed->SetDead(); - if (!pPed->IsPlayer()) - pPed->FlagToDestroyWhenNextProcessed(); - } - else if (CGame::nastyGame && pPed->IsPedInControl()) { - pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true); - } - else { - pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); - } + pPed->InflictDamage(nil, WEAPONTYPE_SNIPERRIFLE, 1000.0f, PEDPIECE_HEAD, 0); return 0; } case COMMAND_EXPLODE_PLAYER_HEAD: @@ -6519,12 +6609,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; assert(pPed); - if (CGame::nastyGame) { - pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true); - } - else { - pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); - } + pPed->InflictDamage(nil, WEAPONTYPE_SNIPERRIFLE, 1000.0f, PEDPIECE_HEAD, 0); return 0; } case COMMAND_ANCHOR_BOAT: @@ -6580,6 +6665,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); if (!pVehicle) continue; + if (pVehicle->GetVehicleAppearance() != VEHICLE_APPEARANCE_CAR && pVehicle->GetVehicleAppearance() != VEHICLE_APPEARANCE_BIKE) + continue; + if (!pVehicle->bUsesCollision) + continue; if (ScriptParams[4] != pVehicle->GetModelIndex() && ScriptParams[4] >= 0) continue; if (pVehicle->VehicleCreatedBy != RANDOM_VEHICLE) @@ -6597,11 +6686,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_ZONE: { char zone[KEY_LENGTH_IN_SCRIPT]; CTheScripts::ReadTextLabelFromScript(&m_nIp, zone); -// TODO(MIAMI): just getting this to compile with new argument int zone_id = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT); if (zone_id != -1) m_nIp += KEY_LENGTH_IN_SCRIPT; @@ -6630,6 +6719,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_HAS_RESPRAY_HAPPENED: { CollectParameters(&m_nIp, 1); @@ -6669,6 +6759,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CCarAI::TellCarToRamOtherCar(pVehicle, pTarget); return 0; } + /* case COMMAND_SET_CAR_BLOCK_CAR: { CollectParameters(&m_nIp, 2); @@ -6688,6 +6779,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->SetObjective(OBJECTIVE_CATCH_TRAIN); return 0; } + */ //case COMMAND_SET_COLL_OBJ_CATCH_TRAIN: case COMMAND_SET_PLAYER_NEVER_GETS_TIRED: { @@ -6711,6 +6803,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->bPedIsBleeding = (ScriptParams[1] != 0); return 0; } + /* case COMMAND_SET_CAR_FUNNY_SUSPENSION: { CollectParameters(&m_nIp, 2); @@ -6729,6 +6822,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pCar->bBigWheels = (ScriptParams[1] != 0); return 0; } + */ case COMMAND_SET_FREE_RESPRAYS: CollectParameters(&m_nIp, 1); CGarages::SetFreeResprays(ScriptParams[0] != 0); @@ -6749,6 +6843,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->bIsVisible = (ScriptParams[1] != 0); return 0; } + /* case COMMAND_SET_CAR_VISIBLE: { CollectParameters(&m_nIp, 2); @@ -6757,6 +6852,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pVehicle->bIsVisible = (ScriptParams[1] != 0); return 0; } + */ case COMMAND_IS_AREA_OCCUPIED: { CollectParameters(&m_nIp, 11); @@ -6784,6 +6880,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) UpdateCompareFlag(total > 0); return 0; } + /* case COMMAND_START_DRUG_RUN: CPlane::CreateIncomingCesna(); return 0; @@ -6797,6 +6894,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CollectParameters(&m_nIp, 1); gFireManager.ExtinguishPoint(CWorld::Players[ScriptParams[0]].GetPos(), 3.0f); return 0; + */ case COMMAND_DISPLAY_TEXT: { CollectParameters(&m_nIp, 2); @@ -6843,18 +6941,21 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CTheScripts::IntroTextLines[CTheScripts::NumberOfIntroTextLinesThisFrame].m_fWrapX = *(float*)&ScriptParams[0]; return 0; } + /* case COMMAND_SET_TEXT_CENTRE_SIZE: { CollectParameters(&m_nIp, 1); CTheScripts::IntroTextLines[CTheScripts::NumberOfIntroTextLinesThisFrame].m_fCenterSize = *(float*)&ScriptParams[0]; return 0; } + */ case COMMAND_SET_TEXT_BACKGROUND: { CollectParameters(&m_nIp, 1); CTheScripts::IntroTextLines[CTheScripts::NumberOfIntroTextLinesThisFrame].m_bBackground = (ScriptParams[0] != 0); return 0; } + /* case COMMAND_SET_TEXT_BACKGROUND_COLOUR: { CollectParameters(&m_nIp, 4); @@ -6868,12 +6969,14 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CTheScripts::IntroTextLines[CTheScripts::NumberOfIntroTextLinesThisFrame].m_bBackgroundOnly = (ScriptParams[0] != 0); return 0; } + */ case COMMAND_SET_TEXT_PROPORTIONAL: { CollectParameters(&m_nIp, 1); CTheScripts::IntroTextLines[CTheScripts::NumberOfIntroTextLinesThisFrame].m_bTextProportional = (ScriptParams[0] != 0); return 0; } + /* case COMMAND_SET_TEXT_FONT: { CollectParameters(&m_nIp, 1); @@ -6891,6 +6994,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) case COMMAND_SUBURBAN_PASSED: CStats::SuburbanPassed = true; return 0; + */ case COMMAND_ROTATE_OBJECT: { CollectParameters(&m_nIp, 4); @@ -7032,9 +7136,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->bKindaStayInSamePlace = (ScriptParams[1] != 0); return 0; } + /* case COMMAND_IS_NASTY_GAME: UpdateCompareFlag(CGame::nastyGame); return 0; + */ case COMMAND_UNDRESS_CHAR: { CollectParameters(&m_nIp, 1); @@ -7064,6 +7170,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CWorld::Add(pPed); return 0; } + /* case COMMAND_START_CHASE_SCENE: CollectParameters(&m_nIp, 1); CTimer::Suspend(); @@ -7128,15 +7235,15 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) } case COMMAND_CREATE_FLOATING_PACKAGE: { -// removed in MIAMI -// CollectParameters(&m_nIp, 3); -// CVector pos = *(CVector*)&ScriptParams[0]; -// if (pos.z <= MAP_Z_LOW_LIMIT) -// pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; -// ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_FLOATPACKAGE1, PICKUP_FLOATINGPACKAGE, 0); -// StoreParameters(&m_nIp, 1); + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= MAP_Z_LOW_LIMIT) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; + ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_FLOATPACKAGE1, PICKUP_FLOATINGPACKAGE, 0); + StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_PLACE_OBJECT_RELATIVE_TO_CAR: { CollectParameters(&m_nIp, 5); @@ -7202,12 +7309,35 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->m_pMyVehicle->SetStatus(STATUS_ABANDONED); pPed->m_pMyVehicle->bEngineOn = false; pPed->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; + pPed->m_pMyVehicle->SetMoveSpeed(0.0f, 0.0f, -0.00001f); + pPed->m_pMyVehicle->SetTurnSpeed(0.0f, 0.0f, 0.0f); }else{ pPed->m_pMyVehicle->RemovePassenger(pPed); } - pPed->m_pMyVehicle->SetMoveSpeed(0.0f, 0.0f, -0.00001f); - pPed->m_pMyVehicle->SetTurnSpeed(0.0f, 0.0f, 0.0f); + if (pPed->m_vehEnterType) { + if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) { + uint8 flags = 0; + if (pPed->m_pMyVehicle->IsBike()) { + //TODO(MIAMI) + } + else { + switch (pPed->m_vehEnterType) { + case CAR_DOOR_LF: + flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_LF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR; + case CAR_DOOR_LR: + flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_RF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR; + case CAR_DOOR_RF: + flags = CAR_DOOR_FLAG_RF; + case CAR_DOOR_RR: + flags = CAR_DOOR_FLAG_RR; + } + } + pPed->m_pMyVehicle->m_nGettingOutFlags &= ~flags; + pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehEnterType, NUM_STD_ANIMS, 0.0f); + } + } } + pPed->RemoveInCarAnims(); pPed->bInVehicle = false; pPed->m_pMyVehicle = nil; pPed->SetPedState(PED_IDLE); @@ -7215,13 +7345,12 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->bUsesCollision = true; pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f); pPed->ReplaceWeaponWhenExitingVehicle(); - pPed->RemoveInCarAnims(); if (pPed->m_pVehicleAnim) pPed->m_pVehicleAnim->blendDelta = -1000.0f; pPed->m_pVehicleAnim = nil; pPed->RestartNonPartialAnims(); pPed->SetMoveState(PEDMOVE_NONE); - CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f); + CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f); pos.z += pPed->GetDistanceFromCentreOfMassToBaseOfModel(); pPed->Teleport(pos); CTheScripts::ClearSpaceForMissionEntity(pos, pPed); @@ -7257,6 +7386,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) } return 0; } + /* case COMMAND_HAS_CHAR_SPOTTED_CHAR: { CollectParameters(&m_nIp, 2); @@ -7267,6 +7397,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) UpdateCompareFlag(pPed->OurPedCanSeeThisOne(pTarget)); return 0; } + */ case COMMAND_SET_CHAR_OBJ_HAIL_TAXI: { CollectParameters(&m_nIp, 1); @@ -7284,6 +7415,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) UpdateCompareFlag(pObject->bRenderDamaged || !pObject->bIsVisible); return 0; } + /* case COMMAND_START_KILL_FRENZY_HEADSHOT: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -7314,6 +7446,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); return 0; } + */ case COMMAND_WARP_PLAYER_INTO_CAR: { CollectParameters(&m_nIp, 2); @@ -7345,6 +7478,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CMessages::AddBigMessageWithNumber(text, ScriptParams[2], ScriptParams[3] - 1, ScriptParams[0], ScriptParams[1], -1, -1, -1, -1); return 0; } + /* case COMMAND_PRINT_WITH_3_NUMBERS_BIG: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -7373,6 +7507,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CMessages::AddBigMessageWithNumber(text, ScriptParams[6], ScriptParams[7] - 1, ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]); return 0; } + */ case COMMAND_SET_CHAR_WAIT_STATE: { CollectParameters(&m_nIp, 3); @@ -7384,6 +7519,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) case COMMAND_SET_CAMERA_BEHIND_PLAYER: TheCamera.SetCameraDirectlyBehindForFollowPed_CamOnAString(); return 0; + /* case COMMAND_SET_MOTION_BLUR: CollectParameters(&m_nIp, 1); TheCamera.SetMotionBlur(0, 0, 0, 0, ScriptParams[0]); @@ -7396,6 +7532,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CMessages::AddMessageWithString(text, ScriptParams[0], ScriptParams[1], string); return 0; } + */ case COMMAND_CREATE_RANDOM_CHAR: { CollectParameters(&m_nIp, 3); @@ -7418,6 +7555,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) ped->CharCreatedBy = MISSION_CHAR; ped->bRespondsToThreats = false; ped->bAllowMedicsToReviveMe = false; + ped->bIsPlayerFriend = false; CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -7445,6 +7583,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->SetObjective(OBJECTIVE_STEAL_ANY_CAR); return 0; } + /* case COMMAND_SET_2_REPEATED_PHONE_MESSAGES: { CollectParameters(&m_nIp, 1); @@ -7499,6 +7638,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) gPhoneInfo.SetPhoneMessage_JustOnce(ScriptParams[0], text1, text2, text3, text4, nil, nil); return 0; } + */ case COMMAND_IS_SNIPER_BULLET_IN_AREA: { CollectParameters(&m_nIp, 6); @@ -7523,9 +7663,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) UpdateCompareFlag(CBulletInfo::TestForSniperBullet(infX, supX, infY, supY, infZ, supZ)); return 0; } + /* case COMMAND_GIVE_PLAYER_DETONATOR: CGarages::GivePlayerDetonator(); return 0; + */ //case COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR: case COMMAND_SET_OBJECT_VELOCITY: { @@ -7575,6 +7717,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) return 0; } //case COMMAND_PRINT_STRING_IN_STRING_SOON: + /* case COMMAND_SET_5_REPEATED_PHONE_MESSAGES: { CollectParameters(&m_nIp, 1); @@ -7621,6 +7764,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) gPhoneInfo.SetPhoneMessage_JustOnce(ScriptParams[0], text1, text2, text3, text4, text5, text6); return 0; } + */ case COMMAND_IS_POINT_OBSCURED_BY_A_MISSION_ENTITY: { CollectParameters(&m_nIp, 6); @@ -7651,16 +7795,24 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) return 0; } case COMMAND_LOAD_ALL_MODELS_NOW: +#ifdef FIX_BUGS + CTimer::Suspend(); +#else CTimer::Stop(); +#endif CStreaming::LoadAllRequestedModels(false); +#ifdef FIX_BUGS + CTimer::Resume(); +#else CTimer::Update(); +#endif return 0; case COMMAND_ADD_TO_OBJECT_VELOCITY: { CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); assert(pObject); - pObject->SetMoveSpeed(pObject->GetMoveSpeed() + 0.02f * *(CVector*)&ScriptParams[1]); + pObject->SetMoveSpeed(pObject->GetMoveSpeed() + *(CVector*)&ScriptParams[1] / METERS_PER_SECOND_TO_GAME_SPEED); return 0; } case COMMAND_DRAW_SPRITE: @@ -7736,6 +7888,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) } return 0; } + /* case COMMAND_SET_CHAR_ANIM_SPEED: { CollectParameters(&m_nIp, 2); @@ -7746,6 +7899,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) pAssoc->speed = *(float*)&ScriptParams[1]; return 0; } + */ case COMMAND_PLAY_MISSION_PASSED_TUNE: { CollectParameters(&m_nIp, 1); @@ -7774,6 +7928,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) pVehicle->m_bSirenOrAlarm = ScriptParams[1] != 0; return 0; } + /* case COMMAND_SWITCH_PED_ROADS_ON_ANGLED: { CollectParameters(&m_nIp, 7); @@ -7796,14 +7951,19 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) ThePaths.SwitchRoadsInAngledArea(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], *(float*)&ScriptParams[4], *(float*)&ScriptParams[5], *(float*)&ScriptParams[6], 1, 0); return 0; + */ case COMMAND_SET_CAR_WATERTIGHT: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); - CAutomobile* pCar = (CAutomobile*)pVehicle; - pCar->bWaterTight = ScriptParams[1] != 0; + if (pVehicle->IsBike()) { + //TODO(MIAMI) + } + else if (pVehicle->IsCar()) { + CAutomobile* pCar = (CAutomobile*)pVehicle; + pCar->bWaterTight = ScriptParams[1] != 0; + } return 0; } case COMMAND_ADD_MOVING_PARTICLE_EFFECT: @@ -7847,6 +8007,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) pVehicle->SetHeading(heading); return 0; } + /* case COMMAND_IS_CRANE_LIFTING_CAR: { CollectParameters(&m_nIp, 3); @@ -7854,6 +8015,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) UpdateCompareFlag(CCranes::IsThisCarPickedUp(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], pVehicle)); return 0; } + */ case COMMAND_DRAW_SPHERE: { CollectParameters(&m_nIp, 4); @@ -7890,6 +8052,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) strncpy(m_abScriptName, str, KEY_LENGTH_IN_SCRIPT); return 0; } + /* case COMMAND_CHANGE_GARAGE_TYPE_WITH_CAR_MODEL: { CollectParameters(&m_nIp, 3); @@ -7900,6 +8063,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) *(CVector*)&ScriptParams[0] = CPlane::FindDrugPlaneCoordinates(); StoreParameters(&m_nIp, 3); return 0; + */ case COMMAND_SAVE_INT_TO_DEBUG_FILE: // TODO: implement something here CollectParameters(&m_nIp, 1); @@ -7927,7 +8091,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) return 0; case COMMAND_SWITCH_RUBBISH: CollectParameters(&m_nIp, 1); - CRubbish::SetVisibility(ScriptParams[0] != 0);; + CRubbish::SetVisibility(ScriptParams[0] != 0); return 0; case COMMAND_REMOVE_PARTICLE_EFFECTS_IN_AREA: { @@ -7966,6 +8130,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CollectParameters(&m_nIp, 1); UpdateCompareFlag(CGarages::IsGarageClosed(ScriptParams[0])); return 0; + /* case COMMAND_START_CATALINA_HELI: CHeli::StartCatalinaFlyBy(); return 0; @@ -7978,6 +8143,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case COMMAND_HAS_CATALINA_HELI_BEEN_SHOT_DOWN: UpdateCompareFlag(CHeli::HasCatalinaBeenShotDown()); return 0; + */ case COMMAND_SWAP_NEAREST_BUILDING_MODEL: { CollectParameters(&m_nIp, 6); @@ -8024,6 +8190,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) pPed->ClearWeapons(); return 0; } + /* case COMMAND_GRAB_CATALINA_HELI: { CHeli* pHeli = CHeli::FindPointerToCatalinasHeli(); @@ -8031,6 +8198,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_CLEAR_AREA_OF_CARS: { CollectParameters(&m_nIp, 6); @@ -8075,9 +8243,11 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CollectParameters(&m_nIp, 1); CTheScripts::RemoveScriptSphere(ScriptParams[0]); return 0; + /* case COMMAND_CATALINA_HELI_FLY_AWAY: CHeli::MakeCatalinaHeliFlyAway(); return 0; + */ case COMMAND_SET_EVERYONE_IGNORE_PLAYER: { CollectParameters(&m_nIp, 2); @@ -8112,18 +8282,21 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_IS_PHONE_DISPLAYING_MESSAGE: CollectParameters(&m_nIp, 1); UpdateCompareFlag(gPhoneInfo.IsMessageBeingDisplayed(ScriptParams[0])); return 0; + */ case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING: { assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); int16 var = CTheScripts::Read2BytesFromScript(&m_nIp); + CollectParameters(&m_nIp, 1); wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? strncpy(onscreen_str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); m_nIp += KEY_LENGTH_IN_SCRIPT; - CUserDisplay::OnscnTimer.AddClock(var, onscreen_str); + CUserDisplay::OnscnTimer.AddClock(var, onscreen_str, ScriptParams[0] != 0); return 0; } case COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING: @@ -8134,7 +8307,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? strncpy(onscreen_str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); m_nIp += KEY_LENGTH_IN_SCRIPT; - CUserDisplay::OnscnTimer.AddCounter(var, ScriptParams[0], onscreen_str); + CUserDisplay::OnscnTimer.AddCounter(var, ScriptParams[0], onscreen_str, 0); return 0; } case COMMAND_CREATE_RANDOM_CAR_FOR_CAR_PARK: @@ -8159,15 +8332,17 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) switch (model) { case MI_LANDSTAL: case MI_LINERUN: + case MI_RIO: case MI_FIRETRUCK: case MI_TRASH: case MI_STRETCH: + case MI_VOODOO: case MI_MULE: case MI_AMBULAN: case MI_FBICAR: case MI_MRWHOOP: case MI_BFINJECT: - // case MI_CORPSE: + case MI_HUNTER: case MI_POLICE: case MI_ENFORCER: case MI_SECURICA: @@ -8175,42 +8350,73 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_BUS: case MI_RHINO: case MI_BARRACKS: - case MI_TRAIN: + case MI_CUBAN: case MI_CHOPPER: - case MI_DODO: + case MI_ANGEL: case MI_COACH: case MI_RCBANDIT: - // case MI_BELLYUP: - // case MI_MRWONGS: - // case MI_MAFIA: - case MI_VOODOO: - // case MI_YAKUZA: - // case MI_DIABLOS: - // case MI_COLUMB: - // case MI_HOODS: + case MI_ROMERO: + case MI_PACKER: + case MI_SENTXS: + case MI_SQUALO: + case MI_SEASPAR: + case MI_PIZZABOY: + case MI_GANGBUR: case MI_AIRTRAIN: case MI_DEADDODO: case MI_SPEEDER: case MI_REEFER: - // case MI_PANLANT: + case MI_TROPIC: case MI_FLATBED: case MI_YANKEE: - // case MI_ESCAPE: + case MI_CADDY: case MI_ZEBRA: case MI_TOPFUN: - // case MI_GHOST: + case MI_SKIMMER: case MI_RCBARON: case MI_RCRAIDER: + case MI_SPARROW: + case MI_PATRIOT: + case MI_LOVEFIST: + case MI_COASTG: + case MI_DINGHY: + case MI_HERMES: + case MI_SABRETUR: + case MI_PHEONIX: + case MI_WALTON: + case MI_COMET: + case MI_DELUXO: + case MI_BURRITO: + case MI_SPAND: + case MI_MARQUIS: + case MI_BAGGAGE: + case MI_KAUFMAN: + case MI_MAVERICK: + case MI_VCNMAV: + case MI_RANCHER: + case MI_FBIRANCH: + case MI_JETMAX: + case MI_HOTRING: + case MI_SANDKING: + case MI_BLISTAC: + case MI_POLMAV: + case MI_BOXVILLE: + case MI_BENSON: + case MI_MESA: + case MI_RCGOBLIN: + case MI_HOTRINA: + case MI_HOTRINB: + case MI_BLOODRA: + case MI_BLOODRB: + case MI_VICECHEE: model = -1; break; case MI_IDAHO: case MI_STINGER: case MI_PEREN: case MI_SENTINEL: - case MI_PATRIOT: case MI_MANANA: case MI_INFERNUS: - // case MI_BLISTA: case MI_PONY: case MI_CHEETAH: case MI_MOONBEAM: @@ -8222,9 +8428,17 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_CABBIE: case MI_STALLION: case MI_RUMPO: -// case 151: -// case 152: -// case 153: + case MI_ADMIRAL: + case MI_PCJ600: + case MI_FAGGIO: + case MI_FREEWAY: + case MI_GLENDALE: + case MI_OCEANIC: + case MI_SANCHEZ: + case MI_SABRE: + case MI_REGINA: + case MI_VIRGO: + case MI_GREENWOO: break; default: printf("CREATE_RANDOM_CAR_FOR_CAR_PARK - Unknown car model %d\n", CStreaming::ms_vehiclesLoaded[index]); @@ -8240,15 +8454,15 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) if (model == -1) return 0; CVehicle* car; - if (!CModelInfo::IsBikeModel(model)) - car = new CAutomobile(model, MISSION_VEHICLE); + //if (CModelInfo::IsBikeModel(model)) // TODO(MIAMI) + car = new CAutomobile(model, MISSION_VEHICLE); CVector pos = *(CVector*)&ScriptParams[0]; pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); car->SetPosition(pos); car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3])); CTheScripts::ClearSpaceForMissionEntity(pos, car); car->SetStatus(STATUS_ABANDONED); - car->bIsLocked = true; + car->bIsLocked = false; car->bIsCarParkVehicle = true; CCarCtrl::JoinCarWithRoadSystem(car); car->AutoPilot.m_nCarMission = MISSION_NONE; @@ -8261,10 +8475,12 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CWorld::Add(car); return 0; } + /* case COMMAND_IS_COLLISION_IN_MEMORY: CollectParameters(&m_nIp, 1); UpdateCompareFlag(CCollision::ms_collisionInMemory == ScriptParams[0]); return 0; + */ case COMMAND_SET_WANTED_MULTIPLIER: CollectParameters(&m_nIp, 1); FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = *(float*)&ScriptParams[0]; @@ -8272,6 +8488,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case COMMAND_SET_CAMERA_IN_FRONT_OF_PLAYER: TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString(); return 0; + /* case COMMAND_IS_CAR_VISIBLY_DAMAGED: { CollectParameters(&m_nIp, 1); @@ -8280,6 +8497,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) UpdateCompareFlag(pVehicle->bIsDamaged); return 0; } + */ case COMMAND_DOES_OBJECT_EXIST: CollectParameters(&m_nIp, 1); UpdateCompareFlag(CPools::GetObjectPool()->GetAt(ScriptParams[0])); @@ -8288,9 +8506,17 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 3); CVector pos = *(CVector*)&ScriptParams[0]; +#ifdef FIX_BUGS + CTimer::Suspend(); +#else CTimer::Stop(); +#endif CStreaming::LoadScene(pos); +#ifdef FIX_BUGS + CTimer::Suspend(); +#else CTimer::Update(); +#endif return 0; } case COMMAND_ADD_STUCK_CAR_CHECK: @@ -8312,12 +8538,20 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) UpdateCompareFlag(CTheScripts::StuckCars.HasCarBeenStuckForAWhile(ScriptParams[0])); return 0; case COMMAND_LOAD_MISSION_AUDIO: + { + CollectParameters(&m_nIp, 1); strncpy(str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) str[i] = tolower(str[i]); + static bool bShowed = false; m_nIp += KEY_LENGTH_IN_SCRIPT; - DMAudio.PreloadMissionAudio(str); + if (!bShowed) { + debug("LOAD_MISSION_AUDIO not implemented\n"); + bShowed = true; + } + //DMAudio.PreloadMissionAudio(str); return 0; + } case COMMAND_HAS_MISSION_AUDIO_LOADED: { CollectParameters(&m_nIp, 1); @@ -8354,6 +8588,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); int node = ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true); + // TODO(MIAMI): replace GetPosition with FindNodeCoorsForScript *(CVector*)&ScriptParams[0] = ThePaths.m_pathNodes[node].GetPosition(); *(float*)&ScriptParams[3] = ThePaths.FindNodeOrientationForCarPlacement(node); StoreParameters(&m_nIp, 4); @@ -8379,21 +8614,32 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) } case COMMAND_SET_MISSION_AUDIO_POSITION: { - CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; - DMAudio.SetMissionAudioLocation(pos.x, pos.y, pos.z); + CollectParameters(&m_nIp, 4); + CVector pos = *(CVector*)&ScriptParams[1]; + static bool bShowed = false; + if (!bShowed) { + debug("SET_MISSION_AUDIO_POSITION not implemented\n"); + bShowed = true; + } + //DMAudio.SetMissionAudioLocation(pos.x, pos.y, pos.z); return 0; } case COMMAND_ACTIVATE_SAVE_MENU: + { + CStats::SafeHouseVisits++; FrontEndMenuManager.m_bSaveMenuActive = true; + FindPlayerPed()->SetMoveSpeed(0.0f, 0.0f, 0.0f); + FindPlayerPed()->SetTurnSpeed(0.0f, 0.0f, 0.0f); return 0; + } case COMMAND_HAS_SAVE_GAME_FINISHED: - UpdateCompareFlag(!FrontEndMenuManager.m_bMenuActive); + UpdateCompareFlag(!FrontEndMenuManager.m_bMenuActive && !FrontEndMenuManager.m_bSaveMenuActive); return 0; case COMMAND_NO_SPECIAL_CAMERA_FOR_THIS_GARAGE: CollectParameters(&m_nIp, 1); CGarages::SetLeaveCameraForThisGarage(ScriptParams[0]); return 0; + /* case COMMAND_ADD_BLIP_FOR_PICKUP_OLD: { CollectParameters(&m_nIp, 3); @@ -8403,6 +8649,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_ADD_BLIP_FOR_PICKUP: { CollectParameters(&m_nIp, 1); @@ -8414,6 +8661,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_ADD_SPRITE_BLIP_FOR_PICKUP: { CollectParameters(&m_nIp, 2); @@ -8425,6 +8673,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_SET_PED_DENSITY_MULTIPLIER: CollectParameters(&m_nIp, 1); CPopulation::PedDensityMultiplier = *(float*)&ScriptParams[0]; @@ -8433,10 +8682,12 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CollectParameters(&m_nIp, 1); CPopulation::m_AllRandomPedsThisType = ScriptParams[0]; return 0; + /* case COMMAND_SET_TEXT_DRAW_BEFORE_FADE: CollectParameters(&m_nIp, 1); CTheScripts::IntroTextLines[CTheScripts::NumberOfIntroTextLinesThisFrame].m_bTextBeforeFade = ScriptParams[0] != 0; return 0; + */ case COMMAND_GET_COLLECTABLE1S_COLLECTED: ScriptParams[0] = CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages; StoreParameters(&m_nIp, 1); @@ -8463,8 +8714,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) if (CCamera::m_bUseMouse3rdPerson && ( strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "HELP15", 7) == 0 || strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_2A", 7) == 0 || - strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_3A", 7) == 0 || - strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_4A", 7) == 0)) { + strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_2C", 7) == 0 || + strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_2D", 7) == 0)) { m_nIp += KEY_LENGTH_IN_SCRIPT; return 0; } @@ -8487,11 +8738,9 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) int8 CRunningScript::ProcessCommands1000To1099(int32 command) { -#ifdef GTA_PS2 - char tmp[48]; -#endif switch (command) { //case COMMAND_FLASH_RADAR_BLIP: + /* case COMMAND_IS_CHAR_IN_CONTROL: { CollectParameters(&m_nIp, 1); @@ -8499,6 +8748,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) UpdateCompareFlag(pPed->IsPedInControl()); return 0; } + */ case COMMAND_SET_GENERATE_CARS_AROUND_CAMERA: CollectParameters(&m_nIp, 1); CCarCtrl::bCarsGeneratedAroundCamera = (ScriptParams[0] != 0); @@ -8506,9 +8756,11 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) case COMMAND_CLEAR_SMALL_PRINTS: CMessages::ClearSmallMessagesOnly(); return 0; + /* case COMMAND_HAS_MILITARY_CRANE_COLLECTED_ALL_CARS: UpdateCompareFlag(CCranes::HaveAllCarsBeenCollectedByMilitaryCrane()); return 0; + */ case COMMAND_SET_UPSIDEDOWN_CAR_NOT_DAMAGED: { CollectParameters(&m_nIp, 2); @@ -8574,6 +8826,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) return 0; } //case COMMAND_MAKE_PLAYER_UNSAFE: + /* case COMMAND_LOAD_COLLISION: { CollectParameters(&m_nIp, 1); @@ -8591,6 +8844,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) // ScriptParams[0] = CObject::nBodyCastHealth; // StoreParameters(&m_nIp, 1); return 0; + */ case COMMAND_SET_CHARS_CHATTING: { CollectParameters(&m_nIp, 3); @@ -8602,6 +8856,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) return 0; } //case COMMAND_MAKE_PLAYER_SAFE: + /* case COMMAND_SET_CAR_STAYS_IN_CURRENT_LEVEL: { CollectParameters(&m_nIp, 2); @@ -8624,18 +8879,33 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) pPed->m_nZoneLevel = LEVEL_NONE; return 0; } + */ case COMMAND_SET_DRUNK_INPUT_DELAY: - assert(0 && "SET_DRUNK_INPUT_DELAY not yet implemented"); + { + CollectParameters(&m_nIp, 2); + debug("SET_DRUNK_INPUT_DELAY not implemented\n"); return 0; + } case COMMAND_SET_CHAR_MONEY: - assert(0 && "SET_CHAR_MONEY not yet implemented"); - return 0; - case COMMAND_INCREASE_CHAR_MONEY: - assert(0 && "INCREASE_CHAR_MONEY not yet implemented"); + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + assert(pPed); + pPed->m_nPedMoney = ScriptParams[1]; + pPed->bMoneyHasBeenGivenByScript = true; return 0; + } + //case COMMAND_INCREASE_CHAR_MONEY: case COMMAND_GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS: - assert(0 && "GET_OFFSET_FROM_OBJECT_IN_WORLD_COORDS not yet implemented"); + { + CollectParameters(&m_nIp, 4); + CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pObject); + CVector result = pObject->GetPosition() + pObject->GetMatrix() * *(CVector*)&ScriptParams[1]; + *(CVector*)&ScriptParams[0] = result; + StoreParameters(&m_nIp, 3); return 0; + } case COMMAND_REGISTER_LIFE_SAVED: CStats::AnotherLifeSavedWithAmbulance(); return 0; @@ -8653,10 +8923,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); gPhoneInfo.m_aPhones[ScriptParams[0]].m_nState = PHONE_STATE_9; return 0; + /* case COMMAND_REGISTER_LONGEST_DODO_FLIGHT: CollectParameters(&m_nIp, 1); CStats::RegisterLongestFlightInDodo(ScriptParams[0]); return 0; + */ case COMMAND_GET_OFFSET_FROM_CAR_IN_WORLD_COORDS: { CollectParameters(&m_nIp, 4); @@ -8674,10 +8946,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) case COMMAND_BLOW_UP_RC_BUGGY: CWorld::Players[CWorld::PlayerInFocus].BlowUpRCBuggy(); return 0; + /* case COMMAND_REMOVE_CAR_FROM_CHASE: CollectParameters(&m_nIp, 1); CRecordDataForChase::RemoveCarFromChase(ScriptParams[0]); return 0; + */ case COMMAND_IS_FRENCH_GAME: UpdateCompareFlag(CGame::frenchGame); return 0; @@ -8685,8 +8959,13 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) UpdateCompareFlag(CGame::germanGame); return 0; case COMMAND_CLEAR_MISSION_AUDIO: - DMAudio.ClearMissionAudio(); + { + CollectParameters(&m_nIp, 1); + debug("CLEAR_MISSION_AUDIO not implemented\n"); + //DMAudio.ClearMissionAudio(); return 0; + } + /* case COMMAND_SET_FADE_IN_AFTER_NEXT_ARREST: CollectParameters(&m_nIp, 1); CRestart::bFadeInAfterNextArrest = !!ScriptParams[0]; @@ -8699,6 +8978,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 2); CGangs::SetGangPedModelOverride(ScriptParams[0], ScriptParams[1]); return 0; + */ case COMMAND_SET_CHAR_USE_PEDNODE_SEEK: { CollectParameters(&m_nIp, 2); @@ -8709,6 +8989,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) pPed->bUsePedNodeSeek = !!ScriptParams[1]; return 0; } + /* case COMMAND_SWITCH_VEHICLE_WEAPONS: { CollectParameters(&m_nIp, 2); @@ -8721,10 +9002,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 2); CWorld::Players[ScriptParams[0]].m_bGetOutOfJailFree = !!ScriptParams[1]; return 0; + */ case COMMAND_SET_FREE_HEALTH_CARE: CollectParameters(&m_nIp, 2); CWorld::Players[ScriptParams[0]].m_bGetOutOfHospitalFree = !!ScriptParams[1]; return 0; + /* case COMMAND_IS_CAR_DOOR_CLOSED: { CollectParameters(&m_nIp, 2); @@ -8733,11 +9016,14 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) UpdateCompareFlag(!pVehicle->IsDoorMissing((eDoors)ScriptParams[1]) && pVehicle->IsDoorClosed((eDoors)ScriptParams[1])); return 0; } + */ case COMMAND_LOAD_AND_LAUNCH_MISSION: return 0; case COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL: { CollectParameters(&m_nIp, 1); + if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2) + return 0; CTimer::Suspend(); int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; #ifdef USE_DEBUG_SCRIPT_LOADER @@ -8755,6 +9041,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CTimer::Resume(); pMissionScript->m_bIsMissionScript = true; pMissionScript->m_bMissionFlag = true; + CTheScripts::bAlreadyRunningAMissionScript = true; + //CGameLogic::ClearShortcut(); // TODO(MIAMI) return 0; } case COMMAND_SET_OBJECT_DRAW_LAST: @@ -8770,14 +9058,15 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; assert(pPed); - CWeapon* pWeaponSlot = &pPed->m_weapons[ScriptParams[1]]; - if (pWeaponSlot->m_eWeaponType == (eWeaponType)ScriptParams[1]) - ScriptParams[0] = pWeaponSlot->m_nAmmoTotal; - else - ScriptParams[0] = 0; + ScriptParams[0] = 0; + for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) { + if (pPed->GetWeapon(i).m_eWeaponType == (eWeaponType)ScriptParams[1]) + ScriptParams[0] = pPed->GetWeapon(i).m_nAmmoTotal; + } StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_GET_AMMO_IN_CHAR_WEAPON: { CollectParameters(&m_nIp, 2); @@ -8822,6 +9111,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) } return 0; } + */ case COMMAND_SET_NEAR_CLIP: CollectParameters(&m_nIp, 1); TheCamera.SetNearClipScript(*(float*)&ScriptParams[0]); @@ -8830,6 +9120,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 2); DMAudio.SetRadioChannel(ScriptParams[0], ScriptParams[1]); return 0; + /* case COMMAND_OVERRIDE_HOSPITAL_LEVEL: CollectParameters(&m_nIp, 1); CRestart::OverrideHospitalLevel = ScriptParams[0]; @@ -8850,6 +9141,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) UpdateCompareFlag(CGarages::IsThisCarWithinGarageArea(ScriptParams[0], pVehicle)); return 0; } + */ case COMMAND_SET_CAR_TRACTION: { CollectParameters(&m_nIp, 2); @@ -8859,9 +9151,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) if (pVehicle->m_vehType == VEHICLE_TYPE_CAR) ((CAutomobile*)pVehicle)->m_fTraction = fTraction; else - // this is certainly not a boat, trane, heli or plane field + // TODO(MIAMI) //((CBike*)pVehicle)->m_fTraction = fTraction; - *(float*)(((char*)pVehicle) + 1088) = fTraction; return 0; } case COMMAND_ARE_MEASUREMENTS_IN_METRES: @@ -8880,6 +9171,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_MARK_ROADS_BETWEEN_LEVELS: { CollectParameters(&m_nIp, 6); @@ -8928,6 +9220,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) ThePaths.PedMarkRoadsBetweenLevelsInArea(infX, supX, infY, supY, infZ, supZ); return 0; } + */ case COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS: { CollectParameters(&m_nIp, 2); @@ -8936,6 +9229,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) pVehicle->AutoPilot.m_bStayInCurrentLevel = !!ScriptParams[1]; return 0; } + /* case COMMAND_SET_CHAR_AVOID_LEVEL_TRANSITIONS: { CollectParameters(&m_nIp, 2); @@ -8948,6 +9242,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 2); UpdateCompareFlag(CPedType::IsThreat(ScriptParams[0], ScriptParams[1])); return 0; + */ case COMMAND_CLEAR_AREA_OF_CHARS: { CollectParameters(&m_nIp, 6); @@ -8974,7 +9269,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) } case COMMAND_SET_TOTAL_NUMBER_OF_MISSIONS: CollectParameters(&m_nIp, 1); - CStats::SetTotalNumberMissions(ScriptParams[0]); + CStats::SetTotalNumberMissions(CGame::germanGame ? ScriptParams[0] - 2 : ScriptParams[0]); return 0; case COMMAND_CONVERT_METRES_TO_FEET_INT: CollectParameters(&m_nIp, 1); @@ -8990,7 +9285,15 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CStats::RegisterHighestScore(ScriptParams[0], ScriptParams[1]); return 0; //case COMMAND_WARP_CHAR_INTO_CAR_AS_PASSENGER: - //case COMMAND_IS_CAR_PASSENGER_SEAT_FREE: + case COMMAND_IS_CAR_PASSENGER_SEAT_FREE: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + assert(pVehicle); + UpdateCompareFlag(ScriptParams[1] < pVehicle->m_nNumMaxPassengers && pVehicle->pPassengers[ScriptParams[1]] == nil); + return 0; + } + /* case COMMAND_GET_CHAR_IN_CAR_PASSENGER_SEAT: { CollectParameters(&m_nIp, 2); @@ -9002,6 +9305,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_SET_CHAR_IS_CHRIS_CRIMINAL: { CollectParameters(&m_nIp, 2); @@ -9024,6 +9328,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CParticle::AddParticle((tParticleType)ScriptParams[0], *(CVector*)&ScriptParams[1], *(CVector*)&ScriptParams[4], nil, *(float*)&ScriptParams[7], 0, 0, 0, 0); return 0; + /* case COMMAND_SET_CHAR_IGNORE_LEVEL_TRANSITIONS: { CollectParameters(&m_nIp, 2); @@ -9056,10 +9361,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CSpecialParticleStuff::UpdateBoatFoamAnimation(&pObject->GetMatrix()); return 0; } + */ case COMMAND_SET_MUSIC_DOES_FADE: CollectParameters(&m_nIp, 1); TheCamera.m_bIgnoreFadingStuffForMusic = (ScriptParams[0] == 0); return 0; + /* case COMMAND_SET_INTRO_IS_PLAYING: CollectParameters(&m_nIp, 1); if (ScriptParams[0]) { @@ -9074,6 +9381,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CStreaming::LoadAllRequestedModels(false); } return 0; + */ case COMMAND_SET_PLAYER_HOOKER: { CollectParameters(&m_nIp, 2); @@ -9086,6 +9394,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CPed* pHooker = CPools::GetPedPool()->GetAt(ScriptParams[1]); assert(pHooker); pPlayerInfo->m_pHooker = (CCivilianPed*)pHooker; + pPlayerInfo->m_nSexFrequency = 1000; pPlayerInfo->m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 1000; pPlayerInfo->m_nNextSexMoneyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000; } @@ -9113,8 +9422,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); - UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_pMyVehicle == pVehicle); + UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE && pPed->m_pMyVehicle == pVehicle); return 0; } case COMMAND_IS_PLAYER_SITTING_IN_ANY_CAR: @@ -9122,15 +9430,17 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; assert(pPed); - UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING); + UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE); return 0; } + /* case COMMAND_SET_SCRIPT_FIRE_AUDIO: CollectParameters(&m_nIp, 2); gFireManager.SetScriptFireAudio(ScriptParams[0], !!ScriptParams[1]); return 0; + */ case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED: - UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3); + UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3); // TODO(MIAMI): more cheats! return 0; case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS: { @@ -9140,6 +9450,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) pPed->bNoCriticalHits = (ScriptParams[0] == 0); return 0; } + /* case COMMAND_IS_PLAYER_LIFTING_A_PHONE: { CollectParameters(&m_nIp, 1); @@ -9148,6 +9459,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) UpdateCompareFlag(pPed->GetPedState() == PED_MAKE_CALL); return 0; } + */ case COMMAND_IS_CHAR_SITTING_IN_CAR: { CollectParameters(&m_nIp, 2); @@ -9155,7 +9467,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); assert(pVehicle); - UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_pMyVehicle == pVehicle); + UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE && pPed->m_pMyVehicle == pVehicle); return 0; } case COMMAND_IS_CHAR_SITTING_IN_ANY_CAR: @@ -9163,7 +9475,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); - UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING); + UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE); return 0; } case COMMAND_IS_PLAYER_ON_FOOT: @@ -9194,7 +9506,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { char tmp[48]; switch (command) { - case COMMAND_LOAD_COLLISION_WITH_SCREEN: // NB: not actually implemented + /* + case COMMAND_LOAD_COLLISION_WITH_SCREEN: CollectParameters(&m_nIp, 1); CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; @@ -9214,6 +9527,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) } CTimer::Update(); return 0; + */ case COMMAND_LOAD_SPLASH_SCREEN: CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp); for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) @@ -9221,7 +9535,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) m_nIp += 8; LoadSplash(tmp); return 0; - case COMMAND_SET_CAR_IGNORE_LEVEL_TRANSITIONS: // NB: not actually implemented + /* + case COMMAND_SET_CAR_IGNORE_LEVEL_TRANSITIONS: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); @@ -9232,7 +9547,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pVehicle->GetPosition()); return 0; } - case COMMAND_MAKE_CRAIGS_CAR_A_BIT_STRONGER: // NB: not actually implemented + case COMMAND_MAKE_CRAIGS_CAR_A_BIT_STRONGER: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); @@ -9242,6 +9557,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) pCar->bMoreResistantToDamage = ScriptParams[1]; return 0; } + */ case COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER: { CollectParameters(&m_nIp, 1); @@ -9256,9 +9572,11 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) DMAudio.PreloadCutSceneMusic(STREAMED_SOUND_GAME_COMPLETED); printf("End preload end of game audio\n"); return 0; - case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA: // NB: not actually implemented + /* + case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA: CPad::GetPad(0)->DisablePlayerControls &= PLAYERCONTROL_DISABLED_1; return 0; + */ case COMMAND_SET_OBJECT_ROTATION: { CollectParameters(&m_nIp, 4); @@ -9278,11 +9596,12 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) *(CVector*)&ScriptParams[0] = TheCamera.Cams[2].Source; StoreParameters(&m_nIp, 3); return 0; - case COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR: // NB: not actually implemented + /* + case COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR: *(CVector*)&ScriptParams[0] = TheCamera.Cams[2].Front; StoreParameters(&m_nIp, 3); return 0; - case COMMAND_IS_PLAYER_TARGETTING_ANY_CHAR: // NB: not actually implemented + case COMMAND_IS_PLAYER_TARGETTING_ANY_CHAR: { CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; @@ -9291,6 +9610,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pTarget && pTarget->IsPed()); return 0; } + */ case COMMAND_IS_PLAYER_TARGETTING_CHAR: { CollectParameters(&m_nIp, 2); @@ -9304,8 +9624,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) static int nCounter = 0; nCounter = Max(0, nCounter - 1); if (!pPed->GetWeapon()->IsTypeMelee() && !bTargetting) { - if ((pTarget->GetPosition() - TheCamera.GetPosition()).Magnitude() < 10.0f) { - CVector vTestedPos(pTarget->GetPosition().x, pTarget->GetPosition().y, pTarget->GetPosition().z + 0.4); + if ((pTestedPed->GetPosition() - TheCamera.GetPosition()).Magnitude() < 10.0f) { + CVector vTestedPos(pTestedPed->GetPosition().x, pTestedPed->GetPosition().y, pTestedPed->GetPosition().z + 0.4); CVector vScreenPos; float w, h; if (CSprite::CalcScreenCoors(vTestedPos, vScreenPos, &w, &h, false)) { @@ -9316,7 +9636,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CEntity* entity; if (!CWorld::ProcessLineOfSight(TheCamera.GetPosition() + 2.0f * TheCamera.GetForward(), vTestedPos, point, entity, true, true, true, true, true, false) || - entity == pTarget) { + entity == pTestedPed) { nCounter += 2; if (nCounter > 20) { bTargetting = true; @@ -9330,7 +9650,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(bTargetting); return 0; } - case COMMAND_IS_PLAYER_TARGETTING_OBJECT: // NB: not actually implemented + /* + case COMMAND_IS_PLAYER_TARGETTING_OBJECT: { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; @@ -9341,6 +9662,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pTarget && pTarget->IsObject() && pTarget == pTestedObject); return 0; } + */ case COMMAND_TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME: { CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp); @@ -9383,8 +9705,10 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) case COMMAND_FAIL_CURRENT_MISSION: CTheScripts::FailCurrentMission = 2; return 0; - case COMMAND_GET_CLOSEST_OBJECT_OF_TYPE: // NB: actually does nothing + case COMMAND_GET_CLOSEST_OBJECT_OF_TYPE: { + return 0; +/* CollectParameters(&m_nIp, 5); CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) @@ -9428,8 +9752,10 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) } StoreParameters(&m_nIp, 1); return 0; +*/ } - case COMMAND_PLACE_OBJECT_RELATIVE_TO_OBJECT: // NB: not actually implemented + /* + case COMMAND_PLACE_OBJECT_RELATIVE_TO_OBJECT: { CollectParameters(&m_nIp, 5); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); @@ -9440,6 +9766,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CPhysical::PlacePhysicalRelativeToOtherPhysical(pTarget, pObject, offset); return 0; } + */ case COMMAND_SET_ALL_OCCUPANTS_OF_CAR_LEAVE_CAR: { CollectParameters(&m_nIp, 1); @@ -9452,7 +9779,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CollectParameters(&m_nIp, 2); TheCamera.SetParametersForScriptInterpolation(*(float*)&ScriptParams[0], 100.0f - *(float*)&ScriptParams[0], ScriptParams[1]); return 0; - case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_TOWARDS_POINT: // NB: not actually implemented + /* + case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_TOWARDS_POINT: { CollectParameters(&m_nIp, 5); CVector pos = *(CVector*)&ScriptParams[0]; @@ -9467,7 +9795,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) StoreParameters(&m_nIp, 4); return 0; } - case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_AWAY_POINT: // NB: not actually implemented + case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_AWAY_POINT: { CollectParameters(&m_nIp, 5); CVector pos = *(CVector*)&ScriptParams[0]; @@ -9482,6 +9810,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) StoreParameters(&m_nIp, 4); return 0; } + */ case COMMAND_GET_DEBUG_CAMERA_POINT_AT: *(CVector*)&ScriptParams[0] = TheCamera.Cams[2].Source + TheCamera.Cams[2].Front; StoreParameters(&m_nIp, 3); @@ -9554,9 +9883,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) continue; if (!pPed->IsWithinArea(x1, y1, x2, y2)) continue; - if (pos.z - PED_FIND_Z_OFFSET > pPed->GetPosition().z) + if (pos.z - COP_PED_FIND_Z_OFFSET > pPed->GetPosition().z) continue; - if (pos.z + PED_FIND_Z_OFFSET < pPed->GetPosition().z) + if (pos.z + COP_PED_FIND_Z_OFFSET < pPed->GetPosition().z) continue; ped_handle = CPools::GetPedPool()->GetIndex(pPed); CTheScripts::LastRandomPedId = ped_handle; @@ -9570,11 +9899,11 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) StoreParameters(&m_nIp, 1); return 0; } - case COMMAND_GET_RANDOM_COP_IN_ZONE: // NB: not actually implemented + /* + case COMMAND_GET_RANDOM_COP_IN_ZONE: { char zone[KEY_LENGTH_IN_SCRIPT]; strncpy(zone, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); -// TODO(MIAMI): just getting this to compile with new argument int nZone = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT); if (nZone != -1) m_nIp += KEY_LENGTH_IN_SCRIPT; @@ -9602,9 +9931,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) continue; if (!CTheZones::PointLiesWithinZone(&pPed->GetPosition(), pZone)) continue; - if (pos.z - PED_FIND_Z_OFFSET > pPed->GetPosition().z) + if (pos.z - COP_PED_FIND_Z_OFFSET > pPed->GetPosition().z) continue; - if (pos.z + PED_FIND_Z_OFFSET < pPed->GetPosition().z) + if (pos.z + COP_PED_FIND_Z_OFFSET < pPed->GetPosition().z) continue; ped_handle = CPools::GetPedPool()->GetIndex(pPed); CTheScripts::LastRandomPedId = ped_handle; @@ -9618,6 +9947,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_SET_CHAR_OBJ_FLEE_CAR: { CollectParameters(&m_nIp, 2); @@ -9704,7 +10034,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[2]; return 0; } - case COMMAND_SET_CAR_HANDBRAKE_TURN_RIGHT: // NB: not actually implemented + /* + case COMMAND_SET_CAR_HANDBRAKE_TURN_RIGHT: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); @@ -9713,7 +10044,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1]; return 0; } - case COMMAND_SET_CAR_HANDBRAKE_STOP: // NB: not actually implemented + case COMMAND_SET_CAR_HANDBRAKE_STOP: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); @@ -9722,6 +10053,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1]; return 0; } + */ case COMMAND_IS_CHAR_ON_ANY_BIKE: { CollectParameters(&m_nIp, 1); @@ -9730,10 +10062,12 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bInVehicle&& pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE); return 0; } - case COMMAND_LOCATE_SNIPER_BULLET_2D: // NB: not actually implemented - case COMMAND_LOCATE_SNIPER_BULLET_3D: // NB: not actually implemented + /* + case COMMAND_LOCATE_SNIPER_BULLET_2D: + case COMMAND_LOCATE_SNIPER_BULLET_3D: LocateSniperBulletCommand(command, &m_nIp); return 0; + */ case COMMAND_GET_NUMBER_OF_SEATS_IN_MODEL: CollectParameters(&m_nIp, 1); ScriptParams[0] = CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors(ScriptParams[0]) + 1; @@ -9747,7 +10081,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE); return 0; } - case COMMAND_IS_CHAR_LYING_DOWN: // NB: not actually implemented + /* + case COMMAND_IS_CHAR_LYING_DOWN: { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); @@ -9755,6 +10090,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bFallenDown); return 0; } + */ case COMMAND_CAN_CHAR_SEE_DEAD_CHAR: { CollectParameters(&m_nIp, 2); @@ -9807,7 +10143,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(CModelInfo::GetModelInfo(ScriptParams[0]) != nil); return 0; case COMMAND_SHUT_CHAR_UP: - assert("SHUT_CHAR_UP not implemented"); // TODO(MIAMI) + CollectParameters(&m_nIp, 1); + debug("SHUT_CHAR_UP not implemented"); // TODO(MIAMI) + return 0; case COMMAND_SET_ENABLE_RC_DETONATE: CollectParameters(&m_nIp, 1); CVehicle::bDisableRemoteDetonation = ScriptParams[0]; @@ -10762,6 +11100,37 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) return -1; } +bool CRunningScript::CheckDamagedWeaponType(int32 type, int32 actual) +{ + if (actual == -1) + return false; + if (type == WEAPONTYPE_ANYMELEE) { + switch (actual) { + case WEAPONTYPE_UNARMED: + case WEAPONTYPE_BRASSKNUCKLE: + case WEAPONTYPE_SCREWDRIVER: + case WEAPONTYPE_GOLFCLUB: + case WEAPONTYPE_NIGHTSTICK: + case WEAPONTYPE_KNIFE: + case WEAPONTYPE_BASEBALLBAT: + case WEAPONTYPE_HAMMER: + case WEAPONTYPE_CLEAVER: + case WEAPONTYPE_MACHETE: + case WEAPONTYPE_KATANA: + case WEAPONTYPE_CHAINSAW: + return true; + default: + return false; + } + } + if (type == WEAPONTYPE_ANYWEAPON) { + // TODO(MIAMI)! + return actual != WEAPONTYPE_UNIDENTIFIED && actual != WEAPONTYPE_RAMMEDBYCAR && + actual != WEAPONTYPE_RUNOVERBYCAR && actual != WEAPONTYPE_FALL && actual != WEAPONTYPE_DROWNING; + } + return false; +} + bool CRunningScript::ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami) { switch (mi) |