mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed the extra AP check when AI reloads a weapon
(reloading is possible if there are not enough action points.)
This commit is contained in:
+2
-2
@@ -6,8 +6,8 @@ GEM
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.6.0)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
|
||||
+11
-12
@@ -394,12 +394,11 @@ skip:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static long tempReloadCost;
|
||||
static long aiReloadCost;
|
||||
|
||||
static long __fastcall item_weapon_reload_cost_fix(fo::GameObject* source, fo::GameObject* weapon, fo::GameObject** outAmmo) {
|
||||
long reloadCost = game::Items::item_weapon_mp_cost(source, weapon, fo::AttackType::ATKTYPE_RWEAPON_RELOAD, 0);
|
||||
if (reloadCost > source->critter.movePoints) return -1; // not enough action points
|
||||
tempReloadCost = reloadCost;
|
||||
aiReloadCost = game::Items::item_weapon_mp_cost(source, weapon, fo::AttackType::ATKTYPE_RWEAPON_RELOAD, 0);
|
||||
//if (aiReloadCost > source->critter.movePoints) return -1; // not enough action points
|
||||
|
||||
return fo::func::ai_have_ammo(source, weapon, outAmmo); // 0 - no ammo
|
||||
}
|
||||
@@ -410,20 +409,20 @@ static void __declspec(naked) ai_try_attack_hook_cost_reload() {
|
||||
push ebx; // ammoObj ref
|
||||
mov ecx, eax; // source
|
||||
call item_weapon_reload_cost_fix; // edx - weapon
|
||||
cmp eax, -1;
|
||||
je noAPs;
|
||||
// cmp eax, -1;
|
||||
// je noAPs;
|
||||
retn;
|
||||
noAPs: // not enough action points
|
||||
add esp, 4; // destroy ret
|
||||
mov edi, 10;
|
||||
jmp ai_try_attack_hook_goNext_Ret; // end ai_try_attack_
|
||||
//noAPs: // not enough action points
|
||||
// add esp, 4; // destroy ret
|
||||
// mov edi, 10;
|
||||
// jmp ai_try_attack_hook_goNext_Ret; // end ai_try_attack_
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_cost1() {
|
||||
__asm {
|
||||
xor ebx, ebx;
|
||||
sub edx, tempReloadCost; // curr.mp - reload cost
|
||||
sub edx, aiReloadCost; // curr.mp - reload cost
|
||||
cmovg ebx, edx; // if curr.mp > 0
|
||||
retn;
|
||||
}
|
||||
@@ -432,7 +431,7 @@ static void __declspec(naked) ai_try_attack_hook_cost1() {
|
||||
static void __declspec(naked) ai_try_attack_hook_cost2() {
|
||||
__asm {
|
||||
xor ecx, ecx;
|
||||
sub ebx, tempReloadCost; // curr.mp - reload cost
|
||||
sub ebx, aiReloadCost; // curr.mp - reload cost
|
||||
cmovg ecx, ebx; // if curr.mp > 0
|
||||
retn;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user