From 25e2939fd0ad1e7bf1cfdc4f76d10e6256ce1ea9 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Wed, 28 Oct 2015 10:43:11 +0800 Subject: [PATCH] Removed obsolete Jim's damage formula. --- artifacts/ddraw.ini | 1 - sfall/AmmoMod.cpp | 61 ++------------------------------------------- 2 files changed, 2 insertions(+), 60 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 9a808d2df..f6366cb30 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -261,7 +261,6 @@ ExtraKillTypes=0 ;0 - Fallout default ;1 - Glovz's Damage Fix ;2 - Glovz's Damage Fix with Damage Multiplier tweak -;4 - Jim's Formula for the Mechanics Overhaul Mod ;5 - Haenlomal's Yet Another Ammo Mod. DamageFormula=0 diff --git a/sfall/AmmoMod.cpp b/sfall/AmmoMod.cpp index ce20216ec..ae8f52fb1 100644 --- a/sfall/AmmoMod.cpp +++ b/sfall/AmmoMod.cpp @@ -408,63 +408,6 @@ __asm { } } -// Jim's Formula for the Mechanics Overhaul Mod -static __declspec(naked) void DamageFunction4() { - __asm { - mov eax,dword ptr ds:[esi+0x8]; // Get pointer to critter's weapon - call item_w_dam_div_; // Retrieve Ammo Divisor - imul ebp,eax; // Ammo Divisor = 1 * Ammo Divisor (ebp set to 1 earlier in function) - mov ebx,dword ptr ss:[esp+0x1c]; // Get number of hits - xor ecx,ecx; // Set loop counter to zero - test ebx,ebx; // Is number of hits smaller than= 0? - jle end; // If yes, jump beyond damage calculation loop -ajmp: // Start of damage calculation loop - mov edx,dword ptr ds:[esi+0x4]; // Get pointer to weapon (?) - mov eax,dword ptr ds:[esi]; // Get pointer to critter (?) - call item_w_damage_; // Retrieve Raw Damage - mov ebx,eax; // Move Raw Damage to ebx - mov edx,dword ptr ss:[esp+0x28]; // Get armor DT - mov eax,dword ptr ds:[esi+0x8]; // Get pointer to critter's weapon - call item_w_dr_adjust_; // Retrieve ammo AM (Armor Modifier: adds or removes a percentage of the DT and DR) - cmp edx,eax; // is ammo DT bigger than AM - jge ijmp; // If yes, go to end of calc because threshold not met - mov edx,dword ptr ss:[esp+0x2c]; // Get armor DR - mov eax,dword ptr ds:[esi+0x8]; // Get pointer to critter's weapon - call item_w_dr_adjust_; // Retrieve ammo AM - imul edx,eax; // DR modifier = armor DR * ammo AM - mov dword ptr ss:[esp+0x30],0x64; //sets some variable to 100 - mov eax,edx; //(not sure if I have to do this, but Haen does it) - sar edx,0x1f; // makes DR modifier the dividend - idiv dword ptr ss:[esp+0x30]; // DR modifier = DR modifier / 100 - mov edx,dword ptr ss:[esp+0x2c]; // Get armor DR - sub edx,eax; // DR = DR - DR modifier (can be negative) - test edx,edx; // Is DR >= 0? - jge gjmp; - xor edx,edx; // If no, set DR = 0 - jmp hjmp; -gjmp: - cmp edx,0x64; // Otherwise, is DR bigger than or equal to 100? - jge ijmp; // If yes, damage will be zero, so stop calculating and go to bottom of loop -hjmp: - imul edx,ebx; // Otherwise, Resisted Damage = DR * Raw Damage - mov dword ptr ss:[esp+0x30],0x64; - mov eax,edx; - sar edx,0x1f; - idiv dword ptr ss:[esp+0x30]; // Resisted Damage = Resisted Damage / 100 - sub ebx,eax; // Raw Damage = Raw Damage - Resisted Damage - test ebx,ebx; // Is Raw Damage smaller than 0? - jle ijmp; // If yes, don't accumulate damage - add dword ptr ds:[edi],ebx; // Otherwise, Accumulated Damage = Accumulated Damage + Raw Damage -ijmp: - mov eax,dword ptr ss:[esp+0x1c]; // Get number of hits - inc ecx; // counter += 1 - cmp ecx,eax; // Is counter smaller than number of hits? - jl ajmp; // If yes, go back to start of damage calcuation loop (calculate damage for next hit) -end: - jmp DamageFunctionReturn; // Otherwise, exit loop - } -} - // YAAM static __declspec(naked) void DamageFunction5() { __asm { @@ -802,10 +745,10 @@ void AmmoModInit() { break; /*case 3: MakeCall(0x424995, &DamageFunction3, true); - break;*/ + break; case 4: MakeCall(0x424995, &DamageFunction4, true); - break; + break;*/ case 5: MakeCall(0x424995, &DamageFunction5, true); break;