summaryrefslogtreecommitdiff
path: root/src/control
diff options
context:
space:
mode:
authorNikolay <nickvnuk@gmail.com>2021-08-31 23:16:52 +0300
committerGitHub <noreply@github.com>2021-08-31 23:16:52 +0300
commit9bd80324d1ff3f221304a7dde98358d9895926c2 (patch)
tree7f2b08583a71f159faa69b4254b54e4fac55174c /src/control
parent27ddca26c2f01428f68f25d12ffb293573b17033 (diff)
parentb67a08744849c2d0912ac818de92b752ee563e19 (diff)
Merge pull request #1327 from Nick007J/lcs
some lcs stuff
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Garages.cpp34
-rw-r--r--src/control/Pickups.cpp6
-rw-r--r--src/control/Script.cpp70
-rw-r--r--src/control/Script10.cpp4
-rw-r--r--src/control/Script3.cpp63
-rw-r--r--src/control/Script4.cpp98
-rw-r--r--src/control/Script5.cpp9
-rw-r--r--src/control/Script6.cpp22
-rw-r--r--src/control/Script7.cpp14
-rw-r--r--src/control/Script8.cpp21
-rw-r--r--src/control/Script9.cpp7
11 files changed, 203 insertions, 145 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index c4916878..dd9067fc 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -627,13 +627,24 @@ void CGarage::Update()
case GS_OPENED:
UpdateDoorsHeight();
if (IsStaticPlayerCarEntirelyInside()) {
+#ifndef BOMBS_ON_BIKES
if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) {
CGarages::TriggerMessage("GA_22", -1, 4000, -1);
m_eGarageState = GS_OPENEDCONTAINSCAR;
DMAudio.PlayFrontEndSound(SOUND_GARAGE_BOMB_ALREADY_SET, 1);
break;
}
- if (!FindPlayerVehicle() || FindPlayerVehicle()->m_bombType) {
+#endif
+ if (!FindPlayerVehicle()
+#ifdef FIX_BUGS
+ || (FindPlayerVehicle()->IsCar() && ((CAutomobile*)FindPlayerVehicle())->m_bombType)
+#else
+ || ((CAutomobile*)FindPlayerVehicle())->m_bombType
+#endif
+#ifdef BOMBS_ON_BIKES
+ || (FindPlayerVehicle()->IsBike() && ((CBike*)FindPlayerVehicle())->m_bombType)
+#endif
+ ) {
CGarages::TriggerMessage("GA_5", -1, 4000, -1); //"Your car is already fitted with a bomb"
m_eGarageState = GS_OPENEDCONTAINSCAR;
DMAudio.PlayFrontEndSound(SOUND_GARAGE_BOMB_ALREADY_SET, 1);
@@ -677,10 +688,16 @@ void CGarage::Update()
if (!CGarages::BombsAreFree)
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - BOMB_PRICE);
if (FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike())) {
-#if (!defined GTA_PS2 || defined FIX_BUGS) // <- this remained in CAutomobile in LCS
- FindPlayerVehicle()->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
- FindPlayerVehicle()->m_pBombRigger = FindPlayerPed();
-#else // PS2 version contained a bug: CBike was casted to CAutomobile, but due to coincidence it didn't corrupt memory
+#ifdef BOMBS_ON_BIKES
+ if (FindPlayerVehicle()->IsCar()) {
+ ((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
+ ((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
+ }
+ else {
+ ((CBike*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
+ ((CBike*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
+ }
+#else
((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
#endif
@@ -694,6 +711,13 @@ void CGarage::Update()
pCar->m_pBombRigger = nil;
pCar->m_pBlowUpEntity = nil;
}
+#ifdef BOMBS_ON_BIKES
+ if (pVehicle->IsBike() && pVehicle->GetStatus() == STATUS_WRECKED) {
+ CBike* pBike = (CBike*)pVehicle;
+ pBike->m_pBombRigger = nil;
+ pBike->m_pBlowUpEntity = nil;
+ }
+#endif
}
}
if (m_eGarageType == GARAGE_BOMBSHOP3)
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index f31d89b3..020083cf 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -709,8 +709,10 @@ bool
CPickups::TestForPickupsInBubble(CVector pos, float range)
{
for (int i = 0; i < NUMPICKUPS; i++) {
- if ((aPickUps[i].m_vecPos - pos).Magnitude() < range)
- return true;
+ if (aPickUps[i].m_eType != PICKUP_NONE) {
+ if ((aPickUps[i].m_vecPos - pos).Magnitude() < range)
+ return true;
+ }
}
return false;
}
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 59af9ff2..fc62aab7 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -179,65 +179,6 @@ static const char* MissionScripts[] = {
"TOSH4"
};
-static const char* MissionScripts[] = {
- "LAWYER1",
- "LAWYER2",
- "LAWYER3",
- "LAWYER4",
- "GENERL1",
- "COL2",
- "GENERL3",
- "COL_4",
- "COL_5",
- "baron1",
- "baron2",
- "baron3",
- "baron4",
- "kent1",
- "baron5",
- "serg1",
- "serg2",
- "serg3",
- "bankjo1",
- "bankjo2",
- "bankjo3",
- "bankjo4",
- "phil1",
- "phil2",
- "porno1",
- "porno2",
- "porno3",
- "porno4",
- "protec1",
- "protec2",
- "protec3",
- "count1",
- "count2",
- "CAP_1",
- "FIN_1",
- "bike1",
- "bike2",
- "bike3",
- "rockb1",
- "rockb2",
- "rockb3",
- "cuban1",
- "cuban2",
- "cuban3",
- "cuban4",
- "hait1",
- "hait2",
- "hait3",
- "assin1",
- "assin2",
- "assin3",
- "assin4",
- "assin5",
- "taxwar1",
- "taxwar2",
- "taxwar3"
-};
-
int AllowMissionReplay;
uint32 NextMissionDelay;
uint32 MissionStartTime;
@@ -501,7 +442,7 @@ void CMissionCleanup::Process()
#endif
CStreaming::ms_disableStreaming = false;
if (CHud::m_ItemToFlash != ITEM_ARMOUR && CHud::m_ItemToFlash != ITEM_HEALTH)
- CHud::m_ItemToFlash = -1;
+ CHud::m_ItemToFlash = ITEM_NONE;
CHud::SetHelpMessage(nil, false); // nil, false, false, true TODO(LCS)
CUserDisplay::OnscnTimer.m_bDisabled = false;
CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false;
@@ -1851,7 +1792,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
if (ped) { // great time to check
for (int i = 0; i < ped->m_numNearPeds; i++) {
CPed* pTestedPed = ped->m_nearPeds[i];
- if (!pTestedPed || !IsPedPointerValid(pTestedPed))
+ if (!pTestedPed || !IsPedPointerValid(pTestedPed) || pTestedPed->bIsFrozen)
continue;
if (pTestedPed->m_pedInObjective == ped && pTestedPed->m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION) {
CVector vFollowerPos = pTestedPed->GetFormationPosition();
@@ -1864,7 +1805,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
}
}
}
- else if (pTestedPed->m_leader == ped) {
+ else if (pTestedPed->m_leader == ped && !pTestedPed->bIsFrozen) {
CVector vFollowerPos;
if (pTestedPed->m_pedFormation)
vFollowerPos = pTestedPed->GetFormationPosition();
@@ -2551,6 +2492,9 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
}
SET_INTEGER_PARAM(0, handle);
StoreParameters(&m_nIp, 1);
+#ifdef GTA_NETWORK
+ // TODO(LCS): register car
+#endif
if (m_bIsMissionScript)
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
return 0;
@@ -3128,6 +3072,8 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_DELETE_OBJECT:
{
CollectParameters(&m_nIp, 1);
+ if (GET_INTEGER_PARAM(0) > (NUMOBJECTS + 2) << 8)
+ return 0;
CObject* pObj = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
if (pObj){
CWorld::Remove(pObj);
diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp
index b6489843..ed1a9264 100644
--- a/src/control/Script10.cpp
+++ b/src/control/Script10.cpp
@@ -104,7 +104,11 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
return 0;
}
case COMMAND_IS_DEVELOPER:
+#ifdef GTA_NETWORK
+ UpdateCompareFlag(gDeveloperFlag || gIsMultiplayerGame);
+#else
UpdateCompareFlag(gDeveloperFlag);
+#endif
return 0;
case COMMAND_SET_DEVELOPER_FLAG:
CollectParameters(&m_nIp, 1);
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index e2646866..9d66b4fe 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -373,10 +373,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB:
{
CollectParameters(&m_nIp, 1);
- CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
- script_assert(pCar);
- script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
+ script_assert(pVehicle);
+#ifdef FIX_BUGS
+ if (pVehicle->IsCar())
+ UpdateCompareFlag(((CAutomobile*)pVehicle)->m_bombType != 0);
+ else if (pVehicle->IsBike())
+ UpdateCompareFlag(((CBike*)pVehicle)->m_bombType != 0);
+ else
+ UpdateCompareFlag(false);
+#else
+ CAutomobile* pCar = (CVehicle*)pVehicle;
UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum
+#endif
return 0;
}
case COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR:
@@ -447,10 +456,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
case COMMAND_IS_CAR_ARMED_WITH_BOMB:
{
CollectParameters(&m_nIp, 2);
- CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
- script_assert(pCar);
- //script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
- UpdateCompareFlag(pCar->m_bombType == GET_INTEGER_PARAM(1));
+ CAutomobile* pVehicle = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
+ script_assert(pVehicle);
+#ifdef FIX_BUGS
+ if (pVehicle->IsCar())
+ UpdateCompareFlag(((CAutomobile*)pVehicle)->m_bombType == GET_INTEGER_PARAM(1));
+ else if (pVehicle->IsBike())
+ UpdateCompareFlag(((CBike*)pVehicle)->m_bombType == GET_INTEGER_PARAM(1));
+ else
+ UpdateCompareFlag(false);
+#else
+ CAutomobile* pCar = (CVehicle*)pVehicle;
+ UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum
+#endif
return 0;
}
case COMMAND_CHANGE_CAR_COLOUR:
@@ -710,9 +728,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+#ifdef FIX_BUGS
+ if (pVehicle->IsCar()) {
+ ((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1);
+ ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
+ }
+ else if (pVehicle->IsBike()) {
+ ((CBike*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1);
+ ((CBike*)pVehicle)->m_pBombRigger = FindPlayerPed();
+ }
+#else
((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1);
((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
+#endif
return 0;
}
case COMMAND_SET_CHAR_PERSONALITY:
@@ -776,7 +804,10 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
int model = GET_INTEGER_PARAM(0);
if (model < 0)
model = CTheScripts::UsedObjectArray[-model].index;
- CStreaming::SetMissionDoesntRequireModel(model);
+ if (m_bIsMissionScript)
+ CStreaming::SetMissionDoesntRequireModel(model);
+ else
+ CStreaming::SetAmbientMissionDoesntRequireModel(model);
return 0;
}
case COMMAND_GRAB_PHONE:
@@ -1243,8 +1274,8 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
CollectParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CStreaming::SetMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1);
- //else
- // CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); // TODO
+ else
+ CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1);
return 0;
case COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER:
CDarkel::ResetModelsKilledByPlayer();
@@ -1393,7 +1424,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
if (GET_INTEGER_PARAM(0) != 0)
TheCamera.SetWideScreenOn();
else {
- // TODO: unknown field
+ // TODO(LCS): unknown field
TheCamera.SetWideScreenOff();
}
return 0;
@@ -1944,7 +1975,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3))); // MI_MONEY -> gpModelIndices[...]
+ SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3)));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -1953,7 +1984,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- pPed->m_wepAccuracy = GET_INTEGER_PARAM(1) * 1.25f;
+ pPed->m_wepAccuracy = Min(100, GET_INTEGER_PARAM(1) * 1.25f);
return 0;
}
case COMMAND_GET_CAR_SPEED:
@@ -1969,7 +2000,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
char name[KEY_LENGTH_IN_SCRIPT];
strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
- // unknown call FUN_29df68(name) on PS2
+ // unknown call FUN_29df68(name) on PS2 - not on PSP
m_nIp += KEY_LENGTH_IN_SCRIPT;
CColStore::RemoveAllCollision();
CCutsceneMgr::LoadCutsceneData(name);
@@ -2010,7 +2041,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
return 0;
}
case COMMAND_CLEAR_CUTSCENE:
- // unknown call on PS2 FUN_29DFA0();
+ // unknown call on PS2 FUN_29DFA0() - not on PSP
printf("clear cutscene\n");
CCutsceneMgr::DeleteCutsceneData();
return 0;
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index b6bc9b4c..91c45bf2 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -789,7 +789,22 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->m_pMyVehicle->RemovePassenger(pPed);
}
if (pPed->m_vehDoor) {
- if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) {
+ eDoors door;
+ switch (pPed->m_vehDoor) {
+ case CAR_DOOR_LF:
+ door = DOOR_FRONT_LEFT;
+ break;
+ case CAR_DOOR_RF:
+ door = DOOR_FRONT_RIGHT;
+ break;
+ case CAR_DOOR_LR:
+ door = DOOR_REAR_LEFT;
+ break;
+ case CAR_DOOR_RR:
+ door = DOOR_REAR_RIGHT;
+ break;
+ }
+ if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR || !pPed->m_pMyVehicle->IsDoorClosed(door)) {
uint8 flags = 0;
if (pPed->m_pMyVehicle->IsBike()) {
if (pPed->m_vehDoor == CAR_DOOR_LF ||
@@ -1397,7 +1412,9 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CollectParameters(&m_nIp, 1);
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE);
+#ifndef GTA_PSP
//DMAudio.SaveAnnouncementsWhenMissionPassedPlayed(); // TODO!
+#endif
return 0;
}
case COMMAND_CLEAR_AREA:
@@ -1407,6 +1424,9 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CWorld::ClearExcitingStuffFromArea(pos, GET_FLOAT_PARAM(3), GET_INTEGER_PARAM(4));
+#ifdef GTA_MOBILE
+ // CPopulation::ms_blockPedCreationForAFrame = true;
+#endif
return 0;
}
case COMMAND_FREEZE_ONSCREEN_TIMER:
@@ -1471,7 +1491,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
float size = Max(0.0f, GET_FLOAT_PARAM(7));
eParticleObjectType type = (eParticleObjectType)GET_INTEGER_PARAM(0);
RwRGBA color;
- if (type == POBJECT_SMOKE_TRAIL){ // 17 in LCS -- assuming enum is the same
+ if (type == POBJECT_SMOKE_TRAIL){
color.alpha = -1;
color.red = GET_INTEGER_PARAM(8);
color.green = GET_INTEGER_PARAM(9);
@@ -1790,8 +1810,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
continue;
if (CModelInfo::IsCarModel(model) || CModelInfo::IsBikeModel(model)) {
switch (model) {
- // TODO(LCS): do it right
- // apparently leeds didn't :lmao:
case MI_LANDSTAL:
case MI_LINERUN:
case MI_RIO:
@@ -1804,6 +1822,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_FBICAR:
case MI_MRWHOOP:
case MI_BFINJECT:
+ case MI_HEARSE:
case MI_HUNTER:
case MI_POLICE:
case MI_ENFORCER:
@@ -1817,13 +1836,15 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_ANGEL:
case MI_COACH:
case MI_RCBANDIT:
- //case MI_ROMERO:
- //case MI_PACKER:
- //case MI_SENTXS:
+ case MI_PACKER:
+ case MI_SENTXS:
case MI_SQUALO:
case MI_SEASPAR:
case MI_PIZZABOY:
- //case MI_GANGBUR:
+ case MI_NOODLEBOY:
+ case MI_ANGEL2:
+ case MI_SANCHEZ2:
+ case MI_GANGBUR:
case MI_AIRTRAIN:
case MI_DEADDODO:
case MI_SPEEDER:
@@ -1832,45 +1853,49 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_FLATBED:
case MI_YANKEE:
case MI_CADDY:
- //case MI_ZEBRA:
+ case MI_BORGNINE:
case MI_TOPFUN:
+ case MI_CAMPVAN:
+ case MI_BALLOT:
case MI_SKIMMER:
case MI_RCBARON:
case MI_RCRAIDER:
case MI_SPARROW:
case MI_PATRIOT:
- //case MI_LOVEFIST:
+ case MI_LOVEFIST:
case MI_COASTG:
case MI_DINGHY:
- //case MI_HERMES:
- //case MI_SABRETUR:
+ case MI_HERMES:
+ case MI_SABRETUR:
case MI_PHEONIX:
- //case MI_WALTON:
+ case MI_WALTON:
case MI_COMET:
- //case MI_DELUXO:
- //case MI_BURRITO:
- //case MI_SPAND:
+ case MI_DELUXO:
+ case MI_BURRITO:
+ case MI_SPAND:
case MI_MARQUIS:
case MI_BAGGAGE:
- //case MI_KAUFMAN:
+ case MI_KAUFMAN:
case MI_MAVERICK:
case MI_VCNMAV:
- //case MI_RANCHER:
+ case MI_RANCHER:
case MI_FBIRANCH:
case MI_JETMAX:
- //case MI_HOTRING:
+ case MI_HOTRING:
case MI_SANDKING:
- //case MI_BLISTAC:
+ case MI_BLISTAC:
case MI_POLMAV:
- //case MI_BOXVILLE:
- //case MI_BENSON:
- //case MI_MESA:
+ 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_HOTRINA:
+ case MI_HOTRINB:
+ case MI_BLOODRA:
+ case MI_BLOODRB:
case MI_VICECHEE:
+ case MI_CABBIE:
+ case MI_MAFIA:
model = -1;
break;
case MI_IDAHO:
@@ -1884,23 +1909,22 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_MOONBEAM:
case MI_ESPERANT:
case MI_TAXI:
- //case MI_WASHING:
+ case MI_WASHING:
case MI_BOBCAT:
case MI_BANSHEE:
- //case MI_CABBIE:
case MI_STALLION:
case MI_RUMPO:
- //case MI_ADMIRAL:
+ case MI_ADMIRAL:
case MI_PCJ600:
case MI_FAGGIO:
case MI_FREEWAY:
- //case MI_GLENDALE:
- //case MI_OCEANIC:
+ case MI_GLENDALE:
+ case MI_OCEANIC:
case MI_SANCHEZ:
- //case MI_SABRE:
- //case MI_REGINA:
- //case MI_VIRGO:
- //case MI_GREENWOO:
+ 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]);
@@ -1973,7 +1997,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
#else
CTimer::Stop();
#endif
- CStreaming::LoadScene(pos);
+ CStreaming::LoadSceneCollision(pos);
#ifdef FIX_BUGS
CTimer::Suspend();
#else
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index 75e33e36..45952497 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -2476,7 +2476,7 @@ void CTheScripts::HighlightImportantArea(uint32 id, float x1, float y1, float x2
center.x = (infX + supX) / 2;
center.y = (infY + supY) / 2;
center.z = (z <= MAP_Z_LOW_LIMIT) ? CWorld::FindGroundZForCoord(center.x, center.y) : z;
- CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, &center, supX - center.x, 0.0f, 0.0f, center.y - supY, 0);
+ CShadows::RenderIndicatorShadow(id, 2, nil, &center, supX - center.x, 0.0f, 0.0f, center.y - supY, 0);
}
void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float z)
@@ -2670,7 +2670,10 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
}
else {
pPed->bScriptObjectiveCompleted = false;
- pPed->SetObjective(objective);
+ if (objective == OBJECTIVE_LEAVE_CAR)
+ pPed->SetObjective(objective);
+ else
+ pPed->SetObjective(objective, pPed->m_pMyVehicle);
}
}
}
@@ -2766,7 +2769,7 @@ void CTheScripts::CleanUpThisPed(CPed* pPed)
flees = true;
}
pPed->ClearObjective();
- pPed->SetWaitState(WAITSTATE_FALSE, nil); // third parameter is 0 TODO?
+ pPed->SetWaitState(WAITSTATE_FALSE, nil);
pPed->bRespondsToThreats = true;
pPed->bScriptObjectiveCompleted = false;
pPed->bKindaStayInSamePlace = false;
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 8dcabd30..2dca5be9 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -38,6 +38,7 @@
#include "CarAI.h"
#include "Pickups.h"
#include "Fluff.h"
+#include "CustomSoundTrack.h"
// LCS: file done except TODOs
@@ -109,9 +110,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
- script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
- CAutomobile* pCar = (CAutomobile*)pVehicle;
- pCar->bNotDamagedUpsideDown = (GET_INTEGER_PARAM(1) != 0);
+ //assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ // they call this for bikes again, we don't really want to destroy the structure...
+#ifdef FIX_BUGS
+ if (pVehicle->m_vehType == VEHICLE_TYPE_CAR)
+#endif
+ ((CAutomobile*)pVehicle)->bNotDamagedUpsideDown = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_CAN_PLAYER_START_MISSION:
@@ -400,7 +404,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
if (size <= 0)
size = CTheScripts::LargestMissionScriptSize;
CFileMgr::Seek(gScriptsFile, offset, 0);
- CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO
+ CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size);
CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
@@ -468,8 +472,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
return 0;
case COMMAND_SET_RADIO_CHANNEL:
CollectParameters(&m_nIp, 2);
- // if (base::cSingleton<cCustomSoundTrack>::Instance()->unk()) - TODO on PS2, but it's not on mobile
- DMAudio.SetRadioChannel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
+ if (!cCustomSoundTrack::Instance()->IsPlaying())
+ DMAudio.SetRadioChannel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
/*
case COMMAND_OVERRIDE_HOSPITAL_LEVEL:
@@ -1781,6 +1785,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
StoreParameters(&m_nIp, 1);
return 0;
}
+ /*
case COMMAND_IS_CHAR_IN_ANY_BOAT:
{
CollectParameters(&m_nIp, 1);
@@ -1789,6 +1794,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT);
return 0;
}
+ */
case COMMAND_IS_PLAYER_IN_ANY_BOAT:
{
CollectParameters(&m_nIp, 1);
@@ -1797,6 +1803,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT);
return 0;
}
+ /*
case COMMAND_IS_CHAR_IN_ANY_HELI:
{
CollectParameters(&m_nIp, 1);
@@ -1805,6 +1812,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
return 0;
}
+ */
case COMMAND_IS_PLAYER_IN_ANY_HELI:
{
CollectParameters(&m_nIp, 1);
@@ -1813,6 +1821,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
return 0;
}
+ /*
case COMMAND_IS_CHAR_IN_ANY_PLANE:
{
CollectParameters(&m_nIp, 1);
@@ -1821,6 +1830,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE);
return 0;
}
+ */
case COMMAND_IS_PLAYER_IN_ANY_PLANE:
{
CollectParameters(&m_nIp, 1);
diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp
index ee197783..fb8e69fe 100644
--- a/src/control/Script7.cpp
+++ b/src/control/Script7.cpp
@@ -373,6 +373,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
}
case COMMAND_HAS_PHOTOGRAPH_BEEN_TAKEN:
UpdateCompareFlag(CWeapon::bPhotographHasBeenTaken);
+ CWeapon::bPhotographHasBeenTaken = false;
return 0;
case COMMAND_GET_CHAR_ARMOUR:
{
@@ -508,7 +509,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CTheScripts::ReadTextLabelFromScript(&m_nIp, key);
m_nIp += KEY_LENGTH_IN_SCRIPT;
CStreaming::RemoveAnim(CAnimManager::GetAnimationBlockIndex(key));
- // + empty function on PS2
+ // + empty function on PS2 (not PSP)
return 0;
}
case COMMAND_IS_CHAR_WAITING_FOR_WORLD_COLLISION:
@@ -636,11 +637,8 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
SET_INTEGER_PARAM(1, 0);
else if (GET_INTEGER_PARAM(1) == 3)
SET_INTEGER_PARAM(1, 1);
- pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true);
- }
- else {
- pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true);
}
+ pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true);
return 0;
}
case COMMAND_IS_CHAR_OBJ_NO_OBJ:
@@ -812,7 +810,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
m_nIp += KEY_LENGTH_IN_SCRIPT;
// TheText.Get(key);
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY, PICKUP_PROPERTY_LOCKED, 0, 0, false, key)); // TODO: gpModelIndices
+ SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY, PICKUP_PROPERTY_LOCKED, 0, 0, false, key));
StoreParameters(&m_nIp, 1);
return 0;
}
@@ -825,9 +823,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
char key[KEY_LENGTH_IN_SCRIPT];
CTheScripts::ReadTextLabelFromScript(&m_nIp, key);
m_nIp += KEY_LENGTH_IN_SCRIPT;
- // TheText.Get(key);
+ TheText.Get(key);
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
- SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY_FORSALE, PICKUP_PROPERTY_FORSALE, GET_INTEGER_PARAM(3), 0, false, key)); // TODO: gpModelIndices
+ SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY_FORSALE, PICKUP_PROPERTY_FORSALE, GET_INTEGER_PARAM(3), 0, false, key));
StoreParameters(&m_nIp, 1);
return 0;
}
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 38c28069..3955cacb 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -3,6 +3,7 @@
#include "Script.h"
#include "ScriptCommands.h"
+#include "Bike.h"
#include "DMAudio.h"
#ifdef MORE_LANGUAGES
#include "Frontend.h"
@@ -378,10 +379,20 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
- if (pVehicle->m_bombType != CARBOMB_NONE) {
- pVehicle->m_bombType = CARBOMB_NONE;
- pVehicle->m_pBombRigger = nil;
+ if (pVehicle->IsCar()) {
+ if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) {
+ ((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE;
+ ((CAutomobile*)pVehicle)->m_pBombRigger = nil;
+ }
}
+#ifdef FIX_BUGS
+ else if (pVehicle->IsBike()) {
+ if (((CBike*)pVehicle)->m_bombType != CARBOMB_NONE) {
+ ((CBike*)pVehicle)->m_bombType = CARBOMB_NONE;
+ ((CBike*)pVehicle)->m_pBombRigger = nil;
+ }
+ }
+#endif
return 0;
}
case COMMAND_IS_JAPANESE_GAME:
@@ -596,7 +607,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
}
case COMMAND_SET_RC_HELI_HEIGHT_LIMIT:
CollectParameters(&m_nIp, 1);
- // CVehicle::rcHeliHeightLimit = GET_FLOAT_PARAM(0); // TODO
+ CVehicle::rcHeliHeightLimit = GET_FLOAT_PARAM(0);
return 0;
case COMMAND_CREATE_SCRIPT_CORONA:
{
@@ -700,7 +711,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
//case COMMAND_1491:
case COMMAND_SET_DEBUG_MENU_ACTIVE:
CollectParameters(&m_nIp, 1);
- // this sets two values on PS2, but not on mobile - TODO?
+ // this sets two values on PS2 and PSP, but not on mobile - TODO?
return 0;
case COMMAND_SET_DRAW_HUD:
CollectParameters(&m_nIp, 1);
diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp
index f5b964ad..875aa96b 100644
--- a/src/control/Script9.cpp
+++ b/src/control/Script9.cpp
@@ -594,13 +594,18 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
// base::cWorldGeom::GetInstance()->StoreBuildingSwap(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3) != 0);
return 0;
case COMMAND_IS_MULTIPLAYER_ACTIVE:
- UpdateCompareFlag(false); // TODO?
+#ifdef GTA_NETWORK
+ UpdateCompareFlag(gIsMultiplayerGame);
+#else
+ UpdateCompareFlag(false);
+#endif
return 0;
case COMMAND_GET_MULTIPLAYER_MODE:
SET_INTEGER_PARAM(0, 0); // TODO
StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_MULTIPLAYER_SCRIPT_DONE:
+ printf("COMMAND_MULTIPLAYER_SCRIPT_DONE\n");
//gbStartingScriptsFromLua = false; TODO?
return 0;
case COMMAND_IS_MULTIPLAYER_SERVER: