Decomp the remaining functions in vr_box and import its data (#917)

* stuff

* not quite there

* data imported

* fixed some things and adjusted sSetupDLs

* remove setup dls

* remove alloc casts

* format

* palette swap

* Update src/code/z_vr_box_draw.c

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

* improved loop matches

* fixed some comments

* format and adjustments

* palettes

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
petrie911 2021-09-21 03:48:43 -05:00 committed by GitHub
parent a9604e267f
commit b18227e6ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 566 additions and 192 deletions

View File

@ -27,7 +27,7 @@
<DList Name="gZelda2OcarinaDL" Offset="0xBAE8"/>
<Texture Name="gZelda2OcarinaTex" OutName="zelda_2_ocarina" Format="rgba16" Width="32" Height="16" Offset="0xB598"/>
<!-- Palletes -->
<!-- palettes -->
<Texture Name="gZelda2_0TLUT" OutName="zelda_2_0_tlut" Format="rgba16" Width="16" Height="16" Offset="0x0"/>
<Texture Name="gZelda2_1TLUT" OutName="zelda_2_1_tlut" Format="rgba16" Width="16" Height="16" Offset="0x200"/>
<Texture Name="gZelda2_2TLUT" OutName="zelda_2_2_tlut" Format="rgba16" Width="16" Height="16" Offset="0x400"/>

View File

@ -1,49 +0,0 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
.section .data
.balign 16
glabel D_8012AC90
.incbin "baserom.z64", 0xBA1E30, 0x10
glabel D_8012ACA0
.incbin "baserom.z64", 0xBA1E40, 0x80
glabel D_8012AD20
.incbin "baserom.z64", 0xBA1EC0, 0xC
glabel D_8012AD2C
.incbin "baserom.z64", 0xBA1ECC, 0x14
glabel D_8012AD40
.incbin "baserom.z64", 0xBA1EE0, 0x80
glabel D_8012ADC0
.incbin "baserom.z64", 0xBA1F60, 0x18
glabel D_8012ADD8
.incbin "baserom.z64", 0xBA1F78, 0x40
glabel D_8012AE18
.incbin "baserom.z64", 0xBA1FB8, 0xC
glabel D_8012AE24
.incbin "baserom.z64", 0xBA1FC4, 0xC
glabel D_8012AE30
.incbin "baserom.z64", 0xBA1FD0, 0xC
glabel D_8012AE3C
.incbin "baserom.z64", 0xBA1FDC, 0x80
glabel D_8012AEBC
.incbin "baserom.z64", 0xBA205C, 0x50
glabel D_8012AF0C
.incbin "baserom.z64", 0xBA20AC, 0x84

View File

@ -322,10 +322,11 @@ typedef enum {
typedef struct {
/* 0x000 */ char unk_00[0x128];
/* 0x128 */ void* staticSegments[3];
/* 0x134 */ Gfx* dListBuf;
/* 0x128 */ void* staticSegments[2];
/* 0x130 */ u16 (*palettes)[256];
/* 0x134 */ Gfx (*dListBuf)[150];
/* 0x138 */ Gfx* unk_138;
/* 0x13C */ void* roomVtx;
/* 0x13C */ Vtx* roomVtx;
/* 0x140 */ s16 unk_140;
/* 0x144 */ Vec3f rot;
/* 0x150 */ char unk_150[0x10];
@ -1776,7 +1777,7 @@ typedef struct {
typedef struct {
/* 0x00 */ RomFile file;
/* 0x08 */ RomFile pallete;
/* 0x08 */ RomFile palette;
} SkyboxFile; // size = 0x10
#define ROM_FILE(name) \

View File

@ -43,7 +43,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u16 startTime;
/* 0x02 */ u16 endTime;
/* 0x04 */ u8 blend; // if true, blend between.. skyboxes? palletes?
/* 0x04 */ u8 blend; // if true, blend between.. skyboxes? palettes?
/* 0x05 */ u8 skybox1Index; // whats the difference between _pal and non _pal files?
/* 0x06 */ u8 skybox2Index;
} struct_8011FC1C; // size = 0x8

1
spec
View File

@ -358,7 +358,6 @@ beginseg
include "build/src/code/z_vismono.o"
include "build/src/code/code_800AD920.o"
include "build/src/code/z_vr_box.o"
include "build/data/z_vr_box.data.o"
include "build/src/code/z_vr_box_draw.o"
include "build/src/code/z_player_call.o"
include "build/src/code/z_fbdemo.o"

View File

@ -696,16 +696,17 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
envCtx->skyboxDmaState = SKYBOX_DMA_PAL1_START;
if ((newSkybox1Index & 1) ^ ((newSkybox1Index & 4) >> 2)) {
size = gSkyboxFiles[newSkybox1Index].pallete.vromEnd - gSkyboxFiles[newSkybox1Index].pallete.vromStart;
size = gSkyboxFiles[newSkybox1Index].palette.vromEnd - gSkyboxFiles[newSkybox1Index].palette.vromStart;
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->staticSegments[2],
gSkyboxFiles[newSkybox1Index].pallete.vromStart, size, 0, &envCtx->loadQueue, NULL,
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes,
gSkyboxFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
"../z_kankyo.c", 1307);
} else {
size = gSkyboxFiles[newSkybox1Index].pallete.vromEnd - gSkyboxFiles[newSkybox1Index].pallete.vromStart;
size = gSkyboxFiles[newSkybox1Index].palette.vromEnd - gSkyboxFiles[newSkybox1Index].palette.vromStart;
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->staticSegments[2] + size,
gSkyboxFiles[newSkybox1Index].pallete.vromStart, size, 0, &envCtx->loadQueue, NULL,
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes + size,
gSkyboxFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
"../z_kankyo.c", 1320);
}
}
@ -714,16 +715,17 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
envCtx->skyboxDmaState = SKYBOX_DMA_PAL2_START;
if ((newSkybox2Index & 1) ^ ((newSkybox2Index & 4) >> 2)) {
size = gSkyboxFiles[newSkybox2Index].pallete.vromEnd - gSkyboxFiles[newSkybox2Index].pallete.vromStart;
size = gSkyboxFiles[newSkybox2Index].palette.vromEnd - gSkyboxFiles[newSkybox2Index].palette.vromStart;
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->staticSegments[2],
gSkyboxFiles[newSkybox2Index].pallete.vromStart, size, 0, &envCtx->loadQueue, NULL,
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes,
gSkyboxFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
"../z_kankyo.c", 1342);
} else {
size = gSkyboxFiles[newSkybox2Index].pallete.vromEnd - gSkyboxFiles[newSkybox2Index].pallete.vromStart;
size = gSkyboxFiles[newSkybox2Index].palette.vromEnd - gSkyboxFiles[newSkybox2Index].palette.vromStart;
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->staticSegments[2] + size,
gSkyboxFiles[newSkybox2Index].pallete.vromStart, size, 0, &envCtx->loadQueue, NULL,
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes + size,
gSkyboxFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue, NULL,
"../z_kankyo.c", 1355);
}
}

View File

@ -2,6 +2,63 @@
#include "vt.h"
#include "z64environment.h"
u32 D_8012AC90[4] = {
0x00000000,
0x00010000,
0x00020000,
0x00030000,
};
u16 D_8012ACA0[2][0x20] = {
{ 0x00, 0x02, 0x0A, 0x0C, 0x02, 0x04, 0x0C, 0x0E, 0x0A, 0x0C, 0x14, 0x16, 0x0C, 0x0E, 0x16, 0x18,
0x01, 0x03, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0B, 0x0D, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x15, 0x17 },
{ 0x14, 0x16, 0x1E, 0x20, 0x16, 0x18, 0x20, 0x22, 0x1E, 0x20, 0x28, 0x2A, 0x20, 0x22, 0x2A, 0x2C,
0x15, 0x17, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1F, 0x21, 0x23, 0x24, 0x25, 0x26, 0x27, 0x29, 0x2B },
};
s16 D_8012AD20[5] = {
0x0000, 0x0FC0, 0x1F80, 0x2F40, 0x3F00,
};
s16 D_8012AD2C[9] = {
0x0000, 0x07C0, 0x0F80, 0x1740, 0x1F00, 0x26C0, 0x2E80, 0x3640, 0x3E00,
};
s16 D_8012AD40[0x40] = {
0x00, 0x10, 0x13, 0x12, 0x10, 0x01, 0x14, 0x13, 0x01, 0x11, 0x15, 0x14, 0x11, 0x05, 0x16, 0x15,
0x12, 0x13, 0x17, 0x02, 0x13, 0x14, 0x03, 0x17, 0x14, 0x15, 0x18, 0x03, 0x15, 0x16, 0x07, 0x18,
0x02, 0x17, 0x1A, 0x19, 0x17, 0x03, 0x1B, 0x1A, 0x03, 0x18, 0x1C, 0x1B, 0x18, 0x07, 0x1D, 0x1C,
0x19, 0x1A, 0x1E, 0x0A, 0x1A, 0x1B, 0x0B, 0x1E, 0x1B, 0x1C, 0x1F, 0x0B, 0x1C, 0x1D, 0x0F, 0x1F,
};
u32 D_8012ADC0[6] = {
0x00000000, 0x00002000, 0x00004000, 0x00006000, 0x00008000, 0x0000C000,
};
u16 D_8012ADD8[0x20] = {
0x00, 0x02, 0x0A, 0x0C, 0x02, 0x04, 0x0C, 0x0E, 0x0A, 0x0C, 0x14, 0x16, 0x0C, 0x0E, 0x16, 0x18,
0x01, 0x03, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0B, 0x0D, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x15, 0x17,
};
s16 D_8012AE18[5] = {
0x0000, 0x07C0, 0x0F80, 0x1740, 0x1F00,
};
s16 D_8012AE24[5] = {
0x0000, 0x07C0, 0x0F80, 0x1740, 0x1F00,
};
s16 D_8012AE30[5] = {
0x0000, 0x07C0, 0x0F80, 0x07C0, 0x0000,
};
s16 D_8012AE3C[0x40] = {
0x00, 0x10, 0x13, 0x12, 0x10, 0x01, 0x14, 0x13, 0x01, 0x11, 0x15, 0x14, 0x11, 0x05, 0x16, 0x15,
0x12, 0x13, 0x17, 0x02, 0x13, 0x14, 0x03, 0x17, 0x14, 0x15, 0x18, 0x03, 0x15, 0x16, 0x07, 0x18,
0x02, 0x17, 0x1A, 0x19, 0x17, 0x03, 0x1B, 0x1A, 0x03, 0x18, 0x1C, 0x1B, 0x18, 0x07, 0x1D, 0x1C,
0x19, 0x1A, 0x1E, 0x0A, 0x1A, 0x1B, 0x0B, 0x1E, 0x1B, 0x1C, 0x1F, 0x0B, 0x1C, 0x1D, 0x0F, 0x1F,
};
typedef struct {
/* 0x000 */ s32 unk_0;
/* 0x004 */ s32 unk_4;
@ -10,23 +67,391 @@ typedef struct {
/* 0x010 */ s32 unk_10;
} Struct_8012AF0C; // size = 0x14
extern Struct_8012AF0C D_8012AF0C[6];
extern Struct_8012AF0C D_8012AEBC[4];
extern struct_8011FC1C D_8011FC1C[][9];
Struct_8012AF0C D_8012AEBC[4] = {
{ -0x7E, 0x7C, -0x7E, 0x3F, -0x1F },
{ 0x7E, 0x7C, -0x7E, 0x3F, -0x1F },
{ 0x7E, 0x7C, 0x7E, -0x3F, -0x1F },
{ -0x7E, 0x7C, 0x7E, -0x3F, -0x1F },
};
typedef struct {
/* 0x00 */ u32 unk_0; // start
/* 0x04 */ u32 unk_4; // end
/* 0x08 */ u32 unk_8; // pal start
/* 0x0C */ u32 unk_C; // pal end
} Struct_8011FD3C; // size = 0x10
Struct_8012AF0C D_8012AF0C[6] = {
{ -0x40, 0x40, -0x40, 0x20, -0x20 }, { 0x40, 0x40, 0x40, -0x20, -0x20 }, { -0x40, 0x40, 0x40, -0x20, -0x20 },
{ 0x40, 0x40, -0x40, 0x20, -0x20 }, { -0x40, 0x40, 0x40, 0x20, -0x20 }, { -0x40, -0x40, -0x40, 0x20, 0x20 },
};
#ifdef NON_MATCHING
// Loops have very strange structure. In principle, they're the double loop over a 2D array shown below them.
// However, that gives wildly different codegen and the part after the switch suggests a linear array.
s32 func_800ADBB0(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7,
s32 arg8, s32 arg9) {
u32 pad42C;
// 42C
s32 pad428;
// 428
s32 sp424;
s32 pad420;
// 420
s32 i;
// 41C
s32 j;
// 418
u16 index;
s16 phi_t1;
// 414
s16 phi_a2_4;
s16 phi_a0_4;
// 410
s16 phi_t2_4;
s16 phi_ra;
// 40C
s32 sp358[9 * 5];
s32 sp2A4[9 * 5];
s32 sp1F0[9 * 5];
s32 sp13C[9 * 5];
s32 sp88[9 * 5];
s32* temp358;
s32* temp2A4;
s32* temp1F0;
s32* temp13C;
s32* temp88;
s16 temp3;
switch (arg8) {
case 0:
case 2:
temp358 = sp358;
temp2A4 = sp2A4;
temp1F0 = sp1F0;
temp13C = sp13C;
temp88 = sp88;
pad428 = arg4;
for (i = 0; temp88 < sp88 + 45; pad428 += arg7, i++) {
pad42C = arg3;
temp3 = D_8012AD2C[i];
for (j = 0; j < 5; j++, pad42C += arg6) {
*(temp358++) = pad42C;
*(temp2A4++) = pad428;
*(temp1F0++) = arg5;
*(temp13C++) = D_8012AD20[j];
*(temp88++) = temp3;
}
}
// for (i = 0; i < 9; i++) {
// for (j = 0; j < 5; j++) {
// sp358[i][j] = arg3 + j * arg6;
// sp2A4[i][j] = arg4 + i * arg7;
// sp1F0[i][j] = arg5;
// sp13C[i][j] = D_8012AD20[j];
// sp88[i][j] = D_8012AD2C[i];
// }
// }
break;
case 1:
case 3:
temp358 = sp358;
temp2A4 = sp2A4;
temp1F0 = sp1F0;
temp13C = sp13C;
temp88 = sp88;
pad428 = arg4;
for (i = 0; temp88 < sp88 + 9 * 5; pad428 += arg7, i++) {
pad42C = arg5;
temp3 = D_8012AD2C[i];
for (j = 0; j < 5; j++, pad42C += arg6) {
*(temp358++) = arg3;
*(temp2A4++) = pad428;
*(temp1F0++) = pad42C;
*(temp13C++) = D_8012AD20[j];
*(temp88++) = temp3;
}
}
// for (i = 0; i < 9; i++) {
// for (j = 0; j < 5; j++) {
// sp358[i][j] = arg3;
// sp2A4[i][j] = arg4 + i * arg7;
// sp1F0[i][j] = arg5 + j * arg6;
// sp13C[i][j] = D_8012AD20[j];
// sp88[i][j] = D_8012AD2C[i];
// }
// }
break;
case 4:
case 5:
temp358 = sp358;
temp2A4 = sp2A4;
temp1F0 = sp1F0;
temp13C = sp13C;
temp88 = sp88;
pad428 = arg5;
for (i = 0; temp88 < sp88 + 9 * 5; pad428 += arg7, i++) {
pad42C = arg3;
temp3 = D_8012AD2C[i];
for (j = 0; j < 5; j++, pad42C += arg6) {
*(temp358++) = pad42C;
*(temp2A4++) = arg4;
*(temp1F0++) = pad428;
*(temp13C++) = D_8012AD20[j];
*(temp88++) = temp3;
}
}
// for (i = 0; i < 9; i++) {
// for (j = 0; j < 5; j++) {
// sp358[i][j] = arg3 + j * arg6;
// sp2A4[i][j] = arg4;
// sp1F0[i][j] = arg5 + i * arg7;
// sp13C[i][j] = D_8012AD20[j];
// sp88[i][j] = D_8012AD2C[i];
// }
// }
break;
}
for (phi_a2_4 = 0, sp424 = 0; sp424 < 2; sp424++) {
skyboxCtx->unk_138 = skyboxCtx->dListBuf[arg9 + sp424];
for (pad420 = 0; pad420 < 0x20; pad420++) {
index = D_8012ACA0[sp424][pad420];
roomVtx[arg2 + pad420].v.ob[0] = sp358[index];
roomVtx[arg2 + pad420].v.ob[1] = sp2A4[index];
roomVtx[arg2 + pad420].v.ob[2] = sp1F0[index];
roomVtx[arg2 + pad420].v.flag = 0;
roomVtx[arg2 + pad420].v.tc[0] = sp13C[index];
roomVtx[arg2 + pad420].v.tc[1] = sp88[index];
roomVtx[arg2 + pad420].v.cn[1] = 0;
roomVtx[arg2 + pad420].v.cn[2] = 0;
roomVtx[arg2 + pad420].v.cn[0] = 255;
}
gSPVertex(skyboxCtx->unk_138++, &roomVtx[arg2], 32, 0);
arg2 += pad420;
gSPCullDisplayList(skyboxCtx->unk_138++, 0, 15);
for (phi_t2_4 = 0, phi_ra = 0; phi_ra < 4; phi_ra++, phi_a2_4 += 0x1F) {
for (phi_a0_4 = 0, phi_t1 = 0; phi_t1 < 4; phi_t1++, phi_a0_4 += 0x3F, phi_t2_4 += 4) {
gDPLoadTextureTile(skyboxCtx->unk_138++, (u32)skyboxCtx->staticSegments[0] + D_8012AC90[arg8],
G_IM_FMT_CI, G_IM_SIZ_8b, 256, 0, phi_a0_4, phi_a2_4, phi_a0_4 + 0x3F,
phi_a2_4 + 0x1F, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gSP1Quadrangle(skyboxCtx->unk_138++, D_8012AD40[phi_t2_4 + 1], D_8012AD40[phi_t2_4 + 2],
D_8012AD40[phi_t2_4 + 3], D_8012AD40[phi_t2_4 + 0], 3);
}
}
gSPEndDisplayList(skyboxCtx->unk_138++);
}
return arg2;
}
#else
s32 func_800ADBB0(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32, UNK_TYPE, UNK_TYPE, UNK_TYPE, UNK_TYPE, UNK_TYPE, s32,
s32);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800ADBB0.s")
#endif
#ifdef NON_MATCHING
// Loops have very strange structure. In principle, they're the double loop over a 2D array shown below them.
// However, that gives wildly different codegen and the part after the switch suggests a linear array.
s32 func_800AE2C0(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7,
s32 arg8) {
s32 pad334;
s32 pad330;
s32 i;
// 32C
s32 j;
// 328
s16 phi_a2_4;
s16 phi_a0_4;
// 324
s16 phi_t1;
u16 index;
// 320
s16 sp320;
s16 sp31E;
// 31C
s16 phi_t2_4;
s16 phi_ra;
// 318
s32 sp2B4[5 * 5];
s32 sp250[5 * 5];
s32 sp1EC[5 * 5];
s32 sp188[5 * 5];
s32 sp124[5 * 5];
s32* temp2B4;
s32* temp250;
s32* temp1EC;
s32* temp188;
s32* temp124;
s32 temp1;
s32 temp2;
s16 temp3;
switch (arg8) {
case 0:
case 1:
temp2B4 = sp2B4;
temp250 = sp250;
temp1EC = sp1EC;
temp188 = sp188;
temp124 = sp124;
temp1 = arg4;
for (i = 0; temp124 < sp124 + 5 * 5; temp1 += arg7, i++) {
temp2 = arg3;
temp3 = D_8012AE30[i];
for (j = 0; j < 5; j++, temp2 += arg6) {
*(temp2B4++) = temp2;
*(temp250++) = temp1;
*(temp1EC++) = arg5;
*(temp188++) = D_8012AE18[j];
*(temp124++) = temp3;
}
}
// for (i = 0; i < 5; i++) {
// for (j = 0; j < 5; j++) {
// sp2B4[i][j] = arg3 + j * arg6;
// sp250[i][j] = arg4 + i * arg7;
// sp1EC[i][j] = arg5;
// sp188[i][j] = D_8012AE18[j];
// sp124[i][j] = D_8012AE30[i];
// }
// }
break;
case 2:
case 3:
temp2B4 = sp2B4;
temp250 = sp250;
temp1EC = sp1EC;
temp188 = sp188;
temp124 = sp124;
temp1 = arg4;
for (i = 0; temp124 < sp124 + 5 * 5; temp1 += arg7, i++) {
temp2 = arg5;
temp3 = D_8012AE30[i];
for (j = 0; j < 5; j++, temp2 += arg6) {
*(temp2B4++) = arg3;
*(temp250++) = temp1;
*(temp1EC++) = temp2;
*(temp188++) = D_8012AE18[j];
*(temp124++) = temp3;
}
}
// for (i = 0; i < 5; i++) {
// for (j = 0; j < 5; j++) {
// sp2B4[i][j] = arg3;
// sp250[i][j] = arg4 + i * arg7;
// sp1EC[i][j] = arg5 + j * arg6;
// sp188[i][j] = D_8012AE18[j];
// sp124[i][j] = D_8012AE30[i];
// }
// }
break;
case 4:
case 5:
temp2B4 = sp2B4;
temp250 = sp250;
temp1EC = sp1EC;
temp188 = sp188;
temp124 = sp124;
temp1 = arg5;
for (i = 0; temp124 < sp124 + 5 * 5; temp1 += arg7, i++) {
temp2 = arg3;
temp3 = D_8012AE24[i];
for (j = 0; j < 5; j++, temp2 += arg6) {
*(temp2B4++) = temp2;
*(temp250++) = arg4;
*(temp1EC++) = temp1;
*(temp188++) = D_8012AE18[j];
*(temp124++) = temp3;
}
}
// for (i = 0; i < 5; i++) {
// for (j = 0; j < 5; j++) {
// sp2B4[i][j] = arg3 + j * arg6;
// sp250[i][j] = arg4;
// sp1EC[i][j] = arg5 + i * arg7;
// sp188[i][j] = D_8012AE18[j];
// sp124[i][j] = D_8012AE24[i];
// }
// }
break;
}
skyboxCtx->unk_138 = &skyboxCtx->dListBuf[2 * arg8];
for (pad330 = 0; pad330 < 0x20; pad330++) {
index = D_8012ADD8[pad330];
roomVtx[arg2 + pad330].v.ob[0] = sp2B4[index];
roomVtx[arg2 + pad330].v.ob[1] = sp250[index];
roomVtx[arg2 + pad330].v.ob[2] = sp1EC[index];
roomVtx[arg2 + pad330].v.flag = 0;
roomVtx[arg2 + pad330].v.tc[0] = sp188[index];
roomVtx[arg2 + pad330].v.tc[1] = sp124[index];
roomVtx[arg2 + pad330].v.cn[1] = 0;
roomVtx[arg2 + pad330].v.cn[2] = 0;
roomVtx[arg2 + pad330].v.cn[0] = 255;
}
gSPVertex(skyboxCtx->unk_138++, &roomVtx[arg2], 32, 0);
arg2 += pad330;
gSPCullDisplayList(skyboxCtx->unk_138++, 0, 15);
if ((arg8 == 4) || (arg8 == 5)) {
phi_a2_4 = 0;
for (phi_t2_4 = 0, phi_ra = 0; phi_ra < 4; phi_ra++, phi_a2_4 += 0x1F) {
for (phi_a0_4 = 0, phi_t1 = 0; phi_t1 < 4; phi_t1++, phi_a0_4 += 0x1F, phi_t2_4 += 4) {
gDPLoadMultiTile(skyboxCtx->unk_138++, (u32)skyboxCtx->staticSegments[0] + D_8012ADC0[arg8], 0,
G_TX_RENDERTILE, G_IM_FMT_CI, G_IM_SIZ_8b, 128, 0, phi_a0_4, phi_a2_4, phi_a0_4 + 0x1F,
phi_a2_4 + 0x1F, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gDPLoadMultiTile(skyboxCtx->unk_138++, (u32)skyboxCtx->staticSegments[1] + D_8012ADC0[arg8], 0x80, 1,
G_IM_FMT_CI, G_IM_SIZ_8b, 128, 0, phi_a0_4, phi_a2_4, phi_a0_4 + 0x1F, phi_a2_4 + 0x1F,
0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOLOD);
gSP1Quadrangle(skyboxCtx->unk_138++, D_8012AE3C[phi_t2_4 + 1], D_8012AE3C[phi_t2_4 + 2],
D_8012AE3C[phi_t2_4 + 3], D_8012AE3C[phi_t2_4 + 0], 3);
}
}
} else {
phi_a2_4 = 0;
for (phi_t2_4 = 0, phi_ra = 0; phi_ra < 2; phi_ra++, phi_a2_4 += 0x1F) {
for (phi_a0_4 = 0, phi_t1 = 0; phi_t1 < 4; phi_t1++, phi_a0_4 += 0x1F, phi_t2_4 += 4) {
gDPLoadMultiTile(skyboxCtx->unk_138++, (u32)skyboxCtx->staticSegments[0] + D_8012ADC0[arg8], 0,
G_TX_RENDERTILE, G_IM_FMT_CI, G_IM_SIZ_8b, 128, 0, phi_a0_4, phi_a2_4, phi_a0_4 + 0x1F,
phi_a2_4 + 0x1F, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gDPLoadMultiTile(skyboxCtx->unk_138++, (u32)skyboxCtx->staticSegments[1] + D_8012ADC0[arg8], 0x80, 1,
G_IM_FMT_CI, G_IM_SIZ_8b, 128, 0, phi_a0_4, phi_a2_4, phi_a0_4 + 0x1F, phi_a2_4 + 0x1F,
0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOLOD);
gSP1Quadrangle(skyboxCtx->unk_138++, D_8012AE3C[phi_t2_4 + 1], D_8012AE3C[phi_t2_4 + 2],
D_8012AE3C[phi_t2_4 + 3], D_8012AE3C[phi_t2_4 + 0], 3);
}
}
phi_a2_4 -= 0x1F;
for (phi_ra = 0; phi_ra < 2; phi_ra++, phi_a2_4 -= 0x1F) {
for (phi_a0_4 = 0, phi_t1 = 0; phi_t1 < 4; phi_t1++, phi_a0_4 += 0x1F, phi_t2_4 += 4) {
gDPLoadMultiTile(skyboxCtx->unk_138++, (u32)skyboxCtx->staticSegments[0] + D_8012ADC0[arg8], 0,
G_TX_RENDERTILE, G_IM_FMT_CI, G_IM_SIZ_8b, 128, 0, phi_a0_4, phi_a2_4, phi_a0_4 + 0x1F,
phi_a2_4 + 0x1F, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gDPLoadMultiTile(skyboxCtx->unk_138++, (u32)skyboxCtx->staticSegments[1] + D_8012ADC0[arg8], 0x80, 1,
G_IM_FMT_CI, G_IM_SIZ_8b, 128, 0, phi_a0_4, phi_a2_4, phi_a0_4 + 0x1F, phi_a2_4 + 0x1F,
0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOLOD);
gSP1Quadrangle(skyboxCtx->unk_138++, D_8012AE3C[phi_t2_4 + 1], D_8012AE3C[phi_t2_4 + 2],
D_8012AE3C[phi_t2_4 + 3], D_8012AE3C[phi_t2_4 + 0], 3);
}
}
}
gSPEndDisplayList(skyboxCtx->unk_138++);
return arg2;
}
#else
s32 func_800AE2C0(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32, UNK_TYPE, UNK_TYPE, UNK_TYPE, UNK_TYPE, UNK_TYPE, s32);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800AE2C0.s")
#endif
void func_800AEFC8(SkyboxContext* skyboxCtx, s16 skyboxId) {
s32 i;
@ -112,27 +537,27 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
1064);
if ((sp41 & 1) ^ ((sp41 & 4) >> 2)) {
size = gSkyboxFiles[sp41].pallete.vromEnd - gSkyboxFiles[sp41].pallete.vromStart;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1072);
size = gSkyboxFiles[sp41].palette.vromEnd - gSkyboxFiles[sp41].palette.vromStart;
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1072);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1073);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], gSkyboxFiles[sp41].pallete.vromStart, size,
"../z_vr_box.c", 1075);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, gSkyboxFiles[sp40].pallete.vromStart,
size, "../z_vr_box.c", 1077);
DmaMgr_SendRequest1(skyboxCtx->palettes, gSkyboxFiles[sp41].palette.vromStart, size, "../z_vr_box.c", 1075);
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, gSkyboxFiles[sp40].palette.vromStart, size,
"../z_vr_box.c", 1077);
} else {
size = gSkyboxFiles[sp41].pallete.vromEnd - gSkyboxFiles[sp41].pallete.vromStart;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1085);
size = gSkyboxFiles[sp41].palette.vromEnd - gSkyboxFiles[sp41].palette.vromStart;
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1085);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1086);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], gSkyboxFiles[sp40].pallete.vromStart, size,
"../z_vr_box.c", 1088);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, gSkyboxFiles[sp41].pallete.vromStart,
size, "../z_vr_box.c", 1090);
DmaMgr_SendRequest1(skyboxCtx->palettes, gSkyboxFiles[sp40].palette.vromStart, size, "../z_vr_box.c", 1088);
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, gSkyboxFiles[sp41].palette.vromStart, size,
"../z_vr_box.c", 1090);
}
break;
@ -149,11 +574,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_SP1a_pal_staticSegmentRomStart;
size = _vr_SP1a_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1132);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1132);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1133);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1134);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1134);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_OVERCAST_SUNSET:
@ -173,12 +598,12 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_cloud2_pal_staticSegmentRomStart;
size = _vr_cloud2_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1170);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1170);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1171);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1173);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, start, size, "../z_vr_box.c", 1175);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1173);
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, start, size, "../z_vr_box.c", 1175);
break;
case SKYBOX_MARKET_ADULT:
skyboxCtx->unk_140 = 1;
@ -195,11 +620,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
size = _vr_RUVR_pal_staticSegmentRomEnd - start;
osSyncPrintf(" = %d\n", size);
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1188);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1188);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1189);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1190);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1190);
break;
case SKYBOX_CUTSCENE_MAP:
start = _vr_holy0_staticSegmentRomStart;
@ -220,12 +645,12 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_holy0_pal_staticSegmentRomStart;
size = _vr_holy0_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1211);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size * 2, "../z_vr_box.c", 1211);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1212);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1214);
DmaMgr_SendRequest1((u32)skyboxCtx->staticSegments[2] + size, _vr_holy1_pal_staticSegmentRomStart, size,
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1214);
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, _vr_holy1_pal_staticSegmentRomStart, size,
"../z_vr_box.c", 1216);
break;
case SKYBOX_HOUSE_LINK:
@ -241,11 +666,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_LHVR_pal_staticSegmentRomStart;
size = _vr_LHVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1231);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1231);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1232);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1233);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1233);
break;
case SKYBOX_MARKET_CHILD_DAY:
skyboxCtx->unk_140 = 1;
@ -260,11 +685,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_MDVR_pal_staticSegmentRomStart;
size = _vr_MDVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1262);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1262);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1263);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1264);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1264);
break;
case SKYBOX_MARKET_CHILD_NIGHT:
skyboxCtx->unk_140 = 1;
@ -281,11 +706,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
size = _vr_MNVR_pal_staticSegmentRomEnd - start;
osSyncPrintf(" = %d\n", size);
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1277);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1277);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1278);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1279);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1279);
break;
case SKYBOX_HAPPY_MASK_SHOP:
skyboxCtx->unk_140 = 1;
@ -300,11 +725,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_FCVR_pal_staticSegmentRomStart;
size = _vr_FCVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1291);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1291);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1292);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1293);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1293);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_HOUSE_KNOW_IT_ALL_BROTHERS:
@ -320,11 +745,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KHVR_pal_staticSegmentRomStart;
size = _vr_KHVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1306);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1306);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1307);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1308);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1308);
break;
case SKYBOX_HOUSE_OF_TWINS:
skyboxCtx->unk_140 = 2;
@ -339,11 +764,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K3VR_pal_staticSegmentRomStart;
size = _vr_K3VR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1336);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1336);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1337);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1338);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1338);
break;
case SKYBOX_STABLES:
skyboxCtx->unk_140 = 1;
@ -358,11 +783,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_MLVR_pal_staticSegmentRomStart;
size = _vr_MLVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1350);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1350);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1351);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1352);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1352);
break;
case SKYBOX_HOUSE_KAKARIKO:
skyboxCtx->unk_140 = 1;
@ -377,11 +802,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KKRVR_pal_staticSegmentRomStart;
size = _vr_KKRVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1364);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1364);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1365);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1366);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1366);
break;
case SKYBOX_KOKIRI_SHOP:
skyboxCtx->unk_140 = 1;
@ -396,11 +821,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KSVR_pal_staticSegmentRomStart;
size = _vr_KSVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1378);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1378);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1379);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1380);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1380);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_GORON_SHOP:
@ -416,11 +841,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_GLVR_pal_staticSegmentRomStart;
size = _vr_GLVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1410);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1410);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1411);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1412);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1412);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_ZORA_SHOP:
@ -436,11 +861,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_ZRVR_pal_staticSegmentRomStart;
size = _vr_ZRVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1425);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1425);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1426);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1427);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1427);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_POTION_SHOP_KAKARIKO:
@ -456,11 +881,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_DGVR_pal_staticSegmentRomStart;
size = _vr_DGVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1456);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1456);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1457);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1458);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1458);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_POTION_SHOP_MARKET:
@ -476,11 +901,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_ALVR_pal_staticSegmentRomStart;
size = _vr_ALVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1471);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1471);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1472);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1473);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1473);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_BOMBCHU_SHOP:
@ -496,11 +921,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_NSVR_pal_staticSegmentRomStart;
size = _vr_NSVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1486);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1486);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1487);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1488);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1488);
skyboxCtx->rot.y = 0.8f;
break;
case SKYBOX_HOUSE_RICHARD:
@ -516,11 +941,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_IPVR_pal_staticSegmentRomStart;
size = _vr_IPVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1517);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1517);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1518);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1519);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1519);
break;
case SKYBOX_HOUSE_IMPA:
skyboxCtx->unk_140 = 1;
@ -535,11 +960,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_LBVR_pal_staticSegmentRomStart;
size = _vr_LBVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1531);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1531);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1532);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1533);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1533);
break;
case SKYBOX_TENT:
skyboxCtx->unk_140 = 2;
@ -554,11 +979,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_TTVR_pal_staticSegmentRomStart;
size = _vr_TTVR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1545);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1545);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1546);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1547);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1547);
break;
case SKYBOX_HOUSE_MIDO:
skyboxCtx->unk_140 = 2;
@ -573,11 +998,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K4VR_pal_staticSegmentRomStart;
size = _vr_K4VR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1565);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1565);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1566);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1567);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1567);
break;
case SKYBOX_HOUSE_SARIA:
skyboxCtx->unk_140 = 2;
@ -592,11 +1017,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_K5VR_pal_staticSegmentRomStart;
size = _vr_K5VR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1579);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1579);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1580);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1581);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1581);
break;
case SKYBOX_HOUSE_ALLEY:
skyboxCtx->unk_140 = 2;
@ -611,11 +1036,11 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
start = _vr_KR3VR_pal_staticSegmentRomStart;
size = _vr_KR3VR_pal_staticSegmentRomEnd - start;
skyboxCtx->staticSegments[2] = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1593);
ASSERT(skyboxCtx->staticSegments[2] != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
skyboxCtx->palettes = GameState_Alloc(&globalCtx->state, size, "../z_vr_box.c", 1593);
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c",
1594);
DmaMgr_SendRequest1(skyboxCtx->staticSegments[2], start, size, "../z_vr_box.c", 1595);
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1595);
break;
case SKYBOX_UNSET_27:
break;
@ -624,9 +1049,7 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
void Skybox_Init(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxId) {
skyboxCtx->unk_140 = 0;
skyboxCtx->rot.x = 0.0f;
skyboxCtx->rot.y = 0.0f;
skyboxCtx->rot.z = 0.0f;
skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f;
Skybox_Setup(globalCtx, skyboxCtx, skyboxId);
osSyncPrintf("\n\n\n\n\n\n"
@ -638,7 +1061,7 @@ void Skybox_Init(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxI
osSyncPrintf(VT_FGCOL(GREEN));
if (skyboxCtx->unk_140 != 0) {
skyboxCtx->dListBuf = GameState_Alloc(&globalCtx->state, 1200 * sizeof(Gfx), "../z_vr_box.c", 1636);
skyboxCtx->dListBuf = GameState_Alloc(&globalCtx->state, 8 * 150 * sizeof(Gfx), "../z_vr_box.c", 1636);
ASSERT(skyboxCtx->dListBuf != NULL, "vr_box->dpList != NULL", "../z_vr_box.c", 1637);
skyboxCtx->roomVtx = GameState_Alloc(&globalCtx->state, 256 * sizeof(Vtx), "../z_vr_box.c", 1639);
@ -646,7 +1069,7 @@ void Skybox_Init(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxI
func_800AEFC8(skyboxCtx, skyboxId);
} else {
skyboxCtx->dListBuf = GameState_Alloc(&globalCtx->state, 1800 * sizeof(Gfx), "../z_vr_box.c", 1643);
skyboxCtx->dListBuf = GameState_Alloc(&globalCtx->state, 12 * 150 * sizeof(Gfx), "../z_vr_box.c", 1643);
ASSERT(skyboxCtx->dListBuf != NULL, "vr_box->dpList != NULL", "../z_vr_box.c", 1644);
if (skyboxId == SKYBOX_CUTSCENE_MAP) {

View File

@ -18,7 +18,7 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb
gSPSegment(POLY_OPA_DISP++, 0x7, skyboxCtx->staticSegments[0]);
gSPSegment(POLY_OPA_DISP++, 0x8, skyboxCtx->staticSegments[1]);
gSPSegment(POLY_OPA_DISP++, 0x9, skyboxCtx->staticSegments[2]);
gSPSegment(POLY_OPA_DISP++, 0x9, skyboxCtx->palettes);
gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 0, 0, 0, blend);
gSPTexture(POLY_OPA_DISP++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
@ -36,44 +36,42 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb
gDPSetColorDither(POLY_OPA_DISP++, G_CD_MAGICSQ);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->staticSegments[2]);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[0]);
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16);
gDPSetTextureConvert(POLY_OPA_DISP++, G_TC_FILT);
if (skyboxCtx->unk_140) {
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 1);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[0]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[1]);
gDPPipeSync(POLY_OPA_DISP++);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, (u16*)skyboxCtx->staticSegments[2] + 256 * 1);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 2);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 3);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[1]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[2]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[3]);
if (skyboxId != SKYBOX_BAZAAR) {
if (skyboxId <= SKYBOX_HOUSE_KAKARIKO || skyboxId > SKYBOX_BOMBCHU_SHOP) {
gDPPipeSync(POLY_OPA_DISP++);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, (u16*)skyboxCtx->staticSegments[2] + 256 * 2);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 4);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 5);
gDPPipeSync(POLY_OPA_DISP++);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[2]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[4]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[5]);
gDPPipeSync(POLY_OPA_DISP++);
if (skyboxCtx->unk_140 != 2) {
gDPLoadTLUT_pal256(POLY_OPA_DISP++, (u16*)skyboxCtx->staticSegments[2] + 256 * 3);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 6);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 7);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[3]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[6]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[7]);
}
}
}
} else {
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 2);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 4);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 6);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 8);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[0]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[2]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[4]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[6]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[8]);
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf + 150 * 10);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[10]);
}
}