1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-27 18:25:28 +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;
#ifdef FREE_CAM
bool CCamera::bFreeCam = true;
bool CCamera::bFreeCam = false;
int nPreviousMode = -1;
#endif
@ -280,12 +280,12 @@ CCam::Process(void)
if(DirectionWasLooking != LOOKING_BEHIND)
TheCamera.m_bJust_Switched = true;
DirectionWasLooking = LOOKING_BEHIND;
}else if(CPad::GetPad(0)->GetLookLeft()){
}else if(!((CVehicle*)CamTargetEntity)->IsRealHeli() && CPad::GetPad(0)->GetLookLeft()){
LookLeft();
if(DirectionWasLooking != LOOKING_LEFT)
TheCamera.m_bJust_Switched = true;
DirectionWasLooking = LOOKING_LEFT;
}else if(CPad::GetPad(0)->GetLookRight()){
}else if(!((CVehicle*)CamTargetEntity)->IsRealHeli() && CPad::GetPad(0)->GetLookRight()){
LookRight();
if(DirectionWasLooking != LOOKING_RIGHT)
TheCamera.m_bJust_Switched = true;

View file

@ -323,7 +323,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); });
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 Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });

View file

@ -16,6 +16,7 @@
#include "Train.h"
#include "Plane.h"
#include "Heli.h"
#include "Bike.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
@ -82,9 +83,13 @@ RwObjectNameIdAssocation carIds[] = {
};
RwObjectNameIdAssocation boatIds[] = {
{ "boat_moving_hi", BOAT_MOVING, VEHICLE_FLAG_COLLAPSE },
{ "boat_rudder_hi", BOAT_RUDDER, VEHICLE_FLAG_COLLAPSE },
{ "windscreen", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE },
{ "boat_moving_hi", BOAT_MOVING, 0 },
{ "boat_rudder_hi", BOAT_RUDDER, 0 },
{ "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 },
{ nil, 0, 0 }
};
@ -112,8 +117,8 @@ RwObjectNameIdAssocation heliIds[] = {
};
RwObjectNameIdAssocation planeIds[] = {
{ "wheel_front_dummy", 2, 0 },
{ "wheel_rear_dummy", 3, 0 },
{ "wheel_front_dummy", PLANE_WHEEL_FRONT, 0 },
{ "wheel_rear_dummy", PLANE_WHEEL_READ, 0 },
{ "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_right", PLANE_POS_LIGHT_RIGHT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
@ -121,16 +126,18 @@ RwObjectNameIdAssocation planeIds[] = {
};
RwObjectNameIdAssocation bikeIds[] = {
{ "chassis_dummy", 1, 0 },
{ "forks_front", 2, 0 },
{ "forks_rear", 3, 0 },
{ "wheel_front", 4, 0 },
{ "wheel_rear", 5, 0 },
{ "mudguard", 6, 0 },
{ "ped_frontseat", 2, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "headlights", 0, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "taillights", 1, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "exhaust", 9, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "chassis_dummy", BIKE_CHASSIS, 0 },
{ "forks_front", BIKE_FORKS_FRONT, 0 },
{ "forks_rear", BIKE_FORKS_REAR, 0 },
{ "wheel_front", BIKE_WHEEL_FRONT, 0 },
{ "wheel_rear", BIKE_WHEEL_REAR, 0 },
{ "mudguard", BIKE_MUDGUARD, 0 },
{ "handlebars", BIKE_HANDLEBARS, 0 },
{ "ped_frontseat", BIKE_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "ped_backseat", BIKE_POS_BACKSEAT, 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 },
{ "extra2", 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]));
mat1.GetPosition() += CVector(mat2.GetPosition().x + 0.1f, 0.0f, mat2.GetPosition().z);
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_RF]), 0);
RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LB]), 0);
@ -672,9 +672,7 @@ CAutomobile::ProcessControl(void)
acceleration /= m_fForceMultiplier;
// unused
if(GetModelIndex() == MI_RCBARON ||
GetModelIndex() == MI_RCRAIDER ||
GetModelIndex() == MI_SPARROW)
if(GetModelIndex() == MI_RCBARON || IsRealHeli())
acceleration = 0.0f;
brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep();
@ -1023,18 +1021,18 @@ CAutomobile::ProcessControl(void)
FlyingControl(FLIGHT_MODEL_DODO);
}else if(GetModelIndex() == MI_RCBARON){
FlyingControl(FLIGHT_MODEL_RCPLANE);
}else if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_SPARROW || bAllCarCheat){
}else if(IsRealHeli() || bAllCarCheat){
#ifdef ALLCARSHELI_CHEAT
if (bAllCarCheat)
FlyingControl(FLIGHT_MODEL_HELI);
else
#endif
{
if (CPad::GetPad(0)->GetCircleJustDown())
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0] - 0.03f, 0.0f);
if (m_aWheelSpeed[0] < 0.22f)
m_aWheelSpeed[0] += 0.0001f;
if (m_aWheelSpeed[0] > 0.15f)
// if (CPad::GetPad(0)->GetCircleJustDown())
// m_aWheelSpeed[0] = Max(m_aWheelSpeed[0] - 0.03f, 0.0f);
// if (m_aWheelSpeed[0] < 0.22f)
// m_aWheelSpeed[0] += 0.0001f;
// if (m_aWheelSpeed[0] > 0.15f)
FlyingControl(FLIGHT_MODEL_HELI);
}
}

View file

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

View file

@ -1,7 +1,5 @@
#pragma once
// some miami bike leftovers
enum eBikeNodes {
BIKE_NODE_NONE,
BIKE_CHASSIS,
@ -12,4 +10,13 @@ enum eBikeNodes {
BIKE_MUDGUARD,
BIKE_HANDLEBARS,
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
{
BOAT_MOVING = 1,
BOAT_WINDSCREEN,
BOAT_RUDDER,
BOAT_WINDSCREEN
BOAT_FLAP_LEFT,
BOAT_FLAP_RIGHT,
BOAT_REARFLAP_LEFT,
BOAT_REARFLAP_RIGHT
};
class CBoat : public CVehicle

View file

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

View file

@ -423,17 +423,16 @@ CVehicle::FlyingControl(eFlightModel flightModel)
}
else {
fPitch = CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
fRoll = CPad::GetPad(0)->GetLookLeft();
if (CPad::GetPad(0)->GetLookRight())
fRoll = -1.0f;
fYaw = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
fYaw = CPad::GetPad(0)->GetLookRight();
if (CPad::GetPad(0)->GetLookLeft())
fYaw = -1.0f;
fRoll = -CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
}
if (CPad::GetPad(0)->GetHorn()) {
fYaw = 0.0f;
fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -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(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());

View file

@ -5,6 +5,7 @@
#include "ModelIndices.h"
#include "AnimManager.h"
#include "Weapon.h"
#include "HandlingMgr.h"
class CPed;
class CFire;
@ -294,6 +295,7 @@ public:
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
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); }
static bool bWheelsOnlyCheat;