mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-18 05:44:53 +00:00
Use macros for oGfxCtx accesses (#465)
* fix colliderinit typo * fix initchain * reloc * add defines * add defines * missed some on merge * rename gfxCtx and add comment * remove space
This commit is contained in:
parent
92bb1fb210
commit
3c5fe66dcd
195 changed files with 2236 additions and 2229 deletions
|
@ -638,16 +638,16 @@ void func_8008F470(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
|||
eyeIndex = sEyeMouthIndexes[face][0];
|
||||
}
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[eyeIndex]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[eyeIndex]));
|
||||
|
||||
if (mouthIndex < 0) {
|
||||
mouthIndex = sEyeMouthIndexes[face][1];
|
||||
}
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[mouthIndex]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[mouthIndex]));
|
||||
|
||||
color = &sTunicColors[tunic];
|
||||
gDPSetEnvColor(oGfxCtx->polyOpa.p++, color->r, color->g, color->b, 0);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
|
||||
|
||||
sDListsLodOffset = lod * 2;
|
||||
|
||||
|
@ -658,25 +658,25 @@ void func_8008F470(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
|||
s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH);
|
||||
|
||||
if (strengthUpgrade >= PLAYER_STR_SILVER_G) {
|
||||
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
color = &sGauntletColors[strengthUpgrade - PLAYER_STR_SILVER_G];
|
||||
gDPSetEnvColor(oGfxCtx->polyOpa.p++, color->r, color->g, color->b, 0);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
|
||||
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, D_06025218);
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, D_06025598);
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, (D_80160014 == 0) ? D_060252D8 : D_06025438);
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, (D_80160018 == 8) ? D_06025658 : D_060257B8);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06025218);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06025598);
|
||||
gSPDisplayList(POLY_OPA_DISP++, (D_80160014 == 0) ? D_060252D8 : D_06025438);
|
||||
gSPDisplayList(POLY_OPA_DISP++, (D_80160018 == 8) ? D_06025658 : D_060257B8);
|
||||
}
|
||||
|
||||
if (boots != 0) {
|
||||
Gfx** bootDLists = sBootDListGroups[boots - 1];
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, bootDLists[0]);
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, bootDLists[1]);
|
||||
gSPDisplayList(POLY_OPA_DISP++, bootDLists[0]);
|
||||
gSPDisplayList(POLY_OPA_DISP++, bootDLists[1]);
|
||||
}
|
||||
} else {
|
||||
if (Player_GetStrength() > PLAYER_STR_NONE) {
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, D_06016118);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06016118);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1031,8 +1031,8 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo
|
|||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment);
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x06, this->giObjectSegment);
|
||||
gSPSegment(oGfxCtx->polyXlu.p++, 0x06, this->giObjectSegment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, this->giObjectSegment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, this->giObjectSegment);
|
||||
|
||||
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);
|
||||
|
@ -1088,7 +1088,7 @@ void func_80090AFC(GlobalContext* globalCtx, Player* this, f32 arg2) {
|
|||
if (func_8003E188(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &sp98) != 0) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2572);
|
||||
|
||||
oGfxCtx->overlay.p = Gfx_CallSetupDL(oGfxCtx->overlay.p, 0x07);
|
||||
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x07);
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &sp74, &sp68, &sp64);
|
||||
|
||||
|
@ -1097,10 +1097,10 @@ void func_80090AFC(GlobalContext* globalCtx, Player* this, f32 arg2) {
|
|||
Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW);
|
||||
Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587),
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(oGfxCtx->overlay.p++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
|
||||
gSPDisplayList(oGfxCtx->overlay.p++, D_0602CB48);
|
||||
gSPSegment(OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
|
||||
gSPDisplayList(OVERLAY_DISP++, D_0602CB48);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592);
|
||||
}
|
||||
|
@ -1186,9 +1186,9 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||
Matrix_RotateRPY(-0x8000, 0, 0x4000, MTXMODE_APPLY);
|
||||
Matrix_Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2653),
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2653),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, D_06006CC0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06006CC0);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2656);
|
||||
} else if ((this->actor.scale.y >= 0.0f) && (this->swordState != 0)) {
|
||||
|
@ -1207,10 +1207,10 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2710);
|
||||
|
||||
gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2712),
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2712),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetEnvColor(oGfxCtx->polyXlu.p++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
|
||||
gSPDisplayList(oGfxCtx->polyXlu.p++, sBottleDLists[gSaveContext.linkAge]);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[gSaveContext.linkAge]);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2717);
|
||||
}
|
||||
|
@ -1280,9 +1280,9 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||
Matrix_RotateZ(this->unk_858 * -0.2f, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2804),
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2804),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(oGfxCtx->polyXlu.p++, stringData->dList);
|
||||
gSPDisplayList(POLY_XLU_DISP++, stringData->dList);
|
||||
|
||||
Matrix_Pull();
|
||||
|
||||
|
@ -1440,60 +1440,60 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, struct_80
|
|||
|
||||
{ s32 pad[2]; }
|
||||
|
||||
opaRef = oGfxCtx->polyOpa.p;
|
||||
oGfxCtx->polyOpa.p++;
|
||||
opaRef = POLY_OPA_DISP;
|
||||
POLY_OPA_DISP++;
|
||||
|
||||
xluRef = oGfxCtx->polyXlu.p;
|
||||
oGfxCtx->polyXlu.p++;
|
||||
xluRef = POLY_XLU_DISP;
|
||||
POLY_XLU_DISP++;
|
||||
|
||||
gSPDisplayList(oGfxCtx->work.p++, oGfxCtx->polyOpa.p);
|
||||
gSPDisplayList(oGfxCtx->work.p++, oGfxCtx->polyXlu.p);
|
||||
gSPDisplayList(WORK_DISP++, POLY_OPA_DISP);
|
||||
gSPDisplayList(WORK_DISP++, POLY_XLU_DISP);
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
|
||||
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
gSPLoadGeometryMode(oGfxCtx->polyOpa.p++, 0);
|
||||
gSPTexture(oGfxCtx->polyOpa.p++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
||||
gDPSetCombineMode(oGfxCtx->polyOpa.p++, G_CC_SHADE, G_CC_SHADE);
|
||||
gDPSetOtherMode(oGfxCtx->polyOpa.p++,
|
||||
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++,
|
||||
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);
|
||||
gSPLoadGeometryMode(oGfxCtx->polyOpa.p++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
|
||||
gDPSetScissorFrac(oGfxCtx->polyOpa.p++, G_SC_NON_INTERLACE, 0, 0, width * 4.0f, height * 4.0f);
|
||||
gSPClipRatio(oGfxCtx->polyOpa.p++, FRUSTRATIO_1);
|
||||
gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
|
||||
gDPSetScissorFrac(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width * 4.0f, height * 4.0f);
|
||||
gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1);
|
||||
|
||||
gDPSetColorImage(oGfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img2);
|
||||
gDPSetCycleType(oGfxCtx->polyOpa.p++, G_CYC_FILL);
|
||||
gDPSetRenderMode(oGfxCtx->polyOpa.p++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPSetFillColor(oGfxCtx->polyOpa.p++, (GPACK_RGBA5551(255, 255, 240, 0) << 16) | GPACK_RGBA5551(255, 255, 240, 0));
|
||||
gDPFillRectangle(oGfxCtx->polyOpa.p++, 0, 0, width - 1, height - 1);
|
||||
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img2);
|
||||
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));
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1);
|
||||
|
||||
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
gDPSetColorImage(oGfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img1);
|
||||
gDPSetCycleType(oGfxCtx->polyOpa.p++, G_CYC_FILL);
|
||||
gDPSetRenderMode(oGfxCtx->polyOpa.p++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPSetFillColor(oGfxCtx->polyOpa.p++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
|
||||
gDPFillRectangle(oGfxCtx->polyOpa.p++, 0, 0, width - 1, height - 1);
|
||||
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, img1);
|
||||
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);
|
||||
|
||||
gDPPipeSync(oGfxCtx->polyOpa.p++);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
gDPSetDepthImage(oGfxCtx->polyOpa.p++, img2);
|
||||
gDPSetDepthImage(POLY_OPA_DISP++, img2);
|
||||
|
||||
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * 2;
|
||||
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * 2;
|
||||
gSPViewport(oGfxCtx->polyOpa.p++, &viewport);
|
||||
gSPViewport(POLY_OPA_DISP++, &viewport);
|
||||
|
||||
guPerspective(perspMtx, &perspNorm, fovy, (f32)width / (f32)height, 10.0f, 4000.0f, 1.0f);
|
||||
|
||||
gSPPerspNormalize(oGfxCtx->polyOpa.p++, perspNorm);
|
||||
gSPMatrix(oGfxCtx->polyOpa.p++, perspMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
gSPPerspNormalize(POLY_OPA_DISP++, perspNorm);
|
||||
gSPMatrix(POLY_OPA_DISP++, perspMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
|
||||
guLookAt(lookAtMtx, eye->x, eye->y, eye->z, at->x, at->y, at->z, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
gSPMatrix(oGfxCtx->polyOpa.p++, lookAtMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
|
||||
gSPMatrix(POLY_OPA_DISP++, lookAtMtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
|
||||
|
||||
sp12C[0] = sword;
|
||||
sp12C[1] = shield;
|
||||
|
@ -1501,27 +1501,27 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, struct_80
|
|||
func_800D1694(pos->x, pos->y, pos->z, rot);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x04, seg04);
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x06, seg06);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x04, seg04);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, seg06);
|
||||
|
||||
gSPSetLights1(oGfxCtx->polyOpa.p++, lights1);
|
||||
gSPSetLights1(POLY_OPA_DISP++, lights1);
|
||||
|
||||
func_80093C80(globalCtx);
|
||||
|
||||
oGfxCtx->polyOpa.p = Gfx_SetFog2(oGfxCtx->polyOpa.p++, 0, 0, 0, 0, 997, 1000);
|
||||
POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP++, 0, 0, 0, 0, 997, 1000);
|
||||
|
||||
func_8002EABC(pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx);
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, gCullBackDList);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
|
||||
|
||||
func_8008F470(globalCtx, arg3->skeleton, arg3->limbDrawTable, arg3->dListCount, 0, tunic, boots, 0, func_80091880,
|
||||
NULL, &sp12C);
|
||||
|
||||
gSPEndDisplayList(oGfxCtx->polyOpa.p++);
|
||||
gSPEndDisplayList(oGfxCtx->polyXlu.p++);
|
||||
gSPEndDisplayList(POLY_OPA_DISP++);
|
||||
gSPEndDisplayList(POLY_XLU_DISP++);
|
||||
|
||||
gSPBranchList(opaRef, oGfxCtx->polyOpa.p);
|
||||
gSPBranchList(xluRef, oGfxCtx->polyXlu.p);
|
||||
gSPBranchList(opaRef, POLY_OPA_DISP);
|
||||
gSPBranchList(xluRef, POLY_XLU_DISP);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue