1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-28 18:35:29 +00:00

vehicle model descriptions; a bit of heli code

This commit is contained in:
aap 2020-05-10 20:51:29 +02:00
parent 7919b92d28
commit 9e842f1628
10 changed files with 63 additions and 39 deletions

View file

@ -29,7 +29,7 @@ bool PrintDebugCode = false;
int16 DebugCamMode; int16 DebugCamMode;
#ifdef FREE_CAM #ifdef FREE_CAM
bool CCamera::bFreeCam = true; bool CCamera::bFreeCam = false;
int nPreviousMode = -1; int nPreviousMode = -1;
#endif #endif
@ -280,12 +280,12 @@ CCam::Process(void)
if(DirectionWasLooking != LOOKING_BEHIND) if(DirectionWasLooking != LOOKING_BEHIND)
TheCamera.m_bJust_Switched = true; TheCamera.m_bJust_Switched = true;
DirectionWasLooking = LOOKING_BEHIND; DirectionWasLooking = LOOKING_BEHIND;
}else if(CPad::GetPad(0)->GetLookLeft()){ }else if(!((CVehicle*)CamTargetEntity)->IsRealHeli() && CPad::GetPad(0)->GetLookLeft()){
LookLeft(); LookLeft();
if(DirectionWasLooking != LOOKING_LEFT) if(DirectionWasLooking != LOOKING_LEFT)
TheCamera.m_bJust_Switched = true; TheCamera.m_bJust_Switched = true;
DirectionWasLooking = LOOKING_LEFT; DirectionWasLooking = LOOKING_LEFT;
}else if(CPad::GetPad(0)->GetLookRight()){ }else if(!((CVehicle*)CamTargetEntity)->IsRealHeli() && CPad::GetPad(0)->GetLookRight()){
LookRight(); LookRight();
if(DirectionWasLooking != LOOKING_RIGHT) if(DirectionWasLooking != LOOKING_RIGHT)
TheCamera.m_bJust_Switched = true; TheCamera.m_bJust_Switched = true;

View file

@ -323,7 +323,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); }); DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); }); DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); });
DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); }); DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); });
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); }); DebugMenuAddCmd("Spawn", "Spawn Sparrow", [](){ SpawnCar(MI_SPARROW); });
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); }); DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); }); DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); }); DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });

View file

@ -16,6 +16,7 @@
#include "Train.h" #include "Train.h"
#include "Plane.h" #include "Plane.h"
#include "Heli.h" #include "Heli.h"
#include "Bike.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "ModelInfo.h" #include "ModelInfo.h"
@ -82,9 +83,13 @@ RwObjectNameIdAssocation carIds[] = {
}; };
RwObjectNameIdAssocation boatIds[] = { RwObjectNameIdAssocation boatIds[] = {
{ "boat_moving_hi", BOAT_MOVING, VEHICLE_FLAG_COLLAPSE }, { "boat_moving_hi", BOAT_MOVING, 0 },
{ "boat_rudder_hi", BOAT_RUDDER, VEHICLE_FLAG_COLLAPSE }, { "boat_rudder_hi", BOAT_RUDDER, 0 },
{ "windscreen", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE }, { "boat_flap_left", BOAT_FLAP_LEFT, 0 },
{ "boat_flap_right", BOAT_FLAP_RIGHT, 0 },
{ "boat_rearflap_left", BOAT_REARFLAP_LEFT, 0 },
{ "boat_rearflap_right", BOAT_REARFLAP_RIGHT, 0 },
{ "windscreen_hi_ok", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_DRAWLAST },
{ "ped_frontseat", BOAT_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "ped_frontseat", BOAT_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ nil, 0, 0 } { nil, 0, 0 }
}; };
@ -112,8 +117,8 @@ RwObjectNameIdAssocation heliIds[] = {
}; };
RwObjectNameIdAssocation planeIds[] = { RwObjectNameIdAssocation planeIds[] = {
{ "wheel_front_dummy", 2, 0 }, { "wheel_front_dummy", PLANE_WHEEL_FRONT, 0 },
{ "wheel_rear_dummy", 3, 0 }, { "wheel_rear_dummy", PLANE_WHEEL_READ, 0 },
{ "light_tailplane", PLANE_POS_LIGHT_TAIL, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "light_tailplane", PLANE_POS_LIGHT_TAIL, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "light_left", PLANE_POS_LIGHT_LEFT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "light_left", PLANE_POS_LIGHT_LEFT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "light_right", PLANE_POS_LIGHT_RIGHT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "light_right", PLANE_POS_LIGHT_RIGHT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
@ -121,16 +126,18 @@ RwObjectNameIdAssocation planeIds[] = {
}; };
RwObjectNameIdAssocation bikeIds[] = { RwObjectNameIdAssocation bikeIds[] = {
{ "chassis_dummy", 1, 0 }, { "chassis_dummy", BIKE_CHASSIS, 0 },
{ "forks_front", 2, 0 }, { "forks_front", BIKE_FORKS_FRONT, 0 },
{ "forks_rear", 3, 0 }, { "forks_rear", BIKE_FORKS_REAR, 0 },
{ "wheel_front", 4, 0 }, { "wheel_front", BIKE_WHEEL_FRONT, 0 },
{ "wheel_rear", 5, 0 }, { "wheel_rear", BIKE_WHEEL_REAR, 0 },
{ "mudguard", 6, 0 }, { "mudguard", BIKE_MUDGUARD, 0 },
{ "ped_frontseat", 2, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "handlebars", BIKE_HANDLEBARS, 0 },
{ "headlights", 0, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "ped_frontseat", BIKE_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "taillights", 1, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "ped_backseat", BIKE_POS_BACKSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "exhaust", 9, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "headlights", BIKE_POS_HEADLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "taillights", BIKE_POS_TAILLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "exhaust", BIKE_POS_EXHAUST, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "extra1", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra1", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },
{ "extra2", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra2", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },
{ "extra3", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra3", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },

View file

@ -195,7 +195,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
CMatrix mat2(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF])); CMatrix mat2(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF]));
mat1.GetPosition() += CVector(mat2.GetPosition().x + 0.1f, 0.0f, mat2.GetPosition().z); mat1.GetPosition() += CVector(mat2.GetPosition().x + 0.1f, 0.0f, mat2.GetPosition().z);
mat1.UpdateRW(); mat1.UpdateRW();
}else if(GetModelIndex() == MI_SPARROW || GetModelIndex() == MI_RCRAIDER){ }else if(IsRealHeli()){
RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LF]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LF]), 0);
RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_RF]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_RF]), 0);
RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LB]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LB]), 0);
@ -672,9 +672,7 @@ CAutomobile::ProcessControl(void)
acceleration /= m_fForceMultiplier; acceleration /= m_fForceMultiplier;
// unused // unused
if(GetModelIndex() == MI_RCBARON || if(GetModelIndex() == MI_RCBARON || IsRealHeli())
GetModelIndex() == MI_RCRAIDER ||
GetModelIndex() == MI_SPARROW)
acceleration = 0.0f; acceleration = 0.0f;
brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep(); brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep();
@ -1023,18 +1021,18 @@ CAutomobile::ProcessControl(void)
FlyingControl(FLIGHT_MODEL_DODO); FlyingControl(FLIGHT_MODEL_DODO);
}else if(GetModelIndex() == MI_RCBARON){ }else if(GetModelIndex() == MI_RCBARON){
FlyingControl(FLIGHT_MODEL_RCPLANE); FlyingControl(FLIGHT_MODEL_RCPLANE);
}else if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_SPARROW || bAllCarCheat){ }else if(IsRealHeli() || bAllCarCheat){
#ifdef ALLCARSHELI_CHEAT #ifdef ALLCARSHELI_CHEAT
if (bAllCarCheat) if (bAllCarCheat)
FlyingControl(FLIGHT_MODEL_HELI); FlyingControl(FLIGHT_MODEL_HELI);
else else
#endif #endif
{ {
if (CPad::GetPad(0)->GetCircleJustDown()) // if (CPad::GetPad(0)->GetCircleJustDown())
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0] - 0.03f, 0.0f); // m_aWheelSpeed[0] = Max(m_aWheelSpeed[0] - 0.03f, 0.0f);
if (m_aWheelSpeed[0] < 0.22f) // if (m_aWheelSpeed[0] < 0.22f)
m_aWheelSpeed[0] += 0.0001f; // m_aWheelSpeed[0] += 0.0001f;
if (m_aWheelSpeed[0] > 0.15f) // if (m_aWheelSpeed[0] > 0.15f)
FlyingControl(FLIGHT_MODEL_HELI); FlyingControl(FLIGHT_MODEL_HELI);
} }
} }

View file

@ -36,7 +36,7 @@ enum eCarPositions
CAR_POS_TAILLIGHTS, CAR_POS_TAILLIGHTS,
CAR_POS_FRONTSEAT, CAR_POS_FRONTSEAT,
CAR_POS_BACKSEAT, CAR_POS_BACKSEAT,
CAR_POS_EXHAUST = 9, CAR_POS_EXHAUST
}; };
// These are used for all the wheel arrays // These are used for all the wheel arrays

View file

@ -1,7 +1,5 @@
#pragma once #pragma once
// some miami bike leftovers
enum eBikeNodes { enum eBikeNodes {
BIKE_NODE_NONE, BIKE_NODE_NONE,
BIKE_CHASSIS, BIKE_CHASSIS,
@ -12,4 +10,13 @@ enum eBikeNodes {
BIKE_MUDGUARD, BIKE_MUDGUARD,
BIKE_HANDLEBARS, BIKE_HANDLEBARS,
BIKE_NUM_NODES BIKE_NUM_NODES
}; };
enum eBikePositions
{
BIKE_POS_HEADLIGHTS,
BIKE_POS_TAILLIGHTS,
BIKE_POS_FRONTSEAT,
BIKE_POS_BACKSEAT,
BIKE_POS_EXHAUST
};

View file

@ -5,8 +5,12 @@
enum eBoatNodes enum eBoatNodes
{ {
BOAT_MOVING = 1, BOAT_MOVING = 1,
BOAT_WINDSCREEN,
BOAT_RUDDER, BOAT_RUDDER,
BOAT_WINDSCREEN BOAT_FLAP_LEFT,
BOAT_FLAP_RIGHT,
BOAT_REARFLAP_LEFT,
BOAT_REARFLAP_RIGHT
}; };
class CBoat : public CVehicle class CBoat : public CVehicle

View file

@ -2,6 +2,13 @@
#include "Vehicle.h" #include "Vehicle.h"
enum ePlaneNodes
{
PLANE_WHEEL_FRONT = 2,
PLANE_WHEEL_READ,
NUM_PLANE_NODES
};
enum ePlanePositions enum ePlanePositions
{ {
PLANE_POS_LIGHT_LEFT, PLANE_POS_LIGHT_LEFT,

View file

@ -423,17 +423,16 @@ CVehicle::FlyingControl(eFlightModel flightModel)
} }
else { else {
fPitch = CPad::GetPad(0)->GetSteeringUpDown() / 128.0f; fPitch = CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
fRoll = CPad::GetPad(0)->GetLookLeft(); fYaw = CPad::GetPad(0)->GetLookRight();
if (CPad::GetPad(0)->GetLookRight()) if (CPad::GetPad(0)->GetLookLeft())
fRoll = -1.0f; fYaw = -1.0f;
fYaw = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f; fRoll = -CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
} }
if (CPad::GetPad(0)->GetHorn()) { if (CPad::GetPad(0)->GetHorn()) {
fYaw = 0.0f; fYaw = 0.0f;
fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -200.0f, 1.3f); fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -200.0f, 1.3f);
fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f); fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
} }
debug("fPitch: %f\n", fPitch);
ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward()); ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());

View file

@ -5,6 +5,7 @@
#include "ModelIndices.h" #include "ModelIndices.h"
#include "AnimManager.h" #include "AnimManager.h"
#include "Weapon.h" #include "Weapon.h"
#include "HandlingMgr.h"
class CPed; class CPed;
class CFire; class CFire;
@ -294,6 +295,7 @@ public:
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; } bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; } bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; }
bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); }
AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); } AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); }
static bool bWheelsOnlyCheat; static bool bWheelsOnlyCheat;