mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-24 15:20:49 -04:00
z_vr_box_draw OK (#481)
* z_vr_box_draw OK * ok * Removed z_vr_box_draw.data.s, its actually z_sram_NES.data.s * Added enum SkyboxId
This commit is contained in:
+1
-1
@@ -140,7 +140,7 @@ void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType)
|
||||
func_801431E8(gameState, skyboxCtx, skyType);
|
||||
|
||||
if (skyType != 0) {
|
||||
skyboxCtx->unk17C = THA_AllocEndAlign16(&gameState->heap, 0x3840);
|
||||
skyboxCtx->dListBuf = THA_AllocEndAlign16(&gameState->heap, 0x3840);
|
||||
|
||||
if (skyType == 5) {
|
||||
// Allocate enough space for the vertices for a 6 sided skybox (cube)
|
||||
|
||||
@@ -1,9 +1,67 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_801435A0.s")
|
||||
Mtx* sSkyboxDrawMatrix;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_80143624.s")
|
||||
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) {
|
||||
Matrix_InsertTranslation(x, y, z, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateStateAroundXAxis(skyboxCtx->rotX);
|
||||
Matrix_InsertYRotation_f(skyboxCtx->rotY, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_f(skyboxCtx->rotZ, MTXMODE_APPLY);
|
||||
return Matrix_ToMtx(sSkyboxDrawMatrix);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_80143668.s")
|
||||
void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) {
|
||||
skyboxCtx->primR = primR;
|
||||
skyboxCtx->primG = primG;
|
||||
skyboxCtx->primB = primB;
|
||||
skyboxCtx->envR = envR;
|
||||
skyboxCtx->envG = envG;
|
||||
skyboxCtx->envB = envB;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_80143A04.s")
|
||||
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
func_8012C6AC(gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0B, skyboxCtx->skyboxPaletteStaticSegment);
|
||||
gSPTexture(POLY_OPA_DISP++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
|
||||
|
||||
sSkyboxDrawMatrix = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
|
||||
|
||||
Matrix_InsertTranslation(x, y, z, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateStateAroundXAxis(skyboxCtx->rotX);
|
||||
Matrix_InsertYRotation_f(skyboxCtx->rotY, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_f(skyboxCtx->rotZ, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(sSkyboxDrawMatrix);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetColorDither(POLY_OPA_DISP++, G_CD_MAGICSQ);
|
||||
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
|
||||
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->skyboxPaletteStaticSegment);
|
||||
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16);
|
||||
gDPSetTextureConvert(POLY_OPA_DISP++, G_TC_FILT);
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, TEXEL0, PRIMITIVE_ALPHA, TEXEL0, TEXEL1, TEXEL0, PRIMITIVE, TEXEL0,
|
||||
PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, skyboxCtx->primR, skyboxCtx->primG, skyboxCtx->primB, blend);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, skyboxCtx->envR, skyboxCtx->envG, skyboxCtx->envB, 0);
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[0]);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[300]);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[600]);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[900]);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[1200]);
|
||||
|
||||
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[1500]);
|
||||
}
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
void SkyboxDraw_Noop(SkyboxContext* skyboxCtx) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user