1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-06-29 00:28:41 +00:00

CAutomobile done

This commit is contained in:
aap 2020-05-31 17:05:49 +02:00
parent 00dc86917e
commit 21ce0a4b28
20 changed files with 1365 additions and 437 deletions

View file

@ -3778,7 +3778,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle()) if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source); FindPlayerVehicle()->Teleport(Source);
else else
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source); CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
} }
// stay inside sectors // stay inside sectors
@ -3845,8 +3845,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle()) if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source); FindPlayerVehicle()->Teleport(Source);
else else
CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source; CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
} }
// stay inside sectors // stay inside sectors

View file

@ -382,6 +382,7 @@ public:
bool m_WideScreenOn; bool m_WideScreenOn;
bool m_1rstPersonRunCloseToAWall; bool m_1rstPersonRunCloseToAWall;
bool m_bHeadBob; bool m_bHeadBob;
bool m_bVehicleSuspenHigh;
bool m_bFailedCullZoneTestPreviously; bool m_bFailedCullZoneTestPreviously;
bool m_FadeTargetIsSplashScreen; bool m_FadeTargetIsSplashScreen;

View file

@ -42,6 +42,7 @@ public:
uint32 m_nTimeLastHealthLoss; uint32 m_nTimeLastHealthLoss;
uint32 m_nTimeLastArmourLoss; uint32 m_nTimeLastArmourLoss;
uint32 m_nTimeTankShotGun; uint32 m_nTimeTankShotGun;
int32 m_nTimeNotFullyOnGround;
int32 m_nUpsideDownCounter; int32 m_nUpsideDownCounter;
int32 field_248; int32 field_248;
int16 m_nTrafficMultiplier; int16 m_nTrafficMultiplier;

View file

@ -335,6 +335,8 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); }); DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); });
DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); }); DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); });
DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); }); DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); });
DebugMenuAddCmd("Spawn", "Spawn Phoenix", [](){ SpawnCar(MI_PHEONIX); });
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); }); DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); }); DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
DebugMenuAddCmd("Spawn", "Spawn Admiral", [](){ SpawnCar(MI_ADMIRAL); }); DebugMenuAddCmd("Spawn", "Spawn Admiral", [](){ SpawnCar(MI_ADMIRAL); });
@ -342,9 +344,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); }); DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); }); DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); }); DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
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 BF injection", [](){ SpawnCar(MI_BFINJECT); });
DebugMenuAddCmd("Spawn", "Spawn Maverick", [](){ SpawnCar(MI_MAVERICK); }); DebugMenuAddCmd("Spawn", "Spawn Maverick", [](){ SpawnCar(MI_MAVERICK); });
DebugMenuAddCmd("Spawn", "Spawn VCN Maverick", [](){ SpawnCar(MI_VCNMAV); }); DebugMenuAddCmd("Spawn", "Spawn VCN Maverick", [](){ SpawnCar(MI_VCNMAV); });
DebugMenuAddCmd("Spawn", "Spawn Sparrow", [](){ SpawnCar(MI_SPARROW); }); DebugMenuAddCmd("Spawn", "Spawn Sparrow", [](){ SpawnCar(MI_SPARROW); });

View file

@ -478,7 +478,9 @@ CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVecto
if(DotProduct(springDir, forceDir) > 0.0f) if(DotProduct(springDir, forceDir) > 0.0f)
forceDir *= -1.0f; forceDir *= -1.0f;
float step = Min(CTimer::GetTimeStep(), 3.0f); float step = Min(CTimer::GetTimeStep(), 3.0f);
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f; float impulse = GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
if(bIsHeavy)
impulse *= 0.75f;
ApplyMoveForce(forceDir*impulse); ApplyMoveForce(forceDir*impulse);
ApplyTurnForce(forceDir*impulse, point); ApplyTurnForce(forceDir*impulse, point);
} }

View file

@ -130,13 +130,18 @@ public:
{ {
float *pFloatMatrix = (float*)&m_matrix; float *pFloatMatrix = (float*)&m_matrix;
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
#ifdef FIX_BUGS // BUGFIX from VC
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
#else
for (int j = 0; j < 4; j++)
#endif
pFloatMatrix[i * 4 + j] *= scale; pFloatMatrix[i * 4 + j] *= scale;
} }
void Scale(float sx, float sy, float sz)
{
float *pFloatMatrix = (float*)&m_matrix;
for (int i = 0; i < 3; i++){
pFloatMatrix[i * 4 + 0] *= sx;
pFloatMatrix[i * 4 + 1] *= sy;
pFloatMatrix[i * 4 + 2] *= sz;
}
}
void SetRotateXOnly(float angle){ void SetRotateXOnly(float angle){
@ -224,6 +229,7 @@ public:
void SetRotate(float xAngle, float yAngle, float zAngle); void SetRotate(float xAngle, float yAngle, float zAngle);
void Rotate(float x, float y, float z); void Rotate(float x, float y, float z);
void RotateX(float x); void RotateX(float x);
void RotateY(float y);
void RotateZ(float z); void RotateZ(float z);
void Reorthogonalise(void); void Reorthogonalise(void);

View file

@ -46,6 +46,12 @@ CMatrix::RotateX(float x)
Rotate(x, 0.0f, 0.0f); Rotate(x, 0.0f, 0.0f);
} }
void
CMatrix::RotateY(float y)
{
Rotate(0.0f, y, 0.0f);
}
void void
CMatrix::RotateZ(float z) CMatrix::RotateZ(float z)
{ {

View file

@ -16623,6 +16623,8 @@ CPed::ScanForThreats(void)
CPed *shooter = nil; CPed *shooter = nil;
if ((fearFlags & PED_FLAG_GUN) && (shooter = CheckForGunShots()) && (m_nPedType != shooter->m_nPedType || m_nPedType == PEDTYPE_CIVMALE || m_nPedType == PEDTYPE_CIVFEMALE)) { if ((fearFlags & PED_FLAG_GUN) && (shooter = CheckForGunShots()) && (m_nPedType != shooter->m_nPedType || m_nPedType == PEDTYPE_CIVMALE || m_nPedType == PEDTYPE_CIVFEMALE)) {
//TODO(MIAMI): just a quick fix for heli weapons
if(shooter->IsPed()){
if (!IsGangMember()) { if (!IsGangMember()) {
m_threatEntity = shooter; m_threatEntity = shooter;
m_threatEntity->RegisterReference((CEntity **) &m_threatEntity); m_threatEntity->RegisterReference((CEntity **) &m_threatEntity);
@ -16634,6 +16636,7 @@ CPed::ScanForThreats(void)
m_threatEntity->RegisterReference((CEntity **) &m_threatEntity); m_threatEntity->RegisterReference((CEntity **) &m_threatEntity);
return CPedType::GetFlag(shooter->m_nPedType); return CPedType::GetFlag(shooter->m_nPedType);
} }
}
} }
CPed *deadPed = nil; CPed *deadPed = nil;

View file

@ -114,11 +114,12 @@ CSkidmarks::Render(void)
continue; continue;
CRGBA color(0, 0, 0, 255); CRGBA color(0, 0, 0, 255);
// TODO(MIAMI): we have a type field here actually (0-3) switch(aSkidmarks[i].m_type){
if(aSkidmarks[i].m_isBloody) // TODO: type 3 case SKIDMARK_NORMAL: color = CRGBA(0, 0, 0, 255); break;
color = CRGBA(132, 34, 11, 255); case SKIDMARK_MUDDY: color = CRGBA(90, 62, 9, 255); break;
else if(aSkidmarks[i].m_isMuddy) // TODO: type 1 case SKIDMARK_SANDY: color = CRGBA(108, 108, 96, 255); break;
color = CRGBA(90, 62, 9, 255); case SKIDMARK_BLOODY: color = CRGBA(132, 34, 11, 255); break;
}
uint32 fade, alpha; uint32 fade, alpha;
if(aSkidmarks[i].m_state == 1 || CTimer::GetTimeInMilliseconds() < aSkidmarks[i].m_fadeStart) if(aSkidmarks[i].m_state == 1 || CTimer::GetTimeInMilliseconds() < aSkidmarks[i].m_fadeStart)
@ -132,8 +133,12 @@ CSkidmarks::Render(void)
alpha = 0; alpha = 0;
alpha = alpha*fade/256; alpha = alpha*fade/256;
CVector p1 = aSkidmarks[i].m_pos[j] + aSkidmarks[i].m_side[j]; CVector p1 = aSkidmarks[i].m_pos[j];
CVector p2 = aSkidmarks[i].m_pos[j] - aSkidmarks[i].m_side[j]; p1.x += aSkidmarks[i].m_sideX[j];
p1.y += aSkidmarks[i].m_sideY[j];
CVector p2 = aSkidmarks[i].m_pos[j];
p2.x -= aSkidmarks[i].m_sideX[j];
p2.y -= aSkidmarks[i].m_sideY[j];
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+0], color.red, color.green, color.blue, alpha); RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+0], color.red, color.green, color.blue, alpha);
RwIm3DVertexSetPos(&SkidmarkVertices[j*2+0], p1.x, p1.y, p1.z+0.1f); RwIm3DVertexSetPos(&SkidmarkVertices[j*2+0], p1.x, p1.y, p1.z+0.1f);
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+1], color.red, color.green, color.blue, alpha); RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+1], color.red, color.green, color.blue, alpha);
@ -153,7 +158,20 @@ CSkidmarks::Render(void)
} }
void void
CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody) CSkidmarks::RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody)
{
eSkidmarkType type;
if(*isBloody)
type = SKIDMARK_BLOODY;
else if(*isMuddy)
type = SKIDMARK_MUDDY;
else
type = SKIDMARK_NORMAL;
RegisterOne(id, pos, fwdX, fwdY, type, isBloody);
}
void
CSkidmarks::RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, eSkidmarkType type, bool *isBloody)
{ {
int i; int i;
CVector2D fwd(fwdX, fwdY); CVector2D fwd(fwdX, fwdY);
@ -169,7 +187,7 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
if(i < NUMSKIDMARKS){ if(i < NUMSKIDMARKS){
// Continue this one // Continue this one
if(aSkidmarks[i].m_isBloody != *isBloody){ if((aSkidmarks[i].m_type==SKIDMARK_BLOODY) != *isBloody){
// Blood-status changed, end this one // Blood-status changed, end this one
aSkidmarks[i].m_state = 2; aSkidmarks[i].m_state = 2;
aSkidmarks[i].m_fadeStart = CTimer::GetTimeInMilliseconds() + 10000; aSkidmarks[i].m_fadeStart = CTimer::GetTimeInMilliseconds() + 10000;
@ -204,9 +222,12 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
CVector2D right(dist.y, -dist.x); CVector2D right(dist.y, -dist.x);
float turn = DotProduct2D(fwd, right); float turn = DotProduct2D(fwd, right);
turn = Abs(turn) + 1.0f; turn = Abs(turn) + 1.0f;
aSkidmarks[i].m_side[aSkidmarks[i].m_last] = CVector(right.x, right.y, 0.0f) * turn * 0.125f; aSkidmarks[i].m_sideX[aSkidmarks[i].m_last] = right.x * turn * 0.125f;
if(aSkidmarks[i].m_last == 1) aSkidmarks[i].m_sideY[aSkidmarks[i].m_last] = right.y * turn * 0.125f;
aSkidmarks[i].m_side[0] = aSkidmarks[i].m_side[1]; if(aSkidmarks[i].m_last == 1){
aSkidmarks[i].m_sideX[0] = aSkidmarks[i].m_sideX[1];
aSkidmarks[i].m_sideY[0] = aSkidmarks[i].m_sideY[1];
}
if(aSkidmarks[i].m_last > 8) if(aSkidmarks[i].m_last > 8)
*isBloody = false; // stop blood marks after 8 *isBloody = false; // stop blood marks after 8
@ -222,12 +243,15 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
aSkidmarks[i].m_state = 1; aSkidmarks[i].m_state = 1;
aSkidmarks[i].m_id = id; aSkidmarks[i].m_id = id;
aSkidmarks[i].m_pos[0] = pos; aSkidmarks[i].m_pos[0] = pos;
aSkidmarks[i].m_side[0] = CVector(0.0f, 0.0f, 0.0f); aSkidmarks[i].m_sideX[0] = 0.0f;
aSkidmarks[i].m_sideY[0] = 0.0f;
aSkidmarks[i].m_wasUpdated = true; aSkidmarks[i].m_wasUpdated = true;
aSkidmarks[i].m_last = 0; aSkidmarks[i].m_last = 0;
aSkidmarks[i].m_lastUpdate = CTimer::GetTimeInMilliseconds() - 1000; aSkidmarks[i].m_lastUpdate = CTimer::GetTimeInMilliseconds() - 1000;
aSkidmarks[i].m_isBloody = *isBloody; if(*isBloody)
aSkidmarks[i].m_isMuddy = *isMuddy; aSkidmarks[i].m_type = SKIDMARK_BLOODY;
else
aSkidmarks[i].m_type = type;
}else }else
*isBloody = false; // stop blood marks if no space *isBloody = false; // stop blood marks if no space
} }

View file

@ -2,20 +2,28 @@
enum { SKIDMARK_LENGTH = 16 }; enum { SKIDMARK_LENGTH = 16 };
enum eSkidmarkType
{
SKIDMARK_NORMAL,
SKIDMARK_MUDDY,
SKIDMARK_SANDY,
SKIDMARK_BLOODY
};
class CSkidmark class CSkidmark
{ {
public: public:
uint8 m_state; CVector m_pos[SKIDMARK_LENGTH];
bool m_wasUpdated; float m_sideX[SKIDMARK_LENGTH];
bool m_isBloody; float m_sideY[SKIDMARK_LENGTH];
bool m_isMuddy;
uintptr m_id; uintptr m_id;
int16 m_last; uint32 m_lastUpdate;
uint32 m_lastUpdate;;
uint32 m_fadeStart; uint32 m_fadeStart;
uint32 m_fadeEnd; uint32 m_fadeEnd;
CVector m_pos[SKIDMARK_LENGTH]; uint32 m_type;
CVector m_side[SKIDMARK_LENGTH]; int16 m_last;
uint8 m_state;
bool m_wasUpdated;
}; };
class CSkidmarks class CSkidmarks
@ -28,5 +36,6 @@ public:
static void Clear(void); static void Clear(void);
static void Update(void); static void Update(void);
static void Render(void); static void Render(void);
static void RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody); static void RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, eSkidmarkType type, bool *isBloody);
static void RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody);
}; };

View file

@ -1,6 +1,11 @@
#include "common.h" #include "common.h"
#include "WindModifiers.h" #include "WindModifiers.h"
void
CWindModifiers::RegisterOne(CVector pos, int32 unk)
{
}
int32 int32
CWindModifiers::FindWindModifier(CVector pos, float *x, float *y) CWindModifiers::FindWindModifier(CVector pos, float *x, float *y)
{ {

View file

@ -3,5 +3,6 @@
class CWindModifiers class CWindModifiers
{ {
public: public:
static void RegisterOne(CVector pos, int32 unk);
static int32 FindWindModifier(CVector pos, float *x, float *y); static int32 FindWindModifier(CVector pos, float *x, float *y);
}; };

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "DamageManager.h" #include "DamageManager.h"
#include "Door.h" #include "Door.h"
#include "Skidmarks.h"
class CObject; class CObject;
@ -76,13 +77,14 @@ public:
float m_aSuspensionSpringRatio[4]; float m_aSuspensionSpringRatio[4];
float m_aSuspensionSpringRatioPrev[4]; float m_aSuspensionSpringRatioPrev[4];
float m_aWheelTimer[4]; // set to 4.0 when wheel is touching ground, then decremented float m_aWheelTimer[4]; // set to 4.0 when wheel is touching ground, then decremented
float field_49C; float m_auto_unused1;
bool m_aWheelSkidmarkMuddy[4]; eSkidmarkType m_aWheelSkidmarkType[4];
bool m_aWheelSkidmarkBloody[4]; bool m_aWheelSkidmarkBloody[4];
bool m_aWheelSkidmarkUnk[4];
float m_aWheelRotation[4]; float m_aWheelRotation[4];
float m_aWheelPosition[4]; float m_aWheelPosition[4];
float m_aWheelSpeed[4]; float m_aWheelSpeed[4];
uint8 field_4D8; uint8 m_auto_unused2;
uint8 bTaxiLight : 1; uint8 bTaxiLight : 1;
uint8 bFixedColour : 1; uint8 bFixedColour : 1;
uint8 bBigWheels : 1; uint8 bBigWheels : 1;
@ -90,7 +92,9 @@ public:
uint8 bNotDamagedUpsideDown : 1; uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1; uint8 bMoreResistantToDamage : 1;
uint8 bTankDetonateCars : 1; uint8 bTankDetonateCars : 1;
int16 field_4E0; uint8 bStuckInSand : 1;
uint8 bHeliDestroyed : 1;
int16 m_doingBurnout;
uint16 m_hydraulicState; uint16 m_hydraulicState;
uint32 m_nBusDoorTimerEnd; uint32 m_nBusDoorTimerEnd;
uint32 m_nBusDoorTimerStart; uint32 m_nBusDoorTimerStart;
@ -98,6 +102,9 @@ public:
float m_aSuspensionLineLength[4]; float m_aSuspensionLineLength[4];
float m_fHeightAboveRoad; float m_fHeightAboveRoad;
float m_fTraction; float m_fTraction;
float m_fTireTemperature;
float m_fOrientation; // for heli and plane go-to
float m_auto_unk4; // related to the above
float m_fVelocityChangeForAudio; float m_fVelocityChangeForAudio;
float m_randomValues[6]; // used for what? float m_randomValues[6]; // used for what?
float m_fFireBlowUpTimer; float m_fFireBlowUpTimer;
@ -183,6 +190,7 @@ public:
void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents = false); void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents = false);
void TellHeliToGoToCoors(float x, float y, float z, uint8 speed); void TellHeliToGoToCoors(float x, float y, float z, uint8 speed);
void TellPlaneToGoToCoors(float x, float y, float z, uint8 speed);
void SetHeliOrientation(float orient) { m_fHeliOrientation = orient; } void SetHeliOrientation(float orient) { m_fHeliOrientation = orient; }
void ClearHeliOrientation(void) { m_fHeliOrientation = -1.0f; } void ClearHeliOrientation(void) { m_fHeliOrientation = -1.0f; }
@ -198,6 +206,7 @@ public:
void PopBoot(void); void PopBoot(void);
void PopBootUsingPhysics(void); void PopBootUsingPhysics(void);
void CloseAllDoors(void); void CloseAllDoors(void);
void KnockPedOutCar(eWeaponType weapon, uint16 door, CPed *ped);
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES
virtual void Save(uint8*& buf); virtual void Save(uint8*& buf);

View file

@ -42,6 +42,7 @@ bool CVehicle::bCheat5;
bool CVehicle::bAltDodoCheat; bool CVehicle::bAltDodoCheat;
#endif #endif
bool CVehicle::bHoverCheat; bool CVehicle::bHoverCheat;
bool CVehicle::bAllTaxisHaveNitro;
bool CVehicle::m_bDisableMouseSteering = true; bool CVehicle::m_bDisableMouseSteering = true;
bool CVehicle::bDisableRemoteDetonation; bool CVehicle::bDisableRemoteDetonation;
bool CVehicle::bDisableRemoteDetonationOnContact; bool CVehicle::bDisableRemoteDetonationOnContact;
@ -126,7 +127,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
bCreatedAsPoliceVehicle = false; bCreatedAsPoliceVehicle = false;
bRestingOnPhysical = false; bRestingOnPhysical = false;
bParking = false; bParking = false;
bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // BUG? this makes no sense bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // never true. probably doesn't work very well
bIsVan = false; bIsVan = false;
bIsBus = false; bIsBus = false;
bIsBig = false; bIsBig = false;
@ -345,7 +346,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
// thrust // thrust
float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward()); float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward());
CVector vecWidthForward = GetColModel()->boundingBox.min.y * GetForward(); CVector vecTail = GetColModel()->boundingBox.min.y * GetForward();
float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f; float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
float fThrustAccel; float fThrustAccel;
if(fForwSpeed > 0.0f || fThrust > 0.0f) if(fForwSpeed > 0.0f || fThrust > 0.0f)
@ -363,9 +364,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float fSideSlipAccel = pFlyingHandling->fSideSlip * fSideSpeed * Abs(fSideSpeed); float fSideSlipAccel = pFlyingHandling->fSideSlip * fSideSpeed * Abs(fSideSpeed);
ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep()); ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep());
float fYaw = -DotProduct(GetSpeed(vecWidthForward), GetRight()); float fYaw = -DotProduct(GetSpeed(vecTail), GetRight());
float fYawAccel = pFlyingHandling->fYawStab * fYaw * Abs(fYaw) + pFlyingHandling->fYaw * fSteerLR * fForwSpeed; float fYawAccel = pFlyingHandling->fYawStab * fYaw * Abs(fYaw) + pFlyingHandling->fYaw * fSteerLR * fForwSpeed;
ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward); ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecTail);
float fRollAccel; float fRollAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE) { if (flightModel == FLIGHT_MODEL_RCPLANE) {
@ -385,9 +386,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right?
// up/down // up/down
float fTail = -DotProduct(GetSpeed(vecWidthForward), GetUp()); float fTail = -DotProduct(GetSpeed(vecTail), GetUp());
float fPitchAccel = pFlyingHandling->fPitchStab * fTail * Abs(fTail) + pFlyingHandling->fPitch * fSteerUD * fForwSpeed; float fPitchAccel = pFlyingHandling->fPitchStab * fTail * Abs(fTail) + pFlyingHandling->fPitch * fSteerUD * fForwSpeed;
ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward); ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecTail);
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude()); float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
float fLiftAccel = (pFlyingHandling->fAttackLift * fLift + pFlyingHandling->fFormLift) * fForwSpeed * fForwSpeed; float fLiftAccel = (pFlyingHandling->fAttackLift * fLift + pFlyingHandling->fFormLift) * fForwSpeed * fForwSpeed;
@ -555,7 +556,7 @@ CVehicle::DoBladeCollision(CVector pos, CMatrix &matrix, int16 rotorType, float
rotorColModel.numSpheres = 1; rotorColModel.numSpheres = 1;
pos = matrix * pos; pos = matrix * pos;
bool hadCollision; bool hadCollision = false;
int minX = CWorld::GetSectorIndexX(pos.x - radius); int minX = CWorld::GetSectorIndexX(pos.x - radius);
if(minX <= 0) minX = 0; if(minX <= 0) minX = 0;
@ -656,7 +657,7 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
if(entity->IsPed()) if(entity->IsPed())
entityCol = ((CPedModelInfo*)CModelInfo::GetModelInfo(entity->GetModelIndex()))->AnimatePedColModelSkinned(entity->GetClump()); entityCol = ((CPedModelInfo*)CModelInfo::GetModelInfo(entity->GetModelIndex()))->AnimatePedColModelSkinned(entity->GetClump());
else else
entityCol = CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel(); entityCol = entity->GetColModel();
if(entityCol) if(entityCol)
numCollisions = CCollision::ProcessColModels(matrix, rotorColModel, entity->GetMatrix(), *entityCol, numCollisions = CCollision::ProcessColModels(matrix, rotorColModel, entity->GetMatrix(), *entityCol,
CWorld::m_aTempColPts, nil, nil); CWorld::m_aTempColPts, nil, nil);
@ -691,10 +692,12 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
CVector localColpos = colpos - center; CVector localColpos = colpos - center;
float axisDir = DotProduct(axis, localColpos); float axisDir = DotProduct(axis, localColpos);
float colDir = DotProduct(CWorld::m_aTempColPts[i].normal, localColpos); float colDir = DotProduct(CWorld::m_aTempColPts[i].normal, localColpos);
if(2.0f*ROTOR_SEMI_THICKNESS < Abs(axisDir) && if(2.0f*ROTOR_SEMI_THICKNESS < Abs(axisDir) &&
ROTOR_DISGUARD_MULT*Abs(colDir) < Abs(axisDir)) ROTOR_DISGUARD_MULT*Abs(colDir) < Abs(axisDir))
continue; continue;
hadCollision = true;
colpos -= axisDir*axis; // get rid of axis component colpos -= axisDir*axis; // get rid of axis component
CVector tangentSpeed = CrossProduct(turnSpeed, colpos - center); CVector tangentSpeed = CrossProduct(turnSpeed, colpos - center);
@ -720,7 +723,6 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
if(damageImpulse > m_fDamageImpulse) if(damageImpulse > m_fDamageImpulse)
SetDamagedPieceRecord(0, damageImpulse, entity, CWorld::m_aTempColPts[i].normal); SetDamagedPieceRecord(0, damageImpulse, entity, CWorld::m_aTempColPts[i].normal);
hadCollision = true;
} }
if(hadCollision && !entity->IsPed()) if(hadCollision && !entity->IsPed())
@ -1712,6 +1714,15 @@ CVehicle::CanPedExitCar(bool jumpExit)
} }
} }
bool
CVehicle::CanPedJumpOutCar(void)
{
if(GetUp().z < 0.3f)
return false;
float speed = m_vecMoveSpeed.MagnitudeSqr();
return speed < 0.1f || speed > 0.5f ? false : true;
}
bool bool
CVehicle::CanPedJumpOffBike(void) CVehicle::CanPedJumpOffBike(void)
{ {

View file

@ -317,6 +317,7 @@ public:
bool CanDoorsBeDamaged(void); bool CanDoorsBeDamaged(void);
bool CanPedEnterCar(void); bool CanPedEnterCar(void);
bool CanPedExitCar(bool jumpExit); bool CanPedExitCar(bool jumpExit);
bool CanPedJumpOutCar(void);
bool CanPedJumpOffBike(void); bool CanPedJumpOffBike(void);
// do these two actually return something? // do these two actually return something?
CPed *SetUpDriver(void); CPed *SetUpDriver(void);
@ -348,11 +349,12 @@ public:
static void HeliDustGenerate(CEntity *heli, float radius, float ground, int rnd); static void HeliDustGenerate(CEntity *heli, float radius, float ground, int rnd);
void DoSunGlare(void); void DoSunGlare(void);
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; } bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; }
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 IsLimo(void) { return GetModelIndex() == MI_STRETCH || GetModelIndex() == MI_LOVEFIST; } bool IsLimo(void) { return GetModelIndex() == MI_STRETCH || GetModelIndex() == MI_LOVEFIST; }
bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); } bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); }
bool IsRealPlane(void) { return !!(pHandling->Flags & HANDLING_IS_PLANE); }
static bool bWheelsOnlyCheat; static bool bWheelsOnlyCheat;
static bool bAllDodosCheat; static bool bAllDodosCheat;
@ -363,6 +365,7 @@ public:
static bool bAltDodoCheat; static bool bAltDodoCheat;
#endif #endif
static bool bHoverCheat; static bool bHoverCheat;
static bool bAllTaxisHaveNitro;
static bool m_bDisableMouseSteering; static bool m_bDisableMouseSteering;
static bool bDisableRemoteDetonation; static bool bDisableRemoteDetonation;
static bool bDisableRemoteDetonationOnContact; static bool bDisableRemoteDetonationOnContact;

View file

@ -86,7 +86,7 @@ CExplosion::GetExplosionPosition(uint8 id)
} }
bool bool
CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime) CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool unk)
{ {
CVector pPosn; CVector pPosn;
CVector posGround; CVector posGround;

View file

@ -40,7 +40,8 @@ public:
static void ResetExplosionActiveCounter(uint8 id); static void ResetExplosionActiveCounter(uint8 id);
static uint8 GetExplosionType(uint8 id); static uint8 GetExplosionType(uint8 id);
static CVector *GetExplosionPosition(uint8 id); static CVector *GetExplosionPosition(uint8 id);
static bool AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime); // TODO(MIAMI): that new parameter
static bool AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool unk = true);
static void Update(); static void Update();
static bool TestForExplosionInArea(eExplosionType type, float x1, float x2, float y1, float y2, float z1, float z2); static bool TestForExplosionInArea(eExplosionType type, float x1, float x2, float y1, float y2, float z1, float z2);
static void RemoveAllExplosionsInArea(CVector pos, float radius); static void RemoveAllExplosionsInArea(CVector pos, float radius);

View file

@ -113,6 +113,18 @@ CWeapon::UpdateWeapons(void)
CBulletInfo::Update(); CBulletInfo::Update();
} }
//--MIAMI: done
CWeapon::CWeapon(eWeaponType type, int32 ammo)
{
m_eWeaponType = type;
m_eWeaponState = WEAPONSTATE_READY;
m_nAmmoTotal = Min(ammo, 99999);
m_nAmmoInClip = 0;
Reload();
m_nTimer = 0;
m_bAddRotOffset = false;
}
// --MIAMI: Done // --MIAMI: Done
void void
CWeapon::Initialise(eWeaponType type, int32 ammo) CWeapon::Initialise(eWeaponType type, int32 ammo)

View file

@ -25,6 +25,7 @@ public:
CWeapon() { CWeapon() {
m_bAddRotOffset = false; m_bAddRotOffset = false;
} }
CWeapon(eWeaponType type, int32 ammo);
CWeaponInfo *GetInfo(); CWeaponInfo *GetInfo();