summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-16 16:00:40 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-16 16:00:40 +0200
commite3291b0cb14811d9201a5f66f0e8633612ecef7e (patch)
treec90f89b280e9077e2020db8d99ac24265762fad0 /src/control
parentWeapon fixes (diff)
downloadre3-e3291b0cb14811d9201a5f66f0e8633612ecef7e.tar
re3-e3291b0cb14811d9201a5f66f0e8633612ecef7e.tar.gz
re3-e3291b0cb14811d9201a5f66f0e8633612ecef7e.tar.bz2
re3-e3291b0cb14811d9201a5f66f0e8633612ecef7e.tar.lz
re3-e3291b0cb14811d9201a5f66f0e8633612ecef7e.tar.xz
re3-e3291b0cb14811d9201a5f66f0e8633612ecef7e.tar.zst
re3-e3291b0cb14811d9201a5f66f0e8633612ecef7e.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp3
-rw-r--r--src/control/CarCtrl.h18
-rw-r--r--src/control/Replay.cpp18
-rw-r--r--src/control/Replay.h2
-rw-r--r--src/control/Script.cpp19
5 files changed, 42 insertions, 18 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index c1d89884..956bad28 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -889,8 +889,7 @@ CCarCtrl::ChoosePoliceCarModel(void)
int32
CCarCtrl::ChooseGangCarModel(int32 gang)
{
- if (CStreaming::HasModelLoaded(MI_GANG01 + 2 * gang) &&
- CStreaming::HasModelLoaded(MI_GANG01+1 + 2 * gang))
+ if (CGangs::HaveGangModelsLoaded(gang))
return CGangs::GetGangVehicleModel(gang);
return -1;
}
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index 8138266f..e696959c 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -39,19 +39,19 @@ public:
WORKERBOAT,
COPS,
- MAFIA,
- TRIAD,
- DIABLO,
- YAKUZA,
- YARDIE,
- COLOMB,
- NINES,
- GANG8,
+ CUBAN,
+ HAITIAN,
+ STREET,
+ DIAZ,
+ BIKER,
+ SECURITY,
+ PLAYER,
+ GOLFERS,
GANG9,
COPS_BOAT,
FIRST_CAR_RATING = NORMAL,
FIRST_BOAT_RATING = LEISUREBOAT,
- FIRST_GANG_CAR_RATING = MAFIA,
+ FIRST_GANG_CAR_RATING = CUBAN,
NUM_CAR_CLASSES = MOTORBIKE - FIRST_CAR_RATING + 1,
NUM_BOAT_CLASSES = WORKERBOAT - FIRST_BOAT_RATING + 1,
NUM_GANG_CAR_CLASSES = GANG9 - FIRST_GANG_CAR_RATING + 1,
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index abd96112..28b999f8 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -511,8 +511,12 @@ void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayB
}
RetrievePedAnimation(ped, &pp->anim_state);
ped->RemoveWeaponModel(-1);
- if (pp->weapon_model != (uint8)-1)
- ped->AddWeaponModel(pp->weapon_model);
+ if (pp->weapon_model != (uint16)-1) {
+ if (CStreaming::HasModelLoaded(pp->weapon_model))
+ ped->AddWeaponModel(pp->weapon_model);
+ else
+ CStreaming::RequestModel(pp->weapon_model, 0);
+ }
CWorld::Remove(ped);
CWorld::Add(ped);
buffer->m_nOffset += sizeof(tPedUpdatePacket);
@@ -1220,6 +1224,16 @@ void CReplay::RestoreStuffFromMem(void)
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
+ for (int j = 0; j < TOTAL_WEAPON_SLOTS; j++) {
+ int mi1 = CWeaponInfo::GetWeaponInfo(ped->m_weapons[j].m_eWeaponType)->m_nModelId;
+ if (mi1 != -1)
+ CStreaming::RequestModel(mi1, STREAMFLAGS_DEPENDENCY);
+ int mi2 = CWeaponInfo::GetWeaponInfo(ped->m_weapons[j].m_eWeaponType)->m_nModel2Id;
+ if (mi2 != -1)
+ CStreaming::RequestModel(mi2, STREAMFLAGS_DEPENDENCY);
+ CStreaming::LoadAllRequestedModels(false);
+ ped->m_weapons[j].Initialise(ped->m_weapons[j].m_eWeaponType, ped->m_weapons[j].m_nAmmoTotal);
+ }
if (ped->m_wepModelID >= 0)
ped->AddWeaponModel(ped->m_wepModelID);
}
diff --git a/src/control/Replay.h b/src/control/Replay.h
index 09cf601e..b369c13d 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -176,7 +176,7 @@ class CReplay
CStoredAnimationState anim_state;
CCompressedMatrixNotAligned matrix;
int8 assoc_group_id;
- uint8 weapon_model;
+ uint16 weapon_model;
};
VALIDATE_SIZE(tPedUpdatePacket, 40);
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index cd0ea5b3..f496ed33 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -4723,8 +4723,6 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
float supX = *(float*)&ScriptParams[5];
float supY = *(float*)&ScriptParams[6];
float supZ = *(float*)&ScriptParams[7];
-
- // TODO(MIAMI): new 2 parameters, requires CGarage change
ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, (eGarageType)ScriptParams[8], 0);
StoreParameters(&m_nIp, 1);
return 0;
@@ -4740,7 +4738,6 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
float supX = *(float*)&ScriptParams[5];
float supY = *(float*)&ScriptParams[6];
float supZ = *(float*)&ScriptParams[7];
- // TODO(MIAMI): new 2 parameters, requires CGarage change
ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, (eGarageType)ScriptParams[8], ScriptParams[9]);
StoreParameters(&m_nIp, 1);
return 0;
@@ -5010,7 +5007,10 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
//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_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]);
@@ -10087,7 +10087,14 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
case COMMAND_ENSURE_PLAYER_HAS_DRIVE_BY_WEAPON:
case COMMAND_MAKE_HELI_COME_CRASHING_DOWN:
case COMMAND_ADD_EXPLOSION_NO_SOUND:
+ assert(0);
case COMMAND_SET_OBJECT_AREA_VISIBLE:
+ {
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ assert(pObject);
+ pObject->m_area = ScriptParams[1];
+ return 0;
+ }
case COMMAND_WAS_VEHICLE_EVER_POLICE:
case COMMAND_SET_CHAR_NEVER_TARGETTED:
case COMMAND_LOAD_UNCOMPRESSED_ANIM:
@@ -10156,7 +10163,11 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_AREA:
case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_ZONE:
case COMMAND_UNLOCK_ALL_CAR_DOORS_IN_AREA:
+ assert(0);
case COMMAND_SET_GANG_ATTACK_PLAYER_WITH_COPS:
+ CollectParameters(&m_nIp, 2);
+ CGangs::SetWillAttackPlayerWithCops((ePedType)((int)PEDTYPE_GANG1 + ScriptParams[0]), !!ScriptParams[1]);
+ return 0;
case COMMAND_SET_CHAR_FRIGHTENED_IN_JACKED_CAR:
case COMMAND_SET_VEHICLE_TO_FADE_IN:
case COMMAND_REGISTER_ODDJOB_MISSION_PASSED: