Fixed a bug in knockback modifier functions that could crash the game (#237)

Updated version number.
This commit is contained in:
NovaRain
2019-06-02 08:52:42 +08:00
parent 56fd9706a4
commit 9a331c918c
2 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -73,8 +73,8 @@ static double ApplyModifiers(std::vector<KnockbackModifier>* mods, TGameObj* obj
static DWORD __fastcall CalcKnockbackMod(int knockValue, int damage, TGameObj* weapon, TGameObj* attacker, TGameObj* target) {
double result = (double)damage / (double)knockValue;
result = ApplyModifiers(&mWeapons, weapon, result);
result = ApplyModifiers(&mAttackers, attacker, result);
if (weapon) result = ApplyModifiers(&mWeapons, weapon, result);
if (attacker) result = ApplyModifiers(&mAttackers, attacker, result);
result = ApplyModifiers(&mTargets, target, result);
return (DWORD)floor(result);
}
@@ -97,9 +97,9 @@ static void __declspec(naked) compute_dmg_damage_hack() {
__asm {
push ecx
push esi; // Target
mov eax, -1;
push eax; // Attacker
push eax; // Weapon
xor eax, eax;
push eax; // Attacker (no attacker)
push eax; // Weapon (no weapon)
mov edx, ebx; // Damage
mov ecx, 10; // Knockback value
call CalcKnockbackMod;
+3 -3
View File
@@ -25,12 +25,12 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 8
#define VERSION_BUILD 18
#define VERSION_REV 0
#define VERSION_REV 1
#ifdef WIN2K
#define VERSION_STRING "3.8.18 win2k"
#define VERSION_STRING "3.8.18.1 win2k"
#else
#define VERSION_STRING "3.8.18"
#define VERSION_STRING "3.8.18.1"
#endif
//#define CHECK_VAL (4)