summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-07-04 14:24:54 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-07-04 14:24:54 +0200
commit62425b586631f95d67f2c9ba8c9a4f202e03bda4 (patch)
tree418a28a718cfe01cc0b8a224e0c1bab6a75de26a
parentMerge remote-tracking branch 'upstream/lcs' into lcs (diff)
parentMerge branch 'miami' into lcs (diff)
downloadre3-62425b586631f95d67f2c9ba8c9a4f202e03bda4.tar
re3-62425b586631f95d67f2c9ba8c9a4f202e03bda4.tar.gz
re3-62425b586631f95d67f2c9ba8c9a4f202e03bda4.tar.bz2
re3-62425b586631f95d67f2c9ba8c9a4f202e03bda4.tar.lz
re3-62425b586631f95d67f2c9ba8c9a4f202e03bda4.tar.xz
re3-62425b586631f95d67f2c9ba8c9a4f202e03bda4.tar.zst
re3-62425b586631f95d67f2c9ba8c9a4f202e03bda4.zip
-rw-r--r--.github/workflows/reLCS_msvc_amd64.yml2
-rw-r--r--.github/workflows/reLCS_msvc_x86.yml2
-rw-r--r--premake5.lua15
-rw-r--r--src/audio/AudioManager.cpp2
-rw-r--r--src/collision/ColStore.cpp2
-rw-r--r--src/control/GameLogic.cpp16
-rw-r--r--src/control/OnscreenTimer.cpp98
-rw-r--r--src/core/Crime.h2
-rw-r--r--src/core/MenuScreensCustom.cpp5
-rw-r--r--src/peds/CopPed.cpp3
-rw-r--r--src/peds/Ped.cpp53
-rw-r--r--src/peds/Ped.h2
-rw-r--r--src/peds/PedIK.cpp4
-rw-r--r--src/peds/PedIK.h2
-rw-r--r--src/save/GenericGameStorage.cpp5
-rw-r--r--src/save/SaveBuf.h36
-rw-r--r--src/skel/glfw/glfw.cpp2
-rw-r--r--src/skel/win/win.cpp4
18 files changed, 152 insertions, 103 deletions
diff --git a/.github/workflows/reLCS_msvc_amd64.yml b/.github/workflows/reLCS_msvc_amd64.yml
index 30e52a16..690c6316 100644
--- a/.github/workflows/reLCS_msvc_amd64.yml
+++ b/.github/workflows/reLCS_msvc_amd64.yml
@@ -34,7 +34,7 @@ jobs:
7z x ${{env.GLFW_FILE}}
- name: Configure build
run: |
- ./premake5 vs2019 --with-librw --glfwdir64=${{env.GLFW_BASE}}
+ ./premake5 vs2019 --with-librw --no-full-paths --glfwdir64=${{env.GLFW_BASE}}
- name: Build
run: |
msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
diff --git a/.github/workflows/reLCS_msvc_x86.yml b/.github/workflows/reLCS_msvc_x86.yml
index d34e47d5..9530f3ef 100644
--- a/.github/workflows/reLCS_msvc_x86.yml
+++ b/.github/workflows/reLCS_msvc_x86.yml
@@ -34,7 +34,7 @@ jobs:
7z x ${{env.GLFW_FILE}}
- name: Configure build
run: |
- ./premake5 vs2019 --with-librw --glfwdir32=${{env.GLFW_BASE}}
+ ./premake5 vs2019 --with-librw --no-full-paths --glfwdir32=${{env.GLFW_BASE}}
- name: Build
run: |
msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
diff --git a/premake5.lua b/premake5.lua
index 6667255c..0da1b8a4 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -28,13 +28,18 @@ newoption {
}
newoption {
+ trigger = "with-lto",
+ description = "Build with link time optimization"
+}
+
+newoption {
trigger = "no-git-hash",
description = "Don't print git commit hash into binary"
}
newoption {
- trigger = "lto",
- description = "Use link time optimization"
+ trigger = "no-full-paths",
+ description = "Don't print full paths into binary"
}
if(_OPTIONS["with-librw"]) then
@@ -121,7 +126,7 @@ workspace "reLCS"
filter "configurations:not Debug"
defines { "NDEBUG" }
optimize "Speed"
- if(_OPTIONS["lto"]) then
+ if(_OPTIONS["with-lto"]) then
flags { "LinkTimeOptimization" }
end
@@ -338,6 +343,10 @@ project "reLCS"
linkoptions "/SAFESEH:NO"
characterset ("MBCS")
targetextension ".exe"
+ if(_OPTIONS["no-full-paths"]) then
+ usefullpaths "off"
+ linkoptions "/PDBALTPATH:%_PDB%"
+ end
if(_OPTIONS["with-librw"]) then
-- external librw is dynamic
staticruntime "on"
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index c4f49e19..4ecdff25 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -1078,7 +1078,7 @@ void
cAudioManager::AdjustSamplesVolume()
{
for (int i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
- tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] + 1];
+ tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
if (!pSample->m_bIs2D)
pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance);
diff --git a/src/collision/ColStore.cpp b/src/collision/ColStore.cpp
index 90a29bc2..c50e6cbd 100644
--- a/src/collision/ColStore.cpp
+++ b/src/collision/ColStore.cpp
@@ -292,7 +292,7 @@ CColStore::LoadCollision(const CVector &pos, eLevelName level)
}else{
for (int j = 0; j < MAX_CLEANUP; j++) {
CPhysical* pEntity = nil;
- cleanup_entity_struct* pCleanup = &CTheScripts::MissionCleanUp.m_sEntities[i];
+ cleanup_entity_struct* pCleanup = &CTheScripts::MissionCleanUp.m_sEntities[j];
if (pCleanup->type == CLEANUP_CAR) {
pEntity = CPools::GetVehiclePool()->GetAt(pCleanup->id);
if (!pEntity || pEntity->GetStatus() == STATUS_WRECKED)
diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp
index 72e84897..595845c1 100644
--- a/src/control/GameLogic.cpp
+++ b/src/control/GameLogic.cpp
@@ -159,7 +159,7 @@ CGameLogic::Update()
#endif
CMessages::ClearMessages();
CCarCtrl::ClearInterestingVehicleList();
- CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
+ CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true);
CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
@@ -192,7 +192,7 @@ CGameLogic::Update()
}
- if (!CTheScripts::IsPlayerOnAMission() && pPlayerInfo.m_nBustedAudioStatus == 0) {
+ if (!CTheScripts::IsPlayerOnAMission() && pPlayerInfo.m_nBustedAudioStatus == BUSTEDAUDIO_NONE) {
if (CGeneral::GetRandomNumberInRange(0, 4) == 0)
pPlayerInfo.m_nBustedAudioStatus = BUSTEDAUDIO_DONE;
else {
@@ -268,7 +268,7 @@ CGameLogic::Update()
#endif
CMessages::ClearMessages();
CCarCtrl::ClearInterestingVehicleList();
- CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
+ CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true);
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
@@ -323,7 +323,7 @@ CGameLogic::Update()
#endif
CMessages::ClearMessages();
CCarCtrl::ClearInterestingVehicleList();
- CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
+ CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true);
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
@@ -380,10 +380,10 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector
pPlayerPed->m_fRotationDest = pPlayerPed->m_fRotationCur;
pPlayerPed->SetHeading(pPlayerPed->m_fRotationCur);
CTheScripts::ClearSpaceForMissionEntity(pos, pPlayerPed);
- CWorld::ClearExcitingStuffFromArea(pos, 4000.0, 1);
+ CWorld::ClearExcitingStuffFromArea(pos, 4000.0f, true);
pPlayerPed->RestoreHeadingRate();
CGame::currArea = AREA_MAIN_MAP;
- CStreaming::RemoveBuildingsNotInArea(0);
+ CStreaming::RemoveBuildingsNotInArea(AREA_MAIN_MAP);
TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString();
TheCamera.Restore();
CReferences::RemoveReferencesToPlayer();
@@ -490,7 +490,7 @@ CGameLogic::UpdateShortCut()
pShortCutTaxi->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
pShortCutTaxi->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2500;
TheCamera.SetFadeColour(0, 0, 0);
- TheCamera.Fade(2.5f, 0);
+ TheCamera.Fade(2.5f, FADE_OUT);
ShortCutState = SHORTCUT_TRANSITION;
ShortCutTimer = CTimer::GetTimeInMilliseconds() + 3000;
CMessages::AddBigMessage(TheText.Get("TAXI"), 4500, 1);
@@ -510,7 +510,7 @@ CGameLogic::UpdateShortCut()
pShortCutTaxi->SetMoveSpeed(pShortCutTaxi->GetForward() * 0.4f);
ShortCutTimer = CTimer::GetTimeInMilliseconds() + 1500;
TheCamera.SetFadeColour(0, 0, 0);
- TheCamera.Fade(1.0f, 1);
+ TheCamera.Fade(1.0f, FADE_IN);
ShortCutState = SHORTCUT_ARRIVING;
CTimer::Resume();
}
diff --git a/src/control/OnscreenTimer.cpp b/src/control/OnscreenTimer.cpp
index 53ed14c7..5045c1e0 100644
--- a/src/control/OnscreenTimer.cpp
+++ b/src/control/OnscreenTimer.cpp
@@ -9,14 +9,15 @@
#include "OnscreenTimer.h"
#include "Camera.h"
-void COnscreenTimer::Init() {
+void
+COnscreenTimer::Init()
+{
m_bDisabled = false;
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
m_sCounters[i].m_nCounterOffset = 0;
- for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) {
- m_sCounters[i].m_aCounterText[j] = 0;
- }
+ for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++)
+ m_sCounters[i].m_aCounterText[j] = '\0';
m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER;
m_sCounters[i].m_bCounterProcessed = false;
@@ -24,24 +25,25 @@ void COnscreenTimer::Init() {
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
m_sClocks[i].m_nClockOffset = 0;
- for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) {
- m_sClocks[i].m_aClockText[j] = 0;
- }
+ for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++)
+ m_sClocks[i].m_aClockText[j] = '\0';
m_sClocks[i].m_bClockProcessed = false;
m_sClocks[i].m_bClockGoingDown = true;
}
}
-void COnscreenTimer::Process() {
- if(!CReplay::IsPlayingBack() && !m_bDisabled) {
- for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
+void
+COnscreenTimer::Process()
+{
+ if(!CReplay::IsPlayingBack() && !m_bDisabled)
+ for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++)
m_sClocks[i].Process();
- }
- }
}
-void COnscreenTimer::ProcessForDisplay() {
+void
+COnscreenTimer::ProcessForDisplay()
+{
if(CHud::m_Wants_To_Draw_Hud) {
m_bProcessed = false;
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
@@ -63,67 +65,67 @@ void COnscreenTimer::ProcessForDisplay() {
}
}
-void COnscreenTimer::ClearCounter(uint32 offset) {
+void
+COnscreenTimer::ClearCounter(uint32 offset)
+{
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
if(offset == m_sCounters[i].m_nCounterOffset) {
m_sCounters[i].m_nCounterOffset = 0;
- m_sCounters[i].m_aCounterText[0] = 0;
+ m_sCounters[i].m_aCounterText[0] = '\0';
m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER;
- m_sCounters[i].m_bCounterProcessed = 0;
+ m_sCounters[i].m_bCounterProcessed = false;
}
}
}
-void COnscreenTimer::ClearClock(uint32 offset) {
- for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
+void
+COnscreenTimer::ClearClock(uint32 offset)
+{
+ for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++)
if(offset == m_sClocks[i].m_nClockOffset) {
m_sClocks[i].m_nClockOffset = 0;
- m_sClocks[i].m_aClockText[0] = 0;
- m_sClocks[i].m_bClockProcessed = 0;
+ m_sClocks[i].m_aClockText[0] = '\0';
+ m_sClocks[i].m_bClockProcessed = false;
m_sClocks[i].m_bClockGoingDown = true;
}
- }
}
-void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) {
-
+void
+COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos)
+{
if (m_sCounters[pos].m_aCounterText[0] != '\0')
return;
m_sCounters[pos].m_nCounterOffset = offset;
- if(text) {
+ if(text)
strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(m_sCounters[0].m_aCounterText));
- } else {
- m_sCounters[pos].m_aCounterText[0] = 0;
- }
+ else
+ m_sCounters[pos].m_aCounterText[0] = '\0';
m_sCounters[pos].m_nType = type;
}
-void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
-
- // dead code in here
- uint32 i;
- for(i = 0; i < NUMONSCREENCLOCKS; i++) {
+void
+COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown)
+{
+ for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
if(m_sClocks[i].m_nClockOffset == 0) {
+ m_sClocks[i].m_nClockOffset = offset;
+ m_sClocks[i].m_bClockGoingDown = bGoingDown;
+ if(text)
+ strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText));
+ else
+ m_sClocks[i].m_aClockText[0] = '\0';
break;
}
- return;
- }
-
- m_sClocks[i].m_nClockOffset = offset;
- m_sClocks[i].m_bClockGoingDown = bGoingDown;
- if(text) {
- strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText));
- } else {
- m_sClocks[i].m_aClockText[0] = 0;
}
}
-void COnscreenTimerEntry::Process() {
- if(m_nClockOffset == 0) {
+void
+COnscreenTimerEntry::Process()
+{
+ if(m_nClockOffset == 0)
return;
- }
int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nClockOffset);
int32 oldTime = *timerPtr;
@@ -147,13 +149,17 @@ void COnscreenTimerEntry::Process() {
*timerPtr = oldTime + int32(CTimer::GetTimeStepInMilliseconds());
}
-void COnscreenTimerEntry::ProcessForDisplayClock() {
+void
+COnscreenTimerEntry::ProcessForDisplayClock()
+{
uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nClockOffset);
sprintf(m_aClockBuffer, "%02d:%02d", time / 1000 / 60 % 100,
time / 1000 % 60);
}
-void COnscreenCounterEntry::ProcessForDisplayCounter() {
+void
+COnscreenCounterEntry::ProcessForDisplayCounter()
+{
uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset);
sprintf(m_aCounterBuffer, "%d", counter);
}
diff --git a/src/core/Crime.h b/src/core/Crime.h
index 3c3e2b26..4c7ea315 100644
--- a/src/core/Crime.h
+++ b/src/core/Crime.h
@@ -28,7 +28,7 @@ class CCrimeBeingQd
{
public:
eCrimeType m_nType;
- uint32 m_nId;
+ int32 m_nId;
uint32 m_nTime;
CVector m_vecPosn;
bool m_bReported;
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index 0534e34a..49bb33f8 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -26,6 +26,7 @@
#include "ModelInfo.h"
#include "Pad.h"
#include "ControllerConfig.h"
+#include "DMAudio.h"
// Menu screens array is at the bottom of the file.
@@ -194,6 +195,8 @@ void MultiSamplingButtonPress(int8 action) {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nPrefsMSAALevel = FrontEndMenuManager.m_nDisplayMSAALevel;
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode);
+ DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
+ DMAudio.Service();
FrontEndMenuManager.SetHelperText(0);
FrontEndMenuManager.SaveSettings();
}
@@ -255,6 +258,8 @@ const char* screenModes[] = { "FED_FLS", "FED_WND" };
void ScreenModeAfterChange(int8 before, int8 after)
{
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
+ DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
+ DMAudio.Service();
FrontEndMenuManager.SetHelperText(0);
}
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index fbfa7249..1efd7733 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -644,9 +644,6 @@ CCopPed::ProcessControl(void)
int numCopsNear = 0;
for (int i = 0; i < player->m_numNearPeds; ++i) {
CPed *nearPed = player->m_nearPeds[i];
-#ifdef FIX_BUGS
- if (nearPed)
-#endif
if (nearPed->m_nPedType == PEDTYPE_COP && nearPed->m_nPedState != PED_DEAD)
++numCopsNear;
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 1a8c4e35..4f695e3a 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -403,6 +403,30 @@ CPed::~CPed(void)
CPopulation::NumMiamiViceCops--;
CPopulation::UpdatePedCount((ePedType)m_nPedType, true);
DMAudio.DestroyEntity(m_audioEntityId);
+
+ // Because of the nature of ped lists in GTA, it can sometimes be outdated.
+ // Remove ourself from nearPeds list of the Peds in our nearPeds list.
+#ifdef FIX_BUGS
+ for(int i = 0; i < m_numNearPeds; i++) {
+ CPed *nearPed = m_nearPeds[i];
+ assert(nearPed != nil);
+ if (!nearPed->IsPointerValid())
+ continue;
+
+ for(int j = 0; j < nearPed->m_numNearPeds;) {
+ assert(j == ARRAY_SIZE(m_nearPeds) - 1 || nearPed->m_nearPeds[j] || !nearPed->m_nearPeds[j+1]); // ensure nil comes after nil
+
+ if (nearPed->m_nearPeds[j] == this) {
+ for (int k = j; k < ARRAY_SIZE(m_nearPeds) - 1; k++) {
+ nearPed->m_nearPeds[k] = nearPed->m_nearPeds[k + 1];
+ nearPed->m_nearPeds[k + 1] = nil;
+ }
+ nearPed->m_numNearPeds--;
+ } else
+ j++;
+ }
+ }
+#endif
}
void
@@ -519,13 +543,15 @@ CPed::BuildPedLists(void)
removePed = true;
}
}
+
+ assert(i == ARRAY_SIZE(m_nearPeds) - 1 || m_nearPeds[i] || !m_nearPeds[i+1]); // ensure nil comes after nil
+
if (removePed) {
// If we arrive here, the ped we're checking isn't "near", so we should remove it.
for (int j = i; j < ARRAY_SIZE(m_nearPeds) - 1; j++) {
m_nearPeds[j] = m_nearPeds[j + 1];
m_nearPeds[j + 1] = nil;
}
- // Above loop won't work on last slot, so we need to empty it.
m_nearPeds[ARRAY_SIZE(m_nearPeds) - 1] = nil;
m_numNearPeds--;
} else
@@ -2861,7 +2887,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
CColModel *hisCol = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex())->GetColModel();
if (!bUsesCollision && !bJustCheckCollision)
- return false;
+ return 0;
if (collidingEnt->IsVehicle() && ((CVehicle*)collidingEnt)->IsBoat())
collidedWithBoat = true;
@@ -6749,7 +6775,7 @@ CPed::FollowPath(void)
}
void
-CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
+CPed::SetEvasiveStep(CPhysical *reason, uint8 animType)
{
AnimationId stepAnim;
@@ -6767,22 +6793,23 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
if (neededTurn > PI)
neededTurn = TWOPI - neededTurn;
- CVehicle *veh = (CVehicle*)reason;
- if (reason->IsVehicle() && veh->IsCar()) {
+ if (reason->IsVehicle() && ((CVehicle*)reason)->IsCar()) {
+ CVehicle *veh = (CVehicle*)reason;
if (veh->m_nCarHornTimer != 0) {
vehPressedHorn = true;
if (!IsPlayer())
animType = 1;
}
}
- if (neededTurn <= DEGTORAD(90.0f) || veh->GetModelIndex() == MI_RCBANDIT || vehPressedHorn || animType != 0) {
- SetLookFlag(veh, true);
- if ((CGeneral::GetRandomNumber() & 1) && veh->GetModelIndex() != MI_RCBANDIT && animType == 0) {
+
+ if (neededTurn <= DEGTORAD(90.0f) || reason->GetModelIndex() == MI_RCBANDIT || vehPressedHorn || animType != 0) {
+ SetLookFlag(reason, true);
+ if ((CGeneral::GetRandomNumber() & 1) && reason->GetModelIndex() != MI_RCBANDIT && animType == 0) {
stepAnim = ANIM_STD_HAILTAXI;
} else {
- float vehDirection = CGeneral::GetRadianAngleBetweenPoints(
- veh->m_vecMoveSpeed.x, veh->m_vecMoveSpeed.y,
+ float dangerDirection = CGeneral::GetRadianAngleBetweenPoints(
+ reason->m_vecMoveSpeed.x, reason->m_vecMoveSpeed.y,
0.0f, 0.0f);
// Let's turn our back to the "reason"
@@ -6792,14 +6819,14 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
angleToFace -= TWOPI;
// We don't want to run towards car's direction
- float dangerZone = angleToFace - vehDirection;
+ float dangerZone = angleToFace - dangerDirection;
dangerZone = CGeneral::LimitRadianAngle(dangerZone);
// So, add or subtract 90deg (jump to left/right) according to that
if (dangerZone > 0.0f)
- angleToFace = vehDirection - HALFPI;
+ angleToFace = dangerDirection - HALFPI;
else
- angleToFace = vehDirection + HALFPI;
+ angleToFace = dangerDirection + HALFPI;
stepAnim = ANIM_STD_NUM;
if (animType == 0 || animType == 1)
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 107ad1a2..bed1e2e1 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -871,7 +871,7 @@ public:
void SetAimFlag(CEntity* to);
void SetAimFlag(float angle);
void SetAmmo(eWeaponType weaponType, uint32 ammo);
- void SetEvasiveStep(CEntity*, uint8);
+ void SetEvasiveStep(CPhysical*, uint8);
void GrantAmmo(eWeaponType, uint32);
void SetEvasiveDive(CPhysical*, uint8);
void SetAttack(CEntity*);
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp
index 6730d731..cf2e4ed5 100644
--- a/src/peds/PedIK.cpp
+++ b/src/peds/PedIK.cpp
@@ -17,9 +17,9 @@ const RwV3d XaxisIK = { 1.0f, 0.0f, 0.0f};
const RwV3d YaxisIK = { 0.0f, 1.0f, 0.0f};
const RwV3d ZaxisIK = { 0.0f, 0.0f, 1.0f};
-CPedIK::CPedIK(CPed *ped)
+CPedIK::CPedIK(CPed *ped) : m_ped(ped)
{
- m_ped = ped;
+ assert(ped != nil);
m_flags = 0;
m_headOrient.yaw = 0.0f;
m_headOrient.pitch = 0.0f;
diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h
index ee719fea..8be04365 100644
--- a/src/peds/PedIK.h
+++ b/src/peds/PedIK.h
@@ -34,7 +34,7 @@ public:
AIMS_WITH_ARM = 4,
};
- CPed *m_ped;
+ CPed *Const m_ped;
LimbOrientation m_headOrient;
LimbOrientation m_torsoOrient;
LimbOrientation m_upperArmOrient;
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index cbd4e2a4..7921b22a 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -251,6 +251,11 @@ GenericSave(int file)
WriteSaveDataBlock(CStreaming::MemoryCardSave, "StreamingSize");
WriteSaveDataBlock(CPedType::Save, "PedTypeSize");
+ // sure just write garbage data repeatedly ...
+#ifndef THIS_IS_STUPID
+ memset(work_buff, 0, sizeof(work_buff));
+#endif
+
// Write padding
for (int i = 0; i < 4; i++) {
size = align4bytes(SIZE_OF_ONE_GAME_IN_BYTES - totalSize - 4);
diff --git a/src/save/SaveBuf.h b/src/save/SaveBuf.h
index de27017e..6e9b3ae9 100644
--- a/src/save/SaveBuf.h
+++ b/src/save/SaveBuf.h
@@ -83,29 +83,29 @@ WriteSaveBuf(uint8 *&buf, uint32 &length, const T &value)
#ifdef VALIDATE_SAVE_SIZE
#define CheckSaveHeader(buf, a, b, c, d, size) do { \
- char _C; uint32 _size;\
- ReadSaveBuf(&_C, buf);\
- assert(_C == a);\
- ReadSaveBuf(&_C, buf);\
- assert(_C == b);\
- ReadSaveBuf(&_C, buf);\
- assert(_C == c);\
- ReadSaveBuf(&_C, buf);\
- assert(_C == d);\
+ char _c; uint32 _size;\
+ ReadSaveBuf(&_c, buf);\
+ assert(_c == a);\
+ ReadSaveBuf(&_c, buf);\
+ assert(_c == b);\
+ ReadSaveBuf(&_c, buf);\
+ assert(_c == c);\
+ ReadSaveBuf(&_c, buf);\
+ assert(_c == d);\
ReadSaveBuf(&_size, buf);\
assert(_size == size);\
} while(0)
#define CheckSaveHeaderWithLength(buf,len,a,b,c,d,size) do { \
- char _C; uint32 _size;\
- ReadSaveBuf(&_C, buf, len);\
- assert(_C == a);\
- ReadSaveBuf(&_C, buf, len);\
- assert(_C == b);\
- ReadSaveBuf(&_C, buf, len);\
- assert(_C == c);\
- ReadSaveBuf(&_C, buf, len);\
- assert(_C == d);\
+ char _c; uint32 _size;\
+ ReadSaveBuf(&_c, buf, len);\
+ assert(_c == a);\
+ ReadSaveBuf(&_c, buf, len);\
+ assert(_c == b);\
+ ReadSaveBuf(&_c, buf, len);\
+ assert(_c == c);\
+ ReadSaveBuf(&_c, buf, len);\
+ assert(_c == d);\
ReadSaveBuf(&_size, buf, len);\
assert(_size == size);\
} while(0)
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index af3a46b1..a30d0daa 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -919,7 +919,7 @@ void _InputInitialiseJoys()
free(db);
fclose(f);
} else
- printf("You don't seem to have copied " SDL_GAMEPAD_DB_PATH " file from re3/gamefiles to GTA3 directory. Some gamepads may not be recognized.\n");
+ printf("You don't seem to have copied " SDL_GAMEPAD_DB_PATH " file from reVC/gamefiles to GTA: Vice City directory. Some gamepads may not be recognized.\n");
#undef SDL_GAMEPAD_DB_PATH
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index 9597e9c2..268d6771 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -1498,7 +1498,7 @@ psSelectDevice()
#ifdef DEFAULT_NATIVE_RESOLUTION
GcurSelVM = 1;
#else
- MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK);
+ MessageBox(nil, "Cannot find 640x480 video mode", "GTA: Vice City", MB_OK);
return FALSE;
#endif
}
@@ -1541,7 +1541,7 @@ psSelectDevice()
}
if(bestFsMode < 0){
- MessageBox(nil, "Cannot find desired video mode", "GTA3", MB_OK);
+ MessageBox(nil, "Cannot find desired video mode", "GTA: Vice City", MB_OK);
return FALSE;
}
GcurSelVM = bestFsMode;