Struct cleanup, various fixes, enable PS2 rand

This commit is contained in:
eray orçunus 2020-04-19 07:14:13 +03:00
parent 9bfcaff849
commit 1ffc37735e
27 changed files with 93 additions and 80 deletions

View file

@ -45,7 +45,7 @@ class cSampleManager
uint8 m_nEffectsFadeVolume; uint8 m_nEffectsFadeVolume;
uint8 m_nMusicFadeVolume; uint8 m_nMusicFadeVolume;
uint8 m_nMonoMode; uint8 m_nMonoMode;
char _pad0[1]; char unk;
char m_szCDRomRootPath[80]; char m_szCDRomRootPath[80];
bool m_bInitialised; bool m_bInitialised;
uint8 m_nNumberOfProviders; uint8 m_nNumberOfProviders;

View file

@ -99,7 +99,7 @@ CPickup::GiveUsAPickUpObject(int32 handle)
switch (m_eType) switch (m_eType)
{ {
case PICKUP_IN_SHOP: case PICKUP_IN_SHOP:
object->m_obj_flag2 = true; object->bPickupObjWithMessage = true;
object->bOutOfStock = false; object->bOutOfStock = false;
break; break;
case PICKUP_ON_STREET: case PICKUP_ON_STREET:
@ -113,11 +113,11 @@ CPickup::GiveUsAPickUpObject(int32 handle)
case PICKUP_NAUTICAL_MINE_ARMED: case PICKUP_NAUTICAL_MINE_ARMED:
case PICKUP_FLOATINGPACKAGE: case PICKUP_FLOATINGPACKAGE:
case PICKUP_ON_STREET_SLOW: case PICKUP_ON_STREET_SLOW:
object->m_obj_flag2 = false; object->bPickupObjWithMessage = false;
object->bOutOfStock = false; object->bOutOfStock = false;
break; break;
case PICKUP_IN_SHOP_OUT_OF_STOCK: case PICKUP_IN_SHOP_OUT_OF_STOCK:
object->m_obj_flag2 = false; object->bPickupObjWithMessage = false;
object->bOutOfStock = true; object->bOutOfStock = true;
object->bRenderScorched = true; object->bRenderScorched = true;
break; break;
@ -690,7 +690,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
size, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); size, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
CObject *object = (CObject*)entity; CObject *object = (CObject*)entity;
if (object->m_obj_flag2 || object->bOutOfStock || object->m_nBonusValue) { if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
float dist = (TheCamera.GetPosition() - pos).Magnitude(); float dist = (TheCamera.GetPosition() - pos).Magnitude();
const float MAXDIST = 12.0f; const float MAXDIST = 12.0f;

View file

@ -8931,7 +8931,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); assert(pPed);
if (ScriptParams[1]) if (ScriptParams[1])
pPed->m_nZoneLevel = -1; pPed->m_nZoneLevel = LEVEL_IGNORE;
else else
pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(pPed->GetPosition()); pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(pPed->GetPosition());
return 0; return 0;
@ -9130,7 +9130,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); assert(pVehicle);
if (ScriptParams[1]) if (ScriptParams[1])
pVehicle->m_nZoneLevel = -1; pVehicle->m_nZoneLevel = LEVEL_IGNORE;
else else
pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(pVehicle->GetPosition()); pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(pVehicle->GetPosition());
return 0; return 0;

View file

@ -26,8 +26,7 @@ enum eEventType
EVENT_ICECREAM, EVENT_ICECREAM,
EVENT_ATM, EVENT_ATM,
EVENT_SHOPSTALL, // used on graffitis EVENT_SHOPSTALL, // used on graffitis
EVENT_SHOPWINDOW, EVENT_LAST_EVENT
EVENT_LAST_EVENT // may be above one
}; };
enum eEventEntity enum eEventEntity

View file

@ -2,6 +2,7 @@
enum eLevelName enum eLevelName
{ {
LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel
LEVEL_NONE = 0, LEVEL_NONE = 0,
LEVEL_INDUSTRIAL, LEVEL_INDUSTRIAL,
LEVEL_COMMERCIAL, LEVEL_COMMERCIAL,

View file

@ -548,10 +548,10 @@ CPlayerInfo::Process(void)
} }
if (FindPlayerVehicle()) { if (FindPlayerVehicle()) {
CVehicle *veh = FindPlayerVehicle(); CVehicle *veh = FindPlayerVehicle();
veh->m_nZoneLevel = -1; veh->m_nZoneLevel = LEVEL_IGNORE;
for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) { for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) {
if (veh->pPassengers[i]) if (veh->pPassengers[i])
veh->pPassengers[i]->m_nZoneLevel = 0; veh->pPassengers[i]->m_nZoneLevel = LEVEL_NONE;
} }
CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled; CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled;
} else { } else {

View file

@ -251,7 +251,7 @@ INITSAVEBUF
continue; continue;
if (pObject->ObjectCreatedBy == MISSION_OBJECT) { if (pObject->ObjectCreatedBy == MISSION_OBJECT) {
bool bIsPickup = pObject->bIsPickup; bool bIsPickup = pObject->bIsPickup;
bool bFlag2 = pObject->m_obj_flag2; bool bPickupObjWithMessage = pObject->bPickupObjWithMessage;
bool bOutOfStock = pObject->bOutOfStock; bool bOutOfStock = pObject->bOutOfStock;
bool bGlassCracked = pObject->bGlassCracked; bool bGlassCracked = pObject->bGlassCracked;
bool bGlassBroken = pObject->bGlassBroken; bool bGlassBroken = pObject->bGlassBroken;
@ -269,7 +269,7 @@ INITSAVEBUF
WriteSaveBuf(buf, (uint32)0); // same WriteSaveBuf(buf, (uint32)0); // same
WriteSaveBuf(buf, pObject->ObjectCreatedBy); WriteSaveBuf(buf, pObject->ObjectCreatedBy);
WriteSaveBuf(buf, bIsPickup); WriteSaveBuf(buf, bIsPickup);
WriteSaveBuf(buf, bFlag2); WriteSaveBuf(buf, bPickupObjWithMessage);
WriteSaveBuf(buf, bOutOfStock); WriteSaveBuf(buf, bOutOfStock);
WriteSaveBuf(buf, bGlassCracked); WriteSaveBuf(buf, bGlassCracked);
WriteSaveBuf(buf, bGlassBroken); WriteSaveBuf(buf, bGlassBroken);
@ -305,7 +305,7 @@ INITSAVEBUF
ReadSaveBuf<uint32>(buf); ReadSaveBuf<uint32>(buf);
pBufferObject->ObjectCreatedBy = ReadSaveBuf<int8>(buf); pBufferObject->ObjectCreatedBy = ReadSaveBuf<int8>(buf);
pBufferObject->bIsPickup = ReadSaveBuf<bool>(buf); pBufferObject->bIsPickup = ReadSaveBuf<bool>(buf);
pBufferObject->m_flagE2 = ReadSaveBuf<bool>(buf); pBufferObject->bPickupObjWithMessage = ReadSaveBuf<bool>(buf);
pBufferObject->bOutOfStock = ReadSaveBuf<bool>(buf); pBufferObject->bOutOfStock = ReadSaveBuf<bool>(buf);
pBufferObject->bGlassCracked = ReadSaveBuf<bool>(buf); pBufferObject->bGlassCracked = ReadSaveBuf<bool>(buf);
pBufferObject->bGlassBroken = ReadSaveBuf<bool>(buf); pBufferObject->bGlassBroken = ReadSaveBuf<bool>(buf);
@ -325,7 +325,7 @@ INITSAVEBUF
pObject->m_objectMatrix = pBufferObject->m_objectMatrix; pObject->m_objectMatrix = pBufferObject->m_objectMatrix;
pObject->ObjectCreatedBy = pBufferObject->ObjectCreatedBy; pObject->ObjectCreatedBy = pBufferObject->ObjectCreatedBy;
pObject->bIsPickup = pBufferObject->bIsPickup; pObject->bIsPickup = pBufferObject->bIsPickup;
pObject->m_flagE2 = pBufferObject->m_flagE2; pObject->bPickupObjWithMessage = pBufferObject->bPickupObjWithMessage;
pObject->bOutOfStock = pBufferObject->bOutOfStock; pObject->bOutOfStock = pBufferObject->bOutOfStock;
pObject->bGlassCracked = pBufferObject->bGlassCracked; pObject->bGlassCracked = pBufferObject->bGlassCracked;
pObject->bGlassBroken = pBufferObject->bGlassBroken; pObject->bGlassBroken = pBufferObject->bGlassBroken;

View file

@ -161,7 +161,7 @@ enum Config {
# define GTA3_1_1_PATCH # define GTA3_1_1_PATCH
//# define GTA3_STEAM_PATCH //# define GTA3_STEAM_PATCH
# ifdef GTA_PS2_STUFF # ifdef GTA_PS2_STUFF
//# define USE_PS2_RAND // this is unsafe until we have the game reversed # define USE_PS2_RAND
# define RANDOMSPLASH // use random splash as on PS2 # define RANDOMSPLASH // use random splash as on PS2
# define PS2_MATFX # define PS2_MATFX
# endif # endif

View file

@ -40,25 +40,25 @@ public:
uint32 m_status : 5; uint32 m_status : 5;
// flagsA // flagsA
uint32 bUsesCollision : 1; uint32 bUsesCollision : 1; // does entity use collision
uint32 bCollisionProcessed : 1; uint32 bCollisionProcessed : 1; // has object been processed by a ProcessEntityCollision function
uint32 bIsStatic : 1; uint32 bIsStatic : 1; // is entity static
uint32 bHasContacted : 1; uint32 bHasContacted : 1; // has entity processed some contact forces
uint32 bPedPhysics : 1; uint32 bPedPhysics : 1;
uint32 bIsStuck : 1; uint32 bIsStuck : 1; // is entity stuck
uint32 bIsInSafePosition : 1; uint32 bIsInSafePosition : 1; // is entity in a collision free safe position
uint32 bUseCollisionRecords : 1; uint32 bUseCollisionRecords : 1;
// flagsB // flagsB
uint32 bWasPostponed : 1; uint32 bWasPostponed : 1; // was entity control processing postponed
uint32 bExplosionProof : 1; uint32 bExplosionProof : 1;
uint32 bIsVisible : 1; uint32 bIsVisible : 1; //is the entity visible
uint32 bHasCollided : 1; // uint32 bHasCollided : 1;
uint32 bRenderScorched : 1; uint32 bRenderScorched : 1;
uint32 bHasBlip : 1; uint32 bHasBlip : 1;
uint32 bIsBIGBuilding : 1; uint32 bIsBIGBuilding : 1; // Set if this entity is a big building
// VC inserts one more flag here: if drawdist <= 2000 // VC inserts one more flag here: if drawdist <= 2000
uint32 bRenderDamaged : 1; uint32 bRenderDamaged : 1; // use damaged LOD models for objects with applicable damage
// flagsC // flagsC
uint32 bBulletProof : 1; uint32 bBulletProof : 1;
@ -66,22 +66,22 @@ public:
uint32 bCollisionProof : 1; uint32 bCollisionProof : 1;
uint32 bMeleeProof : 1; uint32 bMeleeProof : 1;
uint32 bOnlyDamagedByPlayer : 1; uint32 bOnlyDamagedByPlayer : 1;
uint32 bStreamingDontDelete : 1; uint32 bStreamingDontDelete : 1; // Dont let the streaming remove this
uint32 bZoneCulled : 1; uint32 bZoneCulled : 1;
uint32 bZoneCulled2 : 1; // only treadables+10m uint32 bZoneCulled2 : 1; // only treadables+10m
// flagsD // flagsD
uint32 bRemoveFromWorld : 1; uint32 bRemoveFromWorld : 1; // remove this entity next time it should be processed
uint32 bHasHitWall : 1; uint32 bHasHitWall : 1; // has collided with a building (changes subsequent collisions)
uint32 bImBeingRendered : 1; uint32 bImBeingRendered : 1; // don't delete me because I'm being rendered
uint32 bTouchingWater : 1; // used by cBuoyancy::ProcessBuoyancy uint32 bTouchingWater : 1; // used by cBuoyancy::ProcessBuoyancy
uint32 bIsSubway : 1; // set when subway, but maybe different meaning? uint32 bIsSubway : 1; // set when subway, but maybe different meaning?
uint32 bDrawLast : 1; uint32 bDrawLast : 1; // draw object last
uint32 bNoBrightHeadLights : 1; uint32 bNoBrightHeadLights : 1;
uint32 bDoNotRender : 1; uint32 bDoNotRender : 1;
// flagsE // flagsE
uint32 bDistanceFade : 1; uint32 bDistanceFade : 1; // Fade entity because it is far away
uint32 m_flagE2 : 1; uint32 m_flagE2 : 1;
uint16 m_scanCode; uint16 m_scanCode;

View file

@ -36,7 +36,7 @@ CPhysical::CPhysical(void)
for(i = 0; i < 6; i++) for(i = 0; i < 6; i++)
m_aCollisionRecords[i] = nil; m_aCollisionRecords[i] = nil;
field_EF = false; m_bIsVehicleBeingShifted = false;
m_nDamagePieceType = 0; m_nDamagePieceType = 0;
m_fDamageImpulse = 0.0f; m_fDamageImpulse = 0.0f;
@ -63,7 +63,7 @@ CPhysical::CPhysical(void)
m_phy_flagA10 = false; m_phy_flagA10 = false;
m_phy_flagA20 = false; m_phy_flagA20 = false;
m_nZoneLevel = 0; m_nZoneLevel = LEVEL_NONE;
} }
CPhysical::~CPhysical(void) CPhysical::~CPhysical(void)
@ -1767,13 +1767,13 @@ CPhysical::ProcessShift(void)
CWorld::AdvanceCurrentScanCode(); CWorld::AdvanceCurrentScanCode();
if(IsVehicle()) if(IsVehicle())
field_EF = true; m_bIsVehicleBeingShifted = true;
CEntryInfoNode *node; CEntryInfoNode *node;
bool hasshifted = false; // whatever that means... bool hasshifted = false; // whatever that means...
for(node = m_entryInfoList.first; node; node = node->next) for(node = m_entryInfoList.first; node; node = node->next)
hasshifted |= ProcessShiftSectorList(node->sector->m_lists); hasshifted |= ProcessShiftSectorList(node->sector->m_lists);
field_EF = false; m_bIsVehicleBeingShifted = false;
if(hasshifted){ if(hasshifted){
CWorld::AdvanceCurrentScanCode(); CWorld::AdvanceCurrentScanCode();
for(node = m_entryInfoList.first; node; node = node->next) for(node = m_entryInfoList.first; node; node = node->next)
@ -1799,7 +1799,7 @@ CPhysical::ProcessCollision(void)
CPed *ped = (CPed*)this; CPed *ped = (CPed*)this;
m_fDistanceTravelled = 0.0f; m_fDistanceTravelled = 0.0f;
field_EF = 0; m_bIsVehicleBeingShifted = false;
m_phy_flagA80 = false; m_phy_flagA80 = false;
if(!bUsesCollision){ if(!bUsesCollision){
@ -1912,7 +1912,7 @@ CPhysical::ProcessCollision(void)
ApplyMoveSpeed(); ApplyMoveSpeed();
ApplyTurnSpeed(); ApplyTurnSpeed();
GetMatrix().Reorthogonalise(); GetMatrix().Reorthogonalise();
field_EF = 0; m_bIsVehicleBeingShifted = false;
m_phy_flagA80 = false; m_phy_flagA80 = false;
if(!m_vecMoveSpeed.IsZero() || if(!m_vecMoveSpeed.IsZero() ||
!m_vecTurnSpeed.IsZero() || !m_vecTurnSpeed.IsZero() ||

View file

@ -40,7 +40,7 @@ public:
char field_EC; char field_EC;
uint8 m_nStaticFrames; uint8 m_nStaticFrames;
uint8 m_nCollisionRecords; uint8 m_nCollisionRecords;
bool field_EF; bool m_bIsVehicleBeingShifted;
CEntity *m_aCollisionRecords[PHYSICAL_MAX_COLLISIONRECORDS]; CEntity *m_aCollisionRecords[PHYSICAL_MAX_COLLISIONRECORDS];
float m_fDistanceTravelled; float m_fDistanceTravelled;
@ -55,8 +55,8 @@ public:
uint8 bAffectedByGravity : 1; uint8 bAffectedByGravity : 1;
uint8 bInfiniteMass : 1; uint8 bInfiniteMass : 1;
uint8 bIsInWater : 1; uint8 bIsInWater : 1;
uint8 m_phy_flagA10 : 1; uint8 m_phy_flagA10 : 1; // unused
uint8 m_phy_flagA20 : 1; uint8 m_phy_flagA20 : 1; // unused
uint8 bHitByTrain : 1; uint8 bHitByTrain : 1;
uint8 m_phy_flagA80 : 1; uint8 m_phy_flagA80 : 1;

View file

@ -35,7 +35,7 @@ CObject::CObject(void)
m_colour1 = m_colour2; m_colour1 = m_colour2;
m_nBonusValue = 0; m_nBonusValue = 0;
bIsPickup = false; bIsPickup = false;
m_obj_flag2 = false; bPickupObjWithMessage = false;
bOutOfStock = false; bOutOfStock = false;
bGlassCracked = false; bGlassCracked = false;
bGlassBroken = false; bGlassBroken = false;
@ -315,7 +315,7 @@ CObject::Init(void)
ObjectCreatedBy = GAME_OBJECT; ObjectCreatedBy = GAME_OBJECT;
bIsStatic = true; bIsStatic = true;
bIsPickup = false; bIsPickup = false;
m_obj_flag2 = false; bPickupObjWithMessage = false;
bOutOfStock = false; bOutOfStock = false;
bGlassCracked = false; bGlassCracked = false;
bGlassBroken = false; bGlassBroken = false;

View file

@ -47,13 +47,12 @@ public:
float m_fUprootLimit; float m_fUprootLimit;
int8 ObjectCreatedBy; int8 ObjectCreatedBy;
int8 bIsPickup : 1; int8 bIsPickup : 1;
int8 m_obj_flag2 : 1; int8 bPickupObjWithMessage : 1;
int8 bOutOfStock : 1; int8 bOutOfStock : 1;
int8 bGlassCracked : 1; int8 bGlassCracked : 1;
int8 bGlassBroken : 1; int8 bGlassBroken : 1;
int8 bHasBeenDamaged : 1; int8 bHasBeenDamaged : 1;
int8 bUseVehicleColours : 1; int8 bUseVehicleColours : 1;
int8 m_obj_flag80 : 1;
int8 m_nBonusValue; int8 m_nBonusValue;
float m_fCollisionDamageMultiplier; float m_fCollisionDamageMultiplier;
uint8 m_nCollisionDamageEffect; uint8 m_nCollisionDamageEffect;

View file

@ -63,7 +63,7 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
m_bIsInPursuit = false; m_bIsInPursuit = false;
field_1350 = 1; field_1350 = 1;
m_bIsDisabledCop = false; m_bIsDisabledCop = false;
field_1356 = 0; m_fAbseilPos = 0.0f;
m_attackTimer = 0; m_attackTimer = 0;
m_bBeatingSuspect = false; m_bBeatingSuspect = false;
m_bStopAndShootDisabledZone = false; m_bStopAndShootDisabledZone = false;
@ -668,11 +668,13 @@ CCopPed::ProcessControl(void)
} }
if (bDuckAndCover) { if (bDuckAndCover) {
#if !defined(GTA3_1_1_PATCH) && !defined(VC_PED_PORTS)
if (!bNotAllowedToDuck && Seek()) { if (!bNotAllowedToDuck && Seek()) {
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
SetMoveAnim(); SetMoveAnim();
SetPointGunAt(m_pedInObjective); SetPointGunAt(m_pedInObjective);
} }
#endif
} else if (Seek()) { } else if (Seek()) {
CVehicle *playerVeh = FindPlayerVehicle(); CVehicle *playerVeh = FindPlayerVehicle();
if (!playerVeh && player && player->EnteringCar()) { if (!playerVeh && player && player->EnteringCar()) {

View file

@ -20,12 +20,9 @@ public:
bool m_bBeatingSuspect; bool m_bBeatingSuspect;
bool m_bStopAndShootDisabledZone; bool m_bStopAndShootDisabledZone;
bool m_bZoneDisabled; bool m_bZoneDisabled;
int32 field_1356; float m_fAbseilPos; // VC leftover, unused
eCopType m_nCopType; eCopType m_nCopType;
int8 field_1364; int8 field_1364;
int8 field_1365;
int8 field_1366;
int8 field_1367;
CCopPed(eCopType); CCopPed(eCopType);
~CCopPed(); ~CCopPed();

View file

@ -22,13 +22,12 @@ enum EmergencyPedState
class CEmergencyPed : public CPed class CEmergencyPed : public CPed
{ {
public: public:
// 0x53C
CPed *m_pRevivedPed; CPed *m_pRevivedPed;
EmergencyPedState m_nEmergencyPedState; EmergencyPedState m_nEmergencyPedState;
CAccident *m_pAttendedAccident; CAccident *m_pAttendedAccident;
CFire *m_pAttendedFire; CFire *m_pAttendedFire;
bool m_bStartedToCPR; // set but unused(?) bool m_bStartedToCPR; // set but unused
int32 field_1360; // also something for medics, unused(?) int32 field_1360; // set to 0 but unused
CEmergencyPed(uint32); CEmergencyPed(uint32);
~CEmergencyPed() { } ~CEmergencyPed() { }

View file

@ -9191,8 +9191,11 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->QuitEnteringCar(); ped->QuitEnteringCar();
return; return;
} }
bool itsVan = veh->bIsVan; bool itsVan = !!veh->bIsVan;
bool itsBus = veh->bIsBus; bool itsBus = !!veh->bIsBus;
#ifdef FIX_BUGS
bool itsLow = !!veh->bLowVehicle;
#endif
eDoors enterDoor; eDoors enterDoor;
AnimationId enterAnim; AnimationId enterAnim;
@ -9227,6 +9230,10 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
enterAnim = ANIM_VAN_GETIN; enterAnim = ANIM_VAN_GETIN;
} else if (itsBus) { } else if (itsBus) {
enterAnim = ANIM_COACH_IN_R; enterAnim = ANIM_COACH_IN_R;
#ifdef FIX_BUGS
} else if (itsLow) {
enterAnim = ANIM_CAR_GETIN_LOW_RHS;
#endif
} else { } else {
enterAnim = ANIM_CAR_GETIN_RHS; enterAnim = ANIM_CAR_GETIN_RHS;
} }
@ -9234,6 +9241,10 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
enterAnim = ANIM_VAN_GETIN_L; enterAnim = ANIM_VAN_GETIN_L;
} else if (itsBus) { } else if (itsBus) {
enterAnim = ANIM_COACH_IN_L; enterAnim = ANIM_COACH_IN_L;
#ifdef FIX_BUGS
} else if (itsLow) {
enterAnim = ANIM_CAR_GETIN_LOW_LHS;
#endif
} else { } else {
enterAnim = ANIM_CAR_GETIN_LHS; enterAnim = ANIM_CAR_GETIN_LHS;
} }
@ -10806,6 +10817,11 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
} }
} }
#ifdef CANCELLABLE_CAR_ENTER
if (!veh->IsDoorMissing(door) && veh->CanPedOpenLocks(ped) && veh->IsCar()) {
((CAutomobile*)veh)->Damage.SetDoorStatus(door, DOOR_STATUS_SWINGING);
}
#endif
ped->QuitEnteringCar(); ped->QuitEnteringCar();
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
ped->bCancelEnteringCar = false; ped->bCancelEnteringCar = false;
@ -14492,7 +14508,8 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (collidingEnt->IsVehicle() && ((CVehicle*)collidingEnt)->IsBoat()) if (collidingEnt->IsVehicle() && ((CVehicle*)collidingEnt)->IsBoat())
collidedWithBoat = true; collidedWithBoat = true;
if (!field_EF && !m_phy_flagA80 // ofc we're not vehicle
if (!m_bIsVehicleBeingShifted && !m_phy_flagA80
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
&& !collidingEnt->IsPed() && !collidingEnt->IsPed()
#endif #endif
@ -15259,7 +15276,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
{ {
uint32 optedDoorNode = wantedDoorNode; uint32 optedDoorNode = wantedDoorNode;
bool teleportNeeded = false; bool teleportNeeded = false;
bool isLow = veh->bLowVehicle; bool isLow = !!veh->bLowVehicle;
if (!veh->CanPedExitCar()) { if (!veh->CanPedExitCar()) {
if (veh->pDriver && !veh->pDriver->IsPlayer()) { if (veh->pDriver && !veh->pDriver->IsPlayer()) {
veh->AutoPilot.m_nCruiseSpeed = 0; veh->AutoPilot.m_nCruiseSpeed = 0;

View file

@ -435,7 +435,7 @@ public:
float m_fRotationCur; float m_fRotationCur;
float m_fRotationDest; float m_fRotationDest;
float m_headingRate; float m_headingRate;
uint16 m_vehEnterType; // TODO: this is more like a door, not a type uint16 m_vehEnterType;
int16 m_walkAroundType; int16 m_walkAroundType;
CPhysical *m_pCurrentPhysSurface; CPhysical *m_pCurrentPhysSurface;
CVector m_vecOffsetFromPhysSurface; CVector m_vecOffsetFromPhysSurface;

View file

@ -159,12 +159,12 @@ void CMovingThings::Update()
int block = CTimer::GetFrameCounter() % TIME_SPAN; int block = CTimer::GetFrameCounter() % TIME_SPAN;
for (i = (block * NUMMOVINGTHINGS) / TIME_SPAN; i < ((block + 1) * NUMMOVINGTHINGS) / TIME_SPAN; i++) { for (i = (block * NUMMOVINGTHINGS) / TIME_SPAN; i < ((block + 1) * NUMMOVINGTHINGS) / TIME_SPAN; i++) {
if (aMovingThings[i].field_A == 1) if (aMovingThings[i].m_nHidden == 1)
aMovingThings[i].Update(); aMovingThings[i].Update();
} }
for (i = 0; i < CMovingThings::Num; i++) { for (i = 0; i < CMovingThings::Num; i++) {
if (aMovingThings[i].field_A == 0) if (aMovingThings[i].m_nHidden == 0)
aMovingThings[i].Update(); aMovingThings[i].Update();
} }
@ -212,14 +212,14 @@ void CMovingThing::Update()
m_pEntity->UpdateRwFrame(); m_pEntity->UpdateRwFrame();
if (SQR(m_pEntity->GetPosition().x - TheCamera.GetPosition().x) + SQR(m_pEntity->GetPosition().y - TheCamera.GetPosition().y) < 40000.0f) { if (SQR(m_pEntity->GetPosition().x - TheCamera.GetPosition().x) + SQR(m_pEntity->GetPosition().y - TheCamera.GetPosition().y) < 40000.0f) {
if (field_A == 1) { if (m_nHidden == 1) {
AddToList(&CMovingThings::StartCloseList); AddToList(&CMovingThings::StartCloseList);
field_A = 0; m_nHidden = 0;
} }
} else { } else {
if (field_A == 0) { if (m_nHidden == 0) {
RemoveFromList(); RemoveFromList();
field_A = 1; m_nHidden = 1;
} }
} }
} }

View file

@ -8,7 +8,7 @@ public:
CMovingThing *m_pNext; CMovingThing *m_pNext;
CMovingThing *m_pPrev; CMovingThing *m_pPrev;
int16 m_nType; int16 m_nType;
int16 field_A; int16 m_nHidden;
CVector m_vecPosn; CVector m_vecPosn;
CEntity* m_pEntity; CEntity* m_pEntity;

View file

@ -90,7 +90,7 @@ public:
static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize); static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize);
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
#ifndef MASTER #ifdef TOGGLEABLE_BETA_FEATURES
static bool bEnableBannedParticles; static bool bEnableBannedParticles;
#endif #endif
}; };

View file

@ -98,7 +98,7 @@ CPager::AddMessage(wchar *str, uint16 speed, uint16 priority, uint16 a5)
m_messages[i].m_pText = str; m_messages[i].m_pText = str;
m_messages[i].m_nSpeedMs = speed; m_messages[i].m_nSpeedMs = speed;
m_messages[i].m_nPriority = priority; m_messages[i].m_nPriority = priority;
m_messages[i].field_10 = a5; m_messages[i].unused = a5;
m_messages[i].m_nCurrentPosition = -(m_nNumDisplayLetters + 10); m_messages[i].m_nCurrentPosition = -(m_nNumDisplayLetters + 10);
m_messages[i].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed; m_messages[i].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed;
m_messages[i].m_nStringLength = size; m_messages[i].m_nStringLength = size;
@ -142,7 +142,7 @@ CPager::AddMessageWithNumber(wchar *str, int32 n1, int32 n2, int32 n3, int32 n4,
m_messages[i].m_pText = str; m_messages[i].m_pText = str;
m_messages[i].m_nSpeedMs = speed; m_messages[i].m_nSpeedMs = speed;
m_messages[i].m_nPriority = priority; m_messages[i].m_nPriority = priority;
m_messages[i].field_10 = a11; m_messages[i].unused = a11;
m_messages[i].m_nCurrentPosition = -(m_nNumDisplayLetters + 10); m_messages[i].m_nCurrentPosition = -(m_nNumDisplayLetters + 10);
m_messages[i].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed; m_messages[i].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed;
m_messages[i].m_nStringLength = size; m_messages[i].m_nStringLength = size;

View file

@ -7,7 +7,7 @@ struct PagerMessage {
uint16 m_nStringLength; uint16 m_nStringLength;
uint16 m_nPriority; uint16 m_nPriority;
uint32 m_nTimeToChangePosition; uint32 m_nTimeToChangePosition;
int16 field_10; int16 unused; // but still set in SCM. importance? ringtone?
int32 m_nNumber[6]; int32 m_nNumber[6];
}; };

View file

@ -562,7 +562,7 @@ CAutomobile::ProcessControl(void)
bWasPostponed = false; bWasPostponed = false;
bHasHitWall = false; bHasHitWall = false;
m_fDistanceTravelled = 0.0f; m_fDistanceTravelled = 0.0f;
field_EF = false; m_bIsVehicleBeingShifted = false;
m_phy_flagA80 = false; m_phy_flagA80 = false;
ApplyMoveSpeed(); ApplyMoveSpeed();
ApplyTurnSpeed(); ApplyTurnSpeed();
@ -2148,7 +2148,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
// m_aSuspensionSpringRatio are now set to the point where the tyre touches ground. // m_aSuspensionSpringRatio are now set to the point where the tyre touches ground.
// In ProcessControl these will be re-normalized to ignore the tyre radius. // In ProcessControl these will be re-normalized to ignore the tyre radius.
if(field_EF || m_phy_flagA80 || if(m_bIsVehicleBeingShifted || m_phy_flagA80 ||
GetModelIndex() == MI_DODO && (ent->IsPed() || ent->IsVehicle())){ GetModelIndex() == MI_DODO && (ent->IsPed() || ent->IsVehicle())){
// don't do line collision // don't do line collision
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)

View file

@ -101,7 +101,7 @@ struct tHandlingData
float fSteeringLock; float fSteeringLock;
float fTractionLoss; float fTractionLoss;
float fTractionBias; float fTractionBias;
uint32 field_AC; float fABS; // should be VC leftover
float fSuspensionForceLevel; float fSuspensionForceLevel;
float fSuspensionDampingLevel; float fSuspensionDampingLevel;
float fSuspensionUpperLimit; float fSuspensionUpperLimit;
@ -126,7 +126,7 @@ private:
float field_C; // unused it seems float field_C; // unused it seems
float field_10; // float field_10; //
tHandlingData HandlingData[NUMHANDLINGS]; tHandlingData HandlingData[NUMHANDLINGS];
uint32 field_302C; // unused it seems, padding? uint32 field_302C; // unused it seems
public: public:
cHandlingDataMgr(void); cHandlingDataMgr(void);

View file

@ -65,7 +65,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
m_nNumGettingIn = 0; m_nNumGettingIn = 0;
m_nGettingInFlags = 0; m_nGettingInFlags = 0;
m_nGettingOutFlags = 0; m_nGettingOutFlags = 0;
m_nNumMaxPassengers = 8; m_nNumMaxPassengers = ARRAY_SIZE(pPassengers);
for(i = 0; i < m_nNumMaxPassengers; i++) for(i = 0; i < m_nNumMaxPassengers; i++)
pPassengers[i] = nil; pPassengers[i] = nil;
m_nBombTimer = 0; m_nBombTimer = 0;
@ -101,7 +101,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
m_nLastWeaponDamage = -1; m_nLastWeaponDamage = -1;
m_fMapObjectHeightAhead = m_fMapObjectHeightBehind = 0.0f; m_fMapObjectHeightAhead = m_fMapObjectHeightBehind = 0.0f;
m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this); m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this);
if(m_audioEntityId) if(m_audioEntityId >= 0)
DMAudio.SetEntityStatus(m_audioEntityId, true); DMAudio.SetEntityStatus(m_audioEntityId, true);
m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK; m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK;
m_pCurGroundEntity = nil; m_pCurGroundEntity = nil;
@ -728,7 +728,7 @@ CVehicle::CanBeDeleted(void)
return false; return false;
} }
for(i = 0; i < 8; i++){ for(i = 0; i < ARRAY_SIZE(pPassengers); i++){
// Same check as above // Same check as above
if(pPassengers[i]){ if(pPassengers[i]){
if(pPassengers[i]->CharCreatedBy == MISSION_CHAR) if(pPassengers[i]->CharCreatedBy == MISSION_CHAR)
@ -941,7 +941,7 @@ void
CVehicle::RemovePassenger(CPed *p) CVehicle::RemovePassenger(CPed *p)
{ {
if (IsTrain()){ if (IsTrain()){
for (int i = 0; i < 8; i++){ for (int i = 0; i < ARRAY_SIZE(pPassengers); i++){
if (pPassengers[i] == p) { if (pPassengers[i] == p) {
pPassengers[i] = nil; pPassengers[i] = nil;
m_nNumPassengers--; m_nNumPassengers--;

View file

@ -38,7 +38,6 @@ public:
uint8 m_b1stPerson : 1; uint8 m_b1stPerson : 1;
uint8 m_bHeavy : 1; uint8 m_bHeavy : 1;
uint8 m_bThrow : 1; uint8 m_bThrow : 1;
uint8 stuff;
static void Initialise(void); static void Initialise(void);
static void LoadWeaponData(void); static void LoadWeaponData(void);