summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-07 15:59:40 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-07 15:59:40 +0200
commit5780b4503eb7172a1beee05de9513374306c26ec (patch)
tree71503475e494e238d9fcb725a23f8f75e8150ea7 /src/control
parentcar control and friends (diff)
parentMerge branch 'miami' of github.com:GTAmodding/re3 into miami (diff)
downloadre3-5780b4503eb7172a1beee05de9513374306c26ec.tar
re3-5780b4503eb7172a1beee05de9513374306c26ec.tar.gz
re3-5780b4503eb7172a1beee05de9513374306c26ec.tar.bz2
re3-5780b4503eb7172a1beee05de9513374306c26ec.tar.lz
re3-5780b4503eb7172a1beee05de9513374306c26ec.tar.xz
re3-5780b4503eb7172a1beee05de9513374306c26ec.tar.zst
re3-5780b4503eb7172a1beee05de9513374306c26ec.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp32
-rw-r--r--src/control/CarCtrl.h11
-rw-r--r--src/control/Garages.cpp11
-rw-r--r--src/control/Replay.cpp3
-rw-r--r--src/control/RoadBlocks.cpp10
-rw-r--r--src/control/Script.cpp39
6 files changed, 61 insertions, 45 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 6818cd19..e8bc977c 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -329,9 +329,14 @@ CCarCtrl::GenerateOneRandomCar()
case RICH:
case EXEC:
case WORKER:
- case SPECIAL:
case BIG:
case TAXI:
+ // TODO(MIAMI): check this
+ case MOPED:
+ case MOTORBIKE:
+ case LEISUREBOAT:
+ case WORKERBOAT:
+ //
case MAFIA:
case TRIAD:
case DIABLO:
@@ -522,7 +527,12 @@ CCarCtrl::GenerateOneRandomCar()
case RICH:
case EXEC:
case WORKER:
- case SPECIAL:
+ // TODO(MIAMI): check this
+ case MOPED:
+ case MOTORBIKE:
+ case LEISUREBOAT:
+ case WORKERBOAT:
+ //
case BIG:
case TAXI:
case MAFIA:
@@ -602,16 +612,17 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) {
int32 model = -1;
while (model == -1 || !CStreaming::HasModelLoaded(model)){
int rnd = CGeneral::GetRandomNumberInRange(0, 1000);
+ // TODO(MIAMI): new car classes
if (rnd < pZone->carThreshold[0])
- model = CCarCtrl::ChooseCarModel((*pClass = POOR));
+ model = CCarCtrl::ChooseCarModel((*pClass = NORMAL));
else if (rnd < pZone->carThreshold[1])
- model = CCarCtrl::ChooseCarModel((*pClass = RICH));
+ model = CCarCtrl::ChooseCarModel((*pClass = POOR));
else if (rnd < pZone->carThreshold[2])
- model = CCarCtrl::ChooseCarModel((*pClass = EXEC));
+ model = CCarCtrl::ChooseCarModel((*pClass = RICH));
else if (rnd < pZone->carThreshold[3])
- model = CCarCtrl::ChooseCarModel((*pClass = WORKER));
+ model = CCarCtrl::ChooseCarModel((*pClass = EXEC));
else if (rnd < pZone->carThreshold[4])
- model = CCarCtrl::ChooseCarModel((*pClass = SPECIAL));
+ model = CCarCtrl::ChooseCarModel((*pClass = WORKER));
else if (rnd < pZone->carThreshold[5])
model = CCarCtrl::ChooseCarModel((*pClass = BIG));
else if (rnd < pZone->copThreshold)
@@ -649,7 +660,12 @@ CCarCtrl::ChooseCarModel(int32 vehclass)
case RICH:
case EXEC:
case WORKER:
- case SPECIAL:
+ // TODO(MIAMI): check this
+ case MOPED:
+ case MOTORBIKE:
+ case LEISUREBOAT:
+ case WORKERBOAT:
+ //
case BIG:
case TAXI:
{
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index 53ada8ca..1ef2fed7 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -23,14 +23,19 @@ enum{
class CCarCtrl
{
+public:
enum eCarClass {
- POOR = 0,
+ NORMAL = 0,
+ POOR,
RICH,
EXEC,
WORKER,
- SPECIAL,
BIG,
TAXI,
+ MOPED,
+ MOTORBIKE,
+ LEISUREBOAT,
+ WORKERBOAT,
TOTAL_CUSTOM_CLASSES,
MAFIA,
TRIAD,
@@ -53,7 +58,7 @@ class CCarCtrl
CLASS20,
COPS_BOAT
};
-public:
+
static void SwitchVehicleToRealPhysics(CVehicle*);
static void AddToCarArray(int32 id, int32 vehclass);
static void UpdateCarCount(CVehicle*, bool);
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 249b91ef..1b670dbe 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -106,8 +106,9 @@
const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLLECTCARS_CARS] =
{
- { MI_SECURICA, MI_MOONBEAM, MI_COACH, MI_FLATBED, MI_LINERUN, MI_TRASH, MI_PATRIOT, MI_MRWHOOP, MI_BLISTA, MI_MULE, MI_YANKEE, MI_BOBCAT, MI_DODO, MI_BUS, MI_RUMPO, MI_PONY },
- { MI_SENTINEL, MI_CHEETAH, MI_BANSHEE, MI_IDAHO, MI_INFERNUS, MI_TAXI, MI_KURUMA, MI_STRETCH, MI_PEREN, MI_STINGER, MI_MANANA, MI_LANDSTAL, MI_STALLION, MI_BFINJECT, MI_CABBIE, MI_ESPERANT },
+ // TODO(MIAMI): bogus
+ { MI_SECURICA, MI_MOONBEAM, MI_COACH, MI_FLATBED, MI_LINERUN, MI_TRASH, MI_PATRIOT, MI_MRWHOOP, MI_BLISTAC, MI_MULE, MI_YANKEE, MI_BOBCAT, MI_DODO, MI_BUS, MI_RUMPO, MI_PONY },
+ { MI_SENTINEL, MI_CHEETAH, MI_BANSHEE, MI_IDAHO, MI_INFERNUS, MI_TAXI, MI_WASHING, MI_STRETCH, MI_PEREN, MI_STINGER, MI_MANANA, MI_LANDSTAL, MI_STALLION, MI_BFINJECT, MI_CABBIE, MI_ESPERANT },
{ MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }
};
@@ -1612,8 +1613,6 @@ bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id)
bool CGarage::DoesCraigNeedThisCar(int32 mi)
{
- if (mi == MI_CORPSE)
- mi = MI_MANANA;
int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType);
for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) {
if (mi == gaCarsToCollectInCraigsGarages[ct][i])
@@ -1624,8 +1623,6 @@ bool CGarage::DoesCraigNeedThisCar(int32 mi)
bool CGarage::HasCraigCollectedThisCar(int32 mi)
{
- if (mi == MI_CORPSE)
- mi = MI_MANANA;
int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType);
for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) {
if (mi == gaCarsToCollectInCraigsGarages[ct][i])
@@ -1636,8 +1633,6 @@ bool CGarage::HasCraigCollectedThisCar(int32 mi)
bool CGarage::MarkThisCarAsCollectedForCraig(int32 mi)
{
- if (mi == MI_CORPSE)
- mi = MI_MANANA;
int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType);
int index;
for (index = 0; index < TOTAL_COLLECTCARS_CARS; index++) {
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 707f1d87..92cadab7 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -835,13 +835,14 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
CStreaming::RequestModel(mi, 0);
}
else {
+// TODO(MIAMI): don't hardcode model indices
if (mi == MI_DEADDODO || mi == MI_AIRTRAIN) {
new_v = new(vp->index << 8) CPlane(mi, 2);
}
else if (mi == MI_TRAIN) {
new_v = new(vp->index << 8) CTrain(mi, 2);
}
- else if (mi == MI_CHOPPER || mi == MI_ESCAPE) {
+ else if (mi == MI_CHOPPER) {
new_v = new(vp->index << 8) CHeli(mi, 2);
}
else if (CModelInfo::IsBoatModel(mi)){
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index 3a271170..0261cd4a 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -82,8 +82,8 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
if (copType == COP_STREET)
pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45);
CPedPlacement::FindZCoorForPed(&posForZ);
- pCopPed->m_matrix.GetPosition() = posForZ;
- CVector vecSavedPos = pCopPed->m_matrix.GetPosition();
+ pCopPed->SetPosition(posForZ);
+ CVector vecSavedPos = pCopPed->GetPosition();
pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI);
pCopPed->m_matrix.GetPosition() += vecSavedPos;
pCopPed->m_bIsDisabledCop = true;
@@ -137,8 +137,8 @@ CRoadBlocks::GenerateRoadBlocks(void)
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
if (radius > 0 && radius < 6) {
- CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->m_matrix.GetPosition();
- float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->m_matrix.GetUp());
+ CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition();
+ float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward());
float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
for (int16 i = 0; i < radius; i++) {
uint8 nRoadblockType = fDotProduct < 0.0f;
@@ -178,7 +178,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
pVehicle->bExtendedRange = true;
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
pVehicle->m_bSirenOrAlarm = true;
- if (pVehicle->m_matrix.GetForward().z > 0.94f) {
+ if (pVehicle->GetForward().z > 0.94f) {
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
CWorld::Add(pVehicle);
pVehicle->bCreateRoadBlockPeds = true;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 0c3806a3..58222317 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -5346,8 +5346,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
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:
@@ -8159,7 +8158,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_FBICAR:
case MI_MRWHOOP:
case MI_BFINJECT:
- case MI_CORPSE:
+ // case MI_CORPSE:
case MI_POLICE:
case MI_ENFORCER:
case MI_SECURICA:
@@ -8172,27 +8171,27 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_DODO:
case MI_COACH:
case MI_RCBANDIT:
- case MI_BELLYUP:
- case MI_MRWONGS:
- case MI_MAFIA:
- case MI_YARDIE:
- case MI_YAKUZA:
- case MI_DIABLOS:
- case MI_COLUMB:
- case MI_HOODS:
+ // case MI_BELLYUP:
+ // case MI_MRWONGS:
+ // case MI_MAFIA:
+ case MI_VOODOO:
+ // case MI_YAKUZA:
+ // case MI_DIABLOS:
+ // case MI_COLUMB:
+ // case MI_HOODS:
case MI_AIRTRAIN:
case MI_DEADDODO:
case MI_SPEEDER:
case MI_REEFER:
- case MI_PANLANT:
+ // case MI_PANLANT:
case MI_FLATBED:
case MI_YANKEE:
- case MI_ESCAPE:
- case MI_BORGNINE:
- case MI_TOYZ:
- case MI_GHOST:
- case MI_MIAMI_RCBARON:
- case MI_MIAMI_RCRAIDER:
+ // case MI_ESCAPE:
+ case MI_ZEBRA:
+ case MI_TOPFUN:
+ // case MI_GHOST:
+ case MI_RCBARON:
+ case MI_RCRAIDER:
model = -1;
break;
case MI_IDAHO:
@@ -8202,13 +8201,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_PATRIOT:
case MI_MANANA:
case MI_INFERNUS:
- case MI_BLISTA:
+ // case MI_BLISTA:
case MI_PONY:
case MI_CHEETAH:
case MI_MOONBEAM:
case MI_ESPERANT:
case MI_TAXI:
- case MI_KURUMA:
+ case MI_WASHING:
case MI_BOBCAT:
case MI_BANSHEE:
case MI_CABBIE: