Attempt to decompile func0f111ad4

This commit is contained in:
Ryan Dwyer 2020-02-07 18:31:22 +10:00
parent 2e1dfe8b06
commit 524668e0f0
5 changed files with 42 additions and 26 deletions

View File

@ -33168,7 +33168,7 @@ s32 chrConsiderGrenadeThrow(struct chrdata *chr, u32 entitytype, u32 entityid)
if (prop) {
weapon = prop->weapon;
weapon->hidden |= OBJHFLAG_00000800;
weapon->base.hidden |= OBJHFLAG_00000800;
chrThrowGrenade(chr, rightprop == NULL ? 0 : 1, true);
chr->act_throwgrenade.entitytype = entitytype;
chr->act_throwgrenade.entityid = entityid;

View File

@ -2965,8 +2965,8 @@ bool aiIfGunUnclaimed(void)
} else {
struct weaponobj *weapon = g_Vars.chrdata->gunprop->weapon;
if (weapon && weapon->prop) {
weapon->flags |= OBJFLAG_00400000;
if (weapon && weapon->base.prop) {
weapon->base.flags |= OBJFLAG_00400000;
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]);
} else {
g_Vars.aioffset += 5;
@ -11798,7 +11798,7 @@ bool aiDoGunCommand(void)
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
struct weaponobj *weapon = g_Vars.chrdata->gunprop->weapon;
if (cmd[2] == 0 || ((weapon->hidden & OBJHFLAG_00000080) == 0 && cmd[2] == 1)) {
if (cmd[2] == 0 || ((weapon->base.hidden & OBJHFLAG_00000080) == 0 && cmd[2] == 1)) {
if (cmd[2] == 0) {
chrGoToProp(g_Vars.chrdata, g_Vars.chrdata->gunprop, SPEED_JOG);
}

View File

@ -298,6 +298,42 @@ glabel func0f111ad4
/* f111b84: 00000000 */ sll $zero,$zero,0x0
);
// regalloc
//bool func0f111ad4(s32 weaponnum)
//{
// struct invitem *item = g_Vars.currentplayer->weapons;
//
// while (item) {
// if (item->type == INVITEMTYPE_1) {
// if (weaponnum == item->type1.weapon1) {
// return true;
// }
// } else if (item->type == INVITEMTYPE_PROP) {
// struct prop *prop = item->type_prop.prop;
//
// if (prop && prop->type == PROPTYPE_WEAPON) {
// struct defaultobj *obj = prop->obj;
//
// if (obj && obj->type == OBJTYPE_WEAPON) {
// struct weaponobj *weapon = (struct weaponobj *)obj;
//
// if (weapon->weapon_id == weaponnum) {
// return true;
// }
// }
// }
// }
//
// item = item->next;
//
// if (item == g_Vars.currentplayer->weapons) {
// break;
// }
// }
//
// return false;
//}
GLOBAL_ASM(
glabel func0f111b88
/* f111b88: 27bdffe8 */ addiu $sp,$sp,-24

View File

@ -13,7 +13,7 @@ struct invitem *currentPlayerGetWeaponInvItem(s32 weaponnum);
bool currentPlayerHasWeapon(s32 weaponnum);
struct invitem *func0f111a4c(s32 weapon1, s32 weapon2);
bool func0f111ab0(s32 weapon1, s32 weapon2);
u32 func0f111ad4(void);
bool func0f111ad4(s32 weaponnum);
u32 func0f111b88(void);
bool currentStageForbidsSlayer(void);
bool currentPlayerCanHaveAllGunsWeapon(s32 weaponnum);

View File

@ -757,27 +757,7 @@ struct image {
};
struct weaponobj { // objtype 0x08
/*0x00*/ u16 extrascale;
/*0x02*/ u8 hidden2;
/*0x03*/ u8 type;
/*0x04*/ u16 obj;
/*0x06*/ u16 pad;
/*0x08*/ u32 flags;
/*0x0c*/ u32 flags2;
/*0x10*/ u32 flags3;
/*0x14*/ struct prop *prop;
/*0x18*/ u32 unk18;
/*0x1c*/ f32 realrot[9];
/*0x40*/ u32 hidden;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x4c*/ s16 damage;
/*0x4e*/ u16 maxdamage;
/*0x50*/ u32 shadecol;
/*0x54*/ u32 nextcol;
/*0x58*/ u16 floorcol;
/*0x5a*/ u8 numtiles;
/*0x5b*/ u8 unk5b;
struct defaultobj base;
/*0x5c*/ u8 weapon_id;
/*0x5d*/ s8 unk5d;
/*0x5e*/ s8 unk5e;