Files
mm/src/code/z_vr_box.c
T
Lucas Shaw dcf44596d2 Animation system updated, some more boot files decompiled (+6%), z_fcurve_data_skelanime decompiled (1 non-matching), some asm files split, etc (#89)
* Progress on various files

* gfxprint stuff

* split some rodata, add iconv for rodata string parsing

* z_std_dma rodata

* 2 nonmatchings in gfxprint

* mtxuty-cvt ok

* more

* match a function in idle.c

* progress

* Cleanup

* Rename BgPolygon to CollisionPoly

* progress

* some effect stuff

* more effect progress

* updates

* made suggested changes

* z_effect_soft_sprite_old_init mostly ok

* remove old effects enum

* gamealloc.c OK

* added more files

* motor.c almost done

* motor.c OK

* updates

* migration of two files

* listalloc.c oK

* z_fcurve_data_skelanime split

* z_fcurve_data_skelanime.c decompiled

* more files split

* z_malloc.c OK

* contpfs.c OK

* fault.c rodata migrated

* migrated fault_drawer rodata

* update

* update preprocess.py

* renamed functions in z_skelanime

* started z_skelanime cleanup

* like halfway through fixing z_skelanime

* animation system updated to meet oot standards

* remove unused animation structs

* rename matrix structs to fit oot

* Add -woff 712

* fix diff_settings.py because i accidentally broke it before

* fixed merge conflict, doesn't match though

* It matches now

* Updates

* Fixed warnings...added gcc code syntax checking

* Remove gcc check, added in Tharo's PR

* warnings fixed (i think)

* fixed all warnings i think

* ok

* not sure what to do

* Fix all warnings i think (z_en_a_keep needs some file cleanup thouguh)

* it matches if i do this

* remove comment

* accidentally put osPfsFreeBlocks in epilinkhandle.c

* memcmp -> bcmp

* change u32 size to size_t size, delete string.h because it caused unnecessary confusion with defining size_t twice

* format.sh

* MTXMODE_NEW and MTXMODE_APPLY to matrix functions

* Made suggested changes

* pragma sFaultDrawerFont instead of including in repo

* add some functions to functions.h

* Bss reordering fixed in z_collision_check...added hack to disasm.py

* Updated z_en_a_keep.c

* Missed suggestion in EnAObj_Destroy

* .

* update z_fcurve_Data_skelanime and z_skelanime with suggestions

* devmgr.c ok

* minor changes

* Addressed comments

* remove redundant file

* gfxp -> dlist in game.c

* updated actorfixer.py

* fixed warnings in z_malloc

* Change void* back to Actor*

* format

* Add the soft_sprit comments back

* Rename SV->Flex

* remove .common

* run format

* Update src/code/z_skelanime.c

* u32 channel

Co-authored-by: Lucas Shaw <lucas.shaw1123@gmail.com>
Co-authored-by: angie <angheloalf95@gmail.com>
Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com>
2021-10-24 10:59:14 -04:00

156 lines
6.0 KiB
C

#include "global.h"
s32 D_801C5E30[] = { 0, 0x2000, 0x4000, 0x6000, 0x8000, 0xC000 };
u16 D_801C5E48[] = {
0, 2, 10, 12, 2, 4, 12, 14, 10, 12, 20, 22, 12, 14, 22, 24, 1, 3, 5, 6, 7, 8, 9, 11, 13, 15, 16, 17, 18, 19, 21, 23,
};
s32 D_801C5E88[] = { 0, 0x7C0, 0xF80, 0x1740, 0x1F00 };
s32 D_801C5E9C[] = { 0, 0x7C0, 0xF80, 0x1740, 0x1F00 };
s32 D_801C5EB0[] = { 0, 0x7C0, 0xF80, 0x7C0, 0 };
s16 D_801C5EC4[] = {
0, 16, 19, 18, 16, 1, 20, 19, 1, 17, 21, 20, 17, 5, 22, 21, 18, 19, 23, 2, 19, 20,
3, 23, 20, 21, 24, 3, 21, 22, 7, 24, 2, 23, 26, 25, 23, 3, 27, 26, 3, 24, 28, 27,
24, 7, 29, 28, 25, 26, 30, 10, 26, 27, 11, 30, 27, 28, 31, 11, 28, 29, 15, 31,
};
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_80142440.s")
void func_80143148(SkyboxContext* skyboxCtx, s32 arg1) {
static struct_801C5F44 D_801C5F44[] = {
{ -64, 64, -64, 32, -32 }, { 64, 64, 64, -32, -32 }, { -64, 64, 64, -32, -32 },
{ 64, 64, -64, 32, -32 }, { -64, 64, 64, 32, -32 }, { -64, -64, -64, 32, 32 },
};
s32 ret = 0;
struct_801C5F44* unkStruct;
s32 face;
for (face = 0; face < arg1; face++) {
unkStruct = &D_801C5F44[face];
ret = func_80142440(skyboxCtx, skyboxCtx->roomVtx, ret, unkStruct->unk0, unkStruct->unk4, unkStruct->unk8,
unkStruct->unkC, unkStruct->unk10, face);
}
}
void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
size_t size;
void* offset;
s32 pad;
skyboxCtx->rotZ = 0.0f;
if (skyType != 1) {
if (skyType != 2) {
return;
}
} else {
// Send a DMA request for the cloudy sky texture
skyboxCtx->skyboxStaticSegment[0] = &D_80025D00;
size = SEGMENT_ROM_SIZE(d2_cloud_static);
offset = (void*)ALIGN8((u32)skyboxCtx->skyboxStaticSegment[0] + size);
DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[0], SEGMENT_ROM_START(d2_cloud_static), size);
// Send a DMA request for the clear sky texture
skyboxCtx->skyboxStaticSegment[1] = offset;
size = SEGMENT_ROM_SIZE(d2_fine_static);
offset = (void*)ALIGN8((u32)offset + size);
DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[1], SEGMENT_ROM_START(d2_fine_static), size);
// Send a DMA request for the skybox palette
skyboxCtx->skyboxPaletteStaticSegment = offset;
size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
offset = (void*)ALIGN8((u32)offset + size);
DmaMgr_SendRequest0(skyboxCtx->skyboxPaletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size);
skyboxCtx->primR = 145;
skyboxCtx->primG = 120;
skyboxCtx->primB = 155;
skyboxCtx->envR = 40;
skyboxCtx->envG = 0;
skyboxCtx->envB = 40;
// Inverted Stone Tower Temple and Inverted Stone Tower
if ((globalCtx->sceneNum == SCENE_F41) || (globalCtx->sceneNum == SCENE_INISIE_R)) {
skyboxCtx->rotZ = 3.15000009537f;
}
}
}
void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType) {
size_t size;
if (1) {}
if (skyType == 1) {
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1);
if (globalCtx->envCtx.unk_10 == 0) {
// Send a DMA request for the clear sky texture
size = SEGMENT_ROM_SIZE(d2_fine_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->skyboxStaticSegment[0],
SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL);
} else {
// Send a DMA request for the cloudy sky texture
size = SEGMENT_ROM_SIZE(d2_cloud_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->skyboxStaticSegment[0],
SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
}
osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1);
if (globalCtx->envCtx.unk_11 == 0) {
// Send a DMA request for the clear sky texture
size = SEGMENT_ROM_SIZE(d2_fine_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->skyboxStaticSegment[1],
SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL);
} else {
// Send a DMA request for the cloudy sky texture
size = SEGMENT_ROM_SIZE(d2_cloud_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->skyboxStaticSegment[1],
SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
}
osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1);
size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
// Send a DMA request for the skybox palette
DmaMgr_SendRequestImpl(&skyboxCtx->unk1C8, skyboxCtx->skyboxPaletteStaticSegment,
SEGMENT_ROM_START(d2_fine_pal_static), size, 0, &skyboxCtx->loadQueue, NULL);
osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
}
}
void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) {
skyboxCtx->skyboxShouldDraw = 0;
skyboxCtx->rotX = skyboxCtx->rotY = skyboxCtx->rotZ = 0.0f;
func_801431E8(gameState, skyboxCtx, skyType);
if (skyType != 0) {
skyboxCtx->unk17C = THA_AllocEndAlign16(&gameState->heap, 0x3840);
if (skyType == 5) {
// Allocate enough space for the vertices for a 6 sided skybox (cube)
skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6);
func_80143148(skyboxCtx, 6);
} else {
// Allocate enough space for the vertices for a 5 sided skybox (bottom is missing)
skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 5);
func_80143148(skyboxCtx, 5);
}
}
}