summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-01-30 18:27:26 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2021-01-30 18:27:26 +0100
commit01d4312251aabca8d37f49f4ae52c8d5183b5436 (patch)
tree9547a00833071e510516ede05b473b6e8f4ae319 /src
parentstuff (diff)
parentfix (diff)
downloadre3-01d4312251aabca8d37f49f4ae52c8d5183b5436.tar
re3-01d4312251aabca8d37f49f4ae52c8d5183b5436.tar.gz
re3-01d4312251aabca8d37f49f4ae52c8d5183b5436.tar.bz2
re3-01d4312251aabca8d37f49f4ae52c8d5183b5436.tar.lz
re3-01d4312251aabca8d37f49f4ae52c8d5183b5436.tar.xz
re3-01d4312251aabca8d37f49f4ae52c8d5183b5436.tar.zst
re3-01d4312251aabca8d37f49f4ae52c8d5183b5436.zip
Diffstat (limited to 'src')
-rw-r--r--src/control/Garages.cpp2
-rw-r--r--src/control/Script.cpp4
-rw-r--r--src/control/Script10.cpp4
-rw-r--r--src/control/Script3.cpp1
-rw-r--r--src/control/Script6.cpp2
-rw-r--r--src/control/Script8.cpp3
-rw-r--r--src/control/Script9.cpp4
-rw-r--r--src/core/World.cpp6
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp20
-rw-r--r--src/modelinfo/VehicleModelInfo.h12
-rw-r--r--src/vehicles/Ferry.h13
11 files changed, 60 insertions, 11 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 7d7d3922..d5b41c6c 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1562,7 +1562,7 @@ bool CGarage::IsAnyOtherCarTouchingGarage(CVehicle * pException)
uint32 i = CPools::GetVehiclePool()->GetSize();
while (i--) {
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
- if (!pVehicle || pVehicle == pException)
+ if (!pVehicle || pVehicle == pException || pVehicle->GetStatus() == STATUS_WRECKED)
continue;
if (!IsEntityTouching3D(pVehicle))
continue;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 1b1b9045..d12bbb40 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1608,7 +1608,7 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_SET_NAVIGATION_ARROW, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_CLEAR_NAVIGATION_ARROW, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_CALL, INPUT_ARGUMENTS(ARGTYPE_FUNCTION, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_CALLNOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CALLNOT, INPUT_ARGUMENTS(ARGTYPE_FUNCTION, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_CAR_AUTOMOBILE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
REGISTER_COMMAND(COMMAND_IS_CAR_BIKE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
REGISTER_COMMAND(COMMAND_IS_CAR_PLANE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
@@ -1649,7 +1649,7 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_SET_DRAW_HUD, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_GET_RANDOM_CHAR_IN_AREA_NO_CHECKS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_GET_RANDOM_CAR_IN_AREA_NO_CHECKS_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_STORE_CAR_COLLIDED_WITH_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_CAR_COLLIDED_WITH_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
REGISTER_COMMAND(COMMAND_DISABLE_FERRY_PATH, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_ENABLE_FERRY_PATH, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_GET_CLOSEST_DOCKED_FERRY, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp
index ba46fcc3..46013887 100644
--- a/src/control/Script10.cpp
+++ b/src/control/Script10.cpp
@@ -224,8 +224,8 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
SET_FLOAT_PARAM(1, LimitAngleOnCircle(RADTODEG(Asin(pObject->GetForward().z))));
- SET_FLOAT_PARAM(2, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pObject->GetForward().x, pObject->GetForward().y))));
- SET_FLOAT_PARAM(0, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pObject->GetUp().z, pObject->GetRight().z))));
+ SET_FLOAT_PARAM(2, LimitAngleOnCircle(RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y))));
+ SET_FLOAT_PARAM(0, LimitAngleOnCircle(RADTODEG(Atan2(-pObject->GetRight().z, pObject->GetUp().z))));
StoreParameters(&m_nIp, 3);
return 0;
}
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index a903d023..64014ac8 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -1718,6 +1718,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS;
pBoat->AutoPilot.m_vecDestinationCoors = pos;
pBoat->SetStatus(STATUS_PHYSICS);
+ pBoat->bEngineOn = true;
pBoat->AutoPilot.m_nCruiseSpeed = Max(1, pBoat->AutoPilot.m_nCruiseSpeed);
pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0;
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index acc84c31..0e1256fd 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -632,7 +632,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
if (GET_INTEGER_PARAM(2) < 0)
pPed->WarpPedIntoCarAsPassenger(pVehicle, GET_INTEGER_PARAM(2));
else {
- script_assert(GET_INTEGER_PARAM(1) >= 0 && GET_INTEGER_PARAM(1) < ARRAY_SIZE(pVehicle->pPassengers));
+ script_assert(GET_INTEGER_PARAM(2) >= 0 && GET_INTEGER_PARAM(2) < ARRAY_SIZE(pVehicle->pPassengers));
pPed->WarpPedIntoCarAsPassenger(pVehicle, GET_INTEGER_PARAM(2));
}
return 0;
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 53e39b68..8a1612fb 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -437,7 +437,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
}
case COMMAND_DOT_PRODUCT_3D:
{
- CollectParameters(&m_nIp, 4);
+ CollectParameters(&m_nIp, 6);
float X1 = GET_FLOAT_PARAM(0);
float Y1 = GET_FLOAT_PARAM(1);
float Z1 = GET_FLOAT_PARAM(2);
@@ -788,6 +788,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
}
}
}
+ StoreParameters(&m_nIp, 1);
return 0;
}
default:
diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp
index 020221c4..3a68e239 100644
--- a/src/control/Script9.cpp
+++ b/src/control/Script9.cpp
@@ -431,8 +431,8 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
SET_FLOAT_PARAM(1, LimitAngleOnCircle(RADTODEG(Asin(pVehicle->GetForward().z))));
- SET_FLOAT_PARAM(2, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pVehicle->GetForward().x, pVehicle->GetForward().y))));
- SET_FLOAT_PARAM(0, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pVehicle->GetUp().z, pVehicle->GetRight().z))));
+ SET_FLOAT_PARAM(2, LimitAngleOnCircle(RADTODEG(Atan2(-pVehicle->GetForward().x, pVehicle->GetForward().y))));
+ SET_FLOAT_PARAM(0, LimitAngleOnCircle(RADTODEG(Atan2(-pVehicle->GetRight().z, pVehicle->GetUp().z))));
StoreParameters(&m_nIp, 3);
return 0;
}
diff --git a/src/core/World.cpp b/src/core/World.cpp
index eccbcd89..da1c58b2 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -2218,8 +2218,12 @@ 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(pVehicle && !pVehicle->m_vehType && pVehicle->m_bombType == CARBOMB_REMOTE &&
+#endif
+ if(pVehicle && pVehicle->m_bombType == CARBOMB_REMOTE &&
pVehicle->m_pBombRigger == pEntity) {
pVehicle->m_bombType = CARBOMB_NONE;
pVehicle->m_nBombTimer = 500;
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index bd3a2154..21583709 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -15,6 +15,7 @@
#include "Automobile.h"
#include "Boat.h"
#include "Train.h"
+#include "Ferry.h"
#include "Plane.h"
#include "Heli.h"
#include "Bike.h"
@@ -122,6 +123,22 @@ RwObjectNameIdAssocation trainIds[] = {
{ nil, 0, 0 }
};
+RwObjectNameIdAssocation ferryIds[] = {
+ { "door_front_dummy", FERRY_DOOR_FRONT, VEHICLE_FLAG_LEFT | VEHICLE_FLAG_COLLAPSE },
+ { "door_back_dummy", FERRY_DOOR_BACK, VEHICLE_FLAG_LEFT | VEHICLE_FLAG_COLLAPSE },
+ { "ramp_front_dummy", FERRY_RAMP_FRONT, VEHICLE_FLAG_LEFT | VEHICLE_FLAG_COLLAPSE },
+ { "ramp_back_dummy", FERRY_RAMP_BACK, VEHICLE_FLAG_LEFT | VEHICLE_FLAG_COLLAPSE },
+ { "light_front", FERRY_POS_LIGHT_FRONT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "light_rear", FERRY_POS_LIGHT_REAR, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "chim_left", FERRY_POS_CHIM_LEFT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "ped_point", FERRY_POS_PED_POINT, VEHICLE_FLAG_DOOR | VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "car1_dummy", FERRY_POS_CAR1, VEHICLE_FLAG_DOOR | VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "car2_dummy", FERRY_POS_CAR2, VEHICLE_FLAG_DOOR | VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "car3_dummy", FERRY_POS_CAR3, VEHICLE_FLAG_DOOR | VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "car4_dummy", FERRY_POS_CAR4, VEHICLE_FLAG_DOOR | VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { nil, 0, 0 }
+};
+
RwObjectNameIdAssocation heliIds[] = {
{ "chassis_dummy", HELI_CHASSIS, VEHICLE_FLAG_COLLAPSE },
{ "toprotor", HELI_TOPROTOR, 0 },
@@ -170,7 +187,8 @@ RwObjectNameIdAssocation *CVehicleModelInfo::ms_vehicleDescs[] = {
trainIds,
heliIds,
planeIds,
- bikeIds
+ bikeIds,
+ ferryIds
};
bool gbBlackCars;
diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h
index f979c2c0..6f2cea3c 100644
--- a/src/modelinfo/VehicleModelInfo.h
+++ b/src/modelinfo/VehicleModelInfo.h
@@ -49,6 +49,18 @@ enum eBoatPositions
BOAT_POS_FRONTSEAT
};
+enum eFerryPositions
+{
+ FERRY_POS_LIGHT_FRONT,
+ FERRY_POS_LIGHT_REAR,
+ FERRY_POS_CHIM_LEFT,
+ FERRY_POS_PED_POINT,
+ FERRY_POS_CAR1,
+ FERRY_POS_CAR2,
+ FERRY_POS_CAR3,
+ FERRY_POS_CAR4
+};
+
enum eTrainPositions
{
TRAIN_POS_LIGHT_FRONT,
diff --git a/src/vehicles/Ferry.h b/src/vehicles/Ferry.h
new file mode 100644
index 00000000..375dfce1
--- /dev/null
+++ b/src/vehicles/Ferry.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "Vehicle.h"
+#include "Door.h"
+
+enum eFerryNodes
+{
+ FERRY_DOOR_FRONT = 1,
+ FERRY_RAMP_FRONT,
+ FERRY_DOOR_BACK,
+ FERRY_RAMP_BACK,
+ NUM_FERRY_NODES
+};