From 054bac758306026b99358f97ac22062fbedff16b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 13 Mar 2022 01:06:43 +0100 Subject: [PATCH] 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 --- assets/xml/objects/gameplay_keep.xml | 10 +- include/functions.h | 23 ++-- include/z64.h | 6 + src/code/z_player_lib.c | 110 ++++++++++-------- src/code/z_rcp.c | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 4 +- .../actors/ovl_player_actor/z_player.c | 28 ++--- .../ovl_kaleido_scope/z_kaleido_equipment.c | 9 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 5 +- 9 files changed, 112 insertions(+), 85 deletions(-) diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 63aa8eff7d..6908cbed11 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -11,19 +11,19 @@ - + - + - + - + - + diff --git a/include/functions.h b/include/functions.h index e6b721f5d2..c50d8f4b8b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1090,19 +1090,24 @@ s32 Player_ActionToExplosive(Player* player, s32 actionParam); s32 Player_GetExplosiveHeld(Player* player); s32 func_8008F2BC(Player* player, s32 actionParam); s32 func_8008F2F8(GlobalContext* globalCtx); -void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, - s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* this); -s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); -s32 func_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* data); +void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, + s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, + void* data); +s32 Player_OverrideLimbDrawGameplayCommon(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, Vec3f* newBase); 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); -void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, - s32 sword, s32 tunic, s32 shield, s32 boots); +void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, + s32 sword, s32 tunic, s32 shield, s32 boots); void PreNMI_Init(GameState* thisx); Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2); void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x); diff --git a/include/z64.h b/include/z64.h index 063c188d7a..7bc163a54f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -740,6 +740,12 @@ typedef enum { /* 0x04 */ PAUSE_WORLD_MAP } 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 { /* 0x0000 */ View view; /* 0x0128 */ u8* iconItemSegment; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 80a88493a8..7181830690 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -682,10 +682,10 @@ void* sMouthTextures[][4] = { }; #endif -Color_RGB8 sTunicColors[] = { - { 30, 105, 27 }, - { 100, 20, 0 }, - { 0, 60, 100 }, +Color_RGB8 sTunicColors[PLAYER_TUNIC_MAX] = { + { 30, 105, 27 }, // PLAYER_TUNIC_KOKIRI + { 100, 20, 0 }, // PLAYER_TUNIC_GORON + { 0, 60, 100 }, // PLAYER_TUNIC_ZORA }; Color_RGB8 sGauntletColors[] = { @@ -698,9 +698,9 @@ Gfx* sBootDListGroups[][2] = { { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, }; -void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, - s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, - void* data) { +void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, + s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, + void* data) { Color_RGB8* color; s32 eyeIndex = (jointTable[22].x & 0xF) - 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); - 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) { 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; if (limbIndex == PLAYER_LIMB_ROOT) { @@ -947,10 +949,11 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p 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; - if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { + if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) { if (limbIndex == PLAYER_LIMB_L_HAND) { Gfx** dLists = this->leftHandDLists; @@ -1001,10 +1004,11 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p 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; - if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { + if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) { if (this->unk_6AD != 2) { *dList = NULL; } else if (limbIndex == PLAYER_LIMB_L_FOREARM) { @@ -1026,8 +1030,9 @@ s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -s32 func_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) { +s32 Player_OverrideLimbDrawGameplay_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, + Vec3s* rot, void* thisx) { + if (!Player_OverrideLimbDrawGameplayCommon(globalCtx, limbIndex, dList, pos, rot, thisx)) { *dList = NULL; } @@ -1245,7 +1250,7 @@ Vec3f D_801261E0[] = { { 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; if (*dList != NULL) { @@ -1446,27 +1451,30 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) { void* ptr; 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); 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); ptr = (void*)ALIGN16((u32)ptr + size); - gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800); - gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800); + 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); SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.linkAge], &gPlayerAnim_003238, 9, 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 }; -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 modelGroup = D_801261F8[ptr[0] - 1]; s32 type; @@ -1506,10 +1514,12 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, 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* img1, void* img2) { - static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 0 }; +void Player_DrawPauseImpl(GlobalContext* globalCtx, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime, + Vec3f* pos, Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, + s32 height, Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) { + // Note: the viewport x and y values are overwritten below, before usage + static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0, + (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 }; static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172); static Vec3f lightDir = { 89.8f, 0.0f, 89.8f }; 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); 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); 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); 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); 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)); @@ -1563,10 +1573,10 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime 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[1] = viewport.vp.vtrans[1] = height * 2; + viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * ((1 << 2) / 2); + viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * ((1 << 2) / 2); gSPViewport(POLY_OPA_DISP++, &viewport); 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_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPSegment(POLY_OPA_DISP++, 0x04, seg04); - gSPSegment(POLY_OPA_DISP++, 0x06, seg06); + gSPSegment(POLY_OPA_DISP++, 0x04, gameplayKeep); + gSPSegment(POLY_OPA_DISP++, 0x06, linkObject); 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); - func_8008F470(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, - func_80091880, NULL, &sp12C); + Player_DrawImpl(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, + Player_OverrideLimbDrawPause, NULL, &sp12C); gSPEndDisplayList(POLY_OPA_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); } -void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, - s32 sword, s32 tunic, s32 shield, s32 boots) { +void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, + s32 sword, s32 tunic, s32 shield, s32 boots) { static Vec3f eye = { 0.0f, 0.0f, -400.0f }; static Vec3f at = { 0.0f, 0.0f, 0.0f }; Vec3s* destTable; Vec3s* srcTable; s32 i; - gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800); - gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800); + 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); if (!LINK_IS_ADULT) { if (shield == PLAYER_SHIELD_DEKU) { - srcTable = D_040020D0; + srcTable = gLinkPauseChildDekuShieldJointTable; } else { - srcTable = D_04002040; + srcTable = gLinkPauseChildJointTable; } } else { if (sword == 3) { - srcTable = D_04002160; + srcTable = gLinkPauseAdultBgsJointTable; } else if (shield != PLAYER_SHIELD_NONE) { - srcTable = D_04002280; + srcTable = gLinkPauseAdultShieldJointTable; } else { - srcTable = D_040021F0; + srcTable = gLinkPauseAdultJointTable; } } @@ -1642,7 +1653,10 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, *destTable++ = *srcTable++; } - func_80091A24(globalCtx, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield, - boots, 64, 112, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer, - globalCtx->state.gfxCtx->curFrameBuffer + 0x1C00); + Player_DrawPauseImpl(globalCtx, segment + PAUSE_EQUIP_BUFFER_SIZE, + segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE, skelAnime, + pos, rot, scale, sword, tunic, shield, boots, PAUSE_EQUIP_PLAYER_WIDTH, + PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer, + globalCtx->state.gfxCtx->curFrameBuffer + + (PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT)); } diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index c2410f5631..cd368aeac2 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -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); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); 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); gDPPipeSync(POLY_OPA_DISP++); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 6869301ad2..22d87d12a0 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -733,13 +733,13 @@ s32 EnTorch2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Gfx** gfx) { 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) { 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) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 1add591722..79ebd3b8fe 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10409,8 +10409,8 @@ static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = { static Vec3s D_80854864 = { 0, 0, 0 }; -void func_8084A0E8(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDList, - OverrideLimbDrawOpa overrideLimbDraw) { +void Player_DrawGameplay(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDList, + OverrideLimbDrawOpa overrideLimbDraw) { static s32 D_8085486C = 255; 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_XLU_DISP++, 0x0C, cullDList); - func_8008F470(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod, - this->currentTunic, this->currentBoots, this->actor.shape.face, overrideLimbDraw, func_80090D20, - this); + Player_DrawImpl(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, lod, + this->currentTunic, this->currentBoots, this->actor.shape.face, overrideLimbDraw, + 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)); 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); if (!(this->stateFlags2 & PLAYER_STATE2_29)) { - OverrideLimbDrawOpa overrideLimbDraw = func_80090014; + OverrideLimbDrawOpa overrideLimbDraw = Player_OverrideLimbDrawGameplayDefault; s32 lod; s32 pad; @@ -10515,15 +10515,15 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { func_8002ED80(&this->actor, globalCtx, 0); if (this->unk_6AD != 0) { - Vec3f sp7C; + Vec3f projectedHeadPos; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &sp7C); - if (sp7C.z < -4.0f) { - overrideLimbDraw = func_800902F0; + SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &projectedHeadPos); + if (projectedHeadPos.z < -4.0f) { + overrideLimbDraw = Player_OverrideLimbDrawGameplayFirstPerson; } } else if (this->stateFlags2 & PLAYER_STATE2_18) { 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_RotateY(-sp74, 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; Matrix_Pop(); } @@ -10552,7 +10552,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { gSPClearGeometryMode(POLY_OPA_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) { POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 992e33bcf7..e4c9d917e2 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -106,9 +106,9 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) { rot.y = 32300; rot.x = rot.z = 0; - func_8009214C(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_BOOTS) - 1); + 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_BOOTS) - 1); } void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { @@ -588,7 +588,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment); 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]) {} diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 5375f30af1..d6fb3164a9 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -243,7 +243,7 @@ void KaleidoScope_SetupPlayerPreRender(GlobalContext* globalCtx) { gfx = Graph_GfxPlusOne(gfxRef); 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_800C20B4(&sPlayerPreRender, &gfx); @@ -2634,7 +2634,8 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { sPreRenderCvg = (void*)ALIGN16((u32)pauseCtx->nameSegment + 0x400 + 0xA00); 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_SetupPlayerPreRender(globalCtx);