diff --git a/src/game/game_066310.c b/src/game/game_066310.c index 584fac64b..3a22e0182 100644 --- a/src/game/game_066310.c +++ b/src/game/game_066310.c @@ -43663,7 +43663,7 @@ glabel func0f08bd00 /* f08bd24: 24030001 */ addiu $v1,$zero,0x1 .L0f08bd28: /* f08bd28: afa30018 */ sw $v1,0x18($sp) -/* f08bd2c: 0fc449e4 */ jal func0f112790 +/* f08bd2c: 0fc449e4 */ jal currentPlayerHasKeyFlags /* f08bd30: afa7001c */ sw $a3,0x1c($sp) /* f08bd34: 8fa30018 */ lw $v1,0x18($sp) /* f08bd38: 10400003 */ beqz $v0,.L0f08bd48 diff --git a/src/game/game_111600.c b/src/game/game_111600.c index d27c5a57f..27361ed73 100644 --- a/src/game/game_111600.c +++ b/src/game/game_111600.c @@ -1046,7 +1046,7 @@ glabel func0f11253c ); GLOBAL_ASM( -glabel func0f112790 +glabel currentPlayerHasKeyFlags /* f112790: 3c0e800a */ lui $t6,0x800a /* f112794: 8dcea244 */ lw $t6,-0x5dbc($t6) /* f112798: 27bdfff8 */ addiu $sp,$sp,-8 @@ -1094,6 +1094,46 @@ glabel func0f112790 /* f112830: 8fb00004 */ lw $s0,0x4($sp) /* f112834: 03e00008 */ jr $ra /* f112838: 27bd0008 */ addiu $sp,$sp,0x8 +); + +//bool currentPlayerHasKeyFlags(u32 wantkeyflags) +//{ +// struct invitem *item = g_Vars.currentplayer->weapons; +// u32 heldkeyflags = 0; +// bool unlocked = false; +// +// while (item) { +// if (item->type == INVITEMTYPE_PROP) { +// struct prop *prop = item->type_prop.prop; +// +// if (prop && prop->type == PROPTYPE_OBJ) { +// struct defaultobj *obj = prop->obj; +// +// if (obj && obj->type == OBJTYPE_KEY) { +// struct keyobj *key = (struct keyobj *)obj; +// +// heldkeyflags |= key->keyflags; +// +// if ((wantkeyflags & heldkeyflags) == wantkeyflags) { +// unlocked = true; +// break; +// } +// } +// } +// } +// +// item = item->next; +// +// if (item == g_Vars.currentplayer->weapons) { +// break; +// } +// } +// +// return unlocked; +//} + +GLOBAL_ASM( +glabel func0f11283c /* f11283c: 03e00008 */ jr $ra /* f112840: 00001025 */ or $v0,$zero,$zero ); diff --git a/src/include/game/game_111600.h b/src/include/game/game_111600.h index 72c297b08..ddb1f42c4 100644 --- a/src/include/game/game_111600.h +++ b/src/include/game/game_111600.h @@ -27,7 +27,7 @@ void currentPlayerRemoveProp(struct prop *prop); u32 func0f1120f0(void); u32 func0f1122ec(void); u32 func0f11253c(void); -u32 func0f112790(void); +bool currentPlayerHasKeyFlags(u32 wantkeyflags); bool currentPlayerHasBriefcase(void); bool currentPlayerHasDataUplink(void); bool currentPlayerHasProp(struct prop *prop); diff --git a/src/include/types.h b/src/include/types.h index ff78a70b4..3a19bc9b6 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -747,6 +747,11 @@ struct doorobj { // objtype 0x01 /*0xcc*/ u8 laserfade; }; +struct keyobj { // objtype 0x04 + struct defaultobj base; + u32 keyflags; +}; + struct image { /*0x00*/ u32 unk00; /*0x04*/ u32 unk04;