summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-08-29 19:32:22 +0300
committerNikolay Korolev <nickvnuk@gmail.com>2021-08-29 19:32:22 +0300
commit453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd (patch)
treeb1586ab27437633e49c795c2e1277f6ca4877cfa
parente865e65955838f3a5901c737263177797c6eebfa (diff)
script revision p1
-rw-r--r--src/audio/AudioLogic.cpp4
-rw-r--r--src/audio/PolRadio.cpp2
-rw-r--r--src/control/Garages.cpp34
-rw-r--r--src/control/Script.cpp68
-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.cpp16
-rw-r--r--src/control/Script8.cpp22
-rw-r--r--src/core/Streaming.cpp25
-rw-r--r--src/core/Streaming.h2
-rw-r--r--src/core/World.cpp38
-rw-r--r--src/core/config.h2
-rw-r--r--src/leeds/CustomSoundTrack.cpp11
-rw-r--r--src/leeds/CustomSoundTrack.h20
-rw-r--r--src/leeds/base/singletonManager.cpp36
-rw-r--r--src/leeds/base/singletonManager.h60
-rw-r--r--src/modelinfo/ModelIndices.h33
-rw-r--r--src/peds/Ped.h16
-rw-r--r--src/vehicles/Automobile.cpp34
-rw-r--r--src/vehicles/Automobile.h6
-rw-r--r--src/vehicles/Bike.cpp34
-rw-r--r--src/vehicles/Bike.h5
-rw-r--r--src/vehicles/Vehicle.cpp39
-rw-r--r--src/vehicles/Vehicle.h11
25 files changed, 462 insertions, 226 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index aa69a949..9ca9599d 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -2879,10 +2879,10 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params)
if (params.m_pVehicle->bEngineOn) {
switch (params.m_VehicleType) {
case VEHICLE_TYPE_CAR:
- bombType = params.m_pVehicle->m_bombType;
+ bombType = ((CAutomobile*)params.m_pVehicle)->m_bombType;
break;
case VEHICLE_TYPE_BIKE:
- bombType = params.m_pVehicle->m_bombType;
+ bombType = ((CBike*)params.m_pVehicle)->m_bombType;
break;
default:
debug("\n * AUDIOLOG: ProcessCarBombTick() Unsupported vehicle type %d * \n", params.m_VehicleType);
diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp
index d557cdab..467060fa 100644
--- a/src/audio/PolRadio.cpp
+++ b/src/audio/PolRadio.cpp
@@ -600,7 +600,7 @@ cAudioManager::SetupSuspectLastSeenReport()
case MI_COACH:
sample = SFX_SFX_POLICE_RADIO_COACH;
break;
- case MI_ROMERO:
+ case MI_HEARSE:
sample = SFX_SFX_POLICE_RADIO_HEARSE;
break;
case MI_PIZZABOY:
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/Script.cpp b/src/control/Script.cpp
index 59af9ff2..26d9d380 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;
@@ -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/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..94378cc0 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:
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 38c28069..c4f80e79 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,25 @@ 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;
+#ifdef FIX_BUGS
+ if (pVehicle->IsCar()) {
+ if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) {
+ ((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE;
+ ((CAutomobile*)pVehicle)->m_pBombRigger = nil;
+ }
+ }
+ else if (pVehicle->IsBike()) {
+ if (((CBike*)pVehicle)->m_bombType != CARBOMB_NONE) {
+ ((CBike*)pVehicle)->m_bombType = CARBOMB_NONE;
+ ((CBike*)pVehicle)->m_pBombRigger = nil;
+ }
+ }
+#else
+ if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) {
+ ((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE;
+ ((CAutomobile*)pVehicle)->m_pBombRigger = nil;
}
+#endif
return 0;
}
case COMMAND_IS_JAPANESE_GAME:
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index f62ff179..9b8f4a66 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1084,6 +1084,12 @@ CStreaming::SetMissionDoesntRequireSpecialChar(int32 id)
}
void
+CStreaming::SetAmbientMissionDoesntRequireSpecialChar(int32 id)
+{
+ return SetAmbientMissionDoesntRequireModel(id + MI_SPECIAL01);
+}
+
+void
CStreaming::DecrementRef(int32 id)
{
ms_numModelsRequested--;
@@ -1625,9 +1631,11 @@ CStreaming::SetModelTxdIsDeletable(int32 id)
void
CStreaming::SetMissionDoesntRequireModel(int32 id)
{
+ if (ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED)
+ printf("SETTING MISSION DOESN'T REQUIRE MODEL %i\n", id);
ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_SCRIPTOWNED;
if ((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) &&
- (ms_aInfoForModel[id].m_flags & STREAMFLAGS_DONT_REMOVE) == 0){
+ (ms_aInfoForModel[id].m_flags & (STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_AMBIENT_SCRIPT_OWNED)) == 0){
if(ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED)
RemoveModel(id);
else if(ms_aInfoForModel[id].m_next == nil)
@@ -1636,6 +1644,21 @@ CStreaming::SetMissionDoesntRequireModel(int32 id)
}
void
+CStreaming::SetAmbientMissionDoesntRequireModel(int32 id)
+{
+ if (ms_aInfoForModel[id].m_flags & STREAMFLAGS_AMBIENT_SCRIPT_OWNED)
+ printf("SETTING AMBIENT MISSION DOESN'T REQUIRE MODEL %i\n", id);
+ ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_AMBIENT_SCRIPT_OWNED;
+ if ((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) &&
+ (ms_aInfoForModel[id].m_flags & (STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED)) == 0) {
+ if (ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED)
+ RemoveModel(id);
+ else if (ms_aInfoForModel[id].m_next == nil)
+ ms_aInfoForModel[id].AddToList(&ms_startLoadedList);
+ }
+}
+
+void
CStreaming::LoadInitialPeds(void)
{
RequestModel(MI_COP, STREAMFLAGS_DONT_REMOVE);
diff --git a/src/core/Streaming.h b/src/core/Streaming.h
index b4a634fa..a5a5a4ab 100644
--- a/src/core/Streaming.h
+++ b/src/core/Streaming.h
@@ -151,6 +151,7 @@ public:
static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags);
static bool HasSpecialCharLoaded(int32 id);
static void SetMissionDoesntRequireSpecialChar(int32 id);
+ static void SetAmbientMissionDoesntRequireSpecialChar(int32 id);
static void DecrementRef(int32 id);
static void RemoveModel(int32 id);
static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); }
@@ -175,6 +176,7 @@ public:
static void SetModelIsDeletable(int32 id);
static void SetModelTxdIsDeletable(int32 id);
static void SetMissionDoesntRequireModel(int32 id);
+ static void SetAmbientMissionDoesntRequireModel(int32 id);
static void LoadInitialPeds(void);
static void LoadInitialWeapons(void);
static void LoadInitialVehicles(void);
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 2de36383..545c0bde 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -1,4 +1,5 @@
#include "common.h"
+#include "Bike.h"
#include "Camera.h"
#include "CarCtrl.h"
#include "CopPed.h"
@@ -2225,19 +2226,36 @@ CWorld::UseDetonator(CEntity *pEntity)
{
int32 i = CPools::GetVehiclePool()->GetSize();
while(--i >= 0) {
-#ifdef FIX_BUGS
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
-#else
- CAutomobile *pVehicle = (CAutomobile *)CPools::GetVehiclePool()->GetSlot(i);
+#if defined FIX_BUGS || defined BOMBS_ON_BIKES
+ if (pVehicle && pVehicle->IsCar())
#endif
- if(pVehicle && pVehicle->m_bombType == CARBOMB_REMOTE &&
- pVehicle->m_pBombRigger == pEntity) {
- pVehicle->m_bombType = CARBOMB_NONE;
- pVehicle->m_nBombTimer = 500;
- pVehicle->m_pBlowUpEntity = pVehicle->m_pBombRigger;
- if(pVehicle->m_pBlowUpEntity)
- pVehicle->m_pBlowUpEntity->RegisterReference(&pVehicle->m_pBlowUpEntity);
+ {
+ CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetSlot(i);
+ if (pCar && pCar->m_bombType == CARBOMB_REMOTE &&
+ pCar->m_pBombRigger == pEntity) {
+ pCar->m_bombType = CARBOMB_NONE;
+ pCar->m_nBombTimer = 500;
+ pCar->m_pBlowUpEntity = pCar->m_pBombRigger;
+ if (pCar->m_pBlowUpEntity)
+ pCar->m_pBlowUpEntity->RegisterReference(&pCar->m_pBlowUpEntity);
+ }
+ }
+#ifdef BOMBS_ON_BIKES
+ if (pVehicle && pVehicle->IsBike()) {
+ {
+ CBike* pBike = (CBike*)CPools::GetVehiclePool()->GetSlot(i);
+ if (pBike && pBike->m_bombType == CARBOMB_REMOTE &&
+ pBike->m_pBombRigger == pEntity) {
+ pBike->m_bombType = CARBOMB_NONE;
+ pBike->m_nBombTimer = 500;
+ pBike->m_pBlowUpEntity = pBike->m_pBombRigger;
+ if (pBike->m_pBlowUpEntity)
+ pBike->m_pBlowUpEntity->RegisterReference(&pBike->m_pBlowUpEntity);
+ }
+ }
}
+#endif
}
CProjectileInfo::RemoveDetonatorProjectiles();
}
diff --git a/src/core/config.h b/src/core/config.h
index 9049fec0..b20f85ae 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -436,6 +436,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
// Vehicles
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher
#define CPLANE_ROTORS // make the rotors of the NPC police heli rotate
+#define BOMBS_ON_BIKES // allow player to set bombs on bikes
// Pickups
//#define MONEY_MESSAGES
@@ -463,6 +464,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#define ATTACH_RELEASING_SOUNDS_TO_ENTITIES // sounds would follow ped and vehicles coordinates if not being queued otherwise
#define USE_TIME_SCALE_FOR_AUDIO // slow down/speed up sounds according to the speed of the game
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
+#define CUSTOM_SOUND_TRACK // LCS PSP feature - TODO
#ifdef AUDIO_OPUS
#define AUDIO_OAL_USE_OPUS // enable support of opus files
diff --git a/src/leeds/CustomSoundTrack.cpp b/src/leeds/CustomSoundTrack.cpp
new file mode 100644
index 00000000..bcbfb82f
--- /dev/null
+++ b/src/leeds/CustomSoundTrack.cpp
@@ -0,0 +1,11 @@
+#include "common.h"
+
+#include "CustomSoundTrack.h"
+
+// TODO - implement
+
+cCustomSoundTrack* base::cSingleton<cCustomSoundTrack>::mspInstance = nil;
+
+cCustomSoundTrack::cCustomSoundTrack() :
+ m_bIsPlaying(false)
+{}
diff --git a/src/leeds/CustomSoundTrack.h b/src/leeds/CustomSoundTrack.h
new file mode 100644
index 00000000..e7b97fbc
--- /dev/null
+++ b/src/leeds/CustomSoundTrack.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "common.h"
+#include "singletonManager.h"
+
+class cCustomSoundTrack : public base::cSingleton<cCustomSoundTrack>
+{
+public:
+ bool m_bIsPlaying;
+
+ cCustomSoundTrack();
+ bool IsPlaying()
+ {
+#ifdef CUSTOM_SOUND_TRACK
+ return m_bIsPlaying;
+#else
+ return false;
+#endif
+ }
+}; \ No newline at end of file
diff --git a/src/leeds/base/singletonManager.cpp b/src/leeds/base/singletonManager.cpp
new file mode 100644
index 00000000..9ff9f28c
--- /dev/null
+++ b/src/leeds/base/singletonManager.cpp
@@ -0,0 +1,36 @@
+#include "common.h"
+
+#include "singletonManager.h"
+
+namespace base
+{
+
+cSingletonManager& SingletonManager()
+{
+ static cSingletonManager manager;
+ return manager;
+}
+
+cSingletonManager::~cSingletonManager()
+{
+ Purge();
+}
+
+void cSingletonManager::Add(cSingletonBase* node)
+{
+ node->next = head;
+ if (!head)
+ tail = node;
+ head = node;
+}
+
+void cSingletonManager::Purge()
+{
+ for (cSingletonBase* node = tail; node; node = tail) {
+ tail = node->next;
+ delete node;
+ }
+}
+
+
+} \ No newline at end of file
diff --git a/src/leeds/base/singletonManager.h b/src/leeds/base/singletonManager.h
new file mode 100644
index 00000000..833e178b
--- /dev/null
+++ b/src/leeds/base/singletonManager.h
@@ -0,0 +1,60 @@
+#pragma once
+
+#include "common.h"
+
+namespace base
+{
+
+class cSingletonBase
+{
+ friend class cSingletonManager;
+
+ cSingletonBase* next;
+
+public:
+ virtual ~cSingletonBase() {}
+};
+
+template<typename T>
+class cSingleton : public cSingletonBase
+{
+ static T* mspInstance;
+ static void cSingleton<T>::CreateInstance()
+ {
+ mspInstance = new T();
+ SingletonManager().Add(mspInstance);
+ }
+
+public:
+ static T* Instance()
+ {
+ if (!mspInstance)
+ CreateInstance();
+ return mspInstance;
+ }
+
+ ~cSingleton<T>()
+ {
+ mspInstance = nil;
+ }
+};
+
+class cSingletonManager
+{
+ cSingletonBase* head;
+ cSingletonBase* tail;
+
+public:
+ cSingletonManager() :
+ head(nil),
+ tail(nil)
+ {}
+
+ void Add(cSingletonBase*);
+ void Purge();
+ ~cSingletonManager();
+};
+
+cSingletonManager& SingletonManager();
+
+} \ No newline at end of file
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index d24c8549..b3d3ef41 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -1098,46 +1098,55 @@ enum
MI_VOODOO = -984,
MI_FBIRANCH = -982,
MI_SANDKING = -981,
- MI_COMET = -972,
MI_PHEONIX = -973,
+ MI_COMET = -972,
MI_KAUFMAN = -967,
MI_BAGGAGE = -963,
- MI_VICECHEE = -954,
MI_RCBARON = -955,
+ MI_VICECHEE = -954,
// these two are unknown
MI_RIO = -992,
MI_TROPIC = -988,
- // HACK HACK, hopefully temporary
+ // 7 of the following MIs originally are in this set: {-998, -996, -979, -978, -977, -975, -969}
+ MI_WASHING = -3000,
+ MI_ADMIRAL,
+ MI_GLENDALE,
+ MI_OCEANIC,
+ MI_REGINA,
+ MI_SABRE,
+ MI_VIRGO,
+ MI_GREENWOO,
+
+ // 25 of the following MIs originally are in this set:
+ // {-1000, -997, -995, -994, -993, -991, -989, -987, -983, -980, -976, -974, -971, -970, -968, -966, -965, -964, -963, -962, -961, -960, -959, -958, -957, -956}
MI_SQUALO = -2000,
MI_JETMAX,
MI_COASTG,
MI_DINGHY,
MI_SKIMMER,
MI_CUBAN,
- MI_SABRE,
- MI_VIRGO,
MI_RANCHER,
MI_BLISTAC,
- MI_WASHING,
- MI_ADMIRAL,
MI_SABRETUR,
MI_DELUXO,
MI_HOTRING,
- MI_REGINA,
MI_SENTXS,
- MI_GLENDALE,
- MI_OCEANIC,
MI_HERMES,
- MI_GREENWOO,
MI_LOVEFIST,
MI_GANGBUR,
MI_BURRITO,
MI_SPAND,
MI_PACKER,
MI_WALTON,
- MI_ROMERO,
+ MI_BOXVILLE,
+ MI_BENSON,
+ MI_MESA,
+ MI_HOTRINA,
+ MI_HOTRINB,
+ MI_BLOODRA,
+ MI_BLOODRB,
MI_WHEEL_RIM = 237,
MI_WHEEL_OFFROAD,
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 7984b0f8..d1d08c2f 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -550,12 +550,13 @@ public:
uint32 bIsDrowning : 1;
uint32 bDrownsInWater : 1;
uint32 bWaitForLeaderToComeCloser : 1;
- uint32 bHeldHostageInCar : 1; // one flag was added somewhere after this one (TODO: figure out where and which)
+ uint32 bHeldHostageInCar : 1;
+ uint32 b19C_10 : 1;
uint32 bIsPlayerFriend : 1;
uint32 bHeadStuckInCollision : 1;
uint32 bDeadPedInFrontOfCar : 1;
- uint32 bStayInCarOnJack : 1;
+ uint32 bStayInCarOnJack : 1;
uint32 bDontFight : 1;
uint32 bDoomAim : 1;
uint32 bCanBeShotInVehicle : 1;
@@ -563,8 +564,8 @@ public:
uint32 bMakeFleeScream : 1;
uint32 bPushedAlongByCar : 1;
uint32 bRemoveMeWhenIGotIntoCar : 1;
- uint32 bIgnoreThreatsBehindObjects : 1; // one flag was added somewhere before this one (TODO: figure out where and which)
+ uint32 bIgnoreThreatsBehindObjects : 1;
uint32 bNeverEverTargetThisPed : 1;
uint32 bCrouchWhenScared : 1;
uint32 bKnockedOffBike : 1;
@@ -704,7 +705,7 @@ public:
uint32 m_delayedWeaponAmmo;
uint8 m_currentWeapon; // eWeaponType
uint8 m_maxWeaponTypeAllowed; // eWeaponType
- uint8 m_wepSkills;
+ uint8 m_wepSkills; // TODO - missing?
uint8 m_wepAccuracy;
CEntity *m_pPointGunAt;
CVector m_vecHitLastPos;
@@ -1089,8 +1090,13 @@ public:
PedState GetPedState(void) { return m_nPedState; }
void SetPedState(PedState state)
{
- if (GetPedState() == PED_FOLLOW_PATH && state != PED_FOLLOW_PATH)
+ if (GetPedState() == PED_FOLLOW_PATH && state != PED_FOLLOW_PATH) {
+ if (m_followPathTargetEnt) {
+ m_followPathTargetEnt->CleanUpOldReference(&m_followPathTargetEnt);
+ m_followPathTargetEnt = nil;
+ }
ClearFollowPath();
+ }
m_nPedState = state;
}
bool Dead(void) { return m_nPedState == PED_DEAD; }
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 61aa00b2..b0f21af7 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -206,7 +206,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
m_pBombRigger = nil;
m_bombType = CARBOMB_NONE;
- bUnknownFlag = false;
+ bDriverLastFrame = false;
if(m_nDoorLock == CARLOCK_UNLOCKED &&
(id == MI_POLICE || id == MI_ENFORCER || id == MI_RHINO))
@@ -344,8 +344,19 @@ CAutomobile::ProcessControl(void)
ScanForCrimes();
}
- // TODO(LCS)? re-inline this and change where bDriverLastFrame is set
- ActivateBombWhenEntered();
+ if (pDriver) {
+ if (!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE) {
+ // If someone enters the car and there is a bomb, detonate
+ m_nBombTimer = 1000;
+ m_pBlowUpEntity = m_pBombRigger;
+ if (m_pBlowUpEntity)
+ m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
+ }
+ bDriverLastFrame = true;
+ }
+ else
+ bDriverLastFrame = false;
// Process driver
if(pDriver){
@@ -939,9 +950,20 @@ CAutomobile::ProcessControl(void)
traction *= 4.0f;
if(FindPlayerVehicle() && FindPlayerVehicle() == this)
- if(CPad::GetPad(0)->CarGunJustDown())
- // TODO(LCS)? re-inline this from CVehicle
- ActivateBomb();
+ if (CPad::GetPad(0)->CarGunJustDown()) {
+ if (m_bombType == CARBOMB_TIMED) {
+ m_bombType = CARBOMB_TIMEDACTIVE;
+ m_nBombTimer = 7000;
+ m_pBlowUpEntity = FindPlayerPed();
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f);
+ }
+ else if (m_bombType == CARBOMB_ONIGNITION) {
+ m_bombType = CARBOMB_ONIGNITIONACTIVE;
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f);
+ }
+ }
if(FindPlayerVehicle() != this && (strongGrip1 || CVehicle::bCheat3)){
traction *= 1.2f;
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index de69d381..f3ee803b 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -35,11 +35,9 @@ public:
float m_aWheelPosition[4];
float m_aWheelSpeed[4];
uint8 m_auto_unused2;
-#if (defined GTA_PS2 && !defined FIX_BUGS)
uint8 m_bombType : 3;
-#endif
uint8 bTaxiLight : 1;
- uint8 bUnknownFlag : 1; // new in LCS
+ uint8 bDriverLastFrame : 1;
uint8 bFixedColour : 1;
uint8 bBigWheels : 1;
uint8 bWaterTight : 1; // no damage for non-player peds
@@ -48,9 +46,7 @@ public:
uint8 bTankDetonateCars : 1;
uint8 bStuckInSand : 1;
uint8 bHeliDestroyed : 1;
-#if (defined GTA_PS2 && !defined FIX_BUGS)
CEntity* m_pBombRigger;
-#endif
int16 m_doingBurnout;
uint16 m_hydraulicState;
uint32 m_nBusDoorTimerEnd;
diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp
index 60530fff..d8ad71ea 100644
--- a/src/vehicles/Bike.cpp
+++ b/src/vehicles/Bike.cpp
@@ -37,6 +37,7 @@
#include "Bike.h"
#include "Debug.h"
#include "SaveBuf.h"
+#include "Garages.h"
const uint32 CBike::nSaveStructSize =
#ifdef COMPATIBLE_SAVES
@@ -232,7 +233,19 @@ CBike::ProcessControl(void)
ProcessCarAlarm();
- ActivateBombWhenEntered();
+ if (pDriver) {
+ if (!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE) {
+ // If someone enters the car and there is a bomb, detonate
+ m_nBombTimer = 1000;
+ m_pBlowUpEntity = m_pBombRigger;
+ if (m_pBlowUpEntity)
+ m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
+ }
+ bDriverLastFrame = true;
+ }
+ else
+ bDriverLastFrame = false;
CRubbish::StirUp(this);
@@ -300,8 +313,23 @@ CBike::ProcessControl(void)
ApplyMoveForce(parallelSpeed * -CTimer::GetTimeStep()*SAND_SLOWDOWN*m_fMass);
}
}
- if(CPad::GetPad(0)->WeaponJustDown())
- ActivateBomb();
+
+#ifdef BOMBS_ON_BIKES
+ if(CPad::GetPad(0)->WeaponJustDown()) {
+ if (m_bombType == CARBOMB_TIMED) {
+ m_bombType = CARBOMB_TIMEDACTIVE;
+ m_nBombTimer = 7000;
+ m_pBlowUpEntity = FindPlayerPed();
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f);
+ }
+ else if (m_bombType == CARBOMB_ONIGNITION) {
+ m_bombType = CARBOMB_ONIGNITIONACTIVE;
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f);
+ }
+ }
+#endif
break;
case STATUS_PLAYER_PLAYBACKFROMBUFFER:
diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h
index 611cd11d..ce89e8c7 100644
--- a/src/vehicles/Bike.h
+++ b/src/vehicles/Bike.h
@@ -67,15 +67,18 @@ public:
float m_fPedLeanAmountUD;
uint8 m_bike_unused2;
uint8 unused[3]; // looks like padding..but for what?
+ uint8 m_bombType : 3;
+ uint8 bDriverLastFrame : 1;
uint8 m_bike_flag01 : 1;
uint8 m_bike_flag02 : 1;
- uint8 bWaterTight : 1;
+ uint8 bWaterTight : 1; // 535_40
uint8 bIsBeingPickedUp : 1;
uint8 bIsStanding : 1;
uint8 bExtraSpeed : 1; // leaning forward
uint8 bIsOnFire : 1;
uint8 bWheelieCam : 1;
uint8 bFixedColour : 1; // <- figure out its actual place (TODO)
+ CEntity* m_pBombRigger;
int16 m_doingBurnout;
float m_fTireTemperature;
float m_fBrakeDestabilization;
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index be4012eb..308a517e 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -159,10 +159,6 @@ CVehicle::CVehicle(uint8 CreatedBy)
bIsBig = false;
bLowVehicle = false;
- m_bombType = CARBOMB_NONE;
- m_pBombRigger = nil;
- bDriverLastFrame = false;
-
m_nSetPieceExtendedRangeTime = 0;
m_nAlarmState = 0;
m_nDoorLock = CARLOCK_UNLOCKED;
@@ -1465,41 +1461,6 @@ CVehicle::FireFixedMachineGuns(void)
}
}
-//LCS: in CAutomobile
-void
-CVehicle::ActivateBomb(void)
-{
- if(m_bombType == CARBOMB_TIMED){
- m_bombType = CARBOMB_TIMEDACTIVE;
- m_nBombTimer = 7000;
- m_pBlowUpEntity = FindPlayerPed();
- CGarages::TriggerMessage("GA_12", -1, 3000, -1);
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f);
- }else if(m_bombType == CARBOMB_ONIGNITION){
- m_bombType = CARBOMB_ONIGNITIONACTIVE;
- CGarages::TriggerMessage("GA_12", -1, 3000, -1);
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f);
- }
-}
-
-//LCS: in CAutomobile and CBike
-void
-CVehicle::ActivateBombWhenEntered(void)
-{
- if(pDriver){
- if(!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE){
- // If someone enters the car and there is a bomb, detonate
- m_nBombTimer = 1000;
- m_pBlowUpEntity = m_pBombRigger;
- if(m_pBlowUpEntity)
- m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
- }
- bDriverLastFrame = true;
- }else
- bDriverLastFrame = false;
-}
-
void
CVehicle::ExtinguishCarFire(void)
{
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index fa2f988c..763bd56e 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -245,10 +245,6 @@ public:
uint8 bRestingOnPhysical : 1; // Dont go static cause car is sitting on a physical object that might get removed
uint8 bParking : 1;
uint8 bCanPark : 1;
-#if (!defined GTA_PS2 || defined FIX_BUGS) // <- I think this can be moved back to CAutomobile?
- uint8 m_bombType : 3;
-#endif
- uint8 bDriverLastFrame : 1; // originally not in CVehicle (TODO - carbomb stuff)
uint8 bRewardVehicle : 1; // 25B_40
int8 m_numPedsUseItAsCover;
@@ -261,9 +257,6 @@ public:
float m_fEngineEnergy; // TODO(LCS): better name. it adds up acceleration force, so possibly kinetic energy??
uint8 m_nCurrentGear;
float m_fChangeGearTime;
-#if (!defined GTA_PS2 || defined FIX_BUGS)
- CEntity* m_pBombRigger;
-#endif
uint32 m_nSetPieceExtendedRangeTime;
uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats)
uint32 m_nTimeOfDeath;
@@ -395,8 +388,6 @@ public:
void InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage, CVector pos = CVector(0.0f, 0.0f, 0.0f));
void DoFixedMachineGuns(void);
void FireFixedMachineGuns(void);
- void ActivateBomb(void);
- void ActivateBombWhenEntered(void);
void KillPedsInVehicle(void);
void SetComponentAtomicAlpha(RpAtomic *atomic, int32 alpha);
@@ -407,7 +398,7 @@ public:
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
- bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; }
+ bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE || GetModelIndex() == MI_KAUFMAN; }
bool IsLimo(void) { return GetModelIndex() == MI_STRETCH; }
bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); }
bool IsRealPlane(void) { return !!(pHandling->Flags & HANDLING_IS_PLANE); }