From 8d8df1848ea442c05d480e04f76e15bdb02ae23f Mon Sep 17 00:00:00 2001 From: rozlette Date: Sun, 29 Dec 2019 21:34:58 -0600 Subject: [PATCH] More work on z_scene_proc.c 31/36 matching, 3 non-matching, 2 not attempted --- include/PR/gbi.h | 12 +- include/functions.h | 71 ++-- include/structs.h | 44 +- include/variables.h | 16 +- linker_scripts/code_script.txt | 2 +- src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c | 2 +- src/code/z_lib.c | 24 +- src/code/z_room.c | 2 +- src/code/z_scene_proc.c | 490 +++++++++++++++++++++-- tables/files_with_nonmatching.txt | 1 - tables/functions.py | 68 ++-- tables/variables.py | 16 +- undef.txt | 2 +- 13 files changed, 612 insertions(+), 138 deletions(-) diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 1c16bb5823..e32b91881c 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -2732,12 +2732,12 @@ _DW({ \ #endif /* F3DEX_GBI_2 */ #define gSPEndDisplayList(pkt) \ -{ \ +_DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_ENDDL, 24, 8); \ _g->words.w1 = 0; \ -} +}) #define gsSPEndDisplayList() \ { \ @@ -3035,12 +3035,12 @@ _DW({ \ #define gsDPSetCombineMode(a, b) gsDPSetCombineLERP(a, b) #define gDPSetColor(pkt, c, d) \ -{ \ +_DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(c, 24, 8); \ _g->words.w1 = (unsigned int)(d); \ -} +}) #define gsDPSetColor(c, d) \ { \ @@ -4325,12 +4325,12 @@ _DW({ \ } #define gDPNoParam(pkt, cmd) \ -{ \ +_DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(cmd, 24, 8); \ _g->words.w1 = 0; \ -} +}) #define gsDPNoParam(cmd) \ { \ diff --git a/include/functions.h b/include/functions.h index 0946e59f92..0903c67f16 100644 --- a/include/functions.h +++ b/include/functions.h @@ -484,6 +484,7 @@ void func_80096410(void); // func_80096410 void func_800964D0(void); // func_800964D0 s32 __osSpSetPc(u32 data); // func_80096510 void func_80096540(void); // func_80096540 +// UNK_RET func_80096770(UNK_ARGS); void func_800967A0(void); // func_800967A0 u32 __osGetWatchLo(void); // func_80096810 void __osSetWatchLo(u32 value); // func_80096820 @@ -1860,10 +1861,10 @@ void Lib_TranslateAndRotateYVec3f(Vector3f* translation, s16 rotation, Vector3f* void Lib_LerpRGB(RGB* a, RGB* b, f32 t, RGB* dst); // func_801001B8 f32 Lib_PushAwayVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach); // func_80100448 void Lib_Nop801004FC(void); // func_801004FC -u32 Lib_PtrSegToVirt(u32 ptr); // func_80100504 -u32 Lib_PtrSegToVirtNull(u32 ptr); // func_8010053C -u32 Lib_PtrSegToK0(u32 ptr); // func_80100584 -u32 Lib_PtrSegToK0Null(u32 ptr); // func_801005A0 +u32 Lib_PtrSegToVirt(void* ptr); // func_80100504 +u32 Lib_PtrSegToVirtNull(void* ptr); // func_8010053C +u32 Lib_PtrSegToK0(void* ptr); // func_80100584 +u32 Lib_PtrSegToK0Null(void* ptr); // func_801005A0 void LifeMeter_Init(GlobalContext* ctxt); // func_801005C0 void LifeMeter_UpdateColors(GlobalContext* ctxt); // func_8010069C UNK_TYPE4 func_80100A80(GlobalContext* ctxt); // func_80100A80 @@ -2439,42 +2440,42 @@ void func_801306A4(GlobalContext* ctxt); // func_801306A4 s32 Scene_ProcessHeader(GlobalContext* ctxt, SceneHeaderEntry* header); // func_801306E8 u32 Scene_CreateEntrance(u32 sceneIndex, u32 spawnIndex, u32 offset); // func_80130768 void func_80130784(void); // func_80130784 -void func_801307C0(GlobalContext* ctxt); // func_801307C0 -void func_801307F4(GlobalContext* ctxt); // func_801307F4 -void func_80130834(void); // func_80130834 -void SceneProc_DrawType0Texture(GlobalContext* ctxt, unsigned int param_2, UNK_TYPE4 param_3); // func_801308A0 -void func_80130940(void); // func_80130940 -void SceneProc_DrawType1Texture(void); // func_801309F4 -void func_80130A94(GlobalContext* ctxt, unsigned int param_2, u8* param_3, u8* param_4); // func_80130A94 -void SceneProc_DrawType2Texture(void); // func_80130C5C -void func_80130D0C(void); // func_80130D0C -void SceneProc_DrawType3Texture(void); // func_80130D3C -void func_80130F58(void); // func_80130F58 -void func_8013115C(void); // func_8013115C -void SceneProc_DrawType4Texture(void); // func_801311B4 -void SceneProc_DrawType5Texture(void); // func_80131580 -void SceneProc_DrawAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures, f32 param_3, u32 step, u32 flags); // func_80131690 +void SceneProc_DrawCurrentSceneAnimatedTextures(GlobalContext* ctxt); // func_801307C0 +void SceneProc_DrawSceneConfig0(GlobalContext* ctxt); // func_801307F4 +Gfx* SceneProc_SetTile1Layer(GlobalContext* ctxt, ScrollingTextureParams* params); // func_80130834 +void SceneProc_DrawType0Texture(GlobalContext* ctxt, u32 segment, ScrollingTextureParams* params); // func_801308A0 +Gfx* SceneProc_SetTile2Layers(GlobalContext* ctxt, ScrollingTextureParams* params); // func_80130940 +void SceneProc_DrawType1Texture(GlobalContext* ctxt, u32 segment, ScrollingTextureParams* params); // func_801309F4 +void SceneProc_DrawFlashingTexture(GlobalContext* ctxt, u32 segment, FlashingTexturePrimColor* primColor, RGBA8* envColor); // func_80130A94 +void SceneProc_DrawType2Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params); // func_80130C5C +s32 SceneProc_Lerp(s32 a, s32 b, f32 t); // func_80130D0C +void SceneProc_DrawType3Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params); // func_80130D3C +f32 SceneProc_Interpolate(u32 numKeyFrames, f32* keyFrames, f32* values, f32 frame); // func_80130F58 +u8 SceneProc_InterpolateClamped(u32 numKeyFrames, f32* keyFrames, f32* values, f32 frame); // func_8013115C +void SceneProc_DrawType4Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params); // func_801311B4 +void SceneProc_DrawType5Texture(GlobalContext* ctxt, u32 segment, CyclingTextureParams* params); // func_80131580 +void SceneProc_DrawAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures, f32 flashingAlpha, u32 step, u32 flags); // func_80131690 void SceneProc_DrawAllSceneAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures); // func_80131758 void SceneProc_DrawOpaqueSceneAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures); // func_8013178C void SceneProc_DrawTranslucentSceneAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures); // func_801317C0 -void func_801317F4(void); // func_801317F4 -void func_8013182C(void); // func_8013182C -void func_80131864(void); // func_80131864 +void SceneProc_DrawAllSceneAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha); // func_801317F4 +void SceneProc_DrawOpaqueSceneAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha); // func_8013182C +void SceneProc_DrawTranslucentSceneAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha); // func_80131864 void SceneProc_DrawAllAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures, u32 step); // func_8013189C void SceneProc_DrawOpaqueAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures, u32 step); // func_801318C8 void SceneProc_DrawTranslucentAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures, u32 step); // func_801318F4 -void func_80131920(void); // func_80131920 -void func_8013194C(void); // func_8013194C -void func_80131978(void); // func_80131978 -void func_801319A4(GlobalContext* ctxt); // func_801319A4 -void func_801319CC(GlobalContext* ctxt); // func_801319CC -void func_80131CDC(GlobalContext* ctxt); // func_80131CDC -void func_80131DE4(GlobalContext* ctxt); // func_80131DE4 -void func_80131DF0(void); // func_80131DF0 -void func_80131E58(s32* param_1, s32 param_2, u32 param_3); // func_80131E58 -void func_80131EC0(GlobalContext* ctxt); // func_80131EC0 -void func_80131F90(GlobalContext* ctxt); // func_80131F90 -void func_80131FC0(GlobalContext* ctxt); // func_80131FC0 +void SceneProc_DrawAllAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step); // func_80131920 +void SceneProc_DrawOpaqueAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step); // func_8013194C +void SceneProc_DrawTranslucentAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step); // func_80131978 +void SceneProc_DrawSceneConfig1(GlobalContext* ctxt); // func_801319A4 +void SceneProc_DrawSceneConfig3(GlobalContext* ctxt); // func_801319CC +void SceneProc_DrawSceneConfig4(GlobalContext* ctxt); // func_80131CDC +void SceneProc_DrawSceneConfig2(GlobalContext* ctxt); // func_80131DE4 +void func_80131DF0(GlobalContext* ctxt, u32 param_2, u32 flags); // func_80131DF0 +void func_80131E58(GlobalContext* ctxt, u32 param_2, u32 flags); // func_80131E58 +void SceneProc_DrawSceneConfig5(GlobalContext* ctxt); // func_80131EC0 +void SceneProc_DrawSceneConfig7(GlobalContext* ctxt); // func_80131F90 +void SceneProc_DrawSceneConfig6(GlobalContext* ctxt); // func_80131FC0 EntranceRecord* SceneTable_LookupEntrance(u32 entrance); // func_801322C0 s32 SceneTable_LookupEntranceScene(u32 entrance); // func_8013230C s32 SceneTable_LookupEntranceAbsoluteScene(u32 entrance); // func_80132338 @@ -3735,6 +3736,8 @@ void func_8019AB40(void); // func_8019AB40 void func_8019AC10(void); // func_8019AC10 void func_8019ACEC(void); // func_8019ACEC void func_8019ADBC(void); // func_8019ADBC +// UNK_RET func_8019AE40(UNK_ARGS); +// UNK_RET func_8019AEC0(UNK_ARGS); void func_8019AF00(void); // func_8019AF00 void func_8019AF58(void); // func_8019AF58 void func_8019AFE8(void); // func_8019AFE8 diff --git a/include/structs.h b/include/structs.h index 099795a2d7..a0a16b25ff 100644 --- a/include/structs.h +++ b/include/structs.h @@ -48,7 +48,7 @@ typedef struct { typedef struct { /* 0x0 */ s8 segment; /* 0x2 */ s16 type; -/* 0x4 */ u32 params; +/* 0x4 */ void* params; } AnimatedTexture; typedef struct { @@ -188,6 +188,12 @@ typedef struct { /* 0x10 */ u32 collectibleFlags; } CycleSceneFlags; +typedef struct { +/* 0x0 */ u16 cycleLength; +/* 0x4 */ Gfx** textureDls; +/* 0x8 */ u8* textureDlOffsets; +} CyclingTextureParams; + typedef struct { /* 0x0 */ u32 size; /* 0x4 */ void* unk4; @@ -308,6 +314,14 @@ typedef struct { /* 0x7 */ u8 unk7; } FireObjLightParams; +typedef struct { +/* 0x0 */ u8 red; +/* 0x1 */ u8 green; +/* 0x2 */ u8 blue; +/* 0x3 */ u8 alpha; +/* 0x4 */ u8 lodFrac; +} FlashingTexturePrimColor; + // Font textures are loaded into here typedef struct { /* 0x0000 */ u8 unk0[2][120][128]; @@ -442,6 +456,13 @@ typedef struct { /* 0x2 */ u8 blue; } RGB; +typedef struct { +/* 0x0 */ u8 red; +/* 0x1 */ u8 green; +/* 0x2 */ u8 blue; +/* 0x3 */ u8 alpha; +} RGBA8; + typedef struct { /* 0x00 */ s16 intPart[16]; /* 0x20 */ u16 fracPart[16]; @@ -538,12 +559,19 @@ typedef struct { /* 0x0 */ u32 romStart; /* 0x4 */ u32 romEnd; /* 0x8 */ UNK_TYPE1 pad8[3]; -/* 0xB */ u8 unkB; +/* 0xB */ u8 sceneConfig; // TODO: This at least controls the behavior of animated textures. Does it do more? /* 0xC */ UNK_TYPE1 padC[1]; /* 0xD */ u8 unkD; /* 0xE */ UNK_TYPE1 padE[2]; } SceneTableEntry; +typedef struct { +/* 0x0 */ s8 xStep; +/* 0x1 */ s8 yStep; +/* 0x2 */ u8 width; +/* 0x3 */ u8 height; +} ScrollingTextureParams; + typedef struct { /* 0x0 */ s8 letterboxTarget; /* 0x1 */ s8 letterboxMagnitude; @@ -892,6 +920,14 @@ typedef union { /* 0x0 */ F3DVertexNormal normal; } F3DVertex; +typedef struct { +/* 0x0 */ u16 cycleLength; +/* 0x2 */ u16 numKeyFrames; +/* 0x4 */ FlashingTexturePrimColor* primColors; +/* 0x8 */ RGBA8* envColors; +/* 0xC */ u16* keyFrames; +} FlashingTextureParams; + typedef struct { /* 0x00 */ u32 ramLocation; /* 0x04 */ u32 vromStart; @@ -1564,6 +1600,8 @@ typedef struct { typedef void(*scene_header_func)(GlobalContext* ctxt, SceneHeaderEntry* entry); +typedef void(*scene_proc_draw_func)(GlobalContext* ctxt, u32 segment, void* params); + typedef struct LightsList LightsList; typedef struct LoadedParticleEntry LoadedParticleEntry; @@ -1913,7 +1951,7 @@ struct ActorPostDrawParams { struct GlobalContext { /* 0x00000 */ ContextCommon common; /* 0x000A4 */ s16 currentScene; -/* 0x000A6 */ u8 unkA6; +/* 0x000A6 */ u8 sceneConfig; // TODO: This at least controls the behavior of animated textures. Does it do more? /* 0x000A7 */ UNK_TYPE1 padA7[9]; /* 0x000B0 */ void* currentSceneVram; /* 0x000B4 */ UNK_TYPE1 padB4[4]; diff --git a/include/variables.h b/include/variables.h index ed5aa647ea..d52f90a925 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1023,12 +1023,12 @@ extern UNK_TYPE1 D_801C2660; // D_801C2660 extern scene_header_func sceneHeaderFuncTable[31]; // D_801C26A8 extern UNK_TYPE1 D_801C2730; // D_801C2730 extern ObjectFileTableEntry objectFileTable[643]; // D_801C2740 -extern Gfx D_801C3B60[11]; // D_801C3B60 -extern global_context_func D_801C3BB8[8]; // D_801C3BB8 -extern UNK_PTR gSceneProcDrawFuncs; // D_801C3BD8 -extern UNK_TYPE1 D_801C3C50; // D_801C3C50 -extern UNK_TYPE1 D_801C3C80; // D_801C3C80 -extern UNK_TYPE1 D_801C3C88; // D_801C3C88 +extern Gfx gSceneProcDefaultDl[11]; // D_801C3B60 +extern global_context_func gSceneProcSceneDrawFuncs[8]; // D_801C3BB8 +extern scene_proc_draw_func gSceneProcDrawFuncs[6]; // D_801C3BD8 +extern Gfx* D_801C3C50[3]; // D_801C3C50 +extern Gfx* D_801C3C80[2]; // D_801C3C80 +extern Gfx D_801C3C88[2]; // D_801C3C88 extern SceneTableEntry gSceneTable[113]; // D_801C3CA0 extern SceneEntranceTableEnty gSceneEntranceTable[110]; // D_801C5720 extern UNK_PTR D_801C5C50; // D_801C5C50 @@ -2710,9 +2710,9 @@ extern UNK_TYPE1 D_801F5A2C; // D_801F5A2C extern GlobalContext* D_801F5A90; // D_801F5A90 extern UNK_TYPE1 D_801F5A96; // D_801F5A96 extern UNK_TYPE2 D_801F5A98; // D_801F5A98 -extern u32 gSceneProcStep; // D_801F5AA0 +extern s32 gSceneProcStep; // D_801F5AA0 extern u32 gSceneProcFlags; // D_801F5AA4 -extern UNK_TYPE1 D_801F5AA8; // D_801F5AA8 +extern f32 gSceneProcFlashingAlpha; // D_801F5AA8 extern UNK_TYPE1 D_801F5AB0; // D_801F5AB0 extern UNK_TYPE1 D_801F5AB4; // D_801F5AB4 extern UNK_TYPE1 D_801F5AC0; // D_801F5AC0 diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index 9be0124452..5b8c4df582 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -374,7 +374,7 @@ SECTIONS build/asm/code_rodata_z_player_lib.o(.text) build/asm/code_rodata_0x8012A080.o(.text) build/asm/code_rodata_z_room.o(.text) - build/asm/code_rodata_z_scene_proc.o(.text) + build/src/code/z_scene_proc.o(.rodata) build/asm/code_rodata_z_scene_table.o(.text) build/asm/code_rodata_z_skin.o(.text) build/asm/code_rodata_0x80138BA0.o(.text) diff --git a/src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c b/src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c index 95cbf079b0..834ae1daf6 100644 --- a/src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c +++ b/src/actors/Bg_Ikana_Ray/z_bg_ikana_ray.c @@ -40,7 +40,7 @@ void BgIkanaRay_Init(ActorBgIkanaRay* this, GlobalContext* ctxt) { Collision_InitCylinderWithData(ctxt, collision, (Actor*)this, &bgIkanaRayCylinderInit); Collision_CylinderMoveToActor((Actor*)this, &this->collision); - this->animatedTextures = (AnimatedTexture*)Lib_PtrSegToVirt((u32)object_ikana_obj_001228); + this->animatedTextures = (AnimatedTexture*)Lib_PtrSegToVirt(object_ikana_obj_001228); if (Actor_GetSwitchFlag(ctxt, this->base.variable & 0x7F) != 0) { BgIkanaRay_SetActivated(this); diff --git a/src/code/z_lib.c b/src/code/z_lib.c index a3695dc9ea..95902f6eb4 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -649,30 +649,30 @@ f32 Lib_PushAwayVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach) void Lib_Nop801004FC(void) {} -u32 Lib_PtrSegToVirt(u32 ptr) { - return(gRspSegmentPhysAddrs[(ptr << 4) >> 28] + (ptr & 0xFFFFFF)) + 0x80000000; +u32 Lib_PtrSegToVirt(void* ptr) { + return(gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF)) + 0x80000000; } -u32 Lib_PtrSegToVirtNull(u32 ptr) { - if ((ptr >> 28) == 0) { - return ptr; +u32 Lib_PtrSegToVirtNull(void* ptr) { + if (((u32)ptr >> 28) == 0) { + return (u32)ptr; } - return(gRspSegmentPhysAddrs[(ptr << 4) >> 28] + (ptr & 0xFFFFFF)) + 0x80000000; + return(gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF)) + 0x80000000; } -u32 Lib_PtrSegToK0(u32 ptr) { - if (ptr == 0) { +u32 Lib_PtrSegToK0(void* ptr) { + if (ptr == NULL) { return 0; } else { - return ptr + 0x80000000; + return (u32)ptr + 0x80000000; } } -u32 Lib_PtrSegToK0Null(u32 ptr) { - if (ptr == 0) { +u32 Lib_PtrSegToK0Null(void* ptr) { + if (ptr == NULL) { return 0; } else { - return ptr + 0x80000000; + return (u32)ptr + 0x80000000; } } \ No newline at end of file diff --git a/src/code/z_room.c b/src/code/z_room.c index af829c1de9..6eeb2cd49f 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -28,7 +28,7 @@ void Room_DrawType0Mesh(GlobalContext* ctxt, Room* room, u32 flags) { } mesh = &room->mesh->type0; - meshParams = (RoomMeshType0Params*)Lib_PtrSegToVirt((u32)mesh->paramsStart); + meshParams = (RoomMeshType0Params*)Lib_PtrSegToVirt(mesh->paramsStart); for (i = 0; i < mesh->count; i++) { if ((flags & 1) && (meshParams->opaqueDl != NULL)) { gSPDisplayList(gCtxt->polyOpa.append++, meshParams->opaqueDl); diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c index 1cd8d75341..1d0730c61f 100644 --- a/src/code/z_scene_proc.c +++ b/src/code/z_scene_proc.c @@ -1,35 +1,250 @@ #include #include -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_801307C0.asm") +void SceneProc_DrawCurrentSceneAnimatedTextures(GlobalContext* ctxt) { + gSceneProcSceneDrawFuncs[ctxt->sceneConfig](ctxt); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_801307F4.asm") +void SceneProc_DrawSceneConfig0(GlobalContext* ctxt) { + GraphicsContext* gCtxt = ctxt->common.gCtxt; -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80130834.asm") + gSPDisplayList(gCtxt->polyOpa.append++, gSceneProcDefaultDl); + gSPDisplayList(gCtxt->polyXlu.append++, gSceneProcDefaultDl); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawType0Texture.asm") +Gfx* SceneProc_SetTile1Layer(GlobalContext* ctxt, ScrollingTextureParams* params) { + return Rcp_GenerateSetTileSizeDl((ctxt->common).gCtxt, + params->xStep * gSceneProcStep, + -(params->yStep * gSceneProcStep), + params->width, + params->height); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80130940.asm") +void SceneProc_DrawType0Texture(GlobalContext* ctxt, u32 segment, ScrollingTextureParams* params) { + Gfx* dl = SceneProc_SetTile1Layer(ctxt, params); -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawType1Texture.asm") + { + GraphicsContext* gCtxt = ctxt->common.gCtxt; + if (gSceneProcFlags & 1) { + gSPSegment(gCtxt->polyOpa.append++, segment, dl); + } -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80130A94.asm") + if (gSceneProcFlags & 2) { + gSPSegment(gCtxt->polyXlu.append++, segment, dl); + } + } +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawType2Texture.asm") +Gfx* SceneProc_SetTile2Layers(GlobalContext* ctxt, ScrollingTextureParams* params) { + return Rcp_GenerateSetTileSize2Dl((ctxt->common).gCtxt, + 0, + params[0].xStep * gSceneProcStep, + -(params[0].yStep * gSceneProcStep), + params[0].width, + params[0].height, + 1, + params[1].xStep * gSceneProcStep, + -(params[1].yStep * gSceneProcStep), + params[1].width, + params[1].height); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80130D0C.asm") +void SceneProc_DrawType1Texture(GlobalContext* ctxt, u32 segment, ScrollingTextureParams* params) { + Gfx* dl = SceneProc_SetTile2Layers(ctxt, params); + { + GraphicsContext* gCtxt = ctxt->common.gCtxt; + if (gSceneProcFlags & 1) { + gSPSegment(gCtxt->polyOpa.append++, segment, dl); + } + + if (gSceneProcFlags & 2) { + gSPSegment(gCtxt->polyXlu.append++, segment, dl); + } + } +} + +#ifdef NONMATCHING +// Slight ordering differences at the beginning +void SceneProc_DrawFlashingTexture(GlobalContext* ctxt, u32 segment, FlashingTexturePrimColor* primColor, RGBA8* envColor) { + GraphicsContext* gCtxt; + Gfx* dl; + + { + Gfx* _g = (Gfx*)ctxt->common.gCtxt->polyOpa.appendEnd - 4; + dl = _g; + ctxt->common.gCtxt->polyOpa.appendEnd = _g; + } + + gCtxt = ctxt->common.gCtxt; + if (gSceneProcFlags & 1) { + gSPSegment(gCtxt->polyOpa.append++, segment, dl); + } + + if (gSceneProcFlags & 2) { + gSPSegment(gCtxt->polyXlu.append++, segment, dl); + } + + gDPSetPrimColor(dl++, + 0, + primColor->lodFrac, + primColor->red, + primColor->green, + primColor->blue, + (u8)(primColor->alpha * gSceneProcFlashingAlpha)); + + if (envColor != NULL) { + gDPSetEnvColor(dl++, + envColor->red, + envColor->green, + envColor->blue, + envColor->alpha); + } + + gSPEndDisplayList(dl++); +} +#else +GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawFlashingTexture.asm") +#endif + +void SceneProc_DrawType2Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params) { + RGBA8* envColor; + FlashingTexturePrimColor* primColor = (FlashingTexturePrimColor *)Lib_PtrSegToVirt(params->primColors); + u32 pad; + u32 index = gSceneProcStep % params->cycleLength; + + primColor += index; + + if (params->envColors) { + envColor = (RGBA8*)Lib_PtrSegToVirt(params->envColors) + index; + } else { + envColor = NULL; + } + + SceneProc_DrawFlashingTexture(ctxt, segment, primColor, envColor); +} + +s32 SceneProc_Lerp(s32 a, s32 b, f32 t) { + return (s32)((b - a) * t) + a; +} + +#ifdef NONMATCHING +// Slight ordering and regalloc differences around t = ... +void SceneProc_DrawType3Texture(GlobalContext* ctxt, u32 segment, FlashingTextureParams* params) { + FlashingTextureParams* params2 = params; + RGBA8* envColorTo; + FlashingTexturePrimColor* primColorTo = (FlashingTexturePrimColor *)Lib_PtrSegToVirt(params2->primColors); + u16* keyFrames = (u16*)Lib_PtrSegToVirt(params2->keyFrames); + s32 index = gSceneProcStep % params2->cycleLength; + s32 pad1; + s32 keyFrameIndex; + RGBA8* envColorPtrIn; + f32 t; + s32 pad2; + FlashingTexturePrimColor primColorIn; + RGBA8* envColorFrom; + RGBA8 envColorIn; + s32 pad3; + FlashingTexturePrimColor* primColorFrom; + + keyFrameIndex = 1; + keyFrames += 1; + while (params2->numKeyFrames > keyFrameIndex) { + if (index < *keyFrames) break; + keyFrameIndex++; + keyFrames++; + } + + primColorTo += keyFrameIndex; + pad1 = keyFrames[0] - keyFrames[-1]; + pad2 = index - keyFrames[-1]; + + t = (f32)pad2 / (f32)pad1; + + primColorFrom = primColorTo - 1; + primColorIn.red = SceneProc_Lerp(primColorFrom->red, primColorTo->red, t); + primColorIn.green = SceneProc_Lerp(primColorFrom->green, primColorTo->green, t); + primColorIn.blue = SceneProc_Lerp(primColorFrom->blue, primColorTo->blue, t); + primColorIn.alpha = SceneProc_Lerp(primColorFrom->alpha, primColorTo->alpha, t); + primColorIn.lodFrac = SceneProc_Lerp(primColorFrom->lodFrac, primColorTo->lodFrac, t); + + if (params2->envColors) { + envColorTo = (RGBA8*)Lib_PtrSegToVirt(params2->envColors) + keyFrameIndex; + envColorFrom = envColorTo - 1; + envColorIn.red = SceneProc_Lerp(envColorFrom->red, envColorTo->red, t); + envColorIn.green = SceneProc_Lerp(envColorFrom->green, envColorTo->green, t); + envColorIn.blue = SceneProc_Lerp(envColorFrom->blue, envColorTo->blue, t); + envColorIn.alpha = SceneProc_Lerp(envColorFrom->alpha, envColorTo->alpha, t); + } else { + envColorTo = NULL; + } + + if (envColorTo) { + envColorPtrIn = &envColorIn; + } else { + envColorPtrIn = NULL; + } + + SceneProc_DrawFlashingTexture(ctxt, segment, &primColorIn, envColorPtrIn); +} +#else GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawType3Texture.asm") +#endif -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80130F58.asm") +GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_Interpolate.asm") -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_8013115C.asm") +u8 SceneProc_InterpolateClamped(u32 numKeyFrames, f32* keyFrames, f32* values, f32 frame) { + s32 ret = SceneProc_Interpolate(numKeyFrames, keyFrames, values, frame); + + return (ret < 0) ? 0 : + (ret > 0xFF)? 0xFF : + ret; +} GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawType4Texture.asm") -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawType5Texture.asm") +void SceneProc_DrawType5Texture(GlobalContext* ctxt, u32 segment, CyclingTextureParams* params) { + u8* offsets; + Gfx** dls; + Gfx* dl; + GraphicsContext* gCtxt; + s32 step; -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawAnimatedTextures.asm") + dls = (Gfx**)Lib_PtrSegToVirt(params->textureDls); + offsets = (u8*)Lib_PtrSegToVirt(params->textureDlOffsets); + step = gSceneProcStep % params->cycleLength; + dl = (Gfx*)Lib_PtrSegToVirt(dls[offsets[step]]); + + gCtxt = ctxt->common.gCtxt; + if (gSceneProcFlags & 1) { + gSPSegment(gCtxt->polyOpa.append++, segment, dl); + } + + if (gSceneProcFlags & 2) { + gSPSegment(gCtxt->polyXlu.append++, segment, dl); + } +} + + +void SceneProc_DrawAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures, f32 flashingAlpha, u32 step, u32 flags) { + s32 segmentAbs; + s32 segment; + + gSceneProcFlashingAlpha = flashingAlpha; + gSceneProcStep = step; + gSceneProcFlags = flags; + + if ((textures != NULL) && (textures->segment != 0)) { + do { + segment = textures->segment; + segmentAbs = ((segment < 0)? -segment : segment) + 7; + + gSceneProcDrawFuncs[textures->type](ctxt, segmentAbs, (void*)Lib_PtrSegToVirt(textures->params)); + + textures++; + } while (segment > -1); + } +} void SceneProc_DrawAllSceneAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures) { SceneProc_DrawAnimatedTextures(ctxt, textures, 1, ctxt->unk18840, 3); @@ -43,11 +258,17 @@ void SceneProc_DrawTranslucentSceneAnimatedTextures(GlobalContext* ctxt, Animate SceneProc_DrawAnimatedTextures(ctxt, textures, 1, ctxt->unk18840, 2); } -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_801317F4.asm") +void SceneProc_DrawAllSceneAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha) { + SceneProc_DrawAnimatedTextures(ctxt, textures, alpha, ctxt->unk18840, 3); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_8013182C.asm") +void SceneProc_DrawOpaqueSceneAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha) { + SceneProc_DrawAnimatedTextures(ctxt, textures, alpha, ctxt->unk18840, 1); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131864.asm") +void SceneProc_DrawTranslucentSceneAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha) { + SceneProc_DrawAnimatedTextures(ctxt, textures, alpha, ctxt->unk18840, 2); +} void SceneProc_DrawAllAnimatedTextures(GlobalContext* ctxt, AnimatedTexture* textures, u32 step) { SceneProc_DrawAnimatedTextures(ctxt, textures, 1, step, 3); @@ -61,27 +282,240 @@ void SceneProc_DrawTranslucentAnimatedTextures(GlobalContext* ctxt, AnimatedText SceneProc_DrawAnimatedTextures(ctxt, textures, 1, step, 2); } -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131920.asm") +void SceneProc_DrawAllAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step) { + SceneProc_DrawAnimatedTextures(ctxt, textures, alpha, step, 3); +} +void SceneProc_DrawOpaqueAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step) { + SceneProc_DrawAnimatedTextures(ctxt, textures, alpha, step, 1); +} +void SceneProc_DrawTranslucentAnimatedTexturesWithAlpha(GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step) { + SceneProc_DrawAnimatedTextures(ctxt, textures, alpha, step, 2); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_8013194C.asm") +void SceneProc_DrawSceneConfig1(GlobalContext* ctxt) { + SceneProc_DrawAllSceneAnimatedTextures(ctxt, ctxt->sceneTextureAnimations); +} -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131978.asm") +#ifdef NONMATCHING +// This function still needs a lot of work +void SceneProc_DrawSceneConfig3(GlobalContext* ctxt) { + GraphicsContext* gCtxt = ctxt->common.gCtxt; + u32 frames = ctxt->unk18840; -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_801319A4.asm") + if (0); -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_801319CC.asm") + gSPSegment(gCtxt->polyXlu.append++, 8, + Rcp_GenerateSetTileSizeDl(ctxt->common.gCtxt, 0, frames & 0x3f, 0x100, 0x10)); + gSPSegment(gCtxt->polyXlu.append++, 9, + Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt, + 0, 0x7F - (frames & 0x7F), frames & 0x7F, 0x20, 0x20, + 1, frames & 0x7F, frames & 0x7F, 0x20, 0x20)); + gSPSegment(gCtxt->polyOpa.append++, 10, + Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt, + 0, 0, 0, 0x20, 0x20, + 1, 0, 0x7F - (frames & 0x7F), 0x20, 0x20)); + gSPSegment(gCtxt->polyOpa.append++, 11, + Rcp_GenerateSetTileSizeDl(ctxt->common.gCtxt, 0, frames & 0x7F, 0x20, 0x20)); + gSPSegment(gCtxt->polyXlu.append++, 12, + Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt, + 0, 0, frames * 0x32 & 0x7Ff, 8, 0x200, + 1, 0, frames * 0x3c & 0x7Ff, 8, 0x200)); + gSPSegment(gCtxt->polyOpa.append++, 13, + Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt, + 0, 0, 0, 0x20, 0x40, + 1, 0, frames & 0x7F, 0x20, 0x20)); -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131CDC.asm") + gDPPipeSync(gCtxt->polyXlu.append++); + gDPSetEnvColor(gCtxt->polyXlu.append++, 0x80, 0x80, 0x80, 0x80); -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131DE4.asm") + gDPPipeSync(gCtxt->polyOpa.append++); + gDPSetEnvColor(gCtxt->polyOpa.append++, 0x80, 0x80, 0x80, 0x80); +} +#else +GLOBAL_ASM("./asm/nonmatching/z_scene_proc/SceneProc_DrawSceneConfig3.asm") +#endif -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131DF0.asm") +void SceneProc_DrawSceneConfig4(GlobalContext* ctxt) { + u32 frames; + GraphicsContext* gCtxt = ctxt->common.gCtxt; + u32 frames2; -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131E58.asm") + frames = ctxt->unk18840; + frames2 = frames * 1; -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131EC0.asm") + gSPSegment(gCtxt->polyXlu.append++, 8, + Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt, + 0, 0x7F - (frames & 0x7F), frames2 & 0x7F, 0x20, 0x20, + 1, (frames & 0x7F), frames2 & 0x7F, 0x20, 0x20)); -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131F90.asm") + gDPPipeSync(gCtxt->polyOpa.append++); + gDPSetEnvColor(gCtxt->polyOpa.append++, 0x80, 0x80, 0x80, 0x80); -GLOBAL_ASM("./asm/nonmatching/z_scene_proc/func_80131FC0.asm") + gDPPipeSync(gCtxt->polyXlu.append++); + gDPSetEnvColor(gCtxt->polyXlu.append++, 0x80, 0x80, 0x80, 0x80); +} +void SceneProc_DrawSceneConfig2(GlobalContext* ctxt){} + +void func_80131DF0(GlobalContext* ctxt, u32 param_2, u32 flags) { + Gfx* dl = D_801C3C50[param_2]; + + { + GraphicsContext* gCtxt = ctxt->common.gCtxt; + if (flags & 1) { + gSPSegment(gCtxt->polyOpa.append++, 12, dl); + } + + if (flags & 2) { + gSPSegment(gCtxt->polyXlu.append++, 12, dl); + } + } +} + +void func_80131E58(GlobalContext* ctxt, u32 param_2, u32 flags) { + Gfx* dl = D_801C3C80[param_2]; + + { + GraphicsContext* gCtxt = ctxt->common.gCtxt; + if (flags & 1) { + gSPSegment(gCtxt->polyOpa.append++, 12, dl); + } + + if (flags & 2) { + gSPSegment(gCtxt->polyXlu.append++, 12, dl); + } + } +} + +void SceneProc_DrawSceneConfig5(GlobalContext* ctxt) { + u32 dlIndex; + u32 alpha; + GraphicsContext* gCtxt; + + if (ctxt->roomContext.unk7A[0] != 0) { + dlIndex = 1; + alpha = ctxt->roomContext.unk7A[1]; + } else { + dlIndex = 0; + alpha = 0xff; + } + + if (alpha == 0) { + ctxt->roomContext.unk78 = 0; + } else { + gCtxt = ctxt->common.gCtxt; + + ctxt->roomContext.unk78 = 1; + + SceneProc_DrawAllSceneAnimatedTextures(ctxt, ctxt->sceneTextureAnimations); + + func_80131DF0(ctxt, dlIndex, 3); + + gDPSetEnvColor(gCtxt->polyOpa.append++, 0xFF, 0xFF, 0xFF, alpha); + gDPSetEnvColor(gCtxt->polyXlu.append++, 0xFF, 0xFF, 0xFF, alpha); + } +} + +void SceneProc_DrawSceneConfig7(GlobalContext* ctxt) { + SceneProc_DrawAllAnimatedTextures(ctxt, ctxt->sceneTextureAnimations, ctxt->roomContext.unk7A[0]); +} + +void SceneProc_DrawSceneConfig6(GlobalContext* ctxt) { + s32 i; + Gfx* dlHead; + u32 pad1; + u32 pad2; + GraphicsContext* gCtxt; + u32 pad3; + u32 pad4; + u32 pad5; + u32 pad6; + Gfx* dl; + + if (Actor_GetSwitchFlag(ctxt,0x33) && + Actor_GetSwitchFlag(ctxt,0x34) && + Actor_GetSwitchFlag(ctxt,0x35) && + Actor_GetSwitchFlag(ctxt,0x36)) { + func_800C3C00(&ctxt->bgCheckContext, 1); + } else { + func_800C3C14(&ctxt->bgCheckContext, 1); + } + + { + dl = (Gfx*)ctxt->common.gCtxt->polyOpa.appendEnd - 18; + //dl = _g; + ctxt->common.gCtxt->polyOpa.appendEnd = dl; + } + + SceneProc_DrawAllSceneAnimatedTextures(ctxt, ctxt->sceneTextureAnimations); + + gCtxt = ctxt->common.gCtxt; + dlHead = dl; + for (i = 0; i < 9; i++, dlHead += 2) { + u32 lodFrac = 0; + + _bcopy(D_801C3C88, dlHead, sizeof(Gfx[2])); + + switch(i) { + case 0: + if (Actor_GetSwitchFlag(ctxt,0x33) && + Actor_GetSwitchFlag(ctxt,0x34) && + Actor_GetSwitchFlag(ctxt,0x35) && + Actor_GetSwitchFlag(ctxt,0x36)) { + lodFrac = 0xFF; + } + break; + case 1: + if (Actor_GetSwitchFlag(ctxt,0x37)) { + lodFrac = 0x44; + } + break; + case 2: + if (Actor_GetSwitchFlag(ctxt,0x37) && + Actor_GetSwitchFlag(ctxt,0x38)) { + lodFrac = 0x44; + } + break; + case 3: + if (Actor_GetSwitchFlag(ctxt,0x37) && + Actor_GetSwitchFlag(ctxt,0x38) && + Actor_GetSwitchFlag(ctxt,0x39)) { + lodFrac = 0x44; + } + break; + case 4: + if (!Actor_GetSwitchFlag(ctxt,0x33)) { + lodFrac = 0x44; + } + break; + case 5: + if (Actor_GetSwitchFlag(ctxt,0x34)) { + lodFrac = 0x44; + } + break; + case 6: + if (Actor_GetSwitchFlag(ctxt,0x34) && + Actor_GetSwitchFlag(ctxt,0x35)) { + lodFrac = 0x44; + } + break; + case 7: + if (Actor_GetSwitchFlag(ctxt,0x34) && + Actor_GetSwitchFlag(ctxt,0x35) && + Actor_GetSwitchFlag(ctxt,0x36)) { + lodFrac = 0x44; + } + break; + case 8: + if (Actor_GetSwitchFlag(ctxt,0x3A)) { + lodFrac = 0x44; + } + break; + } + + gDPSetPrimColor(dlHead, 0, lodFrac, 0xFF, 0xFF, 0xFF, 0xFF); + } + + gSPSegment(gCtxt->polyOpa.append++, 6, dl); + gSPSegment(gCtxt->polyXlu.append++, 6, dl); +} diff --git a/tables/files_with_nonmatching.txt b/tables/files_with_nonmatching.txt index 7c8c671071..5bdc438d54 100644 --- a/tables/files_with_nonmatching.txt +++ b/tables/files_with_nonmatching.txt @@ -1,4 +1,3 @@ -ovl_Bg_Fu_Kaiten_0x80ACB400 boot_0x800805E0 boot_0x800968B0 z_std_dma diff --git a/tables/functions.py b/tables/functions.py index 162d2bafce..aab87d1293 100644 --- a/tables/functions.py +++ b/tables/functions.py @@ -1850,10 +1850,10 @@ 0x801001B8:("Lib_LerpRGB","void","RGB* a, RGB* b, f32 t, RGB* dst"), 0x80100448:("Lib_PushAwayVec3f","f32","Vector3f* start, Vector3f* pusher, f32 distanceToApproach"), 0x801004FC:("Lib_Nop801004FC","void","void"), - 0x80100504:("Lib_PtrSegToVirt","u32","u32 ptr"), - 0x8010053C:("Lib_PtrSegToVirtNull","u32","u32 ptr"), - 0x80100584:("Lib_PtrSegToK0","u32","u32 ptr"), - 0x801005A0:("Lib_PtrSegToK0Null","u32","u32 ptr"), + 0x80100504:("Lib_PtrSegToVirt","u32","void* ptr"), + 0x8010053C:("Lib_PtrSegToVirtNull","u32","void* ptr"), + 0x80100584:("Lib_PtrSegToK0","u32","void* ptr"), + 0x801005A0:("Lib_PtrSegToK0Null","u32","void* ptr"), 0x801005C0:("LifeMeter_Init","void","GlobalContext* ctxt"), 0x8010069C:("LifeMeter_UpdateColors","void","GlobalContext* ctxt"), 0x80100A80:("func_80100A80","UNK_TYPE4","GlobalContext* ctxt"), @@ -2429,42 +2429,42 @@ 0x801306E8:("Scene_ProcessHeader","s32","GlobalContext* ctxt, SceneHeaderEntry* header"), 0x80130768:("Scene_CreateEntrance","u32","u32 sceneIndex, u32 spawnIndex, u32 offset"), 0x80130784:("func_80130784","void","void"), - 0x801307C0:("func_801307C0","void","GlobalContext* ctxt"), - 0x801307F4:("func_801307F4","void","GlobalContext* ctxt"), - 0x80130834:("func_80130834","void","void"), - 0x801308A0:("SceneProc_DrawType0Texture","void","GlobalContext* ctxt, unsigned int param_2, UNK_TYPE4 param_3"), - 0x80130940:("func_80130940","void","void"), - 0x801309F4:("SceneProc_DrawType1Texture","void","void"), - 0x80130A94:("func_80130A94","void","GlobalContext* ctxt, unsigned int param_2, u8* param_3, u8* param_4"), - 0x80130C5C:("SceneProc_DrawType2Texture","void","void"), - 0x80130D0C:("func_80130D0C","void","void"), - 0x80130D3C:("SceneProc_DrawType3Texture","void","void"), - 0x80130F58:("func_80130F58","void","void"), - 0x8013115C:("func_8013115C","void","void"), - 0x801311B4:("SceneProc_DrawType4Texture","void","void"), - 0x80131580:("SceneProc_DrawType5Texture","void","void"), - 0x80131690:("SceneProc_DrawAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 param_3, u32 step, u32 flags"), + 0x801307C0:("SceneProc_DrawCurrentSceneAnimatedTextures","void","GlobalContext* ctxt"), + 0x801307F4:("SceneProc_DrawSceneConfig0","void","GlobalContext* ctxt"), + 0x80130834:("SceneProc_SetTile1Layer","Gfx*","GlobalContext* ctxt, ScrollingTextureParams* params"), + 0x801308A0:("SceneProc_DrawType0Texture","void","GlobalContext* ctxt, u32 segment, ScrollingTextureParams* params"), + 0x80130940:("SceneProc_SetTile2Layers","Gfx*","GlobalContext* ctxt, ScrollingTextureParams* params"), + 0x801309F4:("SceneProc_DrawType1Texture","void","GlobalContext* ctxt, u32 segment, ScrollingTextureParams* params"), + 0x80130A94:("SceneProc_DrawFlashingTexture","void","GlobalContext* ctxt, u32 segment, FlashingTexturePrimColor* primColor, RGBA8* envColor"), + 0x80130C5C:("SceneProc_DrawType2Texture","void","GlobalContext* ctxt, u32 segment, FlashingTextureParams* params"), + 0x80130D0C:("SceneProc_Lerp","s32","s32 a, s32 b, f32 t"), + 0x80130D3C:("SceneProc_DrawType3Texture","void","GlobalContext* ctxt, u32 segment, FlashingTextureParams* params"), + 0x80130F58:("SceneProc_Interpolate","f32","u32 numKeyFrames, f32* keyFrames, f32* values, f32 frame"), + 0x8013115C:("SceneProc_InterpolateClamped","u8","u32 numKeyFrames, f32* keyFrames, f32* values, f32 frame"), + 0x801311B4:("SceneProc_DrawType4Texture","void","GlobalContext* ctxt, u32 segment, FlashingTextureParams* params"), + 0x80131580:("SceneProc_DrawType5Texture","void","GlobalContext* ctxt, u32 segment, CyclingTextureParams* params"), + 0x80131690:("SceneProc_DrawAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 flashingAlpha, u32 step, u32 flags"), 0x80131758:("SceneProc_DrawAllSceneAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures"), 0x8013178C:("SceneProc_DrawOpaqueSceneAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures"), 0x801317C0:("SceneProc_DrawTranslucentSceneAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures"), - 0x801317F4:("func_801317F4","void","void"), - 0x8013182C:("func_8013182C","void","void"), - 0x80131864:("func_80131864","void","void"), + 0x801317F4:("SceneProc_DrawAllSceneAnimatedTexturesWithAlpha","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha"), + 0x8013182C:("SceneProc_DrawOpaqueSceneAnimatedTexturesWithAlpha","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha"), + 0x80131864:("SceneProc_DrawTranslucentSceneAnimatedTexturesWithAlpha","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha"), 0x8013189C:("SceneProc_DrawAllAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures, u32 step"), 0x801318C8:("SceneProc_DrawOpaqueAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures, u32 step"), 0x801318F4:("SceneProc_DrawTranslucentAnimatedTextures","void","GlobalContext* ctxt, AnimatedTexture* textures, u32 step"), - 0x80131920:("func_80131920","void","void"), - 0x8013194C:("func_8013194C","void","void"), - 0x80131978:("func_80131978","void","void"), - 0x801319A4:("func_801319A4","void","GlobalContext* ctxt"), - 0x801319CC:("func_801319CC","void","GlobalContext* ctxt"), - 0x80131CDC:("func_80131CDC","void","GlobalContext* ctxt"), - 0x80131DE4:("func_80131DE4","void","GlobalContext* ctxt"), - 0x80131DF0:("func_80131DF0","void","void"), - 0x80131E58:("func_80131E58","void","s32* param_1, s32 param_2, u32 param_3"), - 0x80131EC0:("func_80131EC0","void","GlobalContext* ctxt"), - 0x80131F90:("func_80131F90","void","GlobalContext* ctxt"), - 0x80131FC0:("func_80131FC0","void","GlobalContext* ctxt"), + 0x80131920:("SceneProc_DrawAllAnimatedTexturesWithAlpha","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step"), + 0x8013194C:("SceneProc_DrawOpaqueAnimatedTexturesWithAlpha","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step"), + 0x80131978:("SceneProc_DrawTranslucentAnimatedTexturesWithAlpha","void","GlobalContext* ctxt, AnimatedTexture* textures, f32 alpha, u32 step"), + 0x801319A4:("SceneProc_DrawSceneConfig1","void","GlobalContext* ctxt"), + 0x801319CC:("SceneProc_DrawSceneConfig3","void","GlobalContext* ctxt"), + 0x80131CDC:("SceneProc_DrawSceneConfig4","void","GlobalContext* ctxt"), + 0x80131DE4:("SceneProc_DrawSceneConfig2","void","GlobalContext* ctxt"), + 0x80131DF0:("func_80131DF0","void","GlobalContext* ctxt, u32 param_2, u32 flags"), + 0x80131E58:("func_80131E58","void","GlobalContext* ctxt, u32 param_2, u32 flags"), + 0x80131EC0:("SceneProc_DrawSceneConfig5","void","GlobalContext* ctxt"), + 0x80131F90:("SceneProc_DrawSceneConfig7","void","GlobalContext* ctxt"), + 0x80131FC0:("SceneProc_DrawSceneConfig6","void","GlobalContext* ctxt"), 0x801322C0:("SceneTable_LookupEntrance","EntranceRecord*","u32 entrance"), 0x8013230C:("SceneTable_LookupEntranceScene","s32","u32 entrance"), 0x80132338:("SceneTable_LookupEntranceAbsoluteScene","s32","u32 entrance"), diff --git a/tables/variables.py b/tables/variables.py index 3d983d73f3..b5e7751894 100644 --- a/tables/variables.py +++ b/tables/variables.py @@ -1010,12 +1010,12 @@ 0x801C26A8:("sceneHeaderFuncTable","scene_header_func","[31]"), 0x801C2730:("D_801C2730","UNK_TYPE1",""), 0x801C2740:("objectFileTable","ObjectFileTableEntry","[643]"), - 0x801C3B60:("D_801C3B60","Gfx","[11]"), - 0x801C3BB8:("D_801C3BB8","global_context_func","[8]"), - 0x801C3BD8:("gSceneProcDrawFuncs","UNK_PTR",""), - 0x801C3C50:("D_801C3C50","UNK_TYPE1",""), - 0x801C3C80:("D_801C3C80","UNK_TYPE1",""), - 0x801C3C88:("D_801C3C88","UNK_TYPE1",""), + 0x801C3B60:("gSceneProcDefaultDl","Gfx","[11]"), + 0x801C3BB8:("gSceneProcSceneDrawFuncs","global_context_func","[8]"), + 0x801C3BD8:("gSceneProcDrawFuncs","scene_proc_draw_func","[6]"), + 0x801C3C50:("D_801C3C50","Gfx*","[3]"), + 0x801C3C80:("D_801C3C80","Gfx*","[2]"), + 0x801C3C88:("D_801C3C88","Gfx","[2]"), 0x801C3CA0:("gSceneTable","SceneTableEntry","[113]"), 0x801C5720:("gSceneEntranceTable","SceneEntranceTableEnty","[110]"), 0x801C5C50:("D_801C5C50","UNK_PTR",""), @@ -2697,9 +2697,9 @@ 0x801F5A90:("D_801F5A90","GlobalContext*",""), 0x801F5A96:("D_801F5A96","UNK_TYPE1",""), 0x801F5A98:("D_801F5A98","UNK_TYPE2",""), - 0x801F5AA0:("gSceneProcStep","u32",""), + 0x801F5AA0:("gSceneProcStep","s32",""), 0x801F5AA4:("gSceneProcFlags","u32",""), - 0x801F5AA8:("D_801F5AA8","UNK_TYPE1",""), + 0x801F5AA8:("gSceneProcFlashingAlpha","f32",""), 0x801F5AB0:("D_801F5AB0","UNK_TYPE1",""), 0x801F5AB4:("D_801F5AB4","UNK_TYPE1",""), 0x801F5AC0:("D_801F5AC0","UNK_TYPE1",""), diff --git a/undef.txt b/undef.txt index 2e02f0c066..f6f9d79972 100644 --- a/undef.txt +++ b/undef.txt @@ -335,7 +335,7 @@ D_801F5A96 = code_bss_start + 0x00011AF6; D_801F5A98 = code_bss_start + 0x00011AF8; gSceneProcStep = code_bss_start + 0x00011B00; gSceneProcFlags = code_bss_start + 0x00011B04; -D_801F5AA8 = code_bss_start + 0x00011B08; +gSceneProcFlashingAlpha = code_bss_start + 0x00011B08; D_801F5AB0 = code_bss_start + 0x00011B10; D_801F5AB4 = code_bss_start + 0x00011B14; D_801F5AC0 = code_bss_start + 0x00011B20;