diff --git a/src/game/game_190260.c b/src/game/game_190260.c index 8af70b65d..15e6c5d40 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -488,7 +488,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) dprint(); if (qty) { - aibotGiveAmmo(chr->aibot, crate->ammotype, qty); + aibotGiveAmmoByType(chr->aibot, crate->ammotype, qty); } func0f0939f8(NULL, prop, 0xea, -1, @@ -537,7 +537,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) } if (qty) { - aibotGiveAmmo(chr->aibot, i + 1, qty); + aibotGiveAmmoByType(chr->aibot, i + 1, qty); } } @@ -563,7 +563,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) qty = weaponGetPickupAmmoQty(weapon); if (qty) { - func0f199e3c(chr->aibot, weapon->weapon_id, weapon->dragonthrown, qty); + aibotGiveAmmoByWeapon(chr->aibot, weapon->weapon_id, weapon->dragonthrown, qty); } if (itemtype) { diff --git a/src/game/game_197600.c b/src/game/game_197600.c index 4f5f2369c..e5d938407 100644 --- a/src/game/game_197600.c +++ b/src/game/game_197600.c @@ -2349,7 +2349,7 @@ glabel func0f1994b0 /* f1995f8: afa80038 */ sw $t0,0x38($sp) /* f1995fc: 00067880 */ sll $t7,$a2,0x2 /* f199600: 000f37c2 */ srl $a2,$t7,0x1f -/* f199604: 0fc6678f */ jal func0f199e3c +/* f199604: 0fc6678f */ jal aibotGiveAmmoByWeapon /* f199608: afa3003c */ sw $v1,0x3c($sp) /* f19960c: 8fa80038 */ lw $t0,0x38($sp) /* f199610: 8fa3003c */ lw $v1,0x3c($sp) diff --git a/src/game/game_1999b0.c b/src/game/game_1999b0.c index fb622d34a..dd0edaca1 100644 --- a/src/game/game_1999b0.c +++ b/src/game/game_1999b0.c @@ -339,7 +339,7 @@ glabel func0f199d70 ); GLOBAL_ASM( -glabel func0f199e3c +glabel aibotGiveAmmoByWeapon /* f199e3c: 27bdffe0 */ addiu $sp,$sp,-32 /* f199e40: afa40020 */ sw $a0,0x20($sp) /* f199e44: afbf0014 */ sw $ra,0x14($sp) @@ -391,8 +391,28 @@ glabel func0f199e3c /* f199ef0: 00000000 */ sll $zero,$zero,0x0 ); +// Mismatches because the target saves the heldquantity pointer to the stack +// before calling to ammotypeGetMaxCapacity, despite it already being saved. +//void aibotGiveAmmoByWeapon(struct aibot *aibot, s32 weaponnum, s32 funcnum, s32 qty) +//{ +// s32 max; +// s32 *heldquantity = &aibot->ammotypes->quantities[weaponGetAmmoTypeByFunction(weaponnum, funcnum)]; +// +// if (aibot && (aibot->unk064 & 1) == 0 && qty > 0) { +// dprint(); +// *heldquantity += qty; +// max = ammotypeGetMaxCapacity(weaponGetAmmoTypeByFunction(weaponnum, funcnum)); +// +// if (*heldquantity > max) { +// *heldquantity = max; +// } +// +// dprint(); +// } +//} + GLOBAL_ASM( -glabel aibotGiveAmmo +glabel aibotGiveAmmoByType /* f199ef4: 27bdffe0 */ addiu $sp,$sp,-32 /* f199ef8: afbf0014 */ sw $ra,0x14($sp) /* f199efc: 8c8e001c */ lw $t6,0x1c($a0) @@ -436,7 +456,7 @@ glabel aibotGiveAmmo // Mismatches because the target saves the heldquantity pointer to the stack // before calling to ammotypeGetMaxCapacity, despite it already being saved. -//void aibotGiveAmmo(struct aibot *aibot, u32 ammotype, s32 quantity) +//void aibotGiveAmmoByType(struct aibot *aibot, u32 ammotype, s32 quantity) //{ // s32 max; // s32 *heldquantity = &aibot->ammotypes->quantities[ammotype]; diff --git a/src/include/game/game_1999b0.h b/src/include/game/game_1999b0.h index 7632cfbff..42502b835 100644 --- a/src/include/game/game_1999b0.h +++ b/src/include/game/game_1999b0.h @@ -9,8 +9,8 @@ u32 func0f199a40(void); s32 func0f199be4(struct aibot *aibot, u32 weaponnum, u32 arg2, u32 arg3); u32 func0f199cb8(void); u32 func0f199d70(void); -void func0f199e3c(struct aibot *aibot, u32 weaponnum, bool proxy, u32 qty); -void aibotGiveAmmo(struct aibot *aibot, u32 ammotype, s32 quantity); +void aibotGiveAmmoByWeapon(struct aibot *aibot, s32 weaponnum, s32 funcnum, s32 qty); +void aibotGiveAmmoByType(struct aibot *aibot, u32 ammotype, s32 quantity); u32 func0f199f84(void); bool func0f19a29c(u32 value, bool fallback); u32 func0f19a2dc(u32 value);