Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start Player Item Docs #1396

Merged
merged 8 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ s32 func_80123448(PlayState* play);
s32 Player_IsGoronOrDeku(Player* player);
s32 func_801234D4(PlayState* play);
s32 func_80123590(PlayState* play, Actor* actor);
ItemId func_8012364C(PlayState* play, Player* player, s32 arg2);
ItemId Player_GetItemOnButton(PlayState* play, Player* player, EquipSlot slot);
PlayerItemAction func_80123810(PlayState* play);
PlayerModelGroup Player_ActionToModelGroup(Player* player, PlayerItemAction itemAction);
void Player_SetModelsForHoldingShield(Player* player);
Expand Down
12 changes: 6 additions & 6 deletions include/z64player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ typedef enum PlayerCueId {
// breman mask march?
#define PLAYER_STATE3_20000000 (1 << 29)
//
#define PLAYER_STATE3_40000000 (1 << 30)
#define PLAYER_STATE3_START_CHANGING_HELD_ITEM (1 << 30)
// TARGETING_HOSTILE?
#define PLAYER_STATE3_80000000 (1 << 31)

Expand Down Expand Up @@ -1095,7 +1095,7 @@ typedef struct Player {
/* 0x14B */ u8 transformation; // PlayerTransformation enum
/* 0x14C */ u8 modelGroup; // PlayerModelGroup enum
/* 0x14D */ u8 nextModelGroup;
/* 0x14E */ s8 unk_14E;
/* 0x14E */ s8 itemChangeType; // ItemChangeType enum
/* 0x14F */ u8 modelAnimType; // PlayerAnimType enum
/* 0x150 */ u8 leftHandType;
/* 0x151 */ u8 rightHandType;
Expand All @@ -1122,7 +1122,7 @@ typedef struct Player {
/* 0x238 */ OSMesg maskObjectLoadMsg;
/* 0x23C */ void* maskObjectSegment;
/* 0x240 */ SkelAnime skelAnime;
/* 0x284 */ SkelAnime unk_284;
/* 0x284 */ SkelAnime skelAnimeUpper;
/* 0x2C8 */ SkelAnime unk_2C8;
/* 0x30C */ Vec3s jointTable[5];
/* 0x32A */ Vec3s morphTable[5];
Expand Down Expand Up @@ -1176,8 +1176,8 @@ typedef struct Player {
/* 0x74C */ u8 jointTableBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0x7EB */ u8 morphTableBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0x88A */ u8 blendTableBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0x929 */ u8 unk_929[PLAYER_LIMB_BUF_SIZE];
/* 0x9C8 */ u8 unk_9C8[PLAYER_LIMB_BUF_SIZE];
/* 0x929 */ u8 jointTableUpperBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0x9C8 */ u8 morphTableUpperBuffer[PLAYER_LIMB_BUF_SIZE];
/* 0xA68 */ PlayerAgeProperties* ageProperties; // repurposed as "transformation properties"?
/* 0xA6C */ u32 stateFlags1;
/* 0xA70 */ u32 stateFlags2;
Expand Down Expand Up @@ -1206,7 +1206,7 @@ typedef struct Player {
/* 0xABC */ f32 unk_ABC;
/* 0xAC0 */ f32 unk_AC0;
/* 0xAC4 */ PlayerUpperActionFunc upperActionFunc; // Upper body/item action functions
/* 0xAC8 */ f32 unk_AC8;
/* 0xAC8 */ f32 skelAnimeUpperBlendWeight;
/* 0xACC */ s16 unk_ACC;
/* 0xACE */ s8 unk_ACE;
/* 0xACF */ u8 putAwayCountdown; // Frames to wait before showing "Put Away" on A
Expand Down
26 changes: 16 additions & 10 deletions src/code/z_player_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,12 @@ s32 func_801235DC(PlayState* play, f32 arg1, s16 arg2) {
return false;
}

ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
if (arg2 >= 4) {
ItemId Player_GetItemOnButton(PlayState* play, Player* player, EquipSlot slot) {
if (slot >= EQUIP_SLOT_A) {
return ITEM_NONE;
}

if (arg2 == 0) {
if (slot == EQUIP_SLOT_B) {
ItemId item = Inventory_GetBtnBItem(play);

if (item >= ITEM_FD) {
Expand All @@ -597,18 +597,24 @@ ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
return item;
}

if (arg2 == 1) {
if (slot == EQUIP_SLOT_C_LEFT) {
return C_BTN_ITEM(EQUIP_SLOT_C_LEFT);
}

if (arg2 == 2) {
if (slot == EQUIP_SLOT_C_DOWN) {
return C_BTN_ITEM(EQUIP_SLOT_C_DOWN);
}

// EQUIP_SLOT_C_RIGHT

return C_BTN_ITEM(EQUIP_SLOT_C_RIGHT);
}

u16 sCItemButtons[] = { BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT };
u16 sCItemButtons[] = {
BTN_CLEFT,
BTN_CDOWN,
BTN_CRIGHT,
};

PlayerItemAction func_80123810(PlayState* play) {
Player* player = GET_PLAYER(play);
Expand All @@ -630,7 +636,7 @@ PlayerItemAction func_80123810(PlayState* play) {
for (i = 0; i < ARRAY_COUNT(sCItemButtons); i++) {
if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, sCItemButtons[i])) {
i++;
itemId = func_8012364C(play, player, i);
itemId = Player_GetItemOnButton(play, player, i);

play->interfaceCtx.unk_222 = 0;
play->interfaceCtx.unk_224 = 0;
Expand Down Expand Up @@ -2092,7 +2098,7 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
EnArrow* bubble = NULL;

if (((player->skelAnime.animation == &gPlayerAnim_pn_drinkend)) ||
(player->unk_284.animation == &gPlayerAnim_pn_tamahaki) ||
(player->skelAnimeUpper.animation == &gPlayerAnim_pn_tamahaki) ||
((player->stateFlags3 & PLAYER_STATE3_40) && ((bubble = (EnArrow*)player->heldActor) != NULL))) {
Matrix_TranslateRotateZYX(pos, rot);
func_80125340();
Expand All @@ -2108,7 +2114,7 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
} else if (player->skelAnime.animation == &gPlayerAnim_pn_drinkend) {
func_80124618(D_801C03E0, player->skelAnime.curFrame, player->unk_AF0);
} else {
func_80124618(D_801C03C0, player->unk_284.curFrame, player->unk_AF0);
func_80124618(D_801C03C0, player->skelAnimeUpper.curFrame, player->unk_AF0);
}

Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY);
Expand Down Expand Up @@ -3784,7 +3790,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G
Matrix_MultVec3f(&sPlayerFocusHeadLimbModelPos, &player->actor.focus.pos);
Matrix_MultVec3f(&D_801C0E94, sPlayerCurBodyPartPos);
if ((player->skelAnime.animation == &gPlayerAnim_pn_drinkend) ||
(player->unk_284.animation == &gPlayerAnim_pn_tamahaki) ||
(player->skelAnimeUpper.animation == &gPlayerAnim_pn_tamahaki) ||
((player->stateFlags3 & PLAYER_STATE3_40) && ((spA8 = player->heldActor) != NULL))) {
if (spA8 != NULL) {
static Vec3f D_801C0EA0 = { 1300.0f, -400.0f, 0.0f };
Expand Down
Loading