1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 17:30:00 +00:00

some CAutomobile

This commit is contained in:
aap 2020-05-27 22:32:33 +02:00
parent dd162c3aa0
commit c1e13177a1
14 changed files with 445 additions and 194 deletions

2
librw

@ -1 +1 @@
Subproject commit 6ff378bb16007ad003b1a71996944a20f2e76556 Subproject commit 84c582c1d7a64a213523b8e4c8211f8b7a4fdcd1

View file

@ -67,6 +67,7 @@ float CStats::AutoPaintingBudget;
int32 CStats::NoMoreHurricanes; int32 CStats::NoMoreHurricanes;
float CStats::FashionBudget; float CStats::FashionBudget;
int32 CStats::SafeHouseVisits; int32 CStats::SafeHouseVisits;
int32 CStats::TyresPopped;
void CStats::Init() void CStats::Init()
{ {

View file

@ -71,6 +71,7 @@ public:
static int32 NoMoreHurricanes; static int32 NoMoreHurricanes;
static float FashionBudget; static float FashionBudget;
static int32 SafeHouseVisits; static int32 SafeHouseVisits;
static int32 TyresPopped;
public: public:
static void Init(void); static void Init(void);

View file

@ -41,7 +41,7 @@ enum Config {
NUMANIMBLOCKS = 35, NUMANIMBLOCKS = 35,
NUMANIMATIONS = 450, NUMANIMATIONS = 450,
NUMTEMPOBJECTS = 30, NUMTEMPOBJECTS = 40,
// Path data // Path data
NUM_PATHNODES = 9650, NUM_PATHNODES = 9650,

View file

@ -81,7 +81,7 @@ CEntity::CEntity(void)
m_flagE2 = false; m_flagE2 = false;
bOffscreen = false; bOffscreen = false;
bIsStaticWaitingForCollision = false; bIsStaticWaitingForCollision = false;
m_flagE10 = false; bDontStream = false;
bUnderwater = false; bUnderwater = false;
bHasPreRenderEffects = false; bHasPreRenderEffects = false;
@ -1083,7 +1083,7 @@ CEntity::SaveEntityFlags(uint8*& buf)
if (m_flagE2) tmp |= BIT(9); if (m_flagE2) tmp |= BIT(9);
if (bOffscreen) tmp |= BIT(10); if (bOffscreen) tmp |= BIT(10);
if (bIsStaticWaitingForCollision) tmp |= BIT(11); if (bIsStaticWaitingForCollision) tmp |= BIT(11);
if (m_flagE10) tmp |= BIT(12); if (bDontStream) tmp |= BIT(12);
if (bUnderwater) tmp |= BIT(13); if (bUnderwater) tmp |= BIT(13);
if (bHasPreRenderEffects) tmp |= BIT(14); if (bHasPreRenderEffects) tmp |= BIT(14);
@ -1139,7 +1139,7 @@ CEntity::LoadEntityFlags(uint8*& buf)
m_flagE2 = !!(tmp & BIT(9)); m_flagE2 = !!(tmp & BIT(9));
bOffscreen = !!(tmp & BIT(10)); bOffscreen = !!(tmp & BIT(10));
bIsStaticWaitingForCollision = !!(tmp & BIT(11)); bIsStaticWaitingForCollision = !!(tmp & BIT(11));
m_flagE10 = !!(tmp & BIT(12)); bDontStream = !!(tmp & BIT(12));
bUnderwater = !!(tmp & BIT(13)); bUnderwater = !!(tmp & BIT(13));
bHasPreRenderEffects = !!(tmp & BIT(14)); bHasPreRenderEffects = !!(tmp & BIT(14));
} }

View file

@ -87,7 +87,7 @@ public:
uint32 m_flagE2 : 1; uint32 m_flagE2 : 1;
uint32 bOffscreen : 1; // offscreen flag. This can only be trusted when it is set to true uint32 bOffscreen : 1; // offscreen flag. This can only be trusted when it is set to true
uint32 bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them uint32 bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them
uint32 m_flagE10 : 1; // probably bDontStream uint32 bDontStream : 1; // tell the streaming not to stream me
uint32 bUnderwater : 1; // this object is underwater change drawing order uint32 bUnderwater : 1; // this object is underwater change drawing order
uint32 bHasPreRenderEffects : 1; // Object has a prerender effects attached to it uint32 bHasPreRenderEffects : 1; // Object has a prerender effects attached to it

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
class CEntity; class CEntity;
class CVehicle;
class CFallingGlassPane : public CMatrix class CFallingGlassPane : public CMatrix
{ {
@ -49,4 +50,7 @@ public:
static void WindowRespondsToSoftCollision(CEntity *entity, float amount); static void WindowRespondsToSoftCollision(CEntity *entity, float amount);
static void WasGlassHitByBullet(CEntity *entity, CVector point); static void WasGlassHitByBullet(CEntity *entity, CVector point);
static void WindowRespondsToExplosion(CEntity *entity, CVector point); static void WindowRespondsToExplosion(CEntity *entity, CVector point);
//TODO(MIAMI)
static void CarWindscreenShatters(CVehicle *vehicle, bool unk) {}
}; };

View file

@ -394,7 +394,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
} }
return VIS_VISIBLE; return VIS_VISIBLE;
} }
if(ent->m_flagE10){ if(ent->bDontStream){
if(ent->m_rwObject == nil || !ent->bIsVisible) if(ent->m_rwObject == nil || !ent->bIsVisible)
return VIS_INVISIBLE; return VIS_INVISIBLE;
if(!ent->GetIsOnScreen() || ent->IsEntityOccluded()) if(!ent->GetIsOnScreen() || ent->IsEntityOccluded())

File diff suppressed because it is too large Load diff

View file

@ -69,7 +69,6 @@ enum {
class CAutomobile : public CVehicle class CAutomobile : public CVehicle
{ {
public: public:
// 0x288
CDamageManager Damage; CDamageManager Damage;
CDoor Doors[6]; CDoor Doors[6];
RwFrame *m_aCarNodes[NUM_CAR_NODES]; RwFrame *m_aCarNodes[NUM_CAR_NODES];
@ -83,10 +82,8 @@ public:
float m_aWheelRotation[4]; float m_aWheelRotation[4];
float m_aWheelPosition[4]; float m_aWheelPosition[4];
float m_aWheelSpeed[4]; float m_aWheelSpeed[4];
float m_fRotorSpeed;
uint8 field_4D8; uint8 field_4D8;
uint8 bTaxiLight : 1; uint8 bTaxiLight : 1;
//uint8 bHadDriver : 1; // for bombs
uint8 bFixedColour : 1; uint8 bFixedColour : 1;
uint8 bBigWheels : 1; uint8 bBigWheels : 1;
uint8 bWaterTight : 1; // no damage for non-player peds uint8 bWaterTight : 1; // no damage for non-player peds
@ -111,6 +108,7 @@ public:
float m_weaponDoorTimerRight; float m_weaponDoorTimerRight;
float m_fCarGunLR; float m_fCarGunLR;
float m_fCarGunUD; float m_fCarGunUD;
float m_fHeliOrientation;
float m_fPropellerRotation; float m_fPropellerRotation;
uint8 stuff4[4]; uint8 stuff4[4];
uint8 m_nWheelsOnGround; uint8 m_nWheelsOnGround;
@ -144,6 +142,9 @@ public:
bool IsDoorFullyOpen(eDoors door); bool IsDoorFullyOpen(eDoors door);
bool IsDoorClosed(eDoors door); bool IsDoorClosed(eDoors door);
bool IsDoorMissing(eDoors door); bool IsDoorMissing(eDoors door);
bool IsDoorReady(uint32 door);
bool IsDoorMissing(uint32 door);
bool IsOpenTopCar(void);
void RemoveRefsToVehicle(CEntity *ent); void RemoveRefsToVehicle(CEntity *ent);
void BlowUpCar(CEntity *ent); void BlowUpCar(CEntity *ent);
bool SetUpWheelColModel(CColModel *colModel); bool SetUpWheelColModel(CColModel *colModel);
@ -158,6 +159,7 @@ public:
void VehicleDamage(float impulse, uint16 damagedPiece); void VehicleDamage(float impulse, uint16 damagedPiece);
void ProcessBuoyancy(void); void ProcessBuoyancy(void);
void DoDriveByShootings(void); void DoDriveByShootings(void);
void DoHoverSuspensionRatios(void);
int32 RcbanditCheckHitWheels(void); int32 RcbanditCheckHitWheels(void);
int32 RcbanditCheck1CarWheels(CPtrList &list); int32 RcbanditCheck1CarWheels(CPtrList &list);
void PlaceOnRoadProperly(void); void PlaceOnRoadProperly(void);
@ -181,6 +183,8 @@ 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 SetHeliOrientation(float orient) { m_fHeliOrientation = orient; }
void ClearHeliOrientation(void) { m_fHeliOrientation = -1.0f; }
void Fix(void); void Fix(void);
void SetComponentVisibility(RwFrame *frame, uint32 flags); void SetComponentVisibility(RwFrame *frame, uint32 flags);
@ -190,6 +194,11 @@ public:
void HideAllComps(void); void HideAllComps(void);
void ShowAllComps(void); void ShowAllComps(void);
void ReduceHornCounter(void); void ReduceHornCounter(void);
void PopBoot(void);
void PopBootUsingPhysics(void);
void CloseAllDoors(void);
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES
virtual void Save(uint8*& buf); virtual void Save(uint8*& buf);
virtual void Load(uint8*& buf); virtual void Load(uint8*& buf);

View file

@ -10,14 +10,20 @@ float G_aComponentDamage[] = { 2.5f, 1.25f, 3.2f, 1.4f, 2.5f, 2.8f, 0.5f };
CDamageManager::CDamageManager(void) CDamageManager::CDamageManager(void)
{ {
ResetDamageStatus(); ResetDamageStatus();
m_fWheelDamageEffect = 0.75f; m_fWheelDamageEffect = 0.5f;
field_24 = 1; field_18 = 1;
} }
void void
CDamageManager::ResetDamageStatus(void) CDamageManager::ResetDamageStatus(void)
{ {
memset(this, 0, sizeof(*this)); int i;
m_fWheelDamageEffect = 0.0f;
m_engineStatus = 0;
for(i = 0; i < ARRAY_SIZE(m_wheelStatus); i++) m_wheelStatus[i] = 0;
for(i = 0; i < ARRAY_SIZE(m_doorStatus); i++) m_doorStatus[i] = 0;
m_lightStatus = 0;
m_panelStatus = 0;
} }
void void
@ -28,12 +34,8 @@ CDamageManager::FuckCarCompletely(void)
m_wheelStatus[0] = WHEEL_STATUS_MISSING; m_wheelStatus[0] = WHEEL_STATUS_MISSING;
// wheels 1-3 not reset? // wheels 1-3 not reset?
m_doorStatus[0] = DOOR_STATUS_MISSING; for(i = 0; i < ARRAY_SIZE(m_doorStatus); i++)
m_doorStatus[1] = DOOR_STATUS_MISSING; m_doorStatus[i] = DOOR_STATUS_MISSING;
m_doorStatus[2] = DOOR_STATUS_MISSING;
m_doorStatus[3] = DOOR_STATUS_MISSING;
m_doorStatus[4] = DOOR_STATUS_MISSING;
m_doorStatus[5] = DOOR_STATUS_MISSING;
for(i = 0; i < 3; i++){ for(i = 0; i < 3; i++){
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -59,6 +61,8 @@ CDamageManager::ApplyDamage(tComponent component, float damage, float unused)
GetComponentGroup(component, &group, &subComp); GetComponentGroup(component, &group, &subComp);
damage *= G_aComponentDamage[group]; damage *= G_aComponentDamage[group];
if(component == COMPONENT_PANEL_WINDSCREEN)
damage *= 0.6f;
if(damage > 150.0f){ if(damage > 150.0f){
switch(group){ switch(group){
case COMPGROUP_WHEEL: case COMPGROUP_WHEEL:
@ -222,10 +226,6 @@ CDamageManager::GetEngineStatus(void)
bool bool
CDamageManager::ProgressEngineDamage(void) CDamageManager::ProgressEngineDamage(void)
{ {
int status = GetEngineStatus(); // gone in VC
int newstatus = status + 32 + (CGeneral::GetRandomNumber() & 0x1F); return false;
if(status < ENGINE_STATUS_ON_FIRE && newstatus > ENGINE_STATUS_ON_FIRE-1)
newstatus = ENGINE_STATUS_ON_FIRE-1;
SetEngineStatus(newstatus);
return true;
} }

View file

@ -86,7 +86,7 @@ public:
uint8 m_doorStatus[6]; uint8 m_doorStatus[6];
uint32 m_lightStatus; uint32 m_lightStatus;
uint32 m_panelStatus; uint32 m_panelStatus;
uint32 field_24; uint8 field_18;
CDamageManager(void); CDamageManager(void);

View file

@ -707,12 +707,12 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
// Apply Collision // Apply Collision
if(IsCar()){ if(IsCar()){
CAutomobile *heli = (CAutomobile*)this; CAutomobile *heli = (CAutomobile*)this;
if(heli->m_fRotorSpeed > 0.15f){ if(heli->m_aWheelSpeed[1] > 0.15f){
ApplyCollision(CWorld::m_aTempColPts[i], impulse); ApplyCollision(CWorld::m_aTempColPts[i], impulse);
ApplyTurnForce(m_fTurnMass*ROTOR_COL_TURNMULT*tangentSpeed, colpos - center); ApplyTurnForce(m_fTurnMass*ROTOR_COL_TURNMULT*tangentSpeed, colpos - center);
heli->m_fRotorSpeed = 0.15f; heli->m_aWheelSpeed[1] = 0.15f;
}else if(heli->m_fRotorSpeed < 0.075f && heli->m_fRotorSpeed > 0.0f) }else if(heli->m_aWheelSpeed[1] < 0.075f && heli->m_aWheelSpeed[1] > 0.0f)
heli->m_fRotorSpeed *= -1.0f; heli->m_aWheelSpeed[1] *= -1.0f;
} }
float damageImpulse = damageMult * Max(impulse, ROTOR_DEFAULT_DAMAGE*m_fMass/3000.0f); float damageImpulse = damageMult * Max(impulse, ROTOR_DEFAULT_DAMAGE*m_fMass/3000.0f);
@ -1395,7 +1395,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
return false; return false;
if (pPassengers[1] && if (pPassengers[1] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_LR) && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR) &&
IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_LEFT, nil)) { IsRoomForPedToLeaveCar(CAR_DOOR_LR, nil)) {
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[1]; pPassengers[2] = pPassengers[1];
pPassengers[1] = nil; pPassengers[1] = nil;
@ -1412,7 +1412,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
} }
if (pPassengers[2] && if (pPassengers[2] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RR) && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR) &&
IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_RIGHT, nil)) { IsRoomForPedToLeaveCar(CAR_DOOR_RR, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[2]; pPassengers[1] = pPassengers[2];
pPassengers[2] = nil; pPassengers[2] = nil;
@ -1429,7 +1429,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
} }
if (pPassengers[0] && if (pPassengers[0] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RF) && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF) &&
IsRoomForPedToLeaveCar(COMPONENT_DOOR_FRONT_RIGHT, nil)) { IsRoomForPedToLeaveCar(CAR_DOOR_RF, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[0]; pPassengers[1] = pPassengers[0];
pPassengers[0] = nil; pPassengers[0] = nil;
@ -1581,9 +1581,8 @@ CVehicle::CarHasRoof(void)
{ {
if((pHandling->Flags & HANDLING_HAS_NO_ROOF) == 0) if((pHandling->Flags & HANDLING_HAS_NO_ROOF) == 0)
return true; return true;
if(m_aExtras[0] && m_aExtras[1]) // component 0 is assumed to be a roof
return false; return m_aExtras[0] == 0 || m_aExtras[1] == 0;
return true;
} }
bool bool
@ -1977,7 +1976,7 @@ CVehicle::ProcessCarAlarm(void)
{ {
uint32 step; uint32 step;
if(m_nAlarmState == 0 || m_nAlarmState == -1) if(!IsAlarmOn())
return; return;
step = CTimer::GetTimeStepInMilliseconds(); step = CTimer::GetTimeStepInMilliseconds();
@ -2267,6 +2266,32 @@ CVehicle::DoSunGlare(void)
} }
} }
void
CVehicle::KillPedsInVehicle(void)
{
int i;
if(pDriver){
CDarkel::RegisterKillByPlayer(pDriver, WEAPONTYPE_EXPLOSION);
if(pDriver->GetPedState() == PED_DRIVING){
pDriver->SetDead();
if(!pDriver->IsPlayer())
pDriver->FlagToDestroyWhenNextProcessed();
}else
pDriver->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
}
for(i = 0; i < m_nNumMaxPassengers; i++){
if(pPassengers[i]){
CDarkel::RegisterKillByPlayer(pPassengers[i], WEAPONTYPE_EXPLOSION);
if(pPassengers[i]->GetPedState() == PED_DRIVING){
pPassengers[i]->SetDead();
if(!pPassengers[i]->IsPlayer())
pPassengers[i]->FlagToDestroyWhenNextProcessed();
}else
pPassengers[i]->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
}
}
}
void void
DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle) DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle)
{ {

View file

@ -276,7 +276,7 @@ public:
virtual void BlowUpCar(CEntity *ent) {} virtual void BlowUpCar(CEntity *ent) {}
virtual bool SetUpWheelColModel(CColModel *colModel) { return false; } virtual bool SetUpWheelColModel(CColModel *colModel) { return false; }
virtual void BurstTyre(uint8 tyre, bool applyForces) {} virtual void BurstTyre(uint8 tyre, bool applyForces) {}
virtual bool IsRoomForPedToLeaveCar(uint32 component, CVector *forcedDoorPos) { return false;} virtual bool IsRoomForPedToLeaveCar(uint32 component, CVector *forcedDoorPos) { return false; }
virtual bool IsClearToDriveAway(void); virtual bool IsClearToDriveAway(void);
virtual float GetHeightAboveRoad(void); virtual float GetHeightAboveRoad(void);
virtual void PlayCarHorn(void) {} virtual void PlayCarHorn(void) {}
@ -340,6 +340,7 @@ public:
void FireFixedMachineGuns(void); void FireFixedMachineGuns(void);
void ActivateBomb(void); void ActivateBomb(void);
void ActivateBombWhenEntered(void); void ActivateBombWhenEntered(void);
void KillPedsInVehicle(void);
void SetComponentAtomicAlpha(RpAtomic *atomic, int32 alpha); void SetComponentAtomicAlpha(RpAtomic *atomic, int32 alpha);
void UpdateClumpAlpha(void); void UpdateClumpAlpha(void);