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:
Lucas Shaw 2021-12-06 23:36:02 -05:00 committed by GitHub
parent ad02db9b82
commit ff231e093a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 24 deletions

View File

@ -2759,10 +2759,10 @@ void func_80143148(SkyboxContext* skyboxCtx, s32 arg1);
void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType);
void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType);
void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType);
// void func_801435A0(void);
// void func_80143624(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6, UNK_TYPE1 param_7);
// void func_80143668(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
// void func_80143A04(void);
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z);
void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB);
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z);
void SkyboxDraw_Noop(SkyboxContext* skyboxCtx);
void func_80143A10(u8 owlId);
// void func_80143A54(void);
void func_80143AC4(void);

View File

@ -3317,7 +3317,7 @@ extern Arena sZeldaArena;
// extern UNK_TYPE1 D_801F6AD4;
// extern UNK_TYPE1 D_801F6AD5;
// extern UNK_TYPE1 D_801F6ADA;
// extern UNK_TYPE1 D_801F6AE0;
// extern UNK_TYPE1 sSkyboxDrawMatrix;
// extern UNK_TYPE1 D_801F6AF0;
// extern UNK_TYPE1 D_801F6AF2;
// extern UNK_TYPE4 D_801F6B00;

View File

@ -766,11 +766,10 @@ typedef struct {
typedef struct {
/* 0x00000 */ View view;
/* 0x00168 */ void* skyboxStaticSegment[2];
/* 0x00170 */ char unk170[8]; // more static segments?
/* 0x00168 */ void* skyboxStaticSegment[4];
/* 0x00178 */ void* skyboxPaletteStaticSegment;
/* 0x0017C */ Gfx* unk17C;
/* 0x00180 */ Gfx* unk180;
/* 0x0017C */ Gfx* dListBuf;
/* 0x00180 */ Gfx* roomDL;
/* 0x00184 */ Vtx* roomVtx;
/* 0x00188 */ DmaRequest unk188;
/* 0x001A8 */ DmaRequest unk1A8;
@ -791,6 +790,10 @@ typedef struct {
/* 0x00227 */ u8 envB;
} SkyboxContext; // size = 0x228
typedef enum {
/* 0x05 */ SKYBOX_CUTSCENE_MAP = 5
} SkyboxId;
typedef struct ListAlloc {
/* 0x00 */ struct ListAlloc* prev;
/* 0x04 */ struct ListAlloc* next;

2
spec
View File

@ -553,8 +553,6 @@ beginseg
include "build/src/code/code_801420C0.o"
include "build/src/code/z_vr_box.o"
include "build/src/code/z_vr_box_draw.o"
include "build/data/code/z_vr_box_draw.data.o"
include "build/data/code/z_vr_box_draw.bss.o"
include "build/src/code/z_sram_NES.o"
include "build/data/code/z_sram_NES.data.o"
include "build/data/code/z_sram_NES.bss.o"

View File

@ -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)

View File

@ -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) {
}

View File

@ -556,8 +556,7 @@
0x801C5D10 : "z_sub_s",
0x801C5DD0 : "z_vimode",
0x801C5E30 : "z_vr_box",
0x801C5FC0 : "z_vr_box_draw",
0x801C67B0 : "z_sram_NES",
0x801C5FC0 : "z_sram_NES",
0x801D0470 : "z_message_nes",
0x801D0B50 : "",
0x801D0B70 : "z_kaleido_manager",

View File

@ -2783,10 +2783,10 @@
0x801431E8:("func_801431E8",),
0x80143324:("func_80143324",),
0x801434E4:("func_801434E4",),
0x801435A0:("func_801435A0",),
0x80143624:("func_80143624",),
0x80143668:("func_80143668",),
0x80143A04:("func_80143A04",),
0x801435A0:("SkyboxDraw_UpdateMatrix",),
0x80143624:("SkyboxDraw_SetColors",),
0x80143668:("SkyboxDraw_Draw",),
0x80143A04:("SkyboxDraw_Noop",),
0x80143A10:("func_80143A10",),
0x80143A54:("func_80143A54",),
0x80143AC4:("func_80143AC4",),

View File

@ -4094,7 +4094,7 @@
0x801F6AD4:("D_801F6AD4","UNK_TYPE1","",0x1),
0x801F6AD5:("D_801F6AD5","UNK_TYPE1","",0x1),
0x801F6ADA:("D_801F6ADA","UNK_TYPE1","",0x1),
0x801F6AE0:("D_801F6AE0","UNK_TYPE1","",0x1),
0x801F6AE0:("sSkyboxDrawMatrix","Mtx*","",0x4),
0x801F6AF0:("D_801F6AF0","UNK_TYPE1","",0x1),
0x801F6AF2:("D_801F6AF2","UNK_TYPE1","",0x1),
0x801F6B00:("D_801F6B00","UNK_TYPE4","",0x4),