diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-04-19 16:38:48 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-04-19 16:38:48 +0200 |
commit | df376a13ea8dac7ecff2aabe7d715774bcc7c294 (patch) | |
tree | dc4c0230c14bce31044813c8dc4048a837c0c278 | |
parent | 1.1 patch stuff (diff) | |
parent | Merge pull request #474 from Nick007J/master (diff) | |
download | re3-df376a13ea8dac7ecff2aabe7d715774bcc7c294.tar re3-df376a13ea8dac7ecff2aabe7d715774bcc7c294.tar.gz re3-df376a13ea8dac7ecff2aabe7d715774bcc7c294.tar.bz2 re3-df376a13ea8dac7ecff2aabe7d715774bcc7c294.tar.lz re3-df376a13ea8dac7ecff2aabe7d715774bcc7c294.tar.xz re3-df376a13ea8dac7ecff2aabe7d715774bcc7c294.tar.zst re3-df376a13ea8dac7ecff2aabe7d715774bcc7c294.zip |
-rw-r--r-- | src/audio/sampman.h | 2 | ||||
-rw-r--r-- | src/control/Pickups.cpp | 8 | ||||
-rw-r--r-- | src/control/Script.cpp | 4 | ||||
-rw-r--r-- | src/core/EventList.h | 3 | ||||
-rw-r--r-- | src/core/Game.h | 1 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp | 4 | ||||
-rw-r--r-- | src/core/Pools.cpp | 8 | ||||
-rw-r--r-- | src/core/config.h | 2 | ||||
-rw-r--r-- | src/entities/Entity.h | 36 | ||||
-rw-r--r-- | src/entities/Physical.cpp | 12 | ||||
-rw-r--r-- | src/entities/Physical.h | 6 | ||||
-rw-r--r-- | src/objects/Object.cpp | 4 | ||||
-rw-r--r-- | src/objects/Object.h | 3 | ||||
-rw-r--r-- | src/peds/CopPed.cpp | 4 | ||||
-rw-r--r-- | src/peds/CopPed.h | 5 | ||||
-rw-r--r-- | src/peds/EmergencyPed.h | 5 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 25 | ||||
-rw-r--r-- | src/peds/Ped.h | 2 | ||||
-rw-r--r-- | src/render/Fluff.cpp | 12 | ||||
-rw-r--r-- | src/render/Fluff.h | 2 | ||||
-rw-r--r-- | src/render/Particle.h | 2 | ||||
-rw-r--r-- | src/save/GenericGameStorage.cpp | 16 | ||||
-rw-r--r-- | src/text/Pager.cpp | 4 | ||||
-rw-r--r-- | src/text/Pager.h | 2 | ||||
-rw-r--r-- | src/vehicles/Automobile.cpp | 4 | ||||
-rw-r--r-- | src/vehicles/HandlingMgr.h | 4 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 8 | ||||
-rw-r--r-- | src/weapons/WeaponInfo.h | 1 |
28 files changed, 104 insertions, 85 deletions
diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 4f3c3eeb..ebedfb63 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -45,7 +45,7 @@ class cSampleManager uint8 m_nEffectsFadeVolume; uint8 m_nMusicFadeVolume; uint8 m_nMonoMode; - char _pad0[1]; + char unk; char m_szCDRomRootPath[80]; bool m_bInitialised; uint8 m_nNumberOfProviders; diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 9836c9c2..f9605ca6 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -99,7 +99,7 @@ CPickup::GiveUsAPickUpObject(int32 handle) switch (m_eType) { case PICKUP_IN_SHOP: - object->m_obj_flag2 = true; + object->bPickupObjWithMessage = true; object->bOutOfStock = false; break; case PICKUP_ON_STREET: @@ -113,11 +113,11 @@ CPickup::GiveUsAPickUpObject(int32 handle) case PICKUP_NAUTICAL_MINE_ARMED: case PICKUP_FLOATINGPACKAGE: case PICKUP_ON_STREET_SLOW: - object->m_obj_flag2 = false; + object->bPickupObjWithMessage = false; object->bOutOfStock = false; break; case PICKUP_IN_SHOP_OUT_OF_STOCK: - object->m_obj_flag2 = false; + object->bPickupObjWithMessage = false; object->bOutOfStock = true; object->bRenderScorched = true; 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); 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(); const float MAXDIST = 12.0f; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index f1cc8ede..bfe2de34 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -8931,7 +8931,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); if (ScriptParams[1]) - pPed->m_nZoneLevel = -1; + pPed->m_nZoneLevel = LEVEL_IGNORE; else pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(pPed->GetPosition()); return 0; @@ -9130,7 +9130,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); if (ScriptParams[1]) - pVehicle->m_nZoneLevel = -1; + pVehicle->m_nZoneLevel = LEVEL_IGNORE; else pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(pVehicle->GetPosition()); return 0; diff --git a/src/core/EventList.h b/src/core/EventList.h index 1c03c9d6..8840afc4 100644 --- a/src/core/EventList.h +++ b/src/core/EventList.h @@ -26,8 +26,7 @@ enum eEventType EVENT_ICECREAM, EVENT_ATM, EVENT_SHOPSTALL, // used on graffitis - EVENT_SHOPWINDOW, - EVENT_LAST_EVENT // may be above one + EVENT_LAST_EVENT }; enum eEventEntity diff --git a/src/core/Game.h b/src/core/Game.h index 8dc73e8a..e3f0f616 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -2,6 +2,7 @@ enum eLevelName { + LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel LEVEL_NONE = 0, LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 1c641be3..69b8b7bf 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -556,10 +556,10 @@ CPlayerInfo::Process(void) } if (FindPlayerVehicle()) { CVehicle *veh = FindPlayerVehicle(); - veh->m_nZoneLevel = -1; + veh->m_nZoneLevel = LEVEL_IGNORE; for (int i = 0; i < ARRAY_SIZE(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; } else { diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index dfc6974a..fb64c551 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -251,7 +251,7 @@ INITSAVEBUF continue; if (pObject->ObjectCreatedBy == MISSION_OBJECT) { bool bIsPickup = pObject->bIsPickup; - bool bFlag2 = pObject->m_obj_flag2; + bool bPickupObjWithMessage = pObject->bPickupObjWithMessage; bool bOutOfStock = pObject->bOutOfStock; bool bGlassCracked = pObject->bGlassCracked; bool bGlassBroken = pObject->bGlassBroken; @@ -269,7 +269,7 @@ INITSAVEBUF WriteSaveBuf(buf, (uint32)0); // same WriteSaveBuf(buf, pObject->ObjectCreatedBy); WriteSaveBuf(buf, bIsPickup); - WriteSaveBuf(buf, bFlag2); + WriteSaveBuf(buf, bPickupObjWithMessage); WriteSaveBuf(buf, bOutOfStock); WriteSaveBuf(buf, bGlassCracked); WriteSaveBuf(buf, bGlassBroken); @@ -305,7 +305,7 @@ INITSAVEBUF ReadSaveBuf<uint32>(buf); pBufferObject->ObjectCreatedBy = ReadSaveBuf<int8>(buf); pBufferObject->bIsPickup = ReadSaveBuf<bool>(buf); - pBufferObject->m_flagE2 = ReadSaveBuf<bool>(buf); + pBufferObject->bPickupObjWithMessage = ReadSaveBuf<bool>(buf); pBufferObject->bOutOfStock = ReadSaveBuf<bool>(buf); pBufferObject->bGlassCracked = ReadSaveBuf<bool>(buf); pBufferObject->bGlassBroken = ReadSaveBuf<bool>(buf); @@ -325,7 +325,7 @@ INITSAVEBUF pObject->m_objectMatrix = pBufferObject->m_objectMatrix; pObject->ObjectCreatedBy = pBufferObject->ObjectCreatedBy; pObject->bIsPickup = pBufferObject->bIsPickup; - pObject->m_flagE2 = pBufferObject->m_flagE2; + pObject->bPickupObjWithMessage = pBufferObject->bPickupObjWithMessage; pObject->bOutOfStock = pBufferObject->bOutOfStock; pObject->bGlassCracked = pBufferObject->bGlassCracked; pObject->bGlassBroken = pBufferObject->bGlassBroken; diff --git a/src/core/config.h b/src/core/config.h index 12e6ed69..4ca79cb5 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -161,7 +161,7 @@ enum Config { # define GTA3_1_1_PATCH //# define GTA3_STEAM_PATCH # 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 PS2_MATFX # endif diff --git a/src/entities/Entity.h b/src/entities/Entity.h index dadeee54..8c2634f3 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -40,25 +40,25 @@ public: uint32 m_status : 5; // flagsA - uint32 bUsesCollision : 1; - uint32 bCollisionProcessed : 1; - uint32 bIsStatic : 1; - uint32 bHasContacted : 1; + uint32 bUsesCollision : 1; // does entity use collision + uint32 bCollisionProcessed : 1; // has object been processed by a ProcessEntityCollision function + uint32 bIsStatic : 1; // is entity static + uint32 bHasContacted : 1; // has entity processed some contact forces uint32 bPedPhysics : 1; - uint32 bIsStuck : 1; - uint32 bIsInSafePosition : 1; + uint32 bIsStuck : 1; // is entity stuck + uint32 bIsInSafePosition : 1; // is entity in a collision free safe position uint32 bUseCollisionRecords : 1; // flagsB - uint32 bWasPostponed : 1; + uint32 bWasPostponed : 1; // was entity control processing postponed uint32 bExplosionProof : 1; - uint32 bIsVisible : 1; - uint32 bHasCollided : 1; // + uint32 bIsVisible : 1; //is the entity visible + uint32 bHasCollided : 1; uint32 bRenderScorched : 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 - uint32 bRenderDamaged : 1; + uint32 bRenderDamaged : 1; // use damaged LOD models for objects with applicable damage // flagsC uint32 bBulletProof : 1; @@ -66,22 +66,22 @@ public: uint32 bCollisionProof : 1; uint32 bMeleeProof : 1; uint32 bOnlyDamagedByPlayer : 1; - uint32 bStreamingDontDelete : 1; + uint32 bStreamingDontDelete : 1; // Dont let the streaming remove this uint32 bZoneCulled : 1; - uint32 bZoneCulled2 : 1; // only treadables+10m + uint32 bZoneCulled2 : 1; // only treadables+10m // flagsD - uint32 bRemoveFromWorld : 1; - uint32 bHasHitWall : 1; - uint32 bImBeingRendered : 1; + uint32 bRemoveFromWorld : 1; // remove this entity next time it should be processed + uint32 bHasHitWall : 1; // has collided with a building (changes subsequent collisions) + uint32 bImBeingRendered : 1; // don't delete me because I'm being rendered uint32 bTouchingWater : 1; // used by cBuoyancy::ProcessBuoyancy uint32 bIsSubway : 1; // set when subway, but maybe different meaning? - uint32 bDrawLast : 1; + uint32 bDrawLast : 1; // draw object last uint32 bNoBrightHeadLights : 1; uint32 bDoNotRender : 1; // flagsE - uint32 bDistanceFade : 1; + uint32 bDistanceFade : 1; // Fade entity because it is far away uint32 m_flagE2 : 1; uint16 m_scanCode; diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index e2099945..df3da822 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -36,7 +36,7 @@ CPhysical::CPhysical(void) for(i = 0; i < 6; i++) m_aCollisionRecords[i] = nil; - field_EF = false; + m_bIsVehicleBeingShifted = false; m_nDamagePieceType = 0; m_fDamageImpulse = 0.0f; @@ -63,7 +63,7 @@ CPhysical::CPhysical(void) m_phy_flagA10 = false; m_phy_flagA20 = false; - m_nZoneLevel = 0; + m_nZoneLevel = LEVEL_NONE; } CPhysical::~CPhysical(void) @@ -1771,13 +1771,13 @@ CPhysical::ProcessShift(void) CWorld::AdvanceCurrentScanCode(); if(IsVehicle()) - field_EF = true; + m_bIsVehicleBeingShifted = true; CEntryInfoNode *node; bool hasshifted = false; // whatever that means... for(node = m_entryInfoList.first; node; node = node->next) hasshifted |= ProcessShiftSectorList(node->sector->m_lists); - field_EF = false; + m_bIsVehicleBeingShifted = false; if(hasshifted){ CWorld::AdvanceCurrentScanCode(); for(node = m_entryInfoList.first; node; node = node->next) @@ -1803,7 +1803,7 @@ CPhysical::ProcessCollision(void) CPed *ped = (CPed*)this; m_fDistanceTravelled = 0.0f; - field_EF = 0; + m_bIsVehicleBeingShifted = false; m_phy_flagA80 = false; if(!bUsesCollision){ @@ -1916,7 +1916,7 @@ CPhysical::ProcessCollision(void) ApplyMoveSpeed(); ApplyTurnSpeed(); GetMatrix().Reorthogonalise(); - field_EF = 0; + m_bIsVehicleBeingShifted = false; m_phy_flagA80 = false; if(!m_vecMoveSpeed.IsZero() || !m_vecTurnSpeed.IsZero() || diff --git a/src/entities/Physical.h b/src/entities/Physical.h index 6fbc3ffd..fa5ada05 100644 --- a/src/entities/Physical.h +++ b/src/entities/Physical.h @@ -40,7 +40,7 @@ public: char field_EC; uint8 m_nStaticFrames; uint8 m_nCollisionRecords; - bool field_EF; + bool m_bIsVehicleBeingShifted; CEntity *m_aCollisionRecords[PHYSICAL_MAX_COLLISIONRECORDS]; float m_fDistanceTravelled; @@ -55,8 +55,8 @@ public: uint8 bAffectedByGravity : 1; uint8 bInfiniteMass : 1; uint8 bIsInWater : 1; - uint8 m_phy_flagA10 : 1; - uint8 m_phy_flagA20 : 1; + uint8 m_phy_flagA10 : 1; // unused + uint8 m_phy_flagA20 : 1; // unused uint8 bHitByTrain : 1; uint8 m_phy_flagA80 : 1; diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 8968c117..d03dd405 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -35,7 +35,7 @@ CObject::CObject(void) m_colour1 = m_colour2; m_nBonusValue = 0; bIsPickup = false; - m_obj_flag2 = false; + bPickupObjWithMessage = false; bOutOfStock = false; bGlassCracked = false; bGlassBroken = false; @@ -315,7 +315,7 @@ CObject::Init(void) ObjectCreatedBy = GAME_OBJECT; bIsStatic = true; bIsPickup = false; - m_obj_flag2 = false; + bPickupObjWithMessage = false; bOutOfStock = false; bGlassCracked = false; bGlassBroken = false; diff --git a/src/objects/Object.h b/src/objects/Object.h index 081c285a..319ec4bc 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -47,13 +47,12 @@ public: float m_fUprootLimit; int8 ObjectCreatedBy; int8 bIsPickup : 1; - int8 m_obj_flag2 : 1; + int8 bPickupObjWithMessage : 1; int8 bOutOfStock : 1; int8 bGlassCracked : 1; int8 bGlassBroken : 1; int8 bHasBeenDamaged : 1; int8 bUseVehicleColours : 1; - int8 m_obj_flag80 : 1; int8 m_nBonusValue; float m_fCollisionDamageMultiplier; uint8 m_nCollisionDamageEffect; diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index 63811eae..81c9fa6e 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -63,7 +63,7 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP) m_bIsInPursuit = false; field_1350 = 1; m_bIsDisabledCop = false; - field_1356 = 0; + m_fAbseilPos = 0.0f; m_attackTimer = 0; m_bBeatingSuspect = false; m_bStopAndShootDisabledZone = false; @@ -668,7 +668,7 @@ CCopPed::ProcessControl(void) } if (bDuckAndCover) { -#ifndef GTA3_1_1_PATCH +#if !defined(GTA3_1_1_PATCH) && !defined(VC_PED_PORTS) if (!bNotAllowedToDuck && Seek()) { SetMoveState(PEDMOVE_STILL); SetMoveAnim(); diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h index 62234b7e..e3454875 100644 --- a/src/peds/CopPed.h +++ b/src/peds/CopPed.h @@ -20,12 +20,9 @@ public: bool m_bBeatingSuspect; bool m_bStopAndShootDisabledZone; bool m_bZoneDisabled; - int32 field_1356; + float m_fAbseilPos; // VC leftover, unused eCopType m_nCopType; int8 field_1364; - int8 field_1365; - int8 field_1366; - int8 field_1367; CCopPed(eCopType); ~CCopPed(); diff --git a/src/peds/EmergencyPed.h b/src/peds/EmergencyPed.h index 5693e908..6546e902 100644 --- a/src/peds/EmergencyPed.h +++ b/src/peds/EmergencyPed.h @@ -22,13 +22,12 @@ enum EmergencyPedState class CEmergencyPed : public CPed { public: - // 0x53C CPed *m_pRevivedPed; EmergencyPedState m_nEmergencyPedState; CAccident *m_pAttendedAccident; CFire *m_pAttendedFire; - bool m_bStartedToCPR; // set but unused(?) - int32 field_1360; // also something for medics, unused(?) + bool m_bStartedToCPR; // set but unused + int32 field_1360; // set to 0 but unused CEmergencyPed(uint32); ~CEmergencyPed() { } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 1f1930d7..915c5d35 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -9191,8 +9191,11 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) ped->QuitEnteringCar(); return; } - bool itsVan = veh->bIsVan; - bool itsBus = veh->bIsBus; + bool itsVan = !!veh->bIsVan; + bool itsBus = !!veh->bIsBus; +#ifdef FIX_BUGS + bool itsLow = !!veh->bLowVehicle; +#endif eDoors enterDoor; AnimationId enterAnim; @@ -9227,6 +9230,10 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) enterAnim = ANIM_VAN_GETIN; } else if (itsBus) { enterAnim = ANIM_COACH_IN_R; +#ifdef FIX_BUGS + } else if (itsLow) { + enterAnim = ANIM_CAR_GETIN_LOW_RHS; +#endif } else { enterAnim = ANIM_CAR_GETIN_RHS; } @@ -9234,6 +9241,10 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) enterAnim = ANIM_VAN_GETIN_L; } else if (itsBus) { enterAnim = ANIM_COACH_IN_L; +#ifdef FIX_BUGS + } else if (itsLow) { + enterAnim = ANIM_CAR_GETIN_LOW_LHS; +#endif } else { 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->RestorePreviousObjective(); ped->bCancelEnteringCar = false; @@ -14492,7 +14508,8 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints) if (collidingEnt->IsVehicle() && ((CVehicle*)collidingEnt)->IsBoat()) collidedWithBoat = true; - if (!field_EF && !m_phy_flagA80 + // ofc we're not vehicle + if (!m_bIsVehicleBeingShifted && !m_phy_flagA80 #ifdef VC_PED_PORTS && !collidingEnt->IsPed() #endif @@ -15259,7 +15276,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) { uint32 optedDoorNode = wantedDoorNode; bool teleportNeeded = false; - bool isLow = veh->bLowVehicle; + bool isLow = !!veh->bLowVehicle; if (!veh->CanPedExitCar()) { if (veh->pDriver && !veh->pDriver->IsPlayer()) { veh->AutoPilot.m_nCruiseSpeed = 0; diff --git a/src/peds/Ped.h b/src/peds/Ped.h index fc53e4bc..90e16269 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -435,7 +435,7 @@ public: float m_fRotationCur; float m_fRotationDest; float m_headingRate; - uint16 m_vehEnterType; // TODO: this is more like a door, not a type + uint16 m_vehEnterType; int16 m_walkAroundType; CPhysical *m_pCurrentPhysSurface; CVector m_vecOffsetFromPhysSurface; diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index e068747e..9f3f6929 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -159,12 +159,12 @@ void CMovingThings::Update() int block = CTimer::GetFrameCounter() % TIME_SPAN; 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(); } for (i = 0; i < CMovingThings::Num; i++) { - if (aMovingThings[i].field_A == 0) + if (aMovingThings[i].m_nHidden == 0) aMovingThings[i].Update(); } @@ -212,14 +212,14 @@ void CMovingThing::Update() m_pEntity->UpdateRwFrame(); 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); - field_A = 0; + m_nHidden = 0; } } else { - if (field_A == 0) { + if (m_nHidden == 0) { RemoveFromList(); - field_A = 1; + m_nHidden = 1; } } } diff --git a/src/render/Fluff.h b/src/render/Fluff.h index 7ab2d81d..fe3ab256 100644 --- a/src/render/Fluff.h +++ b/src/render/Fluff.h @@ -8,7 +8,7 @@ public: CMovingThing *m_pNext; CMovingThing *m_pPrev; int16 m_nType; - int16 field_A; + int16 m_nHidden; CVector m_vecPosn; CEntity* m_pEntity; diff --git a/src/render/Particle.h b/src/render/Particle.h index b51be6a5..8999f4f6 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -90,7 +90,7 @@ public: static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize); static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); -#ifndef MASTER +#ifdef TOGGLEABLE_BETA_FEATURES static bool bEnableBannedParticles; #endif }; diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 763f516a..5e483dc7 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -112,14 +112,22 @@ GenericSave(int file) // Save simple vars lastMissionPassed = TheText.Get(CStats::LastMissionPassedName); - if (*lastMissionPassed) { + if (lastMissionPassed[0] != '\0') { AsciiToUnicode("...'", suffix); +#ifdef FIX_BUGS + // fix buffer overflow + int len = UnicodeStrlen(lastMissionPassed); + if (len > ARRAY_SIZE(saveName)-1) + len = ARRAY_SIZE(saveName)-1; + memcpy(saveName, lastMissionPassed, sizeof(wchar) * len); +#else TextCopy(saveName, lastMissionPassed); int len = UnicodeStrlen(saveName); +#endif saveName[len] = '\0'; - if (len > 22) - TextCopy(saveName + 18, suffix); - saveName[23] = '\0'; + if (len > ARRAY_SIZE(saveName)-2) + TextCopy(&saveName[ARRAY_SIZE(saveName)-ARRAY_SIZE(suffix)], suffix); + saveName[ARRAY_SIZE(saveName)-1] = '\0'; } WriteDataToBufferPointer(buf, saveName); GetLocalTime(&saveTime); diff --git a/src/text/Pager.cpp b/src/text/Pager.cpp index 565f2c20..609c6860 100644 --- a/src/text/Pager.cpp +++ b/src/text/Pager.cpp @@ -98,7 +98,7 @@ CPager::AddMessage(wchar *str, uint16 speed, uint16 priority, uint16 a5) m_messages[i].m_pText = str; m_messages[i].m_nSpeedMs = speed; 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_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed; 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_nSpeedMs = speed; 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_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + speed; m_messages[i].m_nStringLength = size; diff --git a/src/text/Pager.h b/src/text/Pager.h index a628be6f..16307971 100644 --- a/src/text/Pager.h +++ b/src/text/Pager.h @@ -7,7 +7,7 @@ struct PagerMessage { uint16 m_nStringLength; uint16 m_nPriority; uint32 m_nTimeToChangePosition; - int16 field_10; + int16 unused; // but still set in SCM. importance? ringtone? int32 m_nNumber[6]; }; diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index c2a664a6..2d0aadcc 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -562,7 +562,7 @@ CAutomobile::ProcessControl(void) bWasPostponed = false; bHasHitWall = false; m_fDistanceTravelled = 0.0f; - field_EF = false; + m_bIsVehicleBeingShifted = false; m_phy_flagA80 = false; ApplyMoveSpeed(); ApplyTurnSpeed(); @@ -2148,7 +2148,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) // 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. - if(field_EF || m_phy_flagA80 || + if(m_bIsVehicleBeingShifted || m_phy_flagA80 || GetModelIndex() == MI_DODO && (ent->IsPed() || ent->IsVehicle())){ // don't do line collision for(i = 0; i < 4; i++) diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 137925f3..398a415f 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -101,7 +101,7 @@ struct tHandlingData float fSteeringLock; float fTractionLoss; float fTractionBias; - uint32 field_AC; + float fABS; // should be VC leftover float fSuspensionForceLevel; float fSuspensionDampingLevel; float fSuspensionUpperLimit; @@ -126,7 +126,7 @@ private: float field_C; // unused it seems float field_10; // tHandlingData HandlingData[NUMHANDLINGS]; - uint32 field_302C; // unused it seems, padding? + uint32 field_302C; // unused it seems public: cHandlingDataMgr(void); diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index bc47b486..0ed83f87 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -65,7 +65,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_nNumGettingIn = 0; m_nGettingInFlags = 0; m_nGettingOutFlags = 0; - m_nNumMaxPassengers = 8; + m_nNumMaxPassengers = ARRAY_SIZE(pPassengers); for(i = 0; i < m_nNumMaxPassengers; i++) pPassengers[i] = nil; m_nBombTimer = 0; @@ -101,7 +101,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_nLastWeaponDamage = -1; m_fMapObjectHeightAhead = m_fMapObjectHeightBehind = 0.0f; m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this); - if(m_audioEntityId) + if(m_audioEntityId >= 0) DMAudio.SetEntityStatus(m_audioEntityId, true); m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK; m_pCurGroundEntity = nil; @@ -728,7 +728,7 @@ CVehicle::CanBeDeleted(void) return false; } - for(i = 0; i < 8; i++){ + for(i = 0; i < ARRAY_SIZE(pPassengers); i++){ // Same check as above if(pPassengers[i]){ if(pPassengers[i]->CharCreatedBy == MISSION_CHAR) @@ -941,7 +941,7 @@ void CVehicle::RemovePassenger(CPed *p) { if (IsTrain()){ - for (int i = 0; i < 8; i++){ + for (int i = 0; i < ARRAY_SIZE(pPassengers); i++){ if (pPassengers[i] == p) { pPassengers[i] = nil; m_nNumPassengers--; diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h index e2e71d23..f82f18c5 100644 --- a/src/weapons/WeaponInfo.h +++ b/src/weapons/WeaponInfo.h @@ -38,7 +38,6 @@ public: uint8 m_b1stPerson : 1; uint8 m_bHeavy : 1; uint8 m_bThrow : 1; - uint8 stuff; static void Initialise(void); static void LoadWeaponData(void); |