mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-13 19:35:28 +00:00
Doc equips usage (inventory, current and player-specific constants) (#1142)
* Doc equips usage (inventory, current and player-specific constants) * Improve some comments * `currentSword`(`Item`) -> `currentSwordItemId` * Comments on the right in `D_801261F8` * Improve `sDebugSaveInventory.equipment` formatting with extra parentheses * Use constants for `sNewSaveInventory.equipment` * Run formatter * Make comments in z64save.h header a single line even if very long * `CHECK_OWNED_EQUIP_ALT` * One more use of `CHECK_OWNED_EQUIP` * `OWNED_EQUIP_FLAG` * `OWNED_EQUIP_FLAG_ALT` * Improve (?) giving sword by item id * "half-byte" -> "nibble" * Improve equips for setting kokiri sword * Improve (?) checking boots by item id * Improve (?) checking equips by item id * Fixup one spot assuming `EQUIP_TYPE_SWORD == 0` * Comments on the right in `sBootDListGroups`
This commit is contained in:
parent
72847660eb
commit
b9fded7b4e
27 changed files with 237 additions and 127 deletions
|
@ -443,9 +443,9 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
|
|||
REG(48) = 370;
|
||||
|
||||
currentBoots = this->currentBoots;
|
||||
if (currentBoots == PLAYER_BOOTS_NORMAL) {
|
||||
if (currentBoots == PLAYER_BOOTS_KOKIRI) {
|
||||
if (!LINK_IS_ADULT) {
|
||||
currentBoots = PLAYER_BOOTS_NORMAL_CHILD;
|
||||
currentBoots = PLAYER_BOOTS_KOKIRI_CHILD;
|
||||
}
|
||||
} else if (currentBoots == PLAYER_BOOTS_IRON) {
|
||||
if (this->stateFlags1 & PLAYER_STATE1_27) {
|
||||
|
@ -570,10 +570,10 @@ void func_8008EC70(Player* this) {
|
|||
|
||||
void Player_SetEquipmentData(GlobalContext* globalCtx, Player* this) {
|
||||
if (this->csMode != 0x56) {
|
||||
this->currentShield = CUR_EQUIP_VALUE(EQUIP_SHIELD);
|
||||
this->currentTunic = CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1;
|
||||
this->currentBoots = CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1;
|
||||
this->currentSword = B_BTN_ITEM;
|
||||
this->currentShield = SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD));
|
||||
this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
|
||||
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
|
||||
this->currentSwordItemId = B_BTN_ITEM;
|
||||
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
|
||||
Player_SetBootData(globalCtx, this);
|
||||
}
|
||||
|
@ -854,8 +854,8 @@ Color_RGB8 sGauntletColors[] = {
|
|||
};
|
||||
|
||||
Gfx* sBootDListGroups[][2] = {
|
||||
/* PLAYER_BOOTS_IRON */ { gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL },
|
||||
/* PLAYER_BOOTS_HOVER */ { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL },
|
||||
{ gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL }, // PLAYER_BOOTS_IRON
|
||||
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, // PLAYER_BOOTS_HOVER
|
||||
};
|
||||
|
||||
void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
|
||||
|
@ -915,8 +915,8 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl
|
|||
: gLinkAdultRightGauntletPlate3DL);
|
||||
}
|
||||
|
||||
if (boots != 0) {
|
||||
Gfx** bootDLists = sBootDListGroups[boots - 1];
|
||||
if (boots != PLAYER_BOOTS_KOKIRI) {
|
||||
Gfx** bootDLists = sBootDListGroups[boots - PLAYER_BOOTS_IRON];
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, bootDLists[0]);
|
||||
gSPDisplayList(POLY_OPA_DISP++, bootDLists[1]);
|
||||
|
@ -1637,14 +1637,18 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
|
|||
sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]);
|
||||
}
|
||||
|
||||
u8 D_801261F8[] = { PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_BGS };
|
||||
u8 D_801261F8[] = {
|
||||
PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_KOKIRI
|
||||
PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_MASTER
|
||||
PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BGS
|
||||
};
|
||||
|
||||
s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
void* arg) {
|
||||
u8* playerSwordAndShield = arg;
|
||||
//! @bug `playerSwordAndShield[0]` can be 0 (no sword), which indexes `D_801261F8[-1]`. The result
|
||||
//! @bug `playerSwordAndShield[0]` can be 0 (`PLAYER_SWORD_NONE`), which indexes `D_801261F8[-1]`. The result
|
||||
//! happens to be 0 (`PLAYER_MODELGROUP_0`) in vanilla, but weird values are likely to cause a crash
|
||||
u8 modelGroup = D_801261F8[playerSwordAndShield[0] - 1];
|
||||
u8 modelGroup = D_801261F8[playerSwordAndShield[0] - PLAYER_SWORD_KOKIRI];
|
||||
s32 type;
|
||||
s32 dListOffset = 0;
|
||||
Gfx** dLists;
|
||||
|
@ -1807,7 +1811,7 @@ void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnim
|
|||
srcTable = gLinkPauseChildJointTable;
|
||||
}
|
||||
} else {
|
||||
if (sword == 3) {
|
||||
if (sword == PLAYER_SWORD_BGS) {
|
||||
srcTable = gLinkPauseAdultBgsJointTable;
|
||||
} else if (shield != PLAYER_SHIELD_NONE) {
|
||||
srcTable = gLinkPauseAdultShieldJointTable;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue