Decompile aibotGetInvItemType
This commit is contained in:
parent
13f4c1ec2b
commit
4bedb8b8ad
|
|
@ -43,11 +43,11 @@ void currentPlayerSortInvItem(struct invitem *subject)
|
|||
s32 candweapon2;
|
||||
|
||||
// Prepare subject's properties for comparisons
|
||||
if (subject->type == INVITEMTYPE_1) {
|
||||
subjweapon1 = subject->type1.weapon1;
|
||||
} else if (subject->type == INVITEMTYPE_3) {
|
||||
subjweapon1 = subject->type3.weapon1;
|
||||
subjweapon2 = subject->type3.weapon2;
|
||||
if (subject->type == INVITEMTYPE_WEAP) {
|
||||
subjweapon1 = subject->type_weap.weapon1;
|
||||
} else if (subject->type == INVITEMTYPE_DUAL) {
|
||||
subjweapon1 = subject->type_dual.weapon1;
|
||||
subjweapon2 = subject->type_dual.weapon2;
|
||||
} else if (subject->type == INVITEMTYPE_PROP) {
|
||||
subjweapon1 = 2000;
|
||||
}
|
||||
|
|
@ -59,11 +59,11 @@ void currentPlayerSortInvItem(struct invitem *subject)
|
|||
candweapon1 = -1;
|
||||
candweapon2 = -1;
|
||||
|
||||
if (subject->next->type == INVITEMTYPE_1) {
|
||||
candweapon1 = subject->next->type1.weapon1;
|
||||
} else if (subject->next->type == INVITEMTYPE_3) {
|
||||
candweapon1 = subject->next->type3.weapon1;
|
||||
candweapon2 = subject->next->type3.weapon2;
|
||||
if (subject->next->type == INVITEMTYPE_WEAP) {
|
||||
candweapon1 = subject->next->type_weap.weapon1;
|
||||
} else if (subject->next->type == INVITEMTYPE_DUAL) {
|
||||
candweapon1 = subject->next->type_dual.weapon1;
|
||||
candweapon2 = subject->next->type_dual.weapon2;
|
||||
} else if (subject->next->type == INVITEMTYPE_PROP) {
|
||||
candweapon1 = 1000;
|
||||
}
|
||||
|
|
@ -200,7 +200,7 @@ struct invitem *currentPlayerGetWeaponInvItem(s32 weaponnum)
|
|||
struct invitem *item = first;
|
||||
|
||||
while (item) {
|
||||
if (item->type == INVITEMTYPE_1 && item->type1.weapon1 == weaponnum) {
|
||||
if (item->type == INVITEMTYPE_WEAP && item->type_weap.weapon1 == weaponnum) {
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -225,9 +225,9 @@ struct invitem *func0f111a4c(s32 weapon1, s32 weapon2)
|
|||
struct invitem *item = first;
|
||||
|
||||
while (item) {
|
||||
if (item->type == INVITEMTYPE_3
|
||||
&& item->type3.weapon1 == weapon1
|
||||
&& item->type3.weapon2 == weapon2) {
|
||||
if (item->type == INVITEMTYPE_DUAL
|
||||
&& item->type_dual.weapon1 == weapon1
|
||||
&& item->type_dual.weapon2 == weapon2) {
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -306,8 +306,8 @@ glabel func0f111ad4
|
|||
// struct invitem *item = g_Vars.currentplayer->weapons;
|
||||
//
|
||||
// while (item) {
|
||||
// if (item->type == INVITEMTYPE_1) {
|
||||
// if (weaponnum == item->type1.weapon1) {
|
||||
// if (item->type == INVITEMTYPE_WEAP) {
|
||||
// if (weaponnum == item->type_weap.weapon1) {
|
||||
// return true;
|
||||
// }
|
||||
// } else if (item->type == INVITEMTYPE_PROP) {
|
||||
|
|
@ -438,9 +438,9 @@ bool currentPlayerGiveWeapon(s32 weaponnum)
|
|||
item = currentPlayerGetUnusedInvItem();
|
||||
|
||||
if (item) {
|
||||
item->type = INVITEMTYPE_1;
|
||||
item->type1.weapon1 = weaponnum;
|
||||
item->type1.pickuppad = -1;
|
||||
item->type = INVITEMTYPE_WEAP;
|
||||
item->type_weap.weapon1 = weaponnum;
|
||||
item->type_weap.pickuppad = -1;
|
||||
currentPlayerInsertInvItem(item);
|
||||
}
|
||||
|
||||
|
|
@ -457,9 +457,9 @@ bool currentPlayerGiveWeaponWithArgument(s32 weapon1, s32 weapon2)
|
|||
struct invitem *item = currentPlayerGetUnusedInvItem();
|
||||
|
||||
if (item) {
|
||||
item->type = INVITEMTYPE_3;
|
||||
item->type3.weapon1 = weapon1;
|
||||
item->type3.weapon2 = weapon2;
|
||||
item->type = INVITEMTYPE_DUAL;
|
||||
item->type_dual.weapon1 = weapon1;
|
||||
item->type_dual.weapon2 = weapon2;
|
||||
currentPlayerInsertInvItem(item);
|
||||
}
|
||||
|
||||
|
|
@ -494,12 +494,12 @@ void currentPlayerRemoveWeapon(s32 weaponnum)
|
|||
if (override && override->weapon == weaponnum) {
|
||||
currentPlayerRemoveInvItem(item);
|
||||
}
|
||||
} else if (item->type == INVITEMTYPE_1) {
|
||||
if (item->type1.weapon1 == weaponnum) {
|
||||
} else if (item->type == INVITEMTYPE_WEAP) {
|
||||
if (item->type_weap.weapon1 == weaponnum) {
|
||||
currentPlayerRemoveInvItem(item);
|
||||
}
|
||||
} else if (item->type == INVITEMTYPE_3) {
|
||||
if (item->type3.weapon1 == weaponnum || item->type3.weapon2 == weaponnum) {
|
||||
} else if (item->type == INVITEMTYPE_DUAL) {
|
||||
if (item->type_dual.weapon1 == weaponnum || item->type_dual.weapon2 == weaponnum) {
|
||||
currentPlayerRemoveInvItem(item);
|
||||
}
|
||||
}
|
||||
|
|
@ -1222,9 +1222,9 @@ s32 currentPlayerGetNumInvItems(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (item->type == INVITEMTYPE_1) {
|
||||
} else if (item->type == INVITEMTYPE_WEAP) {
|
||||
if (g_Vars.currentplayer->equipallguns == false
|
||||
|| item->type1.weapon1 > WEAPON_PSYCHOSISGUN) {
|
||||
|| item->type_weap.weapon1 > WEAPON_PSYCHOSISGUN) {
|
||||
numitems++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1278,9 +1278,9 @@ struct invitem *currentPlayerGetInvItemByIndex(s32 index)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (item->type == INVITEMTYPE_1) {
|
||||
} else if (item->type == INVITEMTYPE_WEAP) {
|
||||
if (g_Vars.currentplayer->equipallguns == false
|
||||
|| item->type1.weapon1 > WEAPON_PSYCHOSISGUN) {
|
||||
|| item->type_weap.weapon1 > WEAPON_PSYCHOSISGUN) {
|
||||
if (index == 0) {
|
||||
return item;
|
||||
}
|
||||
|
|
@ -1340,8 +1340,8 @@ s32 currentPlayerGetWeaponNumByInvIndex(s32 index)
|
|||
if (override) {
|
||||
return override->weapon;
|
||||
}
|
||||
} else if (item->type == INVITEMTYPE_1) {
|
||||
return item->type1.weapon1;
|
||||
} else if (item->type == INVITEMTYPE_WEAP) {
|
||||
return item->type_weap.weapon1;
|
||||
}
|
||||
} else if (g_Vars.currentplayer->equipallguns) {
|
||||
if (index < WEAPON_PSYCHOSISGUN - currentStageForbidsSlayer()) {
|
||||
|
|
@ -1371,8 +1371,8 @@ u16 currentPlayerGetInvNameIdByIndex(s32 index)
|
|||
|
||||
weaponnum = override->weapon;
|
||||
}
|
||||
} else if (item->type == INVITEMTYPE_1) {
|
||||
weaponnum = item->type1.weapon1;
|
||||
} else if (item->type == INVITEMTYPE_WEAP) {
|
||||
weaponnum = item->type_weap.weapon1;
|
||||
override = weaponGetTextOverride(weaponnum);
|
||||
|
||||
if (override && override->unk14) {
|
||||
|
|
@ -1414,8 +1414,8 @@ char *currentPlayerGetInvShortNameByIndex(s32 index)
|
|||
|
||||
weaponnum = override->weapon;
|
||||
}
|
||||
} else if (item->type == INVITEMTYPE_1) {
|
||||
weaponnum = item->type1.weapon1;
|
||||
} else if (item->type == INVITEMTYPE_WEAP) {
|
||||
weaponnum = item->type_weap.weapon1;
|
||||
override = weaponGetTextOverride(weaponnum);
|
||||
|
||||
if (override && override->unk14) {
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr)
|
|||
case OBJTYPE_WEAPON:
|
||||
{
|
||||
struct weaponobj *weapon = prop->weapon;
|
||||
bool hasweapon = chrHasWeapon(chr, weapon->weapon_id);
|
||||
u32 itemtype = aibotGetInvItemType(chr, weapon->weapon_id);
|
||||
u32 result;
|
||||
u32 qty;
|
||||
|
||||
|
|
@ -565,12 +565,12 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr)
|
|||
func0f199e3c(chr->unk2d4, weapon->weapon_id, weapon->dragonthrown, qty);
|
||||
}
|
||||
|
||||
if (hasweapon) {
|
||||
if (itemtype) {
|
||||
struct weapon *weapondef = weaponFindById(weapon->weapon_id);
|
||||
u32 originalpad = aibotGetWeaponPad(chr, weapon->weapon_id);
|
||||
u32 currentpad = obj->pad;
|
||||
|
||||
if (hasweapon == true
|
||||
if (itemtype == INVITEMTYPE_WEAP
|
||||
&& weapondef
|
||||
&& (weapondef->flags & WEAPONFLAG_DUALWIELD)
|
||||
&& originalpad != currentpad) {
|
||||
|
|
@ -753,7 +753,7 @@ glabel var7f1b8ea8
|
|||
/* f190d6c: 8dc20004 */ lw $v0,0x4($t6)
|
||||
/* f190d70: 8fa4008c */ lw $a0,0x8c($sp)
|
||||
/* f190d74: 9045005c */ lbu $a1,0x5c($v0)
|
||||
/* f190d78: 0fc65f90 */ jal chrHasWeapon
|
||||
/* f190d78: 0fc65f90 */ jal aibotGetInvItemType
|
||||
/* f190d7c: afa20080 */ sw $v0,0x80($sp)
|
||||
/* f190d80: 8faf0080 */ lw $t7,0x80($sp)
|
||||
/* f190d84: 91e4005c */ lbu $a0,0x5c($t7)
|
||||
|
|
@ -877,7 +877,7 @@ glabel var7f1b8ea8
|
|||
/* f190f3c: 8fa4008c */ lw $a0,0x8c($sp)
|
||||
/* f190f40: 51200011 */ beqzl $t1,.L0f190f88
|
||||
/* f190f44: 8faa0064 */ lw $t2,0x64($sp)
|
||||
/* f190f48: 0fc65f90 */ jal chrHasWeapon
|
||||
/* f190f48: 0fc65f90 */ jal aibotGetInvItemType
|
||||
/* f190f4c: 01202825 */ or $a1,$t1,$zero
|
||||
/* f190f50: 5440000d */ bnezl $v0,.L0f190f88
|
||||
/* f190f54: 8faa0064 */ lw $t2,0x64($sp)
|
||||
|
|
|
|||
|
|
@ -594,31 +594,22 @@ glabel func0f197d94
|
|||
/* f197e3c: 27bd0008 */ addiu $sp,$sp,0x8
|
||||
);
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel chrHasWeapon
|
||||
/* f197e40: 27bdffe8 */ addiu $sp,$sp,-24
|
||||
/* f197e44: 10800004 */ beqz $a0,.L0f197e58
|
||||
/* f197e48: afbf0014 */ sw $ra,0x14($sp)
|
||||
/* f197e4c: 8c8e02d4 */ lw $t6,0x2d4($a0)
|
||||
/* f197e50: 15c00003 */ bnez $t6,.L0f197e60
|
||||
/* f197e54: 00000000 */ sll $zero,$zero,0x0
|
||||
.L0f197e58:
|
||||
/* f197e58: 10000008 */ beqz $zero,.L0f197e7c
|
||||
/* f197e5c: 00001025 */ or $v0,$zero,$zero
|
||||
.L0f197e60:
|
||||
/* f197e60: 0fc65f3c */ jal aibotGetInvItem
|
||||
/* f197e64: 00000000 */ sll $zero,$zero,0x0
|
||||
/* f197e68: 50400004 */ beqzl $v0,.L0f197e7c
|
||||
/* f197e6c: 00001025 */ or $v0,$zero,$zero
|
||||
/* f197e70: 10000002 */ beqz $zero,.L0f197e7c
|
||||
/* f197e74: 8c420000 */ lw $v0,0x0($v0)
|
||||
/* f197e78: 00001025 */ or $v0,$zero,$zero
|
||||
.L0f197e7c:
|
||||
/* f197e7c: 8fbf0014 */ lw $ra,0x14($sp)
|
||||
/* f197e80: 27bd0018 */ addiu $sp,$sp,0x18
|
||||
/* f197e84: 03e00008 */ jr $ra
|
||||
/* f197e88: 00000000 */ sll $zero,$zero,0x0
|
||||
);
|
||||
u32 aibotGetInvItemType(struct chrdata *chr, u32 weaponnum)
|
||||
{
|
||||
struct invitem *item;
|
||||
|
||||
if (!chr || !chr->unk2d4) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
item = aibotGetInvItem(chr, weaponnum);
|
||||
|
||||
if (item) {
|
||||
return item->type;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel func0f197e8c
|
||||
|
|
@ -634,7 +625,7 @@ glabel func0f197e8c
|
|||
/* f197eac: 10000011 */ beqz $zero,.L0f197ef4
|
||||
/* f197eb0: 00001025 */ or $v0,$zero,$zero
|
||||
.L0f197eb4:
|
||||
/* f197eb4: 0fc65f90 */ jal chrHasWeapon
|
||||
/* f197eb4: 0fc65f90 */ jal aibotGetInvItemType
|
||||
/* f197eb8: afa40018 */ sw $a0,0x18($sp)
|
||||
/* f197ebc: 1440000c */ bnez $v0,.L0f197ef0
|
||||
/* f197ec0: 8fa40018 */ lw $a0,0x18($sp)
|
||||
|
|
@ -664,7 +655,7 @@ void aibotGiveDualWeapon(struct chrdata *chr, u32 weaponnum)
|
|||
struct invitem *item = aibotGetInvItem(chr, weaponnum);
|
||||
|
||||
if (item) {
|
||||
item->type = INVITEMTYPE_3;
|
||||
item->type = INVITEMTYPE_DUAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -672,8 +663,8 @@ s16 aibotGetWeaponPad(struct chrdata *chr, u32 weaponnum)
|
|||
{
|
||||
struct invitem *item = aibotGetInvItem(chr, weaponnum);
|
||||
|
||||
if (item && item->type == INVITEMTYPE_1) {
|
||||
return item->type1.pickuppad;
|
||||
if (item && item->type == INVITEMTYPE_WEAP) {
|
||||
return item->type_weap.pickuppad;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -585,9 +585,9 @@
|
|||
#define INVENTORYFUNCTYPE_SPECIAL 0x0004
|
||||
#define INVENTORYFUNCTYPE_VISUAL 0x0005
|
||||
|
||||
#define INVITEMTYPE_1 1
|
||||
#define INVITEMTYPE_WEAP 1
|
||||
#define INVITEMTYPE_PROP 2
|
||||
#define INVITEMTYPE_3 3
|
||||
#define INVITEMTYPE_DUAL 3
|
||||
|
||||
#define L_AME(index) TEXT(1, index)
|
||||
#define L_ARCH(index) TEXT(2, index)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ void func0f197c00(struct chrdata *chr);
|
|||
u32 func0f197c70(void);
|
||||
struct invitem *aibotGetInvItem(struct chrdata *chr, u32 weaponnum);
|
||||
u32 func0f197d94(void);
|
||||
bool chrHasWeapon(struct chrdata *chr, u32 weaponnum);
|
||||
u32 aibotGetInvItemType(struct chrdata *chr, u32 weaponnum);
|
||||
u32 func0f197e8c(void);
|
||||
void aibotGiveDualWeapon(struct chrdata *chr, u32 weaponnum);
|
||||
s16 aibotGetWeaponPad(struct chrdata *chr, u32 weaponnum);
|
||||
|
|
|
|||
|
|
@ -5147,16 +5147,16 @@ struct memorypool {
|
|||
/*0x10*/ u32 unk10;
|
||||
};
|
||||
|
||||
struct invitem_type1 {
|
||||
struct invitem_weap {
|
||||
s16 weapon1;
|
||||
s16 pickuppad;
|
||||
};
|
||||
|
||||
struct invitem_typeprop {
|
||||
struct invitem_prop {
|
||||
struct prop *prop;
|
||||
};
|
||||
|
||||
struct invitem_type3 {
|
||||
struct invitem_dual {
|
||||
s32 weapon1;
|
||||
s32 weapon2;
|
||||
};
|
||||
|
|
@ -5165,9 +5165,9 @@ struct invitem {
|
|||
/*0x00*/ s32 type;
|
||||
|
||||
union {
|
||||
struct invitem_type1 type1;
|
||||
struct invitem_typeprop type_prop;
|
||||
struct invitem_type3 type3;
|
||||
struct invitem_weap type_weap;
|
||||
struct invitem_prop type_prop;
|
||||
struct invitem_dual type_dual;
|
||||
};
|
||||
|
||||
/*0x0c*/ struct invitem *next;
|
||||
|
|
|
|||
Loading…
Reference in New Issue