diff options
Diffstat (limited to 'src/control/Script3.cpp')
-rw-r--r-- | src/control/Script3.cpp | 245 |
1 files changed, 149 insertions, 96 deletions
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index 9a37cb6c..a34c89a9 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -32,6 +32,8 @@ #include "WaterLevel.h" #include "Weather.h" #include "Zones.h" +#include "GameLogic.h" +#include "Bike.h" int8 CRunningScript::ProcessCommands500To599(int32 command) { @@ -70,6 +72,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) } return 0; } + /* case COMMAND_ADD_PAGER_MESSAGE_WITH_NUMBER: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -78,6 +81,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); @@ -144,7 +148,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) } case COMMAND_ADD_EXPLOSION: CollectParameters(&m_nIp, 4); - CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0); + CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, true); return 0; case COMMAND_IS_CAR_UPRIGHT: @@ -222,7 +226,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: { @@ -262,6 +265,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); @@ -270,56 +274,39 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) ScriptParams[0], -1, -1, -1, -1, -1); return 0; } + */ case COMMAND_SET_GARAGE: { - CollectParameters(&m_nIp, 7); + CollectParameters(&m_nIp, 9); float infX = *(float*)&ScriptParams[0]; float infY = *(float*)&ScriptParams[1]; float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; - if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; - } - if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; - } - if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; - } - ScriptParams[0] = CGarages::AddOne(CVector(infX, infY, infZ), CVector(supX, supY, supZ), ScriptParams[6], 0); + float X2 = *(float*)&ScriptParams[3]; + float Y2 = *(float*)&ScriptParams[4]; + float supX = *(float*)&ScriptParams[5]; + float supY = *(float*)&ScriptParams[6]; + float supZ = *(float*)&ScriptParams[7]; + ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], 0); StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_SET_GARAGE_WITH_CAR_MODEL: { - CollectParameters(&m_nIp, 8); + CollectParameters(&m_nIp, 10); float infX = *(float*)&ScriptParams[0]; float infY = *(float*)&ScriptParams[1]; float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; - if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; - } - if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; - } - if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; - } - ScriptParams[0] = CGarages::AddOne(CVector(infX, infY, infZ), CVector(supX, supY, supZ), ScriptParams[6], ScriptParams[7]); + float X2 = *(float*)&ScriptParams[3]; + float Y2 = *(float*)&ScriptParams[4]; + float supX = *(float*)&ScriptParams[5]; + float supY = *(float*)&ScriptParams[6]; + float supZ = *(float*)&ScriptParams[7]; + ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], ScriptParams[9]); StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_SET_TARGET_CAR_FOR_MISSION_GARAGE: { CollectParameters(&m_nIp, 2); @@ -377,6 +364,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); @@ -390,6 +378,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); @@ -399,7 +388,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; script_assert(pPed); - pPed->m_fHealth = ScriptParams[1]; + pPed->m_fHealth = Min(ScriptParams[1], CWorld::Players[ScriptParams[0]].m_nMaxHealth); return 0; } case COMMAND_SET_CHAR_HEALTH: @@ -416,7 +405,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->FlagToDestroyWhenNextProcessed(); } else { - pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); + pPed->SetDie(); } return 0; } @@ -433,7 +422,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; script_assert(pPed); - ScriptParams[0] = pPed->m_fHealth; // correct cast float to int + ScriptParams[0] = pPed->m_fHealth; StoreParameters(&m_nIp, 1); return 0; } @@ -442,7 +431,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); script_assert(pPed); - ScriptParams[0] = pPed->m_fHealth; // correct cast float to int + ScriptParams[0] = pPed->m_fHealth; StoreParameters(&m_nIp, 1); return 0; } @@ -451,19 +440,21 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_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]); script_assert(pCar); script_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); @@ -577,15 +568,19 @@ 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_PED_MODELS: + */ + //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]); + return 0; case COMMAND_SET_GANG_CAR_MODEL: CollectParameters(&m_nIp, 2); CGangs::SetGangVehicleModel(ScriptParams[0], ScriptParams[1]); @@ -594,6 +589,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); @@ -620,6 +616,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); @@ -633,6 +630,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); @@ -661,6 +659,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(isTouching); return 0; } + */ case COMMAND_LOAD_SPECIAL_CHARACTER: { CollectParameters(&m_nIp, 1); @@ -678,6 +677,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(CStreaming::HasSpecialCharLoaded(ScriptParams[0] - 1)); return 0; } + /* case COMMAND_FLASH_CAR: { CollectParameters(&m_nIp, 2); @@ -702,10 +702,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); @@ -716,6 +718,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed(); return 0; } + */ case COMMAND_SET_CHAR_PERSONALITY: { CollectParameters(&m_nIp, 2); @@ -736,6 +739,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); @@ -744,6 +748,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->m_animGroup = (AssocGroupId)ScriptParams[1]; return 0; } + */ case COMMAND_REQUEST_MODEL: { CollectParameters(&m_nIp, 1); @@ -778,6 +783,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_SET_REPEATED_PHONE_MESSAGE: { CollectParameters(&m_nIp, 1); @@ -798,6 +804,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) UpdateCompareFlag(gPhoneInfo.HasMessageBeenDisplayed(ScriptParams[0])); return 0; } + */ case COMMAND_TURN_PHONE_OFF: { CollectParameters(&m_nIp, 1); @@ -823,18 +830,15 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) ScriptParams[3] / 255.0f, ScriptParams[4] / 255.0f, ScriptParams[5] / 255.0f, 0, true); return 0; } - case COMMAND_STORE_WEATHER: - CWeather::StoreWeatherState(); - return 0; - case COMMAND_RESTORE_WEATHER: - CWeather::RestoreWeatherState(); - return 0; + //case COMMAND_STORE_WEATHER: + //case COMMAND_RESTORE_WEATHER: case COMMAND_STORE_CLOCK: CClock::StoreClock(); return 0; case COMMAND_RESTORE_CLOCK: CClock::RestoreClock(); return 0; + /* case COMMAND_RESTART_CRITICAL_MISSION: { CollectParameters(&m_nIp, 4); @@ -847,6 +851,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CWorld::Players[CWorld::PlayerInFocus].PlayerFailedCriticalMission(); return 0; } + */ case COMMAND_IS_PLAYER_PLAYING: { CollectParameters(&m_nIp, 1); @@ -1205,19 +1210,25 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(pVehicle); - script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); - ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0); + //assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + // they DO call this for bikes, we don't really want to destroy the structure... +#ifdef FIX_BUGS + if (pVehicle->m_vehType == VEHICLE_TYPE_CAR) +#endif + ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0); + return 0; } + /* case COMMAND_IS_TAXI: { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); script_assert(pVehicle); - int mi = pVehicle->GetModelIndex(); - UpdateCompareFlag(mi == MI_TAXI || mi == MI_CABBIE || mi == MI_BORGNINE); + UpdateCompareFlag(pVehicle->IsTaxi()); return 0; } + */ case COMMAND_UNLOAD_SPECIAL_CHARACTER: CollectParameters(&m_nIp, 1); CStreaming::SetMissionDoesntRequireSpecialChar(ScriptParams[0] - 1); @@ -1230,6 +1241,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]); @@ -1245,12 +1257,13 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) } return 0; } + */ case COMMAND_CREATE_OBJECT_NO_OFFSET: { CollectParameters(&m_nIp, 4); int mi = ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::UsedObjectArray[-ScriptParams[0]].index; CObject* pObj = new CObject(mi, false); - pObj->ObjectCreatedBy = MISSION_OBJECT; +; pObj->ObjectCreatedBy = MISSION_OBJECT; CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -1258,6 +1271,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); @@ -1266,6 +1282,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT); return 0; } + /* case COMMAND_IS_BOAT: { CollectParameters(&m_nIp, 1); @@ -1300,6 +1317,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius); return 0; } + */ #ifdef GTA_SCRIPT_COLLECTIVE case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS: { @@ -1325,13 +1343,16 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) return 0; } #endif + /* case COMMAND_IS_PLAYER_STOPPED: { CollectParameters(&m_nIp, 1); CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; UpdateCompareFlag(CTheScripts::IsPlayerStopped(pPlayer)); return 0; + } + /* case COMMAND_IS_CHAR_STOPPED: { CollectParameters(&m_nIp, 1); @@ -1354,6 +1375,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) @@ -1361,6 +1383,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) else TheCamera.SetWideScreenOff(); return 0; + /* case COMMAND_ADD_SPRITE_BLIP_FOR_CAR: { CollectParameters(&m_nIp, 2); @@ -1397,6 +1420,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT: { CollectParameters(&m_nIp, 4); @@ -1477,6 +1501,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]); @@ -1490,6 +1515,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CollectParameters(&m_nIp, 2); UpdateCompareFlag(CGarages::HasThisCarBeenCollected(ScriptParams[0], ScriptParams[1] - 1)); return 0; + */ default: script_assert(0); } @@ -1499,6 +1525,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); @@ -1511,6 +1538,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); @@ -1524,7 +1552,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f)]; + CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f, true)]; *(CVector*)&ScriptParams[0] = pNode->GetPosition(); StoreParameters(&m_nIp, 3); return 0; @@ -1535,8 +1563,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f)]; - *(CVector*)&ScriptParams[0] = pNode->GetPosition(); + *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true)); StoreParameters(&m_nIp, 3); return 0; } @@ -1555,10 +1582,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]); @@ -1589,6 +1617,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); @@ -1613,6 +1642,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius())); return 0; } + /* case COMMAND_GOSUB_FILE: { CollectParameters(&m_nIp, 2); @@ -1622,6 +1652,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) // ScriptParams[1] == filename return 0; } + */ case COMMAND_GET_GROUND_Z_FOR_3D_COORD: { CollectParameters(&m_nIp, 3); @@ -1649,6 +1680,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); @@ -1657,6 +1689,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pVehicle->bComedyControls = (ScriptParams[1] != 0); return 0; } + */ case COMMAND_BOAT_GOTO_COORDS: { CollectParameters(&m_nIp, 4); @@ -1670,7 +1703,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; } @@ -1724,7 +1757,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; script_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: @@ -1732,9 +1765,10 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); script_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; @@ -1747,6 +1781,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CPacManPickups::GenerateOnePMPickUp(pos); return 0; } + */ case COMMAND_SET_BOAT_CRUISE_SPEED: { CollectParameters(&m_nIp, 2); @@ -1757,6 +1792,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); @@ -1781,8 +1817,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) continue; if (pPed->bFadeOut) continue; - if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) - continue; +// if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) +// continue; if (!ThisIsAValidRandomPed(pPed->m_nPedType)) continue; if (pPed->bIsLeader || pPed->m_leader) @@ -1805,14 +1841,16 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) StoreParameters(&m_nIp, 1); return 0; } + */ case COMMAND_GET_RANDOM_CHAR_IN_ZONE: { char zone[KEY_LENGTH_IN_SCRIPT]; strncpy(zone, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); - int nZone = CTheZones::FindZoneByLabelAndReturnIndex(zone); + int nZone = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT); if (nZone != -1) m_nIp += KEY_LENGTH_IN_SCRIPT; - CZone* pZone = CTheZones::GetZone(nZone); + CZone* pZone = CTheZones::GetNavigationZone(nZone); + CollectParameters(&m_nIp, 3); int ped_handle = -1; CVector pos = FindPlayerCoors(); int i = CPools::GetPedPool()->GetSize(); @@ -1830,9 +1868,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) continue; if (pPed->bFadeOut) continue; - if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) + if (pPed->m_nWaitState != WAITSTATE_FALSE) continue; - if (!ThisIsAValidRandomPed(pPed->m_nPedType)) + if (!ThisIsAValidRandomPed(pPed->m_nPedType, ScriptParams[0], ScriptParams[1], ScriptParams[2])) continue; if (pPed->bIsLeader || pPed->m_leader) continue; @@ -1842,6 +1880,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; @@ -1962,6 +2004,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); @@ -2032,6 +2075,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); @@ -2051,29 +2095,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) m_nIp += KEY_LENGTH_IN_SCRIPT; return 0; } - case COMMAND_CREATE_CUTSCENE_HEAD: - { - CollectParameters(&m_nIp, 2); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - script_assert(pObject); - CCutsceneHead* pCutHead = CCutsceneMgr::AddCutsceneHead(pObject, ScriptParams[1]); - ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pCutHead); - StoreParameters(&m_nIp, 1); - return 0; - } - case COMMAND_SET_CUTSCENE_HEAD_ANIM: - { - CollectParameters(&m_nIp, 1); - CObject* pCutHead = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - script_assert(pCutHead); - char name[KEY_LENGTH_IN_SCRIPT]; - strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); - m_nIp += KEY_LENGTH_IN_SCRIPT; - CTimer::Stop(); - CCutsceneMgr::SetHeadAnim(name, pCutHead); - CTimer::Update(); - 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])); @@ -2106,6 +2129,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 2); CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], 0); return 0; + /* case COMMAND_ACTIVATE_CRUSHER_CRANE: { CollectParameters(&m_nIp, 10); @@ -2134,6 +2158,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); @@ -2141,6 +2166,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); @@ -2148,6 +2174,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); @@ -2155,6 +2182,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); @@ -2169,6 +2197,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); @@ -2176,6 +2205,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); @@ -2211,6 +2241,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); @@ -2218,6 +2249,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); @@ -2243,6 +2275,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]; @@ -2250,6 +2283,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); @@ -2296,6 +2331,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) strncpy(CStats::LastMissionPassedName, name, KEY_LENGTH_IN_SCRIPT); ++CStats::MissionsPassed; CStats::CheckPointReachedSuccessfully(); + CTheScripts::LastMissionPassedTime = CTimer::GetTimeInMilliseconds(); + CGameLogic::RemoveShortCutDropOffPointForMission(); return 0; } case COMMAND_SET_CHAR_RUNNING: @@ -2309,6 +2346,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); @@ -2325,22 +2363,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(pPed->m_lastWepDam, ScriptParams[1]); + 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(pVehicle->m_nLastWeaponDamage, ScriptParams[1]); + else + result = ScriptParams[1] == pVehicle->m_nLastWeaponDamage; + } + UpdateCompareFlag(result); return 0; } case COMMAND_IS_CHAR_IN_CHARS_GROUP: |