Merge branch 'master' into master

This commit is contained in:
Fire_Head
2019-08-15 05:06:52 +03:00
committed by GitHub
64 changed files with 6132 additions and 408 deletions

View File

@ -312,7 +312,7 @@ CAutomobile::ProcessControl(void)
CVisibilityPlugins::SetClumpAlpha((RpClump*)m_rwObject, clumpAlpha);
AutoPilot.m_flag1 = false;
AutoPilot.m_flag2 = false;
AutoPilot.m_bSlowedDownBecauseOfPeds = false;
// Set Center of Mass to make car more stable
if(strongGrip1 || bCheat3)
@ -3930,7 +3930,7 @@ CAutomobile::PlayCarHorn(void)
void
CAutomobile::PlayHornIfNecessary(void)
{
if(AutoPilot.m_flag2 ||
if(AutoPilot.m_bSlowedDownBecauseOfPeds ||
AutoPilot.m_flag1)
if(!HasCarStoppedBecauseOfLight())
PlayCarHorn();

View File

@ -58,6 +58,14 @@ enum eBombType
CARBOMB_ONIGNITIONACTIVE,
};
enum {
CAR_DOOR_FLAG_UNKNOWN = 0x0,
CAR_DOOR_FLAG_LF = 0x1,
CAR_DOOR_FLAG_LR = 0x2,
CAR_DOOR_FLAG_RF = 0x4,
CAR_DOOR_FLAG_RR = 0x8
};
class CAutomobile : public CVehicle
{
public:
@ -189,14 +197,14 @@ static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");
inline uint8 GetCarDoorFlag(int32 carnode) {
switch (carnode) {
case CAR_DOOR_LF:
return 1;
return CAR_DOOR_FLAG_LF;
case CAR_DOOR_LR:
return 2;
return CAR_DOOR_FLAG_LR;
case CAR_DOOR_RF:
return 4;
return CAR_DOOR_FLAG_RF;
case CAR_DOOR_RR:
return 8;
return CAR_DOOR_FLAG_RR;
default:
return 0;
return CAR_DOOR_FLAG_UNKNOWN;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,15 +2,98 @@
#include "Vehicle.h"
class CObject;
enum eHeliNodes
{
HELI_CHASSIS = 1,
HELI_TOPROTOR,
HELI_BACKROTOR,
HELI_TAIL,
HELI_TOPKNOT,
HELI_SKID_LEFT,
HELI_SKID_RIGHT,
NUM_HELI_NODES
};
enum
{
HELI_RANDOM0,
HELI_RANDOM1,
HELI_SCRIPT,
HELI_CATALINA,
NUM_HELIS
};
enum
{
HELI_TYPE_RANDOM,
HELI_TYPE_SCRIPT,
HELI_TYPE_CATALINA,
};
class CHeli : public CVehicle
{
public:
// 0x288
uint8 stuff[180];
RwFrame *m_aHeliNodes[NUM_HELI_NODES];
int8 m_heliStatus;
float m_fSearchLightX;
float m_fSearchLightY;
uint32 m_nExplosionTimer;
float m_fRotation;
float m_fAngularSpeed;
float m_fTargetZ;
float m_fSearchLightIntensity;
int8 m_nHeliId;
int8 m_heliType;
int8 m_pathState;
float m_aSearchLightHistoryX[6];
float m_aSearchLightHistoryY[6];
uint32 m_nSearchLightTimer;
uint32 m_nShootTimer;
uint32 m_nLastShotTime;
uint32 m_nBulletDamage;
float m_fRotorRotation;
float m_fHeliDustZ[8];
uint32 m_nPoliceShoutTimer;
float m_fTargetOffset;
bool m_bTestRight;
CHeli(int, uint8);
static CHeli **pHelis; //[NUM_HELIS]
static int16 &NumRandomHelis;
static uint32 &TestForNewRandomHelisTimer;
static int16 NumScriptHelis; // unused
static bool &CatalinaHeliOn;
static bool &CatalinaHasBeenShotDown;
static bool &ScriptHeliOn;
CHeli(int32 id, uint8 CreatedBy);
CHeli* ctor(int, uint8);
// from CEntity
void SetModelIndex(uint32 id);
void ProcessControl(void);
void PreRender(void);
void Render(void);
void PreRenderAlways(void);
CObject *SpawnFlyingComponent(int32 component);
static void InitHelis(void);
static void UpdateHelis(void);
static void SpecialHeliPreRender(void);
static bool TestRocketCollision(CVector *coors);
static bool TestBulletCollision(CVector *line0, CVector *line1, CVector *bulletPos, int32 damage);
static void StartCatalinaFlyBy(void);
static void RemoveCatalinaHeli(void);
static CHeli *FindPointerToCatalinasHeli(void);
static void CatalinaTakeOff(void);
static void MakeCatalinaHeliFlyAway(void);
static bool HasCatalinaBeenShotDown(void);
static void ActivateHeli(bool activate);
};
static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");

View File

@ -137,15 +137,16 @@ CPlane::ProcessControl(void)
colors[6] = CRGBA(0, 0, 0, 255);
colors[7] = CRGBA(224, 230, 238, 255);
CVector dir;
for(i = 0; i < 40; i++){
int rotSpeed = CGeneral::GetRandomNumberInRange(30.0f, 20.0f);
dir.x = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f);
dir.y = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f);
dir.z = CGeneral::GetRandomNumberInRange(0.0f, 2.0f);
int rotSpeed = CGeneral::GetRandomNumberInRange(10, 30);
if(CGeneral::GetRandomNumber() & 1)
rotSpeed = -rotSpeed;
int f = ++nFrameGen & 3;
CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f),
CVector(CGeneral::GetRandomNumberInRange(-2.0f, 2.0f),
CGeneral::GetRandomNumberInRange(-2.0f, 2.0f),
CGeneral::GetRandomNumberInRange(0.0f, 2.0f)),
CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), dir,
nil, CGeneral::GetRandomNumberInRange(0.1f, 1.0f),
colors[nFrameGen], rotSpeed, 0, f, 0);
}

View File

@ -67,7 +67,7 @@ CTrain::SetModelIndex(uint32 id)
int i;
CVehicle::SetModelIndex(id);
for(i = 0; i < 3; i++)
for(i = 0; i < NUM_TRAIN_NODES; i++)
m_aTrainNodes[i] = nil;
CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes);
}

View File

@ -20,7 +20,8 @@ enum
enum eTrainNodes
{
TRAIN_DOOR_LHS = 1,
TRAIN_DOOR_RHS
TRAIN_DOOR_RHS,
NUM_TRAIN_NODES
};
enum eTrainPositions
@ -66,7 +67,7 @@ public:
uint32 m_nDoorTimer;
int16 m_nDoorState;
CTrainDoor Doors[2];
RwFrame *m_aTrainNodes[3];
RwFrame *m_aTrainNodes[NUM_TRAIN_NODES];
// unused
static CVector aStationCoors[3];

View File

@ -30,6 +30,10 @@ void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehicleP
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
WRAPPER bool CVehicle::ShufflePassengersToMakeSpace(void) { EAXJMP(0x5528A0); }
// or Weapon.cpp?
WRAPPER void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage) { EAXJMP(0x563B00); }
CVehicle::CVehicle(uint8 CreatedBy)
{
int i;
@ -57,7 +61,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
pPassengers[i] = nil;
m_nBombTimer = 0;
m_pBlowUpEntity = nil;
field_1FB = 0;
m_nPacManPickupsCarried = 0;
bComedyControls = false;
bCraneMessageDone = false;
bExtendedRange = false;
@ -68,7 +72,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
m_nTimeOfDeath = 0;
m_pCarFire = nil;
bHasBeenOwnedByPlayer = false;
m_veh_flagC20 = false;
bCreateRoadBlockPeds = false;
bCanBeDamaged = true;
bUsingSpecialColModel = false;
m_veh_flagD1 = false;
@ -99,7 +103,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
m_aCollPolys[0].valid = false;
m_aCollPolys[1].valid = false;
AutoPilot.m_nCarMission = MISSION_NONE;
AutoPilot.m_nAnimationId = TEMPACT_NONE;
AutoPilot.m_nTempAction = TEMPACT_NONE;
AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
AutoPilot.m_flag4 = false;
AutoPilot.m_flag10 = false;

View File

@ -106,6 +106,9 @@ enum eFlightModel
FLIGHT_MODEL_SEAPLANE
};
// Or Weapon.h?
void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage);
class CVehicle : public CPhysical
{
public:
@ -156,7 +159,7 @@ public:
uint8 bHasBeenOwnedByPlayer : 1;// To work out whether stealing it is a crime
uint8 bFadeOut : 1; // Fade vehicle out
uint8 m_veh_flagC10 : 1;
uint8 m_veh_flagC20 : 1;
uint8 bCreateRoadBlockPeds : 1; // If this vehicle gets close enough we will create peds (coppers or gang members) round it
uint8 bCanBeDamaged : 1; // Set to FALSE during cut scenes to avoid explosions
uint8 bUsingSpecialColModel : 1;// Is player vehicle using special collision model, stored in player strucure
@ -171,8 +174,9 @@ public:
int8 m_numPedsUseItAsCover;
uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default)
int8 field_1FB;
int8 field_1FC[4];
int8 m_nPacManPickupsCarried;
uint8 m_nRoadblockType;
int16 m_nRoadblockNode;
float m_fHealth; // 1000.0f = full health. 250.0f = fire. 0 -> explode
uint8 m_nCurrentGear;
int8 field_205[3];
@ -262,6 +266,7 @@ public:
void RemoveDriver(void);
void ProcessCarAlarm(void);
bool IsSphereTouchingVehicle(float sx, float sy, float sz, float radius);
bool ShufflePassengersToMakeSpace(void);
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }