mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-02 22:14:33 +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:
parent
a160fb96c8
commit
054bac7583
9 changed files with 112 additions and 85 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]) {}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue