From eccc4a3a5b45253ad8a6bdacbfccb8a15299d334 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 15 Apr 2020 16:17:18 +0200 Subject: fixed bug and weirdness in CHeli --- src/vehicles/Heli.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/vehicles') diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 3dc1deeb..c4cdcb02 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -78,6 +78,9 @@ CHeli::CHeli(int32 id, uint8 CreatedBy) m_bTestRight = true; m_fTargetOffset = 0.0f; m_fSearchLightX = m_fSearchLightY = 0.0f; + + // BUG: not in game but gets initialized to CDCDCDCD in debug + m_nLastShotTime = 0; } void @@ -590,7 +593,12 @@ CHeli::PreRender(void) break; } RwRGBA col = { r, g, b, 32 }; +#ifdef FIX_BUGS + pos.z = m_fHeliDustZ[frm]; +#else + // What the hell is the point of this? pos.z = m_fHeliDustZ[(i - (i&3))/4]; // advance every 4 iterations, why not just /4? +#endif if(pos.z > -200.0f && GetPosition().z - pos.z < 20.0f) CParticle::AddParticle(PARTICLE_HELI_DUST, pos, dir, nil, 0.0f, col); i++; -- cgit v1.2.3 From 4da1879975ef28cb7f406166d62d154d03ef47d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 15 Apr 2020 19:19:45 +0300 Subject: Many fixes and cleanup --- src/vehicles/Automobile.cpp | 7 +++---- src/vehicles/Vehicle.cpp | 12 ++++++------ src/vehicles/Vehicle.h | 12 ++++++------ 3 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src/vehicles') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 257c8d33..2a325b3d 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -356,7 +356,7 @@ CAutomobile::ProcessControl(void) PruneReferences(); - if(m_status == STATUS_PLAYER && CRecordDataForChase::IsRecording()) + if(m_status == STATUS_PLAYER && !CRecordDataForChase::IsRecording()) DoDriveByShootings(); } break; @@ -4206,8 +4206,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data) return object; } -CColPoint aTempPedColPts[32]; // this name doesn't make any sense - // they probably copied it from Ped (both serves same purpose) and didn't change the name +CColPoint spherepoints[MAX_COLLISION_POINTS]; CObject* CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) @@ -4327,7 +4326,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) if(CCollision::ProcessColModels(obj->GetMatrix(), *obj->GetColModel(), this->GetMatrix(), *this->GetColModel(), - aTempPedColPts, nil, nil) > 0) + spherepoints, nil, nil) > 0) obj->m_pCollidingEntity = this; if(bRenderScorched) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index f47fd131..ed8f4221 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -19,12 +19,12 @@ #include "Fire.h" #include "Darkel.h" -bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78; -bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75; -bool &CVehicle::bCheat3 = *(bool *)0x95CD66; -bool &CVehicle::bCheat4 = *(bool *)0x95CD65; -bool &CVehicle::bCheat5 = *(bool *)0x95CD64; -bool &CVehicle::m_bDisableMouseSteering = *(bool *)0x60252C; +bool CVehicle::bWheelsOnlyCheat; +bool CVehicle::bAllDodosCheat; +bool CVehicle::bCheat3; +bool CVehicle::bCheat4; +bool CVehicle::bCheat5; +bool CVehicle::m_bDisableMouseSteering; void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); } void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); } diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index f9becda0..bfc6d95d 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -277,12 +277,12 @@ public: bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); } - static bool &bWheelsOnlyCheat; - static bool &bAllDodosCheat; - static bool &bCheat3; - static bool &bCheat4; - static bool &bCheat5; - static bool &m_bDisableMouseSteering; + static bool bWheelsOnlyCheat; + static bool bAllDodosCheat; + static bool bCheat3; + static bool bCheat4; + static bool bCheat5; + static bool m_bDisableMouseSteering; }; static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error"); -- cgit v1.2.3 From 83cbe4e39ede4853e0d352e55aeddbd481b39948 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 16 Apr 2020 15:30:47 +0300 Subject: More refs removed --- src/vehicles/Automobile.cpp | 2 +- src/vehicles/Automobile.h | 2 +- src/vehicles/Boat.cpp | 10 ++++---- src/vehicles/Boat.h | 2 +- src/vehicles/Floater.cpp | 5 ++-- src/vehicles/Floater.h | 2 +- src/vehicles/HandlingMgr.cpp | 2 +- src/vehicles/HandlingMgr.h | 2 +- src/vehicles/Heli.cpp | 12 ++++----- src/vehicles/Heli.h | 12 ++++----- src/vehicles/Plane.cpp | 58 ++++++++++++++++++++++---------------------- src/vehicles/Plane.h | 6 ++--- src/vehicles/Train.cpp | 30 +++++++++++------------ 13 files changed, 72 insertions(+), 73 deletions(-) (limited to 'src/vehicles') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 2a325b3d..12d4f589 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -49,7 +49,7 @@ bool bAllCarCheat; // unused RwObject *GetCurrentAtomicObjectCB(RwObject *object, void *data); -bool &CAutomobile::m_sAllTaxiLights = *(bool*)0x95CD21; +bool CAutomobile::m_sAllTaxiLights;// = *(bool*)0x95CD21; CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 561ab566..66774612 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -120,7 +120,7 @@ public: float m_fGasPedalAudio; tWheelState m_aWheelState[4]; - static bool &m_sAllTaxiLights; + static bool m_sAllTaxiLights; CAutomobile(int32 id, uint8 CreatedBy); diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 0159d168..d694d8b0 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -21,16 +21,16 @@ #define INVALID_ORIENTATION (-9999.99f) -float &fShapeLength = *(float*)0x600E78; -float &fShapeTime = *(float*)0x600E7C; -float &fRangeMult = *(float*)0x600E80; //0.6f; // 0.75f gta 3 -float &fTimeMult = *(float*)0x943008; +float fShapeLength = 0.4f;// *(float*)0x600E78; +float fShapeTime = 0.05f;// *(float*)0x600E7C; +float fRangeMult = 0.75f; // = *(float*)0x600E80; //0.6f; // 0.75f gta 3 +float fTimeMult;// = *(float*)0x943008; float MAX_WAKE_LENGTH = 50.0f; float MIN_WAKE_INTERVAL = 1.0f; float WAKE_LIFETIME = 400.0f; -CBoat * (&CBoat::apFrameWakeGeneratingBoats)[4] = *(CBoat * (*)[4])*(uintptr*)0x8620E0; +CBoat *CBoat::apFrameWakeGeneratingBoats[4];// = *(CBoat * (*)[4]) * (uintptr*)0x8620E0; CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner) { diff --git a/src/vehicles/Boat.h b/src/vehicles/Boat.h index f4c6a747..ba56e355 100644 --- a/src/vehicles/Boat.h +++ b/src/vehicles/Boat.h @@ -58,7 +58,7 @@ public: void PruneWakeTrail(void); void AddWakePoint(CVector point); - static CBoat *(&apFrameWakeGeneratingBoats)[4]; + static CBoat *apFrameWakeGeneratingBoats[4]; static bool IsSectorAffectedByWake(CVector2D sector, float fSize, CBoat **apBoats); static float IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat); diff --git a/src/vehicles/Floater.cpp b/src/vehicles/Floater.cpp index 62d55925..ee4a1191 100644 --- a/src/vehicles/Floater.cpp +++ b/src/vehicles/Floater.cpp @@ -7,10 +7,9 @@ #include "Vehicle.h" #include "Floater.h" -cBuoyancy &mod_Buoyancy = *(cBuoyancy*)0x8F2674; +cBuoyancy mod_Buoyancy;// = *(cBuoyancy*)0x8F2674; -//static float fVolMultiplier = 1.0f; -static float &fVolMultiplier = *(float*)0x601394; +static float fVolMultiplier = 1.0f; // 0x601394; // amount of boat volume in bounding box // 1.0-volume is the empty space in the bbox static float fBoatVolumeDistribution[9] = { diff --git a/src/vehicles/Floater.h b/src/vehicles/Floater.h index 4754a235..1cfb46fb 100644 --- a/src/vehicles/Floater.h +++ b/src/vehicles/Floater.h @@ -42,4 +42,4 @@ public: void FindWaterLevel(const CVector &zpos, CVector *waterLevel, tWaterLevel *waterPosition); bool CalcBuoyancyForce(CPhysical *phys, CVector *impulse, CVector *point); }; -extern cBuoyancy &mod_Buoyancy; +extern cBuoyancy mod_Buoyancy; diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 0f16401e..40715887 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -4,7 +4,7 @@ #include "FileMgr.h" #include "HandlingMgr.h" -cHandlingDataMgr &mod_HandlingManager = *(cHandlingDataMgr*)0x728060; +cHandlingDataMgr mod_HandlingManager;// = *(cHandlingDataMgr*)0x728060; const char *HandlingFilename = "HANDLING.CFG"; diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 70f1c005..137925f3 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -140,4 +140,4 @@ public: bool HasFrontWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'F'; } }; VALIDATE_SIZE(cHandlingDataMgr, 0x3030); -extern cHandlingDataMgr &mod_HandlingManager; +extern cHandlingDataMgr mod_HandlingManager; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index c4cdcb02..61714133 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -34,13 +34,13 @@ enum HELI_STATUS_HOVER2, }; -CHeli **CHeli::pHelis = (CHeli**)0x72CF50; -int16 &CHeli::NumRandomHelis = *(int16*)0x95CCAA; -uint32 &CHeli::TestForNewRandomHelisTimer = *(uint32*)0x8F1A7C; +CHeli *CHeli::pHelis[NUM_HELIS];// = (CHeli**)0x72CF50; +int16 CHeli::NumRandomHelis;// = *(int16*)0x95CCAA; +uint32 CHeli::TestForNewRandomHelisTimer;// = *(uint32*)0x8F1A7C; int16 CHeli::NumScriptHelis; // unused -bool &CHeli::CatalinaHeliOn = *(bool*)0x95CD85; -bool &CHeli::CatalinaHasBeenShotDown = *(bool*)0x95CD56; -bool &CHeli::ScriptHeliOn = *(bool*)0x95CD43; +bool CHeli::CatalinaHeliOn;// = *(bool*)0x95CD85; +bool CHeli::CatalinaHasBeenShotDown;// = *(bool*)0x95CD56; +bool CHeli::ScriptHeliOn;// = *(bool*)0x95CD43; CHeli::CHeli(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) diff --git a/src/vehicles/Heli.h b/src/vehicles/Heli.h index bb10345d..15dff7b1 100644 --- a/src/vehicles/Heli.h +++ b/src/vehicles/Heli.h @@ -61,13 +61,13 @@ public: float m_fTargetOffset; bool m_bTestRight; - static CHeli **pHelis; //[NUM_HELIS] - static int16 &NumRandomHelis; - static uint32 &TestForNewRandomHelisTimer; + static CHeli *pHelis[NUM_HELIS]; + static int16 NumRandomHelis; + static uint32 TestForNewRandomHelisTimer; static int16 NumScriptHelis; // unused - static bool &CatalinaHeliOn; - static bool &CatalinaHasBeenShotDown; - static bool &ScriptHeliOn; + static bool CatalinaHeliOn; + static bool CatalinaHasBeenShotDown; + static bool ScriptHeliOn; CHeli(int32 id, uint8 CreatedBy); CHeli* ctor(int, uint8); diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp index c2b9e493..49f5d69d 100644 --- a/src/vehicles/Plane.cpp +++ b/src/vehicles/Plane.cpp @@ -16,35 +16,35 @@ #include "HandlingMgr.h" #include "Plane.h" -CPlaneNode *&pPathNodes = *(CPlaneNode**)0x8F1B68; -CPlaneNode *&pPath2Nodes = *(CPlaneNode**)0x885B8C; -CPlaneNode *&pPath3Nodes = *(CPlaneNode**)0x885B78; -CPlaneNode *&pPath4Nodes = *(CPlaneNode**)0x885AD8; -int32 &NumPathNodes = *(int32*)0x8F2BE4; -int32 &NumPath2Nodes = *(int32*)0x941498; -int32 &NumPath3Nodes = *(int32*)0x9414D8; -int32 &NumPath4Nodes = *(int32*)0x9412C8; -float &TotalLengthOfFlightPath = *(float*)0x8F2C6C; -float &TotalLengthOfFlightPath2 = *(float*)0x64CFBC; -float &TotalLengthOfFlightPath3 = *(float*)0x64CFD0; -float &TotalLengthOfFlightPath4 = *(float*)0x64CFDC; -float &TotalDurationOfFlightPath = *(float*)0x64CFB8; -float &TotalDurationOfFlightPath2 = *(float*)0x64CFC0; -float &TotalDurationOfFlightPath3 = *(float*)0x64CFD4; -float &TotalDurationOfFlightPath4 = *(float*)0x64CFE0; -float &LandingPoint = *(float*)0x8F2C7C; -float &TakeOffPoint = *(float*)0x8E28A4; -CPlaneInterpolationLine *aPlaneLineBits = (CPlaneInterpolationLine*)0x734168; //[6] - -float *PlanePathPosition = (float*)0x8F5FC8; //[3] -float *OldPlanePathPosition = (float*)0x8F5FBC; //[3] -float *PlanePathSpeed = (float*)0x941538; //[3] -float *PlanePath2Position = (float*)0x64CFC4; //[3] -float &PlanePath3Position = *(float*)0x64CFD8; -float &PlanePath4Position = *(float*)0x64CFE4; -float *PlanePath2Speed = (float*)0x8F1A54; //[3] -float &PlanePath3Speed = *(float*)0x8F1A94; -float &PlanePath4Speed = *(float*)0x8F1AFC; +CPlaneNode *pPathNodes;// = *(CPlaneNode**)0x8F1B68; +CPlaneNode *pPath2Nodes;// = *(CPlaneNode**)0x885B8C; +CPlaneNode *pPath3Nodes;// = *(CPlaneNode**)0x885B78; +CPlaneNode *pPath4Nodes;// = *(CPlaneNode**)0x885AD8; +int32 NumPathNodes;// = *(int32*)0x8F2BE4; +int32 NumPath2Nodes;// = *(int32*)0x941498; +int32 NumPath3Nodes;// = *(int32*)0x9414D8; +int32 NumPath4Nodes;// = *(int32*)0x9412C8; +float TotalLengthOfFlightPath;// = *(float*)0x8F2C6C; +float TotalLengthOfFlightPath2;// = *(float*)0x64CFBC; +float TotalLengthOfFlightPath3;// = *(float*)0x64CFD0; +float TotalLengthOfFlightPath4;// = *(float*)0x64CFDC; +float TotalDurationOfFlightPath;// = *(float*)0x64CFB8; +float TotalDurationOfFlightPath2;// = *(float*)0x64CFC0; +float TotalDurationOfFlightPath3;// = *(float*)0x64CFD4; +float TotalDurationOfFlightPath4;// = *(float*)0x64CFE0; +float LandingPoint;// = *(float*)0x8F2C7C; +float TakeOffPoint;// = *(float*)0x8E28A4; +CPlaneInterpolationLine aPlaneLineBits[6]; // = (CPlaneInterpolationLine*)0x734168; + +float PlanePathPosition[3];// = (float*)0x8F5FC8; //[3] +float OldPlanePathPosition[3];// = (float*)0x8F5FBC; //[3] +float PlanePathSpeed[3];// = (float*)0x941538; //[3] +float PlanePath2Position[3];// = (float*)0x64CFC4; //[3] +float PlanePath3Position;// = *(float*)0x64CFD8; +float PlanePath4Position;// = *(float*)0x64CFE4; +float PlanePath2Speed[3];// = (float*)0x8F1A54; //[3] +float PlanePath3Speed;// = *(float*)0x8F1A94; +float PlanePath4Speed;// = *(float*)0x8F1AFC; enum diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h index edca92ec..4c8e70aa 100644 --- a/src/vehicles/Plane.h +++ b/src/vehicles/Plane.h @@ -67,6 +67,6 @@ public: }; static_assert(sizeof(CPlane) == 0x29C, "CPlane: error"); -extern float &LandingPoint; -extern float &TakeOffPoint; -extern float *PlanePathPosition; //[3] +extern float LandingPoint; +extern float TakeOffPoint; +extern float PlanePathPosition[3]; diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 7d81fd57..25be193c 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -14,23 +14,23 @@ #include "HandlingMgr.h" #include "Train.h" -static CTrainNode *&pTrackNodes = *(CTrainNode**)0x8F4338; -static int16 &NumTrackNodes = *(int16*)0x95CC5C; +static CTrainNode* pTrackNodes; +static int16 NumTrackNodes; static float StationDist[3] = { 873.0f, 1522.0f, 2481.0f }; -static float &TotalLengthOfTrack = *(float*)0x64D000; -static float &TotalDurationOfTrack = *(float*)0x64D004; -static CTrainInterpolationLine *aLineBits = (CTrainInterpolationLine*)0x70D838; // [17] -static float *EngineTrackPosition = (float*)0x64D008; //[2] -static float *EngineTrackSpeed = (float*)0x880848; //[2] - -static CTrainNode *&pTrackNodes_S = *(CTrainNode**)0x8F2560; -static int16 &NumTrackNodes_S = *(int16*)0x95CC6A; +static float TotalLengthOfTrack; +static float TotalDurationOfTrack; +static CTrainInterpolationLine aLineBits[17]; +static float EngineTrackPosition[2]; +static float EngineTrackSpeed[2]; + +static CTrainNode* pTrackNodes_S; +static int16 NumTrackNodes_S; static float StationDist_S[4] = { 55.0f, 1388.0f, 2337.0f, 3989.0f }; -static float &TotalLengthOfTrack_S = *(float*)0x64D010; -static float &TotalDurationOfTrack_S = *(float*)0x64D014; -static CTrainInterpolationLine *aLineBits_S = (CTrainInterpolationLine*)0x726600; // [18] -static float *EngineTrackPosition_S = (float*)0x64D018; //[4] -static float *EngineTrackSpeed_S = (float*)0x87C7C8; //[4] +static float TotalLengthOfTrack_S; +static float TotalDurationOfTrack_S; +static CTrainInterpolationLine aLineBits_S[18]; +static float EngineTrackPosition_S[4]; +static float EngineTrackSpeed_S[4]; CVector CTrain::aStationCoors[3]; CVector CTrain::aStationCoors_S[4]; -- cgit v1.2.3