From d59862eb5e9b56fe5b9fb0b2332e07b5266dcd22 Mon Sep 17 00:00:00 2001 From: nrb Date: Sun, 24 May 2020 17:27:12 +0200 Subject: [PATCH 1/3] fixed compiler errors --- src/control/Script.cpp | 5 +++-- src/core/Streaming.cpp | 3 ++- src/core/Zones.cpp | 12 ++++++------ src/peds/CopPed.cpp | 2 +- src/peds/EmergencyPed.cpp | 16 ++++++++-------- src/peds/Ped.cpp | 10 +++++----- src/peds/{PedAttactor.cpp => PedAttractor.cpp} | 4 ++-- src/peds/PlayerPed.cpp | 2 +- src/render/Timecycle.cpp | 2 +- src/save/GenericGameStorage.h | 3 ++- src/weapons/ShotInfo.cpp | 2 +- src/weapons/Weapon.cpp | 4 ++-- src/weapons/WeaponInfo.cpp | 3 ++- src/weapons/WeaponInfo.h | 1 + 14 files changed, 37 insertions(+), 32 deletions(-) rename src/peds/{PedAttactor.cpp => PedAttractor.cpp} (99%) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index cf2545c0..cbaaf32e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -11,6 +11,7 @@ #include "CarAI.h" #include "CarCtrl.h" #include "CarGen.h" +#include "Ped.h" #include "CivilianPed.h" #include "Clock.h" #include "ColStore.h" @@ -7298,7 +7299,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) case COMMAND_WARP_CHAR_FROM_CAR_TO_COORD: { CollectParameters(&m_nIp, 4); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed *pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); assert(pPed); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) @@ -10655,7 +10656,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CCoronas::RegisterCorona((uint32)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8], 255, pos, *(float*)&ScriptParams[3], + CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8], 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f, false, 0.2f); return 0; } diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 0ce8b50e..985b28c9 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1449,7 +1449,8 @@ CStreaming::StreamVehiclesAndPeds(void) timeBeforeNextLoad--; else if(ms_numVehiclesLoaded <= desiredNumVehiclesLoaded){ CZoneInfo zone; - CTheZones::GetZoneInfoForTimeOfDay(&FindPlayerCoors(), &zone); + CVector coors = FindPlayerCoors(); + CTheZones::GetZoneInfoForTimeOfDay(&coors, &zone); int32 maxReq = -1; int32 mostRequestedRating = 0; for(i = 0; i < CCarCtrl::TOTAL_CUSTOM_CLASSES; i++){ diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 0e8606f3..84b5ca29 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -725,17 +725,17 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size) for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++){ NavigationZoneArray[i] = ReadSaveBuf(buffer); - NavigationZoneArray[i].child = GetPointerForZoneIndex((int32)NavigationZoneArray[i].child); - NavigationZoneArray[i].parent = GetPointerForZoneIndex((int32)NavigationZoneArray[i].parent); - NavigationZoneArray[i].next = GetPointerForZoneIndex((int32)NavigationZoneArray[i].next); + NavigationZoneArray[i].child = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].child); + NavigationZoneArray[i].parent = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].parent); + NavigationZoneArray[i].next = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].next); } for(i = 0; i < ARRAY_SIZE(InfoZoneArray); i++){ InfoZoneArray[i] = ReadSaveBuf(buffer); - InfoZoneArray[i].child = GetPointerForZoneIndex((int32)InfoZoneArray[i].child); - InfoZoneArray[i].parent = GetPointerForZoneIndex((int32)InfoZoneArray[i].parent); - InfoZoneArray[i].next = GetPointerForZoneIndex((int32)InfoZoneArray[i].next); + InfoZoneArray[i].child = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].child); + InfoZoneArray[i].parent = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].parent); + InfoZoneArray[i].next = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].next); } for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++) diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index c24be62f..35acd675 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -257,7 +257,7 @@ CCopPed::ArrestPlayer(void) CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f); CVector suspMidPos; - suspect->m_pedIK.GetComponentPosition((RwV3d)suspMidPos, PED_MID); + suspect->m_pedIK.GetComponentPosition(*(RwV3d*)&suspMidPos, PED_MID); m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y, GetPosition().x, GetPosition().y); diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp index 95811dab..1988366d 100644 --- a/src/peds/EmergencyPed.cpp +++ b/src/peds/EmergencyPed.cpp @@ -231,8 +231,8 @@ CEmergencyPed::MedicAI(void) if (nearestAccident) { m_pRevivedPed = nearestAccident->m_pVictim; m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed); - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID); - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD); SetSeek((headPos + midPos) * 0.5f, 1.0f); SetObjective(OBJECTIVE_NONE); bIsRunning = true; @@ -271,8 +271,8 @@ CEmergencyPed::MedicAI(void) m_nEmergencyPedState = EMERGENCY_PED_STOP; break; } - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID); - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD); SetSeek((headPos + midPos) * 0.5f, nearestAccident->m_nMedicsPerformingCPR * 0.5f + 1.0f); SetObjective(OBJECTIVE_NONE); bIsRunning = true; @@ -326,8 +326,8 @@ CEmergencyPed::MedicAI(void) if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f) m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE; else { - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID); - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD); midPos = (headPos + midPos) * 0.5f; m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints( midPos.x, midPos.y, @@ -348,8 +348,8 @@ CEmergencyPed::MedicAI(void) m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE; break; } - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID); - m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID); + m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD); midPos = (headPos + midPos) * 0.5f; m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints( midPos.x, midPos.y, diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 7eb2491b..8f6cc284 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -9713,7 +9713,7 @@ CPed::MoveHeadToLook(void) } if (m_pLookTarget->IsPed()) { - ((CPed*)m_pLookTarget)->m_pedIK.GetComponentPosition((RwV3d)lookPos, PED_MID); + ((CPed*)m_pLookTarget)->m_pedIK.GetComponentPosition(*(RwV3d *)&lookPos, PED_MID); } else { lookPos = m_pLookTarget->GetPosition(); } @@ -12804,7 +12804,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) } // --MIAMI: Done, but enumarate weapon slots -inline void +void CPed::ReplaceWeaponWhenExitingVehicle(void) { eWeaponType weaponType = GetWeapon()->m_eWeaponType; @@ -12821,7 +12821,7 @@ CPed::ReplaceWeaponWhenExitingVehicle(void) } // --MIAMI: Done -inline void +void CPed::RemoveWeaponWhenEnteringVehicle(void) { if (IsPlayer() && HasWeaponSlot(5) && GetWeapon(5).m_nAmmoTotal > 0 && ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed()->m_bDriveByAllowed) { @@ -13675,7 +13675,7 @@ CPed::ProcessObjective(void) CVector target; CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f); if (m_pedInObjective->IsPed()) - m_pedInObjective->m_pedIK.GetComponentPosition((RwV3d)target, PED_MID); + m_pedInObjective->m_pedIK.GetComponentPosition(*(RwV3d *)&target, PED_MID); else target = m_pedInObjective->GetPosition(); @@ -18682,4 +18682,4 @@ IsPedPointerValid(CPed* pPed) if (pPed->bInVehicle && pPed->m_pMyVehicle) return IsEntityPointerValid(pPed->m_pMyVehicle); return pPed->m_entryInfoList.first || pPed == FindPlayerPed(); -} \ No newline at end of file +} diff --git a/src/peds/PedAttactor.cpp b/src/peds/PedAttractor.cpp similarity index 99% rename from src/peds/PedAttactor.cpp rename to src/peds/PedAttractor.cpp index 782d2770..3d35b8a3 100644 --- a/src/peds/PedAttactor.cpp +++ b/src/peds/PedAttractor.cpp @@ -108,7 +108,7 @@ const C2dEffect* CPedAttractorManager::GetEffectForIceCreamVan(CVehicle* pVehicl CVehicle* CPedAttractorManager::GetIceCreamVanForEffect(C2dEffect* pEffect) { if (vVehicleToEffect.empty()) - return false; + return nil; for (std::vector::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend(); ++assoc) { if (assoc->HasThisEffect(pEffect)) return assoc->GetVehicle(); @@ -625,7 +625,7 @@ CPedAttractor* CPedAttractorManager::RegisterPed(CPed* pPed, C2dEffect* pEffect, ComputeEffectPos(pAttractor->GetEffect(), matrix, vEffectPos); if (pAttractor->GetEffect() == pEffect && vEffectPos == pAttractor->GetEffectPos()) { if (!IsApproachable(pEffect, matrix, pAttractor->ComputeFreeSlot(), pPed)) - return false; + return nil; pRegisteredAttractor = pAttractor; break; } diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 37a0b191..aafb80c7 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -1252,7 +1252,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) #else CVector markPos; if (m_pPointGunAt->IsPed()) { - ((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition((RwV3d)markPos, PED_MID); + ((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition(*(RwV3d *)&markPos, PED_MID); } else { markPos = m_pPointGunAt->GetPosition(); } diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp index c120c003..8846fdf0 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -175,7 +175,7 @@ CTimeCycle::Initialise(void) bi++; bi++; } - while(work_buff[bi] != '\n') + while(work_buff[bi] != '\n' || work_buff[bi] != '\0') line[li++] = work_buff[bi++]; line[li] = '\0'; bi++; diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h index b913c305..2d83385b 100644 --- a/src/save/GenericGameStorage.h +++ b/src/save/GenericGameStorage.h @@ -1,5 +1,6 @@ #pragma once +#include "Game.h" #include "PCSave.h" #define SLOT_COUNT (8) @@ -40,4 +41,4 @@ extern uint32 TimeToStayFadedBeforeFadeOut; extern char SaveFileNameJustSaved[260]; // 8F2570 -const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; \ No newline at end of file +const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; diff --git a/src/weapons/ShotInfo.cpp b/src/weapons/ShotInfo.cpp index f09ae052..6fc6341d 100644 --- a/src/weapons/ShotInfo.cpp +++ b/src/weapons/ShotInfo.cpp @@ -128,4 +128,4 @@ CShotInfo::Update() if (!((CTimer::GetFrameCounter() + slot) & 3)) CWorld::SetCarsOnFire(shot.m_startPos.x, shot.m_startPos.y, shot.m_startPos.z, 4.0f, shot.m_sourceEntity); } -} \ No newline at end of file +} diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index ebdeb38b..6908abab 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -817,7 +817,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt; if ( threatAttack->IsPed() ) { - threatAttack->m_pedIK.GetComponentPosition((RwV3d)target, PED_MID); + threatAttack->m_pedIK.GetComponentPosition(*(RwV3d *)&target, PED_MID); threatAttack->ReactToPointGun(shooter); } else @@ -1483,7 +1483,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) { CVector pos; if (shooterPed->m_pPointGunAt->IsPed()) { - ((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition((RwV3d)pos, PED_MID); + ((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition(*(RwV3d *)&pos, PED_MID); } else { pos = ((CPed*)shooterPed->m_pPointGunAt)->GetPosition(); } diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp index 104fa2ec..bd53d8c5 100644 --- a/src/weapons/WeaponInfo.cpp +++ b/src/weapons/WeaponInfo.cpp @@ -59,7 +59,8 @@ static char ms_aWeaponNames[][32] = { }; CWeaponInfo* -CWeaponInfo::GetWeaponInfo(eWeaponType weaponType) { +CWeaponInfo::GetWeaponInfo(eWeaponType weaponType) +{ return &CWeaponInfo::ms_apWeaponInfos[weaponType]; } diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h index 41450047..e7013004 100644 --- a/src/weapons/WeaponInfo.h +++ b/src/weapons/WeaponInfo.h @@ -1,5 +1,6 @@ #pragma once +#include "AnimManager.h" #include "AnimationId.h" #include "WeaponType.h" From 55ece14f423f65b09c8c3d8849a3eb8a7fd7d4c4 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Sun, 24 May 2020 17:36:37 +0200 Subject: [PATCH 2/3] Update CopPed.cpp --- src/peds/CopPed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index 35acd675..6fb858f6 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -257,7 +257,7 @@ CCopPed::ArrestPlayer(void) CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f); CVector suspMidPos; - suspect->m_pedIK.GetComponentPosition(*(RwV3d*)&suspMidPos, PED_MID); + suspect->m_pedIK.GetComponentPosition(*(RwV3d *)&suspMidPos, PED_MID); m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y, GetPosition().x, GetPosition().y); From 79c652e1152cecd228a7cef9e0f4b93d051a485d Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Sun, 24 May 2020 17:48:13 +0200 Subject: [PATCH 3/3] Ped.h include not needed --- src/control/Script.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index cbaaf32e..ee1b9fed 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -11,7 +11,6 @@ #include "CarAI.h" #include "CarCtrl.h" #include "CarGen.h" -#include "Ped.h" #include "CivilianPed.h" #include "Clock.h" #include "ColStore.h"