From 13f4c1ec2b5aa861dd6743dfa177b6d3cb307aaa Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 12 Mar 2020 17:22:21 +1000 Subject: [PATCH] Decompile aibotGetWeaponPad --- src/game/game_111600.c | 2 +- src/game/game_190260.c | 2 +- src/game/game_197600.c | 30 ++++++++++-------------------- src/include/game/game_197600.h | 2 +- src/include/types.h | 2 +- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/game/game_111600.c b/src/game/game_111600.c index fc49b6c3f..46e6b5847 100644 --- a/src/game/game_111600.c +++ b/src/game/game_111600.c @@ -440,7 +440,7 @@ bool currentPlayerGiveWeapon(s32 weaponnum) if (item) { item->type = INVITEMTYPE_1; item->type1.weapon1 = weaponnum; - item->type1.weapon2 = -1; + item->type1.pickuppad = -1; currentPlayerInsertInvItem(item); } diff --git a/src/game/game_190260.c b/src/game/game_190260.c index 4bf0532af..7b8bc01ef 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -567,7 +567,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) if (hasweapon) { struct weapon *weapondef = weaponFindById(weapon->weapon_id); - u32 originalpad = chrGetWeaponPad(chr, weapon->weapon_id); + u32 originalpad = aibotGetWeaponPad(chr, weapon->weapon_id); u32 currentpad = obj->pad; if (hasweapon == true diff --git a/src/game/game_197600.c b/src/game/game_197600.c index 237b23d10..82265f74e 100644 --- a/src/game/game_197600.c +++ b/src/game/game_197600.c @@ -668,26 +668,16 @@ void aibotGiveDualWeapon(struct chrdata *chr, u32 weaponnum) } } -GLOBAL_ASM( -glabel chrGetWeaponPad -/* f197f30: 27bdffe8 */ addiu $sp,$sp,-24 -/* f197f34: afbf0014 */ sw $ra,0x14($sp) -/* f197f38: 0fc65f3c */ jal aibotGetInvItem -/* f197f3c: 00000000 */ sll $zero,$zero,0x0 -/* f197f40: 10400007 */ beqz $v0,.L0f197f60 -/* f197f44: 8fbf0014 */ lw $ra,0x14($sp) -/* f197f48: 8c4e0000 */ lw $t6,0x0($v0) -/* f197f4c: 24010001 */ addiu $at,$zero,0x1 -/* f197f50: 55c10004 */ bnel $t6,$at,.L0f197f64 -/* f197f54: 2402ffff */ addiu $v0,$zero,-1 -/* f197f58: 10000002 */ beqz $zero,.L0f197f64 -/* f197f5c: 84420006 */ lh $v0,0x6($v0) -.L0f197f60: -/* f197f60: 2402ffff */ addiu $v0,$zero,-1 -.L0f197f64: -/* f197f64: 03e00008 */ jr $ra -/* f197f68: 27bd0018 */ addiu $sp,$sp,0x18 -); +s16 aibotGetWeaponPad(struct chrdata *chr, u32 weaponnum) +{ + struct invitem *item = aibotGetInvItem(chr, weaponnum); + + if (item && item->type == INVITEMTYPE_1) { + return item->type1.pickuppad; + } + + return -1; +} GLOBAL_ASM( glabel chrGiveWeapon diff --git a/src/include/game/game_197600.h b/src/include/game/game_197600.h index 487ebc5ce..248bb7486 100644 --- a/src/include/game/game_197600.h +++ b/src/include/game/game_197600.h @@ -12,7 +12,7 @@ u32 func0f197d94(void); bool chrHasWeapon(struct chrdata *chr, u32 weaponnum); u32 func0f197e8c(void); void aibotGiveDualWeapon(struct chrdata *chr, u32 weaponnum); -u32 chrGetWeaponPad(struct chrdata *chr, u32 weaponnum); +s16 aibotGetWeaponPad(struct chrdata *chr, u32 weaponnum); void chrGiveWeapon(struct chrdata *chr, struct prop *prop); u32 func0f198068(void); u32 func0f198278(void); diff --git a/src/include/types.h b/src/include/types.h index bc45662f4..5a54db256 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -5149,7 +5149,7 @@ struct memorypool { struct invitem_type1 { s16 weapon1; - s16 weapon2; + s16 pickuppad; }; struct invitem_typeprop {