1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Doc player drawing (#1098)

* Introduce and use more enums and defines for equips and data involved in player drawing

* `EQUIP_TYPE_`, `EQUIP_INV_`, `EQUIP_VALUE_`

* Improve doc on ItemEquips/Inventory's `equipment` field

* Run formatter

* Add `PLAYER_MODELGROUPENTRY_*` for second index of `gPlayerModelTypes`

* Name `PLAYER_MODELGROUPENTRY_*` from existing documentation

* Partial doc on `PLAYER_MODELTYPE_*`

* Some doc on `PLAYER_MODELGROUP_*`

* Run formatter

* Name and some doc/cleanup on the various player draw functions

* Name symbols used for player position in pause menu

* Name player override/post limb draw callbacks

* `BOOTS_NORMAL` -> `BOOTS_KOKIRI`

* `EQUIP_INV_SWORD_GIANTKNIFE` -> `EQUIP_INV_SWORD_BROKENGIANTKNIFE`

* `currentSword` -> `currentSwordItem` to avoid confusion with `PlayerSword` enum

* Make one constant more explicit

* Document severe bug (not an issue by luck)

* Some doc on `PLAYER_MODELTYPE_RH_FF`

* Actually name most of `PlayerModelType`

* Actually name most of `PlayerModelGroup` and improve comments

* Make equipment in debug save data use equip enums

* Name symbol for computing player's `bodyPartsPos` and fix struct access

* Name right/left `HandType` symbols

* Add `PlayerBodyPart` enum

* Run formatter

* Introduce defines for pause player render dimensions and cleanup viewport usage in pause drawing

* Document `playerSegment` related usage

* Run formatter

* Revert player bodypart changes

* Revert equips doc changes

* Revert player model and anim data changes

* Revert drawing-unrelated changes

* Move `sTunicColors` tunic comments to after data
This commit is contained in:
Dragorn421 2022-03-13 01:06:43 +01:00 committed by GitHub
parent a160fb96c8
commit 054bac7583
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 112 additions and 85 deletions

View file

@ -11,19 +11,19 @@
<Texture Name="gLinkTunic2Tex" OutName="link_tunic_2" Format="i8" Width="16" Height="16" Offset="0x1C40"/> <Texture Name="gLinkTunic2Tex" OutName="link_tunic_2" Format="i8" Width="16" Height="16" Offset="0x1C40"/>
<Texture Name="gLinkTunic3Tex" OutName="link_tunic_3" Format="i8" Width="16" Height="32" Offset="0x1D40"/> <Texture Name="gLinkTunic3Tex" OutName="link_tunic_3" Format="i8" Width="16" Height="32" Offset="0x1D40"/>
<Texture Name="gLinkTunic4Tex" OutName="link_tunic_4" Format="i8" Width="16" Height="16" Offset="0x1F40"/> <Texture Name="gLinkTunic4Tex" OutName="link_tunic_4" Format="i8" Width="16" Height="16" Offset="0x1F40"/>
<Array Name="D_04002040" Count="24" Offset="0x2040"> <Array Name="gLinkPauseChildJointTable" Count="24" Offset="0x2040">
<Vector Type="s16" Dimensions="3"/> <Vector Type="s16" Dimensions="3"/>
</Array> </Array>
<Array Name="D_040020D0" Count="24" Offset="0x20D0"> <Array Name="gLinkPauseChildDekuShieldJointTable" Count="24" Offset="0x20D0">
<Vector Type="s16" Dimensions="3"/> <Vector Type="s16" Dimensions="3"/>
</Array> </Array>
<Array Name="D_04002160" Count="24" Offset="0x2160"> <Array Name="gLinkPauseAdultBgsJointTable" Count="24" Offset="0x2160">
<Vector Type="s16" Dimensions="3"/> <Vector Type="s16" Dimensions="3"/>
</Array> </Array>
<Array Name="D_040021F0" Count="24" Offset="0x21F0"> <Array Name="gLinkPauseAdultJointTable" Count="24" Offset="0x21F0">
<Vector Type="s16" Dimensions="3"/> <Vector Type="s16" Dimensions="3"/>
</Array> </Array>
<Array Name="D_04002280" Count="24" Offset="0x2280"> <Array Name="gLinkPauseAdultShieldJointTable" Count="24" Offset="0x2280">
<Vector Type="s16" Dimensions="3"/> <Vector Type="s16" Dimensions="3"/>
</Array> </Array>

View file

@ -1090,19 +1090,24 @@ s32 Player_ActionToExplosive(Player* player, s32 actionParam);
s32 Player_GetExplosiveHeld(Player* player); s32 Player_GetExplosiveHeld(Player* player);
s32 func_8008F2BC(Player* player, s32 actionParam); s32 func_8008F2BC(Player* player, s32 actionParam);
s32 func_8008F2F8(GlobalContext* globalCtx); s32 func_8008F2F8(GlobalContext* globalCtx);
void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* this); s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); void* data);
s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); void* data);
s32 func_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* data);
s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
Vec3s* rot, void* data);
s32 Player_OverrideLimbDrawGameplay_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
Vec3s* rot, void* data);
u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponDim, Vec3f* newTip, u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponDim, Vec3f* newTip,
Vec3f* newBase); Vec3f* newBase);
void Player_DrawGetItem(GlobalContext* globalCtx, Player* player); void Player_DrawGetItem(GlobalContext* globalCtx, Player* player);
void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* data); void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* data);
u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime); u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime);
void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots); s32 sword, s32 tunic, s32 shield, s32 boots);
void PreNMI_Init(GameState* thisx); void PreNMI_Init(GameState* thisx);
Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2); Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2);
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x); void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x);

View file

@ -740,6 +740,12 @@ typedef enum {
/* 0x04 */ PAUSE_WORLD_MAP /* 0x04 */ PAUSE_WORLD_MAP
} PauseMenuPage; } PauseMenuPage;
#define PAUSE_EQUIP_PLAYER_WIDTH 64
#define PAUSE_EQUIP_PLAYER_HEIGHT 112
#define PAUSE_EQUIP_BUFFER_SIZE sizeof(u16[PAUSE_EQUIP_PLAYER_HEIGHT][PAUSE_EQUIP_PLAYER_WIDTH])
#define PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE 0x5000
typedef struct { typedef struct {
/* 0x0000 */ View view; /* 0x0000 */ View view;
/* 0x0128 */ u8* iconItemSegment; /* 0x0128 */ u8* iconItemSegment;

View file

@ -682,10 +682,10 @@ void* sMouthTextures[][4] = {
}; };
#endif #endif
Color_RGB8 sTunicColors[] = { Color_RGB8 sTunicColors[PLAYER_TUNIC_MAX] = {
{ 30, 105, 27 }, { 30, 105, 27 }, // PLAYER_TUNIC_KOKIRI
{ 100, 20, 0 }, { 100, 20, 0 }, // PLAYER_TUNIC_GORON
{ 0, 60, 100 }, { 0, 60, 100 }, // PLAYER_TUNIC_ZORA
}; };
Color_RGB8 sGauntletColors[] = { Color_RGB8 sGauntletColors[] = {
@ -698,9 +698,9 @@ Gfx* sBootDListGroups[][2] = {
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL },
}; };
void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
void* data) { void* data) {
Color_RGB8* color; Color_RGB8* color;
s32 eyeIndex = (jointTable[22].x & 0xF) - 1; s32 eyeIndex = (jointTable[22].x & 0xF) - 1;
s32 mouthIndex = (jointTable[22].x >> 4) - 1; s32 mouthIndex = (jointTable[22].x >> 4) - 1;
@ -734,7 +734,8 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
SkelAnime_DrawFlexLod(globalCtx, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod); SkelAnime_DrawFlexLod(globalCtx, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod);
if ((overrideLimbDraw != func_800902F0) && (overrideLimbDraw != func_80090440) && (gSaveContext.gameMode != 3)) { if ((overrideLimbDraw != Player_OverrideLimbDrawGameplayFirstPerson) &&
(overrideLimbDraw != Player_OverrideLimbDrawGameplay_80090440) && (gSaveContext.gameMode != 3)) {
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH); s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH);
@ -875,7 +876,8 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
} }
} }
s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 Player_OverrideLimbDrawGameplayCommon(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
if (limbIndex == PLAYER_LIMB_ROOT) { if (limbIndex == PLAYER_LIMB_ROOT) {
@ -947,10 +949,11 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return false; return false;
} }
s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 Player_OverrideLimbDrawGameplayDefault(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
if (limbIndex == PLAYER_LIMB_L_HAND) { if (limbIndex == PLAYER_LIMB_L_HAND) {
Gfx** dLists = this->leftHandDLists; Gfx** dLists = this->leftHandDLists;
@ -1001,10 +1004,11 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return false; return false;
} }
s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 Player_OverrideLimbDrawGameplayFirstPerson(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
if (this->unk_6AD != 2) { if (this->unk_6AD != 2) {
*dList = NULL; *dList = NULL;
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) { } else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
@ -1026,8 +1030,9 @@ s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return false; return false;
} }
s32 func_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 Player_OverrideLimbDrawGameplay_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos,
if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { Vec3s* rot, void* thisx) {
if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) {
*dList = NULL; *dList = NULL;
} }
@ -1245,7 +1250,7 @@ Vec3f D_801261E0[] = {
{ 200.0f, 200.0f, 0.0f }, { 200.0f, 200.0f, 0.0f },
}; };
void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { void Player_PostLimbDrawGameplay(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
if (*dList != NULL) { if (*dList != NULL) {
@ -1446,27 +1451,30 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
void* ptr; void* ptr;
size = gObjectTable[OBJECT_GAMEPLAY_KEEP].vromEnd - gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart; size = gObjectTable[OBJECT_GAMEPLAY_KEEP].vromEnd - gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart;
ptr = segment + 0x3800; ptr = segment + PAUSE_EQUIP_BUFFER_SIZE;
DmaMgr_SendRequest1(ptr, gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart, size, "../z_player_lib.c", 2982); DmaMgr_SendRequest1(ptr, gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart, size, "../z_player_lib.c", 2982);
size = gObjectTable[linkObjectId].vromEnd - gObjectTable[linkObjectId].vromStart; size = gObjectTable[linkObjectId].vromEnd - gObjectTable[linkObjectId].vromStart;
ptr = segment + 0x8800; ptr = segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE;
DmaMgr_SendRequest1(ptr, gObjectTable[linkObjectId].vromStart, size, "../z_player_lib.c", 2988); DmaMgr_SendRequest1(ptr, gObjectTable[linkObjectId].vromStart, size, "../z_player_lib.c", 2988);
ptr = (void*)ALIGN16((u32)ptr + size); ptr = (void*)ALIGN16((u32)ptr + size);
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800); gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE);
gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800); gSegments[6] =
VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE);
SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9, SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9,
ptr, ptr, PLAYER_LIMB_MAX); ptr, ptr, PLAYER_LIMB_MAX);
return size + 0x8800 + 0x90; return size + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE +
sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]);
} }
u8 D_801261F8[] = { 2, 2, 5 }; u8 D_801261F8[] = { 2, 2, 5 };
s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) { s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* arg) {
u8* ptr = arg; u8* ptr = arg;
u8 modelGroup = D_801261F8[ptr[0] - 1]; u8 modelGroup = D_801261F8[ptr[0] - 1];
s32 type; s32 type;
@ -1506,10 +1514,12 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return 0; return 0;
} }
void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime,
f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height, Vec3f* eye, Vec3f* at, Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width,
f32 fovy, void* img1, void* img2) { s32 height, Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) {
static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 0 }; // 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 };
static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172); static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172);
static Vec3f lightDir = { 89.8f, 0.0f, 89.8f }; static Vec3f lightDir = { 89.8f, 0.0f, 89.8f };
u8 sp12C[2]; u8 sp12C[2];
@ -1547,15 +1557,15 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width, height); gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width, height);
gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1); gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1);
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img2); gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, depthFrameBuffer);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(255, 255, 240, 0) << 16) | GPACK_RGBA5551(255, 255, 240, 0)); gDPSetFillColor(POLY_OPA_DISP++, (GPACK_ZDZ(G_MAXFBZ, 0) << 16) | GPACK_ZDZ(G_MAXFBZ, 0));
gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1); gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1);
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img1); gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, colorFrameBuffer);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2); 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)); gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
@ -1563,10 +1573,10 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetDepthImage(POLY_OPA_DISP++, img2); gDPSetDepthImage(POLY_OPA_DISP++, depthFrameBuffer);
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * 2; viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * ((1 << 2) / 2);
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * 2; viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * ((1 << 2) / 2);
gSPViewport(POLY_OPA_DISP++, &viewport); gSPViewport(POLY_OPA_DISP++, &viewport);
guPerspective(perspMtx, &perspNorm, fovy, (f32)width / (f32)height, 10.0f, 4000.0f, 1.0f); guPerspective(perspMtx, &perspNorm, fovy, (f32)width / (f32)height, 10.0f, 4000.0f, 1.0f);
@ -1584,8 +1594,8 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
Matrix_SetTranslateRotateYXZ(pos->x, pos->y, pos->z, rot); Matrix_SetTranslateRotateYXZ(pos->x, pos->y, pos->z, rot);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPSegment(POLY_OPA_DISP++, 0x04, seg04); gSPSegment(POLY_OPA_DISP++, 0x04, gameplayKeep);
gSPSegment(POLY_OPA_DISP++, 0x06, seg06); gSPSegment(POLY_OPA_DISP++, 0x06, linkObject);
gSPSetLights1(POLY_OPA_DISP++, lights1); gSPSetLights1(POLY_OPA_DISP++, lights1);
@ -1597,8 +1607,8 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
func_8008F470(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, Player_DrawImpl(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
func_80091880, NULL, &sp12C); Player_OverrideLimbDrawPause, NULL, &sp12C);
gSPEndDisplayList(POLY_OPA_DISP++); gSPEndDisplayList(POLY_OPA_DISP++);
gSPEndDisplayList(POLY_XLU_DISP++); gSPEndDisplayList(POLY_XLU_DISP++);
@ -1609,30 +1619,31 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288);
} }
void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots) { s32 sword, s32 tunic, s32 shield, s32 boots) {
static Vec3f eye = { 0.0f, 0.0f, -400.0f }; static Vec3f eye = { 0.0f, 0.0f, -400.0f };
static Vec3f at = { 0.0f, 0.0f, 0.0f }; static Vec3f at = { 0.0f, 0.0f, 0.0f };
Vec3s* destTable; Vec3s* destTable;
Vec3s* srcTable; Vec3s* srcTable;
s32 i; s32 i;
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800); gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE);
gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800); gSegments[6] =
VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE);
if (!LINK_IS_ADULT) { if (!LINK_IS_ADULT) {
if (shield == PLAYER_SHIELD_DEKU) { if (shield == PLAYER_SHIELD_DEKU) {
srcTable = D_040020D0; srcTable = gLinkPauseChildDekuShieldJointTable;
} else { } else {
srcTable = D_04002040; srcTable = gLinkPauseChildJointTable;
} }
} else { } else {
if (sword == 3) { if (sword == 3) {
srcTable = D_04002160; srcTable = gLinkPauseAdultBgsJointTable;
} else if (shield != PLAYER_SHIELD_NONE) { } else if (shield != PLAYER_SHIELD_NONE) {
srcTable = D_04002280; srcTable = gLinkPauseAdultShieldJointTable;
} else { } else {
srcTable = D_040021F0; srcTable = gLinkPauseAdultJointTable;
} }
} }
@ -1642,7 +1653,10 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime,
*destTable++ = *srcTable++; *destTable++ = *srcTable++;
} }
func_80091A24(globalCtx, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield, Player_DrawPauseImpl(globalCtx, segment + PAUSE_EQUIP_BUFFER_SIZE,
boots, 64, 112, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer, segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE, skelAnime,
globalCtx->state.gfxCtx->curFrameBuffer + 0x1C00); pos, rot, scale, sword, tunic, shield, boots, PAUSE_EQUIP_PLAYER_WIDTH,
PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer,
globalCtx->state.gfxCtx->curFrameBuffer +
(PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT));
} }

View file

@ -1503,7 +1503,7 @@ void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gZBuffer); gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gZBuffer);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(255, 255, 240, 0) << 16) | GPACK_RGBA5551(255, 255, 240, 0)); gDPSetFillColor(POLY_OPA_DISP++, (GPACK_ZDZ(G_MAXFBZ, 0) << 16) | GPACK_ZDZ(G_MAXFBZ, 0));
gDPFillRectangle(POLY_OPA_DISP++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1); gDPFillRectangle(POLY_OPA_DISP++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1);
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);

View file

@ -733,13 +733,13 @@ s32 EnTorch2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
Gfx** gfx) { Gfx** gfx) {
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
return func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, &this->actor); return Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, &this->actor);
} }
void EnTorch2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { void EnTorch2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) {
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
func_80090D20(globalCtx, limbIndex, dList, rot, &this->actor); Player_PostLimbDrawGameplay(globalCtx, limbIndex, dList, rot, &this->actor);
} }
void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx2) { void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx2) {

View file

@ -10409,8 +10409,8 @@ static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = {
static Vec3s D_80854864 = { 0, 0, 0 }; static Vec3s D_80854864 = { 0, 0, 0 };
void func_8084A0E8(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDList, void Player_DrawGameplay(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDList,
OverrideLimbDrawOpa overrideLimbDraw) { OverrideLimbDrawOpa overrideLimbDraw) {
static s32 D_8085486C = 255; static s32 D_8085486C = 255;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19228); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19228);
@ -10418,11 +10418,11 @@ void func_8084A0E8(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDLi
gSPSegment(POLY_OPA_DISP++, 0x0C, cullDList); gSPSegment(POLY_OPA_DISP++, 0x0C, cullDList);
gSPSegment(POLY_XLU_DISP++, 0x0C, cullDList); gSPSegment(POLY_XLU_DISP++, 0x0C, cullDList);
func_8008F470(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod, Player_DrawImpl(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod,
this->currentTunic, this->currentBoots, this->actor.shape.face, overrideLimbDraw, func_80090D20, this->currentTunic, this->currentBoots, this->actor.shape.face, overrideLimbDraw,
this); Player_PostLimbDrawGameplay, this);
if ((overrideLimbDraw == func_80090014) && (this->currentMask != PLAYER_MASK_NONE)) { if ((overrideLimbDraw == Player_OverrideLimbDrawGameplayDefault) && (this->currentMask != PLAYER_MASK_NONE)) {
Mtx* sp70 = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Mtx)); Mtx* sp70 = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Mtx));
if (this->currentMask == PLAYER_MASK_BUNNY) { if (this->currentMask == PLAYER_MASK_BUNNY) {
@ -10492,7 +10492,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19346); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 19346);
if (!(this->stateFlags2 & PLAYER_STATE2_29)) { if (!(this->stateFlags2 & PLAYER_STATE2_29)) {
OverrideLimbDrawOpa overrideLimbDraw = func_80090014; OverrideLimbDrawOpa overrideLimbDraw = Player_OverrideLimbDrawGameplayDefault;
s32 lod; s32 lod;
s32 pad; s32 pad;
@ -10515,15 +10515,15 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) {
func_8002ED80(&this->actor, globalCtx, 0); func_8002ED80(&this->actor, globalCtx, 0);
if (this->unk_6AD != 0) { if (this->unk_6AD != 0) {
Vec3f sp7C; Vec3f projectedHeadPos;
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &sp7C); SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &projectedHeadPos);
if (sp7C.z < -4.0f) { if (projectedHeadPos.z < -4.0f) {
overrideLimbDraw = func_800902F0; overrideLimbDraw = Player_OverrideLimbDrawGameplayFirstPerson;
} }
} else if (this->stateFlags2 & PLAYER_STATE2_18) { } else if (this->stateFlags2 & PLAYER_STATE2_18) {
if (this->actor.projectedPos.z < 0.0f) { if (this->actor.projectedPos.z < 0.0f) {
overrideLimbDraw = func_80090440; overrideLimbDraw = Player_OverrideLimbDrawGameplay_80090440;
} }
} }
@ -10544,7 +10544,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) {
Matrix_Scale(1.1f, 0.95f, 1.05f, MTXMODE_APPLY); Matrix_Scale(1.1f, 0.95f, 1.05f, MTXMODE_APPLY);
Matrix_RotateY(-sp74, MTXMODE_APPLY); Matrix_RotateY(-sp74, MTXMODE_APPLY);
Matrix_RotateX(-sp78, MTXMODE_APPLY); Matrix_RotateX(-sp78, MTXMODE_APPLY);
func_8084A0E8(globalCtx, this, lod, gCullFrontDList, overrideLimbDraw); Player_DrawGameplay(globalCtx, this, lod, gCullFrontDList, overrideLimbDraw);
this->actor.scale.y = -this->actor.scale.y; this->actor.scale.y = -this->actor.scale.y;
Matrix_Pop(); Matrix_Pop();
} }
@ -10552,7 +10552,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) {
gSPClearGeometryMode(POLY_OPA_DISP++, G_CULL_BOTH); gSPClearGeometryMode(POLY_OPA_DISP++, G_CULL_BOTH);
gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BOTH); gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BOTH);
func_8084A0E8(globalCtx, this, lod, gCullBackDList, overrideLimbDraw); Player_DrawGameplay(globalCtx, this, lod, gCullBackDList, overrideLimbDraw);
if (this->invincibilityTimer > 0) { if (this->invincibilityTimer > 0) {
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);

View file

@ -106,9 +106,9 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) {
rot.y = 32300; rot.y = 32300;
rot.x = rot.z = 0; rot.x = rot.z = 0;
func_8009214C(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale, Player_DrawPause(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale,
CUR_EQUIP_VALUE(EQUIP_SWORD), CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1, CUR_EQUIP_VALUE(EQUIP_SHIELD), CUR_EQUIP_VALUE(EQUIP_SWORD), CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1, CUR_EQUIP_VALUE(EQUIP_SHIELD),
CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1); CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1);
} }
void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
@ -588,7 +588,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment); gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment);
func_800949A8(globalCtx->state.gfxCtx); func_800949A8(globalCtx->state.gfxCtx);
KaleidoScope_DrawEquipmentImage(globalCtx, pauseCtx->playerSegment, 64, 112); KaleidoScope_DrawEquipmentImage(globalCtx, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH,
PAUSE_EQUIP_PLAYER_HEIGHT);
if (gUpgradeMasks[0]) {} if (gUpgradeMasks[0]) {}

View file

@ -243,7 +243,7 @@ void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx) {
gfx = Graph_GfxPlusOne(gfxRef); gfx = Graph_GfxPlusOne(gfxRef);
gSPDisplayList(WORK_DISP++, gfx); gSPDisplayList(WORK_DISP++, gfx);
PreRender_SetValues(&sPlayerPreRender, 64, 112, fbuf, NULL); PreRender_SetValues(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, fbuf, NULL);
func_800C1F20(&sPlayerPreRender, &gfx); func_800C1F20(&sPlayerPreRender, &gfx);
func_800C20B4(&sPlayerPreRender, &gfx); func_800C20B4(&sPlayerPreRender, &gfx);
@ -2634,7 +2634,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
sPreRenderCvg = (void*)ALIGN16((u32)pauseCtx->nameSegment + 0x400 + 0xA00); sPreRenderCvg = (void*)ALIGN16((u32)pauseCtx->nameSegment + 0x400 + 0xA00);
PreRender_Init(&sPlayerPreRender); PreRender_Init(&sPlayerPreRender);
PreRender_SetValuesSave(&sPlayerPreRender, 64, 112, pauseCtx->playerSegment, NULL, sPreRenderCvg); PreRender_SetValuesSave(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT,
pauseCtx->playerSegment, NULL, sPreRenderCvg);
KaleidoScope_DrawPlayerWork(globalCtx); KaleidoScope_DrawPlayerWork(globalCtx);
KaleidoScope_SetupPlayerPreRender(globalCtx); KaleidoScope_SetupPlayerPreRender(globalCtx);