From f403a63a5cc2262dc2a10f4963140aceff15e681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 14 Aug 2020 18:54:01 +0300 Subject: [PATCH] Wheelie opcode --- src/control/Script.cpp | 20 +++++++++++++------- src/core/PlayerInfo.cpp | 36 ++++++++++++++++++------------------ src/core/PlayerInfo.h | 12 ++++++------ 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 69b8ee4f..0c3d269c 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -12725,14 +12725,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_GET_WHEELIE_STATS: { CollectParameters(&m_nIp, 1); - static bool bShowed = false; - if (!bShowed) { - debug("GET_WHEELIE_STATS not implemented\n"); - bShowed = true; - } - for (int i = 0; i < 6; i++) - ScriptParams[i] = 0; + CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; + ScriptParams[0] = pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels; + ScriptParams[1] = pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels; + ScriptParams[2] = pPlayerInfo->m_nLastTimeSpentOnWheelie; + ScriptParams[3] = pPlayerInfo->m_nLastDistanceTravelledOnWheelie; + ScriptParams[4] = pPlayerInfo->m_nLastTimeSpentOnStoppie; + ScriptParams[5] = pPlayerInfo->m_nLastDistanceTravelledOnStoppie; StoreParameters(&m_nIp, 6); + pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels = 0; + pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels = 0; + pPlayerInfo->m_nLastTimeSpentOnWheelie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnWheelie = 0; + pPlayerInfo->m_nLastTimeSpentOnStoppie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnStoppie = 0; return 0; } //case COMMAND_DISARM_CHAR: diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index f5f6a684..256bc1b7 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -160,12 +160,12 @@ CPlayerInfo::Clear(void) m_nTimeSpentOnStoppie = 0; m_nDistanceTravelledOnStoppie = 0.0f; m_nCancelWheelStuntTimer = 0; - m_nPrevTimeCarSpentOnTwoWheels = 0; - m_nPrevDistanceCarTravelledOnTwoWheels = 0; - m_nPrevTimeSpentOnWheelie = 0; - m_nPrevDistanceTravelledOnWheelie = 0; - m_nPrevTimeSpentOnStoppie = 0; - m_nPrevDistanceTravelledOnStoppie = 0; + m_nLastTimeCarSpentOnTwoWheels = 0; + m_nLastDistanceCarTravelledOnTwoWheels = 0; + m_nLastTimeSpentOnWheelie = 0; + m_nLastDistanceTravelledOnWheelie = 0; + m_nLastTimeSpentOnStoppie = 0; + m_nLastDistanceTravelledOnStoppie = 0; m_bInfiniteSprint = false; m_bFastReload = false; m_bFireproof = false; @@ -415,8 +415,8 @@ CPlayerInfo::Process(void) m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds(); } else { if (m_nTimeCarSpentOnTwoWheels >= 2000) { - m_nPrevTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; - m_nPrevDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; + m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; + m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000) CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000; if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels) @@ -443,8 +443,8 @@ CPlayerInfo::Process(void) } else { if (m_nTimeCarSpentOnTwoWheels >= 2000) { - m_nPrevTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; - m_nPrevDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; + m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; + m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000) CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000; if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels) @@ -456,8 +456,8 @@ CPlayerInfo::Process(void) } } else if (m_nTimeCarSpentOnTwoWheels != 0) { if (m_nTimeCarSpentOnTwoWheels >= 2000) { - m_nPrevTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; - m_nPrevDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; + m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; + m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000) CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000; if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels) @@ -483,8 +483,8 @@ CPlayerInfo::Process(void) m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds(); } else { if (m_nTimeSpentOnWheelie >= 5000) { - m_nPrevTimeSpentOnWheelie = m_nTimeSpentOnWheelie; - m_nPrevDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie; + m_nLastTimeSpentOnWheelie = m_nTimeSpentOnWheelie; + m_nLastDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie; if (CStats::LongestWheelie < m_nTimeSpentOnWheelie / 1000) CStats::LongestWheelie = m_nTimeSpentOnWheelie / 1000; if (CStats::LongestWheelieDist < m_nDistanceTravelledOnWheelie) @@ -497,8 +497,8 @@ CPlayerInfo::Process(void) } } else if (m_nTimeSpentOnWheelie != 0) { if (m_nTimeSpentOnWheelie >= 5000) { - m_nPrevTimeSpentOnWheelie = m_nTimeSpentOnWheelie; - m_nPrevDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie; + m_nLastTimeSpentOnWheelie = m_nTimeSpentOnWheelie; + m_nLastDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie; if (CStats::LongestWheelie < m_nTimeSpentOnWheelie / 1000) CStats::LongestWheelie = m_nTimeSpentOnWheelie / 1000; if (CStats::LongestWheelieDist < m_nDistanceTravelledOnWheelie) @@ -519,8 +519,8 @@ CPlayerInfo::Process(void) m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds(); } else { if (m_nTimeSpentOnStoppie >= 2000) { - m_nPrevTimeSpentOnStoppie = m_nTimeSpentOnStoppie; - m_nPrevDistanceTravelledOnStoppie = m_nDistanceTravelledOnStoppie; + m_nLastTimeSpentOnStoppie = m_nTimeSpentOnStoppie; + m_nLastDistanceTravelledOnStoppie = m_nDistanceTravelledOnStoppie; if (CStats::LongestStoppie < m_nTimeSpentOnStoppie / 1000) CStats::LongestStoppie = m_nTimeSpentOnStoppie / 1000; if (CStats::LongestStoppieDist < m_nDistanceTravelledOnStoppie) diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index 1a8df47c..7d99a4e0 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -61,12 +61,12 @@ public: int32 m_nTimeSpentOnStoppie; float m_nDistanceTravelledOnStoppie; int32 m_nCancelWheelStuntTimer; - int32 m_nPrevTimeCarSpentOnTwoWheels; - int32 m_nPrevDistanceCarTravelledOnTwoWheels; - int32 m_nPrevTimeSpentOnWheelie; - int32 m_nPrevDistanceTravelledOnWheelie; - int32 m_nPrevTimeSpentOnStoppie; - int32 m_nPrevDistanceTravelledOnStoppie; + int32 m_nLastTimeCarSpentOnTwoWheels; + int32 m_nLastDistanceCarTravelledOnTwoWheels; + int32 m_nLastTimeSpentOnWheelie; + int32 m_nLastDistanceTravelledOnWheelie; + int32 m_nLastTimeSpentOnStoppie; + int32 m_nLastDistanceTravelledOnStoppie; int16 m_nTrafficMultiplier; int16 field_12A; float m_fRoadDensity;