From 31569d512c708161b6c2afdf8a6e4356a7db15aa Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 7 Jun 2020 09:10:09 +0300 Subject: font fix --- src/render/Font.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/render/Font.cpp b/src/render/Font.cpp index ef665fae..de7de81a 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -483,6 +483,8 @@ CFont::PrintString(float xstart, float ystart, wchar *s) xstart; #ifdef MORE_LANGUAGES PrintString(xleft, y, start, s, spaceWidth, xstart); +#else + PrintString(xleft, y, start, s, spaceWidth); #endif // reset things lineLength = 0.0f; -- cgit v1.2.3 From be2291e44cd898a86fc2d0f1da56305e1f4143b2 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 7 Jun 2020 15:07:36 +0300 Subject: fixed some arithmetic --- src/control/Script.cpp | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 94590087..d90f2a0b 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1552,11 +1552,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_MULT_INT_LVAR_BY_INT_VAR: + case COMMAND_MULT_INT_VAR_BY_INT_LVAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_MULT_INT_VAR_BY_INT_LVAR: + case COMMAND_MULT_INT_LVAR_BY_INT_VAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1568,11 +1568,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR: + case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR: + case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1584,11 +1584,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_DIV_INT_LVAR_BY_INT_VAR: + case COMMAND_DIV_INT_VAR_BY_INT_LVAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_DIV_INT_VAR_BY_INT_LVAR: + case COMMAND_DIV_INT_LVAR_BY_INT_VAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1600,11 +1600,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR: + case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR: + case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1630,11 +1630,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; +#ifdef FIX_BUGS + case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR: +#else case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; +#ifdef FIX_BUGS + case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR: +#else case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1660,11 +1668,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; +#ifdef FIX_BUGS // in SA it was fixed by reversing their order in enum + case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR: +#else case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; +#ifdef FIX_BUGS + case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR: +#else case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1678,13 +1694,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_SET_LVAR_INT_TO_VAR_INT: + case COMMAND_SET_VAR_INT_TO_LVAR_INT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_SET_VAR_INT_TO_LVAR_INT: + case COMMAND_SET_LVAR_INT_TO_VAR_INT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); @@ -1702,13 +1718,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT: + case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT: + case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); @@ -1726,13 +1742,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT: + case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT: + case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); @@ -1750,13 +1766,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT: + case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT: + case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); -- cgit v1.2.3 From af564d865c3883f11a5272be76f3a51863586a8d Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 8 Jun 2020 01:16:21 +0300 Subject: fixes --- src/control/CarCtrl.cpp | 12 +++++++----- src/control/Script.cpp | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index e8b3bfd9..5db674cd 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -984,13 +984,15 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f if (pVehicle->GetModelIndex() == MI_RCBANDIT){ if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit) pPed->SetEvasiveStep(pVehicle, 0); - }else if (dotVelocity > 0.3f){ - if (sideLength - 0.5f < sidewaysDistance) + } + else if (dotVelocity > 0.3f) { + if (sideLength + 0.1f < sidewaysDistance) pPed->SetEvasiveStep(pVehicle, 0); else pPed->SetEvasiveDive(pVehicle, 0); - }else{ - if (sideLength + 0.1f < sidewaysDistance) + } + else if (dotVelocity > 0.1f) { + if (sideLength - 0.5f < sidewaysDistance) pPed->SetEvasiveStep(pVehicle, 0); else pPed->SetEvasiveDive(pVehicle, 0); @@ -1019,7 +1021,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f CPlayerPed* pPlayerPed = (CPlayerPed*)pPed; if (pPlayerPed->IsPlayer() && dotDirection < frontSafe && pPlayerPed->IsPedInControl() && - pPlayerPed->m_fMoveSpeed < 0.1f && pPlayerPed->bIsLooking && + pPlayerPed->m_fMoveSpeed < 1.0f && !pPlayerPed->bIsLooking && CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) { pPlayerPed->AnnoyPlayerPed(false); pPlayerPed->SetLookFlag(pVehicle, true); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index d90f2a0b..da321a28 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2153,7 +2153,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; car->SetStatus(STATUS_PHYSICS); car->bEngineOn = true; - car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6); + car->AutoPilot.m_nCruiseSpeed = Max(6, car->AutoPilot.m_nCruiseSpeed); car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; } @@ -2165,7 +2165,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CCarCtrl::JoinCarWithRoadSystem(car); car->AutoPilot.m_nCarMission = MISSION_CRUISE; car->bEngineOn = true; - car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6); + car->AutoPilot.m_nCruiseSpeed = Max(6, car->AutoPilot.m_nCruiseSpeed); car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; } -- cgit v1.2.3 From be9954ecc6496fec4913c129310c89d83636346a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 8 Jun 2020 10:33:32 +0300 Subject: IsMissionAudioSamplePlaying (from VC) --- src/audio/AudioLogic.cpp | 2 +- src/audio/AudioManager.h | 4 ++-- src/audio/DMAudio.cpp | 2 +- src/audio/DMAudio.h | 2 +- src/audio/MusicManager.cpp | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index ec193bc8..58fd9ef3 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -8664,7 +8664,7 @@ cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const } void -cAudioManager::PreloadMissionAudio(const char *name) +cAudioManager::PreloadMissionAudio(Const char *name) { if (m_bIsInitialised) { int32 missionAudioSfx = FindMissionAudioSfx(name); diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index c58d0a39..190d9add 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -213,7 +213,7 @@ public: float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; } int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; } int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; } - bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; } + bool IsMissionAudioSamplePlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; } // "Should" be in alphabetic order, except "getXTalkSfx" void AddDetailsToRequestedOrderList(uint8 sample); @@ -358,7 +358,7 @@ public: void PostInitialiseGameSpecificSetup(); void PostTerminateGameSpecificShutdown(); void PreInitialiseGameSpecificSetup() const; - void PreloadMissionAudio(const char *name); + void PreloadMissionAudio(Const char *name); void PreTerminateGameSpecificShutdown(); /// processX - main logic of adding new sounds void ProcessActiveQueues(); diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 18d13c9d..76b134ec 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -290,7 +290,7 @@ cDMAudio::StopCutSceneMusic(void) } void -cDMAudio::PreloadMissionAudio(char *missionAudio) +cDMAudio::PreloadMissionAudio(Const char *missionAudio) { AudioManager.PreloadMissionAudio(missionAudio); } diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index e1a18830..c0e1de1d 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -76,7 +76,7 @@ public: void PlayPreloadedCutSceneMusic(void); void StopCutSceneMusic(void); - void PreloadMissionAudio(char *missionAudio); + void PreloadMissionAudio(Const char *missionAudio); uint8 GetMissionAudioLoadingStatus(void); void SetMissionAudioLocation(float x, float y, float z); void PlayLoadedMissionAudio(void); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index b8d6dc03..9f648d07 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -526,7 +526,7 @@ cMusicManager::ServiceGameMode() } else if (dist >= 100.0f) { int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f); int8 pan; - if (AudioManager.IsMissionAudioPlaying()) + if (AudioManager.IsMissionAudioSamplePlaying()) volume /= 4; if (volume != 0) { CVector trVec; @@ -538,7 +538,7 @@ cMusicManager::ServiceGameMode() if (gRetuneCounter) volume /= 4; SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0); - } else if (AudioManager.IsMissionAudioPlaying()) { + } else if (AudioManager.IsMissionAudioSamplePlaying()) { SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); } else if (gRetuneCounter) { SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); @@ -546,7 +546,7 @@ cMusicManager::ServiceGameMode() SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0); } } - } else if (AudioManager.IsMissionAudioPlaying()) { + } else if (AudioManager.IsMissionAudioSamplePlaying()) { SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); nFramesSinceCutsceneEnded = 0; } else { @@ -832,7 +832,7 @@ cMusicManager::ServiceAnnouncement() SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) { - SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0); m_bAnnouncementInProgress = true; m_nPreviousStreamedSound = m_nCurrentStreamedSound; m_nCurrentStreamedSound = m_nAnnouncement; @@ -905,7 +905,7 @@ cMusicManager::ChangeRadioChannel() return false; if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0)) return false; - SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0); } return true; } -- cgit v1.2.3