1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-23 05:45:03 +00:00
oot/src/code/z_player_lib.c

188 lines
5.2 KiB
C
Raw Normal View History

2020-03-17 04:31:30 +00:00
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008E750.s")
s32 func_8008E8DC(GlobalContext* globalCtx, Player* player) {
2020-03-22 21:19:43 +00:00
return (player->stateFlags1 & 0x20000080 || player->action || globalCtx->sceneLoadFlag == 0x14 ||
player->stateFlags1 & 1 || player->unk_692 & 0x80 ||
(gSaveContext.unk_13F0 && func_8008F0D8(player, player->unk_154) >= 0));
2020-03-22 21:19:43 +00:00
}
s32 func_8008E988(GlobalContext* globalCtx) {
2020-03-17 04:31:30 +00:00
Player* player = PLAYER;
return func_8008E8DC(globalCtx, player) || player->unk_6AD == 4;
}
s32 func_8008E9C4(Player* player) {
2020-03-17 04:31:30 +00:00
return player->stateFlags1 & 0x10;
}
s32 func_8008E9D0(Player* player) {
2020-03-17 04:31:30 +00:00
return LINK_IS_CHILD && player->currentShield == 2;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008E9F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EA40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EB2C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EC04.s")
2020-03-22 21:19:43 +00:00
void func_8008EC70(Player* player) {
2020-03-17 04:31:30 +00:00
player->unk_154 = player->unk_151;
func_8008EC04(player, func_8008E9F8(player, player->unk_151));
player->unk_6AD = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008ECAC.s")
void func_8008ED9C(GlobalContext* globalCtx, Player* player, s32 item, s32 arg2) {
2020-03-17 04:31:30 +00:00
Inventory_UpdateBottleItem(globalCtx, item, player->unk_150);
2020-03-22 21:19:43 +00:00
if (item != ITEM_BOTTLE) {
2020-03-17 04:31:30 +00:00
player->unk_152 = item;
player->unk_151 = arg2;
}
player->unk_154 = arg2;
}
2020-03-22 21:19:43 +00:00
void func_8008EDF0(Player* player) {
2020-03-17 04:31:30 +00:00
player->unk_664 = NULL;
player->stateFlags2 &= ~0x2000;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EE08.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EEAC.s")
s32 func_8008EF44(GlobalContext* globalCtx, s32 arg1) {
2020-03-17 04:31:30 +00:00
globalCtx->unk_11E5C = (arg1 + 1);
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EF5C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F034.s")
2020-03-22 21:19:43 +00:00
u8 func_8008F080(GlobalContext* globalCtx) {
2020-03-17 04:31:30 +00:00
Player* player = PLAYER;
return player->currentMask;
}
2020-03-22 21:19:43 +00:00
void func_8008F08C(GlobalContext* globalCtx) {
2020-03-17 04:31:30 +00:00
Player* player = PLAYER;
player->currentMask = 0;
}
s32 func_8008F098(GlobalContext* globalCtx) {
2020-03-17 04:31:30 +00:00
Player* player = PLAYER;
return player->currentShield == 3;
}
s32 func_8008F0AC(GlobalContext* globalCtx) {
2020-03-17 04:31:30 +00:00
Player* player = PLAYER;
return player->unk_15D == 0xa && player->currentShield == 3;
}
s32 func_8008F0D8(Player* player, s32 arg1) {
2020-03-17 04:31:30 +00:00
s32 temp_v0 = arg1 - 0x15;
2020-03-22 21:19:43 +00:00
if (temp_v0 >= 0 && temp_v0 < 6) {
2020-03-17 04:31:30 +00:00
return temp_v0;
}
return -1;
}
s32 func_8008F104(Player* player) {
2020-03-17 04:31:30 +00:00
return player->unk_151 == 0x10 || player->unk_151 == 0x11;
}
s32 func_8008F128(Player* player) {
2020-03-17 04:31:30 +00:00
return func_8008F104(player) && player->heldActor == NULL;
}
s32 func_8008F158(s32 arg0) {
2020-03-17 04:31:30 +00:00
s32 temp_v0 = arg0 - 2;
2020-03-22 21:19:43 +00:00
if (temp_v0 > 0 && temp_v0 < 6) {
2020-03-17 04:31:30 +00:00
return temp_v0;
}
return 0;
}
2020-03-22 21:19:43 +00:00
void func_8008F180(Player* player) {
2020-03-17 04:31:30 +00:00
func_8008F158(player->unk_151);
}
s32 func_8008F1A0(Player* player) {
2020-03-22 21:19:43 +00:00
if (player->unk_151 >= 5 && player->unk_151 < 8) {
2020-03-17 04:31:30 +00:00
return 1;
}
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F1CC.s")
s32 func_8008F224(Player* player, s32 arg1) {
2020-03-17 04:31:30 +00:00
s32 temp_v0 = arg1 - 0x1E;
2020-03-22 21:19:43 +00:00
if (temp_v0 >= 0 && temp_v0 < 0xD) {
2020-03-17 04:31:30 +00:00
return temp_v0;
}
return -1;
}
2020-03-22 21:19:43 +00:00
void func_8008F250(Player* player) {
2020-03-17 04:31:30 +00:00
func_8008F224(player, player->unk_151);
}
s32 func_8008F270(Player* player, s32 arg1) {
2020-03-17 04:31:30 +00:00
s32 temp_v0 = arg1 - 0x12;
2020-03-22 21:19:43 +00:00
if (temp_v0 >= 0 && temp_v0 < 2) {
2020-03-17 04:31:30 +00:00
return temp_v0;
}
return -1;
}
2020-03-22 21:19:43 +00:00
s32 func_8008F29C(Player* player) {
2020-03-17 04:31:30 +00:00
return func_8008F270(player, player->unk_151);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F2BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F2F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F470.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F87C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008FCC8.s")
2020-04-19 15:57:38 +00:00
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090014.s")
2020-03-17 04:31:30 +00:00
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800902F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090440.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090480.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090604.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800906D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800907E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800909B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090A28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090AFC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090D20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80091738.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80091880.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80091A24.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8009214C.s")