From fd113b11c752824d72fa42b285a51400d19dc02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valdir=20da=20Costa=20J=C3=BAnior?= Date: Sat, 16 Jan 2021 09:38:03 -0300 Subject: [PATCH] v1.0.7 --- CLEOPlus/CLEOPlus.cpp | 4 ++-- CLEOPlus/Misc.cpp | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CLEOPlus/CLEOPlus.cpp b/CLEOPlus/CLEOPlus.cpp index 355e4df..955e983 100644 --- a/CLEOPlus/CLEOPlus.cpp +++ b/CLEOPlus/CLEOPlus.cpp @@ -18,7 +18,7 @@ #include "rw/rpworld.h" #include -constexpr uint32_t CLEOPLUS_VERSION_INT = 0x01000600; +constexpr uint32_t CLEOPLUS_VERSION_INT = 0x01000700; using namespace plugin; using namespace std; @@ -960,7 +960,7 @@ class CLEOPlus { VehExtended &xdata = vehExtData.Get(vehicle); - if (&xdata) { + if (&xdata != nullptr) { // Reset last damage; xdata.lastDamagePed = nullptr; xdata.lastDamageType = 0; diff --git a/CLEOPlus/Misc.cpp b/CLEOPlus/Misc.cpp index 523640a..bc937a5 100644 --- a/CLEOPlus/Misc.cpp +++ b/CLEOPlus/Misc.cpp @@ -1260,14 +1260,7 @@ OpcodeResult WINAPI GET_CHAR_DAMAGE_LAST_FRAME(CScriptThread* thread) int ref = CLEO_GetIntOpcodeParam(thread); CPed *ped = CPools::GetPed(ref); PedExtended &data = extData.Get(ped); - if (&data) - { - CLEO_SetIntOpcodeParam(thread, -1); - CLEO_SetIntOpcodeParam(thread, -1); - CLEO_SetIntOpcodeParam(thread, -1); - CLEO_SetFloatOpcodeParam(thread, 0.0f); - } - else + if (&data != nullptr) { CLEO_SetIntOpcodeParam(thread, (DWORD)data.lastDamageEntity); CLEO_SetIntOpcodeParam(thread, data.lastDamageWeapon); @@ -1275,6 +1268,13 @@ OpcodeResult WINAPI GET_CHAR_DAMAGE_LAST_FRAME(CScriptThread* thread) CLEO_SetFloatOpcodeParam(thread, data.lastDamageIntensity); if (data.lastDamageIntensity > 0.0f) bResult = true; } + else + { + CLEO_SetIntOpcodeParam(thread, -1); + CLEO_SetIntOpcodeParam(thread, -1); + CLEO_SetIntOpcodeParam(thread, -1); + CLEO_SetFloatOpcodeParam(thread, 0.0f); + } reinterpret_cast(thread)->UpdateCompareFlag(bResult); return OR_CONTINUE; } @@ -1289,11 +1289,6 @@ OpcodeResult WINAPI GET_CAR_WEAPON_DAMAGE_LAST_FRAME(CScriptThread* thread) int pedReturn = -1; if (&data != nullptr) { - CLEO_SetIntOpcodeParam(thread, pedReturn); - CLEO_SetIntOpcodeParam(thread, -1); - CLEO_SetFloatOpcodeParam(thread, 0.0f); - } - else { if (data.lastDamagePed) { pedReturn = CPools::GetPedRef((CPed*)data.lastDamagePed); } @@ -1303,6 +1298,11 @@ OpcodeResult WINAPI GET_CAR_WEAPON_DAMAGE_LAST_FRAME(CScriptThread* thread) CLEO_SetIntOpcodeParam(thread, data.lastDamageType); CLEO_SetFloatOpcodeParam(thread, data.lastDamageIntensity); } + else { + CLEO_SetIntOpcodeParam(thread, pedReturn); + CLEO_SetIntOpcodeParam(thread, -1); + CLEO_SetFloatOpcodeParam(thread, 0.0f); + } reinterpret_cast(thread)->UpdateCompareFlag(bResult); return OR_CONTINUE; }