2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2021-01-25 00:36:40 +00:00
|
|
|
#include "objects/gameplay_keep/gameplay_keep.h"
|
2021-12-27 13:08:26 +00:00
|
|
|
#include "objects/object_link_boy/object_link_boy.h"
|
2021-05-26 22:59:21 +00:00
|
|
|
#include "objects/object_link_child/object_link_child.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-05-20 00:15:48 +00:00
|
|
|
typedef struct {
|
2020-09-19 01:45:39 +00:00
|
|
|
/* 0x00 */ u8 flag;
|
|
|
|
/* 0x02 */ u16 textId;
|
|
|
|
} TextTriggerEntry; // size = 0x04
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
typedef struct {
|
|
|
|
/* 0x00 */ void* dList;
|
|
|
|
/* 0x04 */ Vec3f pos;
|
|
|
|
} BowStringData; // size = 0x10
|
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
FlexSkeletonHeader* gPlayerSkelHeaders[] = { &gLinkAdultSkel, &gLinkChildSkel };
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
s16 sBootData[PLAYER_BOOTS_MAX][17] = {
|
|
|
|
{ 200, 1000, 300, 700, 550, 270, 600, 350, 800, 600, -100, 600, 590, 750, 125, 200, 130 },
|
|
|
|
{ 200, 1000, 300, 700, 550, 270, 1000, 0, 800, 300, -160, 600, 590, 750, 125, 200, 130 },
|
|
|
|
{ 200, 1000, 300, 700, 550, 270, 600, 600, 800, 550, -100, 600, 540, 270, 25, 0, 130 },
|
|
|
|
{ 200, 1000, 300, 700, 380, 400, 0, 300, 800, 500, -100, 600, 590, 750, 125, 200, 130 },
|
|
|
|
{ 80, 800, 150, 700, 480, 270, 600, 50, 800, 550, -40, 400, 540, 270, 25, 0, 80 },
|
|
|
|
{ 200, 1000, 300, 800, 500, 400, 800, 400, 800, 550, -100, 600, 540, 750, 125, 400, 200 },
|
|
|
|
};
|
|
|
|
|
|
|
|
// Used to map action params to model groups
|
2022-03-20 22:42:01 +00:00
|
|
|
u8 sActionModelGroups[PLAYER_AP_MAX] = {
|
|
|
|
/* PLAYER_AP_NONE */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_LAST_USED */ PLAYER_MODELGROUP_15,
|
|
|
|
/* PLAYER_AP_FISHING_POLE */ PLAYER_MODELGROUP_10,
|
|
|
|
/* PLAYER_AP_SWORD_MASTER */ PLAYER_MODELGROUP_SWORD,
|
|
|
|
/* PLAYER_AP_SWORD_KOKIRI */ PLAYER_MODELGROUP_SWORD,
|
|
|
|
/* PLAYER_AP_SWORD_BGS */ PLAYER_MODELGROUP_BGS,
|
|
|
|
/* PLAYER_AP_STICK */ PLAYER_MODELGROUP_10,
|
|
|
|
/* PLAYER_AP_HAMMER */ PLAYER_MODELGROUP_HAMMER,
|
|
|
|
/* PLAYER_AP_BOW */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_BOW_FIRE */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_BOW_ICE */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_BOW_LIGHT */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_BOW_0C */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_BOW_0D */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_BOW_0E */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_SLINGSHOT */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_HOOKSHOT */ PLAYER_MODELGROUP_HOOKSHOT,
|
|
|
|
/* PLAYER_AP_LONGSHOT */ PLAYER_MODELGROUP_HOOKSHOT,
|
|
|
|
/* PLAYER_AP_BOMB */ PLAYER_MODELGROUP_EXPLOSIVES,
|
|
|
|
/* PLAYER_AP_BOMBCHU */ PLAYER_MODELGROUP_EXPLOSIVES,
|
|
|
|
/* PLAYER_AP_BOOMERANG */ PLAYER_MODELGROUP_BOOMERANG,
|
|
|
|
/* PLAYER_AP_MAGIC_SPELL_15 */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MAGIC_SPELL_16 */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MAGIC_SPELL_17 */ PLAYER_MODELGROUP_BOW_SLINGSHOT,
|
|
|
|
/* PLAYER_AP_FARORES_WIND */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_NAYRUS_LOVE */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_DINS_FIRE */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_NUT */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_OCARINA_FAIRY */ PLAYER_MODELGROUP_OCARINA,
|
|
|
|
/* PLAYER_AP_OCARINA_TIME */ PLAYER_MODELGROUP_OOT,
|
|
|
|
/* PLAYER_AP_BOTTLE */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_FISH */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_FIRE */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_BUG */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_POE */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_BIG_POE */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_LETTER */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_POTION_RED */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_POTION_BLUE */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_POTION_GREEN */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_MILK */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_MILK_HALF */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_BOTTLE_FAIRY */ PLAYER_MODELGROUP_BOTTLE,
|
|
|
|
/* PLAYER_AP_LETTER_ZELDA */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_WEIRD_EGG */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_CHICKEN */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_BEAN */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_POCKET_EGG */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_POCKET_CUCCO */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_COJIRO */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_ODD_MUSHROOM */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_ODD_POTION */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_SAW */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_SWORD_BROKEN */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_PRESCRIPTION */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_FROG */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_EYEDROPS */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_CLAIM_CHECK */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_KEATON */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_SKULL */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_SPOOKY */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_BUNNY */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_GORON */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_ZORA */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_GERUDO */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_MASK_TRUTH */ PLAYER_MODELGROUP_DEFAULT,
|
|
|
|
/* PLAYER_AP_LENS */ PLAYER_MODELGROUP_DEFAULT,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
TextTriggerEntry sTextTriggers[] = {
|
|
|
|
{ 1, 0x3040 },
|
|
|
|
{ 2, 0x401D },
|
|
|
|
{ 0, 0x0000 },
|
|
|
|
{ 2, 0x401D },
|
|
|
|
};
|
|
|
|
|
|
|
|
// Used to map model groups to model types for [animation, left hand, right hand, sheath, waist]
|
2022-03-20 22:42:01 +00:00
|
|
|
u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX] = {
|
|
|
|
/* PLAYER_MODELGROUP_0 */
|
|
|
|
{ PLAYER_ANIMTYPE_2, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_SHIELD, PLAYER_MODELTYPE_SHEATH_16,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD */
|
|
|
|
{ PLAYER_ANIMTYPE_1, PLAYER_MODELTYPE_LH_SWORD, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_19,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_SWORD */
|
|
|
|
{ PLAYER_ANIMTYPE_1, PLAYER_MODELTYPE_LH_SWORD, PLAYER_MODELTYPE_RH_SHIELD, PLAYER_MODELTYPE_SHEATH_17,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_DEFAULT */
|
|
|
|
{ PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_4 */
|
|
|
|
{ PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_BGS */
|
|
|
|
{ PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_BGS, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_19,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_BOW_SLINGSHOT */
|
|
|
|
{ PLAYER_ANIMTYPE_4, PLAYER_MODELTYPE_LH_CLOSED, PLAYER_MODELTYPE_RH_BOW_SLINGSHOT, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_EXPLOSIVES */
|
|
|
|
{ PLAYER_ANIMTYPE_5, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_BOOMERANG */
|
|
|
|
{ PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_BOOMERANG, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_HOOKSHOT */
|
|
|
|
{ PLAYER_ANIMTYPE_4, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_HOOKSHOT, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_10 */
|
|
|
|
{ PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_CLOSED, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_HAMMER */
|
|
|
|
{ PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_HAMMER, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_OCARINA */
|
|
|
|
{ PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OCARINA, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_OOT */
|
|
|
|
{ PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OOT, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_BOTTLE */
|
|
|
|
{ PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_BOTTLE, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_18,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
|
|
|
/* PLAYER_MODELGROUP_15 */
|
|
|
|
{ PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_SWORD, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_19,
|
|
|
|
PLAYER_MODELTYPE_WAIST },
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
Gfx* D_80125CE8[PLAYER_SHIELD_MAX * 4] = {
|
|
|
|
// PLAYER_SHIELD_NONE
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandClosedNearDL,
|
|
|
|
gLinkChildRightHandClosedNearDL,
|
|
|
|
gLinkAdultRightHandClosedFarDL,
|
|
|
|
gLinkChildRightHandClosedFarDL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_DEKU
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandClosedNearDL,
|
|
|
|
gLinkChildRightFistAndDekuShieldNearDL,
|
|
|
|
gLinkAdultRightHandClosedFarDL,
|
|
|
|
gLinkChildRightFistAndDekuShieldFarDL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_HYLIAN
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingHylianShieldNearDL,
|
|
|
|
gLinkChildRightHandClosedNearDL,
|
|
|
|
gLinkAdultRightHandHoldingHylianShieldFarDL,
|
|
|
|
gLinkChildRightHandClosedFarDL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_MIRROR
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingMirrorShieldNearDL,
|
|
|
|
gLinkChildRightHandClosedNearDL,
|
|
|
|
gLinkAdultRightHandHoldingMirrorShieldFarDL,
|
|
|
|
gLinkChildRightHandClosedFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
Gfx* D_80125D28[PLAYER_SHIELD_MAX * 4] = {
|
|
|
|
// PLAYER_SHIELD_NONE
|
|
|
|
gLinkAdultMasterSwordAndSheathNearDL,
|
|
|
|
gLinkChildSwordAndSheathNearDL,
|
|
|
|
gLinkAdultMasterSwordAndSheathFarDL,
|
|
|
|
gLinkChildSwordAndSheathFarDL,
|
|
|
|
// PLAYER_SHIELD_DEKU
|
|
|
|
gLinkAdultMasterSwordAndSheathNearDL,
|
|
|
|
gLinkChildDekuShieldSwordAndSheathNearDL,
|
|
|
|
gLinkAdultMasterSwordAndSheathFarDL,
|
|
|
|
gLinkChildDekuShieldSwordAndSheathFarDL,
|
|
|
|
// PLAYER_SHIELD_HYLIAN
|
|
|
|
gLinkAdultHylianShieldSwordAndSheathNearDL,
|
|
|
|
gLinkChildHylianShieldSwordAndSheathNearDL,
|
|
|
|
gLinkAdultHylianShieldSwordAndSheathFarDL,
|
|
|
|
gLinkChildHylianShieldSwordAndSheathFarDL,
|
|
|
|
// PLAYER_SHIELD_MIRROR
|
|
|
|
gLinkAdultMirrorShieldSwordAndSheathNearDL,
|
|
|
|
gLinkChildSwordAndSheathNearDL,
|
|
|
|
gLinkAdultMirrorShieldSwordAndSheathFarDL,
|
|
|
|
gLinkChildSwordAndSheathFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125D68[] = {
|
2021-05-26 22:59:21 +00:00
|
|
|
NULL, NULL, NULL, NULL, NULL, gLinkChildDekuShieldWithMatrixDL, NULL, gLinkChildDekuShieldWithMatrixDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
Gfx* D_80125D88[(PLAYER_SHIELD_MAX + 2) * 4] = {
|
|
|
|
// PLAYER_SHIELD_NONE
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultSheathNearDL,
|
|
|
|
gLinkChildSheathNearDL,
|
|
|
|
gLinkAdultSheathFarDL,
|
|
|
|
gLinkChildSheathFarDL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_DEKU
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultSheathNearDL,
|
|
|
|
gLinkChildDekuShieldAndSheathNearDL,
|
|
|
|
gLinkAdultSheathFarDL,
|
|
|
|
gLinkChildDekuShieldAndSheathFarDL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_HYLIAN
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultHylianShieldAndSheathNearDL,
|
|
|
|
gLinkChildHylianShieldAndSheathNearDL,
|
|
|
|
gLinkAdultHylianShieldAndSheathFarDL,
|
|
|
|
gLinkChildHylianShieldAndSheathFarDL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_MIRROR
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultMirrorShieldAndSheathNearDL,
|
|
|
|
gLinkChildSheathNearDL,
|
|
|
|
gLinkAdultMirrorShieldAndSheathFarDL,
|
|
|
|
gLinkChildSheathFarDL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_NONE (child, no sword)
|
2021-12-27 13:08:26 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2022-03-20 22:42:01 +00:00
|
|
|
// PLAYER_SHIELD_DEKU (child, no sword)
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultSheathNearDL,
|
|
|
|
gLinkChildDekuShieldWithMatrixDL,
|
|
|
|
gLinkAdultSheathNearDL,
|
|
|
|
gLinkChildDekuShieldWithMatrixDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125DE8[] = {
|
2022-03-20 22:42:01 +00:00
|
|
|
// biggoron sword
|
|
|
|
gLinkAdultLeftHandHoldingBgsNearDL,
|
|
|
|
gLinkChildLeftHandHoldingMasterSwordDL,
|
|
|
|
gLinkAdultLeftHandHoldingBgsFarDL,
|
|
|
|
gLinkChildLeftHandHoldingMasterSwordDL,
|
|
|
|
// broken giant knife
|
|
|
|
gLinkAdultHandHoldingBrokenGiantsKnifeDL,
|
|
|
|
gLinkChildLeftHandHoldingMasterSwordDL,
|
|
|
|
gLinkAdultHandHoldingBrokenGiantsKnifeFarDL,
|
|
|
|
gLinkChildLeftHandHoldingMasterSwordDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E08[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftHandNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftHandFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E18[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandClosedNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandClosedFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E28[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandHoldingMasterSwordNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistAndKokiriSwordNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandHoldingMasterSwordFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistAndKokiriSwordFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E38[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandHoldingMasterSwordNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistAndKokiriSwordNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandHoldingMasterSwordFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistAndKokiriSwordFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E48[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E58[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandClosedNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandClosedNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandClosedFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandClosedFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E68[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingBowNearDL,
|
|
|
|
gLinkChildRightHandHoldingSlingshotNearDL,
|
|
|
|
gLinkAdultRightHandHoldingBowFarDL,
|
|
|
|
gLinkChildRightHandHoldingSlingshotFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E78[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultMasterSwordAndSheathNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildSwordAndSheathNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultMasterSwordAndSheathFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildSwordAndSheathFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E88[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultSheathNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildSheathNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultSheathFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildSheathFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125E98[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultWaistNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildWaistNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultWaistFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildWaistFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125EA8[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingBowNearDL,
|
|
|
|
gLinkChildRightHandHoldingSlingshotNearDL,
|
|
|
|
gLinkAdultRightHandHoldingBowFarDL,
|
|
|
|
gLinkChildRightHandHoldingSlingshotFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125EB8[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingOotNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandHoldingFairyOcarinaNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingOotFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandHoldingFairyOcarinaFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125EC8[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingOotNearDL,
|
|
|
|
gLinkChildRightHandAndOotNearDL,
|
|
|
|
gLinkAdultRightHandHoldingOotFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandHoldingOOTFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125ED8[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingHookshotNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingHookshotNearDL, // The 'far' display list exists but is not used
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightHandFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125EE8[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandHoldingHammerNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftHandNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandHoldingHammerFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftHandFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125EF8[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistAndBoomerangNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandFarDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftFistAndBoomerangFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125F08[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandOutNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftHandUpNearDL,
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftHandOutNearDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildLeftHandUpNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
Gfx* sArmOutDLs[] = {
|
|
|
|
gLinkAdultRightArmOutNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
Gfx* sHandOutDLs[] = {
|
|
|
|
gLinkAdultRightHandOutNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
Gfx* sRightShoulderNearDLs[] = {
|
|
|
|
gLinkAdultRightShoulderNearDL,
|
|
|
|
gLinkChildRightShoulderNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* D_80125F30[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftArmOutNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
Gfx* sHoldingFirstPersonWeaponDLs[] = {
|
|
|
|
gLinkAdultRightHandHoldingBowFirstPersonDL,
|
2021-05-26 22:59:21 +00:00
|
|
|
gLinkChildRightArmStretchedSlingshotDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Indexed by model types (left hand, right hand, sheath or waist)
|
2022-03-20 22:42:01 +00:00
|
|
|
Gfx** sPlayerDListGroups[PLAYER_MODELTYPE_MAX] = {
|
|
|
|
/* PLAYER_MODELTYPE_LH_OPEN */ D_80125E08,
|
|
|
|
/* PLAYER_MODELTYPE_LH_CLOSED */ D_80125E18,
|
|
|
|
/* PLAYER_MODELTYPE_LH_SWORD */ D_80125E38,
|
|
|
|
/* PLAYER_MODELTYPE_3 */ D_80125E28,
|
|
|
|
/* PLAYER_MODELTYPE_LH_BGS */ D_80125DE8,
|
|
|
|
/* PLAYER_MODELTYPE_LH_HAMMER */ D_80125EE8,
|
|
|
|
/* PLAYER_MODELTYPE_LH_BOOMERANG */ D_80125EF8,
|
|
|
|
/* PLAYER_MODELTYPE_LH_BOTTLE */ D_80125F08,
|
|
|
|
/* PLAYER_MODELTYPE_RH_OPEN */ D_80125E48,
|
|
|
|
/* PLAYER_MODELTYPE_RH_CLOSED */ D_80125E58,
|
|
|
|
/* PLAYER_MODELTYPE_RH_SHIELD */ D_80125CE8,
|
|
|
|
/* PLAYER_MODELTYPE_RH_BOW_SLINGSHOT */ D_80125E68,
|
|
|
|
/* PLAYER_MODELTYPE_12 */ D_80125EA8,
|
|
|
|
/* PLAYER_MODELTYPE_RH_OCARINA */ D_80125EB8,
|
|
|
|
/* PLAYER_MODELTYPE_RH_OOT */ D_80125EC8,
|
|
|
|
/* PLAYER_MODELTYPE_RH_HOOKSHOT */ D_80125ED8,
|
|
|
|
/* PLAYER_MODELTYPE_SHEATH_16 */ D_80125E78,
|
|
|
|
/* PLAYER_MODELTYPE_SHEATH_17 */ D_80125E88,
|
|
|
|
/* PLAYER_MODELTYPE_SHEATH_18 */ D_80125D28,
|
|
|
|
/* PLAYER_MODELTYPE_SHEATH_19 */ D_80125D88,
|
|
|
|
/* PLAYER_MODELTYPE_WAIST */ D_80125E98,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Gfx gCullBackDList[] = {
|
|
|
|
gsSPSetGeometryMode(G_CULL_BACK),
|
|
|
|
gsSPEndDisplayList(),
|
|
|
|
};
|
|
|
|
|
|
|
|
Gfx gCullFrontDList[] = {
|
|
|
|
gsSPSetGeometryMode(G_CULL_FRONT),
|
|
|
|
gsSPEndDisplayList(),
|
|
|
|
};
|
|
|
|
|
2022-03-09 00:50:27 +00:00
|
|
|
Vec3f* sCurBodyPartPos;
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 sDListsLodOffset;
|
|
|
|
Vec3f sGetItemRefPos;
|
2022-03-20 22:42:01 +00:00
|
|
|
s32 sLeftHandType;
|
|
|
|
s32 sRightHandType;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
|
2020-05-20 00:15:48 +00:00
|
|
|
s32 currentBoots;
|
2020-09-19 01:45:39 +00:00
|
|
|
s16* bootRegs;
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
REG(27) = 2000;
|
|
|
|
REG(48) = 370;
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
currentBoots = this->currentBoots;
|
|
|
|
if (currentBoots == PLAYER_BOOTS_NORMAL) {
|
2021-08-21 23:12:57 +00:00
|
|
|
if (!LINK_IS_ADULT) {
|
2020-09-19 01:45:39 +00:00
|
|
|
currentBoots = PLAYER_BOOTS_NORMAL_CHILD;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (currentBoots == PLAYER_BOOTS_IRON) {
|
2022-01-18 00:04:07 +00:00
|
|
|
if (this->stateFlags1 & PLAYER_STATE1_27) {
|
2020-09-19 01:45:39 +00:00
|
|
|
currentBoots = PLAYER_BOOTS_IRON_UNDERWATER;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
REG(27) = 500;
|
|
|
|
REG(48) = 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
bootRegs = sBootData[currentBoots];
|
|
|
|
REG(19) = bootRegs[0];
|
|
|
|
REG(30) = bootRegs[1];
|
|
|
|
REG(32) = bootRegs[2];
|
|
|
|
REG(34) = bootRegs[3];
|
|
|
|
REG(35) = bootRegs[4];
|
|
|
|
REG(36) = bootRegs[5];
|
|
|
|
REG(37) = bootRegs[6];
|
|
|
|
REG(38) = bootRegs[7];
|
|
|
|
REG(43) = bootRegs[8];
|
|
|
|
REG(45) = bootRegs[9];
|
|
|
|
REG(68) = bootRegs[10];
|
|
|
|
REG(69) = bootRegs[11];
|
|
|
|
IREG(66) = bootRegs[12];
|
|
|
|
IREG(67) = bootRegs[13];
|
|
|
|
IREG(68) = bootRegs[14];
|
|
|
|
IREG(69) = bootRegs[15];
|
|
|
|
MREG(95) = bootRegs[16];
|
|
|
|
|
2020-05-20 00:15:48 +00:00
|
|
|
if (globalCtx->roomCtx.curRoom.unk_03 == 2) {
|
2020-09-19 01:45:39 +00:00
|
|
|
REG(45) = 500;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) {
|
2022-01-18 00:04:07 +00:00
|
|
|
return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) ||
|
|
|
|
(globalCtx->sceneLoadFlag == 0x14) || (this->stateFlags1 & PLAYER_STATE1_0) ||
|
|
|
|
(this->stateFlags3 & PLAYER_STATE3_7) ||
|
2020-09-19 01:45:39 +00:00
|
|
|
((gSaveContext.unk_13F0 != 0) && (Player_ActionToMagicSpell(this, this->itemActionParam) >= 0));
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_InCsMode(GlobalContext* globalCtx) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
return Player_InBlockingCsMode(globalCtx, this) || (this->unk_6AD == 4);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 func_8008E9C4(Player* this) {
|
2022-01-18 00:04:07 +00:00
|
|
|
return (this->stateFlags1 & PLAYER_STATE1_4);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_IsChildWithHylianShield(Player* this) {
|
2022-01-25 00:08:37 +00:00
|
|
|
return gSaveContext.linkAge != LINK_AGE_ADULT && (this->currentShield == PLAYER_SHIELD_HYLIAN);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
|
|
|
|
s32 modelGroup = sActionModelGroups[actionParam];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if ((modelGroup == PLAYER_MODELGROUP_SWORD) && Player_IsChildWithHylianShield(this)) {
|
|
|
|
// child, using kokiri sword with hylian shield equipped
|
|
|
|
return PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD;
|
2020-05-20 00:15:48 +00:00
|
|
|
} else {
|
2020-09-19 01:45:39 +00:00
|
|
|
return modelGroup;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void Player_SetModelsForHoldingShield(Player* this) {
|
2022-01-18 00:04:07 +00:00
|
|
|
if ((this->stateFlags1 & PLAYER_STATE1_22) &&
|
2020-09-19 01:45:39 +00:00
|
|
|
((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) {
|
|
|
|
if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) {
|
2022-03-20 22:42:01 +00:00
|
|
|
this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD;
|
|
|
|
this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][(void)0, gSaveContext.linkAge];
|
|
|
|
if (this->sheathType == PLAYER_MODELTYPE_SHEATH_18) {
|
|
|
|
this->sheathType = PLAYER_MODELTYPE_SHEATH_16;
|
|
|
|
} else if (this->sheathType == PLAYER_MODELTYPE_SHEATH_19) {
|
|
|
|
this->sheathType = PLAYER_MODELTYPE_SHEATH_17;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
this->sheathDLists = &sPlayerDListGroups[this->sheathType][(void)0, gSaveContext.linkAge];
|
2022-03-20 22:42:01 +00:00
|
|
|
this->modelAnimType = PLAYER_ANIMTYPE_2;
|
2020-09-19 01:45:39 +00:00
|
|
|
this->itemActionParam = -1;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void Player_SetModels(Player* this, s32 modelGroup) {
|
2022-03-20 22:42:01 +00:00
|
|
|
this->leftHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND];
|
|
|
|
this->rightHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND];
|
|
|
|
this->sheathType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH];
|
|
|
|
|
|
|
|
this->leftHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND]]
|
|
|
|
[(void)0, gSaveContext.linkAge];
|
|
|
|
this->rightHandDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]]
|
|
|
|
[(void)0, gSaveContext.linkAge];
|
|
|
|
this->sheathDLists = &sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]]
|
|
|
|
[(void)0, gSaveContext.linkAge];
|
|
|
|
this->waistDLists =
|
|
|
|
&sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_WAIST]][(void)0, gSaveContext.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
Player_SetModelsForHoldingShield(this);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void Player_SetModelGroup(Player* this, s32 modelGroup) {
|
|
|
|
this->modelGroup = modelGroup;
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if (modelGroup == PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD) {
|
|
|
|
this->modelAnimType = PLAYER_ANIMTYPE_0;
|
2020-05-20 00:15:48 +00:00
|
|
|
} else {
|
2022-03-20 22:42:01 +00:00
|
|
|
this->modelAnimType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_ANIM];
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if ((this->modelAnimType < PLAYER_ANIMTYPE_3) && (this->currentShield == PLAYER_SHIELD_NONE)) {
|
|
|
|
this->modelAnimType = PLAYER_ANIMTYPE_0;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
Player_SetModels(this, modelGroup);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void func_8008EC70(Player* this) {
|
|
|
|
this->itemActionParam = this->heldItemActionParam;
|
|
|
|
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
|
|
|
|
this->unk_6AD = 0;
|
|
|
|
}
|
2020-06-14 03:29:59 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
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;
|
|
|
|
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
|
|
|
|
Player_SetBootData(globalCtx, this);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* this, s32 item, s32 actionParam) {
|
|
|
|
Inventory_UpdateBottleItem(globalCtx, item, this->heldItemButton);
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (item != ITEM_BOTTLE) {
|
2020-09-19 01:45:39 +00:00
|
|
|
this->heldItemId = item;
|
|
|
|
this->heldItemActionParam = actionParam;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
this->itemActionParam = actionParam;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void func_8008EDF0(Player* this) {
|
|
|
|
this->unk_664 = NULL;
|
2022-01-18 00:04:07 +00:00
|
|
|
this->stateFlags2 &= ~PLAYER_STATE2_13;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void func_8008EE08(Player* this) {
|
2022-02-19 02:16:19 +00:00
|
|
|
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ||
|
2022-01-18 00:04:07 +00:00
|
|
|
(this->stateFlags1 & (PLAYER_STATE1_21 | PLAYER_STATE1_23 | PLAYER_STATE1_27)) ||
|
|
|
|
(!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19)) &&
|
|
|
|
((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) {
|
|
|
|
this->stateFlags1 &= ~(PLAYER_STATE1_15 | PLAYER_STATE1_16 | PLAYER_STATE1_17 | PLAYER_STATE1_18 |
|
|
|
|
PLAYER_STATE1_19 | PLAYER_STATE1_30);
|
|
|
|
} else if (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_21))) {
|
|
|
|
this->stateFlags1 |= PLAYER_STATE1_19;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
func_8008EDF0(this);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
func_8008EE08(this);
|
|
|
|
this->unk_664 = actor;
|
|
|
|
this->unk_684 = actor;
|
2022-01-18 00:04:07 +00:00
|
|
|
this->stateFlags1 |= PLAYER_STATE1_16;
|
2020-09-19 01:45:39 +00:00
|
|
|
Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, actor);
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), 2);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
|
2020-07-12 23:12:18 +00:00
|
|
|
s32 func_8008EF30(GlobalContext* globalCtx) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
return (this->stateFlags1 & PLAYER_STATE1_23);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) {
|
2020-12-11 22:38:23 +00:00
|
|
|
globalCtx->shootingGalleryStatus = ammo + 1;
|
2020-03-17 04:31:30 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRange, f32 yRange) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-05-20 00:15:48 +00:00
|
|
|
Vec3f diff;
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 pad;
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_860 != 0)) {
|
2022-02-20 23:45:12 +00:00
|
|
|
Math_Vec3f_Diff(&this->meleeWeaponInfo[0].tip, pos, &diff);
|
2020-09-19 01:45:39 +00:00
|
|
|
return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange);
|
2020-05-20 00:15:48 +00:00
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_GetStrength(void) {
|
|
|
|
s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-05-20 00:15:48 +00:00
|
|
|
if (LINK_IS_ADULT) {
|
2020-09-19 01:45:39 +00:00
|
|
|
return strengthUpgrade;
|
|
|
|
} else if (strengthUpgrade != 0) {
|
|
|
|
return PLAYER_STR_BRACELET;
|
2020-05-20 00:15:48 +00:00
|
|
|
} else {
|
2020-09-19 01:45:39 +00:00
|
|
|
return PLAYER_STR_NONE;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
u8 Player_GetMask(GlobalContext* globalCtx) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
return this->currentMask;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
Player* Player_UnsetMask(GlobalContext* globalCtx) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
this->currentMask = PLAYER_MASK_NONE;
|
|
|
|
|
|
|
|
return this;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
return (this->currentShield == PLAYER_SHIELD_MIRROR);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) {
|
|
|
|
s32 magicSpell = actionParam - PLAYER_AP_MAGIC_SPELL_15;
|
|
|
|
|
|
|
|
if ((magicSpell >= 0) && (magicSpell < 6)) {
|
|
|
|
return magicSpell;
|
|
|
|
} else {
|
|
|
|
return -1;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_HoldsHookshot(Player* this) {
|
|
|
|
return (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) || (this->heldItemActionParam == PLAYER_AP_LONGSHOT);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 func_8008F128(Player* this) {
|
|
|
|
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
s32 Player_ActionToMeleeWeapon(s32 actionParam) {
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 sword = actionParam - PLAYER_AP_FISHING_POLE;
|
|
|
|
|
|
|
|
if ((sword > 0) && (sword < 6)) {
|
|
|
|
return sword;
|
|
|
|
} else {
|
|
|
|
return 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
s32 Player_GetMeleeWeaponHeld(Player* this) {
|
|
|
|
return Player_ActionToMeleeWeapon(this->heldItemActionParam);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_HoldsTwoHandedWeapon(Player* this) {
|
|
|
|
if ((this->heldItemActionParam >= PLAYER_AP_SWORD_BGS) && (this->heldItemActionParam <= PLAYER_AP_HAMMER)) {
|
2020-03-17 04:31:30 +00:00
|
|
|
return 1;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
|
|
|
return 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_HoldsBrokenKnife(Player* this) {
|
|
|
|
return (this->heldItemActionParam == PLAYER_AP_SWORD_BGS) && (gSaveContext.swordHealth <= 0.0f);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_ActionToBottle(Player* this, s32 actionParam) {
|
|
|
|
s32 bottle = actionParam - PLAYER_AP_BOTTLE;
|
|
|
|
|
|
|
|
if ((bottle >= 0) && (bottle < 13)) {
|
|
|
|
return bottle;
|
|
|
|
} else {
|
|
|
|
return -1;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_GetBottleHeld(Player* this) {
|
|
|
|
return Player_ActionToBottle(this, this->heldItemActionParam);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_ActionToExplosive(Player* this, s32 actionParam) {
|
|
|
|
s32 explosive = actionParam - PLAYER_AP_BOMB;
|
|
|
|
|
|
|
|
if ((explosive >= 0) && (explosive < 2)) {
|
|
|
|
return explosive;
|
|
|
|
} else {
|
|
|
|
return -1;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_GetExplosiveHeld(Player* this) {
|
|
|
|
return Player_ActionToExplosive(this, this->heldItemActionParam);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 func_8008F2BC(Player* this, s32 actionParam) {
|
|
|
|
s32 sword = 0;
|
|
|
|
|
|
|
|
if (actionParam != PLAYER_AP_LAST_USED) {
|
|
|
|
sword = actionParam - PLAYER_AP_SWORD_MASTER;
|
|
|
|
if ((sword < 0) || (sword >= 3)) {
|
|
|
|
goto return_neg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sword;
|
|
|
|
|
|
|
|
return_neg:
|
|
|
|
return -1;
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-05-20 00:15:48 +00:00
|
|
|
s32 func_8008F2F8(GlobalContext* globalCtx) {
|
2021-08-31 10:22:03 +00:00
|
|
|
Player* this = GET_PLAYER(globalCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
TextTriggerEntry* triggerEntry;
|
|
|
|
s32 var;
|
|
|
|
|
|
|
|
if (globalCtx->roomCtx.curRoom.unk_02 == 3) { // Room is hot
|
|
|
|
var = 0;
|
|
|
|
} else if ((this->unk_840 > 80) &&
|
|
|
|
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater
|
2022-02-19 02:16:19 +00:00
|
|
|
var = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) ? 1 : 3;
|
2022-01-18 00:04:07 +00:00
|
|
|
} else if (this->stateFlags1 & PLAYER_STATE1_27) { // Swimming
|
2020-09-19 01:45:39 +00:00
|
|
|
var = 2;
|
2020-05-20 00:15:48 +00:00
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
// Trigger general textboxes under certain conditions, like "It's so hot in here!"
|
|
|
|
if (!Player_InCsMode(globalCtx)) {
|
|
|
|
triggerEntry = &sTextTriggers[var];
|
|
|
|
|
|
|
|
if (0) {}
|
|
|
|
|
|
|
|
if ((triggerEntry->flag != 0) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) &&
|
|
|
|
(((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON)) ||
|
|
|
|
(((var == 1) || (var == 3)) && (this->currentBoots == PLAYER_BOOTS_IRON) &&
|
|
|
|
(this->currentTunic != PLAYER_TUNIC_ZORA)))) {
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
Message_StartTextbox(globalCtx, triggerEntry->textId, NULL);
|
2020-09-19 01:45:39 +00:00
|
|
|
gSaveContext.textTriggerFlags |= triggerEntry->flag;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
return var + 1;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-04-03 22:33:50 +00:00
|
|
|
u8 sEyeMouthIndices[][2] = {
|
2020-09-19 01:45:39 +00:00
|
|
|
{ 0, 0 }, { 1, 0 }, { 2, 0 }, { 0, 0 }, { 1, 0 }, { 2, 0 }, { 4, 0 }, { 5, 1 },
|
|
|
|
{ 7, 2 }, { 0, 2 }, { 3, 0 }, { 4, 0 }, { 2, 2 }, { 1, 1 }, { 0, 2 }, { 0, 0 },
|
|
|
|
};
|
|
|
|
|
2021-05-26 22:59:21 +00:00
|
|
|
/**
|
|
|
|
* Link's eye and mouth textures are placed at the exact same place in adult and child Link's respective object files.
|
|
|
|
* This allows the array to only contain the symbols for one file and have it apply to both. This is a problem for
|
|
|
|
* shiftability, and changes will need to be made in the code to account for this in a modding scenario. The symbols
|
|
|
|
* from adult Link's object are used here.
|
|
|
|
*/
|
2022-02-19 21:50:56 +00:00
|
|
|
#ifndef AVOID_UB
|
2021-05-26 22:59:21 +00:00
|
|
|
void* sEyeTextures[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultEyesOpenTex, gLinkAdultEyesHalfTex, gLinkAdultEyesClosedfTex, gLinkAdultEyesRollLeftTex,
|
|
|
|
gLinkAdultEyesRollRightTex, gLinkAdultEyesShockTex, gLinkAdultEyesUnk1Tex, gLinkAdultEyesUnk2Tex,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2021-05-26 22:59:21 +00:00
|
|
|
void* sMouthTextures[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultMouth1Tex,
|
|
|
|
gLinkAdultMouth2Tex,
|
|
|
|
gLinkAdultMouth3Tex,
|
|
|
|
gLinkAdultMouth4Tex,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
2022-02-19 21:50:56 +00:00
|
|
|
#else
|
|
|
|
// Defining `AVOID_UB` will use a 2D array instead and properly use the child link pointers to allow for shifting.
|
|
|
|
void* sEyeTextures[][8] = {
|
|
|
|
{ gLinkAdultEyesOpenTex, gLinkAdultEyesHalfTex, gLinkAdultEyesClosedfTex, gLinkAdultEyesRollLeftTex,
|
|
|
|
gLinkAdultEyesRollRightTex, gLinkAdultEyesShockTex, gLinkAdultEyesUnk1Tex, gLinkAdultEyesUnk2Tex },
|
|
|
|
{ gLinkChildEyesOpenTex, gLinkChildEyesHalfTex, gLinkChildEyesClosedfTex, gLinkChildEyesRollLeftTex,
|
|
|
|
gLinkChildEyesRollRightTex, gLinkChildEyesShockTex, gLinkChildEyesUnk1Tex, gLinkChildEyesUnk2Tex },
|
|
|
|
};
|
|
|
|
|
|
|
|
void* sMouthTextures[][4] = {
|
|
|
|
{ gLinkAdultMouth1Tex, gLinkAdultMouth2Tex, gLinkAdultMouth3Tex, gLinkAdultMouth4Tex },
|
|
|
|
{ gLinkChildMouth1Tex, gLinkChildMouth2Tex, gLinkChildMouth3Tex, gLinkChildMouth4Tex },
|
|
|
|
};
|
|
|
|
#endif
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
Color_RGB8 sTunicColors[PLAYER_TUNIC_MAX] = {
|
|
|
|
{ 30, 105, 27 }, // PLAYER_TUNIC_KOKIRI
|
|
|
|
{ 100, 20, 0 }, // PLAYER_TUNIC_GORON
|
|
|
|
{ 0, 60, 100 }, // PLAYER_TUNIC_ZORA
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Color_RGB8 sGauntletColors[] = {
|
|
|
|
{ 255, 255, 255 },
|
|
|
|
{ 254, 207, 15 },
|
|
|
|
};
|
|
|
|
|
|
|
|
Gfx* sBootDListGroups[][2] = {
|
2022-03-20 22:42:01 +00:00
|
|
|
/* PLAYER_BOOTS_IRON */ { gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL },
|
|
|
|
/* PLAYER_BOOTS_HOVER */ { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL },
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
|
|
|
|
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
|
|
|
|
void* data) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Color_RGB8* color;
|
2020-12-29 22:46:46 +00:00
|
|
|
s32 eyeIndex = (jointTable[22].x & 0xF) - 1;
|
|
|
|
s32 mouthIndex = (jointTable[22].x >> 4) - 1;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 1721);
|
|
|
|
|
|
|
|
if (eyeIndex < 0) {
|
2022-04-03 22:33:50 +00:00
|
|
|
eyeIndex = sEyeMouthIndices[face][0];
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-02-19 21:50:56 +00:00
|
|
|
#ifndef AVOID_UB
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[eyeIndex]));
|
2022-02-19 21:50:56 +00:00
|
|
|
#else
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[gSaveContext.linkAge][eyeIndex]));
|
|
|
|
#endif
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
if (mouthIndex < 0) {
|
2022-04-03 22:33:50 +00:00
|
|
|
mouthIndex = sEyeMouthIndices[face][1];
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-02-19 21:50:56 +00:00
|
|
|
#ifndef AVOID_UB
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[mouthIndex]));
|
2022-02-19 21:50:56 +00:00
|
|
|
#else
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[gSaveContext.linkAge][mouthIndex]));
|
|
|
|
#endif
|
2020-04-19 15:57:38 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
color = &sTunicColors[tunic];
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
sDListsLodOffset = lod * 2;
|
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
SkelAnime_DrawFlexLod(globalCtx, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
if ((overrideLimbDraw != Player_OverrideLimbDrawGameplayFirstPerson) &&
|
|
|
|
(overrideLimbDraw != Player_OverrideLimbDrawGameplay_80090440) && (gSaveContext.gameMode != 3)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (LINK_IS_ADULT) {
|
|
|
|
s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH);
|
|
|
|
|
2021-10-03 03:17:09 +00:00
|
|
|
if (strengthUpgrade >= 2) { // silver or gold gauntlets
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-10-03 03:17:09 +00:00
|
|
|
color = &sGauntletColors[strengthUpgrade - 2];
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultLeftGauntletPlate1DL);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultRightGauntletPlate1DL);
|
2022-03-20 22:42:01 +00:00
|
|
|
gSPDisplayList(POLY_OPA_DISP++, (sLeftHandType == PLAYER_MODELTYPE_LH_OPEN)
|
|
|
|
? gLinkAdultLeftGauntletPlate2DL
|
|
|
|
: gLinkAdultLeftGauntletPlate3DL);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, (sRightHandType == PLAYER_MODELTYPE_RH_OPEN)
|
|
|
|
? gLinkAdultRightGauntletPlate2DL
|
|
|
|
: gLinkAdultRightGauntletPlate3DL);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (boots != 0) {
|
|
|
|
Gfx** bootDLists = sBootDListGroups[boots - 1];
|
2021-10-03 03:17:09 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPDisplayList(POLY_OPA_DISP++, bootDLists[0]);
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, bootDLists[1]);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
2020-05-20 00:15:48 +00:00
|
|
|
} else {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (Player_GetStrength() > PLAYER_STR_NONE) {
|
2021-05-26 22:59:21 +00:00
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gLinkChildGoronBraceletDL);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 1803);
|
|
|
|
}
|
|
|
|
|
2022-03-09 00:50:27 +00:00
|
|
|
Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
Vec3f D_80126038[] = {
|
|
|
|
{ 1304.0f, 0.0f, 0.0f },
|
|
|
|
{ 695.0f, 0.0f, 0.0f },
|
|
|
|
};
|
|
|
|
|
|
|
|
f32 D_80126050[] = { 1265.0f, 826.0f };
|
2021-03-31 16:18:31 +00:00
|
|
|
f32 D_80126058[] = { SQ(13.04f), SQ(6.95f) };
|
|
|
|
f32 D_80126060[] = { 10.019104f, -19.925102f };
|
2020-09-19 01:45:39 +00:00
|
|
|
f32 D_80126068[] = { 5.0f, 3.0f };
|
|
|
|
|
|
|
|
Vec3f D_80126070 = { 0.0f, -300.0f, 0.0f };
|
|
|
|
|
|
|
|
void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
|
|
|
|
s32 thighLimbIndex, s32 shinLimbIndex, s32 footLimbIndex) {
|
|
|
|
Vec3f spA4;
|
|
|
|
Vec3f sp98;
|
2020-09-30 00:18:46 +00:00
|
|
|
Vec3f footprintPos;
|
2020-09-19 01:45:39 +00:00
|
|
|
CollisionPoly* sp88;
|
2021-03-31 16:18:31 +00:00
|
|
|
s32 sp84;
|
2020-09-19 01:45:39 +00:00
|
|
|
f32 sp80;
|
|
|
|
f32 sp7C;
|
|
|
|
f32 sp78;
|
|
|
|
f32 sp74;
|
|
|
|
f32 sp70;
|
|
|
|
f32 sp6C;
|
|
|
|
f32 sp68;
|
|
|
|
f32 sp64;
|
|
|
|
f32 sp60;
|
|
|
|
f32 sp5C;
|
|
|
|
f32 sp58;
|
|
|
|
f32 sp54;
|
|
|
|
f32 sp50;
|
|
|
|
s16 temp1;
|
|
|
|
s16 temp2;
|
|
|
|
s32 temp3;
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & PLAYER_STATE1_7) &&
|
2020-09-19 01:45:39 +00:00
|
|
|
(Player_ActionToMagicSpell(this, this->itemActionParam) < 0)) {
|
|
|
|
s32 pad;
|
|
|
|
|
|
|
|
sp7C = D_80126058[(void)0, gSaveContext.linkAge];
|
|
|
|
sp78 = D_80126060[(void)0, gSaveContext.linkAge];
|
|
|
|
sp74 = D_80126068[(void)0, gSaveContext.linkAge] - this->unk_6C4;
|
|
|
|
|
|
|
|
Matrix_Push();
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_TranslateRotateZYX(pos, rot);
|
2022-03-09 00:50:27 +00:00
|
|
|
Matrix_MultVec3f(&sZeroVec, &spA4);
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_TranslateRotateZYX(&D_80126038[(void)0, gSaveContext.linkAge], &skelAnime->jointTable[shinLimbIndex]);
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Translate(D_80126050[(void)0, gSaveContext.linkAge], 0.0f, 0.0f, MTXMODE_APPLY);
|
2022-03-09 00:50:27 +00:00
|
|
|
Matrix_MultVec3f(&sZeroVec, &sp98);
|
2020-09-30 00:18:46 +00:00
|
|
|
Matrix_MultVec3f(&D_80126070, &footprintPos);
|
2021-02-24 19:28:04 +00:00
|
|
|
Matrix_Pop();
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-09-30 00:18:46 +00:00
|
|
|
footprintPos.y += 15.0f;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
sp80 = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
if (sp98.y < sp80) {
|
|
|
|
sp70 = sp98.x - spA4.x;
|
|
|
|
sp6C = sp98.y - spA4.y;
|
|
|
|
sp68 = sp98.z - spA4.z;
|
|
|
|
|
|
|
|
sp64 = sqrtf(SQ(sp70) + SQ(sp6C) + SQ(sp68));
|
|
|
|
sp60 = (SQ(sp64) + sp78) / (2.0f * sp64);
|
|
|
|
|
|
|
|
sp58 = sp7C - SQ(sp60);
|
|
|
|
sp58 = (sp7C < SQ(sp60)) ? 0.0f : sqrtf(sp58);
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
sp54 = Math_FAtan2F(sp58, sp60);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
sp6C = sp80 - spA4.y;
|
|
|
|
|
|
|
|
sp64 = sqrtf(SQ(sp70) + SQ(sp6C) + SQ(sp68));
|
|
|
|
sp60 = (SQ(sp64) + sp78) / (2.0f * sp64);
|
|
|
|
sp5C = sp64 - sp60;
|
|
|
|
|
|
|
|
sp58 = sp7C - SQ(sp60);
|
|
|
|
sp58 = (sp7C < SQ(sp60)) ? 0.0f : sqrtf(sp58);
|
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
sp50 = Math_FAtan2F(sp58, sp60);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-04-24 14:23:49 +00:00
|
|
|
temp1 = RAD_TO_BINANG(M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50)));
|
2020-12-29 22:46:46 +00:00
|
|
|
temp1 = temp1 - skelAnime->jointTable[shinLimbIndex].z;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
if ((s16)(ABS(skelAnime->jointTable[shinLimbIndex].x) + ABS(skelAnime->jointTable[shinLimbIndex].y)) < 0) {
|
2020-09-19 01:45:39 +00:00
|
|
|
temp1 += 0x8000;
|
|
|
|
}
|
|
|
|
|
2022-04-24 14:23:49 +00:00
|
|
|
temp2 = RAD_TO_BINANG(sp50 - sp54);
|
2020-09-19 01:45:39 +00:00
|
|
|
rot->z -= temp2;
|
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
skelAnime->jointTable[thighLimbIndex].z = skelAnime->jointTable[thighLimbIndex].z - temp2;
|
|
|
|
skelAnime->jointTable[shinLimbIndex].z = skelAnime->jointTable[shinLimbIndex].z + temp1;
|
|
|
|
skelAnime->jointTable[footLimbIndex].z = skelAnime->jointTable[footLimbIndex].z + temp2 - temp1;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
temp3 = func_80041D4C(&globalCtx->colCtx, sp88, sp84);
|
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&globalCtx->colCtx, sp88, sp84)) {
|
2020-09-30 00:18:46 +00:00
|
|
|
footprintPos.y = sp80;
|
|
|
|
EffectSsGFire_Spawn(globalCtx, &footprintPos);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
|
|
|
void* thisx) {
|
2020-12-02 03:19:56 +00:00
|
|
|
Player* this = (Player*)thisx;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
if (limbIndex == PLAYER_LIMB_ROOT) {
|
2022-03-20 22:42:01 +00:00
|
|
|
sLeftHandType = this->leftHandType;
|
|
|
|
sRightHandType = this->rightHandType;
|
2022-03-09 00:50:27 +00:00
|
|
|
|
|
|
|
// `sCurBodyPartPos` is incremented before each usage, so it starts at index -1.
|
|
|
|
// What determines if a limb corresponds to a body part is whether or not it has a non-NULL `dList`.
|
|
|
|
// Note: The increment would not be done for the root limb, even if it had a non-NULL `dList`.
|
|
|
|
// So if the root limb had a non-NULL `dList` (which is not the case in vanilla),
|
|
|
|
// an out-of-bounds write to `bodyPartsPos` would occur.
|
|
|
|
sCurBodyPartPos = &this->bodyPartsPos[-1];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-08-21 23:12:57 +00:00
|
|
|
if (!LINK_IS_ADULT) {
|
2020-12-29 22:46:46 +00:00
|
|
|
if (!(this->skelAnime.moveFlags & 4) || (this->skelAnime.moveFlags & 1)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
pos->x *= 0.64f;
|
|
|
|
pos->z *= 0.64f;
|
|
|
|
}
|
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
if (!(this->skelAnime.moveFlags & 4) || (this->skelAnime.moveFlags & 2)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
pos->y *= 0.64f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pos->y -= this->unk_6C4;
|
|
|
|
|
|
|
|
if (this->unk_6C2 != 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
Matrix_Translate(pos->x, ((Math_CosS(this->unk_6C2) - 1.0f) * 200.0f) + pos->y, pos->z, MTXMODE_APPLY);
|
2022-03-20 00:16:33 +00:00
|
|
|
Matrix_RotateX(BINANG_TO_RAD(this->unk_6C2), MTXMODE_APPLY);
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
pos->x = pos->y = pos->z = 0.0f;
|
|
|
|
rot->x = rot->y = rot->z = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (*dList != NULL) {
|
2022-03-09 00:50:27 +00:00
|
|
|
sCurBodyPartPos++;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (limbIndex == PLAYER_LIMB_HEAD) {
|
|
|
|
rot->x += this->unk_6BA;
|
|
|
|
rot->y -= this->unk_6B8;
|
|
|
|
rot->z += this->unk_6B6;
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_UPPER) {
|
|
|
|
if (this->unk_6B0 != 0) {
|
2022-03-20 00:16:33 +00:00
|
|
|
Matrix_RotateZ(BINANG_TO_RAD(0x44C), MTXMODE_APPLY);
|
|
|
|
Matrix_RotateY(BINANG_TO_RAD(this->unk_6B0), MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
if (this->unk_6BE != 0) {
|
2022-03-20 00:16:33 +00:00
|
|
|
Matrix_RotateY(BINANG_TO_RAD(this->unk_6BE), MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
if (this->unk_6BC != 0) {
|
2022-03-20 00:16:33 +00:00
|
|
|
Matrix_RotateX(BINANG_TO_RAD(this->unk_6BC), MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
if (this->unk_6C0 != 0) {
|
2022-03-20 00:16:33 +00:00
|
|
|
Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_L_THIGH) {
|
|
|
|
func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,
|
|
|
|
PLAYER_LIMB_L_FOOT);
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_THIGH) {
|
|
|
|
func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN,
|
|
|
|
PLAYER_LIMB_R_FOOT);
|
2020-12-29 22:46:46 +00:00
|
|
|
return false;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
2020-12-29 22:46:46 +00:00
|
|
|
return false;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
return false;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
|
|
|
void* thisx) {
|
2020-12-02 03:19:56 +00:00
|
|
|
Player* this = (Player*)thisx;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (limbIndex == PLAYER_LIMB_L_HAND) {
|
|
|
|
Gfx** dLists = this->leftHandDLists;
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if ((sLeftHandType == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
dLists += 4;
|
2022-03-20 22:42:01 +00:00
|
|
|
} else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & PLAYER_STATE1_25)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
dLists = &D_80125E08[gSaveContext.linkAge];
|
2022-03-20 22:42:01 +00:00
|
|
|
sLeftHandType = PLAYER_MODELTYPE_LH_OPEN;
|
|
|
|
} else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speedXZ > 2.0f) &&
|
2022-01-18 00:04:07 +00:00
|
|
|
!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
dLists = &D_80125E18[gSaveContext.linkAge];
|
2022-03-20 22:42:01 +00:00
|
|
|
sLeftHandType = PLAYER_MODELTYPE_LH_CLOSED;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*dList = dLists[sDListsLodOffset];
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
|
|
|
Gfx** dLists = this->rightHandDLists;
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if (sRightHandType == PLAYER_MODELTYPE_RH_SHIELD) {
|
2020-09-19 01:45:39 +00:00
|
|
|
dLists += this->currentShield * 4;
|
2022-03-20 22:42:01 +00:00
|
|
|
} else if ((this->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (this->actor.speedXZ > 2.0f) &&
|
2022-01-18 00:04:07 +00:00
|
|
|
!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
dLists = &D_80125E58[gSaveContext.linkAge];
|
2022-03-20 22:42:01 +00:00
|
|
|
sRightHandType = PLAYER_MODELTYPE_RH_CLOSED;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*dList = dLists[sDListsLodOffset];
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_SHEATH) {
|
|
|
|
Gfx** dLists = this->sheathDLists;
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if ((this->sheathType == PLAYER_MODELTYPE_SHEATH_18) || (this->sheathType == PLAYER_MODELTYPE_SHEATH_19)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
dLists += this->currentShield * 4;
|
2021-08-21 23:12:57 +00:00
|
|
|
if (!LINK_IS_ADULT && (this->currentShield < PLAYER_SHIELD_HYLIAN) &&
|
2020-09-19 01:45:39 +00:00
|
|
|
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) {
|
2022-03-20 22:42:01 +00:00
|
|
|
dLists += PLAYER_SHIELD_MAX * 4;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
2022-03-20 22:42:01 +00:00
|
|
|
} else if (!LINK_IS_ADULT &&
|
|
|
|
((this->sheathType == PLAYER_MODELTYPE_SHEATH_16) ||
|
|
|
|
(this->sheathType == PLAYER_MODELTYPE_SHEATH_17)) &&
|
2020-09-19 01:45:39 +00:00
|
|
|
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) {
|
|
|
|
dLists = D_80125D68;
|
|
|
|
}
|
|
|
|
|
|
|
|
*dList = dLists[sDListsLodOffset];
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_WAIST) {
|
|
|
|
*dList = this->waistDLists[sDListsLodOffset];
|
|
|
|
}
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
return false;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
|
|
|
|
Vec3s* rot, void* thisx) {
|
2020-12-02 03:19:56 +00:00
|
|
|
Player* this = (Player*)thisx;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (this->unk_6AD != 2) {
|
|
|
|
*dList = NULL;
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
|
2021-12-27 13:08:26 +00:00
|
|
|
*dList = sArmOutDLs[(void)0, gSaveContext.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
|
2021-12-27 13:08:26 +00:00
|
|
|
*dList = sHandOutDLs[(void)0, gSaveContext.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_SHOULDER) {
|
2021-12-27 13:08:26 +00:00
|
|
|
*dList = sRightShoulderNearDLs[(void)0, gSaveContext.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_FOREARM) {
|
|
|
|
*dList = D_80125F30[(void)0, gSaveContext.linkAge];
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
2021-12-27 13:08:26 +00:00
|
|
|
*dList = Player_HoldsHookshot(this) ? gLinkAdultRightHandHoldingHookshotFarDL
|
|
|
|
: sHoldingFirstPersonWeaponDLs[(void)0, gSaveContext.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
|
|
|
*dList = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
return false;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplay_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
|
|
|
|
Vec3s* rot, void* thisx) {
|
|
|
|
if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
*dList = NULL;
|
|
|
|
}
|
|
|
|
|
2020-12-29 22:46:46 +00:00
|
|
|
return false;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip,
|
|
|
|
Vec3f* newBase) {
|
|
|
|
if (weaponInfo->active == 0) {
|
2020-05-20 00:15:48 +00:00
|
|
|
if (collider != NULL) {
|
2021-01-18 02:13:36 +00:00
|
|
|
Collider_ResetQuadAT(globalCtx, &collider->base);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
Math_Vec3f_Copy(&weaponInfo->tip, newTip);
|
|
|
|
Math_Vec3f_Copy(&weaponInfo->base, newBase);
|
|
|
|
weaponInfo->active = 1;
|
2020-05-20 00:15:48 +00:00
|
|
|
return 1;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if ((weaponInfo->tip.x == newTip->x) && (weaponInfo->tip.y == newTip->y) &&
|
|
|
|
(weaponInfo->tip.z == newTip->z) && (weaponInfo->base.x == newBase->x) &&
|
|
|
|
(weaponInfo->base.y == newBase->y) && (weaponInfo->base.z == newBase->z)) {
|
|
|
|
if (collider != NULL) {
|
2021-01-18 02:13:36 +00:00
|
|
|
Collider_ResetQuadAT(globalCtx, &collider->base);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
return 0;
|
|
|
|
} else {
|
2020-05-20 00:15:48 +00:00
|
|
|
if (collider != NULL) {
|
2021-01-18 02:13:36 +00:00
|
|
|
Collider_SetQuadVertices(collider, newBase, newTip, &weaponInfo->base, &weaponInfo->tip);
|
2020-09-19 01:45:39 +00:00
|
|
|
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
Math_Vec3f_Copy(&weaponInfo->base, newBase);
|
|
|
|
Math_Vec3f_Copy(&weaponInfo->tip, newTip);
|
|
|
|
weaponInfo->active = 1;
|
2020-05-20 00:15:48 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collider, Vec3f* quadSrc) {
|
|
|
|
static u8 shieldColTypes[PLAYER_SHIELD_MAX] = {
|
2021-01-18 02:13:36 +00:00
|
|
|
COLTYPE_METAL,
|
|
|
|
COLTYPE_WOOD,
|
|
|
|
COLTYPE_METAL,
|
|
|
|
COLTYPE_METAL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
if (this->stateFlags1 & PLAYER_STATE1_22) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Vec3f quadDest[4];
|
|
|
|
|
2021-01-18 02:13:36 +00:00
|
|
|
this->shieldQuad.base.colType = shieldColTypes[this->currentShield];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
Matrix_MultVec3f(&quadSrc[0], &quadDest[0]);
|
|
|
|
Matrix_MultVec3f(&quadSrc[1], &quadDest[1]);
|
|
|
|
Matrix_MultVec3f(&quadSrc[2], &quadDest[2]);
|
|
|
|
Matrix_MultVec3f(&quadSrc[3], &quadDest[3]);
|
2021-01-18 02:13:36 +00:00
|
|
|
Collider_SetQuadVertices(collider, &quadDest[0], &quadDest[1], &quadDest[2], &quadDest[3]);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
|
|
|
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base);
|
|
|
|
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base);
|
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
Vec3f D_80126080 = { 5000.0f, 400.0f, 0.0f };
|
|
|
|
Vec3f D_8012608C = { 5000.0f, -400.0f, 1000.0f };
|
|
|
|
Vec3f D_80126098 = { 5000.0f, 1400.0f, -1000.0f };
|
|
|
|
|
|
|
|
Vec3f D_801260A4[3] = {
|
|
|
|
{ 0.0f, 400.0f, 0.0f },
|
|
|
|
{ 0.0f, 1400.0f, -1000.0f },
|
|
|
|
{ 0.0f, -400.0f, 1000.0f },
|
|
|
|
};
|
|
|
|
|
|
|
|
void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) {
|
|
|
|
Vec3f newBasePos[3];
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_MultVec3f(&D_801260A4[0], &newBasePos[0]);
|
|
|
|
Matrix_MultVec3f(&D_801260A4[1], &newBasePos[1]);
|
|
|
|
Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]);
|
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
if (func_80090480(globalCtx, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) &&
|
2022-01-18 00:04:07 +00:00
|
|
|
!(this->stateFlags1 & PLAYER_STATE1_22)) {
|
2022-02-20 23:45:12 +00:00
|
|
|
EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip,
|
|
|
|
&this->meleeWeaponInfo[0].base);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
if ((this->meleeWeaponState > 0) &&
|
2022-03-09 17:52:28 +00:00
|
|
|
((this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || (this->stateFlags2 & PLAYER_STATE2_17))) {
|
2022-02-20 23:45:12 +00:00
|
|
|
func_80090480(globalCtx, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]);
|
|
|
|
func_80090480(globalCtx, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPos, s32 drawIdPlusOne) {
|
|
|
|
f32 height = (this->exchangeItemId != EXCH_ITEM_NONE) ? 6.0f : 14.0f;
|
|
|
|
|
|
|
|
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2401);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x06, this->giObjectSegment);
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x06, this->giObjectSegment);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-12-26 10:44:53 +00:00
|
|
|
Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height,
|
|
|
|
refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW);
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY);
|
2020-06-14 03:29:59 +00:00
|
|
|
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-02-12 21:57:06 +00:00
|
|
|
GetItem_Draw(globalCtx, drawIdPlusOne - 1);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2421);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void Player_DrawGetItem(GlobalContext* globalCtx, Player* this) {
|
2022-04-09 00:20:23 +00:00
|
|
|
if (!this->giObjectLoading || osRecvMesg(&this->giObjectLoadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
2020-09-19 01:45:39 +00:00
|
|
|
this->giObjectLoading = false;
|
|
|
|
Player_DrawGetItemImpl(globalCtx, this, &sGetItemRefPos, ABS(this->unk_862));
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
void func_80090A28(Player* this, Vec3f* vecs) {
|
2020-05-20 00:15:48 +00:00
|
|
|
D_8012608C.x = D_80126080.x;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
if (this->unk_845 >= 3) {
|
|
|
|
this->unk_845 += 1;
|
|
|
|
D_8012608C.x *= 1.0f + ((9 - this->unk_845) * 0.1f);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-05-20 00:15:48 +00:00
|
|
|
D_8012608C.x += 1200.0f;
|
|
|
|
D_80126098.x = D_8012608C.x;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
Matrix_MultVec3f(&D_80126080, &vecs[0]);
|
|
|
|
Matrix_MultVec3f(&D_8012608C, &vecs[1]);
|
|
|
|
Matrix_MultVec3f(&D_80126098, &vecs[2]);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2) {
|
2020-09-19 01:45:39 +00:00
|
|
|
static Vec3f D_801260C8 = { -500.0f, -100.0f, 0.0f };
|
2020-12-02 03:19:56 +00:00
|
|
|
CollisionPoly* sp9C;
|
2021-02-14 00:49:40 +00:00
|
|
|
s32 bgId;
|
2020-05-20 00:15:48 +00:00
|
|
|
Vec3f sp8C;
|
|
|
|
Vec3f sp80;
|
|
|
|
Vec3f sp74;
|
|
|
|
Vec3f sp68;
|
|
|
|
f32 sp64;
|
|
|
|
f32 sp60;
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
D_801260C8.z = 0.0f;
|
2020-05-20 00:15:48 +00:00
|
|
|
Matrix_MultVec3f(&D_801260C8, &sp8C);
|
2020-09-19 01:45:39 +00:00
|
|
|
D_801260C8.z = arg2;
|
2020-05-20 00:15:48 +00:00
|
|
|
Matrix_MultVec3f(&D_801260C8, &sp80);
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
if (1) {}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2572);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x07);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2021-11-30 23:52:16 +00:00
|
|
|
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
sp60 = (sp64 < 200.0f) ? 0.08f : (sp64 / 200.0f) * 0.08f;
|
2020-05-20 00:15:48 +00:00
|
|
|
|
|
|
|
Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW);
|
|
|
|
Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY);
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587),
|
2020-05-20 00:15:48 +00:00
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSegment(OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
|
2021-12-27 13:08:26 +00:00
|
|
|
gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Vec3f D_801260D4 = { 1100.0f, -700.0f, 0.0f };
|
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
f32 sMeleeWeaponLengths[] = {
|
2020-09-19 01:45:39 +00:00
|
|
|
0.0f, 4000.0f, 3000.0f, 5500.0f, 0.0f, 2500.0f,
|
|
|
|
};
|
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
Gfx* sBottleDLists[] = { gLinkAdultBottleDL, gLinkChildBottleDL };
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
Color_RGB8 sBottleColors[] = {
|
|
|
|
{ 255, 255, 255 }, { 80, 80, 255 }, { 255, 100, 255 }, { 0, 0, 255 }, { 255, 0, 255 },
|
|
|
|
{ 255, 0, 255 }, { 200, 200, 100 }, { 255, 0, 0 }, { 0, 0, 255 }, { 0, 255, 0 },
|
|
|
|
{ 255, 255, 255 }, { 255, 255, 255 }, { 80, 80, 255 },
|
|
|
|
};
|
|
|
|
|
|
|
|
Vec3f D_80126128 = { 398.0f, 1419.0f, 244.0f };
|
|
|
|
|
|
|
|
BowStringData sBowStringData[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
{ gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // bow
|
|
|
|
{ gLinkChildSlinghotStringDL, { 606.0f, 236.0f, 0.0f } }, // slingshot
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Vec3f D_80126154[] = {
|
|
|
|
{ -4500.0f, -3000.0f, -600.0f },
|
|
|
|
{ 1500.0f, -3000.0f, -600.0f },
|
|
|
|
{ -4500.0f, 3000.0f, -600.0f },
|
|
|
|
{ 1500.0f, 3000.0f, -600.0f },
|
|
|
|
};
|
|
|
|
|
|
|
|
Vec3f D_80126184 = { 100.0f, 1500.0f, 0.0f };
|
|
|
|
Vec3f D_80126190 = { 100.0f, 1640.0f, 0.0f };
|
|
|
|
|
|
|
|
Vec3f D_8012619C[] = {
|
|
|
|
{ -3000.0f, -3000.0f, -900.0f },
|
|
|
|
{ 3000.0f, -3000.0f, -900.0f },
|
|
|
|
{ -3000.0f, 3000.0f, -900.0f },
|
|
|
|
{ 3000.0f, 3000.0f, -900.0f },
|
|
|
|
};
|
|
|
|
|
|
|
|
Vec3f D_801261CC = { 630.0f, 100.0f, -30.0f };
|
|
|
|
Vec3s D_801261D8 = { 0, 0, 0x7FFF };
|
|
|
|
|
|
|
|
Vec3f D_801261E0[] = {
|
|
|
|
{ 200.0f, 300.0f, 0.0f },
|
|
|
|
{ 200.0f, 200.0f, 0.0f },
|
|
|
|
};
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
2020-12-02 03:19:56 +00:00
|
|
|
Player* this = (Player*)thisx;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
if (*dList != NULL) {
|
2022-03-09 00:50:27 +00:00
|
|
|
Matrix_MultVec3f(&sZeroVec, sCurBodyPartPos);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (limbIndex == PLAYER_LIMB_L_HAND) {
|
|
|
|
MtxF sp14C;
|
2020-11-25 21:42:02 +00:00
|
|
|
Actor* hookedActor;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-09 00:50:27 +00:00
|
|
|
Math_Vec3f_Copy(&this->leftHandPos, sCurBodyPartPos);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
if (this->itemActionParam == PLAYER_AP_STICK) {
|
|
|
|
Vec3f sp124[3];
|
|
|
|
|
|
|
|
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2633);
|
|
|
|
|
|
|
|
if (this->actor.scale.y >= 0.0f) {
|
|
|
|
D_80126080.x = this->unk_85C * 5000.0f;
|
|
|
|
func_80090A28(this, sp124);
|
2022-02-20 23:45:12 +00:00
|
|
|
if (this->meleeWeaponState != 0) {
|
2020-09-19 01:45:39 +00:00
|
|
|
func_800906D4(globalCtx, this, sp124);
|
|
|
|
} else {
|
2022-02-20 23:45:12 +00:00
|
|
|
Math_Vec3f_Copy(&this->meleeWeaponInfo[0].tip, &sp124[0]);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Matrix_Translate(-428.26f, 267.2f, -33.82f, MTXMODE_APPLY);
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_APPLY);
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2653),
|
2020-09-19 01:45:39 +00:00
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
2021-05-26 22:59:21 +00:00
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gLinkChildLinkDekuStickDL);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2656);
|
2022-02-20 23:45:12 +00:00
|
|
|
} else if ((this->actor.scale.y >= 0.0f) && (this->meleeWeaponState != 0)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Vec3f spE4[3];
|
|
|
|
|
|
|
|
if (Player_HoldsBrokenKnife(this)) {
|
|
|
|
D_80126080.x = 1500.0f;
|
|
|
|
} else {
|
2022-02-20 23:45:12 +00:00
|
|
|
D_80126080.x = sMeleeWeaponLengths[Player_GetMeleeWeaponHeld(this)];
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func_80090A28(this, spE4);
|
|
|
|
func_800906D4(globalCtx, this, spE4);
|
2022-03-20 22:42:01 +00:00
|
|
|
} else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) {
|
2020-11-25 21:42:02 +00:00
|
|
|
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2710);
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2712),
|
2020-09-19 01:45:39 +00:00
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
|
2021-02-14 00:49:40 +00:00
|
|
|
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[((void)0, gSaveContext.linkAge)]);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2717);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->actor.scale.y >= 0.0f) {
|
|
|
|
if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) {
|
2022-01-18 00:04:07 +00:00
|
|
|
if (this->stateFlags1 & PLAYER_STATE1_9) {
|
2021-01-18 21:04:04 +00:00
|
|
|
Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos);
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Get(&sp14C);
|
2021-08-22 15:25:17 +00:00
|
|
|
Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0);
|
2021-01-18 21:04:04 +00:00
|
|
|
hookedActor->shape.rot = hookedActor->world.rot;
|
2022-01-18 00:04:07 +00:00
|
|
|
} else if (this->stateFlags1 & PLAYER_STATE1_11) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Vec3s spB8;
|
|
|
|
|
|
|
|
Matrix_Get(&sp14C);
|
2021-08-22 15:25:17 +00:00
|
|
|
Matrix_MtxFToYXZRotS(&sp14C, &spB8, 0);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-12-06 00:11:38 +00:00
|
|
|
if (hookedActor->flags & ACTOR_FLAG_17) {
|
2021-01-18 21:04:04 +00:00
|
|
|
hookedActor->world.rot.x = hookedActor->shape.rot.x = spB8.x - this->unk_3BC.x;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
2021-01-18 21:04:04 +00:00
|
|
|
hookedActor->world.rot.y = hookedActor->shape.rot.y = this->actor.shape.rot.y + this->unk_3BC.y;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Matrix_Get(&this->mf_9E0);
|
2021-08-22 15:25:17 +00:00
|
|
|
Matrix_MtxFToYXZRotS(&this->mf_9E0, &this->unk_3BC, 0);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
2020-11-25 21:42:02 +00:00
|
|
|
Actor* heldActor = this->heldActor;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if (this->rightHandType == PLAYER_MODELTYPE_RH_FF) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Get(&this->shieldMf);
|
2022-03-20 22:42:01 +00:00
|
|
|
} else if ((this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT) ||
|
|
|
|
(this->rightHandType == PLAYER_MODELTYPE_12)) {
|
2020-11-25 21:42:02 +00:00
|
|
|
BowStringData* stringData = &sBowStringData[gSaveContext.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2783);
|
|
|
|
|
|
|
|
Matrix_Push();
|
|
|
|
Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY);
|
|
|
|
|
2022-01-18 00:04:07 +00:00
|
|
|
if ((this->stateFlags1 & PLAYER_STATE1_9) && (this->unk_860 >= 0) && (this->unk_834 <= 10)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Vec3f sp90;
|
|
|
|
f32 distXYZ;
|
|
|
|
|
2022-03-09 00:50:27 +00:00
|
|
|
Matrix_MultVec3f(&sZeroVec, &sp90);
|
|
|
|
distXYZ = Math_Vec3f_DistXYZ(sCurBodyPartPos, &sp90);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
this->unk_858 = distXYZ - 3.0f;
|
|
|
|
if (distXYZ < 3.0f) {
|
|
|
|
this->unk_858 = 0.0f;
|
|
|
|
} else {
|
|
|
|
this->unk_858 *= 1.6f;
|
|
|
|
if (this->unk_858 > 1.0f) {
|
|
|
|
this->unk_858 = 1.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this->unk_85C = -0.5f;
|
|
|
|
}
|
|
|
|
|
|
|
|
Matrix_Scale(1.0f, this->unk_858, 1.0f, MTXMODE_APPLY);
|
|
|
|
|
2021-08-21 23:12:57 +00:00
|
|
|
if (!LINK_IS_ADULT) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_RotateZ(this->unk_858 * -0.2f, MTXMODE_APPLY);
|
|
|
|
}
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2804),
|
2020-09-19 01:45:39 +00:00
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPDisplayList(POLY_XLU_DISP++, stringData->dList);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-02-24 19:28:04 +00:00
|
|
|
Matrix_Pop();
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2809);
|
2022-03-20 22:42:01 +00:00
|
|
|
} else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Get(&this->shieldMf);
|
|
|
|
func_80090604(globalCtx, this, &this->shieldQuad, D_80126154);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->actor.scale.y >= 0.0f) {
|
|
|
|
if ((this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ||
|
|
|
|
(this->heldItemActionParam == PLAYER_AP_LONGSHOT)) {
|
|
|
|
Matrix_MultVec3f(&D_80126184, &this->unk_3C8);
|
|
|
|
|
|
|
|
if (heldActor != NULL) {
|
|
|
|
MtxF sp44;
|
|
|
|
s32 pad;
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
Matrix_MultVec3f(&D_80126190, &heldActor->world.pos);
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_RotateZYX(0, -0x4000, -0x4000, MTXMODE_APPLY);
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Get(&sp44);
|
2021-08-22 15:25:17 +00:00
|
|
|
Matrix_MtxFToYXZRotS(&sp44, &heldActor->world.rot, 0);
|
2021-01-18 21:04:04 +00:00
|
|
|
heldActor->shape.rot = heldActor->world.rot;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
if (func_8002DD78(this) != 0) {
|
|
|
|
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
|
2021-12-27 13:08:26 +00:00
|
|
|
Player_DrawHookshotReticle(
|
|
|
|
globalCtx, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((this->unk_862 != 0) || ((func_8002DD6C(this) == 0) && (heldActor != NULL))) {
|
2022-01-18 00:04:07 +00:00
|
|
|
if (!(this->stateFlags1 & PLAYER_STATE1_10) && (this->unk_862 != 0) &&
|
|
|
|
(this->exchangeItemId != EXCH_ITEM_NONE)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Math_Vec3f_Copy(&sGetItemRefPos, &this->leftHandPos);
|
|
|
|
} else {
|
2022-03-09 00:50:27 +00:00
|
|
|
sGetItemRefPos.x = (this->bodyPartsPos[PLAYER_BODYPART_R_HAND].x + this->leftHandPos.x) * 0.5f;
|
|
|
|
sGetItemRefPos.y = (this->bodyPartsPos[PLAYER_BODYPART_R_HAND].y + this->leftHandPos.y) * 0.5f;
|
|
|
|
sGetItemRefPos.z = (this->bodyPartsPos[PLAYER_BODYPART_R_HAND].z + this->leftHandPos.z) * 0.5f;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this->unk_862 == 0) {
|
2021-01-18 21:04:04 +00:00
|
|
|
Math_Vec3f_Copy(&heldActor->world.pos, &sGetItemRefPos);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (this->actor.scale.y >= 0.0f) {
|
|
|
|
if (limbIndex == PLAYER_LIMB_SHEATH) {
|
2022-03-20 22:42:01 +00:00
|
|
|
if ((this->rightHandType != PLAYER_MODELTYPE_RH_SHIELD) &&
|
|
|
|
(this->rightHandType != PLAYER_MODELTYPE_RH_FF)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (Player_IsChildWithHylianShield(this)) {
|
|
|
|
func_80090604(globalCtx, this, &this->shieldQuad, D_8012619C);
|
|
|
|
}
|
|
|
|
|
2021-11-17 10:52:26 +00:00
|
|
|
Matrix_TranslateRotateZYX(&D_801261CC, &D_801261D8);
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Get(&this->shieldMf);
|
|
|
|
}
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_HEAD) {
|
2021-01-18 21:04:04 +00:00
|
|
|
Matrix_MultVec3f(&D_801260D4, &this->actor.focus.pos);
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
2021-02-14 00:49:40 +00:00
|
|
|
Vec3f* vec = &D_801261E0[((void)0, gSaveContext.linkAge)];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
Actor_SetFeetPos(&this->actor, limbIndex, PLAYER_LIMB_L_FOOT, vec, PLAYER_LIMB_R_FOOT, vec);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
|
2021-02-14 00:49:40 +00:00
|
|
|
s16 linkObjectId = gLinkObjectIds[(void)0, gSaveContext.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
u32 size;
|
|
|
|
void* ptr;
|
|
|
|
|
|
|
|
size = gObjectTable[OBJECT_GAMEPLAY_KEEP].vromEnd - gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart;
|
2022-03-13 00:06:43 +00:00
|
|
|
ptr = segment + PAUSE_EQUIP_BUFFER_SIZE;
|
2020-09-19 01:45:39 +00:00
|
|
|
DmaMgr_SendRequest1(ptr, gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart, size, "../z_player_lib.c", 2982);
|
|
|
|
|
|
|
|
size = gObjectTable[linkObjectId].vromEnd - gObjectTable[linkObjectId].vromStart;
|
2022-03-13 00:06:43 +00:00
|
|
|
ptr = segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE;
|
2020-09-19 01:45:39 +00:00
|
|
|
DmaMgr_SendRequest1(ptr, gObjectTable[linkObjectId].vromStart, size, "../z_player_lib.c", 2988);
|
|
|
|
|
|
|
|
ptr = (void*)ALIGN16((u32)ptr + size);
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE);
|
|
|
|
gSegments[6] =
|
|
|
|
VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-04-12 17:45:58 +00:00
|
|
|
SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9,
|
|
|
|
ptr, ptr, PLAYER_LIMB_MAX);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
return size + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE +
|
|
|
|
sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
u8 D_801261F8[] = { PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_BGS };
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
|
|
|
void* arg) {
|
2022-03-20 22:42:01 +00:00
|
|
|
u8* playerSwordAndShield = arg;
|
|
|
|
//! @bug `playerSwordAndShield[0]` can be 0 (no sword), 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];
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 type;
|
|
|
|
s32 dListOffset = 0;
|
|
|
|
Gfx** dLists;
|
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
if ((modelGroup == PLAYER_MODELGROUP_SWORD) && !LINK_IS_ADULT &&
|
|
|
|
(playerSwordAndShield[1] == PLAYER_SHIELD_HYLIAN)) {
|
|
|
|
modelGroup = PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (limbIndex == PLAYER_LIMB_L_HAND) {
|
2022-03-20 22:42:01 +00:00
|
|
|
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND];
|
|
|
|
sLeftHandType = type;
|
|
|
|
if ((type == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
dListOffset = 4;
|
|
|
|
}
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
2022-03-20 22:42:01 +00:00
|
|
|
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND];
|
|
|
|
sRightHandType = type;
|
|
|
|
if (type == PLAYER_MODELTYPE_RH_SHIELD) {
|
|
|
|
dListOffset = playerSwordAndShield[1] * 4;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_SHEATH) {
|
2022-03-20 22:42:01 +00:00
|
|
|
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH];
|
|
|
|
if ((type == PLAYER_MODELTYPE_SHEATH_18) || (type == PLAYER_MODELTYPE_SHEATH_19)) {
|
|
|
|
dListOffset = playerSwordAndShield[1] * 4;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_WAIST) {
|
2022-03-20 22:42:01 +00:00
|
|
|
type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_WAIST];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
dLists = &sPlayerDListGroups[type][(void)0, gSaveContext.linkAge];
|
|
|
|
*dList = dLists[dListOffset];
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime,
|
|
|
|
Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width,
|
|
|
|
s32 height, Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) {
|
|
|
|
// Note: the viewport x and y values are overwritten below, before usage
|
|
|
|
static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0,
|
|
|
|
(PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 };
|
2020-09-19 01:45:39 +00:00
|
|
|
static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172);
|
|
|
|
static Vec3f lightDir = { 89.8f, 0.0f, 89.8f };
|
2022-03-20 22:42:01 +00:00
|
|
|
u8 playerSwordAndShield[2];
|
2020-09-19 01:45:39 +00:00
|
|
|
Gfx* opaRef;
|
|
|
|
Gfx* xluRef;
|
|
|
|
u16 perspNorm;
|
2021-02-14 00:49:40 +00:00
|
|
|
Mtx* perspMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx));
|
|
|
|
Mtx* lookAtMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3129);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
{ s32 pad[2]; }
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
opaRef = POLY_OPA_DISP;
|
|
|
|
POLY_OPA_DISP++;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
xluRef = POLY_XLU_DISP;
|
|
|
|
POLY_XLU_DISP++;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPDisplayList(WORK_DISP++, POLY_OPA_DISP);
|
|
|
|
gSPDisplayList(WORK_DISP++, POLY_XLU_DISP);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPLoadGeometryMode(POLY_OPA_DISP++, 0);
|
|
|
|
gSPTexture(POLY_OPA_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
|
|
|
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_SHADE, G_CC_SHADE);
|
|
|
|
gDPSetOtherMode(POLY_OPA_DISP++,
|
2020-09-19 01:45:39 +00:00
|
|
|
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
|
|
|
G_TD_CLAMP | G_TP_PERSP | G_CYC_FILL | G_PM_NPRIMITIVE,
|
|
|
|
G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
|
2021-04-14 19:14:07 +00:00
|
|
|
gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width, height);
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, depthFrameBuffer);
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
|
|
|
|
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
|
2022-03-13 00:06:43 +00:00
|
|
|
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_ZDZ(G_MAXFBZ, 0) << 16) | GPACK_ZDZ(G_MAXFBZ, 0));
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, colorFrameBuffer);
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
|
|
|
|
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
|
|
|
|
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
|
|
|
|
gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gDPPipeSync(POLY_OPA_DISP++);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
gDPSetDepthImage(POLY_OPA_DISP++, depthFrameBuffer);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * ((1 << 2) / 2);
|
|
|
|
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * ((1 << 2) / 2);
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPViewport(POLY_OPA_DISP++, &viewport);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
guPerspective(perspMtx, &perspNorm, fovy, (f32)width / (f32)height, 10.0f, 4000.0f, 1.0f);
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPPerspNormalize(POLY_OPA_DISP++, perspNorm);
|
|
|
|
gSPMatrix(POLY_OPA_DISP++, perspMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
guLookAt(lookAtMtx, eye->x, eye->y, eye->z, at->x, at->y, at->z, 0.0f, 1.0f, 0.0f);
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPMatrix(POLY_OPA_DISP++, lookAtMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-20 22:42:01 +00:00
|
|
|
playerSwordAndShield[0] = sword;
|
|
|
|
playerSwordAndShield[1] = shield;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-01-10 23:28:01 +00:00
|
|
|
Matrix_SetTranslateRotateYXZ(pos->x, pos->y, pos->z, rot);
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x04, gameplayKeep);
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x06, linkObject);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSetLights1(POLY_OPA_DISP++, lights1);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
func_80093C80(globalCtx);
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP++, 0, 0, 0, 0, 997, 1000);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
func_8002EABC(pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx);
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
Player_DrawImpl(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
|
2022-03-20 22:42:01 +00:00
|
|
|
Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPEndDisplayList(POLY_OPA_DISP++);
|
|
|
|
gSPEndDisplayList(POLY_XLU_DISP++);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPBranchList(opaRef, POLY_OPA_DISP);
|
|
|
|
gSPBranchList(xluRef, POLY_XLU_DISP);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288);
|
|
|
|
}
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
|
|
|
|
s32 sword, s32 tunic, s32 shield, s32 boots) {
|
2020-09-19 01:45:39 +00:00
|
|
|
static Vec3f eye = { 0.0f, 0.0f, -400.0f };
|
|
|
|
static Vec3f at = { 0.0f, 0.0f, 0.0f };
|
|
|
|
Vec3s* destTable;
|
|
|
|
Vec3s* srcTable;
|
|
|
|
s32 i;
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE);
|
|
|
|
gSegments[6] =
|
|
|
|
VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-08-21 23:12:57 +00:00
|
|
|
if (!LINK_IS_ADULT) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (shield == PLAYER_SHIELD_DEKU) {
|
2022-03-13 00:06:43 +00:00
|
|
|
srcTable = gLinkPauseChildDekuShieldJointTable;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
2022-03-13 00:06:43 +00:00
|
|
|
srcTable = gLinkPauseChildJointTable;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (sword == 3) {
|
2022-03-13 00:06:43 +00:00
|
|
|
srcTable = gLinkPauseAdultBgsJointTable;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (shield != PLAYER_SHIELD_NONE) {
|
2022-03-13 00:06:43 +00:00
|
|
|
srcTable = gLinkPauseAdultShieldJointTable;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
2022-03-13 00:06:43 +00:00
|
|
|
srcTable = gLinkPauseAdultJointTable;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
srcTable = SEGMENTED_TO_VIRTUAL(srcTable);
|
2021-05-02 23:15:16 +00:00
|
|
|
destTable = skelAnime->jointTable;
|
|
|
|
for (i = 0; i < skelAnime->limbCount; i++) {
|
2020-09-19 01:45:39 +00:00
|
|
|
*destTable++ = *srcTable++;
|
|
|
|
}
|
|
|
|
|
2022-03-13 00:06:43 +00:00
|
|
|
Player_DrawPauseImpl(globalCtx, segment + PAUSE_EQUIP_BUFFER_SIZE,
|
|
|
|
segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE, skelAnime,
|
|
|
|
pos, rot, scale, sword, tunic, shield, boots, PAUSE_EQUIP_PLAYER_WIDTH,
|
|
|
|
PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer,
|
|
|
|
globalCtx->state.gfxCtx->curFrameBuffer +
|
|
|
|
(PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT));
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|