diff --git a/Client/game_sa/C3DMarkerSA.cpp b/Client/game_sa/C3DMarkerSA.cpp index 572bc94751..ad2564eea1 100644 --- a/Client/game_sa/C3DMarkerSA.cpp +++ b/Client/game_sa/C3DMarkerSA.cpp @@ -32,38 +32,38 @@ void C3DMarkerSA::SetMatrix(CMatrix* pMatrix) void C3DMarkerSA::SetPosition(CVector* vecPosition) { - this->GetInterface()->m_mat.vPos = *vecPosition; + GetInterface()->m_mat.vPos = *vecPosition; } CVector* C3DMarkerSA::GetPosition() { - return &this->GetInterface()->m_mat.vPos; + return &GetInterface()->m_mat.vPos; } DWORD C3DMarkerSA::GetType() { - return this->GetInterface()->m_nType; + return GetInterface()->m_nType; } void C3DMarkerSA::SetType(DWORD dwType) { - this->GetInterface()->m_nType = (unsigned short)(dwType); + GetInterface()->m_nType = (unsigned short)(dwType); } bool C3DMarkerSA::IsActive() { - return this->GetInterface()->m_bIsUsed; + return GetInterface()->m_bIsUsed; } DWORD C3DMarkerSA::GetIdentifier() { - return this->GetInterface()->m_nIdentifier; + return GetInterface()->m_nIdentifier; } SharedUtil::SColor C3DMarkerSA::GetColor() { // From ABGR - unsigned long ulABGR = this->GetInterface()->rwColour; + unsigned long ulABGR = GetInterface()->rwColour; SharedUtil::SColor color; color.A = (ulABGR >> 24) & 0xff; color.B = (ulABGR >> 16) & 0xff; @@ -75,60 +75,60 @@ SharedUtil::SColor C3DMarkerSA::GetColor() void C3DMarkerSA::SetColor(const SharedUtil::SColor color) { // To ABGR - this->GetInterface()->rwColour = (color.A << 24) | (color.B << 16) | (color.G << 8) | color.R; + GetInterface()->rwColour = (color.A << 24) | (color.B << 16) | (color.G << 8) | color.R; } void C3DMarkerSA::SetPulsePeriod(WORD wPulsePeriod) { - this->GetInterface()->m_nPulsePeriod = wPulsePeriod; + GetInterface()->m_nPulsePeriod = wPulsePeriod; } void C3DMarkerSA::SetRotateRate(short RotateRate) { - this->GetInterface()->m_nRotateRate = RotateRate; + GetInterface()->m_nRotateRate = RotateRate; } float C3DMarkerSA::GetSize() { - return this->GetInterface()->m_fSize; + return GetInterface()->m_fSize; } void C3DMarkerSA::SetSize(float fSize) { - this->GetInterface()->m_fSize = fSize; + GetInterface()->m_fSize = fSize; } float C3DMarkerSA::GetBrightness() { - return this->GetInterface()->m_fBrightness; + return GetInterface()->m_fBrightness; } void C3DMarkerSA::SetBrightness(float fBrightness) { - this->GetInterface()->m_fBrightness = fBrightness; + GetInterface()->m_fBrightness = fBrightness; } void C3DMarkerSA::SetCameraRange(float fCameraRange) { - this->GetInterface()->m_fCameraRange = fCameraRange; + GetInterface()->m_fCameraRange = fCameraRange; } void C3DMarkerSA::SetPulseFraction(float fPulseFraction) { - this->GetInterface()->m_fPulseFraction = fPulseFraction; + GetInterface()->m_fPulseFraction = fPulseFraction; } float C3DMarkerSA::GetPulseFraction() { - return this->GetInterface()->m_fPulseFraction; + return GetInterface()->m_fPulseFraction; } void C3DMarkerSA::Disable() { - this->GetInterface()->m_nIdentifier = 0; + GetInterface()->m_nIdentifier = 0; } void C3DMarkerSA::Reset() { - this->internalInterface->m_lastPosition = this->internalInterface->m_mat.vPos; + internalInterface->m_lastPosition = internalInterface->m_mat.vPos; } diff --git a/Client/game_sa/C3DMarkerSA.h b/Client/game_sa/C3DMarkerSA.h index 5152dd4be9..e15a765ee6 100644 --- a/Client/game_sa/C3DMarkerSA.h +++ b/Client/game_sa/C3DMarkerSA.h @@ -77,6 +77,6 @@ class C3DMarkerSA : public C3DMarker float GetPulseFraction(); void Disable(); void Reset(); - void SetActive() { this->internalInterface->m_bIsUsed = true; }; - RpClump* GetRwObject() { return this->internalInterface->m_pRwObject; } + void SetActive() { internalInterface->m_bIsUsed = true; } + RpClump* GetRwObject() { return internalInterface->m_pRwObject; } }; diff --git a/Client/game_sa/C3DMarkersSA.cpp b/Client/game_sa/C3DMarkersSA.cpp index 0b587baf21..86f1f8d4ef 100644 --- a/Client/game_sa/C3DMarkersSA.cpp +++ b/Client/game_sa/C3DMarkersSA.cpp @@ -16,7 +16,7 @@ C3DMarkersSA::C3DMarkersSA() { for (int i = 0; i < MAX_3D_MARKERS; i++) { - this->Markers[i] = new C3DMarkerSA((C3DMarkerSAInterface*)(ARRAY_3D_MARKERS + i * sizeof(C3DMarkerSAInterface))); + Markers[i] = new C3DMarkerSA((C3DMarkerSAInterface*)(ARRAY_3D_MARKERS + i * sizeof(C3DMarkerSAInterface))); } } diff --git a/Client/game_sa/CAutomobileSA.cpp b/Client/game_sa/CAutomobileSA.cpp index e11fc2293d..59205e86e1 100644 --- a/Client/game_sa/CAutomobileSA.cpp +++ b/Client/game_sa/CAutomobileSA.cpp @@ -12,100 +12,8 @@ #include "StdInc.h" #include "CAutomobileSA.h" -/** - * \todo Spawn automobiles with engine off - */ -CAutomobileSA::CAutomobileSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) : CVehicleSA(dwModelID, ucVariation, ucVariation2) +CAutomobileSA::CAutomobileSA(CAutomobileSAInterface* pInterface) { - // create our mirror classes - for (int i = 0; i < MAX_DOORS; i++) - this->door[i] = new CDoorSA(&((CAutomobileSAInterface*)this->GetInterface())->m_doors[i]); - -} - -CAutomobileSA::CAutomobileSA(CAutomobileSAInterface* automobile) -{ - // just so it can be passed on to CVehicle -} - -CAutomobileSA::~CAutomobileSA() -{ - for (int i = 0; i < MAX_DOORS; i++) - { - if (this->door[i]) - delete this->door[i]; - } -} - -bool CAutomobileSA::BurstTyre(DWORD dwTyreID) -{ - DWORD dwThis = (DWORD)GetInterface(); - DWORD dwFunc = FUNC_CAutomobile_BurstTyre; - bool bReturn; - - _asm - { - mov ecx, dwThis - push dwTyreID - call dwFunc; - mov bReturn, al - } - - return bReturn; -} - -bool CAutomobileSA::BreakTowLink() -{ - DWORD dwThis = (DWORD)GetInterface(); - DWORD dwFunc = FUNC_CAutomobile_BreakTowLink; - bool bReturn; - - _asm - { - mov ecx, dwThis - call dwFunc - mov bReturn, al - } - - return bReturn; -} - -bool CAutomobileSA::IsComponentPresent(int iComponentID) -{ - DWORD dwThis = (DWORD)GetInterface(); - DWORD dwFunc = FUNC_CAutomobile_IsComponentPresent; - bool bReturn; - - _asm - { - mov ecx, dwThis - push iComponentID - call dwFunc - mov bReturn, al - } - - return bReturn; -} - -CPhysical* CAutomobileSA::SpawnFlyingComponent(int iCarNodeIndex, int iUnknown) -{ - DWORD dwThis = (DWORD)GetInterface(); - DWORD dwFunc = FUNC_CAutomobile_SpawnFlyingComponent; - CPhysical* pReturn; - - _asm - { - mov ecx, dwThis - push iUnknown - push iCarNodeIndex - call dwFunc - mov pReturn, eax - } - - return pReturn; -} - -CDoor* CAutomobileSA::GetDoor(eDoors doorID) -{ - return this->door[doorID]; + SetInterface(pInterface); + Init(); } diff --git a/Client/game_sa/CAutomobileSA.h b/Client/game_sa/CAutomobileSA.h index 428be36d05..701030a5a9 100644 --- a/Client/game_sa/CAutomobileSA.h +++ b/Client/game_sa/CAutomobileSA.h @@ -16,11 +16,7 @@ #include "CDoorSA.h" #include "CVehicleSA.h" -#define FUNC_CAutomobile_BurstTyre 0x6A32B0 -#define FUNC_CAutomobile_BreakTowLink 0x6A4400 -#define FUNC_CAutomobile_IsComponentPresent 0x6A2250 #define FUNC_CAutomobile_SetTaxiLight 0x6A3740 -#define FUNC_CAutomobile_SpawnFlyingComponent 0x6A8580 #define MAX_PASSENGER_COUNT 8 #define MAX_DOORS 6 // also in CDamageManager @@ -163,19 +159,9 @@ static_assert(sizeof(CAutomobileSAInterface) == 0x988, "Invalid size for CAutomo class CAutomobileSA : public virtual CAutomobile, public virtual CVehicleSA { -private: - CDoorSA* door[MAX_DOORS]; - public: - CAutomobileSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); - CAutomobileSA(CAutomobileSAInterface* automobile); - ~CAutomobileSA(); - - bool BurstTyre(DWORD dwTyreID); - bool BreakTowLink(); - - bool IsComponentPresent(int iComponentID); - CPhysical* SpawnFlyingComponent(int iCarNodeIndex, int iUnknown); + CAutomobileSA() = default; + CAutomobileSA(CAutomobileSAInterface* pInterface); - CDoor* GetDoor(eDoors doorID); + CAutomobileSAInterface* GetAutomobileInterface() { return reinterpret_cast(GetInterface()); } }; diff --git a/Client/game_sa/CBikeSA.cpp b/Client/game_sa/CBikeSA.cpp index 5913d34cbe..3a20c99d25 100644 --- a/Client/game_sa/CBikeSA.cpp +++ b/Client/game_sa/CBikeSA.cpp @@ -12,30 +12,10 @@ #include "StdInc.h" #include "CBikeSA.h" -CBikeSA::CBikeSA(CBikeSAInterface* bike) +CBikeSA::CBikeSA(CBikeSAInterface* pInterface) { - this->m_pInterface = bike; -} - -CBikeSA::CBikeSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) : CVehicleSA(dwModelID, ucVariation, ucVariation2) -{ - /*if(this->internalInterface) - { - // create the actual vehicle - DWORD dwFunc = FUNC_CBikeContructor; - DWORD dwThis = (DWORD)this->internalInterface; - _asm - { - mov ecx, dwThis - push MISSION_VEHICLE - push dwModelID - call dwFunc - } - - this->SetEntityStatus(STATUS_ABANDONED); // so it actually shows up in the world - - pGame->GetWorld()->Add((CEntitySA *)this); - }*/ + SetInterface(pInterface); + Init(); } CBikeHandlingEntry* CBikeSA::GetBikeHandlingData() diff --git a/Client/game_sa/CBikeSA.h b/Client/game_sa/CBikeSA.h index 90ab7338d7..65602ae525 100644 --- a/Client/game_sa/CBikeSA.h +++ b/Client/game_sa/CBikeSA.h @@ -90,11 +90,10 @@ class CBikeSA : public virtual CBike, public virtual CVehicleSA CBikeHandlingEntrySA* m_pBikeHandlingData = nullptr; public: - CBikeSA(){}; - CBikeSA(CBikeSAInterface* bike); - CBikeSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CBikeSA() = default; + CBikeSA(CBikeSAInterface* pInterface); - CBikeSAInterface* GetBikeInterface() { return (CBikeSAInterface*)m_pInterface; }; + CBikeSAInterface* GetBikeInterface() { return reinterpret_cast(GetInterface()); } CBikeHandlingEntry* GetBikeHandlingData(); void SetBikeHandlingData(CBikeHandlingEntry* pHandling); diff --git a/Client/game_sa/CBmxSA.cpp b/Client/game_sa/CBmxSA.cpp index 487755abbe..e68757900e 100644 --- a/Client/game_sa/CBmxSA.cpp +++ b/Client/game_sa/CBmxSA.cpp @@ -12,11 +12,8 @@ #include "StdInc.h" #include "CBmxSA.h" -CBmxSA::CBmxSA(CBmxSAInterface* bmx) -{ - this->m_pInterface = bmx; -} - -CBmxSA::CBmxSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) : CBikeSA(dwModelID, ucVariation, ucVariation2) +CBmxSA::CBmxSA(CBmxSAInterface* pInterface) { + SetInterface(pInterface); + Init(); } diff --git a/Client/game_sa/CBmxSA.h b/Client/game_sa/CBmxSA.h index 04e64f5b3c..250a8bd5e6 100644 --- a/Client/game_sa/CBmxSA.h +++ b/Client/game_sa/CBmxSA.h @@ -19,11 +19,10 @@ class CBmxSAInterface : public CBikeSAInterface // fill this }; -class CBmxSA : public virtual CBmx, public virtual CBikeSA +class CBmxSA final : public virtual CBmx, public virtual CBikeSA { public: - CBmxSA(CBmxSAInterface* bmx); - CBmxSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CBmxSA(CBmxSAInterface* pInterface); - virtual ~CBmxSA(){}; + CBmxSAInterface* GetBmxInterface() { return reinterpret_cast(GetInterface()); } }; diff --git a/Client/game_sa/CBoatSA.cpp b/Client/game_sa/CBoatSA.cpp index 345fd67c1f..416863b6e4 100644 --- a/Client/game_sa/CBoatSA.cpp +++ b/Client/game_sa/CBoatSA.cpp @@ -12,30 +12,10 @@ #include "StdInc.h" #include "CBoatSA.h" -CBoatSA::CBoatSA(CBoatSAInterface* boat) +CBoatSA::CBoatSA(CBoatSAInterface* pInterface) { - this->m_pInterface = boat; -} - -CBoatSA::CBoatSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) : CVehicleSA(dwModelID, ucVariation, ucVariation2) -{ - /*if(this->internalInterface) - { - // create the actual vehicle - DWORD dwFunc = FUNC_CBoatContructor; - DWORD dwThis = (DWORD)this->internalInterface; - _asm - { - mov ecx, dwThis - push MISSION_VEHICLE - push dwModelID - call dwFunc - } - - this->SetEntityStatus(STATUS_ABANDONED); // so it actually shows up in the world - - pGame->GetWorld()->Add((CEntitySA *)this); - } */ + SetInterface(pInterface); + Init(); } CBoatHandlingEntry* CBoatSA::GetBoatHandlingData() diff --git a/Client/game_sa/CBoatSA.h b/Client/game_sa/CBoatSA.h index 6d4936c27f..6d432b1bf7 100644 --- a/Client/game_sa/CBoatSA.h +++ b/Client/game_sa/CBoatSA.h @@ -36,17 +36,14 @@ class CBoatSAInterface : public CVehicleSAInterface uint32 pad10[106]; // 1600 }; -class CBoatSA : public virtual CBoat, public virtual CVehicleSA +class CBoatSA final : public virtual CBoat, public virtual CVehicleSA { private: CBoatHandlingEntrySA* m_pBoatHandlingData = nullptr; public: - CBoatSA(CBoatSAInterface* boat); - CBoatSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CBoatSA(CBoatSAInterface* pInterface); - virtual ~CBoatSA(){}; - - CBoatSAInterface* GetBoatInterface() { return (CBoatSAInterface*)m_pInterface; } + CBoatSAInterface* GetBoatInterface() { return reinterpret_cast(GetInterface()); } CBoatHandlingEntry* GetBoatHandlingData(); void SetBoatHandlingData(CBoatHandlingEntry* pHandling); diff --git a/Client/game_sa/CCameraSA.cpp b/Client/game_sa/CCameraSA.cpp index 598a0830b3..4cd7383e3e 100644 --- a/Client/game_sa/CCameraSA.cpp +++ b/Client/game_sa/CCameraSA.cpp @@ -29,9 +29,9 @@ void HOOK_Camera_CollisionDetection(); CCameraSA::CCameraSA(CCameraSAInterface* cameraInterface) { - this->internalInterface = cameraInterface; + internalInterface = cameraInterface; for (int i = 0; i < MAX_CAMS; i++) - this->Cams[i] = new CCamSA(&this->internalInterface->Cams[i]); + Cams[i] = new CCamSA(&internalInterface->Cams[i]); bCameraClipObjects = true; bCameraClipVehicles = true; HookInstall(HOOKPOS_Camera_CollisionDetection, (DWORD)HOOK_Camera_CollisionDetection, 5); @@ -48,7 +48,7 @@ CCameraSA::~CCameraSA() void CCameraSA::Restore() { DWORD dwFunc = FUNC_Restore; - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); _asm { mov ecx, cameraInterface @@ -58,7 +58,7 @@ void CCameraSA::Restore() void CCameraSA::RestoreWithJumpCut() { - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); DWORD dwFunc = 0x50BD40; _asm { @@ -83,7 +83,7 @@ void CCameraSA::TakeControl(CEntity* entity, eCamMode CamMode, int CamSwitchStyl return; CEntitySAInterface* entityInterface = pEntitySA->GetInterface(); - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); // __thiscall DWORD CCamera__TakeControl = FUNC_TakeControl; @@ -100,7 +100,7 @@ void CCameraSA::TakeControl(CEntity* entity, eCamMode CamMode, int CamSwitchStyl void CCameraSA::TakeControl(CVector* position, int CamSwitchStyle) { - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); // __thiscall CVector vecOffset; /* vecOffset.fZ = 0.5f; @@ -188,7 +188,7 @@ void CCameraSA::RestoreLastGoodState() CMatrix* CCameraSA::GetMatrix(CMatrix* matrix) { - CMatrix_Padded* pCamMatrix = &this->GetInterface()->m_cameraMatrix; // ->Placeable.matrix; + CMatrix_Padded* pCamMatrix = &GetInterface()->m_cameraMatrix; // ->Placeable.matrix; if (pCamMatrix) { matrix->vFront = pCamMatrix->vFront; @@ -211,7 +211,7 @@ CMatrix* CCameraSA::GetMatrix(CMatrix* matrix) void CCameraSA::SetMatrix(CMatrix* matrix) { - CMatrix_Padded* pCamMatrix = this->GetInterface()->Placeable.matrix; + CMatrix_Padded* pCamMatrix = GetInterface()->Placeable.matrix; if (pCamMatrix) { pCamMatrix->vFront = matrix->vFront; @@ -227,7 +227,7 @@ void CCameraSA::Find3rdPersonCamTargetVector(float fDistance, CVector* vecGunMuz float fOriginY = vecGunMuzzle->fY; float fOriginZ = vecGunMuzzle->fZ; DWORD dwFunc = FUNC_Find3rdPersonCamTargetVector; - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); _asm { mov ecx, cameraInterface @@ -245,7 +245,7 @@ float CCameraSA::Find3rdPersonQuickAimPitch() { float fReturn; DWORD dwFunc = FUNC_Find3rdPersonQuickAimPitch; - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); _asm { mov ecx, cameraInterface @@ -257,7 +257,7 @@ float CCameraSA::Find3rdPersonQuickAimPitch() BYTE CCameraSA::GetActiveCam() { - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); return cameraInterface->ActiveCam; } @@ -289,14 +289,14 @@ void CCameraSA::SetWidescreen(bool bWidescreen) bool CCameraSA::GetWidescreen() { - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); return cameraInterface->m_WideScreenOn; } bool CCameraSA::IsFading() { DWORD dwFunc = FUNC_GetFading; - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); bool bRet = false; _asm { @@ -310,7 +310,7 @@ bool CCameraSA::IsFading() int CCameraSA::GetFadingDirection() { DWORD dwFunc = FUNC_GetFadingDirection; - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); int dwRet = false; _asm { @@ -324,7 +324,7 @@ int CCameraSA::GetFadingDirection() void CCameraSA::Fade(float fFadeOutTime, int iOutOrIn) { DWORD dwFunc = FUNC_Fade; - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); _asm { mov ecx, cameraInterface @@ -337,7 +337,7 @@ void CCameraSA::Fade(float fFadeOutTime, int iOutOrIn) void CCameraSA::SetFadeColor(unsigned char ucRed, unsigned char ucGreen, unsigned char ucBlue) { DWORD dwFunc = FUNC_SetFadeColour; - CCameraSAInterface* cameraInterface = this->GetInterface(); + CCameraSAInterface* cameraInterface = GetInterface(); DWORD dwRed = ucRed; DWORD dwGreen = ucGreen; DWORD dwBlue = ucBlue; @@ -358,7 +358,7 @@ float CCameraSA::GetCameraRotation() RwMatrix* CCameraSA::GetLTM() { - DWORD frame = *(DWORD*)(((DWORD)this->GetInterface()->m_pRwCamera) + 4); + DWORD frame = *(DWORD*)(((DWORD)GetInterface()->m_pRwCamera) + 4); DWORD dwReturn; _asm { @@ -372,7 +372,7 @@ RwMatrix* CCameraSA::GetLTM() CEntity* CCameraSA::GetTargetEntity() { - CEntitySAInterface* pInterface = this->GetInterface()->pTargetEntity; + CEntitySAInterface* pInterface = GetInterface()->pTargetEntity; if (pInterface) { CPools* pPools = pGame->GetPools(); diff --git a/Client/game_sa/CCheckpointSA.cpp b/Client/game_sa/CCheckpointSA.cpp index ac03b2d714..316ce5ebd7 100644 --- a/Client/game_sa/CCheckpointSA.cpp +++ b/Client/game_sa/CCheckpointSA.cpp @@ -16,58 +16,58 @@ void CCheckpointSA::SetPosition(CVector* vecPosition) { - MemCpyFast(&this->GetInterface()->m_pos, vecPosition, sizeof(CVector)); + MemCpyFast(&GetInterface()->m_pos, vecPosition, sizeof(CVector)); } CVector* CCheckpointSA::GetPosition() { - return &this->GetInterface()->m_pos; + return &GetInterface()->m_pos; } void CCheckpointSA::SetPointDirection(CVector* vecPointDirection) { - MemCpyFast(&this->GetInterface()->m_pointDir, vecPointDirection, sizeof(CVector)); + MemCpyFast(&GetInterface()->m_pointDir, vecPointDirection, sizeof(CVector)); } CVector* CCheckpointSA::GetPointDirection() { - return &this->GetInterface()->m_pointDir; + return &GetInterface()->m_pointDir; } DWORD CCheckpointSA::GetType() { - return this->GetInterface()->m_nType; + return GetInterface()->m_nType; } void CCheckpointSA::SetType(WORD wType) { - this->GetInterface()->m_nType = wType; + GetInterface()->m_nType = wType; } bool CCheckpointSA::IsActive() { - return this->GetInterface()->m_bIsUsed; + return GetInterface()->m_bIsUsed; } void CCheckpointSA::Activate() { - this->GetInterface()->m_bIsUsed = true; + GetInterface()->m_bIsUsed = true; } DWORD CCheckpointSA::GetIdentifier() { - return this->GetInterface()->m_nIdentifier; + return GetInterface()->m_nIdentifier; } void CCheckpointSA::SetIdentifier(DWORD dwIdentifier) { - this->GetInterface()->m_nIdentifier = dwIdentifier; + GetInterface()->m_nIdentifier = dwIdentifier; } SharedUtil::SColor CCheckpointSA::GetColor() { // From ABGR - unsigned long ulABGR = this->GetInterface()->rwColour; + unsigned long ulABGR = GetInterface()->rwColour; SharedUtil::SColor color; color.A = (ulABGR >> 24) & 0xff; color.B = (ulABGR >> 16) & 0xff; @@ -79,56 +79,56 @@ SharedUtil::SColor CCheckpointSA::GetColor() void CCheckpointSA::SetColor(const SharedUtil::SColor color) { // To ABGR - this->GetInterface()->rwColour = (color.A << 24) | (color.B << 16) | (color.G << 8) | color.R; + GetInterface()->rwColour = (color.A << 24) | (color.B << 16) | (color.G << 8) | color.R; } void CCheckpointSA::SetPulsePeriod(WORD wPulsePeriod) { - this->GetInterface()->m_nPulsePeriod = wPulsePeriod; + GetInterface()->m_nPulsePeriod = wPulsePeriod; } void CCheckpointSA::SetRotateRate(short RotateRate) { - this->GetInterface()->m_nRotateRate = RotateRate; + GetInterface()->m_nRotateRate = RotateRate; if (RotateRate == 0) { - this->GetInterface()->m_rotFlag = true; + GetInterface()->m_rotFlag = true; } else { - this->GetInterface()->m_rotFlag = false; + GetInterface()->m_rotFlag = false; } } float CCheckpointSA::GetSize() { - return this->GetInterface()->m_fSize; + return GetInterface()->m_fSize; } void CCheckpointSA::SetSize(float fSize) { - this->GetInterface()->m_fSize = fSize; + GetInterface()->m_fSize = fSize; } void CCheckpointSA::SetCameraRange(float fCameraRange) { - this->GetInterface()->m_fCameraRange = fCameraRange; + GetInterface()->m_fCameraRange = fCameraRange; } void CCheckpointSA::SetPulseFraction(float fPulseFraction) { - this->GetInterface()->m_fPulseFraction = fPulseFraction; + GetInterface()->m_fPulseFraction = fPulseFraction; } float CCheckpointSA::GetPulseFraction() { - return this->GetInterface()->m_fPulseFraction; + return GetInterface()->m_fPulseFraction; } void CCheckpointSA::Remove() { - this->GetInterface()->m_bIsUsed = false; - this->GetInterface()->m_nType = 257; - this->GetInterface()->rwColour = 0; + GetInterface()->m_bIsUsed = false; + GetInterface()->m_nType = 257; + GetInterface()->rwColour = 0; } diff --git a/Client/game_sa/CCheckpointsSA.cpp b/Client/game_sa/CCheckpointsSA.cpp index 923baeb06a..e0f83f5de5 100644 --- a/Client/game_sa/CCheckpointsSA.cpp +++ b/Client/game_sa/CCheckpointsSA.cpp @@ -16,7 +16,7 @@ CCheckpointsSA::CCheckpointsSA() { for (int i = 0; i < MAX_CHECKPOINTS; i++) - this->Checkpoints[i] = new CCheckpointSA((CCheckpointSAInterface*)(ARRAY_CHECKPOINTS + i * sizeof(CCheckpointSAInterface))); + Checkpoints[i] = new CCheckpointSA((CCheckpointSAInterface*)(ARRAY_CHECKPOINTS + i * sizeof(CCheckpointSAInterface))); } CCheckpointsSA::~CCheckpointsSA() diff --git a/Client/game_sa/CCoronasSA.cpp b/Client/game_sa/CCoronasSA.cpp index 612cf625d8..bbd739af36 100644 --- a/Client/game_sa/CCoronasSA.cpp +++ b/Client/game_sa/CCoronasSA.cpp @@ -31,20 +31,20 @@ CCoronasSA::~CCoronasSA() CRegisteredCorona* CCoronasSA::GetCorona(DWORD ID) { - return (CRegisteredCorona*)this->Coronas[ID]; + return (CRegisteredCorona*)Coronas[ID]; } CRegisteredCorona* CCoronasSA::CreateCorona(DWORD Identifier, CVector* position) { CRegisteredCoronaSA* corona; - corona = (CRegisteredCoronaSA*)this->FindCorona(Identifier); + corona = (CRegisteredCoronaSA*)FindCorona(Identifier); if (!corona) - corona = (CRegisteredCoronaSA*)this->FindFreeCorona(); + corona = (CRegisteredCoronaSA*)FindFreeCorona(); if (corona) { - RwTexture* texture = this->GetTexture((eCoronaType)CORONATYPE_SHINYSTAR); + RwTexture* texture = GetTexture((eCoronaType)CORONATYPE_SHINYSTAR); if (texture) { corona->Init(Identifier); diff --git a/Client/game_sa/CDoorSA.h b/Client/game_sa/CDoorSA.h index 806be7f773..f97db0e506 100644 --- a/Client/game_sa/CDoorSA.h +++ b/Client/game_sa/CDoorSA.h @@ -49,5 +49,5 @@ class CDoorSA : public CDoor bool IsClosed(); bool IsFullyOpen(); void Open(float fOpenRatio); - eDoorState GetDoorState() { return (eDoorState)this->GetInterface()->m_nDoorState; }; + eDoorState GetDoorState() { return (eDoorState)GetInterface()->m_nDoorState; }; }; diff --git a/Client/game_sa/CExplosionSA.cpp b/Client/game_sa/CExplosionSA.cpp index 37040de184..9666c562fa 100644 --- a/Client/game_sa/CExplosionSA.cpp +++ b/Client/game_sa/CExplosionSA.cpp @@ -44,7 +44,7 @@ CEntity* CExplosionSA::GetExplosionCreator() { case ENTITY_TYPE_PED: { - SClientEntity* pPedClientEntity = pools->GetPed((DWORD*)this->GetInterface()->m_pEntExplosionOwner); + SClientEntity* pPedClientEntity = pools->GetPed((DWORD*)GetInterface()->m_pEntExplosionOwner); if (pPedClientEntity) { return pPedClientEntity->pEntity; @@ -53,7 +53,7 @@ CEntity* CExplosionSA::GetExplosionCreator() } case ENTITY_TYPE_VEHICLE: { - SClientEntity* pVehicleClientEntity = pools->GetVehicle((DWORD*)this->GetInterface()->m_pEntExplosionOwner); + SClientEntity* pVehicleClientEntity = pools->GetVehicle((DWORD*)GetInterface()->m_pEntExplosionOwner); if (pVehicleClientEntity) { return pVehicleClientEntity->pEntity; @@ -85,45 +85,45 @@ void CExplosionSA::Remove() float CExplosionSA::GetExplosionForce() { - return this->GetInterface()->m_fExplosionForce; + return GetInterface()->m_fExplosionForce; } void CExplosionSA::SetExplosionForce(float fForce) { - this->GetInterface()->m_fExplosionForce = fForce; + GetInterface()->m_fExplosionForce = fForce; } void CExplosionSA::SetSilent(bool bSilent) { - this->GetInterface()->m_bMakeSound = !bSilent; + GetInterface()->m_bMakeSound = !bSilent; } unsigned long CExplosionSA::GetActivationTimer() { - return this->GetInterface()->m_ActivationTime; + return GetInterface()->m_ActivationTime; } void CExplosionSA::SetActivationTimer(unsigned long ulActivationTime) { - this->GetInterface()->m_ActivationTime = ulActivationTime; + GetInterface()->m_ActivationTime = ulActivationTime; } DWORD CExplosionSA::GetExpiryTime() { - return this->GetInterface()->m_TimeExpires; + return GetInterface()->m_TimeExpires; } void CExplosionSA::SetExpiryTime(DWORD dwExpiryTime) { - this->GetInterface()->m_TimeExpires = dwExpiryTime; + GetInterface()->m_TimeExpires = dwExpiryTime; } float CExplosionSA::GetExplosionRadius() { - return this->GetInterface()->m_fExplosionRadius; + return GetInterface()->m_fExplosionRadius; } void CExplosionSA::SetExplosionRadius(float fRadius) { - this->GetInterface()->m_fExplosionRadius = fRadius; + GetInterface()->m_fExplosionRadius = fRadius; } diff --git a/Client/game_sa/CExplosionSA.h b/Client/game_sa/CExplosionSA.h index 2739fb97c6..524351752b 100644 --- a/Client/game_sa/CExplosionSA.h +++ b/Client/game_sa/CExplosionSA.h @@ -46,9 +46,9 @@ class CExplosionSA : public CExplosion CExplosionSAInterface* internalInterface; public: - CExplosionSA(CExplosionSAInterface* explosionInterface) { this->internalInterface = explosionInterface; } + CExplosionSA(CExplosionSAInterface* explosionInterface) { internalInterface = explosionInterface; } - CExplosionSAInterface* GetInterface() { return this->internalInterface; }; + CExplosionSAInterface* GetInterface() { return internalInterface; }; eExplosionType GetExplosionType(); CVector* GetExplosionPosition(); diff --git a/Client/game_sa/CFireManagerSA.cpp b/Client/game_sa/CFireManagerSA.cpp index f6fb5938ca..6402ce891b 100644 --- a/Client/game_sa/CFireManagerSA.cpp +++ b/Client/game_sa/CFireManagerSA.cpp @@ -19,7 +19,7 @@ extern CGameSA* pGame; CFireManagerSA::CFireManagerSA() { for (int i = 0; i < MAX_FIRES; i++) - this->Fires[i] = new CFireSA( + Fires[i] = new CFireSA( (CFireSAInterface*)(CLASS_CFireManager + 40 * i)); // + 4 because thats the position of CFire array in CFireManager (see source) } @@ -51,7 +51,7 @@ void CFireManagerSA::ExtinguishPoint(CVector& vecPosition, float fRadius) CFire* CFireManagerSA::StartFire(CEntity* entityTarget, CEntity* entityCreator, float fSize = DEFAULT_FIRE_PARTICLE_SIZE) { - CFire* fire = this->FindFreeFire(); + CFire* fire = FindFreeFire(); if (fire != NULL) { @@ -67,7 +67,7 @@ CFire* CFireManagerSA::StartFire(CEntity* entityTarget, CEntity* entityCreator, CFire* CFireManagerSA::StartFire(CVector& vecPosition, float fSize = DEFAULT_FIRE_PARTICLE_SIZE) { - CFire* fire = this->FindFreeFire(); + CFire* fire = FindFreeFire(); if (fire != NULL) { @@ -86,7 +86,7 @@ void CFireManagerSA::ExtinguishAllFires() CFireSA* fire; for (int i = 0; i < MAX_FIRES; i++) { - fire = (CFireSA*)this->GetFire(i); + fire = (CFireSA*)GetFire(i); if (fire && fire->IsIgnited()) fire->Extinguish(); } @@ -110,7 +110,7 @@ CFire* CFireManagerSA::FindFreeFire() CFireSA* fire; for (int i = 0; i < MAX_FIRES; i++) { - fire = (CFireSA*)this->GetFire(i); + fire = (CFireSA*)GetFire(i); if (fire && !fire->IsIgnited()) return fire; } diff --git a/Client/game_sa/CFireSA.cpp b/Client/game_sa/CFireSA.cpp index 7943298d7f..a3920fa77d 100644 --- a/Client/game_sa/CFireSA.cpp +++ b/Client/game_sa/CFireSA.cpp @@ -23,13 +23,13 @@ extern CGameSA* pGame; void CFireSA::Extinguish() { DWORD dwFunction = FUNC_Extinguish; - DWORD dwPointer = (DWORD)this->internalInterface; + DWORD dwPointer = (DWORD)internalInterface; _asm { mov ecx, dwPointer call dwFunction } - this->internalInterface->bActive = false; + internalInterface->bActive = false; } /** @@ -48,7 +48,7 @@ CVector* CFireSA::GetPosition() */ void CFireSA::SetPosition(CVector& vecPosition) { - this->internalInterface->entityTarget = 0; + internalInterface->entityTarget = 0; MemCpyFast(&internalInterface->vecPosition, &vecPosition, sizeof(CVector)); } @@ -177,11 +177,11 @@ bool CFireSA::IsBeingExtinguished() void CFireSA::Ignite() { - this->internalInterface->bActive = true; + internalInterface->bActive = true; - CVector* vecPosition = this->GetPosition(); + CVector* vecPosition = GetPosition(); DWORD dwFunc = FUNC_CreateFxSysForStrength; - DWORD dwThis = (DWORD)this->internalInterface; + DWORD dwThis = (DWORD)internalInterface; _asm { mov ecx, dwThis @@ -190,22 +190,22 @@ void CFireSA::Ignite() call dwFunc } - this->internalInterface->bBeingExtinguished = 0; - this->internalInterface->bFirstGeneration = 1; - this->internalInterface->nNumGenerationsAllowed = 100; + internalInterface->bBeingExtinguished = 0; + internalInterface->bFirstGeneration = 1; + internalInterface->nNumGenerationsAllowed = 100; } float CFireSA::GetStrength() { - return this->internalInterface->Strength; + return internalInterface->Strength; } void CFireSA::SetStrength(float fStrength) { - this->internalInterface->Strength = fStrength; + internalInterface->Strength = fStrength; } void CFireSA::SetNumGenerationsAllowed(char generations) { - this->internalInterface->nNumGenerationsAllowed = generations; + internalInterface->nNumGenerationsAllowed = generations; } diff --git a/Client/game_sa/CFireSA.h b/Client/game_sa/CFireSA.h index 945fdc2320..bac0adefc4 100644 --- a/Client/game_sa/CFireSA.h +++ b/Client/game_sa/CFireSA.h @@ -45,7 +45,7 @@ class CFireSA : public CFire CFireSAInterface* internalInterface; public: - CFireSA(CFireSAInterface* fireInterface) { this->internalInterface = fireInterface; } + CFireSA(CFireSAInterface* fireInterface) { internalInterface = fireInterface; } void Extinguish(); CVector* GetPosition(); @@ -63,5 +63,5 @@ class CFireSA : public CFire float GetStrength(); void SetStrength(float fStrength); void SetNumGenerationsAllowed(char generations); - CFireSAInterface* GetInterface() { return this->internalInterface; } + CFireSAInterface* GetInterface() { return internalInterface; } }; diff --git a/Client/game_sa/CGameSA.cpp b/Client/game_sa/CGameSA.cpp index 60ef2e3552..769643ab80 100644 --- a/Client/game_sa/CGameSA.cpp +++ b/Client/game_sa/CGameSA.cpp @@ -117,47 +117,47 @@ CGameSA::CGameSA() ObjectGroupsInfo[i].SetGroup(i); } - this->m_pAudioEngine = new CAudioEngineSA((CAudioEngineSAInterface*)CLASS_CAudioEngine); - this->m_pAEAudioHardware = new CAEAudioHardwareSA((CAEAudioHardwareSAInterface*)CLASS_CAEAudioHardware); - this->m_pAESoundManager = new CAESoundManagerSA((CAESoundManagerSAInterface*)CLASS_CAESoundManager); - this->m_pAudioContainer = new CAudioContainerSA(); - this->m_pWorld = new CWorldSA(); - this->m_pPools = new CPoolsSA(); - this->m_pClock = new CClockSA(); - this->m_pRadar = new CRadarSA(); - this->m_pCamera = new CCameraSA((CCameraSAInterface*)CLASS_CCamera); - this->m_pCoronas = new CCoronasSA(); - this->m_pCheckpoints = new CCheckpointsSA(); - this->m_pPickups = new CPickupsSA(); - this->m_pExplosionManager = new CExplosionManagerSA(); - this->m_pHud = new CHudSA(); - this->m_pFireManager = new CFireManagerSA(); - this->m_p3DMarkers = new C3DMarkersSA(); - this->m_pPad = new CPadSA((CPadSAInterface*)CLASS_CPad); - this->m_pCAERadioTrackManager = new CAERadioTrackManagerSA(); - this->m_pWeather = new CWeatherSA(); - this->m_pStats = new CStatsSA(); - this->m_pTaskManagementSystem = new CTaskManagementSystemSA(); - this->m_pSettings = new CSettingsSA(); - this->m_pCarEnterExit = new CCarEnterExitSA(); - this->m_pControllerConfigManager = new CControllerConfigManagerSA(); - this->m_pProjectileInfo = new CProjectileInfoSA(); - this->m_pRenderWare = new CRenderWareSA(version); - this->m_pHandlingManager = new CHandlingManagerSA(); - this->m_pEventList = new CEventListSA(); - this->m_pGarages = new CGaragesSA((CGaragesSAInterface*)CLASS_CGarages); - this->m_pTasks = new CTasksSA((CTaskManagementSystemSA*)m_pTaskManagementSystem); - this->m_pAnimManager = new CAnimManagerSA; - this->m_pStreaming = new CStreamingSA; - this->m_pVisibilityPlugins = new CVisibilityPluginsSA; - this->m_pKeyGen = new CKeyGenSA; - this->m_pRopes = new CRopesSA; - this->m_pFx = new CFxSA((CFxSAInterface*)CLASS_CFx); - this->m_pFxManager = new CFxManagerSA((CFxManagerSAInterface*)CLASS_CFxManager); - this->m_pWaterManager = new CWaterManagerSA(); - this->m_pWeaponStatsManager = new CWeaponStatManagerSA(); - this->m_pPointLights = new CPointLightsSA(); - this->m_collisionStore = new CColStoreSA(); + m_pAudioEngine = new CAudioEngineSA((CAudioEngineSAInterface*)CLASS_CAudioEngine); + m_pAEAudioHardware = new CAEAudioHardwareSA((CAEAudioHardwareSAInterface*)CLASS_CAEAudioHardware); + m_pAESoundManager = new CAESoundManagerSA((CAESoundManagerSAInterface*)CLASS_CAESoundManager); + m_pAudioContainer = new CAudioContainerSA(); + m_pWorld = new CWorldSA(); + m_pPools = new CPoolsSA(); + m_pClock = new CClockSA(); + m_pRadar = new CRadarSA(); + m_pCamera = new CCameraSA((CCameraSAInterface*)CLASS_CCamera); + m_pCoronas = new CCoronasSA(); + m_pCheckpoints = new CCheckpointsSA(); + m_pPickups = new CPickupsSA(); + m_pExplosionManager = new CExplosionManagerSA(); + m_pHud = new CHudSA(); + m_pFireManager = new CFireManagerSA(); + m_p3DMarkers = new C3DMarkersSA(); + m_pPad = new CPadSA((CPadSAInterface*)CLASS_CPad); + m_pCAERadioTrackManager = new CAERadioTrackManagerSA(); + m_pWeather = new CWeatherSA(); + m_pStats = new CStatsSA(); + m_pTaskManagementSystem = new CTaskManagementSystemSA(); + m_pSettings = new CSettingsSA(); + m_pCarEnterExit = new CCarEnterExitSA(); + m_pControllerConfigManager = new CControllerConfigManagerSA(); + m_pProjectileInfo = new CProjectileInfoSA(); + m_pRenderWare = new CRenderWareSA(version); + m_pHandlingManager = new CHandlingManagerSA(); + m_pEventList = new CEventListSA(); + m_pGarages = new CGaragesSA((CGaragesSAInterface*)CLASS_CGarages); + m_pTasks = new CTasksSA((CTaskManagementSystemSA*)m_pTaskManagementSystem); + m_pAnimManager = new CAnimManagerSA; + m_pStreaming = new CStreamingSA; + m_pVisibilityPlugins = new CVisibilityPluginsSA; + m_pKeyGen = new CKeyGenSA; + m_pRopes = new CRopesSA; + m_pFx = new CFxSA((CFxSAInterface*)CLASS_CFx); + m_pFxManager = new CFxManagerSA((CFxManagerSAInterface*)CLASS_CFxManager); + m_pWaterManager = new CWaterManagerSA(); + m_pWeaponStatsManager = new CWeaponStatManagerSA(); + m_pPointLights = new CPointLightsSA(); + m_collisionStore = new CColStoreSA(); // Normal weapon types (WEAPONSKILL_STD) for (int i = 0; i < NUM_WeaponInfosStdSkill; i++) @@ -352,7 +352,7 @@ CModelInfo* CGameSA::GetModelInfo(DWORD dwModelID, bool bCanBeInvalid) */ void CGameSA::StartGame() { - this->SetSystemState(GS_INIT_PLAYING_GAME); + SetSystemState(GS_INIT_PLAYING_GAME); MemPutFast(0xB7CB49, 0); // CTimer::m_UserPause MemPutFast(0xBA67A4, 0); // FrontEndMenuManager + 0x5C } @@ -377,7 +377,7 @@ eSystemState CGameSA::GetSystemState() */ bool CGameSA::InitLocalPlayer(CClientPed* pClientPed) { - CPoolsSA* pools = (CPoolsSA*)this->GetPools(); + CPoolsSA* pools = (CPoolsSA*)GetPools(); if (pools) { //* HACKED IN HERE FOR NOW *// diff --git a/Client/game_sa/CGarageSA.h b/Client/game_sa/CGarageSA.h index 00767f9987..defcf259c9 100644 --- a/Client/game_sa/CGarageSA.h +++ b/Client/game_sa/CGarageSA.h @@ -39,7 +39,7 @@ class CGarageSA : public CGarage CGarageSA(CGarageSAInterface* pInterface); void SetType(BYTE type); - BYTE GetType() const { return this->internalInterface->Type; } + BYTE GetType() const { return internalInterface->Type; } void GetPosition(CVector& vecPosition) const; void GetDirection(float& x1, float& y1, float& x2, float& y2) const; @@ -49,7 +49,7 @@ class CGarageSA : public CGarage void SetOpen(bool bOpen); bool IsOpen() const; - CGarageSAInterface* GetInterface() { return this->internalInterface; } + CGarageSAInterface* GetInterface() { return internalInterface; } private: CGarageSAInterface* internalInterface; diff --git a/Client/game_sa/CGaragesSA.cpp b/Client/game_sa/CGaragesSA.cpp index 79d93e6492..2834e9e79e 100644 --- a/Client/game_sa/CGaragesSA.cpp +++ b/Client/game_sa/CGaragesSA.cpp @@ -14,11 +14,11 @@ CGaragesSA::CGaragesSA(CGaragesSAInterface* pInterface) { - this->internalInterface = pInterface; + internalInterface = pInterface; for (int i = 0; i < MAX_GARAGES; i++) { - this->Garages[i] = new CGarageSA((CGarageSAInterface*)(CLASS_CGarages + 216 * i)); + Garages[i] = new CGarageSA((CGarageSAInterface*)(CLASS_CGarages + 216 * i)); } } @@ -26,8 +26,8 @@ CGaragesSA::~CGaragesSA() { for (int i = 0; i < MAX_GARAGES; i++) { - delete this->Garages[i]; - this->Garages[i] = NULL; + delete Garages[i]; + Garages[i] = NULL; } } @@ -37,7 +37,7 @@ void CGaragesSA::Initialize() static const int iPayAndSprays[] = {7, 8, 10, 11, 12, 15, 18, 19, 24, 27, 32, 33, 36, 40, 41, 47}; for (unsigned int i = 0; i < sizeof(iPayAndSprays) / sizeof(int); ++i) { - this->Garages[iPayAndSprays[i]]->SetType(1); + Garages[iPayAndSprays[i]]->SetType(1); } } @@ -45,7 +45,7 @@ CGarageSA* CGaragesSA::GetGarage(DWORD dwID) { if (dwID >= 0 && dwID < MAX_GARAGES) { - return this->Garages[dwID]; + return Garages[dwID]; } return NULL; } diff --git a/Client/game_sa/CHeliSA.cpp b/Client/game_sa/CHeliSA.cpp new file mode 100644 index 0000000000..986e3e9764 --- /dev/null +++ b/Client/game_sa/CHeliSA.cpp @@ -0,0 +1,18 @@ +/***************************************************************************** + * + * PROJECT: Multi Theft Auto + * LICENSE: See LICENSE in the top level directory + * FILE: game_sa/CHeliSA.cpp + * + * Multi Theft Auto is available from http://www.multitheftauto.com/ + * + *****************************************************************************/ + +#include "StdInc.h" +#include "CHeliSA.h" + +CHeliSA::CHeliSA(CHeliSAInterface* pInterface) +{ + SetInterface(pInterface); + Init(); +} diff --git a/Client/game_sa/CHeliSA.h b/Client/game_sa/CHeliSA.h new file mode 100644 index 0000000000..49fc0d866d --- /dev/null +++ b/Client/game_sa/CHeliSA.h @@ -0,0 +1,24 @@ +/***************************************************************************** + * + * PROJECT: Multi Theft Auto v1.0 + * LICENSE: See LICENSE in the top level directory + * FILE: game_sa/CHeliSA.h + * + * Multi Theft Auto is available from http://www.multitheftauto.com/ + * + *****************************************************************************/ + +#pragma once + +#include +#include "CAutomobileSA.h" + +class CHeliSAInterface : public CAutomobileSAInterface +{ +}; + +class CHeliSA final : public virtual CHeli, public virtual CAutomobileSA +{ +public: + CHeliSA(CHeliSAInterface* pInterface); +}; diff --git a/Client/game_sa/CModelInfoSA.cpp b/Client/game_sa/CModelInfoSA.cpp index 1daabc1c2e..7536848da3 100644 --- a/Client/game_sa/CModelInfoSA.cpp +++ b/Client/game_sa/CModelInfoSA.cpp @@ -54,7 +54,7 @@ static void CColAccel_addCacheCol(int idx, const CColModelSAInterface* colModel) CModelInfoSA::CModelInfoSA() { m_pInterface = NULL; - this->m_dwModelID = 0xFFFFFFFF; + m_dwModelID = 0xFFFFFFFF; m_dwReferences = 0; m_dwPendingInterfaceRef = 0; m_pOriginalColModelInterface = NULL; diff --git a/Client/game_sa/CMonsterTruckSA.cpp b/Client/game_sa/CMonsterTruckSA.cpp index 2d47a0b265..48bfeab7e0 100644 --- a/Client/game_sa/CMonsterTruckSA.cpp +++ b/Client/game_sa/CMonsterTruckSA.cpp @@ -12,12 +12,8 @@ #include "StdInc.h" #include "CMonsterTruckSA.h" -CMonsterTruckSA::CMonsterTruckSA(CMonsterTruckSAInterface* monstertruck) : CAutomobileSA(monstertruck) -{ - this->m_pInterface = monstertruck; -} - -CMonsterTruckSA::CMonsterTruckSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) - : CAutomobileSA(dwModelID, ucVariation, ucVariation2) +CMonsterTruckSA::CMonsterTruckSA(CMonsterTruckSAInterface* pInterface) { + SetInterface(pInterface); + Init(); } diff --git a/Client/game_sa/CMonsterTruckSA.h b/Client/game_sa/CMonsterTruckSA.h index 1618e79a0f..8d3f98a001 100644 --- a/Client/game_sa/CMonsterTruckSA.h +++ b/Client/game_sa/CMonsterTruckSA.h @@ -19,10 +19,10 @@ class CMonsterTruckSAInterface : public CAutomobileSAInterface // fill this }; -class CMonsterTruckSA : public CMonsterTruck, public CAutomobileSA +class CMonsterTruckSA final : public virtual CMonsterTruck, public virtual CAutomobileSA { -private: public: - CMonsterTruckSA(CMonsterTruckSAInterface* monstertruck); - CMonsterTruckSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CMonsterTruckSA(CMonsterTruckSAInterface* pInterface); + + CMonsterTruckSAInterface* GetMonsterTruckInterface() { return reinterpret_cast(GetInterface()); } }; diff --git a/Client/game_sa/CObjectSA.cpp b/Client/game_sa/CObjectSA.cpp index 3f3c00bf9b..ef31e9b37a 100644 --- a/Client/game_sa/CObjectSA.cpp +++ b/Client/game_sa/CObjectSA.cpp @@ -69,12 +69,12 @@ struct CFileObjectInstance CObjectSA::CObjectSA(CObjectSAInterface* objectInterface) { - this->SetInterface(objectInterface); + SetInterface(objectInterface); m_ucAlpha = 255; // Setup some flags - this->BeingDeleted = false; - this->DoNotRemoveFromGame = false; + BeingDeleted = false; + DoNotRemoveFromGame = false; if (m_pInterface) { @@ -99,14 +99,14 @@ CObjectSA::CObjectSA(DWORD dwModel, bool bBreakingDisabled) if (dwObjectPtr) { - this->SetInterface((CEntitySAInterface*)dwObjectPtr); + SetInterface((CEntitySAInterface*)dwObjectPtr); CWorldSA* world = (CWorldSA*)pGame->GetWorld(); world->Add(m_pInterface, CObject_Constructor); // Setup some flags - this->BeingDeleted = false; - this->DoNotRemoveFromGame = false; + BeingDeleted = false; + DoNotRemoveFromGame = false; MemPutFast(dwObjectPtr + 316, 6); if (bBreakingDisabled) { @@ -124,7 +124,7 @@ CObjectSA::CObjectSA(DWORD dwModel, bool bBreakingDisabled) else { // The exception handler doesn't work for some reason, so do this - this->SetInterface(nullptr); + SetInterface(nullptr); } m_ucAlpha = 255; @@ -138,7 +138,7 @@ CObjectSA::CObjectSA(DWORD dwModel, bool bBreakingDisabled) CObjectSA::~CObjectSA() { - if (!this->BeingDeleted && DoNotRemoveFromGame == false) + if (!BeingDeleted && DoNotRemoveFromGame == false) { CEntitySAInterface* pInterface = GetInterface(); if (pInterface) @@ -160,7 +160,7 @@ CObjectSA::~CObjectSA() } } - this->BeingDeleted = true; + BeingDeleted = true; ((CPoolsSA*)pGame->GetPools())->RemoveObject((CObject*)(CObjectSA*)this); } } @@ -168,7 +168,7 @@ CObjectSA::~CObjectSA() void CObjectSA::Explode() { DWORD dwFunc = FUNC_CObject_Explode; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { @@ -221,19 +221,19 @@ void CObjectSA::Break() void CObjectSA::SetHealth(float fHealth) { - static_cast(this->GetInterface())->fHealth = fHealth; + static_cast(GetInterface())->fHealth = fHealth; } float CObjectSA::GetHealth() { - return static_cast(this->GetInterface())->fHealth; + return static_cast(GetInterface())->fHealth; } void CObjectSA::SetModelIndex(unsigned long ulModel) { // Delete any existing RwObject first - DWORD dwFunc = this->GetInterface()->vtbl->DeleteRwObject; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwFunc = GetInterface()->vtbl->DeleteRwObject; + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -241,7 +241,7 @@ void CObjectSA::SetModelIndex(unsigned long ulModel) } // Jax: I'm not sure if using the vtbl is right (as ped and vehicle dont), but it works - dwFunc = this->GetInterface()->vtbl->SetModelIndex; + dwFunc = GetInterface()->vtbl->SetModelIndex; _asm { mov ecx, dwThis diff --git a/Client/game_sa/CPadSA.cpp b/Client/game_sa/CPadSA.cpp index 251e3b3997..2097d4a162 100644 --- a/Client/game_sa/CPadSA.cpp +++ b/Client/game_sa/CPadSA.cpp @@ -14,34 +14,34 @@ CControllerState* CPadSA::GetCurrentControllerState(CControllerState* ControllerState) { - MemCpyFast(ControllerState, &this->internalInterface->NewState, sizeof(CControllerState)); + MemCpyFast(ControllerState, &internalInterface->NewState, sizeof(CControllerState)); return ControllerState; } CControllerState* CPadSA::GetLastControllerState(CControllerState* ControllerState) { - MemCpyFast(ControllerState, &this->internalInterface->OldState, sizeof(CControllerState)); + MemCpyFast(ControllerState, &internalInterface->OldState, sizeof(CControllerState)); return ControllerState; } void CPadSA::SetCurrentControllerState(CControllerState* ControllerState) { - MemCpyFast(&this->internalInterface->NewState, ControllerState, sizeof(CControllerState)); + MemCpyFast(&internalInterface->NewState, ControllerState, sizeof(CControllerState)); } void CPadSA::SetLastControllerState(CControllerState* ControllerState) { - MemCpyFast(&this->internalInterface->OldState, ControllerState, sizeof(CControllerState)); + MemCpyFast(&internalInterface->OldState, ControllerState, sizeof(CControllerState)); } void CPadSA::Store() { - MemCpyFast(&this->StoredPad, this->internalInterface, sizeof(CPadSAInterface)); + MemCpyFast(&StoredPad, internalInterface, sizeof(CPadSAInterface)); } void CPadSA::Restore() { - MemCpyFast(this->internalInterface, &this->StoredPad, sizeof(CPadSAInterface)); + MemCpyFast(internalInterface, &StoredPad, sizeof(CPadSAInterface)); } bool CPadSA::IsEnabled() diff --git a/Client/game_sa/CPadSA.h b/Client/game_sa/CPadSA.h index e6e571a3a7..b4ee1aaf22 100644 --- a/Client/game_sa/CPadSA.h +++ b/Client/game_sa/CPadSA.h @@ -65,7 +65,7 @@ class CPadSA : public CPad CPadSAInterface StoredPad; public: - CPadSA(CPadSAInterface* padInterface) { this->internalInterface = padInterface; }; + CPadSA(CPadSAInterface* padInterface) { internalInterface = padInterface; }; CControllerState* GetCurrentControllerState(CControllerState* ControllerState); CControllerState* GetLastControllerState(CControllerState* ControllerState); @@ -76,7 +76,7 @@ class CPadSA : public CPad bool IsEnabled(); void Disable(bool bDisable); void Clear(); - CPadSAInterface* GetInterface() { return this->internalInterface; }; + CPadSAInterface* GetInterface() { return internalInterface; }; void SetHornHistoryValue(bool value); void SetLastTimeTouched(DWORD dwTime); }; diff --git a/Client/game_sa/CPedIKSA.h b/Client/game_sa/CPedIKSA.h index 38a9baf461..26a2a4525b 100644 --- a/Client/game_sa/CPedIKSA.h +++ b/Client/game_sa/CPedIKSA.h @@ -71,9 +71,9 @@ class CPedIKSA : public CPedIK CPedIKSA(CPedIKSAInterface* ikInterface) { internalInterface = ikInterface; }; // r*'s functions - void SetFlag(DWORD flag) { this->internalInterface->m_flags |= flag; } - void ClearFlag(DWORD flag) { this->internalInterface->m_flags &= ~flag; } - bool IsFlagSet(DWORD flag) { return ((this->internalInterface->m_flags & flag) > 0 ? 1 : 0); } + void SetFlag(DWORD flag) { internalInterface->m_flags |= flag; } + void ClearFlag(DWORD flag) { internalInterface->m_flags &= ~flag; } + bool IsFlagSet(DWORD flag) { return ((internalInterface->m_flags & flag) > 0 ? 1 : 0); } void RotateTorso(void* bone, LimbOrientation* orientation, bool flag); }; diff --git a/Client/game_sa/CPedIntelligenceSA.cpp b/Client/game_sa/CPedIntelligenceSA.cpp index 1c41e41dda..3c5b1359d0 100644 --- a/Client/game_sa/CPedIntelligenceSA.cpp +++ b/Client/game_sa/CPedIntelligenceSA.cpp @@ -17,20 +17,20 @@ CPedIntelligenceSA::CPedIntelligenceSA(CPedIntelligenceSAInterface* pedIntelligenceSAInterface, CPed* ped) { - this->internalInterface = pedIntelligenceSAInterface; this->ped = ped; + internalInterface = pedIntelligenceSAInterface; CTaskManagerSAInterface* pTaskManagerInterface = (CTaskManagerSAInterface*)&(pedIntelligenceSAInterface->taskManager); - this->TaskManager = new CTaskManagerSA(pTaskManagerInterface, this->ped); + TaskManager = new CTaskManagerSA(pTaskManagerInterface, ped); } CPedIntelligenceSA::~CPedIntelligenceSA() { - delete this->TaskManager; + delete TaskManager; } CTaskManager* CPedIntelligenceSA::GetTaskManager() { - return this->TaskManager; + return TaskManager; } bool CPedIntelligenceSA::TestForStealthKill(CPed* pPed, bool bUnk) diff --git a/Client/game_sa/CPedIntelligenceSA.h b/Client/game_sa/CPedIntelligenceSA.h index 69dd0caac4..560df3730d 100644 --- a/Client/game_sa/CPedIntelligenceSA.h +++ b/Client/game_sa/CPedIntelligenceSA.h @@ -50,7 +50,7 @@ class CPedIntelligenceSA : public CPedIntelligence public: CPedIntelligenceSA(CPedIntelligenceSAInterface* pedIntelligenceSAInterface, CPed* ped); ~CPedIntelligenceSA(); - CPedIntelligenceSAInterface* GetInterface() { return this->internalInterface; } + CPedIntelligenceSAInterface* GetInterface() { return internalInterface; } CTaskManager* GetTaskManager(); bool TestForStealthKill(CPed* pPed, bool bUnk); CTaskSAInterface* SetTaskDuckSecondary(unsigned short nLengthOfDuck); diff --git a/Client/game_sa/CPedSA.cpp b/Client/game_sa/CPedSA.cpp index a05aec0ed3..47912b717b 100644 --- a/Client/game_sa/CPedSA.cpp +++ b/Client/game_sa/CPedSA.cpp @@ -29,12 +29,12 @@ int g_bOnlyUpdateRotations = false; CPedSA::CPedSA() : m_pPedIntelligence(NULL), m_pPedInterface(NULL), m_pPedSound(NULL), m_iCustomMoveAnim(0) { - MemSetFast(this->m_pWeapons, 0, sizeof(CWeaponSA*) * WEAPONSLOT_MAX); + MemSetFast(m_pWeapons, 0, sizeof(CWeaponSA*) * WEAPONSLOT_MAX); } CPedSA::CPedSA(CPedSAInterface* pPedInterface) : m_pPedIntelligence(NULL), m_pPedInterface(pPedInterface), m_pPedSound(NULL), m_iCustomMoveAnim(0) { - MemSetFast(this->m_pWeapons, 0, sizeof(CWeaponSA*) * WEAPONSLOT_MAX); + MemSetFast(m_pWeapons, 0, sizeof(CWeaponSA*) * WEAPONSLOT_MAX); } void CPedSA::SetInterface(CEntitySAInterface* intInterface) @@ -51,8 +51,8 @@ CPedSA::~CPedSA() for (int i = 0; i < WEAPONSLOT_MAX; i++) { - if (this->m_pWeapons[i]) - delete this->m_pWeapons[i]; + if (m_pWeapons[i]) + delete m_pWeapons[i]; } // Make sure this ped is not refed in the flame shot info array @@ -88,11 +88,11 @@ void CPedSA::Init() mov dwPedIntelligence, eax } CPedIntelligenceSAInterface* m_pPedIntelligenceInterface = (CPedIntelligenceSAInterface*)(dwPedIntelligence); - this->m_pPedIntelligence = new CPedIntelligenceSA(m_pPedIntelligenceInterface, this); - this->m_pPedSound = new CPedSoundSA(&pedInterface->pedSound); + m_pPedIntelligence = new CPedIntelligenceSA(m_pPedIntelligenceInterface, this); + m_pPedSound = new CPedSoundSA(&pedInterface->pedSound); for (int i = 0; i < WEAPONSLOT_MAX; i++) - this->m_pWeapons[i] = new CWeaponSA(&(pedInterface->Weapons[i]), this, (eWeaponSlot)i); + m_pWeapons[i] = new CWeaponSA(&(pedInterface->Weapons[i]), this, (eWeaponSlot)i); // this->m_pPedIK = new Cm_pPedIKSA(&(pedInterface->m_pPedIK)); } @@ -100,7 +100,7 @@ void CPedSA::Init() void CPedSA::SetModelIndex(DWORD dwModelIndex) { DWORD dwFunction = FUNC_SetModelIndex; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -129,7 +129,7 @@ void CPedSA::RemoveGeometryRef() bool CPedSA::IsInWater() { - CTask* pTask = this->m_pPedIntelligence->GetTaskManager()->GetTask(TASK_PRIORITY_EVENT_RESPONSE_NONTEMP); + CTask* pTask = m_pPedIntelligence->GetTaskManager()->GetTask(TASK_PRIORITY_EVENT_RESPONSE_NONTEMP); return (pTask && (pTask->GetTaskType() == TASK_COMPLEX_IN_WATER)); } @@ -141,7 +141,7 @@ bool CPedSA::AddProjectile(eWeaponType eWeapon, CVector vecOrigin, float fForce, void CPedSA::DetachPedFromEntity() { DWORD dwFunc = FUNC_DetachPedFromEntity; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -160,7 +160,7 @@ void CPedSA::AttachPedToEntity(DWORD dwEntityInterface, CVector* vector, unsigne { // sDirection and fRotationLimit only apply to first-person shooting (bChangeCamera) DWORD dwFunc = FUNC_AttachPedToEntity; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); float fX = vector->fX; float fY = vector->fY; float fZ = vector->fZ; @@ -190,9 +190,9 @@ void CPedSA::AttachPedToEntity(DWORD dwEntityInterface, CVector* vector, unsigne CVehicle* CPedSA::GetVehicle() { - if (((CPedSAInterface*)this->GetInterface())->pedFlags.bInVehicle) + if (((CPedSAInterface*)GetInterface())->pedFlags.bInVehicle) { - CVehicleSAInterface* vehicle = (CVehicleSAInterface*)(((CPedSAInterface*)this->GetInterface())->CurrentObjective); + CVehicleSAInterface* vehicle = (CVehicleSAInterface*)(((CPedSAInterface*)GetInterface())->CurrentObjective); if (vehicle) { SClientEntity* pVehicleClientEntity = pGame->GetPools()->GetVehicle((DWORD*)vehicle); @@ -217,7 +217,7 @@ void CPedSA::Respawn(CVector* position, bool bCameraCut) float fZ = position->fZ; float fUnk = 1.0f; DWORD dwFunc = FUNC_RestorePlayerStuffDuringResurrection; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { push fUnk @@ -289,7 +289,7 @@ void CPedSA::SetOxygenLevel(float fOxygen) void CPedSA::SetIsStanding(bool bStanding) { DWORD dwFunc = FUNC_SetIsStanding; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -305,13 +305,13 @@ DWORD CPedSA::GetType() void CPedSA::SetType(DWORD m_dwType) { - this->m_dwType = m_dwType; + m_dwType = m_dwType; } void CPedSA::RemoveWeaponModel(int iModel) { DWORD dwFunc = FUNC_RemoveWeaponModel; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -323,7 +323,7 @@ void CPedSA::RemoveWeaponModel(int iModel) void CPedSA::ClearWeapon(eWeaponType weaponType) { DWORD dwFunc = FUNC_ClearWeapon; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -370,7 +370,7 @@ CWeapon* CPedSA::GiveWeapon(eWeaponType weaponType, unsigned int uiAmmo, eWeapon DWORD dwReturn = 0; DWORD dwFunc = FUNC_GiveWeapon; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -443,7 +443,7 @@ void CPedSA::SetCurrentRotation(float fRotation) GetPedInterface()->fCurrentRotation = fRotation; // char szDebug[255] = {'\0'}; - // sprintf(szDebug,"CurrentRotate Offset: %d", ((DWORD)&((CPedSAInterface *)this->GetInterface())->CurrentRotate) - (DWORD)this->GetInterface()); + // sprintf(szDebug,"CurrentRotate Offset: %d", ((DWORD)&((CPedSAInterface *)GetInterface())->CurrentRotate) - (DWORD)GetInterface()); // OutputDebugString(szDebug); } @@ -468,7 +468,7 @@ void CPedSA::SetCurrentWeaponSlot(eWeaponSlot weaponSlot) if (pWeapon) RemoveWeaponModel(pWeapon->GetInfo(WEAPONSKILL_STD)->GetModel()); - CPedSAInterface* thisPed = (CPedSAInterface*)this->GetInterface(); + CPedSAInterface* thisPed = (CPedSAInterface*)GetInterface(); // set the new weapon slot thisPed->bCurrentWeaponSlot = weaponSlot; @@ -478,7 +478,7 @@ void CPedSA::SetCurrentWeaponSlot(eWeaponSlot weaponSlot) // if ( pPed == this && thisPed->pPlayerInfo ) //{ - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); if (pPed == this) { ((CPlayerInfoSA*)pGame->GetPlayerInfo())->GetInterface()->PlayerPedData.m_nChosenWeapon = weaponSlot; @@ -579,22 +579,22 @@ void CPedSA::ApplySwimAndSlopeRotations() bool CPedSA::IsDucking() { - return ((CPedSAInterface*)this->GetInterface())->pedFlags.bIsDucking; + return ((CPedSAInterface*)GetInterface())->pedFlags.bIsDucking; } void CPedSA::SetDucking(bool bDuck) { - ((CPedSAInterface*)this->GetInterface())->pedFlags.bIsDucking = bDuck; + ((CPedSAInterface*)GetInterface())->pedFlags.bIsDucking = bDuck; } int CPedSA::GetCantBeKnockedOffBike() { - return ((CPedSAInterface*)this->GetInterface())->pedFlags.CantBeKnockedOffBike; + return ((CPedSAInterface*)GetInterface())->pedFlags.CantBeKnockedOffBike; } void CPedSA::SetCantBeKnockedOffBike(int iCantBeKnockedOffBike) { - ((CPedSAInterface*)this->GetInterface())->pedFlags.CantBeKnockedOffBike = iCantBeKnockedOffBike; + ((CPedSAInterface*)GetInterface())->pedFlags.CantBeKnockedOffBike = iCantBeKnockedOffBike; } void CPedSA::QuitEnteringCar(CVehicle* vehicle, int iSeat, bool bUnknown) @@ -604,7 +604,7 @@ void CPedSA::QuitEnteringCar(CVehicle* vehicle, int iSeat, bool bUnknown) return; DWORD dwFunc = FUNC_QuitEnteringCar; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); DWORD dwVehicle = (DWORD)pVehicleSA->GetInterface(); _asm { @@ -620,7 +620,7 @@ void CPedSA::QuitEnteringCar(CVehicle* vehicle, int iSeat, bool bUnknown) bool CPedSA::IsWearingGoggles() { DWORD dwFunc = FUNC_IsWearingGoggles; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); bool bReturn = false; _asm { @@ -637,7 +637,7 @@ void CPedSA::SetGogglesState(bool bIsWearingThem) if (bIsWearingThem) dwFunc = FUNC_PutOnGoggles; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -649,7 +649,7 @@ void CPedSA::SetClothesTextureAndModel(const char* szTexture, const char* szMode { DWORD dwFunc = FUNC_CPedClothesDesc__SetTextureAndModel; // DWORD dwThis = (DWORD)this->GetInterface()->PlayerPedData.m_pClothes; - DWORD dwThis = (DWORD)((CPedSAInterface*)this->GetInterface())->pPlayerData->m_pClothes; + DWORD dwThis = (DWORD)((CPedSAInterface*)GetInterface())->pPlayerData->m_pClothes; _asm { mov ecx, dwThis @@ -663,7 +663,7 @@ void CPedSA::SetClothesTextureAndModel(const char* szTexture, const char* szMode void CPedSA::RebuildPlayer() { DWORD dwFunc = FUNC_CClothes__RebuildPlayer; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { push 0 @@ -675,14 +675,14 @@ void CPedSA::RebuildPlayer() eFightingStyle CPedSA::GetFightingStyle() { - return (eFightingStyle)((CPedSAInterface*)this->GetInterface())->bFightingStyle; + return (eFightingStyle)((CPedSAInterface*)GetInterface())->bFightingStyle; } void CPedSA::SetFightingStyle(eFightingStyle style, BYTE bStyleExtra) { BYTE bStyle = (BYTE)style; - BYTE* pFightingStyle = &((CPedSAInterface*)this->GetInterface())->bFightingStyle; - BYTE* pFightingStyleExtra = &((CPedSAInterface*)this->GetInterface())->bFightingStyleExtra; + BYTE* pFightingStyle = &((CPedSAInterface*)GetInterface())->bFightingStyle; + BYTE* pFightingStyleExtra = &((CPedSAInterface*)GetInterface())->bFightingStyleExtra; if (bStyle != *pFightingStyle) { *pFightingStyle = bStyle; @@ -717,7 +717,7 @@ void CPedSA::SetFightingStyle(eFightingStyle style, BYTE bStyleExtra) CEntity* CPedSA::GetContactEntity() { - CEntitySAInterface* pInterface = ((CPedSAInterface*)this->GetInterface())->pContactEntity; + CEntitySAInterface* pInterface = ((CPedSAInterface*)GetInterface())->pContactEntity; if (pInterface) { CPools* pPools = pGame->GetPools(); @@ -752,12 +752,12 @@ CEntity* CPedSA::GetContactEntity() unsigned char CPedSA::GetRunState() { - return *(unsigned char*)(((DWORD)(this->GetInterface()) + 1332)); + return *(unsigned char*)(((DWORD)(GetInterface()) + 1332)); } CEntity* CPedSA::GetTargetedEntity() { - CEntitySAInterface* pInterface = ((CPedSAInterface*)this->GetInterface())->pTargetedEntity; + CEntitySAInterface* pInterface = ((CPedSAInterface*)GetInterface())->pTargetedEntity; if (pInterface) { CPools* pPools = pGame->GetPools(); @@ -776,7 +776,7 @@ void CPedSA::SetTargetedEntity(CEntity* pEntity) pInterface = pEntitySA->GetInterface(); } - ((CPedSAInterface*)this->GetInterface())->pTargetedEntity = pInterface; + ((CPedSAInterface*)GetInterface())->pTargetedEntity = pInterface; } bool CPedSA::GetCanBeShotInVehicle() @@ -801,7 +801,7 @@ void CPedSA::SetTestForShotInVehicle(bool bTest) void CPedSA::RemoveBodyPart(int i, char c) { - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); DWORD dwFunc = FUNC_CPed_RemoveBodyPart; _asm { @@ -814,7 +814,7 @@ void CPedSA::RemoveBodyPart(int i, char c) void CPedSA::SetFootBlood(unsigned int uiFootBlood) { - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); // Check if the ped is to have foot blood if (uiFootBlood > 0) { @@ -832,7 +832,7 @@ void CPedSA::SetFootBlood(unsigned int uiFootBlood) unsigned int CPedSA::GetFootBlood() { - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); // Check if the ped has the foot blood flag if (*(unsigned short*)(dwThis + 0x46F) & 16) { diff --git a/Client/game_sa/CPhysicalSA.cpp b/Client/game_sa/CPhysicalSA.cpp index 2df2fd2417..7cdade7bba 100644 --- a/Client/game_sa/CPhysicalSA.cpp +++ b/Client/game_sa/CPhysicalSA.cpp @@ -41,7 +41,7 @@ void CPhysicalSA::RestoreLastGoodPhysicsState() SetTurnSpeed(&vecDefault); SetMoveSpeed(&vecDefault); - CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)this->GetInterface(); + CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)GetInterface(); pInterface->m_pad4d = 0; pInterface->m_fDamageImpulseMagnitude = 0; pInterface->m_vecCollisionImpactVelocity = CVector(); @@ -73,7 +73,7 @@ CVector* CPhysicalSA::GetTurnSpeed(CVector* vecTurnSpeed) CVector* CPhysicalSA::GetMoveSpeedInternal(CVector* vecMoveSpeed) { DWORD dwFunc = FUNC_GetMoveSpeed; - DWORD dwThis = (DWORD)((CPhysicalSAInterface*)this->GetInterface()); + DWORD dwThis = (DWORD)((CPhysicalSAInterface*)GetInterface()); DWORD dwReturn = 0; _asm { @@ -88,7 +88,7 @@ CVector* CPhysicalSA::GetMoveSpeedInternal(CVector* vecMoveSpeed) CVector* CPhysicalSA::GetTurnSpeedInternal(CVector* vecTurnSpeed) { DWORD dwFunc = FUNC_GetTurnSpeed; - DWORD dwThis = (DWORD)((CPhysicalSAInterface*)this->GetInterface()); + DWORD dwThis = (DWORD)((CPhysicalSAInterface*)GetInterface()); DWORD dwReturn = 0; _asm { @@ -103,7 +103,7 @@ CVector* CPhysicalSA::GetTurnSpeedInternal(CVector* vecTurnSpeed) void CPhysicalSA::SetMoveSpeed(CVector* vecMoveSpeed) { DWORD dwFunc = FUNC_GetMoveSpeed; - DWORD dwThis = (DWORD)((CPhysicalSAInterface*)this->GetInterface()); + DWORD dwThis = (DWORD)((CPhysicalSAInterface*)GetInterface()); DWORD dwReturn = 0; _asm @@ -123,7 +123,7 @@ void CPhysicalSA::SetMoveSpeed(CVector* vecMoveSpeed) void CPhysicalSA::SetTurnSpeed(CVector* vecTurnSpeed) { - ((CPhysicalSAInterface*)this->GetInterface())->m_vecAngularVelocity = *vecTurnSpeed; + ((CPhysicalSAInterface*)GetInterface())->m_vecAngularVelocity = *vecTurnSpeed; if (GetInterface()->nType == ENTITY_TYPE_OBJECT) { @@ -134,68 +134,68 @@ void CPhysicalSA::SetTurnSpeed(CVector* vecTurnSpeed) float CPhysicalSA::GetMass() { - return ((CPhysicalSAInterface*)this->GetInterface())->m_fMass; + return ((CPhysicalSAInterface*)GetInterface())->m_fMass; } void CPhysicalSA::SetMass(float fMass) { - ((CPhysicalSAInterface*)this->GetInterface())->m_fMass = fMass; + ((CPhysicalSAInterface*)GetInterface())->m_fMass = fMass; } float CPhysicalSA::GetTurnMass() { - return ((CPhysicalSAInterface*)this->GetInterface())->m_fTurnMass; + return ((CPhysicalSAInterface*)GetInterface())->m_fTurnMass; } void CPhysicalSA::SetTurnMass(float fTurnMass) { - ((CPhysicalSAInterface*)this->GetInterface())->m_fTurnMass = fTurnMass; + ((CPhysicalSAInterface*)GetInterface())->m_fTurnMass = fTurnMass; } float CPhysicalSA::GetAirResistance() { - return ((CPhysicalSAInterface*)this->GetInterface())->m_fAirResistance; + return ((CPhysicalSAInterface*)GetInterface())->m_fAirResistance; } void CPhysicalSA::SetAirResistance(float fAirResistance) { - ((CPhysicalSAInterface*)this->GetInterface())->m_fAirResistance = fAirResistance; + ((CPhysicalSAInterface*)GetInterface())->m_fAirResistance = fAirResistance; } float CPhysicalSA::GetElasticity() { - return ((CPhysicalSAInterface*)this->GetInterface())->m_fElasticity; + return ((CPhysicalSAInterface*)GetInterface())->m_fElasticity; } void CPhysicalSA::SetElasticity(float fElasticity) { - ((CPhysicalSAInterface*)this->GetInterface())->m_fElasticity = fElasticity; + ((CPhysicalSAInterface*)GetInterface())->m_fElasticity = fElasticity; } float CPhysicalSA::GetBuoyancyConstant() { - return ((CPhysicalSAInterface*)this->GetInterface())->m_fBuoyancyConstant; + return ((CPhysicalSAInterface*)GetInterface())->m_fBuoyancyConstant; } void CPhysicalSA::SetBuoyancyConstant(float fBuoyancyConstant) { - ((CPhysicalSAInterface*)this->GetInterface())->m_fBuoyancyConstant = fBuoyancyConstant; + ((CPhysicalSAInterface*)GetInterface())->m_fBuoyancyConstant = fBuoyancyConstant; } void CPhysicalSA::GetCenterOfMass(CVector& vecCenterOfMass) { - vecCenterOfMass = ((CPhysicalSAInterface*)this->GetInterface())->m_vecCenterOfMass; + vecCenterOfMass = ((CPhysicalSAInterface*)GetInterface())->m_vecCenterOfMass; } void CPhysicalSA::SetCenterOfMass(CVector& vecCenterOfMass) { - ((CPhysicalSAInterface*)this->GetInterface())->m_vecCenterOfMass = vecCenterOfMass; + ((CPhysicalSAInterface*)GetInterface())->m_vecCenterOfMass = vecCenterOfMass; } void CPhysicalSA::ProcessCollision() { DWORD dwFunc = FUNC_ProcessCollision; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { @@ -218,17 +218,17 @@ void CPhysicalSA::AddToMovingList() float CPhysicalSA::GetDamageImpulseMagnitude() { - return ((CPhysicalSAInterface*)this->GetInterface())->m_fDamageImpulseMagnitude; + return ((CPhysicalSAInterface*)GetInterface())->m_fDamageImpulseMagnitude; } void CPhysicalSA::SetDamageImpulseMagnitude(float fMagnitude) { - ((CPhysicalSAInterface*)this->GetInterface())->m_fDamageImpulseMagnitude = fMagnitude; + ((CPhysicalSAInterface*)GetInterface())->m_fDamageImpulseMagnitude = fMagnitude; } CEntity* CPhysicalSA::GetDamageEntity() { - CEntitySAInterface* pInterface = ((CPhysicalSAInterface*)this->GetInterface())->m_pCollidedEntity; + CEntitySAInterface* pInterface = ((CPhysicalSAInterface*)GetInterface())->m_pCollidedEntity; if (pInterface) { CPools* pPools = pGame->GetPools(); @@ -241,18 +241,18 @@ void CPhysicalSA::SetDamageEntity(CEntity* pEntity) { CEntitySA* pEntitySA = dynamic_cast(pEntity); if (pEntitySA) - ((CPhysicalSAInterface*)this->GetInterface())->m_pCollidedEntity = pEntitySA->GetInterface(); + ((CPhysicalSAInterface*)GetInterface())->m_pCollidedEntity = pEntitySA->GetInterface(); } void CPhysicalSA::ResetLastDamage() { - ((CPhysicalSAInterface*)this->GetInterface())->m_fDamageImpulseMagnitude = 0.0f; - ((CPhysicalSAInterface*)this->GetInterface())->m_pCollidedEntity = NULL; + ((CPhysicalSAInterface*)GetInterface())->m_fDamageImpulseMagnitude = 0.0f; + ((CPhysicalSAInterface*)GetInterface())->m_pCollidedEntity = NULL; } CEntity* CPhysicalSA::GetAttachedEntity() { - CEntitySAInterface* pInterface = ((CPhysicalSAInterface*)this->GetInterface())->m_pAttachedEntity; + CEntitySAInterface* pInterface = ((CPhysicalSAInterface*)GetInterface())->m_pAttachedEntity; if (pInterface) { CPools* pPools = pGame->GetPools(); @@ -272,11 +272,11 @@ void CPhysicalSA::AttachEntityToEntity(CPhysical& Entity, const CVector& vecPosi void CPhysicalSA::DetachEntityFromEntity(float fUnkX, float fUnkY, float fUnkZ, bool bUnk) { DWORD dwFunc = FUNC_DetatchEntityFromEntity; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); // DetachEntityFromEntity appears to crash when there's no entity attached (0x544403, bug 2350) // So do a NULL check here - if (((CPhysicalSAInterface*)this->GetInterface())->m_pAttachedEntity == NULL) + if (((CPhysicalSAInterface*)GetInterface())->m_pAttachedEntity == NULL) return; _asm @@ -293,7 +293,7 @@ void CPhysicalSA::DetachEntityFromEntity(float fUnkX, float fUnkY, float fUnkZ, bool CPhysicalSA::InternalAttachEntityToEntity(DWORD dwEntityInterface, const CVector* vecPosition, const CVector* vecRotation) { DWORD dwFunc = FUNC_AttachEntityToEntity; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); DWORD dwReturn = 0; _asm { @@ -315,7 +315,7 @@ bool CPhysicalSA::InternalAttachEntityToEntity(DWORD dwEntityInterface, const CV void CPhysicalSA::GetAttachedOffsets(CVector& vecPosition, CVector& vecRotation) { - CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)this->GetInterface(); + CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)GetInterface(); if (pInterface->m_pAttachedEntity) { vecPosition = pInterface->m_vecAttachedOffset; @@ -325,7 +325,7 @@ void CPhysicalSA::GetAttachedOffsets(CVector& vecPosition, CVector& vecRotation) void CPhysicalSA::SetAttachedOffsets(CVector& vecPosition, CVector& vecRotation) { - CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)this->GetInterface(); + CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)GetInterface(); if (pInterface->m_pAttachedEntity) { pInterface->m_vecAttachedOffset = vecPosition; @@ -335,19 +335,19 @@ void CPhysicalSA::SetAttachedOffsets(CVector& vecPosition, CVector& vecRotation) float CPhysicalSA::GetLighting() { - CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)this->GetInterface(); + CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)GetInterface(); return pInterface->m_fLighting; } void CPhysicalSA::SetLighting(float fLighting) { - CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)this->GetInterface(); + CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)GetInterface(); pInterface->m_fLighting = fLighting; } void CPhysicalSA::SetFrozen(bool bFrozen) { - CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)this->GetInterface(); + CPhysicalSAInterface* pInterface = (CPhysicalSAInterface*)GetInterface(); pInterface->bDontApplySpeed = bFrozen; // Don't enable friction for static objects diff --git a/Client/game_sa/CPickupSA.cpp b/Client/game_sa/CPickupSA.cpp index 5da542fba7..25c11ee2e3 100644 --- a/Client/game_sa/CPickupSA.cpp +++ b/Client/game_sa/CPickupSA.cpp @@ -18,15 +18,15 @@ extern CGameSA* pGame; CPickupSA::CPickupSA(CPickupSAInterface* pickupInterface) { - this->internalInterface = pickupInterface; - this->object = 0; + internalInterface = pickupInterface; + object = 0; } void CPickupSA::SetPosition(CVector* vecPosition) { - this->GetInterface()->bIsPickupNearby = 0; + GetInterface()->bIsPickupNearby = 0; - CPickupSAInterface* iPickup = this->GetInterface(); + CPickupSAInterface* iPickup = GetInterface(); iPickup->CoorsX = (short)(vecPosition->fX * 8); iPickup->CoorsY = (short)(vecPosition->fY * 8); iPickup->CoorsZ = (short)(vecPosition->fZ * 8); @@ -34,7 +34,7 @@ void CPickupSA::SetPosition(CVector* vecPosition) CVector* CPickupSA::GetPosition(CVector* vecPosition) { - CPickupSAInterface* iPickup = this->GetInterface(); + CPickupSAInterface* iPickup = GetInterface(); vecPosition->fX = iPickup->CoorsX / 8.0f; vecPosition->fY = iPickup->CoorsY / 8.0f; vecPosition->fZ = iPickup->CoorsZ / 8.0f; @@ -43,89 +43,89 @@ CVector* CPickupSA::GetPosition(CVector* vecPosition) ePickupType CPickupSA::GetType() { - return (ePickupType)this->GetInterface()->Type; + return (ePickupType)GetInterface()->Type; } void CPickupSA::SetType(ePickupType type) { - this->GetInterface()->Type = type; + GetInterface()->Type = type; } float CPickupSA::GetCurrentValue() { - return this->GetInterface()->CurrentValue; + return GetInterface()->CurrentValue; } void CPickupSA::SetCurrentValue(float fCurrentValue) { - this->GetInterface()->CurrentValue = fCurrentValue; + GetInterface()->CurrentValue = fCurrentValue; } void CPickupSA::SetRegenerationTime(DWORD dwTime) { - this->GetInterface()->RegenerationTime = dwTime; + GetInterface()->RegenerationTime = dwTime; } void CPickupSA::SetMoneyPerDay(WORD wMoneyPerDay) { - this->GetInterface()->MoneyPerDay = wMoneyPerDay; + GetInterface()->MoneyPerDay = wMoneyPerDay; } WORD CPickupSA::GetMoneyPerDay() { - return this->GetInterface()->MoneyPerDay; + return GetInterface()->MoneyPerDay; } WORD CPickupSA::GetModel() { - return this->GetInterface()->MI; + return GetInterface()->MI; } void CPickupSA::SetModel(WORD wModelIndex) { - this->GetInterface()->MI = wModelIndex; + GetInterface()->MI = wModelIndex; } ePickupState CPickupSA::GetState() { - return (ePickupState)this->GetInterface()->State; + return (ePickupState)GetInterface()->State; } void CPickupSA::SetState(ePickupState bState) { - this->GetInterface()->State = (BYTE)bState; + GetInterface()->State = (BYTE)bState; } BYTE CPickupSA::GetAmmo() { - return this->GetInterface()->bNoAmmo; + return GetInterface()->bNoAmmo; } void CPickupSA::SetAmmo(BYTE bAmmo) { - this->GetInterface()->bNoAmmo = bAmmo; + GetInterface()->bNoAmmo = bAmmo; } long CPickupSA::GetMonetaryValue() { - return this->GetInterface()->MonetaryValue; + return GetInterface()->MonetaryValue; } void CPickupSA::SetMonetaryValue(long lMonetaryValue) { - this->GetInterface()->MonetaryValue = lMonetaryValue; + GetInterface()->MonetaryValue = lMonetaryValue; } BYTE CPickupSA::IsNearby() { - return this->GetInterface()->bIsPickupNearby; + return GetInterface()->bIsPickupNearby; } void CPickupSA::GiveUsAPickUpObject(int ForcedObjectIndex) { DWORD GiveUsAPickUpObject = FUNC_GIVEUSAPICKUP; - DWORD dwObject = (DWORD) & (this->GetInterface()->pObject); - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwObject = (DWORD) & (GetInterface()->pObject); + DWORD dwThis = (DWORD)GetInterface(); _asm { push ForcedObjectIndex @@ -133,35 +133,35 @@ void CPickupSA::GiveUsAPickUpObject(int ForcedObjectIndex) mov ecx, dwThis call GiveUsAPickUpObject } - if (this->GetInterface()->pObject) + if (GetInterface()->pObject) { - if (this->object) + if (object) { - ((CEntitySA*)this->object)->DoNotRemoveFromGame = true; - delete this->object; + ((CEntitySA*)object)->DoNotRemoveFromGame = true; + delete object; } - this->object = new CObjectSA(this->GetInterface()->pObject); + object = new CObjectSA(GetInterface()->pObject); } } void CPickupSA::GetRidOfObjects() { - if (this->GetInterface()->pObject) - ((CWorldSA*)pGame->GetWorld())->Remove(this->GetInterface()->pObject, CPickup_Destructor); + if (GetInterface()->pObject) + ((CWorldSA*)pGame->GetWorld())->Remove(GetInterface()->pObject, CPickup_Destructor); - if (this->object) + if (object) { - ((CEntitySA*)this->object)->DoNotRemoveFromGame = true; - delete this->object; - this->object = NULL; + ((CEntitySA*)object)->DoNotRemoveFromGame = true; + delete object; + object = NULL; } } void CPickupSA::Remove() { DWORD dwFunc = FUNC_CPickup_Remove; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -169,10 +169,10 @@ void CPickupSA::Remove() } // CPickup::Remove also destroys the owned object, so we need to delete our CObjectSA class - if (this->object) + if (object) { - ((CEntitySA*)this->object)->DoNotRemoveFromGame = true; - delete this->object; - this->object = NULL; + ((CEntitySA*)object)->DoNotRemoveFromGame = true; + delete object; + object = NULL; } } diff --git a/Client/game_sa/CPlaneSA.cpp b/Client/game_sa/CPlaneSA.cpp index 816f0689d4..a0d7994c07 100644 --- a/Client/game_sa/CPlaneSA.cpp +++ b/Client/game_sa/CPlaneSA.cpp @@ -12,11 +12,8 @@ #include "StdInc.h" #include "CPlaneSA.h" -CPlaneSA::CPlaneSA(CPlaneSAInterface* plane) : CAutomobileSA(plane) -{ - this->m_pInterface = plane; -} - -CPlaneSA::CPlaneSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) : CAutomobileSA(dwModelID, ucVariation, ucVariation2) +CPlaneSA::CPlaneSA(CPlaneSAInterface* pInterface) { + SetInterface(pInterface); + Init(); } diff --git a/Client/game_sa/CPlaneSA.h b/Client/game_sa/CPlaneSA.h index 604a009fb2..12da33579a 100644 --- a/Client/game_sa/CPlaneSA.h +++ b/Client/game_sa/CPlaneSA.h @@ -20,9 +20,10 @@ class CPlaneSAInterface : public CAutomobileSAInterface // fill this }; -class CPlaneSA : public virtual CPlane, public virtual CAutomobileSA +class CPlaneSA final : public virtual CPlane, public virtual CAutomobileSA { public: - CPlaneSA(CPlaneSAInterface* plane); - CPlaneSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CPlaneSA(CPlaneSAInterface* pInterface); + + CPlaneSAInterface* GetPlaneInterface() { return reinterpret_cast(GetInterface()); } }; diff --git a/Client/game_sa/CPlayerInfoSA.cpp b/Client/game_sa/CPlayerInfoSA.cpp index 25cc51da57..62b6985ed4 100644 --- a/Client/game_sa/CPlayerInfoSA.cpp +++ b/Client/game_sa/CPlayerInfoSA.cpp @@ -15,7 +15,7 @@ CWanted* CPlayerInfoSA::GetWanted() { if (!wanted) - wanted = new CWantedSA(this->internalInterface->PlayerPedData.m_Wanted); + wanted = new CWantedSA(internalInterface->PlayerPedData.m_Wanted); return wanted; } @@ -44,7 +44,7 @@ void CPlayerInfoSA::SetPlayerMoney(long lMoney, bool bInstant) float CPlayerInfoSA::GetFPSMoveHeading() { - return this->GetInterface()->PlayerPedData.m_fFPSMoveHeading; + return GetInterface()->PlayerPedData.m_fFPSMoveHeading; } void CPlayerInfoSA::SetDoesNotGetTired(bool bDoesNotGetTired) diff --git a/Client/game_sa/CPlayerInfoSA.h b/Client/game_sa/CPlayerInfoSA.h index 2ba53956b1..34a206a63c 100644 --- a/Client/game_sa/CPlayerInfoSA.h +++ b/Client/game_sa/CPlayerInfoSA.h @@ -235,8 +235,8 @@ class CPlayerInfoSA : public CPlayerInfo public: CPlayerInfoSA(CPlayerInfoSAInterface* playerInfoInterface) { - this->internalInterface = playerInfoInterface; - this->wanted = NULL; // we can't init it yet, as our interface hasn't been inited yet + internalInterface = playerInfoInterface; + wanted = NULL; // we can't init it yet, as our interface hasn't been inited yet } ~CPlayerInfoSA() diff --git a/Client/game_sa/CPlayerPedSA.cpp b/Client/game_sa/CPlayerPedSA.cpp index e0fb17574e..22a90b1163 100644 --- a/Client/game_sa/CPlayerPedSA.cpp +++ b/Client/game_sa/CPlayerPedSA.cpp @@ -29,7 +29,7 @@ static CPedClothesDesc* pLocalClothes = 0; static CWantedSAInterface* pLocalWanted = 0; static std::set ms_DoneAnimBlockRefMap; -CPlayerPedSA::CPlayerPedSA(ePedModel pedType) +CPlayerPedSA::CPlayerPedSA(unsigned int nModelIndex) { // based on CPlayerPed::SetupPlayerPed (R*) DWORD CPedOperatorNew = FUNC_CPedOperatorNew; @@ -50,16 +50,16 @@ CPlayerPedSA::CPlayerPedSA(ePedModel pedType) call CPlayerPedConstructor } - this->SetInterface((CEntitySAInterface*)dwPedPointer); + SetInterface((CEntitySAInterface*)dwPedPointer); - this->Init(); // init our interfaces + Init(); // init our interfaces CPoolsSA* pools = (CPoolsSA*)pGame->GetPools(); CWorldSA* world = (CWorldSA*)pGame->GetWorld(); - this->SetModelIndex(pedType); - this->BeingDeleted = false; - this->DoNotRemoveFromGame = false; - this->SetType(PLAYER_PED); + SetModelIndex(nModelIndex); + BeingDeleted = false; + DoNotRemoveFromGame = false; + SetType(PLAYER_PED); // Allocate a player data struct and set it as the players m_bIsLocal = false; @@ -102,12 +102,12 @@ CPlayerPedSA::CPlayerPedSA(ePedModel pedType) CPlayerPedSA::CPlayerPedSA(CPlayerPedSAInterface* pPlayer) { // based on CPlayerPed::SetupPlayerPed (R*) - this->SetInterface((CEntitySAInterface*)pPlayer); + SetInterface((CEntitySAInterface*)pPlayer); - this->Init(); + Init(); CPoolsSA* pools = (CPoolsSA*)pGame->GetPools(); - this->SetType(PLAYER_PED); - this->BeingDeleted = false; + SetType(PLAYER_PED); + BeingDeleted = false; m_bIsLocal = true; DoNotRemoveFromGame = true; @@ -131,11 +131,11 @@ CPlayerPedSA::CPlayerPedSA(CPlayerPedSAInterface* pPlayer) CPlayerPedSA::~CPlayerPedSA() { - if (!this->BeingDeleted && DoNotRemoveFromGame == false) + if (!BeingDeleted && DoNotRemoveFromGame == false) { DWORD dwInterface = (DWORD)m_pInterface; - if ((DWORD)this->GetInterface()->vtbl != VTBL_CPlaceable) + if ((DWORD)GetInterface()->vtbl != VTBL_CPlaceable) { CWorldSA* world = (CWorldSA*)pGame->GetWorld(); world->Remove(m_pInterface, CPlayerPed_Destructor); @@ -149,7 +149,7 @@ CPlayerPedSA::~CPlayerPedSA() call dwFunc } } - this->BeingDeleted = true; + BeingDeleted = true; ((CPoolsSA*)pGame->GetPools())->RemovePed((CPed*)(CPedSA*)this, false); } @@ -187,7 +187,7 @@ void CPlayerPedSA::SetInitialState() eMoveAnim CPlayerPedSA::GetMoveAnim() { - CPedSAInterface* pedInterface = (CPedSAInterface*)this->GetInterface(); + CPedSAInterface* pedInterface = (CPedSAInterface*)GetInterface(); return (eMoveAnim)pedInterface->iMoveAnimGroup; } @@ -296,7 +296,7 @@ void CPlayerPedSA::SetMoveAnim(eMoveAnim iAnimGroup) m_iCustomMoveAnim = iAnimGroup; // Set the the new move animation group now, although it does get updated through the hooks as well - CPedSAInterface* pedInterface = (CPedSAInterface*)this->GetInterface(); + CPedSAInterface* pedInterface = (CPedSAInterface*)GetInterface(); pedInterface->iMoveAnimGroup = (int)iAnimGroup; DWORD dwThis = (DWORD)pedInterface; diff --git a/Client/game_sa/CPlayerPedSA.h b/Client/game_sa/CPlayerPedSA.h index 897e26a52f..53c7b7b357 100644 --- a/Client/game_sa/CPlayerPedSA.h +++ b/Client/game_sa/CPlayerPedSA.h @@ -41,7 +41,7 @@ class CPlayerPedSA : public virtual CPlayerPed, public virtual CPedSA CWantedSA* m_pWanted; public: - CPlayerPedSA(ePedModel pedType); + CPlayerPedSA(unsigned int nModelIndex); CPlayerPedSA(CPlayerPedSAInterface* ped); ~CPlayerPedSA(); diff --git a/Client/game_sa/CPoolsSA.cpp b/Client/game_sa/CPoolsSA.cpp index d8c5e9cba5..ef6cfd013d 100644 --- a/Client/game_sa/CPoolsSA.cpp +++ b/Client/game_sa/CPoolsSA.cpp @@ -11,16 +11,21 @@ #include "StdInc.h" #include "CBikeSA.h" +#include "CBmxSA.h" #include "CBoatSA.h" #include "CGameSA.h" +#include "CHeliSA.h" +#include "CMonsterTruckSA.h" +#include "CPlaneSA.h" #include "CPlayerPedSA.h" #include "CPoolsSA.h" +#include "CQuadBikeSA.h" +#include "CTrailerSA.h" +#include "CTrainSA.h" #include "CWorldSA.h" extern CGameSA* pGame; -extern bool g_bVehiclePointerInvalid; - CPoolsSA::CPoolsSA() { m_ppPedPoolInterface = (CPoolSAInterface**)0xB74490; @@ -67,30 +72,61 @@ inline bool CPoolsSA::AddVehicleToPool(CClientVehicle* pClientVehicle, CVehicleS CVehicle* CPoolsSA::AddVehicle(CClientVehicle* pClientVehicle, eVehicleTypes eVehicleType, unsigned char ucVariation, unsigned char ucVariation2) { - CVehicleSA* pVehicle = NULL; + CVehicleSA* pVehicle = nullptr; if (m_vehiclePool.ulCount < MAX_VEHICLES) { + MemSetFast((void*)VAR_CVehicle_Variation1, ucVariation, 1); + MemSetFast((void*)VAR_CVehicle_Variation2, ucVariation2, 1); + + // CCarCtrl::CreateCarForScript + CVehicleSAInterface* pInterface = ((CVehicleSAInterface*(__cdecl*)(int, CVector, unsigned char))FUNC_CCarCtrlCreateCarForScript)(eVehicleType, CVector(0, 0, 0), 0); + auto vehicleClass = static_cast(pGame->GetModelInfo(eVehicleType)->GetVehicleType()); switch (vehicleClass) { + case VehicleClass::MONSTER_TRUCK: + pVehicle = new CMonsterTruckSA(reinterpret_cast(pInterface)); + break; + case VehicleClass::QUAD: + pVehicle = new CQuadBikeSA(reinterpret_cast(pInterface)); + break; + case VehicleClass::HELI: + pVehicle = new CHeliSA(reinterpret_cast(pInterface)); + break; + case VehicleClass::PLANE: + pVehicle = new CPlaneSA(reinterpret_cast(pInterface)); + break; case VehicleClass::BOAT: - pVehicle = new CBoatSA(eVehicleType, ucVariation, ucVariation2); + pVehicle = new CBoatSA(reinterpret_cast(pInterface)); + break; + case VehicleClass::TRAIN: + pVehicle = new CTrainSA(reinterpret_cast(pInterface)); break; - case VehicleClass::BMX: case VehicleClass::BIKE: - pVehicle = new CBikeSA(eVehicleType, ucVariation, ucVariation2); + pVehicle = new CBikeSA(reinterpret_cast(pInterface)); + break; + case VehicleClass::BMX: + pVehicle = new CBmxSA(reinterpret_cast(pInterface)); + break; + case VehicleClass::TRAILER: + pVehicle = new CTrailerSA(reinterpret_cast(pInterface)); break; default: - pVehicle = new CVehicleSA(eVehicleType, ucVariation, ucVariation2); + pVehicle = new CAutomobileSA(reinterpret_cast(pInterface)); break; } - if (!AddVehicleToPool(pClientVehicle, pVehicle)) + if (pVehicle && AddVehicleToPool(pClientVehicle, pVehicle)) + { + pVehicle->m_ucVariant = ucVariation; + pVehicle->m_ucVariant2 = ucVariation2; + } + else { delete pVehicle; - pVehicle = NULL; + pVehicle = nullptr; } } @@ -317,12 +353,12 @@ inline bool CPoolsSA::AddPedToPool(CClientPed* pClientPed, CPedSA* pPed) return true; } -CPed* CPoolsSA::AddPed(CClientPed* pClientPed, ePedModel ePedType) +CPed* CPoolsSA::AddPed(CClientPed* pClientPed, unsigned int nModelIndex) { CPedSA* pPed = NULL; if (m_pedPool.ulCount < MAX_PEDS) { - pPed = new CPlayerPedSA(ePedType); + pPed = new CPlayerPedSA(nModelIndex); if (!AddPedToPool(pClientPed, pPed)) { delete pPed; @@ -434,7 +470,7 @@ SClientEntity* CPoolsSA::GetPed(DWORD* pGameInterface) CPed* CPoolsSA::GetPedFromRef(DWORD dwGameRef) { - CPedSAInterface* pInterface = this->GetPedInterface(dwGameRef); + CPedSAInterface* pInterface = GetPedInterface(dwGameRef); if (pInterface) { // Extract the element index from the handle @@ -538,8 +574,8 @@ CVehicle* CPoolsSA::AddTrain(CClientVehicle* pClientVehicle, CVector* vecPositio } } - CVehicleSAInterface* pTrainBeginning = NULL; - CVehicleSAInterface* pTrainEnd = NULL; + CTrainSAInterface* pTrainBeginning = nullptr; + CTrainSAInterface* pTrainEnd = nullptr; float fX = vecPosition->fX; float fY = vecPosition->fY; @@ -583,7 +619,7 @@ CVehicle* CPoolsSA::AddTrain(CClientVehicle* pClientVehicle, CVector* vecPositio if (m_vehiclePool.ulCount < MAX_VEHICLES) { - trainHead = new CVehicleSA(pTrainBeginning); + trainHead = new CTrainSA(pTrainBeginning); if (!AddVehicleToPool(pClientVehicle, trainHead)) { delete trainHead; @@ -599,10 +635,10 @@ CVehicle* CPoolsSA::AddTrain(CClientVehicle* pClientVehicle, CVector* vecPositio { if (m_vehiclePool.ulCount < MAX_VEHICLES) { - CVehicleSAInterface* vehCarriage = carriage->GetNextCarriageInTrain(); + CTrainSAInterface* vehCarriage = carriage->GetNextCarriageInTrain(); if (vehCarriage) { - carriage = new CVehicleSA(vehCarriage); + carriage = new CTrainSA(vehCarriage); if (!AddVehicleToPool(pClientVehicle, carriage)) { delete carriage; @@ -620,7 +656,10 @@ CVehicle* CPoolsSA::AddTrain(CClientVehicle* pClientVehicle, CVector* vecPositio // Stops the train from moving at ludacrist speeds right after creation // due to some glitch in the node finding in CreateMissionTrain CVector vec(0, 0, 0); - trainHead->SetMoveSpeed(&vec); + if (trainHead) + { + trainHead->SetMoveSpeed(&vec); + } return trainHead; } diff --git a/Client/game_sa/CPoolsSA.h b/Client/game_sa/CPoolsSA.h index 3cf09db965..b9e3aef8b0 100644 --- a/Client/game_sa/CPoolsSA.h +++ b/Client/game_sa/CPoolsSA.h @@ -94,7 +94,7 @@ class CPoolsSA : public CPools void DeleteAllObjects(); // Peds pool - CPed* AddPed(CClientPed* pClientPed, ePedModel ePedType); + CPed* AddPed(CClientPed* pClientPed, unsigned int nModelIndex); CPed* AddPed(CClientPed* pClientPed, DWORD* pGameInterface); private: diff --git a/Client/game_sa/CProjectileSA.cpp b/Client/game_sa/CProjectileSA.cpp index dde338e531..1eb7082596 100644 --- a/Client/game_sa/CProjectileSA.cpp +++ b/Client/game_sa/CProjectileSA.cpp @@ -21,17 +21,17 @@ CProjectileSA::CProjectileSA(CProjectileSAInterface* projectileInterface) : CObj { internalInterface = projectileInterface; projectileInfo = NULL; - this->BeingDeleted = false; - this->DoNotRemoveFromGame = false; - this->internalInterface->bStreamingDontDelete = true; - this->internalInterface->bDontStream = true; - this->internalInterface->bRemoveFromWorld = false; + BeingDeleted = false; + DoNotRemoveFromGame = false; + internalInterface->bStreamingDontDelete = true; + internalInterface->bDontStream = true; + internalInterface->bRemoveFromWorld = false; m_bDestroyed = false; } CProjectileSA::~CProjectileSA() { - this->BeingDeleted = true; + BeingDeleted = true; /* //OutputDebugString("Attempting to destroy Object\n"); if(!this->BeingDeleted && DoNotRemoveFromGame == false) diff --git a/Client/game_sa/CQuadBikeSA.cpp b/Client/game_sa/CQuadBikeSA.cpp index dc08765a1c..0d7e341264 100644 --- a/Client/game_sa/CQuadBikeSA.cpp +++ b/Client/game_sa/CQuadBikeSA.cpp @@ -12,11 +12,8 @@ #include "StdInc.h" #include "CQuadBikeSA.h" -CQuadBikeSA::CQuadBikeSA(CQuadBikeSAInterface* quadbike) : CAutomobileSA(quadbike) -{ - this->m_pInterface = quadbike; -} - -CQuadBikeSA::CQuadBikeSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) : CAutomobileSA(dwModelID, ucVariation, ucVariation2) +CQuadBikeSA::CQuadBikeSA(CQuadBikeSAInterface* pInterface) { + SetInterface(pInterface); + Init(); } diff --git a/Client/game_sa/CQuadBikeSA.h b/Client/game_sa/CQuadBikeSA.h index e51bea5e92..931fde6493 100644 --- a/Client/game_sa/CQuadBikeSA.h +++ b/Client/game_sa/CQuadBikeSA.h @@ -19,12 +19,10 @@ class CQuadBikeSAInterface : public CAutomobileSAInterface // fill this }; -class CQuadBikeSA : public virtual CQuadBike, public virtual CAutomobileSA +class CQuadBikeSA final : public virtual CQuadBike, public virtual CAutomobileSA { -private: public: - CQuadBikeSA(CQuadBikeSAInterface* quadbike); - CQuadBikeSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CQuadBikeSA(CQuadBikeSAInterface* pInterface); - virtual ~CQuadBikeSA() {} + CQuadBikeSAInterface* GetQuadBikeInterface() { return reinterpret_cast(GetInterface()); } }; diff --git a/Client/game_sa/CRadarSA.cpp b/Client/game_sa/CRadarSA.cpp index 7d56516dbb..99a4f0ab2e 100644 --- a/Client/game_sa/CRadarSA.cpp +++ b/Client/game_sa/CRadarSA.cpp @@ -33,7 +33,7 @@ CRadarSA::~CRadarSA() CMarker* CRadarSA::CreateMarker(CVector* vecPosition) { CMarkerSA* marker; - marker = (CMarkerSA*)this->GetFreeMarker(); + marker = (CMarkerSA*)GetFreeMarker(); if (marker) { marker->Init(); diff --git a/Client/game_sa/CRegisteredCoronaSA.cpp b/Client/game_sa/CRegisteredCoronaSA.cpp index 5ce8cd9d23..6f1c0e98cc 100644 --- a/Client/game_sa/CRegisteredCoronaSA.cpp +++ b/Client/game_sa/CRegisteredCoronaSA.cpp @@ -110,7 +110,7 @@ DWORD CRegisteredCoronaSA::GetID() void CRegisteredCoronaSA::Init(DWORD Identifier) { internalInterface->Identifier = Identifier; - this->SetSize(2.5f); + SetSize(2.5f); internalInterface->bIsAttachedToEntity = false; internalInterface->pEntityAttachedTo = NULL; internalInterface->NormalAngle = 0.0f; diff --git a/Client/game_sa/CTaskManagerSA.cpp b/Client/game_sa/CTaskManagerSA.cpp index 1b40536e1c..15589de95f 100644 --- a/Client/game_sa/CTaskManagerSA.cpp +++ b/Client/game_sa/CTaskManagerSA.cpp @@ -20,8 +20,8 @@ extern CGameSA* pGame; CTaskManagerSA::CTaskManagerSA(CTaskManagerSAInterface* taskManagerInterface, CPed* ped) { this->ped = ped; - this->internalInterface = taskManagerInterface; - this->m_pTaskManagementSystem = pGame->GetTaskManagementSystem(); + internalInterface = taskManagerInterface; + m_pTaskManagementSystem = pGame->GetTaskManagementSystem(); } void CTaskManagerSA::RemoveTask(const int iTaskPriority) @@ -39,7 +39,7 @@ void CTaskManagerSA::SetTask(CTaskSA* pTaskPrimary, const int iTaskPriority, con if (pTaskPrimary) taskInterface = pTaskPrimary->GetInterface(); - DWORD dwInterface = (DWORD)this->GetInterface(); + DWORD dwInterface = (DWORD)GetInterface(); _asm { xor eax, eax @@ -54,7 +54,7 @@ void CTaskManagerSA::SetTask(CTaskSA* pTaskPrimary, const int iTaskPriority, con CTask* CTaskManagerSA::GetTask(const int iTaskPriority) { - CTaskManagerSAInterface* pTaskManagerInterface = this->GetInterface(); + CTaskManagerSAInterface* pTaskManagerInterface = GetInterface(); return m_pTaskManagementSystem->GetTask(pTaskManagerInterface->m_tasks[iTaskPriority]); } @@ -62,7 +62,7 @@ CTask* CTaskManagerSA::GetActiveTask() { DWORD dwFunc = FUNC_GetActiveTask; DWORD dwReturn = 0; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -81,7 +81,7 @@ CTask* CTaskManagerSA::GetSimplestActiveTask() { DWORD dwFunc = FUNC_GetSimplestActiveTask; DWORD dwReturn = 0; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { @@ -98,7 +98,7 @@ CTask* CTaskManagerSA::GetSimplestTask(const int iPriority) { DWORD dwFunc = FUNC_GetSimplestTask; DWORD dwReturn = 0; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -115,7 +115,7 @@ CTask* CTaskManagerSA::FindActiveTaskByType(const int iTaskType) { DWORD dwFunc = FUNC_FindActiveTaskByType; DWORD dwReturn = 0; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -132,7 +132,7 @@ CTask* CTaskManagerSA::FindTaskByType(const int iPriority, const int iTaskType) { DWORD dwFunc = FUNC_FindTaskByType; DWORD dwReturn = 0; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); _asm { mov ecx, dwThis @@ -157,7 +157,7 @@ void CTaskManagerSA::SetTaskSecondary(CTaskSA* pTaskSecondary, const int iType) CTaskSAInterface* taskInterface = NULL; if (pTaskSecondary) taskInterface = pTaskSecondary->GetInterface(); - DWORD dwInterface = (DWORD)this->GetInterface(); + DWORD dwInterface = (DWORD)GetInterface(); _asm { push iType @@ -173,7 +173,7 @@ void CTaskManagerSA::SetTaskSecondary(CTaskSA* pTaskSecondary, const int iType) CTask* CTaskManagerSA::GetTaskSecondary(const int iType) { if (iType < TASK_SECONDARY_MAX) - return m_pTaskManagementSystem->GetTask(this->GetInterface()->m_tasksSecondary[iType]); + return m_pTaskManagementSystem->GetTask(GetInterface()->m_tasksSecondary[iType]); else return NULL; } diff --git a/Client/game_sa/CTaskManagerSA.h b/Client/game_sa/CTaskManagerSA.h index db905473c5..bb99366621 100644 --- a/Client/game_sa/CTaskManagerSA.h +++ b/Client/game_sa/CTaskManagerSA.h @@ -46,7 +46,7 @@ class CTaskManagerSA : public CTaskManager public: CTaskManagerSA(CTaskManagerSAInterface* taskManagerInterface, CPed* ped); - CTaskManagerSAInterface* GetInterface() { return this->internalInterface; } + CTaskManagerSAInterface* GetInterface() { return internalInterface; } void RemoveTask(const int iTaskPriority); void SetTask(CTaskSA* pTaskPrimary, const int iTaskPriority, const bool bForceNewTask = false); diff --git a/Client/game_sa/CTrailerSA.cpp b/Client/game_sa/CTrailerSA.cpp index ec8b3429c7..6485298078 100644 --- a/Client/game_sa/CTrailerSA.cpp +++ b/Client/game_sa/CTrailerSA.cpp @@ -12,11 +12,8 @@ #include "StdInc.h" #include "CTrailerSA.h" -CTrailerSA::CTrailerSA(CTrailerSAInterface* trailer) : CAutomobileSA(trailer) -{ - this->m_pInterface = trailer; -} - -CTrailerSA::CTrailerSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) : CAutomobileSA(dwModelID, ucVariation, ucVariation2) +CTrailerSA::CTrailerSA(CTrailerSAInterface* pInterface) { + SetInterface(pInterface); + Init(); } diff --git a/Client/game_sa/CTrailerSA.h b/Client/game_sa/CTrailerSA.h index 0875aeb85e..a28e929479 100644 --- a/Client/game_sa/CTrailerSA.h +++ b/Client/game_sa/CTrailerSA.h @@ -19,12 +19,10 @@ class CTrailerSAInterface : public CAutomobileSAInterface // fill this }; -class CTrailerSA : public virtual CTrailer, public virtual CAutomobileSA +class CTrailerSA final : public virtual CTrailer, public virtual CAutomobileSA { -private: public: - CTrailerSA(CTrailerSAInterface* trailer); - CTrailerSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CTrailerSA(CTrailerSAInterface* pInterface); - virtual ~CTrailerSA() {} + CTrailerSAInterface* GetTrailerInterface() { return reinterpret_cast(GetInterface()); } }; diff --git a/Client/game_sa/CTrainSA.cpp b/Client/game_sa/CTrainSA.cpp index 6362f9c88c..38b1fd0aca 100644 --- a/Client/game_sa/CTrainSA.cpp +++ b/Client/game_sa/CTrainSA.cpp @@ -10,3 +10,9 @@ #include "StdInc.h" #include "CTrainSA.h" + +CTrainSA::CTrainSA(CTrainSAInterface* pInterface) +{ + SetInterface(pInterface); + Init(); +} diff --git a/Client/game_sa/CTrainSA.h b/Client/game_sa/CTrainSA.h index ebbc1c7656..969fa907ee 100644 --- a/Client/game_sa/CTrainSA.h +++ b/Client/game_sa/CTrainSA.h @@ -9,6 +9,8 @@ *****************************************************************************/ #pragma once + +#include #include "CVehicleSA.h" #include "CDoorSA.h" @@ -102,3 +104,11 @@ class CTrainSAInterface : public CVehicleSAInterface RwFrame* m_aTrainNodes[eTrainNode::NUM_NODES]; }; static_assert(sizeof(CTrainSAInterface) == 0x6AC, "Invalid size for CTrainSAInterface"); + +class CTrainSA final : public virtual CTrain, public virtual CVehicleSA +{ +public: + CTrainSA(CTrainSAInterface* pInterface); + + CTrainSAInterface* GetTrainInterface() { return reinterpret_cast(GetInterface()); } +}; diff --git a/Client/game_sa/CVehicleSA.cpp b/Client/game_sa/CVehicleSA.cpp index b9629e595e..1ed679563d 100644 --- a/Client/game_sa/CVehicleSA.cpp +++ b/Client/game_sa/CVehicleSA.cpp @@ -25,8 +25,6 @@ extern CGameSA* pGame; -bool g_bVehiclePointerInvalid = false; - static BOOL m_bVehicleSunGlare = false; _declspec(naked) void DoVehicleSunGlare(void* this_) { @@ -114,126 +112,15 @@ namespace void GetAllAtomicObjects(RwFrame* frame, std::vector& result) { RwFrameForAllObjects(frame, (void*)GetAllAtomicObjectCB, &result); } } // namespace -CVehicleSA::CVehicleSA() : m_ucAlpha(255), m_bIsDerailable(true), m_vecGravity(0.0f, 0.0f, -1.0f), m_HeadLightColor(SharedUtil::SColorRGBA(255, 255, 255, 255)) -{ - assert(0); // Never used ? -} - -/** - *\todo ASAP: Remove all the VC specific (SCM) function calls propperly - */ -CVehicleSA::CVehicleSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2) - : m_ucAlpha(255), m_bIsDerailable(true), m_vecGravity(0.0f, 0.0f, -1.0f), m_HeadLightColor(SharedUtil::SColorRGBA(255, 255, 255, 255)) -{ - // for SA, we can just call the following function and it should just work: - // CCarCtrl::CreateCarForScript(int,class CVector,unsigned char) - // ModelID, Position, IsMissionVehicle - - m_pHandlingData = NULL; - m_pFlyingHandlingData = NULL; - m_pSuspensionLines = NULL; - - DWORD dwReturn = 0; - - // Set Variation 1 before creation. - MemSetFast((void*)VAR_CVehicle_Variation1, ucVariation, 1); - MemSetFast((void*)VAR_CVehicle_Variation2, ucVariation2, 1); - - g_bVehiclePointerInvalid = true; // m_pVehicle can have invalid value during CAutomobile constructor - DWORD dwFunc = FUNC_CCarCtrlCreateCarForScript; - _asm - { - push 0 // its a mission vehicle - push 0 - push 0 - push 0 // spawn at 0,0,0 - push dwModelID - call dwFunc - add esp, 0x14 - mov dwReturn, eax - } - - m_pInterface = reinterpret_cast(dwReturn); -#if 0 - this->BeingDeleted = false; - - m_pInterface->bStreamingDontDelete = true; - m_pInterface->bDontStream = true; - - // store our CVehicleSA pointer in the vehicle's time of creation member (as it won't get modified later and as far as I know it isn't used for something important) - GetVehicleInterface ()->m_pVehicle = this; - - // Unlock doors as they spawn randomly with locked doors - LockDoors ( false ); - - // Reset the car countss to 0 so that this vehicle doesn't affect the population vehicles - for ( int i = 0; i < 5; i++ ) - { - MemPutFast < DWORD > ( VARS_CarCounts + i * sizeof(DWORD), 0 ); - } - - // only applicable for CAutomobile based vehicles (i.e. not bikes or boats, but includes planes, helis etc) - this->damageManager = new CDamageManagerSA ( m_pInterface, (CDamageManagerSAInterface *)((DWORD)this->GetInterface() + 1440)); - - - // Replace the handling interface with our own to prevent handlig.cfg cheats and allow custom handling stuff. - // We don't use SA's array because we want one handling per vehicle type and also allow custom handlings - // per car later. - /*CHandlingEntry* pEntry = pGame->GetHandlingManager ()->CreateHandlingData (); - //CHandlingEntry* pEntry = pGame->GetHandlingManager ()->GetHandlingData ( dwModelID ); - pEntry->ApplyHandlingData ( pGame->GetHandlingManager ()->GetHandlingData ( dwModelID ) ); // We need to do that so vehicle handling wont get corrupted - SetHandlingData ( pEntry ); - pEntry->Recalculate ();*/ - - GetVehicleInterface ()->m_nVehicleFlags.bVehicleCanBeTargetted = true; - -#else - m_ucVariant = ucVariation; - m_ucVariant2 = ucVariation2; - Init(); // Use common setup -#endif -} - -CVehicleSA::CVehicleSA(CVehicleSAInterface* pVehicleInterface) -{ - m_pInterface = pVehicleInterface; - m_pHandlingData = NULL; - m_pSuspensionLines = NULL; - -#if 0 - m_pInterface->bStreamingDontDelete = true; - m_pInterface->bDontStream = true; - this->BeingDeleted = false; - - // Store our CVehicleSA pointer in the vehicle's time of creation member (as it won't get modified later and as far as I know it isn't used for something important) - GetVehicleInterface ()->m_pVehicle = this; - - // Reset the car countss to 0 so that this vehicle doesn't affect the population vehicles - for ( int i = 0; i < 5; i++ ) - { - MemPutFast < DWORD > ( VARS_CarCounts + i * sizeof(DWORD), 0 ); - } - - // only applicable for CAutomobile based vehicles (i.e. not bikes, trains or boats, but includes planes, helis etc) - this->damageManager = new CDamageManagerSA( m_pInterface, (CDamageManagerSAInterface *)((DWORD)this->GetInterface() + 1440)); - - m_bIsDerailable = true; - m_ucAlpha = 255; -#else - Init(); // Use common setup -#endif -} - void CVehicleSA::Init() { - m_pInterface->bStreamingDontDelete = true; - m_pInterface->bDontStream = true; - this->BeingDeleted = false; + GetVehicleInterface()->bStreamingDontDelete = true; + GetVehicleInterface()->bDontStream = true; + BeingDeleted = false; // Store our CVehicleSA pointer in the vehicle's time of creation member (as it won't get modified later and as far as I know it isn't used for something // important) GetVehicleInterface()->m_pVehicle = this; - g_bVehiclePointerInvalid = false; CModelInfo* modelInfo = pGame->GetModelInfo(GetModelIndex()); @@ -255,9 +142,9 @@ void CVehicleSA::Init() } // only applicable for CAutomobile based vehicles (i.e. not bikes, trains or boats, but includes planes, helis etc) - this->m_pDamageManager = new CDamageManagerSA(m_pInterface, (CDamageManagerSAInterface*)((DWORD)this->GetInterface() + 1440)); + m_pDamageManager = new CDamageManagerSA(m_pInterface, (CDamageManagerSAInterface*)((DWORD)GetInterface() + 1440)); - this->m_pVehicleAudioEntity = new CAEVehicleAudioEntitySA(&GetVehicleInterface()->m_VehicleAudioEntity); + m_pVehicleAudioEntity = new CAEVehicleAudioEntitySA(&GetVehicleInterface()->m_VehicleAudioEntity); // Replace the handling interface with our own to prevent handlig.cfg cheats and allow custom handling stuff. // We don't use SA's array because we want one handling per vehicle type and also allow custom handlings @@ -270,20 +157,15 @@ void CVehicleSA::Init() GetVehicleInterface()->m_nVehicleFlags.bVehicleCanBeTargetted = true; - m_bIsDerailable = true; - m_ucAlpha = 255; - m_vecGravity = CVector(0.0f, 0.0f, -1.0f); - m_HeadLightColor = SharedUtil::SColorRGBA(255, 255, 255, 255); - - m_RGBColors[0] = CVehicleColor::GetRGBFromPaletteIndex(((CVehicleSAInterface*)(this->GetInterface()))->m_colour1); - m_RGBColors[1] = CVehicleColor::GetRGBFromPaletteIndex(((CVehicleSAInterface*)(this->GetInterface()))->m_colour2); - m_RGBColors[2] = CVehicleColor::GetRGBFromPaletteIndex(((CVehicleSAInterface*)(this->GetInterface()))->m_colour3); - m_RGBColors[3] = CVehicleColor::GetRGBFromPaletteIndex(((CVehicleSAInterface*)(this->GetInterface()))->m_colour4); + m_RGBColors[0] = CVehicleColor::GetRGBFromPaletteIndex(GetVehicleInterface()->m_colour1); + m_RGBColors[1] = CVehicleColor::GetRGBFromPaletteIndex(GetVehicleInterface()->m_colour2); + m_RGBColors[2] = CVehicleColor::GetRGBFromPaletteIndex(GetVehicleInterface()->m_colour3); + m_RGBColors[3] = CVehicleColor::GetRGBFromPaletteIndex(GetVehicleInterface()->m_colour4); SetColor(m_RGBColors[0], m_RGBColors[1], m_RGBColors[2], m_RGBColors[3], 0); // Initialize doors depending on the vtable. DWORD dwOffset; - DWORD dwFunc = ((CVehicleSAInterfaceVTBL*)this->GetVehicleInterface()->vtbl)->GetDoorAngleOpenRatio_; + DWORD dwFunc = ((CVehicleSAInterfaceVTBL*)GetVehicleInterface()->vtbl)->GetDoorAngleOpenRatio_; if (dwFunc == FUNC_CAutomobile__GetDoorAngleOpenRatio) dwOffset = 1464; else if (dwFunc == FUNC_CTrain__GetDoorAngleOpenRatio) @@ -300,18 +182,9 @@ void CVehicleSA::Init() m_doors[i].SetInterface((CDoorSAInterface*)dwDoorAddress); } } - m_bSwingingDoorsAllowed = false; CopyGlobalSuspensionLinesToPrivate(); - m_tSirenInfo.m_bOverrideSirens = false; - m_tSirenInfo.m_bSirenSilent = false; - for (unsigned int i = 0; i < 8; i++) - { - m_tSirenInfo.m_tSirenInfo[i].m_dwMinSirenAlpha = 0; - } - // set our variant count - m_ucVariantCount = 0; // clear our rw frames list m_ExtraFrames.clear(); // dump the frames @@ -321,28 +194,28 @@ void CVehicleSA::Init() CVehicleSA::~CVehicleSA() { - if (!this->BeingDeleted) + if (!BeingDeleted) { if ((DWORD)m_pInterface->vtbl != VTBL_CPlaceable) { - GetVehicleInterface()->m_pVehicle = NULL; + GetVehicleInterface()->m_pVehicle = nullptr; if (m_pDamageManager) { delete m_pDamageManager; - m_pDamageManager = NULL; + m_pDamageManager = nullptr; } if (m_pVehicleAudioEntity) { delete m_pVehicleAudioEntity; - m_pVehicleAudioEntity = NULL; + m_pVehicleAudioEntity = nullptr; } if (m_pSuspensionLines) { delete[] m_pSuspensionLines; - m_pSuspensionLines = NULL; + m_pSuspensionLines = nullptr; } DWORD dwThis = (DWORD)m_pInterface; @@ -365,7 +238,7 @@ CVehicleSA::~CVehicleSA() call dwFunc } } - this->BeingDeleted = true; + BeingDeleted = true; ((CPoolsSA*)pGame->GetPools())->RemoveVehicle((CVehicle*)this); } } @@ -373,7 +246,7 @@ CVehicleSA::~CVehicleSA() void CVehicleSA::SetMoveSpeed(CVector* vecMoveSpeed) { DWORD dwFunc = FUNC_GetMoveSpeed; - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); DWORD dwReturn = 0; _asm { @@ -415,14 +288,14 @@ void CVehicleSA::SetMoveSpeed(CVector* vecMoveSpeed) #endif } -CVehicleSAInterface* CVehicleSA::GetNextCarriageInTrain() +CTrainSAInterface* CVehicleSA::GetNextCarriageInTrain() { - return (CVehicleSAInterface*)*(DWORD*)((DWORD)this->GetInterface() + 1492); + return (CTrainSAInterface*)*(DWORD*)((DWORD)GetInterface() + 1492); } CVehicle* CVehicleSA::GetNextTrainCarriage() { - CVehicleSAInterface* pVehicle = GetNextCarriageInTrain(); + CTrainSAInterface* pVehicle = GetNextCarriageInTrain(); if (pVehicle) { SClientEntity* pVehicleClientEntity = pGame->GetPools()->GetVehicle((DWORD*)pVehicle); @@ -443,20 +316,20 @@ void CVehicleSA::SetNextTrainCarriage(CVehicle* pNext) CVehicleSA* pNextVehicle = dynamic_cast(pNext); if (pNextVehicle) { - MemPutFast((DWORD)this->GetInterface() + 1492, (DWORD)pNextVehicle->GetInterface()); + MemPutFast((DWORD)GetInterface() + 1492, (DWORD)pNextVehicle->GetInterface()); if (pNextVehicle->GetPreviousTrainCarriage() != this) pNextVehicle->SetPreviousTrainCarriage(this); } } else { - MemPutFast((DWORD)this->GetInterface() + 1492, NULL); + MemPutFast((DWORD)GetInterface() + 1492, NULL); } } -CVehicleSAInterface* CVehicleSA::GetPreviousCarriageInTrain() +CTrainSAInterface* CVehicleSA::GetPreviousCarriageInTrain() { - return (CVehicleSAInterface*)*(DWORD*)((DWORD)this->GetInterface() + 1488); + return (CTrainSAInterface*)*(DWORD*)((DWORD)GetInterface() + 1488); } void CVehicleSA::SetPreviousTrainCarriage(CVehicle* pPrevious) @@ -466,20 +339,20 @@ void CVehicleSA::SetPreviousTrainCarriage(CVehicle* pPrevious) CVehicleSA* pPreviousVehicle = dynamic_cast(pPrevious); if (pPreviousVehicle) { - MemPutFast((DWORD)this->GetInterface() + 1488, (DWORD)pPreviousVehicle->GetInterface()); + MemPutFast((DWORD)GetInterface() + 1488, (DWORD)pPreviousVehicle->GetInterface()); if (pPreviousVehicle->GetNextTrainCarriage() != this) pPreviousVehicle->SetNextTrainCarriage(this); } } else { - MemPutFast((DWORD)this->GetInterface() + 1488, NULL); + MemPutFast((DWORD)GetInterface() + 1488, NULL); } } CVehicle* CVehicleSA::GetPreviousTrainCarriage() { - CVehicleSAInterface* pVehicle = GetPreviousCarriageInTrain(); + CTrainSAInterface* pVehicle = GetPreviousCarriageInTrain(); if (pVehicle) { SClientEntity* pVehicleClientEntity = pGame->GetPools()->GetVehicle((DWORD*)pVehicle); @@ -498,7 +371,7 @@ float CVehicleSA::GetDistanceToCarriage(CVehicle* pCarriage) } else { - CBoundingBox* pBoundingBox = pGame->GetModelInfo(this->GetModelIndex())->GetBoundingBox(); + CBoundingBox* pBoundingBox = pGame->GetModelInfo(GetModelIndex())->GetBoundingBox(); return pBoundingBox->vecBoundMax.fY - pBoundingBox->vecBoundMin.fY; } } @@ -526,7 +399,7 @@ void CVehicleSA::AttachTrainCarriage(CVehicle* pCarriage) } else { - CBoundingBox* pBoundingBox = pGame->GetModelInfo(this->GetModelIndex())->GetBoundingBox(); + CBoundingBox* pBoundingBox = pGame->GetModelInfo(GetModelIndex())->GetBoundingBox(); pCarriageInterface->m_fDistanceToNextCarriage = pBoundingBox->vecBoundMax.fY - pBoundingBox->vecBoundMin.fY; } } @@ -945,7 +818,7 @@ bool CVehicleSA::IsBeingDriven() void CVehicleSA::PlaceBikeOnRoadProperly() { DWORD dwFunc = FUNC_Bike_PlaceOnRoadProperly; - DWORD dwBike = (DWORD)this->GetInterface(); + DWORD dwBike = (DWORD)GetInterface(); _asm { @@ -957,7 +830,7 @@ void CVehicleSA::PlaceBikeOnRoadProperly() void CVehicleSA::PlaceAutomobileOnRoadProperly() { DWORD dwFunc = FUNC_Automobile_PlaceOnRoadProperly; - DWORD dwAutomobile = (DWORD)this->GetInterface(); + DWORD dwAutomobile = (DWORD)GetInterface(); _asm { @@ -1013,7 +886,7 @@ void CVehicleSA::GetTurretRotation(float* fHorizontal, float* fVertical) { // This is coded in asm because for some reason it was failing to compile // correctly with normal c++. - DWORD vehicleInterface = (DWORD)this->GetInterface(); + DWORD vehicleInterface = (DWORD)GetInterface(); float fHoriz = 0.0f; float fVert = 0.0f; _asm @@ -1034,7 +907,7 @@ void CVehicleSA::SetTurretRotation(float fHorizontal, float fVertical) { //*(float *)(this->GetInterface() + 2380) = fHorizontal; //*(float *)(this->GetInterface() + 2384) = fVertical; - DWORD vehicleInterface = (DWORD)this->GetInterface(); + DWORD vehicleInterface = (DWORD)GetInterface(); _asm { mov eax, vehicleInterface @@ -1049,17 +922,17 @@ void CVehicleSA::SetTurretRotation(float fHorizontal, float fVertical) bool CVehicleSA::IsSirenOrAlarmActive() { - return ((CVehicleSAInterface*)this->GetInterface())->m_nVehicleFlags.bSirenOrAlarm; + return ((CVehicleSAInterface*)GetInterface())->m_nVehicleFlags.bSirenOrAlarm; } void CVehicleSA::SetSirenOrAlarmActive(bool bActive) { - ((CVehicleSAInterface*)this->GetInterface())->m_nVehicleFlags.bSirenOrAlarm = bActive; + ((CVehicleSAInterface*)GetInterface())->m_nVehicleFlags.bSirenOrAlarm = bActive; } float CVehicleSA::GetHealth() { - CVehicleSAInterface* vehicle = (CVehicleSAInterface*)this->GetInterface(); + CVehicleSAInterface* vehicle = (CVehicleSAInterface*)GetInterface(); return vehicle->m_nHealth; } @@ -1080,7 +953,7 @@ void CVehicleSA::SetLandingGearDown(bool bLandingGearDown) { // This is the C code corresponding to the gta_sa // asm code at address 0x6CB39A. - CVehicleSAInterface* pInterface = this->GetVehicleInterface(); + CVehicleSAInterface* pInterface = GetVehicleInterface(); DWORD dwThis = (DWORD)pInterface; float& fPosition = *(float*)(dwThis + 0x9CC); float& fTimeStep = *(float*)(0xB7CB5C); @@ -1106,19 +979,19 @@ void CVehicleSA::SetLandingGearDown(bool bLandingGearDown) float CVehicleSA::GetLandingGearPosition() { - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); return *(float*)(dwThis + 2508); } void CVehicleSA::SetLandingGearPosition(float fPosition) { - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); MemPutFast(dwThis + 2508, fPosition); } bool CVehicleSA::IsLandingGearDown() { - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); if (*(float*)(dwThis + 2508) <= 0.0f) return true; else @@ -1130,7 +1003,7 @@ void CVehicleSA::Fix() DWORD dwThis = (DWORD)GetInterface(); DWORD dwFunc = 0; - CModelInfo* pModelInfo = pGame->GetModelInfo(this->GetModelIndex()); + CModelInfo* pModelInfo = pGame->GetModelInfo(GetModelIndex()); if (pModelInfo) { if (pModelInfo->IsCar() || pModelInfo->IsMonsterTruck() || pModelInfo->IsTrailer()) @@ -1155,12 +1028,12 @@ void CVehicleSA::Fix() CDamageManager* CVehicleSA::GetDamageManager() { - return this->m_pDamageManager; + return m_pDamageManager; } void CVehicleSA::BlowUp(CEntity* pCreator, unsigned long ulUnknown) { - CVehicleSAInterfaceVTBL* vehicleVTBL = (CVehicleSAInterfaceVTBL*)(this->GetInterface()->vtbl); + CVehicleSAInterfaceVTBL* vehicleVTBL = (CVehicleSAInterfaceVTBL*)(GetInterface()->vtbl); DWORD dwThis = (DWORD)m_pInterface; DWORD dwFunc = vehicleVTBL->BlowUpCar; @@ -1177,14 +1050,14 @@ void CVehicleSA::BlowUp(CEntity* pCreator, unsigned long ulUnknown) void CVehicleSA::FadeOut(bool bFadeOut) { - CVehicleSAInterface* vehicle = (CVehicleSAInterface*)this->GetInterface(); + CVehicleSAInterface* vehicle = (CVehicleSAInterface*)GetInterface(); vehicle->bDistanceFade = bFadeOut; vehicle->m_nVehicleFlags.bFadeOut = bFadeOut; } bool CVehicleSA::IsFadingOut() { - CVehicleSAInterface* vehicle = (CVehicleSAInterface*)this->GetInterface(); + CVehicleSAInterface* vehicle = (CVehicleSAInterface*)GetInterface(); return vehicle->m_nVehicleFlags.bFadeOut; } @@ -1363,12 +1236,12 @@ void CVehicleSA::SetRemapTexDictionary(int iRemapTextureDictionary) bool CVehicleSA::IsSmokeTrailEnabled() { - return (*(unsigned char*)((DWORD)this->GetInterface() + 2560) == 1); + return (*(unsigned char*)((DWORD)GetInterface() + 2560) == 1); } void CVehicleSA::SetSmokeTrailEnabled(bool bEnabled) { - MemPutFast((DWORD)this->GetInterface() + 2560, (bEnabled) ? 1 : 0); + MemPutFast((DWORD)GetInterface() + 2560, (bEnabled) ? 1 : 0); } CHandlingEntry* CVehicleSA::GetHandlingData() @@ -1481,18 +1354,18 @@ void CVehicleSA::BurstTyre(BYTE bTyre) BYTE CVehicleSA::GetBikeWheelStatus(BYTE bWheel) { if (bWheel == 0) - return *(BYTE*)((DWORD)this->GetInterface() + 0x65C); + return *(BYTE*)((DWORD)GetInterface() + 0x65C); if (bWheel == 1) - return *(BYTE*)((DWORD)this->GetInterface() + 0x65D); + return *(BYTE*)((DWORD)GetInterface() + 0x65D); return 0; } void CVehicleSA::SetBikeWheelStatus(BYTE bWheel, BYTE bStatus) { if (bWheel == 0) - *(BYTE*)((DWORD)this->GetInterface() + 0x65C) = bStatus; + *(BYTE*)((DWORD)GetInterface() + 0x65C) = bStatus; else if (bWheel == 1) - *(BYTE*)((DWORD)this->GetInterface() + 0x65D) = bStatus; + *(BYTE*)((DWORD)GetInterface() + 0x65D) = bStatus; } bool CVehicleSA::IsWheelCollided(BYTE eWheelPosition) @@ -1684,7 +1557,7 @@ void CVehicleSA::SetHeliSearchLightVisible(bool bVisible) CColModel* CVehicleSA::GetSpecialColModel() { - CVehicleSAInterface* vehicle = (CVehicleSAInterface*)this->GetInterface(); + CVehicleSAInterface* vehicle = (CVehicleSAInterface*)GetInterface(); if (vehicle->m_nSpecialColModel != 0xFF) { CColModelSAInterface* pSpecialColModels = (CColModelSAInterface*)VAR_CVehicle_SpecialColModels; @@ -1702,7 +1575,7 @@ bool CVehicleSA::UpdateMovingCollision(float fAngle) { // If we dont have a driver, use the local player for this function // It will check a few key-states which shouldn't make any difference as we've specified an angle. - CVehicleSAInterface* vehicle = (CVehicleSAInterface*)this->GetInterface(); + CVehicleSAInterface* vehicle = (CVehicleSAInterface*)GetInterface(); CPedSAInterface* pDriver = vehicle->pDriver; if (!pDriver) { @@ -2290,7 +2163,7 @@ void CVehicleSA::SetAutomobileDummyPosition(CAutomobileSAInterface* automobile, // Change plate text of existing vehicle bool CVehicleSA::SetPlateText(const SString& strText) { - CModelInfo* pModelInfo = pGame->GetModelInfo(this->GetModelIndex()); + CModelInfo* pModelInfo = pGame->GetModelInfo(GetModelIndex()); if (!pModelInfo) return false; CVehicleModelInfoSAInterface* pVehicleModelInfo = (CVehicleModelInfoSAInterface*)pModelInfo->GetInterface(); diff --git a/Client/game_sa/CVehicleSA.h b/Client/game_sa/CVehicleSA.h index 2dfe22626e..3e2c284ba5 100644 --- a/Client/game_sa/CVehicleSA.h +++ b/Client/game_sa/CVehicleSA.h @@ -23,6 +23,7 @@ #include "CAEVehicleAudioEntitySA.h" class CFxSystemSAInterface; +class CTrainSAInterface; struct RwTexture; #define SIZEOF_CHELI 2584 @@ -390,34 +391,34 @@ class CVehicleSA : public virtual CVehicle, public virtual CPhysicalSA friend class CPoolsSA; private: - CDamageManagerSA* m_pDamageManager; - CAEVehicleAudioEntitySA* m_pVehicleAudioEntity; - CHandlingEntrySA* m_pHandlingData; - CFlyingHandlingEntrySA* m_pFlyingHandlingData; - void* m_pSuspensionLines; - bool m_bIsDerailable; - unsigned char m_ucAlpha; - CVector m_vecGravity; - SharedUtil::SColor m_HeadLightColor; - RwObject m_WheelObjects[4]; + CDamageManagerSA* m_pDamageManager{nullptr}; + CAEVehicleAudioEntitySA* m_pVehicleAudioEntity{nullptr}; + CHandlingEntrySA* m_pHandlingData{nullptr}; + CFlyingHandlingEntrySA* m_pFlyingHandlingData{nullptr}; + void* m_pSuspensionLines{nullptr}; + bool m_bIsDerailable{true}; + unsigned char m_ucAlpha{255}; + CVector m_vecGravity{0.0f, 0.0f, -1.0f}; + SharedUtil::SColor m_HeadLightColor{SharedUtil::SColorRGBA{255, 255, 255, 255}}; SharedUtil::SColor m_RGBColors[4]; SharedUtil::SColor m_RGBColorsFixed[4]; CDoorSA m_doors[6]; - bool m_bSwingingDoorsAllowed; + bool m_bSwingingDoorsAllowed{false}; SSirenInfo m_tSirenInfo; std::map m_ExtraFrames; unsigned char m_ucVariant; unsigned char m_ucVariant2; - unsigned char m_ucVariantCount; - bool m_doorsUndamageable = false; + unsigned char m_ucVariantCount{0}; + bool m_doorsUndamageable{false}; std::array m_dummyPositions; public: - CVehicleSA(); - CVehicleSA(CVehicleSAInterface* vehicleInterface); - CVehicleSA(eVehicleTypes dwModelID, unsigned char ucVariation, unsigned char ucVariation2); + CVehicleSA() = default; ~CVehicleSA(); + + CVehicleSAInterface* GetVehicleInterface() { return reinterpret_cast(GetInterface()); } + void Init(); // CEntitySA interface @@ -428,10 +429,10 @@ class CVehicleSA : public virtual CVehicle, public virtual CPhysicalSA bool AddProjectile(eWeaponType eWeapon, CVector vecOrigin, float fForce, CVector* target, CEntity* targetEntity); - CVehicleSAInterface* GetNextCarriageInTrain(); + CTrainSAInterface* GetNextCarriageInTrain(); CVehicle* GetNextTrainCarriage(); void SetNextTrainCarriage(CVehicle* pNext); - CVehicleSAInterface* GetPreviousCarriageInTrain(); + CTrainSAInterface* GetPreviousCarriageInTrain(); CVehicle* GetPreviousTrainCarriage(); void SetPreviousTrainCarriage(CVehicle* pPrevious); float GetDistanceToCarriage(CVehicle* pCarriage); @@ -613,8 +614,6 @@ class CVehicleSA : public virtual CVehicle, public virtual CPhysicalSA void* GetPrivateSuspensionLines(); - CVehicleSAInterface* GetVehicleInterface() { return (CVehicleSAInterface*)m_pInterface; } - bool DoesVehicleHaveSirens() { return m_tSirenInfo.m_bOverrideSirens; } void GiveVehicleSirens(unsigned char ucSirenType, unsigned char ucSirenCount); diff --git a/Client/game_sa/CWantedSA.cpp b/Client/game_sa/CWantedSA.cpp index e806c063eb..58fc1e7068 100644 --- a/Client/game_sa/CWantedSA.cpp +++ b/Client/game_sa/CWantedSA.cpp @@ -40,7 +40,7 @@ CWantedSA::~CWantedSA() void CWantedSA::SetWantedLevel(DWORD dwWantedLevel) { - DWORD dwThis = (DWORD)this->GetInterface(); + DWORD dwThis = (DWORD)GetInterface(); DWORD dwFunc = FUNC_SetWantedLevel; _asm { diff --git a/Client/game_sa/CWantedSA.h b/Client/game_sa/CWantedSA.h index 77b4bbe324..c2a57e745d 100644 --- a/Client/game_sa/CWantedSA.h +++ b/Client/game_sa/CWantedSA.h @@ -82,12 +82,12 @@ class CWantedSA : public CWanted ~CWantedSA(); // Internal game_sa accessors - CWantedSAInterface* GetInterface() { return this->internalInterface; } + CWantedSAInterface* GetInterface() { return internalInterface; } bool GetDontDelete() { return m_bDontDelete; }; void SetDontDelete(bool bDontDelete) { m_bDontDelete = bDontDelete; }; // Exported methods void SetWantedLevel(DWORD dwWantedLevel); void SetWantedLevelNoFlash(DWORD dwWantedLevel); - char GetWantedLevel() { return this->internalInterface->m_WantedLevel; }; + char GetWantedLevel() { return internalInterface->m_WantedLevel; }; }; diff --git a/Client/game_sa/CWeaponInfoSA.h b/Client/game_sa/CWeaponInfoSA.h index 4c03842037..606892ef02 100644 --- a/Client/game_sa/CWeaponInfoSA.h +++ b/Client/game_sa/CWeaponInfoSA.h @@ -93,99 +93,96 @@ class CWeaponInfoSAInterface // 112 byte long class class CWeaponInfoSA : public CWeaponInfo { private: - eWeaponType weaponType; - CWeaponInfoSAInterface* internalInterface; + eWeaponType m_weaponType; + CWeaponInfoSAInterface* m_pInterface; public: - CWeaponInfoSA(CWeaponInfoSAInterface* weaponInfoInterface, eWeaponType weaponType) - { - internalInterface = weaponInfoInterface; - weaponType = weaponType; - }; + CWeaponInfoSA(CWeaponInfoSAInterface* pInterface, eWeaponType weaponType) : m_pInterface{pInterface}, m_weaponType{weaponType} + {}; // stolen from R*'s CPedIK :) // DO NOT USE. - void SetFlags(int iFlags) { internalInterface->m_nFlags = iFlags; } + void SetFlags(int iFlags) { m_pInterface->m_nFlags = iFlags; } // END - void SetFlag(DWORD flag) { internalInterface->m_nFlags |= flag; } - void ClearFlag(DWORD flag) { internalInterface->m_nFlags &= ~flag; } - bool IsFlagSet(DWORD flag) { return ((internalInterface->m_nFlags & flag) > 0 ? true : false); } - short GetFlags() { return internalInterface->m_nFlags; } + void SetFlag(DWORD flag) { m_pInterface->m_nFlags |= flag; } + void ClearFlag(DWORD flag) { m_pInterface->m_nFlags &= ~flag; } + bool IsFlagSet(DWORD flag) { return ((m_pInterface->m_nFlags & flag) > 0 ? true : false); } + short GetFlags() { return m_pInterface->m_nFlags; } - eWeaponModel GetModel() { return (eWeaponModel)internalInterface->m_modelId; } - eWeaponModel GetModel2() { return (eWeaponModel)internalInterface->m_modelId2; } + eWeaponModel GetModel() { return (eWeaponModel)m_pInterface->m_modelId; } + eWeaponModel GetModel2() { return (eWeaponModel)m_pInterface->m_modelId2; } - CWeaponInfoSAInterface* GetInterface() { return internalInterface; }; + CWeaponInfoSAInterface* GetInterface() { return m_pInterface; }; - float GetWeaponRange() { return internalInterface->m_fWeaponRange; }; - void SetWeaponRange(float fRange) { internalInterface->m_fWeaponRange = fRange; }; + float GetWeaponRange() { return m_pInterface->m_fWeaponRange; }; + void SetWeaponRange(float fRange) { m_pInterface->m_fWeaponRange = fRange; }; - float GetTargetRange() { return internalInterface->m_fTargetRange; }; - void SetTargetRange(float fRange) { internalInterface->m_fTargetRange = fRange; }; + float GetTargetRange() { return m_pInterface->m_fTargetRange; }; + void SetTargetRange(float fRange) { m_pInterface->m_fTargetRange = fRange; }; - CVector* GetFireOffset() { return &internalInterface->m_vecFireOffset; }; - void SetFireOffset(CVector* vecFireOffset) { MemCpyFast(&internalInterface->m_vecFireOffset, vecFireOffset, sizeof(CVector)); }; + CVector* GetFireOffset() { return &m_pInterface->m_vecFireOffset; }; + void SetFireOffset(CVector* vecFireOffset) { MemCpyFast(&m_pInterface->m_vecFireOffset, vecFireOffset, sizeof(CVector)); }; - short GetDamagePerHit() { return internalInterface->m_nDamage; }; - void SetDamagePerHit(short sDamagePerHit) { internalInterface->m_nDamage = sDamagePerHit; }; + short GetDamagePerHit() { return m_pInterface->m_nDamage; }; + void SetDamagePerHit(short sDamagePerHit) { m_pInterface->m_nDamage = sDamagePerHit; }; - float GetAccuracy() { return internalInterface->m_fAccuracy; }; - void SetAccuracy(float fAccuracy) { internalInterface->m_fAccuracy = fAccuracy; }; + float GetAccuracy() { return m_pInterface->m_fAccuracy; }; + void SetAccuracy(float fAccuracy) { m_pInterface->m_fAccuracy = fAccuracy; }; - short GetMaximumClipAmmo() { return internalInterface->m_nAmmo; }; - void SetMaximumClipAmmo(short sAmmo) { internalInterface->m_nAmmo = sAmmo; }; + short GetMaximumClipAmmo() { return m_pInterface->m_nAmmo; }; + void SetMaximumClipAmmo(short sAmmo) { m_pInterface->m_nAmmo = sAmmo; }; - float GetMoveSpeed() { return internalInterface->m_fMoveSpeed; }; - void SetMoveSpeed(float fMoveSpeed) { internalInterface->m_fMoveSpeed = fMoveSpeed; }; + float GetMoveSpeed() { return m_pInterface->m_fMoveSpeed; }; + void SetMoveSpeed(float fMoveSpeed) { m_pInterface->m_fMoveSpeed = fMoveSpeed; }; // projectile/areaeffect only - float GetFiringSpeed() { return internalInterface->m_fSpeed; }; - void SetFiringSpeed(float fFiringSpeed) { internalInterface->m_fSpeed = fFiringSpeed; }; + float GetFiringSpeed() { return m_pInterface->m_fSpeed; }; + void SetFiringSpeed(float fFiringSpeed) { m_pInterface->m_fSpeed = fFiringSpeed; }; // area effect only - float GetRadius() { return internalInterface->m_fRadius; }; - void SetRadius(float fRadius) { internalInterface->m_fRadius = fRadius; }; + float GetRadius() { return m_pInterface->m_fRadius; }; + void SetRadius(float fRadius) { m_pInterface->m_fRadius = fRadius; }; - float GetLifeSpan() { return internalInterface->m_fLifeSpan; }; - void SetLifeSpan(float fLifeSpan) { internalInterface->m_fLifeSpan = fLifeSpan; }; + float GetLifeSpan() { return m_pInterface->m_fLifeSpan; }; + void SetLifeSpan(float fLifeSpan) { m_pInterface->m_fLifeSpan = fLifeSpan; }; - float GetSpread() { return internalInterface->m_fSpread; }; - void SetSpread(float fSpread) { internalInterface->m_fSpread = fSpread; }; + float GetSpread() { return m_pInterface->m_fSpread; }; + void SetSpread(float fSpread) { m_pInterface->m_fSpread = fSpread; }; - float GetAnimBreakoutTime() { return internalInterface->m_animBreakoutTime; }; - void SetAnimBreakoutTime(float fBreakoutTime) { internalInterface->m_animBreakoutTime = fBreakoutTime; }; + float GetAnimBreakoutTime() { return m_pInterface->m_animBreakoutTime; }; + void SetAnimBreakoutTime(float fBreakoutTime) { m_pInterface->m_animBreakoutTime = fBreakoutTime; }; - eWeaponSlot GetSlot() { return (eWeaponSlot)internalInterface->m_nWeaponSlot; }; - void SetSlot(eWeaponSlot dwSlot) { internalInterface->m_nWeaponSlot = (eWeaponSlot)dwSlot; }; + eWeaponSlot GetSlot() { return (eWeaponSlot)m_pInterface->m_nWeaponSlot; }; + void SetSlot(eWeaponSlot dwSlot) { m_pInterface->m_nWeaponSlot = (eWeaponSlot)dwSlot; }; - eWeaponSkill GetSkill() { return internalInterface->m_SkillLevel; } - void SetSkill(eWeaponSkill weaponSkill) { internalInterface->m_SkillLevel = weaponSkill; } + eWeaponSkill GetSkill() { return m_pInterface->m_SkillLevel; } + void SetSkill(eWeaponSkill weaponSkill) { m_pInterface->m_SkillLevel = weaponSkill; } - float GetRequiredStatLevel() { return static_cast(internalInterface->m_nReqStatLevel); } - void SetRequiredStatLevel(float fStatLevel) { internalInterface->m_nReqStatLevel = static_cast(fStatLevel); } + float GetRequiredStatLevel() { return static_cast(m_pInterface->m_nReqStatLevel); } + void SetRequiredStatLevel(float fStatLevel) { m_pInterface->m_nReqStatLevel = static_cast(fStatLevel); } - DWORD GetAnimGroup() { return internalInterface->m_animGroup; } - void SetAnimGroup(DWORD dwAnimGroup) { internalInterface->m_animGroup = dwAnimGroup; } + DWORD GetAnimGroup() { return m_pInterface->m_animGroup; } + void SetAnimGroup(DWORD dwAnimGroup) { m_pInterface->m_animGroup = dwAnimGroup; } - eFireType GetFireType() { return internalInterface->m_eFireType; } + eFireType GetFireType() { return m_pInterface->m_eFireType; } // Floats - float GetWeaponAnimLoopStart() { return internalInterface->m_animLoopStart; } - float GetWeaponAnimLoopStop() { return internalInterface->m_animLoopEnd; } - float GetWeaponAnimLoopFireTime() { return internalInterface->m_animFireTime; } - void SetWeaponAnimLoopFireTime(float animFireTime) { internalInterface->m_animFireTime = animFireTime; } + float GetWeaponAnimLoopStart() { return m_pInterface->m_animLoopStart; } + float GetWeaponAnimLoopStop() { return m_pInterface->m_animLoopEnd; } + float GetWeaponAnimLoopFireTime() { return m_pInterface->m_animFireTime; } + void SetWeaponAnimLoopFireTime(float animFireTime) { m_pInterface->m_animFireTime = animFireTime; } - float GetWeaponAnim2LoopStart() { return internalInterface->m_anim2LoopStart; } - float GetWeaponAnim2LoopStop() { return internalInterface->m_anim2LoopEnd; } - float GetWeaponAnim2LoopFireTime() { return internalInterface->m_anim2FireTime; } + float GetWeaponAnim2LoopStart() { return m_pInterface->m_anim2LoopStart; } + float GetWeaponAnim2LoopStop() { return m_pInterface->m_anim2LoopEnd; } + float GetWeaponAnim2LoopFireTime() { return m_pInterface->m_anim2FireTime; } - float GetWeaponAnimBreakoutTime() { return internalInterface->m_animBreakoutTime; } + float GetWeaponAnimBreakoutTime() { return m_pInterface->m_animBreakoutTime; } - float GetWeaponRadius() { return internalInterface->m_fRadius; } + float GetWeaponRadius() { return m_pInterface->m_fRadius; } // Ints - short GetAimOffsetIndex() { return internalInterface->m_nAimOffsetIndex; } + short GetAimOffsetIndex() { return m_pInterface->m_nAimOffsetIndex; } - BYTE GetDefaultCombo() { return internalInterface->m_defaultCombo; } - BYTE GetCombosAvailable() { return internalInterface->m_nCombosAvailable; } + BYTE GetDefaultCombo() { return m_pInterface->m_defaultCombo; } + BYTE GetCombosAvailable() { return m_pInterface->m_nCombosAvailable; } }; diff --git a/Client/game_sa/CWeaponSA.cpp b/Client/game_sa/CWeaponSA.cpp index 19e3cf0e0e..93a7dd8a6e 100644 --- a/Client/game_sa/CWeaponSA.cpp +++ b/Client/game_sa/CWeaponSA.cpp @@ -20,65 +20,62 @@ extern CGameSA* pGame; -CWeaponSA::CWeaponSA(CWeaponSAInterface* weaponInterface, CPed* ped, eWeaponSlot weaponSlot) -{ - this->owner = ped; - this->m_weaponSlot = weaponSlot; - internalInterface = weaponInterface; -} +CWeaponSA::CWeaponSA(CWeaponSAInterface* pInterface, CPed* pOwner, eWeaponSlot weaponSlot) + : m_pInterface{pInterface}, m_pOwner{pOwner}, m_weaponSlot{weaponSlot} +{} void CWeaponSA::Destroy() { - if (!owner) + if (!m_pOwner) { - delete internalInterface; + delete m_pInterface; delete this; } } eWeaponType CWeaponSA::GetType() { - return this->internalInterface->m_eWeaponType; + return m_pInterface->m_eWeaponType; }; void CWeaponSA::SetType(eWeaponType type) { - this->internalInterface->m_eWeaponType = type; + m_pInterface->m_eWeaponType = type; } eWeaponState CWeaponSA::GetState() { - return this->internalInterface->m_eState; + return m_pInterface->m_eState; } void CWeaponSA::SetState(eWeaponState state) { - this->internalInterface->m_eState = state; + m_pInterface->m_eState = state; } DWORD CWeaponSA::GetAmmoInClip() { - return this->internalInterface->m_nAmmoInClip; + return m_pInterface->m_nAmmoInClip; } void CWeaponSA::SetAmmoInClip(DWORD dwAmmoInClip) { - this->internalInterface->m_nAmmoInClip = dwAmmoInClip; + m_pInterface->m_nAmmoInClip = dwAmmoInClip; } DWORD CWeaponSA::GetAmmoTotal() { - return this->internalInterface->m_nAmmoTotal; + return m_pInterface->m_nAmmoTotal; } void CWeaponSA::SetAmmoTotal(DWORD dwAmmoTotal) { - this->internalInterface->m_nAmmoTotal = dwAmmoTotal; + m_pInterface->m_nAmmoTotal = dwAmmoTotal; } CPed* CWeaponSA::GetPed() { - return (CPed*)owner; + return m_pOwner; } eWeaponSlot CWeaponSA::GetSlot() @@ -88,18 +85,18 @@ eWeaponSlot CWeaponSA::GetSlot() void CWeaponSA::SetAsCurrentWeapon() { - owner->SetCurrentWeaponSlot(m_weaponSlot); + m_pOwner->SetCurrentWeaponSlot(m_weaponSlot); } CWeaponInfo* CWeaponSA::GetInfo(eWeaponSkill skill) { - return pGame->GetWeaponInfo(internalInterface->m_eWeaponType, skill); + return pGame->GetWeaponInfo(m_pInterface->m_eWeaponType, skill); } void CWeaponSA::Remove() { DWORD dwFunc = FUNC_Shutdown; - DWORD dwThis = (DWORD)this->internalInterface; + DWORD dwThis = (DWORD)m_pInterface; _asm { mov ecx, dwThis @@ -107,15 +104,15 @@ void CWeaponSA::Remove() } // If the removed weapon was the currently active weapon, switch to empty-handed - if (owner->GetCurrentWeaponSlot() == m_weaponSlot) + if (m_pOwner->GetCurrentWeaponSlot() == m_weaponSlot) { - CWeaponInfo* pInfo = pGame->GetWeaponInfo(this->internalInterface->m_eWeaponType); + CWeaponInfo* pInfo = pGame->GetWeaponInfo(m_pInterface->m_eWeaponType); if (pInfo) { int iModel = pInfo->GetModel(); - owner->RemoveWeaponModel(iModel); + m_pOwner->RemoveWeaponModel(iModel); } - owner->SetCurrentWeaponSlot(WEAPONSLOT_TYPE_UNARMED); + m_pOwner->SetCurrentWeaponSlot(WEAPONSLOT_TYPE_UNARMED); } } @@ -125,7 +122,7 @@ void CWeaponSA::Initialize(eWeaponType type, unsigned int uiAmmo, CPed* pPed) if (pPed) dwPedInterface = (DWORD)pPed->GetInterface(); unsigned int uiType = (unsigned int)type; - DWORD dwThis = (DWORD)internalInterface; + DWORD dwThis = (DWORD)m_pInterface; DWORD dwFunc = FUNC_CWeapon_Initialize; _asm { @@ -141,7 +138,7 @@ void CWeaponSA::Update(CPed* pPed) { // Note: CWeapon::Update is called mainly to check for reload DWORD dwPedInterface = (DWORD)pPed->GetInterface(); - DWORD dwThis = (DWORD)internalInterface; + DWORD dwThis = (DWORD)m_pInterface; DWORD dwFunc = FUNC_CWeapon_Update; _asm { @@ -160,7 +157,7 @@ bool CWeaponSA::Fire(CEntity* pFiringEntity, CVector* pvecOrigin, CVector* pvecT DWORD dwTargetInterface = 0; if (pTargetEntity) dwTargetInterface = (DWORD)pTargetEntity->GetInterface(); - DWORD dwThis = (DWORD)internalInterface; + DWORD dwThis = (DWORD)m_pInterface; DWORD dwFunc = FUNC_CWeapon_Fire; _asm { @@ -182,7 +179,7 @@ void CWeaponSA::AddGunshell(CEntity* pFiringEntity, CVector* pvecOrigin, CVector DWORD dwEntityInterface = 0; if (pFiringEntity) dwEntityInterface = (DWORD)pFiringEntity->GetInterface(); - DWORD dwThis = (DWORD)internalInterface; + DWORD dwThis = (DWORD)m_pInterface; DWORD dwFunc = FUNC_CWeapon_AddGunshell; _asm { @@ -205,7 +202,7 @@ void CWeaponSA::DoBulletImpact(CEntity* pFiringEntity, CEntitySAInterface* pEnti DWORD dwColPointInterface = 0; if (pColPoint) dwColPointInterface = (DWORD)pColPoint->GetInterface(); - DWORD dwThis = (DWORD)internalInterface; + DWORD dwThis = (DWORD)m_pInterface; DWORD dwFunc = FUNC_CWeapon_DoBulletImpact; _asm { @@ -281,7 +278,7 @@ bool CWeaponSA::FireBullet(CEntity* pFiringEntity, const CVector& vecOrigin, con pFiringPlayerPed->GetTransformedBonePosition(BONE_RIGHTWRIST, &vecGunMuzzle); // Bullet trace - FireInstantHit(pFiringEntity, &vecOrigin, &vecGunMuzzle, NULL, &vecTarget, NULL, false, true); + FireInstantHit(pFiringEntity, &vecOrigin, &vecGunMuzzle, nullptr, &vecTarget, nullptr, false, true); // Fire sound if (pFiringPlayerPed) @@ -291,7 +288,7 @@ bool CWeaponSA::FireBullet(CEntity* pFiringEntity, const CVector& vecOrigin, con if (pGame->m_pPostWeaponFireHandler && pFiringPlayerPed) pGame->m_pPostWeaponFireHandler(); - pGame->GetWorld()->IgnoreEntity(NULL); + pGame->GetWorld()->IgnoreEntity(nullptr); return true; } @@ -312,7 +309,7 @@ bool CWeaponSA::FireInstantHit(CEntity* pFiringEntity, const CVector* pvecOrigin DWORD dwTargetInterface = 0; if (pTargetEntity) dwTargetInterface = (DWORD)pTargetEntity->GetInterface(); - DWORD dwThis = (DWORD)internalInterface; + DWORD dwThis = (DWORD)m_pInterface; DWORD dwFunc = FUNC_CWeapon_FireInstantHit; _asm { diff --git a/Client/game_sa/CWeaponSA.h b/Client/game_sa/CWeaponSA.h index 57a1feb0e3..571fccbcd9 100644 --- a/Client/game_sa/CWeaponSA.h +++ b/Client/game_sa/CWeaponSA.h @@ -42,12 +42,12 @@ class CWeaponSAInterface class CWeaponSA : public CWeapon { private: - CWeaponSAInterface* internalInterface; - CPed* owner; + CWeaponSAInterface* m_pInterface; + CPed* m_pOwner; eWeaponSlot m_weaponSlot; public: - CWeaponSA(CWeaponSAInterface* weaponInterface, CPed* ped, eWeaponSlot weaponSlot); + CWeaponSA(CWeaponSAInterface* pInterface, CPed* pOwner, eWeaponSlot weaponSlot); eWeaponType GetType(); void SetType(eWeaponType type); eWeaponState GetState(); diff --git a/Client/game_sa/CWeaponStatManagerSA.cpp b/Client/game_sa/CWeaponStatManagerSA.cpp index 4988cb7d68..e976a61250 100644 --- a/Client/game_sa/CWeaponStatManagerSA.cpp +++ b/Client/game_sa/CWeaponStatManagerSA.cpp @@ -14,14 +14,16 @@ sWeaponInfo CWeaponStatManagerSA::OriginalPoorWeaponData[WEAPONTYPE_MAX + 1]; sWeaponInfo CWeaponStatManagerSA::OriginalNormalWeaponData[WEAPONTYPE_MAX + 1]; sWeaponInfo CWeaponStatManagerSA::OriginalHitmanWeaponData[WEAPONTYPE_MAX + 1]; + CWeaponStatManagerSA::CWeaponStatManagerSA() { Init(); InitLists(); } + void CWeaponStatManagerSA::InitLists() { - CWeaponStatSA* pWeaponStat = NULL; + CWeaponStatSA* pWeaponStat = nullptr; // Make our list nicer by starting at the non-skill weapons so we don't have duplicates of STD weapon skill for (int i = 0; i <= WEAPONTYPE_EXTINGUISHER; i++) { @@ -46,6 +48,7 @@ void CWeaponStatManagerSA::InitLists() } } } + // Don't call me for now seems to screw up rejoining void CWeaponStatManagerSA::ResetLists() { @@ -53,7 +56,7 @@ void CWeaponStatManagerSA::ResetLists() if (m_WeaponData.size() == 0) return; - CWeaponStat* pWeaponStat = NULL; + CWeaponStat* pWeaponStat = nullptr; // Make our list nicer by starting at the non-skill weapons so we don't have duplicates of STD weapon skill for (std::list::iterator iter = m_WeaponData.begin(); iter != m_WeaponData.end(); iter++) { @@ -86,7 +89,7 @@ CWeaponStatManagerSA::~CWeaponStatManagerSA() void CWeaponStatManagerSA::CreateWeaponStat(CWeaponInfo* pInterface, eWeaponType weaponType, eWeaponSkill weaponSkill) { - CWeaponStatSA* pWeaponStat = NULL; + CWeaponStatSA* pWeaponStat = nullptr; // Storage for new weapon data ( for script use ) pWeaponStat = new CWeaponStatSA(((CWeaponInfoSA*)(pInterface)), weaponType, weaponSkill); @@ -96,7 +99,7 @@ void CWeaponStatManagerSA::CreateWeaponStat(CWeaponInfo* pInterface, eWeaponType CWeaponStat* CWeaponStatManagerSA::CreateWeaponStatUnlisted(eWeaponType weaponType, eWeaponSkill weaponSkill) { - CWeaponStatSA* pWeaponStat = NULL; + CWeaponStatSA* pWeaponStat = nullptr; // Storage for new weapon data ( for script use ) pWeaponStat = new CWeaponStatSA(weaponType, weaponSkill); @@ -113,7 +116,7 @@ CWeaponStat* CWeaponStatManagerSA::GetWeaponStats(eWeaponType type, eWeaponSkill return (*iter); } } - return NULL; + return nullptr; } CWeaponStat* CWeaponStatManagerSA::GetWeaponStatsFromSkillLevel(eWeaponType type, float fSkillLevel) @@ -135,7 +138,7 @@ CWeaponStat* CWeaponStatManagerSA::GetWeaponStatsFromSkillLevel(eWeaponType type else return pStd; } - return NULL; + return nullptr; } CWeaponStat* CWeaponStatManagerSA::GetOriginalWeaponStats(eWeaponType type, eWeaponSkill skill) @@ -147,7 +150,7 @@ CWeaponStat* CWeaponStatManagerSA::GetOriginalWeaponStats(eWeaponType type, eWea return (*iter); } } - return NULL; + return nullptr; } void CWeaponStatManagerSA::Init() { diff --git a/Client/game_sa/CWeaponStatManagerSA.h b/Client/game_sa/CWeaponStatManagerSA.h index 0d3a15bd32..8446598e2b 100644 --- a/Client/game_sa/CWeaponStatManagerSA.h +++ b/Client/game_sa/CWeaponStatManagerSA.h @@ -15,10 +15,12 @@ #include "CWeaponStatSA.h" // Straight out of CGameSA.h -#define CLASSSIZE_WeaponInfo 112 // ##SA## -#define NUM_WeaponInfosStdSkill WEAPONTYPE_LAST_WEAPONTYPE -#define NUM_WeaponInfosOtherSkill 11 -#define NUM_WeaponInfosTotal (NUM_WeaponInfosStdSkill + (3*NUM_WeaponInfosOtherSkill)) // std, (poor, pro, special) +#define CLASSSIZE_WeaponInfo 112 // ##SA## +#define NUM_WeaponInfosStdSkill WEAPONTYPE_LAST_WEAPONTYPE +#define NUM_WeaponInfosOtherSkill 11 +#define NUM_WeaponInfosTotal (NUM_WeaponInfosStdSkill + (3*NUM_WeaponInfosOtherSkill)) // std, (poor, pro, special) + +#define WEAPON_STAT_MAX 112 struct sWeaponInfo { @@ -74,7 +76,6 @@ struct sWeaponInfo BYTE combos_available; // how many further combos are available }; -#define WEAPON_STAT_MAX 112 class CWeaponStatManagerSA : public CWeaponStatManager { public: diff --git a/Client/game_sa/CWeaponStatSA.cpp b/Client/game_sa/CWeaponStatSA.cpp index c95d8b3525..4c84c2ffdb 100644 --- a/Client/game_sa/CWeaponStatSA.cpp +++ b/Client/game_sa/CWeaponStatSA.cpp @@ -15,57 +15,55 @@ extern CGameSA* pGame; -CWeaponStatSA::CWeaponStatSA(eWeaponType weaponType, eWeaponSkill skillLevel) +// For Data Storage and won't apply changes. +CWeaponStatSA::CWeaponStatSA(eWeaponType weaponType, eWeaponSkill skillLevel) : m_weaponType{weaponType}, m_skillLevel{skillLevel} { - // For Data Storage and won't apply changes. - this->pWeaponStats = new CWeaponInfoSAInterface(); - this->weaponType = weaponType; - this->skillLevel = skillLevel; + m_pWeaponStats = new CWeaponInfoSAInterface(); } -CWeaponStatSA::CWeaponStatSA(CWeaponInfoSA* pWeaponInfo, eWeaponType weaponType, eWeaponSkill skillLevel) + +// For scripting API and applies changes. +CWeaponStatSA::CWeaponStatSA(CWeaponInfoSA* pWeaponInfo, eWeaponType weaponType, eWeaponSkill skillLevel) : m_weaponType{weaponType}, m_skillLevel{skillLevel} { - // For scripting API and applies changes.. - this->pWeaponStats = pWeaponInfo->GetInterface(); - this->weaponType = weaponType; - this->skillLevel = skillLevel; + m_pWeaponStats = pWeaponInfo->GetInterface(); } + CWeaponStatSA::~CWeaponStatSA() { } eWeaponType CWeaponStatSA::GetWeaponType() { - return this->weaponType; + return m_weaponType; } eWeaponSkill CWeaponStatSA::GetWeaponSkillLevel() { - return this->skillLevel; + return m_skillLevel; } void CWeaponStatSA::SetWeaponType(eWeaponType weaponType) { - this->weaponType = weaponType; + m_weaponType = weaponType; } void CWeaponStatSA::SetWeaponSkillLevel(eWeaponSkill skillLevel) { - this->skillLevel = skillLevel; + m_skillLevel = skillLevel; } void CWeaponStatSA::ToggleFlagBits(DWORD flagBits) { - HandleFlagsValueChange(pWeaponStats->m_nFlags ^ flagBits); + HandleFlagsValueChange(m_pWeaponStats->m_nFlags ^ flagBits); } void CWeaponStatSA::SetFlagBits(DWORD flagBits) { - HandleFlagsValueChange(pWeaponStats->m_nFlags | flagBits); + HandleFlagsValueChange(m_pWeaponStats->m_nFlags | flagBits); } void CWeaponStatSA::ClearFlagBits(DWORD flagBits) { - HandleFlagsValueChange(pWeaponStats->m_nFlags & ~flagBits); + HandleFlagsValueChange(m_pWeaponStats->m_nFlags & ~flagBits); } void CWeaponStatSA::HandleFlagsValueChange(DWORD newValue) @@ -111,5 +109,5 @@ void CWeaponStatSA::HandleFlagsValueChange(DWORD newValue) newValue &= ~WEAPONTYPE_ANIM_CROUCHFIRE; } - pWeaponStats->m_nFlags = newValue; + m_pWeaponStats->m_nFlags = newValue; } diff --git a/Client/game_sa/CWeaponStatSA.h b/Client/game_sa/CWeaponStatSA.h index 8168389e36..d89aeff1fd 100644 --- a/Client/game_sa/CWeaponStatSA.h +++ b/Client/game_sa/CWeaponStatSA.h @@ -34,114 +34,114 @@ class CWeaponStatSA : public CWeaponStat void SetFlagBits(DWORD flagBits); void ClearFlagBits(DWORD flagBits); // For initialization only - void SetFlags(int iFlags) { pWeaponStats->m_nFlags = iFlags; } - bool IsFlagSet(DWORD flag) { return ((pWeaponStats->m_nFlags & flag) > 0 ? true : false); } - int GetFlags() { return pWeaponStats->m_nFlags; } + void SetFlags(int iFlags) { m_pWeaponStats->m_nFlags = iFlags; } + bool IsFlagSet(DWORD flag) { return ((m_pWeaponStats->m_nFlags & flag) > 0 ? true : false); } + int GetFlags() { return m_pWeaponStats->m_nFlags; } - eWeaponModel GetModel() { return (eWeaponModel)pWeaponStats->m_modelId; } - void SetModel(int iModel) { pWeaponStats->m_modelId = (int)iModel; } + eWeaponModel GetModel() { return (eWeaponModel)m_pWeaponStats->m_modelId; } + void SetModel(int iModel) { m_pWeaponStats->m_modelId = (int)iModel; } - eWeaponModel GetModel2() { return (eWeaponModel)pWeaponStats->m_modelId2; } - void SetModel2(int iModel) { pWeaponStats->m_modelId2 = (int)iModel; } + eWeaponModel GetModel2() { return (eWeaponModel)m_pWeaponStats->m_modelId2; } + void SetModel2(int iModel) { m_pWeaponStats->m_modelId2 = (int)iModel; } - CWeaponInfoSAInterface* GetInterface() { return pWeaponStats; }; + CWeaponInfoSAInterface* GetInterface() { return m_pWeaponStats; }; - float GetWeaponRange() { return pWeaponStats->m_fWeaponRange; }; - void SetWeaponRange(float fRange) { pWeaponStats->m_fWeaponRange = fRange; }; + float GetWeaponRange() { return m_pWeaponStats->m_fWeaponRange; }; + void SetWeaponRange(float fRange) { m_pWeaponStats->m_fWeaponRange = fRange; }; - float GetTargetRange() { return pWeaponStats->m_fTargetRange; }; - void SetTargetRange(float fRange) { pWeaponStats->m_fTargetRange = fRange; }; + float GetTargetRange() { return m_pWeaponStats->m_fTargetRange; }; + void SetTargetRange(float fRange) { m_pWeaponStats->m_fTargetRange = fRange; }; - CVector* GetFireOffset() { return &pWeaponStats->m_vecFireOffset; }; - void SetFireOffset(CVector* vecFireOffset) { pWeaponStats->m_vecFireOffset = *vecFireOffset; }; + CVector* GetFireOffset() { return &m_pWeaponStats->m_vecFireOffset; }; + void SetFireOffset(CVector* vecFireOffset) { m_pWeaponStats->m_vecFireOffset = *vecFireOffset; }; - short GetDamagePerHit() { return pWeaponStats->m_nDamage; }; - void SetDamagePerHit(short sDamagePerHit) { pWeaponStats->m_nDamage = sDamagePerHit; }; + short GetDamagePerHit() { return m_pWeaponStats->m_nDamage; }; + void SetDamagePerHit(short sDamagePerHit) { m_pWeaponStats->m_nDamage = sDamagePerHit; }; - float GetAccuracy() { return pWeaponStats->m_fAccuracy; }; - void SetAccuracy(float fAccuracy) { pWeaponStats->m_fAccuracy = fAccuracy; }; + float GetAccuracy() { return m_pWeaponStats->m_fAccuracy; }; + void SetAccuracy(float fAccuracy) { m_pWeaponStats->m_fAccuracy = fAccuracy; }; - short GetMaximumClipAmmo() { return pWeaponStats->m_nAmmo; }; - void SetMaximumClipAmmo(short sAccuracy) { pWeaponStats->m_nAmmo = sAccuracy; }; + short GetMaximumClipAmmo() { return m_pWeaponStats->m_nAmmo; }; + void SetMaximumClipAmmo(short sAccuracy) { m_pWeaponStats->m_nAmmo = sAccuracy; }; - float GetMoveSpeed() { return pWeaponStats->m_fMoveSpeed; }; - void SetMoveSpeed(float fMoveSpeed) { pWeaponStats->m_fMoveSpeed = fMoveSpeed; }; + float GetMoveSpeed() { return m_pWeaponStats->m_fMoveSpeed; }; + void SetMoveSpeed(float fMoveSpeed) { m_pWeaponStats->m_fMoveSpeed = fMoveSpeed; }; // projectile/areaeffect only - float GetFiringSpeed() { return pWeaponStats->m_fSpeed; }; - void SetFiringSpeed(float fFiringSpeed) { pWeaponStats->m_fSpeed = fFiringSpeed; }; + float GetFiringSpeed() { return m_pWeaponStats->m_fSpeed; }; + void SetFiringSpeed(float fFiringSpeed) { m_pWeaponStats->m_fSpeed = fFiringSpeed; }; // area effect only - float GetRadius() { return pWeaponStats->m_fRadius; }; - void SetRadius(float fRadius) { pWeaponStats->m_fRadius = fRadius; }; + float GetRadius() { return m_pWeaponStats->m_fRadius; }; + void SetRadius(float fRadius) { m_pWeaponStats->m_fRadius = fRadius; }; - float GetLifeSpan() { return pWeaponStats->m_fLifeSpan; }; - void SetLifeSpan(float fLifeSpan) { pWeaponStats->m_fLifeSpan = fLifeSpan; }; + float GetLifeSpan() { return m_pWeaponStats->m_fLifeSpan; }; + void SetLifeSpan(float fLifeSpan) { m_pWeaponStats->m_fLifeSpan = fLifeSpan; }; - float GetSpread() { return pWeaponStats->m_fSpread; }; - void SetSpread(float fSpread) { pWeaponStats->m_fSpread = fSpread; }; + float GetSpread() { return m_pWeaponStats->m_fSpread; }; + void SetSpread(float fSpread) { m_pWeaponStats->m_fSpread = fSpread; }; - float GetAnimBreakoutTime() { return pWeaponStats->m_animBreakoutTime; }; - void SetAnimBreakoutTime(float fBreakoutTime) { pWeaponStats->m_animBreakoutTime = fBreakoutTime; }; + float GetAnimBreakoutTime() { return m_pWeaponStats->m_animBreakoutTime; }; + void SetAnimBreakoutTime(float fBreakoutTime) { m_pWeaponStats->m_animBreakoutTime = fBreakoutTime; }; - eWeaponSlot GetSlot() { return (eWeaponSlot)pWeaponStats->m_nWeaponSlot; }; - void SetSlot(eWeaponSlot dwSlot) { pWeaponStats->m_nWeaponSlot = (eWeaponSlot)dwSlot; }; + eWeaponSlot GetSlot() { return (eWeaponSlot)m_pWeaponStats->m_nWeaponSlot; }; + void SetSlot(eWeaponSlot dwSlot) { m_pWeaponStats->m_nWeaponSlot = (eWeaponSlot)dwSlot; }; - eWeaponSkill GetSkill() { return pWeaponStats->m_SkillLevel; } - void SetSkill(eWeaponSkill weaponSkill) { pWeaponStats->m_SkillLevel = weaponSkill; } + eWeaponSkill GetSkill() { return m_pWeaponStats->m_SkillLevel; } + void SetSkill(eWeaponSkill weaponSkill) { m_pWeaponStats->m_SkillLevel = weaponSkill; } - float GetRequiredStatLevel() { return static_cast(pWeaponStats->m_nReqStatLevel); } - void SetRequiredStatLevel(float fStatLevel) { pWeaponStats->m_nReqStatLevel = static_cast(fStatLevel); } - void SetRequiredStatLevel(int iStatLevel) { pWeaponStats->m_nReqStatLevel = iStatLevel; } + float GetRequiredStatLevel() { return static_cast(m_pWeaponStats->m_nReqStatLevel); } + void SetRequiredStatLevel(float fStatLevel) { m_pWeaponStats->m_nReqStatLevel = static_cast(fStatLevel); } + void SetRequiredStatLevel(int iStatLevel) { m_pWeaponStats->m_nReqStatLevel = iStatLevel; } - DWORD GetAnimGroup() { return pWeaponStats->m_animGroup; } - void SetAnimGroup(DWORD dwAnimGroup) { pWeaponStats->m_animGroup = dwAnimGroup; } + DWORD GetAnimGroup() { return m_pWeaponStats->m_animGroup; } + void SetAnimGroup(DWORD dwAnimGroup) { m_pWeaponStats->m_animGroup = dwAnimGroup; } - eFireType GetFireType() { return pWeaponStats->m_eFireType; } - void SetFireType(eFireType type) { pWeaponStats->m_eFireType = type; } + eFireType GetFireType() { return m_pWeaponStats->m_eFireType; } + void SetFireType(eFireType type) { m_pWeaponStats->m_eFireType = type; } // Floats - float GetWeaponAnimLoopStart() { return pWeaponStats->m_animLoopStart; } - void SetWeaponAnimLoopStart(float animLoopStart) { pWeaponStats->m_animLoopStart = animLoopStart; } + float GetWeaponAnimLoopStart() { return m_pWeaponStats->m_animLoopStart; } + void SetWeaponAnimLoopStart(float animLoopStart) { m_pWeaponStats->m_animLoopStart = animLoopStart; } - float GetWeaponAnimLoopStop() { return pWeaponStats->m_animLoopEnd; } - void SetWeaponAnimLoopStop(float animLoopEnd) { pWeaponStats->m_animLoopEnd = animLoopEnd; } + float GetWeaponAnimLoopStop() { return m_pWeaponStats->m_animLoopEnd; } + void SetWeaponAnimLoopStop(float animLoopEnd) { m_pWeaponStats->m_animLoopEnd = animLoopEnd; } - float GetWeaponAnimLoopFireTime() { return pWeaponStats->m_animFireTime; } - void SetWeaponAnimLoopFireTime(float animFireTime) { pWeaponStats->m_animFireTime = animFireTime; } + float GetWeaponAnimLoopFireTime() { return m_pWeaponStats->m_animFireTime; } + void SetWeaponAnimLoopFireTime(float animFireTime) { m_pWeaponStats->m_animFireTime = animFireTime; } - float GetWeaponAnim2LoopStart() { return pWeaponStats->m_anim2LoopStart; } - void SetWeaponAnim2LoopStart(float anim2LoopStart) { pWeaponStats->m_anim2LoopStart = anim2LoopStart; } + float GetWeaponAnim2LoopStart() { return m_pWeaponStats->m_anim2LoopStart; } + void SetWeaponAnim2LoopStart(float anim2LoopStart) { m_pWeaponStats->m_anim2LoopStart = anim2LoopStart; } - float GetWeaponAnim2LoopStop() { return pWeaponStats->m_anim2LoopEnd; } - void SetWeaponAnim2LoopStop(float anim2LoopEnd) { pWeaponStats->m_anim2LoopEnd = anim2LoopEnd; } + float GetWeaponAnim2LoopStop() { return m_pWeaponStats->m_anim2LoopEnd; } + void SetWeaponAnim2LoopStop(float anim2LoopEnd) { m_pWeaponStats->m_anim2LoopEnd = anim2LoopEnd; } - float GetWeaponAnim2LoopFireTime() { return pWeaponStats->m_anim2FireTime; } - void SetWeaponAnim2LoopFireTime(float anim2FireTime) { pWeaponStats->m_anim2FireTime = anim2FireTime; } + float GetWeaponAnim2LoopFireTime() { return m_pWeaponStats->m_anim2FireTime; } + void SetWeaponAnim2LoopFireTime(float anim2FireTime) { m_pWeaponStats->m_anim2FireTime = anim2FireTime; } - float GetWeaponAnimBreakoutTime() { return pWeaponStats->m_animBreakoutTime; } - void SetWeaponAnimBreakoutTime(float animBreakoutTime) { pWeaponStats->m_animBreakoutTime = animBreakoutTime; } + float GetWeaponAnimBreakoutTime() { return m_pWeaponStats->m_animBreakoutTime; } + void SetWeaponAnimBreakoutTime(float animBreakoutTime) { m_pWeaponStats->m_animBreakoutTime = animBreakoutTime; } - float GetWeaponSpeed() { return pWeaponStats->m_fSpeed; } - void SetWeaponSpeed(float fSpeed) { pWeaponStats->m_fSpeed = fSpeed; } + float GetWeaponSpeed() { return m_pWeaponStats->m_fSpeed; } + void SetWeaponSpeed(float fSpeed) { m_pWeaponStats->m_fSpeed = fSpeed; } - float GetWeaponRadius() { return pWeaponStats->m_fRadius; } - void SetWeaponRadius(float fRadius) { pWeaponStats->m_fRadius = fRadius; } + float GetWeaponRadius() { return m_pWeaponStats->m_fRadius; } + void SetWeaponRadius(float fRadius) { m_pWeaponStats->m_fRadius = fRadius; } // Ints - short GetAimOffsetIndex() { return pWeaponStats->m_nAimOffsetIndex; } - void SetAimOffsetIndex(short sIndex) { pWeaponStats->m_nAimOffsetIndex = sIndex; } + short GetAimOffsetIndex() { return m_pWeaponStats->m_nAimOffsetIndex; } + void SetAimOffsetIndex(short sIndex) { m_pWeaponStats->m_nAimOffsetIndex = sIndex; } - BYTE GetDefaultCombo() { return pWeaponStats->m_defaultCombo; } - void SetDefaultCombo(BYTE defaultCombo) { pWeaponStats->m_defaultCombo = defaultCombo; } + BYTE GetDefaultCombo() { return m_pWeaponStats->m_defaultCombo; } + void SetDefaultCombo(BYTE defaultCombo) { m_pWeaponStats->m_defaultCombo = defaultCombo; } - BYTE GetCombosAvailable() { return pWeaponStats->m_nCombosAvailable; } - void SetCombosAvailable(BYTE nCombosAvailable) { pWeaponStats->m_nCombosAvailable = nCombosAvailable; } + BYTE GetCombosAvailable() { return m_pWeaponStats->m_nCombosAvailable; } + void SetCombosAvailable(BYTE nCombosAvailable) { m_pWeaponStats->m_nCombosAvailable = nCombosAvailable; } private: void HandleFlagsValueChange(DWORD newValue); - eWeaponType weaponType; - eWeaponSkill skillLevel; - CWeaponInfoSAInterface* pWeaponStats; + eWeaponType m_weaponType; + eWeaponSkill m_skillLevel; + CWeaponInfoSAInterface* m_pWeaponStats; }; diff --git a/Client/game_sa/TaskAttackSA.cpp b/Client/game_sa/TaskAttackSA.cpp index 0a03a111ff..2f2c2b0ca6 100644 --- a/Client/game_sa/TaskAttackSA.cpp +++ b/Client/game_sa/TaskAttackSA.cpp @@ -17,11 +17,11 @@ CTaskSimpleGangDriveBySA::CTaskSimpleGangDriveBySA(CEntity* pTargetEntity, const CVector* pVecTarget, float fAbortRange, char FrequencyPercentage, char nDrivebyStyle, bool bSeatRHS) { - this->CreateTaskInterface(sizeof(CTaskSimpleGangDriveBySAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleGangDriveBySAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleGangDriveBy__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwTargetEntity = (pTargetEntity) ? (DWORD)pTargetEntity->GetInterface() : 0; _asm { @@ -38,11 +38,11 @@ CTaskSimpleGangDriveBySA::CTaskSimpleGangDriveBySA(CEntity* pTargetEntity, const CTaskSimpleUseGunSA::CTaskSimpleUseGunSA(CEntity* pTargetEntity, CVector vecTarget, char nCommand, short nBurstLength, unsigned char bAimImmediate) { - this->CreateTaskInterface(sizeof(CTaskSimpleUseGunSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleUseGunSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleUseGun__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwTargetEntity = (pTargetEntity) ? (DWORD)pTargetEntity->GetInterface() : 0; float fTargetX = vecTarget.fX, fTargetY = vecTarget.fY, fTargetZ = vecTarget.fZ; DWORD dwBurstLength = nBurstLength; @@ -64,7 +64,7 @@ bool CTaskSimpleUseGunSA::SetPedPosition(CPed* pPed) { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_SetPedPosition; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); BYTE* ptr = (BYTE*)dwThisInterface; ptr[0x0d] = 2; @@ -86,7 +86,7 @@ bool CTaskSimpleUseGunSA::SetPedPosition(CPed* pPed) void CTaskSimpleUseGunSA::FireGun(CPed* pPed, bool bFlag) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_FireGun; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -101,7 +101,7 @@ bool CTaskSimpleUseGunSA::ControlGun(CPed* pPed, CEntity* pTargetEntity, char nC { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_ControlGun; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); DWORD dwTargetEntity = (pTargetEntity) ? (DWORD)pTargetEntity->GetInterface() : 0; _asm @@ -120,7 +120,7 @@ bool CTaskSimpleUseGunSA::ControlGunMove(CVector2D* pMoveVec) { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_ControlGunMove; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -134,7 +134,7 @@ bool CTaskSimpleUseGunSA::ControlGunMove(CVector2D* pMoveVec) void CTaskSimpleUseGunSA::Reset(CPed* pPed, CEntity* pTargetEntity, CVector vecTarget, char nCommand, short nBurstLength) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_Reset; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); DWORD dwTargetEntity = (pTargetEntity) ? (DWORD)pTargetEntity->GetInterface() : 0; float fTargetX = vecTarget.fX, fTargetY = vecTarget.fY, fTargetZ = vecTarget.fZ; @@ -157,7 +157,7 @@ int CTaskSimpleUseGunSA::GetTaskType() { int iReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_GetTaskType; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -173,7 +173,7 @@ bool CTaskSimpleUseGunSA::MakeAbortable(CPed* pPed, int iPriority, CEvent const* { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_MakeAbortable; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -191,7 +191,7 @@ bool CTaskSimpleUseGunSA::ProcessPed(CPed* pPed) { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_ProcessPed; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -206,7 +206,7 @@ bool CTaskSimpleUseGunSA::ProcessPed(CPed* pPed) void CTaskSimpleUseGunSA::AbortIK(CPed* pPed) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_AbortIK; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -219,7 +219,7 @@ void CTaskSimpleUseGunSA::AbortIK(CPed* pPed) void CTaskSimpleUseGunSA::AimGun(CPed* pPed) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_AimGun; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -232,7 +232,7 @@ void CTaskSimpleUseGunSA::AimGun(CPed* pPed) void CTaskSimpleUseGunSA::ClearAnim(CPed* pPed) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_ClearAnim; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -246,7 +246,7 @@ signed char CTaskSimpleUseGunSA::GetCurrentCommand() { signed char bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_GetCurrentCommand; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -260,7 +260,7 @@ bool CTaskSimpleUseGunSA::GetDoneFiring() { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_GetDoneFiring; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -274,7 +274,7 @@ bool CTaskSimpleUseGunSA::GetIsFinished() { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_GetIsFinished; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -288,7 +288,7 @@ bool CTaskSimpleUseGunSA::IsLineOfSightBlocked() { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_IsLineOfSightBlocked; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -302,7 +302,7 @@ bool CTaskSimpleUseGunSA::GetIsFiring() { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_GetIsFiring; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -316,7 +316,7 @@ bool CTaskSimpleUseGunSA::GetIsReloading() { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_GetIsReloading; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -330,7 +330,7 @@ bool CTaskSimpleUseGunSA::GetSkipAim() { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_GetSkipAim; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -344,7 +344,7 @@ bool CTaskSimpleUseGunSA::PlayerPassiveControlGun() { bool bReturn; DWORD dwFunc = FUNC_CTaskSimpleUseGun_PlayerPassiveControlGun; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -357,7 +357,7 @@ bool CTaskSimpleUseGunSA::PlayerPassiveControlGun() void CTaskSimpleUseGunSA::RemoveStanceAnims(CPed* pPed, float f) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_RemoveStanceAnims; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -387,7 +387,7 @@ bool CTaskSimpleUseGunSA::RequirePistolWhip(CPed* pPed, CEntity* pTargetEntity) void CTaskSimpleUseGunSA::SetBurstLength(short a) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_SetBurstLength; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -399,7 +399,7 @@ void CTaskSimpleUseGunSA::SetBurstLength(short a) void CTaskSimpleUseGunSA::SetMoveAnim(CPed* pPed) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_SetMoveAnim; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -412,7 +412,7 @@ void CTaskSimpleUseGunSA::SetMoveAnim(CPed* pPed) void CTaskSimpleUseGunSA::StartAnim(class CPed* pPed) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_StartAnim; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetInterface(); _asm { @@ -425,7 +425,7 @@ void CTaskSimpleUseGunSA::StartAnim(class CPed* pPed) void CTaskSimpleUseGunSA::StartCountDown(unsigned char a, bool b) { DWORD dwFunc = FUNC_CTaskSimpleUseGun_StartCountDown; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -437,11 +437,11 @@ void CTaskSimpleUseGunSA::StartCountDown(unsigned char a, bool b) CTaskSimpleFightSA::CTaskSimpleFightSA(CEntity* pTargetEntity, int nCommand, unsigned int nIdlePeriod) { - this->CreateTaskInterface(sizeof(CTaskSimpleFightSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleFightSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleFight__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwTargetEntity = (pTargetEntity) ? (DWORD)pTargetEntity->GetInterface() : 0; _asm { diff --git a/Client/game_sa/TaskBasicSA.cpp b/Client/game_sa/TaskBasicSA.cpp index 27bb895c67..9ef743a9b8 100644 --- a/Client/game_sa/TaskBasicSA.cpp +++ b/Client/game_sa/TaskBasicSA.cpp @@ -15,11 +15,11 @@ CTaskComplexUseMobilePhoneSA::CTaskComplexUseMobilePhoneSA(const int iDuration) { - this->CreateTaskInterface(sizeof(CTaskComplexUseMobilePhoneSAInterface)); + CreateTaskInterface(sizeof(CTaskComplexUseMobilePhoneSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexUseMobilePhone__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -33,11 +33,11 @@ CTaskSimpleRunAnimSA::CTaskSimpleRunAnimSA(const AssocGroupId animGroup, const A const char* pTaskName, const bool bHoldLastFrame) { // TODO: Find out the real size - this->CreateTaskInterface(1024); + CreateTaskInterface(1024); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleRunAnim__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -57,11 +57,11 @@ CTaskSimpleRunNamedAnimSA::CTaskSimpleRunNamedAnimSA(const char* pAnimName, cons const bool bHoldLastFrame) { // TODO: Find out the real size - this->CreateTaskInterface(sizeof(CTaskSimpleRunNamedAnimSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleRunNamedAnimSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleRunNamedAnim__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -84,11 +84,11 @@ CTaskComplexDieSA::CTaskComplexDieSA(const eWeaponType eMeansOfDeath, const Asso const bool bFallToDeathOverRailing) { // TODO: Find out the real size - this->CreateTaskInterface(1024); + CreateTaskInterface(1024); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexDie__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -109,11 +109,11 @@ CTaskComplexDieSA::CTaskComplexDieSA(const eWeaponType eMeansOfDeath, const Asso CTaskSimpleStealthKillSA::CTaskSimpleStealthKillSA(bool bKiller, CPed* pPed, const AssocGroupId animGroup) { // TODO: Find out the real size - this->CreateTaskInterface(1024); + CreateTaskInterface(1024); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleStealthKill__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPed->GetPedInterface(); _asm @@ -128,11 +128,11 @@ CTaskSimpleStealthKillSA::CTaskSimpleStealthKillSA(bool bKiller, CPed* pPed, con CTaskSimpleDeadSA::CTaskSimpleDeadSA(unsigned int uiDeathTimeMS, bool bUnk2) { - this->CreateTaskInterface(sizeof(CTaskSimpleDeadSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleDeadSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleDead__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -145,11 +145,11 @@ CTaskSimpleDeadSA::CTaskSimpleDeadSA(unsigned int uiDeathTimeMS, bool bUnk2) CTaskSimpleBeHitSA::CTaskSimpleBeHitSA(CPed* pPedAttacker, ePedPieceTypes hitBodyPart, int hitBodySide, int weaponId) { - this->CreateTaskInterface(sizeof(CTaskSimpleBeHitSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleBeHitSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleBeHit__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwPedInterface = (DWORD)pPedAttacker->GetPedInterface(); _asm @@ -166,11 +166,11 @@ CTaskSimpleBeHitSA::CTaskSimpleBeHitSA(CPed* pPedAttacker, ePedPieceTypes hitBod CTaskComplexSunbatheSA::CTaskComplexSunbatheSA(CObject* pTowel, const bool bStartStanding) { // TODO: Find out the real size - this->CreateTaskInterface(1024); + CreateTaskInterface(1024); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexSunbathe__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwObjectInterface = 0; if (pTowel) dwObjectInterface = (DWORD)pTowel->GetObjectInterface(); @@ -186,7 +186,7 @@ CTaskComplexSunbatheSA::CTaskComplexSunbatheSA(CObject* pTowel, const bool bStar void CTaskComplexSunbatheSA::SetEndTime(DWORD dwTime) { - CTaskComplexSunbatheSAInterface* thisInterface = (CTaskComplexSunbatheSAInterface*)this->GetInterface(); + CTaskComplexSunbatheSAInterface* thisInterface = (CTaskComplexSunbatheSAInterface*)GetInterface(); thisInterface->m_BathingTimer.dwTimeEnd = dwTime; } @@ -195,11 +195,11 @@ void CTaskComplexSunbatheSA::SetEndTime(DWORD dwTime) //////////////////// CTaskSimplePlayerOnFootSA::CTaskSimplePlayerOnFootSA() { - this->CreateTaskInterface(sizeof(CTaskSimplePlayerOnFootSAInterface)); + CreateTaskInterface(sizeof(CTaskSimplePlayerOnFootSAInterface)); if (!IsValid()) return; DWORD dwFunc = (DWORD)FUNC_CTASKSimplePlayerOnFoot__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -213,11 +213,11 @@ CTaskSimplePlayerOnFootSA::CTaskSimplePlayerOnFootSA() //////////////////// CTaskComplexFacialSA::CTaskComplexFacialSA() { - this->CreateTaskInterface(sizeof(CTaskComplexFacialSAInterface)); + CreateTaskInterface(sizeof(CTaskComplexFacialSAInterface)); if (!IsValid()) return; DWORD dwFunc = (DWORD)FUNC_CTASKComplexFacial__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { diff --git a/Client/game_sa/TaskCarAccessoriesSA.cpp b/Client/game_sa/TaskCarAccessoriesSA.cpp index 9fda5604f4..0add7301ae 100644 --- a/Client/game_sa/TaskCarAccessoriesSA.cpp +++ b/Client/game_sa/TaskCarAccessoriesSA.cpp @@ -23,12 +23,12 @@ CTaskSimpleCarSetPedInAsDriverSA::CTaskSimpleCarSetPedInAsDriverSA(CVehicle* pTa if (pTargetVehicleSA) { - this->CreateTaskInterface(sizeof(CTaskSimpleCarSetPedInAsDriverSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleCarSetPedInAsDriverSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleCarSetPedInAsDriver__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -42,17 +42,17 @@ CTaskSimpleCarSetPedInAsDriverSA::CTaskSimpleCarSetPedInAsDriverSA(CVehicle* pTa void CTaskSimpleCarSetPedInAsDriverSA::SetIsWarpingPedIntoCar() { - ((CTaskSimpleCarSetPedInAsDriverSAInterface*)this->GetInterface())->m_bWarpingInToCar = true; + ((CTaskSimpleCarSetPedInAsDriverSAInterface*)GetInterface())->m_bWarpingInToCar = true; } void CTaskSimpleCarSetPedInAsDriverSA::SetDoorFlagsToClear(const unsigned char nDoorFlagsToClear) { - ((CTaskSimpleCarSetPedInAsDriverSAInterface*)this->GetInterface())->m_nDoorFlagsToClear = nDoorFlagsToClear; + ((CTaskSimpleCarSetPedInAsDriverSAInterface*)GetInterface())->m_nDoorFlagsToClear = nDoorFlagsToClear; } void CTaskSimpleCarSetPedInAsDriverSA::SetNumGettingInToClear(const unsigned char nNumGettingInToClear) { - ((CTaskSimpleCarSetPedInAsDriverSAInterface*)this->GetInterface())->m_nNumGettingInToClear = nNumGettingInToClear; + ((CTaskSimpleCarSetPedInAsDriverSAInterface*)GetInterface())->m_nNumGettingInToClear = nNumGettingInToClear; } // ############################################################################## @@ -66,12 +66,12 @@ CTaskSimpleCarSetPedInAsPassengerSA::CTaskSimpleCarSetPedInAsPassengerSA(CVehicl if (pTargetVehicleSA) { - this->CreateTaskInterface(sizeof(CTaskSimpleCarSetPedInAsPassengerSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleCarSetPedInAsPassengerSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleCarSetPedInAsPassenger__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -85,17 +85,17 @@ CTaskSimpleCarSetPedInAsPassengerSA::CTaskSimpleCarSetPedInAsPassengerSA(CVehicl void CTaskSimpleCarSetPedInAsPassengerSA::SetIsWarpingPedIntoCar() { - ((CTaskSimpleCarSetPedInAsPassengerSAInterface*)this->GetInterface())->m_bWarpingInToCar = true; + ((CTaskSimpleCarSetPedInAsPassengerSAInterface*)GetInterface())->m_bWarpingInToCar = true; } void CTaskSimpleCarSetPedInAsPassengerSA::SetDoorFlagsToClear(const unsigned char nDoorFlagsToClear) { - ((CTaskSimpleCarSetPedInAsPassengerSAInterface*)this->GetInterface())->m_nDoorFlagsToClear = nDoorFlagsToClear; + ((CTaskSimpleCarSetPedInAsPassengerSAInterface*)GetInterface())->m_nDoorFlagsToClear = nDoorFlagsToClear; } void CTaskSimpleCarSetPedInAsPassengerSA::SetNumGettingInToClear(const unsigned char nNumGettingInToClear) { - ((CTaskSimpleCarSetPedInAsPassengerSAInterface*)this->GetInterface())->m_nNumGettingInToClear = nNumGettingInToClear; + ((CTaskSimpleCarSetPedInAsPassengerSAInterface*)GetInterface())->m_nNumGettingInToClear = nNumGettingInToClear; } // ############################################################################## @@ -109,12 +109,12 @@ CTaskSimpleCarSetPedOutSA::CTaskSimpleCarSetPedOutSA(CVehicle* pTargetVehicle, i if (pTargetVehicleSA) { - this->CreateTaskInterface(sizeof(CTaskSimpleCarSetPedOutSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleCarSetPedOutSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleCarSetPedOut__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -130,23 +130,23 @@ CTaskSimpleCarSetPedOutSA::CTaskSimpleCarSetPedOutSA(CVehicle* pTargetVehicle, i void CTaskSimpleCarSetPedOutSA::SetIsWarpingPedOutOfCar() { - ((CTaskSimpleCarSetPedOutSAInterface*)this->GetInterface())->m_bWarpingOutOfCar = true; + ((CTaskSimpleCarSetPedOutSAInterface*)GetInterface())->m_bWarpingOutOfCar = true; } void CTaskSimpleCarSetPedOutSA::SetKnockedOffBike() { - ((CTaskSimpleCarSetPedOutSAInterface*)this->GetInterface())->m_bKnockedOffBike = true; - ((CTaskSimpleCarSetPedOutSAInterface*)this->GetInterface())->m_bSwitchOffEngine = false; + ((CTaskSimpleCarSetPedOutSAInterface*)GetInterface())->m_bKnockedOffBike = true; + ((CTaskSimpleCarSetPedOutSAInterface*)GetInterface())->m_bSwitchOffEngine = false; } void CTaskSimpleCarSetPedOutSA::SetDoorFlagsToClear(const unsigned char nDoorFlagsToClear) { - ((CTaskSimpleCarSetPedOutSAInterface*)this->GetInterface())->m_nDoorFlagsToClear = nDoorFlagsToClear; + ((CTaskSimpleCarSetPedOutSAInterface*)GetInterface())->m_nDoorFlagsToClear = nDoorFlagsToClear; } void CTaskSimpleCarSetPedOutSA::SetNumGettingInToClear(const unsigned char nNumGettingInToClear) { - ((CTaskSimpleCarSetPedOutSAInterface*)this->GetInterface())->m_nNumGettingInToClear = nNumGettingInToClear; + ((CTaskSimpleCarSetPedOutSAInterface*)GetInterface())->m_nNumGettingInToClear = nNumGettingInToClear; } void CTaskSimpleCarSetPedOutSA::PositionPedOutOfCollision(CPed* ped, CVehicle* vehicle, int nDoor) diff --git a/Client/game_sa/TaskCarSA.cpp b/Client/game_sa/TaskCarSA.cpp index 92df638569..dff13954b8 100644 --- a/Client/game_sa/TaskCarSA.cpp +++ b/Client/game_sa/TaskCarSA.cpp @@ -36,12 +36,12 @@ CTaskComplexEnterCarAsDriverSA::CTaskComplexEnterCarAsDriverSA(CVehicle* pTarget if (pTargetVehicleSA) { - this->CreateTaskInterface(sizeof(CTaskComplexEnterCarAsDriverSAInterface)); + CreateTaskInterface(sizeof(CTaskComplexEnterCarAsDriverSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexEnterCarAsDriver__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -64,12 +64,12 @@ CTaskComplexEnterCarAsPassengerSA::CTaskComplexEnterCarAsPassengerSA(CVehicle* p if (pTargetVehicleSA) { - this->CreateTaskInterface(sizeof(CTaskComplexEnterCarAsPassengerSAInterface)); + CreateTaskInterface(sizeof(CTaskComplexEnterCarAsPassengerSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexEnterCarAsPassenger__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -97,12 +97,12 @@ CTaskComplexEnterBoatAsDriverSA::CTaskComplexEnterBoatAsDriverSA(CVehicle* pTarg if (pTargetVehicleSA) { - this->CreateTaskInterface(sizeof(CTaskComplexEnterBoatAsDriverSAInterface)); + CreateTaskInterface(sizeof(CTaskComplexEnterBoatAsDriverSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexEnterBoatAsDriver__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -126,12 +126,12 @@ CTaskComplexLeaveCarSA::CTaskComplexLeaveCarSA(CVehicle* pTargetVehicle, const i if (pTargetVehicleSA) { - this->CreateTaskInterface(sizeof(CTaskComplexLeaveCarSAInterface)); + CreateTaskInterface(sizeof(CTaskComplexLeaveCarSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexLeaveCar__Constructor; DWORD dwVehiclePtr = (DWORD)pTargetVehicleSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwDoorIdx = 0; static int s_iCarNodeIndexes[6] = {0x10, 0x11, 0x0A, 0x08, 0x0B, 0x09}; diff --git a/Client/game_sa/TaskCarSA.h b/Client/game_sa/TaskCarSA.h index 88cd6ccaa3..015ff0ed2f 100644 --- a/Client/game_sa/TaskCarSA.h +++ b/Client/game_sa/TaskCarSA.h @@ -68,18 +68,18 @@ class CTaskComplexEnterCarSA : public virtual CTaskComplexSA int GetTargetDoor() { - CTaskComplexEnterCarSAInterface* thisInterface = (CTaskComplexEnterCarSAInterface*)this->GetInterface(); + CTaskComplexEnterCarSAInterface* thisInterface = (CTaskComplexEnterCarSAInterface*)GetInterface(); return thisInterface->m_iTargetDoor; } void SetTargetDoor(int iDoor) { - CTaskComplexEnterCarSAInterface* thisInterface = (CTaskComplexEnterCarSAInterface*)this->GetInterface(); + CTaskComplexEnterCarSAInterface* thisInterface = (CTaskComplexEnterCarSAInterface*)GetInterface(); thisInterface->m_iTargetDoor = iDoor; } int GetEnterCarStartTime() { - CTaskComplexEnterCarSAInterface* thisInterface = (CTaskComplexEnterCarSAInterface*)this->GetInterface(); + CTaskComplexEnterCarSAInterface* thisInterface = (CTaskComplexEnterCarSAInterface*)GetInterface(); return thisInterface->m_iEnterCarStartTime; } }; @@ -180,7 +180,7 @@ class CTaskComplexLeaveCarSA : public virtual CTaskComplexSA, public virtual CTa int GetTargetDoor() { - CTaskComplexLeaveCarSAInterface* thisInterface = (CTaskComplexLeaveCarSAInterface*)this->GetInterface(); + CTaskComplexLeaveCarSAInterface* thisInterface = (CTaskComplexLeaveCarSAInterface*)GetInterface(); return thisInterface->m_iTargetDoor; } }; diff --git a/Client/game_sa/TaskGoToSA.cpp b/Client/game_sa/TaskGoToSA.cpp index 756d727814..e3164cfdce 100644 --- a/Client/game_sa/TaskGoToSA.cpp +++ b/Client/game_sa/TaskGoToSA.cpp @@ -20,7 +20,7 @@ int CTaskComplexWanderSA::GetWanderType() { - CTaskSAInterface* pTaskInterface = this->GetInterface(); + CTaskSAInterface* pTaskInterface = GetInterface(); DWORD dwFunc = ((TaskComplexWanderVTBL*)pTaskInterface->VTBL)->GetWanderType; int iReturn = NO_WANDER_TYPE; @@ -38,12 +38,12 @@ int CTaskComplexWanderSA::GetWanderType() CNodeAddress* CTaskComplexWanderSA::GetNextNode() { - return &((CTaskComplexWanderSAInterface*)this->GetInterface())->m_NextNode; + return &((CTaskComplexWanderSAInterface*)GetInterface())->m_NextNode; } CNodeAddress* CTaskComplexWanderSA::GetLastNode() { - return &((CTaskComplexWanderSAInterface*)this->GetInterface())->m_LastNode; + return &((CTaskComplexWanderSAInterface*)GetInterface())->m_LastNode; } // ############################################################################## @@ -53,11 +53,11 @@ CNodeAddress* CTaskComplexWanderSA::GetLastNode() CTaskComplexWanderStandardSA::CTaskComplexWanderStandardSA(const int iMoveState, const unsigned char iDir, const bool bWanderSensibly) { - this->CreateTaskInterface(sizeof(CTaskComplexWanderStandardSAInterface)); + CreateTaskInterface(sizeof(CTaskComplexWanderStandardSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskComplexWanderStandard__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface diff --git a/Client/game_sa/TaskIKSA.cpp b/Client/game_sa/TaskIKSA.cpp index 39e8aa8eb0..07ebc25857 100644 --- a/Client/game_sa/TaskIKSA.cpp +++ b/Client/game_sa/TaskIKSA.cpp @@ -22,10 +22,10 @@ CTaskSimpleIKChainSA::CTaskSimpleIKChainSA(char* idString, int effectorBoneTag, { DWORD dwFunc = FUNC_CTaskSimpleIKChain__Constructor; // TODO: Find out the real size - this->CreateTaskInterface(1024); + CreateTaskInterface(1024); if (!IsValid()) return; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwEntityInterface = 0; if (pEntity) dwEntityInterface = (DWORD)pEntity->GetInterface(); @@ -57,10 +57,10 @@ CTaskSimpleIKLookAtSA::CTaskSimpleIKLookAtSA(char* idString, CEntity* pEntity, i { DWORD dwFunc = FUNC_CTaskSimpleIKLookAt__Constructor; // TODO: Find out the real size - this->CreateTaskInterface(1024); + CreateTaskInterface(1024); if (!IsValid()) return; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwEntityInterface = 0; if (pEntity) dwEntityInterface = (DWORD)pEntity->GetInterface(); @@ -85,12 +85,12 @@ CTaskSimpleIKLookAtSA::CTaskSimpleIKLookAtSA(char* idString, CEntity* pEntity, i CTaskSimpleIKManagerSA::CTaskSimpleIKManagerSA() { - this->m_pTaskManagementSystem = pGame->GetTaskManagementSystem(); + m_pTaskManagementSystem = pGame->GetTaskManagementSystem(); } int CTaskSimpleIKManagerSA::AddIKChainTask(CTaskSimpleIKChain* pIKChainTask, int slotID) { - CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)this->GetInterface(); + CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)GetInterface(); if (!pInterface->m_pIKChainTasks[slotID]) { pInterface->m_pIKChainTasks[slotID] = (CTaskSimpleIKChainSAInterface*)(pIKChainTask->GetInterface()); @@ -109,7 +109,7 @@ int CTaskSimpleIKManagerSA::AddIKChainTask(CTaskSimpleIKChain* pIKChainTask, int void CTaskSimpleIKManagerSA::RemoveIKChainTask(int slotID) { - CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)this->GetInterface(); + CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)GetInterface(); if (pInterface->m_pIKChainTasks[slotID]) { // Grab the task @@ -127,13 +127,13 @@ void CTaskSimpleIKManagerSA::BlendOut(int slotID, int blendOutTime) unsigned char CTaskSimpleIKManagerSA::IsSlotEmpty(int slotID) { - CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)this->GetInterface(); + CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)GetInterface(); return (!pInterface->m_pIKChainTasks[slotID]); } CTaskSimpleIKChain* CTaskSimpleIKManagerSA::GetTaskAtSlot(int slotID) { - CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)this->GetInterface(); + CTaskSimpleIKManagerSAInterface* pInterface = (CTaskSimpleIKManagerSAInterface*)GetInterface(); if (pInterface->m_pIKChainTasks[slotID]) { // Grab the task @@ -149,10 +149,10 @@ CTaskSimpleTriggerLookAtSA::CTaskSimpleTriggerLookAtSA(CEntity* pEntity, int tim { DWORD dwFunc = FUNC_CTaskSimpleTriggerLookAt__Constructor; // TODO: Find out the real size - this->CreateTaskInterface(1024); + CreateTaskInterface(1024); if (!IsValid()) return; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwEntityInterface = 0; if (pEntity) dwEntityInterface = (DWORD)pEntity->GetInterface(); diff --git a/Client/game_sa/TaskJumpFallSA.cpp b/Client/game_sa/TaskJumpFallSA.cpp index c40db29ae2..c731096af4 100644 --- a/Client/game_sa/TaskJumpFallSA.cpp +++ b/Client/game_sa/TaskJumpFallSA.cpp @@ -15,11 +15,11 @@ CTaskSimpleClimbSA::CTaskSimpleClimbSA(CEntity* pClimbEnt, const CVector& vecTarget, float fHeading, unsigned char nSurfaceType, char nHeight, const bool bForceClimb) { - this->CreateTaskInterface(sizeof(CTaskSimpleClimbSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleClimbSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleClimb__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { @@ -41,11 +41,11 @@ CTaskSimpleClimbSA::CTaskSimpleClimbSA(CEntity* pClimbEnt, const CVector& vecTar CTaskSimpleJetPackSA::CTaskSimpleJetPackSA(const CVector* pVecTargetPos, float fCruiseHeight, int nHoverTime) { - this->CreateTaskInterface(sizeof(CTaskSimpleJetPackSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleJetPackSAInterface)); if (!IsValid()) return; DWORD dwFunc = FUNC_CTaskSimpleJetPack__Constructor; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { diff --git a/Client/game_sa/TaskPhysicalResponseSA.cpp b/Client/game_sa/TaskPhysicalResponseSA.cpp index e81c38d3f7..44448c4b60 100644 --- a/Client/game_sa/TaskPhysicalResponseSA.cpp +++ b/Client/game_sa/TaskPhysicalResponseSA.cpp @@ -33,10 +33,10 @@ CTaskSimpleChokingSA::CTaskSimpleChokingSA(CPed* pAttacker, bool bIsTearGas) if (pAttackerSA) pAttackerInterface = pAttackerSA->GetPedInterface(); - this->CreateTaskInterface(sizeof(CTaskSimpleChokingSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleChokingSAInterface)); if (!IsValid()) return; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface @@ -50,32 +50,32 @@ CTaskSimpleChokingSA::CTaskSimpleChokingSA(CPed* pAttacker, bool bIsTearGas) CPed* CTaskSimpleChokingSA::GetAttacker() { - CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)this->GetInterface(); + CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)GetInterface(); SClientEntity* pPedClientEntity = pGame->GetPools()->GetPed((DWORD*)internalInterface->m_pAttacker); return pPedClientEntity ? pPedClientEntity->pEntity : nullptr; } unsigned int CTaskSimpleChokingSA::GetTimeRemaining() { - CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)this->GetInterface(); + CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)GetInterface(); return internalInterface->m_nTimeRemaining; } unsigned int CTaskSimpleChokingSA::GetTimeStarted() { - CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)this->GetInterface(); + CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)GetInterface(); return internalInterface->m_nTimeStarted; } bool CTaskSimpleChokingSA::IsTeargas() { - CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)this->GetInterface(); + CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)GetInterface(); return internalInterface->m_bIsTeargas ? true : false; } bool CTaskSimpleChokingSA::IsFinished() { - CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)this->GetInterface(); + CTaskSimpleChokingSAInterface* internalInterface = (CTaskSimpleChokingSAInterface*)GetInterface(); return internalInterface->m_bIsFinished; } @@ -97,7 +97,7 @@ void CTaskSimpleChokingSA::UpdateChoke(CPed* pPed, CPed* pAttacker, bool bIsTear } // Call the func - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); DWORD dwFunc = FUNC_CTaskSimpleChoking__UpdateChoke; _asm { diff --git a/Client/game_sa/TaskSA.cpp b/Client/game_sa/TaskSA.cpp index afc650b160..a39af6afc9 100644 --- a/Client/game_sa/TaskSA.cpp +++ b/Client/game_sa/TaskSA.cpp @@ -61,8 +61,8 @@ void CTaskSA::CreateTaskInterface(size_t nSize) CTask* CTaskSA::Clone() { - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = this->GetInterface()->VTBL->Clone; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = GetInterface()->VTBL->Clone; DWORD dwReturn = 0; _asm { @@ -77,16 +77,16 @@ void CTaskSA::SetParent(CTask* pParent) { UCTask unionTask; unionTask.pTask = pParent; - this->GetInterface()->m_pParent = unionTask.pTaskSA->GetInterface(); - this->Parent = unionTask.pTaskSA; + GetInterface()->m_pParent = unionTask.pTaskSA->GetInterface(); + Parent = unionTask.pTaskSA; } CTask* CTaskSA::GetSubTask() { static CTaskManagementSystemSA* s_pTaskManagementSystem = pGame->GetTaskManagementSystem(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = this->GetInterface()->VTBL->GetSubTask; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = GetInterface()->VTBL->GetSubTask; DWORD dwReturn = 0; _asm { @@ -99,8 +99,8 @@ CTask* CTaskSA::GetSubTask() bool CTaskSA::IsSimpleTask() { - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = this->GetInterface()->VTBL->IsSimpleTask; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = GetInterface()->VTBL->IsSimpleTask; bool bReturn = 0; _asm { @@ -113,7 +113,7 @@ bool CTaskSA::IsSimpleTask() int CTaskSA::GetTaskType() { - CTaskSAInterface* pTaskInterface = this->GetInterface(); + CTaskSAInterface* pTaskInterface = GetInterface(); DWORD dwFunc = pTaskInterface->VTBL->GetTaskType; int iReturn = 9999; @@ -135,8 +135,8 @@ int CTaskSA::GetTaskType() */ void CTaskSA::StopTimer(const CEvent* pEvent) { - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = this->GetInterface()->VTBL->StopTimer; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = GetInterface()->VTBL->StopTimer; if (dwFunc != 0x82263A && dwFunc) { _asm @@ -159,8 +159,8 @@ bool CTaskSA::MakeAbortable(CPed* pPed, const int iPriority, const CEvent* pEven return false; DWORD dwPedInterface = (DWORD)pPedSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = this->GetInterface()->VTBL->MakeAbortable; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = GetInterface()->VTBL->MakeAbortable; bool bReturn = 0; if (dwFunc != 0x82263A && dwFunc) // 82263A = purecall { @@ -196,8 +196,8 @@ void CTaskSA::Destroy() return; // our hook in CTaskManagementSystem will try to delete this otherwise m_bBeingDestroyed = true; - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = this->GetInterface()->VTBL->DeletingDestructor; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = GetInterface()->VTBL->DeletingDestructor; if (dwFunc) { _asm @@ -209,7 +209,7 @@ void CTaskSA::Destroy() } /*dwFunc = FUNC_CTask__Operator_Delete; - DWORD thisInterface = (DWORD)this->GetInterface(); + DWORD thisInterface = (DWORD)GetInterface(); if ( thisInterface ) { _asm @@ -255,8 +255,8 @@ bool CTaskSimpleSA::ProcessPed(CPed* pPed) return false; DWORD dwPedInterface = (DWORD)pPedSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = ((TaskSimpleVTBL*)this->GetInterface()->VTBL)->ProcessPed; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = ((TaskSimpleVTBL*)GetInterface()->VTBL)->ProcessPed; bool bReturn = 0; if (dwFunc != 0x82263A && dwFunc) { @@ -278,8 +278,8 @@ bool CTaskSimpleSA::SetPedPosition(CPed* pPed) return false; DWORD dwPedInterface = (DWORD)pPedSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = ((TaskSimpleVTBL*)this->GetInterface()->VTBL)->SetPedPosition; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = ((TaskSimpleVTBL*)GetInterface()->VTBL)->SetPedPosition; bool bReturn = 0; if (dwFunc != 0x82263A && dwFunc) { @@ -314,8 +314,8 @@ void CTaskComplexSA::SetSubTask(CTask* pSubTask) this->m_pSubTask = pSubTask;*/ DWORD dwTaskInterface = (DWORD)pSubTask->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = ((TaskComplexVTBL*)this->GetInterface()->VTBL)->SetSubTask; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = ((TaskComplexVTBL*)GetInterface()->VTBL)->SetSubTask; if (dwFunc != 0x82263A && dwFunc) { _asm @@ -334,8 +334,8 @@ CTask* CTaskComplexSA::CreateNextSubTask(CPed* pPed) return NULL; DWORD dwPedInterface = (DWORD)pPedSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = ((TaskComplexVTBL*)this->GetInterface()->VTBL)->CreateNextSubTask; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = ((TaskComplexVTBL*)GetInterface()->VTBL)->CreateNextSubTask; DWORD dwReturn = 0; if (dwFunc != 0x82263A && dwFunc) { @@ -357,8 +357,8 @@ CTask* CTaskComplexSA::CreateFirstSubTask(CPed* pPed) return NULL; DWORD dwPedInterface = (DWORD)pPedSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = ((TaskComplexVTBL*)this->GetInterface()->VTBL)->CreateFirstSubTask; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = ((TaskComplexVTBL*)GetInterface()->VTBL)->CreateFirstSubTask; DWORD dwReturn = 0; if (dwFunc != 0x82263A && dwFunc) { @@ -380,8 +380,8 @@ CTask* CTaskComplexSA::ControlSubTask(CPed* pPed) return NULL; DWORD dwPedInterface = (DWORD)pPedSA->GetInterface(); - DWORD dwThisInterface = (DWORD)this->GetInterface(); - DWORD dwFunc = ((TaskComplexVTBL*)this->GetInterface()->VTBL)->ControlSubTask; + DWORD dwThisInterface = (DWORD)GetInterface(); + DWORD dwFunc = ((TaskComplexVTBL*)GetInterface()->VTBL)->ControlSubTask; DWORD dwReturn = 0; if (dwFunc != 0x82263A && dwFunc) { diff --git a/Client/game_sa/TaskSA.h b/Client/game_sa/TaskSA.h index b3b403f8fa..1022b070b0 100644 --- a/Client/game_sa/TaskSA.h +++ b/Client/game_sa/TaskSA.h @@ -85,8 +85,8 @@ class CTaskSA : public virtual CTask // our function(s) void SetInterface(CTaskSAInterface* pInterface) { TaskInterface = pInterface; }; - CTaskSAInterface* GetInterface() { return this->TaskInterface; } - bool IsValid() { return this->GetInterface() != NULL; } + CTaskSAInterface* GetInterface() { return TaskInterface; } + bool IsValid() { return GetInterface() != NULL; } void CreateTaskInterface(size_t nSize); diff --git a/Client/game_sa/TaskSecondarySA.cpp b/Client/game_sa/TaskSecondarySA.cpp index 1b8c7c99dc..189e7ada7e 100644 --- a/Client/game_sa/TaskSecondarySA.cpp +++ b/Client/game_sa/TaskSecondarySA.cpp @@ -20,10 +20,10 @@ CTaskSimpleDuckSA::CTaskSimpleDuckSA(eDuckControlTypes nDuckControl, unsigned short nLengthOfDuck, short nUseShotsWhizzingEvents) { DWORD dwFunc = FUNC_CTaskSimpleDuck__Constructor; - this->CreateTaskInterface(sizeof(CTaskSimpleDuckSAInterface)); + CreateTaskInterface(sizeof(CTaskSimpleDuckSAInterface)); if (!IsValid()) return; - DWORD dwThisInterface = (DWORD)this->GetInterface(); + DWORD dwThisInterface = (DWORD)GetInterface(); _asm { mov ecx, dwThisInterface diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 41bf874ed6..440978529b 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -3578,7 +3578,7 @@ void CClientPed::_CreateModel() m_pLoadedModelInfo->ModelAddRef(BLOCKING, "CClientPed::_CreateModel"); // Create the new ped - m_pPlayerPed = dynamic_cast(g_pGame->GetPools()->AddPed(this, static_cast(m_ulModel))); + m_pPlayerPed = dynamic_cast(g_pGame->GetPools()->AddPed(this, m_ulModel)); if (m_pPlayerPed) { // Put our pointer in the stored data and update the remote data with the new model pointer diff --git a/Client/sdk/game/CAutomobile.h b/Client/sdk/game/CAutomobile.h index 0ed9b2fa8a..1c2b2451e2 100644 --- a/Client/sdk/game/CAutomobile.h +++ b/Client/sdk/game/CAutomobile.h @@ -21,13 +21,4 @@ class CAutomobile : public virtual CVehicle { public: virtual ~CAutomobile(){}; - - virtual bool BurstTyre(DWORD dwTyreID) = 0; - virtual bool BreakTowLink() = 0; - virtual bool IsComponentPresent(int iComponentID) = 0; - - virtual void SetTowLink(CVehicle* pVehicle, bool bRemoveAdd) = 0; - virtual CPhysical* SpawnFlyingComponent(int iCarNodeIndex, int iUnknown) = 0; - - virtual CDoor* GetDoor(eDoors doorID) = 0; }; diff --git a/Client/sdk/game/CHeli.h b/Client/sdk/game/CHeli.h new file mode 100644 index 0000000000..6bb0364854 --- /dev/null +++ b/Client/sdk/game/CHeli.h @@ -0,0 +1,19 @@ +/***************************************************************************** + * + * PROJECT: Multi Theft Auto + * LICENSE: See LICENSE in the top level directory + * FILE: sdk/game/CHeli.h + * + * Multi Theft Auto is available from http://www.multitheftauto.com/ + * + *****************************************************************************/ + +#pragma once + +#include "CAutomobile.h" + +class CHeli : public virtual CAutomobile +{ +public: + virtual ~CHeli(){}; +}; diff --git a/Client/sdk/game/CMonsterTruck.h b/Client/sdk/game/CMonsterTruck.h index 94d38d8918..8bafc4f913 100644 --- a/Client/sdk/game/CMonsterTruck.h +++ b/Client/sdk/game/CMonsterTruck.h @@ -11,8 +11,10 @@ #pragma once -#include "CVehicle.h" +#include "CAutomobile.h" -class CMonsterTruck : public CVehicle +class CMonsterTruck : public virtual CAutomobile { +public: + virtual ~CMonsterTruck(){}; }; diff --git a/Client/sdk/game/CPlane.h b/Client/sdk/game/CPlane.h index 73ea630482..44b147afc0 100644 --- a/Client/sdk/game/CPlane.h +++ b/Client/sdk/game/CPlane.h @@ -11,9 +11,9 @@ #pragma once -#include "CVehicle.h" +#include "CAutomobile.h" -class CPlane : public virtual CVehicle +class CPlane : public virtual CAutomobile { public: virtual ~CPlane(){}; diff --git a/Client/sdk/game/CPools.h b/Client/sdk/game/CPools.h index 1b475ebacd..4ad1fcd461 100644 --- a/Client/sdk/game/CPools.h +++ b/Client/sdk/game/CPools.h @@ -74,7 +74,7 @@ class CPools virtual unsigned long GetObjectCount() = 0; // Peds pool - virtual CPed* AddPed(class CClientPed* pClientPed, ePedModel ePedType) = 0; + virtual CPed* AddPed(class CClientPed* pClientPed, unsigned int nModelIndex) = 0; virtual CPed* AddPed(class CClientPed* pClientPed, DWORD* pGameInterface) = 0; virtual void RemovePed(CPed* pPed, bool bDelete = true) = 0; diff --git a/Client/sdk/game/CQuadBike.h b/Client/sdk/game/CQuadBike.h index 8fdd450869..41427914a9 100644 --- a/Client/sdk/game/CQuadBike.h +++ b/Client/sdk/game/CQuadBike.h @@ -11,9 +11,9 @@ #pragma once -#include "CVehicle.h" +#include "CAutomobile.h" -class CQuadBike : public virtual CVehicle +class CQuadBike : public virtual CAutomobile { public: virtual ~CQuadBike(){}; diff --git a/Client/sdk/game/CTrain.h b/Client/sdk/game/CTrain.h new file mode 100644 index 0000000000..142b56e5e2 --- /dev/null +++ b/Client/sdk/game/CTrain.h @@ -0,0 +1,19 @@ +/***************************************************************************** + * + * PROJECT: Multi Theft Auto + * LICENSE: See LICENSE in the top level directory + * FILE: sdk/game/CTrain.h + * + * Multi Theft Auto is available from http://www.multitheftauto.com/ + * + *****************************************************************************/ + +#pragma once + +#include "CVehicle.h" + +class CTrain : public virtual CVehicle +{ +public: + virtual ~CTrain(){}; +}; diff --git a/Client/sdk/game/CVehicle.h b/Client/sdk/game/CVehicle.h index cdedd949e2..06c72fa9af 100644 --- a/Client/sdk/game/CVehicle.h +++ b/Client/sdk/game/CVehicle.h @@ -57,19 +57,20 @@ enum eDoorLock : int32_t struct SSirenBeaconInfo { - CVector m_vecSirenPositions; - SharedUtil::SColor m_RGBBeaconColour; - DWORD m_dwMinSirenAlpha; + CVector m_vecSirenPositions; + SharedUtil::SColor m_RGBBeaconColour; + DWORD m_dwMinSirenAlpha{0}; }; + struct SSirenInfo { // Flags bool m_b360Flag; bool m_bDoLOSCheck; bool m_bUseRandomiser; - bool m_bSirenSilent; + bool m_bSirenSilent{false}; // End of flags - bool m_bOverrideSirens; + bool m_bOverrideSirens{false}; unsigned char m_ucSirenType; unsigned char m_ucSirenCount; unsigned char m_ucCurrentSirenID; diff --git a/Client/sdk/game/Common.h b/Client/sdk/game/Common.h index 811f9ae05e..cba37b7f91 100644 --- a/Client/sdk/game/Common.h +++ b/Client/sdk/game/Common.h @@ -729,137 +729,6 @@ enum VehModelFlags MF_IS_HATCHBACK = 0x80000000 // has window in boot that is pointing upwards (render order thing) }; -enum ePedModel -{ - GTAVC_PLAYER = 0, - GTAVC_COP_COP, - GTAVC_COP_SWAT, - GTAVC_COP_FBI, - GTAVC_COP_ARMY, - GTAVC_EMERGENCY_MEDIC, - GTAVC_FIREMAN_FIREMAN, - GTAVC_CIVMALE_MALE01, - GTAVC_CIVFEMALE_HFYST, - GTAVC_CIVFEMALE_HFOST, - GTAVC_CIVMALE_HMYST, - GTAVC_CIVMALE_HMOST, - GTAVC_CIVFEMALE_HFYRI, - GTAVC_CIVFEMALE_HFORI, - GTAVC_CIVMALE_HMYRI, - GTAVC_CIVMALE_HMORI, - GTAVC_CIVFEMALE_HFYBE, - GTAVC_CIVFEMALE_HFOBE, - GTAVC_CIVMALE_HMYBE, - GTAVC_CIVMALE_HMOBE, - GTAVC_CIVFEMALE_HFYBU, - GTAVC_CIVFEMALE_HFYMD, - GTAVC_CIVFEMALE_HFYCG, - GTAVC_PROSTITUTE_HFYPR, - GTAVC_CIVFEMALE_HFOTR, - GTAVC_CIVMALE_HMOTR, - GTAVC_CIVMALE_HMYAP, - GTAVC_CIVMALE_HMOCA, - GTAVC_CIVMALE_BMODK, - GTAVC_CRIMINAL_BMYCR, - GTAVC_CIVFEMALE_BFYST, - GTAVC_CIVFEMALE_BFOST, - GTAVC_CIVMALE_BMYST, - GTAVC_CIVMALE_BMOST, - GTAVC_CIVFEMALE_BFYRI, - GTAVC_CIVFEMALE_BFORI, - GTAVC_CIVMALE_BMYRI, - GTAVC_CIVFEMALE_BFYBE, - GTAVC_CIVMALE_BMYBE, - GTAVC_CIVFEMALE_BFOBE, - GTAVC_CIVMALE_BMOBE, - GTAVC_CIVMALE_BMYBU, - GTAVC_PROSTITUTE_BFYPR, - GTAVC_CIVFEMALE_BFOTR, - GTAVC_CIVMALE_BMOTR, - GTAVC_CIVMALE_BMYPI, - GTAVC_CIVMALE_BMYBB, - GTAVC_CRIMINAL_WMYCR, - GTAVC_CIVFEMALE_WFYST, - GTAVC_CIVFEMALE_WFOST, - GTAVC_CIVMALE_WMYST, - GTAVC_CIVMALE_WMOST, - GTAVC_CIVFEMALE_WFYRI, - GTAVC_CIVFEMALE_WFORI, - GTAVC_CIVMALE_WMYRI, - GTAVC_CIVMALE_WMORI, - GTAVC_CIVFEMALE_WFYBE, - GTAVC_CIVMALE_WMYBE, - GTAVC_CIVFEMALE_WFOBE, - GTAVC_CIVMALE_WMOBE, - GTAVC_CIVMALE_WMYCW, - GTAVC_CIVMALE_WMYGO, - GTAVC_CIVFEMALE_WFOGO, - GTAVC_CIVMALE_WMOGO, - GTAVC_CIVFEMALE_WFYLG, - GTAVC_CIVMALE_WMYLG, - GTAVC_CIVFEMALE_WFYBU, - GTAVC_CIVMALE_WMYBU, - GTAVC_CIVMALE_WMOBU, - GTAVC_PROSTITUTE_WFYPR, - GTAVC_CIVFEMALE_WFOTR, - GTAVC_CIVMALE_WMOTR, - GTAVC_CRIMINAL_WMYPI, - GTAVC_CIVMALE_WMOCA, - GTAVC_CIVFEMALE_WFYJG, - GTAVC_CIVMALE_WMYJG, - GTAVC_CIVFEMALE_WFYSK, - GTAVC_CIVMALE_WMYSK, - GTAVC_CIVFEMALE_WFYSH, - GTAVC_CIVFEMALE_WFOSH, - GTAVC_CIVFEMALE_JFOTO, - GTAVC_CIVMALE_JMOTO, - GTAVC_GANG1_CBA, - GTAVC_GANG1_CBB, - GTAVC_GANG2_HNA, - GTAVC_GANG2_HNB, - GTAVC_GANG3_SGA, - GTAVC_GANG3_SGB, - GTAVC_GANG4_CLA, - GTAVC_GANG4_CLB, - GTAVC_GANG5_GDA, - GTAVC_GANG5_GDB, - GTAVC_GANG6_BKA, - GTAVC_GANG6_BKB, - GTAVC_GANG7_PGA, - GTAVC_GANG7_PGB, - GTAVC_COP_VICE1, - GTAVC_COP_VICE2, - GTAVC_COP_VICE3, - GTAVC_COP_VICE4, - GTAVC_COP_VICE5, - GTAVC_COP_VICE6, - GTAVC_COP_VICE7, - GTAVC_COP_VICE8, - GTAVC_CIVFEMALE_WFYG1, - GTAVC_CIVFEMALE_WFYG2, - GTAVC_CIVMALE_SPECIAL01, - GTAVC_CIVMALE_SPECIAL02, - GTAVC_CIVMALE_SPECIAL03, - GTAVC_CIVMALE_SPECIAL04, - GTAVC_CIVMALE_SPECIAL05, - GTAVC_CIVMALE_SPECIAL06, - GTAVC_CIVMALE_SPECIAL07, - GTAVC_CIVMALE_SPECIAL08, - GTAVC_CIVMALE_SPECIAL09, - GTAVC_CIVMALE_SPECIAL10, - GTAVC_CIVMALE_SPECIAL11, - GTAVC_CIVMALE_SPECIAL12, - GTAVC_CIVMALE_SPECIAL13, - GTAVC_CIVMALE_SPECIAL14, - GTAVC_CIVMALE_SPECIAL15, - GTAVC_CIVMALE_SPECIAL16, - GTAVC_CIVMALE_SPECIAL17, - GTAVC_CIVMALE_SPECIAL18, - GTAVC_CIVMALE_SPECIAL19, - GTAVC_CIVMALE_SPECIAL20, - GTAVC_CIVMALE_SPECIAL21 -}; - /** * Use to refer to types of weather, most in CWeather */