2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2022-06-06 19:37:25 +00:00
|
|
|
#include "assets/objects/gameplay_keep/gameplay_keep.h"
|
|
|
|
#include "assets/objects/object_link_boy/object_link_boy.h"
|
|
|
|
#include "assets/objects/object_link_child/object_link_child.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
typedef struct {
|
2022-05-29 11:52:15 +00:00
|
|
|
/* 0x00 */ Gfx* dList;
|
2020-09-19 01:45:39 +00:00
|
|
|
/* 0x04 */ Vec3f pos;
|
2022-05-29 11:52:15 +00:00
|
|
|
} BowSlingshotStringData; // size = 0x10
|
2020-09-19 01:45:39 +00:00
|
|
|
|
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 },
|
|
|
|
};
|
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
// Used to map item actions to model groups
|
|
|
|
u8 sActionModelGroups[PLAYER_IA_MAX] = {
|
2023-11-07 19:11:59 +00:00
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NONE
|
|
|
|
PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_CS
|
|
|
|
PLAYER_MODELGROUP_10, // PLAYER_IA_FISHING_POLE
|
|
|
|
PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_IA_SWORD_MASTER
|
|
|
|
PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_IA_SWORD_KOKIRI
|
|
|
|
PLAYER_MODELGROUP_BGS, // PLAYER_IA_SWORD_BIGGORON
|
|
|
|
PLAYER_MODELGROUP_10, // PLAYER_IA_DEKU_STICK
|
|
|
|
PLAYER_MODELGROUP_HAMMER, // PLAYER_IA_HAMMER
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_FIRE
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_ICE
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_LIGHT
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0C
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0D
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0E
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_SLINGSHOT
|
|
|
|
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_HOOKSHOT
|
|
|
|
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_LONGSHOT
|
|
|
|
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMB
|
|
|
|
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMBCHU
|
|
|
|
PLAYER_MODELGROUP_BOOMERANG, // PLAYER_IA_BOOMERANG
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_15
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_16
|
|
|
|
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_MAGIC_SPELL_17
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FARORES_WIND
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NAYRUS_LOVE
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DINS_FIRE
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DEKU_NUT
|
|
|
|
PLAYER_MODELGROUP_OCARINA, // PLAYER_IA_OCARINA_FAIRY
|
|
|
|
PLAYER_MODELGROUP_OOT, // PLAYER_IA_OCARINA_OF_TIME
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FIRE
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BUG
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POE
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BIG_POE
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_RUTOS_LETTER
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_RED
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_BLUE
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_GREEN
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_FULL
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_HALF
|
|
|
|
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FAIRY
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ZELDAS_LETTER
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_WEIRD_EGG
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CHICKEN
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_BEAN
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_EGG
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_CUCCO
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_COJIRO
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_MUSHROOM
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_POTION
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POACHERS_SAW
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BROKEN_GORONS_SWORD
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PRESCRIPTION
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FROG
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_EYEDROPS
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CLAIM_CHECK
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_KEATON
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SKULL
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SPOOKY
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_BUNNY_HOOD
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GORON
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_ZORA
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GERUDO
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_TRUTH
|
|
|
|
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS_OF_TRUTH
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-11-16 18:41:27 +00:00
|
|
|
typedef struct {
|
|
|
|
/* 0x0 */ u8 flag;
|
|
|
|
/* 0x2 */ u16 textId;
|
|
|
|
} EnvHazardTextTriggerEntry; // size = 0x4
|
|
|
|
|
|
|
|
EnvHazardTextTriggerEntry sEnvHazardTextTriggers[] = {
|
|
|
|
{ ENV_HAZARD_TEXT_TRIGGER_HOTROOM, 0x3040 }, // PLAYER_ENV_HAZARD_HOTROOM - 1
|
|
|
|
{ ENV_HAZARD_TEXT_TRIGGER_UNDERWATER, 0x401D }, // PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1
|
|
|
|
{ 0, 0x0000 }, // PLAYER_ENV_HAZARD_SWIMMING - 1
|
|
|
|
{ ENV_HAZARD_TEXT_TRIGGER_UNDERWATER, 0x401D }, // PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// 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 },
|
2023-11-07 19:11:59 +00:00
|
|
|
/* PLAYER_MODELGROUP_SWORD_AND_SHIELD */
|
2022-03-20 22:42:01 +00:00
|
|
|
{ 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 },
|
2023-11-07 19:11:59 +00:00
|
|
|
/* PLAYER_MODELGROUP_SWORD */
|
2022-03-20 22:42:01 +00:00
|
|
|
{ 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-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerRightHandShieldDLs[PLAYER_SHIELD_MAX * 4] = {
|
2022-03-20 22:42:01 +00:00
|
|
|
// 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-05-29 11:52:15 +00:00
|
|
|
Gfx* D_80125D28[(PLAYER_SHIELD_MAX + 2) * 4] = {
|
2022-03-20 22:42:01 +00:00
|
|
|
// 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,
|
2022-05-29 11:52:15 +00:00
|
|
|
// PLAYER_SHIELD_NONE (child, no sword)
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
// PLAYER_SHIELD_DEKU (child, no sword)
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* gPlayerLeftHandBgsDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* gPlayerLeftHandOpenDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* gPlayerLeftHandClosedDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// Identical to `sPlayerLeftHandSwordDLs` and unused
|
|
|
|
Gfx* sPlayerLeftHandSwordDLs2[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerLeftHandSwordDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerRightHandOpenDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerRightHandClosedDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerRightHandBowSlingshotDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerWaistDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// Identical to `sPlayerRightHandBowSlingshotDLs` and unused
|
|
|
|
Gfx* sPlayerRightHandBowSlingshotDLs2[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandHoldingBowNearDL,
|
|
|
|
gLinkChildRightHandHoldingSlingshotNearDL,
|
|
|
|
gLinkAdultRightHandHoldingBowFarDL,
|
|
|
|
gLinkChildRightHandHoldingSlingshotFarDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerRightHandOcarinaDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerRightHandOotDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerRightHandHookshotDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerLeftHandHammerDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* gPlayerLeftHandBoomerangDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sPlayerLeftHandBottleDLs[] = {
|
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
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sFirstPersonLeftForearmDLs[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightArmOutNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sFirstPersonLeftHandDLs[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightHandOutNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sFirstPersonRightShoulderDLs[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultRightShoulderNearDL,
|
|
|
|
gLinkChildRightShoulderNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sFirstPersonForearmDLs[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
gLinkAdultLeftArmOutNearDL,
|
2020-09-19 01:45:39 +00:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Gfx* sFirstPersonRightHandHoldingWeaponDLs[] = {
|
2021-12-27 13:08:26 +00:00
|
|
|
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] = {
|
2022-05-29 11:52:15 +00:00
|
|
|
gPlayerLeftHandOpenDLs, // PLAYER_MODELTYPE_LH_OPEN
|
|
|
|
gPlayerLeftHandClosedDLs, // PLAYER_MODELTYPE_LH_CLOSED
|
|
|
|
sPlayerLeftHandSwordDLs, // PLAYER_MODELTYPE_LH_SWORD
|
|
|
|
sPlayerLeftHandSwordDLs2, // PLAYER_MODELTYPE_LH_SWORD_2
|
|
|
|
gPlayerLeftHandBgsDLs, // PLAYER_MODELTYPE_LH_BGS
|
|
|
|
sPlayerLeftHandHammerDLs, // PLAYER_MODELTYPE_LH_HAMMER
|
|
|
|
gPlayerLeftHandBoomerangDLs, // PLAYER_MODELTYPE_LH_BOOMERANG
|
|
|
|
sPlayerLeftHandBottleDLs, // PLAYER_MODELTYPE_LH_BOTTLE
|
|
|
|
sPlayerRightHandOpenDLs, // PLAYER_MODELTYPE_RH_OPEN
|
|
|
|
sPlayerRightHandClosedDLs, // PLAYER_MODELTYPE_RH_CLOSED
|
|
|
|
sPlayerRightHandShieldDLs, // PLAYER_MODELTYPE_RH_SHIELD
|
|
|
|
sPlayerRightHandBowSlingshotDLs, // PLAYER_MODELTYPE_RH_BOW_SLINGSHOT
|
|
|
|
sPlayerRightHandBowSlingshotDLs2, // PLAYER_MODELTYPE_RH_BOW_SLINGSHOT_2
|
|
|
|
sPlayerRightHandOcarinaDLs, // PLAYER_MODELTYPE_RH_OCARINA
|
|
|
|
sPlayerRightHandOotDLs, // PLAYER_MODELTYPE_RH_OOT
|
|
|
|
sPlayerRightHandHookshotDLs, // PLAYER_MODELTYPE_RH_HOOKSHOT
|
|
|
|
D_80125E78, // PLAYER_MODELTYPE_SHEATH_16
|
|
|
|
D_80125E88, // PLAYER_MODELTYPE_SHEATH_17
|
|
|
|
D_80125D28, // PLAYER_MODELTYPE_SHEATH_18
|
|
|
|
D_80125D88, // PLAYER_MODELTYPE_SHEATH_19
|
|
|
|
sPlayerWaistDLs, // PLAYER_MODELTYPE_WAIST
|
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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_SetBootData(PlayState* play, 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;
|
2022-04-30 16:18:56 +00:00
|
|
|
if (currentBoots == PLAYER_BOOTS_KOKIRI) {
|
2021-08-21 23:12:57 +00:00
|
|
|
if (!LINK_IS_ADULT) {
|
2022-04-30 16:18:56 +00:00
|
|
|
currentBoots = PLAYER_BOOTS_KOKIRI_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];
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_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
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int Player_InBlockingCsMode(PlayState* play, Player* this) {
|
2023-09-26 16:48:41 +00:00
|
|
|
return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csAction != PLAYER_CSACTION_NONE) ||
|
2022-05-21 18:23:43 +00:00
|
|
|
(play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) ||
|
2022-01-18 00:04:07 +00:00
|
|
|
(this->stateFlags3 & PLAYER_STATE3_7) ||
|
2022-10-09 13:59:57 +00:00
|
|
|
((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int Player_InCsMode(PlayState* play) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Player* this = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
return Player_InBlockingCsMode(play, 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
|
|
|
}
|
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int Player_IsChildWithHylianShield(Player* this) {
|
2023-08-13 19:24:26 +00:00
|
|
|
return gSaveContext.save.linkAge != LINK_AGE_ADULT && (this->currentShield == PLAYER_SHIELD_HYLIAN);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
s32 Player_ActionToModelGroup(Player* this, s32 itemAction) {
|
|
|
|
s32 modelGroup = sActionModelGroups[itemAction];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2023-11-07 19:11:59 +00:00
|
|
|
if ((modelGroup == PLAYER_MODELGROUP_SWORD_AND_SHIELD) && Player_IsChildWithHylianShield(this)) {
|
2022-03-20 22:42:01 +00:00
|
|
|
// 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) &&
|
2022-10-09 13:59:57 +00:00
|
|
|
((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) {
|
2022-03-20 22:42:01 +00:00
|
|
|
this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD;
|
2023-08-13 19:24:26 +00:00
|
|
|
this->rightHandDLists =
|
|
|
|
sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD] + ((void)0, gSaveContext.save.linkAge);
|
2022-03-20 22:42:01 +00:00
|
|
|
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
|
|
|
}
|
2023-08-13 19:24:26 +00:00
|
|
|
this->sheathDLists = sPlayerDListGroups[this->sheathType] + ((void)0, gSaveContext.save.linkAge);
|
2022-03-20 22:42:01 +00:00
|
|
|
this->modelAnimType = PLAYER_ANIMTYPE_2;
|
2022-10-09 13:59:57 +00:00
|
|
|
this->itemAction = -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];
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
this->leftHandDLists = sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND]] +
|
2023-08-13 19:24:26 +00:00
|
|
|
((void)0, gSaveContext.save.linkAge);
|
2022-05-29 11:52:15 +00:00
|
|
|
this->rightHandDLists = sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]] +
|
2023-08-13 19:24:26 +00:00
|
|
|
((void)0, gSaveContext.save.linkAge);
|
2022-05-29 11:52:15 +00:00
|
|
|
this->sheathDLists = sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]] +
|
2023-08-13 19:24:26 +00:00
|
|
|
((void)0, gSaveContext.save.linkAge);
|
2022-05-29 11:52:15 +00:00
|
|
|
this->waistDLists = sPlayerDListGroups[gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_WAIST]] +
|
2023-08-13 19:24:26 +00:00
|
|
|
((void)0, gSaveContext.save.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) {
|
2022-10-09 13:59:57 +00:00
|
|
|
this->itemAction = this->heldItemAction;
|
|
|
|
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemAction));
|
2020-09-19 01:45:39 +00:00
|
|
|
this->unk_6AD = 0;
|
|
|
|
}
|
2020-06-14 03:29:59 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_SetEquipmentData(PlayState* play, Player* this) {
|
2023-09-26 16:48:41 +00:00
|
|
|
if (this->csAction != PLAYER_CSACTION_86) {
|
2022-04-30 16:18:56 +00:00
|
|
|
this->currentShield = SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD));
|
|
|
|
this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
|
|
|
|
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
|
|
|
|
this->currentSwordItemId = B_BTN_ITEM;
|
2022-10-09 13:59:57 +00:00
|
|
|
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemAction));
|
2022-05-21 18:23:43 +00:00
|
|
|
Player_SetBootData(play, this);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAction) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Inventory_UpdateBottleItem(play, item, this->heldItemButton);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-11-16 18:23:27 +00:00
|
|
|
if (item != ITEM_BOTTLE_EMPTY) {
|
2020-09-19 01:45:39 +00:00
|
|
|
this->heldItemId = item;
|
2022-10-09 13:59:57 +00:00
|
|
|
this->heldItemAction = itemAction;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
this->itemAction = itemAction;
|
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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void func_8008EEAC(PlayState* play, Actor* actor) {
|
|
|
|
Player* this = GET_PLAYER(play);
|
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;
|
2022-12-05 04:02:24 +00:00
|
|
|
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor);
|
2023-11-19 01:17:32 +00:00
|
|
|
Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_TARGET_FRIENDLY);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
s32 func_8008EF30(PlayState* play) {
|
|
|
|
Player* this = GET_PLAYER(play);
|
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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
s32 func_8008EF44(PlayState* play, s32 ammo) {
|
|
|
|
play->shootingGalleryStatus = ammo + 1;
|
2020-03-17 04:31:30 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Player* this = GET_PLAYER(play);
|
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
|
|
|
|
2022-11-16 18:23:27 +00:00
|
|
|
if ((this->heldItemAction == PLAYER_IA_DEKU_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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
u8 Player_GetMask(PlayState* play) {
|
|
|
|
Player* this = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
return this->currentMask;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
Player* Player_UnsetMask(PlayState* play) {
|
|
|
|
Player* this = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
this->currentMask = PLAYER_MASK_NONE;
|
|
|
|
|
|
|
|
return this;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
s32 Player_HasMirrorShieldEquipped(PlayState* play) {
|
|
|
|
Player* this = GET_PLAYER(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
return (this->currentShield == PLAYER_SHIELD_MIRROR);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int Player_HasMirrorShieldSetToDraw(PlayState* play) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Player* this = GET_PLAYER(play);
|
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
|
|
|
}
|
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
s32 Player_ActionToMagicSpell(Player* this, s32 itemAction) {
|
|
|
|
s32 magicSpell = itemAction - PLAYER_IA_MAGIC_SPELL_15;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
if ((magicSpell >= 0) && (magicSpell < 6)) {
|
|
|
|
return magicSpell;
|
|
|
|
} else {
|
|
|
|
return -1;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int Player_HoldsHookshot(Player* this) {
|
2022-10-09 13:59:57 +00:00
|
|
|
return (this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int func_8008F128(Player* this) {
|
2020-09-19 01:45:39 +00:00
|
|
|
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
s32 Player_ActionToMeleeWeapon(s32 itemAction) {
|
|
|
|
s32 meleeWeapon = itemAction - PLAYER_IA_FISHING_POLE;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
if ((meleeWeapon > 0) && (meleeWeapon < 6)) {
|
|
|
|
return meleeWeapon;
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
|
|
|
return 0;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
s32 Player_GetMeleeWeaponHeld(Player* this) {
|
2022-10-09 13:59:57 +00:00
|
|
|
return Player_ActionToMeleeWeapon(this->heldItemAction);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 Player_HoldsTwoHandedWeapon(Player* this) {
|
2023-01-10 18:03:31 +00:00
|
|
|
if ((this->heldItemAction >= PLAYER_IA_SWORD_BIGGORON) && (this->heldItemAction <= PLAYER_IA_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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 19:16:31 +00:00
|
|
|
int Player_HoldsBrokenKnife(Player* this) {
|
2023-08-13 19:24:26 +00:00
|
|
|
return (this->heldItemAction == PLAYER_IA_SWORD_BIGGORON) &&
|
|
|
|
(gSaveContext.save.info.playerData.swordHealth <= 0.0f);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
s32 Player_ActionToBottle(Player* this, s32 itemAction) {
|
|
|
|
s32 bottle = itemAction - PLAYER_IA_BOTTLE;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
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) {
|
2022-10-09 13:59:57 +00:00
|
|
|
return Player_ActionToBottle(this, this->heldItemAction);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
s32 Player_ActionToExplosive(Player* this, s32 itemAction) {
|
|
|
|
s32 explosive = itemAction - PLAYER_IA_BOMB;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
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) {
|
2022-10-09 13:59:57 +00:00
|
|
|
return Player_ActionToExplosive(this, this->heldItemAction);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-09 13:59:57 +00:00
|
|
|
s32 func_8008F2BC(Player* this, s32 itemAction) {
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 sword = 0;
|
|
|
|
|
2023-11-07 19:11:59 +00:00
|
|
|
if (itemAction != PLAYER_IA_SWORD_CS) {
|
2022-10-09 13:59:57 +00:00
|
|
|
sword = itemAction - PLAYER_IA_SWORD_MASTER;
|
2020-09-19 01:45:39 +00:00
|
|
|
if ((sword < 0) || (sword >= 3)) {
|
|
|
|
goto return_neg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sword;
|
|
|
|
|
|
|
|
return_neg:
|
|
|
|
return -1;
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-11-16 18:41:27 +00:00
|
|
|
s32 Player_GetEnvironmentalHazard(PlayState* play) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Player* this = GET_PLAYER(play);
|
2022-11-16 18:41:27 +00:00
|
|
|
EnvHazardTextTriggerEntry* triggerEntry;
|
|
|
|
s32 envHazard;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot
|
2022-11-16 18:41:27 +00:00
|
|
|
envHazard = PLAYER_ENV_HAZARD_HOTROOM - 1;
|
|
|
|
} else if ((this->underwaterTimer > 80) &&
|
|
|
|
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->underwaterTimer >= 300))) {
|
|
|
|
envHazard = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))
|
|
|
|
? (PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1)
|
|
|
|
: (PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1);
|
2022-01-18 00:04:07 +00:00
|
|
|
} else if (this->stateFlags1 & PLAYER_STATE1_27) { // Swimming
|
2022-11-16 18:41:27 +00:00
|
|
|
envHazard = PLAYER_ENV_HAZARD_SWIMMING - 1;
|
2020-05-20 00:15:48 +00:00
|
|
|
} else {
|
2022-11-16 18:41:27 +00:00
|
|
|
return PLAYER_ENV_HAZARD_NONE;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-11-16 18:41:27 +00:00
|
|
|
triggerEntry = &sEnvHazardTextTriggers[envHazard];
|
2022-05-21 18:23:43 +00:00
|
|
|
if (!Player_InCsMode(play)) {
|
2022-11-16 18:41:27 +00:00
|
|
|
if ((triggerEntry->flag != 0) && !(gSaveContext.envHazardTextTriggerFlags & triggerEntry->flag) &&
|
|
|
|
(((envHazard == (PLAYER_ENV_HAZARD_HOTROOM - 1)) && (this->currentTunic != PLAYER_TUNIC_GORON)) ||
|
|
|
|
(((envHazard == (PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1)) ||
|
|
|
|
(envHazard == (PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1))) &&
|
|
|
|
(this->currentBoots == PLAYER_BOOTS_IRON) && (this->currentTunic != PLAYER_TUNIC_ZORA)))) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Message_StartTextbox(play, triggerEntry->textId, NULL);
|
2022-11-16 18:41:27 +00:00
|
|
|
gSaveContext.envHazardTextTriggerFlags |= triggerEntry->flag;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-11-16 18:41:27 +00:00
|
|
|
return envHazard + 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-04-30 16:18:56 +00:00
|
|
|
{ gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL }, // PLAYER_BOOTS_IRON
|
|
|
|
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, // PLAYER_BOOTS_HOVER
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_DrawImpl(PlayState* play, 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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 1721);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
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
|
2023-08-13 19:24:26 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[gSaveContext.save.linkAge][eyeIndex]));
|
2022-02-19 21:50:56 +00:00
|
|
|
#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
|
2023-08-13 19:24:26 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[gSaveContext.save.linkAge][mouthIndex]));
|
2022-02-19 21:50:56 +00:00
|
|
|
#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;
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
SkelAnime_DrawFlexLod(play, 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) &&
|
2022-10-23 21:32:51 +00:00
|
|
|
(overrideLimbDraw != Player_OverrideLimbDrawGameplayCrawling) &&
|
2022-06-24 01:32:48 +00:00
|
|
|
(gSaveContext.gameMode != GAMEMODE_END_CREDITS)) {
|
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
|
|
|
}
|
|
|
|
|
2022-04-30 16:18:56 +00:00
|
|
|
if (boots != PLAYER_BOOTS_KOKIRI) {
|
|
|
|
Gfx** bootDLists = sBootDListGroups[boots - PLAYER_BOOTS_IRON];
|
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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 1803);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
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 };
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, s32 thighLimbIndex,
|
|
|
|
s32 shinLimbIndex, s32 footLimbIndex) {
|
2020-09-19 01:45:39 +00:00
|
|
|
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) &&
|
2022-10-09 13:59:57 +00:00
|
|
|
(Player_ActionToMagicSpell(this, this->itemAction) < 0)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 pad;
|
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
sp7C = D_80126058[(void)0, gSaveContext.save.linkAge];
|
|
|
|
sp78 = D_80126060[(void)0, gSaveContext.save.linkAge];
|
|
|
|
sp74 = D_80126068[(void)0, gSaveContext.save.linkAge] - this->unk_6C4;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
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);
|
2023-08-13 19:24:26 +00:00
|
|
|
Matrix_TranslateRotateZYX(&D_80126038[(void)0, gSaveContext.save.linkAge],
|
|
|
|
&skelAnime->jointTable[shinLimbIndex]);
|
|
|
|
Matrix_Translate(D_80126050[(void)0, gSaveContext.save.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
|
|
|
|
2022-08-30 15:49:51 +00:00
|
|
|
sp80 = BgCheck_EntityRaycastDown4(&play->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)));
|
2023-11-22 09:19:31 +00:00
|
|
|
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
|
|
|
|
2022-07-31 18:57:18 +00:00
|
|
|
temp3 = SurfaceType_GetFloorType(&play->colCtx, sp88, sp84);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-07-31 18:57:18 +00:00
|
|
|
if ((temp3 >= FLOOR_TYPE_2) && (temp3 <= FLOOR_TYPE_3) && !func_80042108(&play->colCtx, sp88, sp84)) {
|
2020-09-30 00:18:46 +00:00
|
|
|
footprintPos.y = sp80;
|
2022-05-21 18:23:43 +00:00
|
|
|
EffectSsGFire_Spawn(play, &footprintPos);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
2022-03-13 00:06:43 +00:00
|
|
|
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.
|
2023-11-12 21:59:52 +00:00
|
|
|
sCurBodyPartPos = &this->bodyPartsPos[0] - 1;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-08-21 23:12:57 +00:00
|
|
|
if (!LINK_IS_ADULT) {
|
2023-08-15 20:23:53 +00:00
|
|
|
if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2) || (this->skelAnime.moveFlags & ANIM_FLAG_0)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
pos->x *= 0.64f;
|
|
|
|
pos->z *= 0.64f;
|
|
|
|
}
|
|
|
|
|
2023-08-15 20:23:53 +00:00
|
|
|
if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2) || (this->skelAnime.moveFlags & ANIM_FLAG_UPDATE_Y)) {
|
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) {
|
2022-05-21 18:23:43 +00:00
|
|
|
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,
|
2020-09-19 01:45:39 +00:00
|
|
|
PLAYER_LIMB_L_FOOT);
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_THIGH) {
|
2022-05-21 18:23:43 +00:00
|
|
|
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN,
|
2020-09-19 01:45:39 +00:00
|
|
|
PLAYER_LIMB_R_FOOT);
|
|
|
|
} 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-05-21 18:23:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
2022-03-13 00:06:43 +00:00
|
|
|
void* thisx) {
|
2020-12-02 03:19:56 +00:00
|
|
|
Player* this = (Player*)thisx;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (limbIndex == PLAYER_LIMB_L_HAND) {
|
|
|
|
Gfx** dLists = this->leftHandDLists;
|
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
if ((sLeftHandType == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.save.info.playerData.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)) {
|
2023-08-13 19:24:26 +00:00
|
|
|
dLists = gPlayerLeftHandOpenDLs + gSaveContext.save.linkAge;
|
2022-03-20 22:42:01 +00:00
|
|
|
sLeftHandType = PLAYER_MODELTYPE_LH_OPEN;
|
2022-12-24 17:18:57 +00:00
|
|
|
} else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speed > 2.0f) &&
|
2022-01-18 00:04:07 +00:00
|
|
|
!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
2023-08-13 19:24:26 +00:00
|
|
|
dLists = gPlayerLeftHandClosedDLs + gSaveContext.save.linkAge;
|
2022-03-20 22:42:01 +00:00
|
|
|
sLeftHandType = PLAYER_MODELTYPE_LH_CLOSED;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
*dList = *(dLists + sDListsLodOffset);
|
2020-09-19 01:45:39 +00:00
|
|
|
} 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-12-24 17:18:57 +00:00
|
|
|
} else if ((this->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (this->actor.speed > 2.0f) &&
|
2022-01-18 00:04:07 +00:00
|
|
|
!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
2023-08-13 19:24:26 +00:00
|
|
|
dLists = sPlayerRightHandClosedDLs + gSaveContext.save.linkAge;
|
2022-03-20 22:42:01 +00:00
|
|
|
sRightHandType = PLAYER_MODELTYPE_RH_CLOSED;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
*dList = *(dLists + sDListsLodOffset);
|
2020-09-19 01:45:39 +00:00
|
|
|
} 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) &&
|
2023-08-13 19:24:26 +00:00
|
|
|
(gSaveContext.save.info.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)) &&
|
2023-08-13 19:24:26 +00:00
|
|
|
(gSaveContext.save.info.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) {
|
2022-05-29 11:52:15 +00:00
|
|
|
dLists = D_80125D28 + PLAYER_SHIELD_MAX * 4;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
*dList = *(dLists + sDListsLodOffset);
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_WAIST) {
|
2022-05-29 11:52:15 +00:00
|
|
|
*dList = *(this->waistDLists + sDListsLodOffset);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
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-05-21 18:23:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, 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-05-21 18:23:43 +00:00
|
|
|
if (!Player_OverrideLimbDrawGameplayCommon(play, 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) {
|
2023-08-13 19:24:26 +00:00
|
|
|
*dList = sFirstPersonLeftForearmDLs[(void)0, gSaveContext.save.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
|
2023-08-13 19:24:26 +00:00
|
|
|
*dList = sFirstPersonLeftHandDLs[(void)0, gSaveContext.save.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_SHOULDER) {
|
2023-08-13 19:24:26 +00:00
|
|
|
*dList = sFirstPersonRightShoulderDLs[(void)0, gSaveContext.save.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_FOREARM) {
|
2023-08-13 19:24:26 +00:00
|
|
|
*dList = sFirstPersonForearmDLs[(void)0, gSaveContext.save.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
2023-08-13 19:24:26 +00:00
|
|
|
*dList = Player_HoldsHookshot(this)
|
|
|
|
? gLinkAdultRightHandHoldingHookshotFarDL
|
|
|
|
: sFirstPersonRightHandHoldingWeaponDLs[(void)0, gSaveContext.save.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-10-23 21:32:51 +00:00
|
|
|
s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
|
|
|
void* thisx) {
|
2022-05-21 18:23:43 +00:00
|
|
|
if (!Player_OverrideLimbDrawGameplayCommon(play, 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
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase) {
|
2020-09-19 01:45:39 +00:00
|
|
|
if (weaponInfo->active == 0) {
|
2020-05-20 00:15:48 +00:00
|
|
|
if (collider != NULL) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Collider_ResetQuadAT(play, &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;
|
2022-05-29 11:52:15 +00:00
|
|
|
return true;
|
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) {
|
2022-05-21 18:23:43 +00:00
|
|
|
Collider_ResetQuadAT(play, &collider->base);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2022-05-29 11:52:15 +00:00
|
|
|
return false;
|
2020-09-19 01:45:39 +00:00
|
|
|
} 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);
|
2022-05-21 18:23:43 +00:00
|
|
|
CollisionCheck_SetAT(play, &play->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;
|
2022-05-29 11:52:15 +00:00
|
|
|
return true;
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
void Player_UpdateShieldCollider(PlayState* play, Player* this, ColliderQuad* collider, Vec3f* quadSrc) {
|
2020-09-19 01:45:39 +00:00
|
|
|
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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base);
|
|
|
|
CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
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 },
|
|
|
|
};
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) {
|
2020-09-19 01:45:39 +00:00
|
|
|
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-05-21 18:23:43 +00:00
|
|
|
if (func_80090480(play, 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-05-21 18:23:43 +00:00
|
|
|
func_80090480(play, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]);
|
|
|
|
func_80090480(play, &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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne) {
|
2020-09-19 01:45:39 +00:00
|
|
|
f32 height = (this->exchangeItemId != EXCH_ITEM_NONE) ? 6.0f : 14.0f;
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
OPEN_DISPS(play->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);
|
2022-05-21 18:23:43 +00:00
|
|
|
Matrix_RotateZYX(0, play->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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
GetItem_Draw(play, drawIdPlusOne - 1);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2421);
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_DrawGetItem(PlayState* play, 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;
|
2022-05-21 18:23:43 +00:00
|
|
|
Player_DrawGetItemImpl(play, 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) {
|
2023-02-26 20:48:42 +00:00
|
|
|
this->unk_845++;
|
2020-09-19 01:45:39 +00:00
|
|
|
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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_DrawHookshotReticle(PlayState* play, 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) {}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
if (BgCheck_AnyLineTest3(&play->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) {
|
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2572);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2022-06-03 22:25:48 +00:00
|
|
|
OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_7);
|
2020-05-20 00:15:48 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
SkinMatrix_Vec3fMtxFMultXYZW(&play->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);
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2587),
|
2020-05-20 00:15:48 +00:00
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
2023-09-19 18:10:12 +00:00
|
|
|
gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
|
2021-12-27 13:08:26 +00:00
|
|
|
gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2592);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// Coordinates of the player focus position, in the head limb's own model space.
|
|
|
|
Vec3f sPlayerFocusHeadLimbModelPos = { 1100.0f, -700.0f, 0.0f };
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-02-20 23:45:12 +00:00
|
|
|
f32 sMeleeWeaponLengths[] = {
|
2022-05-29 11:52:15 +00:00
|
|
|
0.0f, // not a melee weapon
|
|
|
|
4000.0f, // Master Sword
|
|
|
|
3000.0f, // Kokiri Sword
|
|
|
|
5500.0f, // Biggoron's Sword
|
|
|
|
0.0f, // Deku Stick
|
|
|
|
2500.0f, // Hammer
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2021-12-27 13:08:26 +00:00
|
|
|
Gfx* sBottleDLists[] = { gLinkAdultBottleDL, gLinkChildBottleDL };
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
Color_RGB8 sBottleColors[] = {
|
2022-05-29 11:52:15 +00:00
|
|
|
{ 255, 255, 255 }, // Empty
|
|
|
|
{ 80, 80, 255 }, // Fish
|
|
|
|
{ 255, 100, 255 }, // Fire
|
|
|
|
{ 0, 0, 255 }, // Bug
|
|
|
|
{ 255, 0, 255 }, // Poe
|
|
|
|
{ 255, 0, 255 }, // Big Poe
|
|
|
|
{ 200, 200, 100 }, // Letter
|
|
|
|
{ 255, 0, 0 }, // Red Potion
|
|
|
|
{ 0, 0, 255 }, // Blue Potion
|
|
|
|
{ 0, 255, 0 }, // Green Potion
|
|
|
|
{ 255, 255, 255 }, // Milk
|
|
|
|
{ 255, 255, 255 }, // Half Milk
|
|
|
|
{ 80, 80, 255 }, // Fairy
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Vec3f D_80126128 = { 398.0f, 1419.0f, 244.0f };
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
BowSlingshotStringData sBowSlingshotStringData[] = {
|
2023-11-11 23:01:55 +00:00
|
|
|
{ gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // Bow
|
|
|
|
{ gLinkChildSlingshotStringDL, { 606.0f, 236.0f, 0.0f } }, // Slingshot
|
2020-09-19 01:45:39 +00:00
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// Coordinates of the shield quad collider vertices, in the right hand limb's own model space.
|
|
|
|
Vec3f sRightHandLimbModelShieldQuadVertices[] = {
|
2020-09-19 01:45:39 +00:00
|
|
|
{ -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 };
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// Coordinates of the shield quad collider vertices, in the sheath limb's own model space.
|
|
|
|
Vec3f sSheathLimbModelShieldQuadVertices[] = {
|
2020-09-19 01:45:39 +00:00
|
|
|
{ -3000.0f, -3000.0f, -900.0f },
|
|
|
|
{ 3000.0f, -3000.0f, -900.0f },
|
|
|
|
{ -3000.0f, 3000.0f, -900.0f },
|
|
|
|
{ 3000.0f, 3000.0f, -900.0f },
|
|
|
|
};
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// Position and rotation of the shield on Link's back, in the sheath limb's own model space.
|
|
|
|
Vec3f sSheathLimbModelShieldOnBackPos = { 630.0f, 100.0f, -30.0f };
|
|
|
|
Vec3s sSheathLimbModelShieldOnBackZyxRot = { 0, 0, 0x7FFF };
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// Position of Link's foot, in the foot limb's own model space.
|
|
|
|
Vec3f sLeftRightFootLimbModelFootPos[] = {
|
2020-09-19 01:45:39 +00:00
|
|
|
{ 200.0f, 300.0f, 0.0f },
|
|
|
|
{ 200.0f, 200.0f, 0.0f },
|
|
|
|
};
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_PostLimbDrawGameplay(PlayState* play, 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
|
|
|
|
2022-11-16 18:23:27 +00:00
|
|
|
if (this->itemAction == PLAYER_IA_DEKU_STICK) {
|
2020-09-19 01:45:39 +00:00
|
|
|
Vec3f sp124[3];
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2633);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
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) {
|
2022-05-21 18:23:43 +00:00
|
|
|
func_800906D4(play, this, sp124);
|
2020-09-19 01:45:39 +00:00
|
|
|
} 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);
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CLOSE_DISPS(play->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);
|
2022-05-21 18:23:43 +00:00
|
|
|
func_800906D4(play, this, spE4);
|
2022-03-20 22:42:01 +00:00
|
|
|
} else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) {
|
2022-10-09 13:59:57 +00:00
|
|
|
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemAction)];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2710);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->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);
|
2023-08-13 19:24:26 +00:00
|
|
|
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[((void)0, gSaveContext.save.linkAge)]);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2717);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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) ||
|
2022-05-29 11:52:15 +00:00
|
|
|
(this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT_2)) {
|
2023-08-13 19:24:26 +00:00
|
|
|
BowSlingshotStringData* stringData = &sBowSlingshotStringData[gSaveContext.save.linkAge];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2783);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CLOSE_DISPS(play->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);
|
2022-05-29 11:52:15 +00:00
|
|
|
Player_UpdateShieldCollider(play, this, &this->shieldQuad, sRightHandLimbModelShieldQuadVertices);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this->actor.scale.y >= 0.0f) {
|
2022-10-09 13:59:57 +00:00
|
|
|
if ((this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT)) {
|
2020-09-19 01:45:39 +00:00
|
|
|
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);
|
2022-10-09 13:59:57 +00:00
|
|
|
Player_DrawHookshotReticle(play, this,
|
|
|
|
(this->heldItemAction == PLAYER_IA_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)) {
|
2022-05-29 11:52:15 +00:00
|
|
|
Player_UpdateShieldCollider(play, this, &this->shieldQuad, sSheathLimbModelShieldQuadVertices);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
Matrix_TranslateRotateZYX(&sSheathLimbModelShieldOnBackPos, &sSheathLimbModelShieldOnBackZyxRot);
|
2020-09-19 01:45:39 +00:00
|
|
|
Matrix_Get(&this->shieldMf);
|
|
|
|
}
|
|
|
|
} else if (limbIndex == PLAYER_LIMB_HEAD) {
|
2022-05-29 11:52:15 +00:00
|
|
|
Matrix_MultVec3f(&sPlayerFocusHeadLimbModelPos, &this->actor.focus.pos);
|
2020-09-19 01:45:39 +00:00
|
|
|
} else {
|
2023-08-13 19:24:26 +00:00
|
|
|
Vec3f* footPos = &sLeftRightFootLimbModelFootPos[((void)0, gSaveContext.save.linkAge)];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
// The same model position is used for both feet,
|
|
|
|
// but the resulting world position will be different for each limb.
|
|
|
|
Actor_SetFeetPos(&this->actor, limbIndex, PLAYER_LIMB_L_FOOT, footPos, PLAYER_LIMB_R_FOOT, footPos);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
2020-05-20 00:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2023-09-06 15:14:15 +00:00
|
|
|
u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime) {
|
2023-08-13 19:24:26 +00:00
|
|
|
s16 linkObjectId = gLinkObjectIds[(void)0, gSaveContext.save.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;
|
2022-11-17 02:57:02 +00:00
|
|
|
DmaMgr_RequestSyncDebug(ptr, gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart, size, "../z_player_lib.c", 2982);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
|
|
|
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;
|
2022-11-17 02:57:02 +00:00
|
|
|
DmaMgr_RequestSyncDebug(ptr, gObjectTable[linkObjectId].vromStart, size, "../z_player_lib.c", 2988);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2023-07-10 19:03:01 +00:00
|
|
|
ptr = (void*)ALIGN16((uintptr_t)ptr + size);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
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
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.save.linkAge],
|
2022-09-12 18:43:06 +00:00
|
|
|
&gPlayerAnim_link_normal_wait, 9, ptr, ptr, PLAYER_LIMB_MAX);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2023-09-06 15:14:15 +00:00
|
|
|
return PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE + size +
|
2022-03-13 00:06:43 +00:00
|
|
|
sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
u8 sPauseModelGroupBySword[] = {
|
2023-11-07 19:11:59 +00:00
|
|
|
PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_SWORD_KOKIRI
|
|
|
|
PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_SWORD_MASTER
|
|
|
|
PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BIGGORON
|
2022-04-30 16:18:56 +00:00
|
|
|
};
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) {
|
2022-03-20 22:42:01 +00:00
|
|
|
u8* playerSwordAndShield = arg;
|
2022-05-29 11:52:15 +00:00
|
|
|
//! @bug `playerSwordAndShield[0]` can be 0 (`PLAYER_SWORD_NONE`), which indexes `sPauseModelGroupBySword[-1]`.
|
|
|
|
//! The result happens to be 0 (`PLAYER_MODELGROUP_0`) in vanilla, but weird values are likely to cause a crash.
|
|
|
|
u8 modelGroup = sPauseModelGroupBySword[playerSwordAndShield[0] - PLAYER_SWORD_KOKIRI];
|
2020-09-19 01:45:39 +00:00
|
|
|
s32 type;
|
|
|
|
s32 dListOffset = 0;
|
|
|
|
Gfx** dLists;
|
|
|
|
|
2023-11-07 19:11:59 +00:00
|
|
|
if ((modelGroup == PLAYER_MODELGROUP_SWORD_AND_SHIELD) && !LINK_IS_ADULT &&
|
2022-03-20 22:42:01 +00:00
|
|
|
(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;
|
2023-08-13 19:24:26 +00:00
|
|
|
if ((type == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.save.info.playerData.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 {
|
2022-05-29 11:52:15 +00:00
|
|
|
return false;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
dLists = sPlayerDListGroups[type] + ((void)0, gSaveContext.save.linkAge);
|
2022-05-29 11:52:15 +00:00
|
|
|
*dList = *(dLists + dListOffset);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-29 11:52:15 +00:00
|
|
|
return false;
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_DrawPauseImpl(PlayState* play, 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) {
|
2022-03-13 00:06:43 +00:00
|
|
|
// 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;
|
2022-05-21 18:23:43 +00:00
|
|
|
Mtx* perspMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
|
|
|
|
Mtx* lookAtMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
OPEN_DISPS(play->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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
func_80093C80(play);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
func_8002EABC(pos, &play->view.eye, &lightDir, play->state.gfxCtx);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
Player_DrawImpl(play, 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
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 3288);
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Player_DrawPause(PlayState* play, 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 {
|
2023-01-10 18:03:31 +00:00
|
|
|
if (sword == PLAYER_SWORD_BIGGORON) {
|
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-05-21 18:23:43 +00:00
|
|
|
Player_DrawPauseImpl(play, segment + PAUSE_EQUIP_BUFFER_SIZE,
|
2022-03-13 00:06:43 +00:00
|
|
|
segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE, skelAnime,
|
|
|
|
pos, rot, scale, sword, tunic, shield, boots, PAUSE_EQUIP_PLAYER_WIDTH,
|
2022-05-21 18:23:43 +00:00
|
|
|
PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, play->state.gfxCtx->curFrameBuffer,
|
|
|
|
play->state.gfxCtx->curFrameBuffer + (PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT));
|
2020-09-19 01:45:39 +00:00
|
|
|
}
|