From dcbb258e457eebbf5f8e3c9a1a48d88e52ff577f Mon Sep 17 00:00:00 2001 From: dark-samus Date: Tue, 12 Jan 2021 14:45:50 -0500 Subject: [PATCH] misc work --- asm/data/code_102c80.rodata.s | 123 ++++++++++ asm/data/code_104940_len_dc0.rodata.s | 30 +++ include/common_structs.h | 53 ++++- include/map.h | 4 +- src/code_102610_len_2330.c | 4 +- src/code_102c80.c | 36 +-- src/code_104940_len_dc0.c | 128 +++++++++- src/code_1b40_len_20b0.c | 22 +- src/code_331940.c | 151 ++++++++++++ src/os/code_4ac90_len_3910.c | 3 + src/world/world.c | 321 ++++++++++++++++++++------ tools/splat.yaml | 16 +- undefined_syms.txt | 1 - 13 files changed, 769 insertions(+), 123 deletions(-) create mode 100644 asm/data/code_102c80.rodata.s create mode 100644 asm/data/code_104940_len_dc0.rodata.s diff --git a/asm/data/code_102c80.rodata.s b/asm/data/code_102c80.rodata.s new file mode 100644 index 0000000000..2955e73d10 --- /dev/null +++ b/asm/data/code_102c80.rodata.s @@ -0,0 +1,123 @@ +.include "macro.inc" + +.section .rodata + +glabel D_802EB000 +.word 0x3FFDCCCC, 0xCCCCCCCD + +glabel D_802EB008 +.word 0x3FFDCCCC, 0xCCCCCCCD + +glabel D_802EB010 +.word 0x802E17EC, 0x802E1894, 0x802E1938, 0x802E19E0, 0x802E1A84, 0x802E1B18 + +glabel D_802EB028 +.word 0x3FD33333, 0x33333333 + +glabel D_802EB030 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB038 +.word 0xBFC99999, 0x9999999A + +glabel D_802EB040 +.word 0xBF847AE1, 0x47AE147B + +glabel D_802EB048 +.word 0x3FC33333, 0x33333333 + +glabel D_802EB050 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB058 +.word 0xBFB99999, 0x9999999A + +glabel D_802EB060 +.word 0xBF847AE1, 0x47AE147B + +glabel D_802EB068 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB070 +.word 0x802E1B48, 0x802E1BF0, 0x802E1C94, 0x802E1D38, 0x802E1DDC, 0x802E1E6C + +glabel D_802EB088 +.word 0xBF847AE1, 0x47AE147B + +glabel D_802EB090 +.word 0x3FB99999, 0x9999999A + +glabel D_802EB098 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB0A0 +.ascii "甚333333" + +glabel D_802EB0A8 +.word 0xBF847AE1, 0x47AE147B + +glabel D_802EB0B0 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB0B8 +.word 0xBF847AE1, 0x47AE147B + +glabel D_802EB0C0 +.word 0x802E1F20, 0x802E1FBC, 0x802E1FD0, 0x802E206C, 0x802E211C, 0x00000000 + +glabel D_802EB0D8 +.word 0x3FD33333, 0x33333333 + +glabel D_802EB0E0 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB0E8 +.word 0xBFC99999, 0x9999999A + +glabel D_802EB0F0 +.word 0x3FC33333, 0x33333333 + +glabel D_802EB0F8 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB100 +.word 0xBFB99999, 0x9999999A + +glabel D_802EB108 +.word 0xBF847AE1, 0x47AE147B + +glabel D_802EB110 +.word 0x3FB99999, 0x9999999A + +glabel D_802EB118 +.word 0x3F847AE1, 0x47AE147B + +glabel D_802EB120 +.ascii "甚333333" + +glabel D_802EB128 +.word 0xBF847AE1, 0x47AE147B + +glabel D_802EB130 +.word 0x40059999, 0x9999999A + +glabel D_802EB138 +.word 0x40768000, 0x00000000 + +glabel D_802EB140 +.word 0x3FD33333, 0x33333333 + +glabel D_802EB148 +.word 0x3FF33333, 0x33333333 + +glabel D_802EB150 +.word 0xC0286666, 0x66666666 + +glabel D_802EB158 +.word 0x401921FA, 0x00000000 + +glabel D_802EB160 +.word 0x802E2F78, 0x802E2FA4, 0x802E2FA4, 0x802E2FA4, 0x802E2FA4, 0x802E2FA4, 0x802E2FA4, 0x802E2FA4, 0x802E2F30, 0x802E2F48, 0x802E2F60, 0x802E2F30, 0x802E2F48, 0x802E2F60 + +glabel D_802EB198 +.word 0x802E305C, 0x802E3064, 0x802E3064, 0x802E3064, 0x802E3064, 0x802E3064, 0x802E3064, 0x802E3064, 0x802E3014, 0x802E302C, 0x802E3044, 0x802E3020, 0x802E3038, 0x802E3050 \ No newline at end of file diff --git a/asm/data/code_104940_len_dc0.rodata.s b/asm/data/code_104940_len_dc0.rodata.s new file mode 100644 index 0000000000..89c93a044e --- /dev/null +++ b/asm/data/code_104940_len_dc0.rodata.s @@ -0,0 +1,30 @@ +.include "macro.inc" + +.section .rodata + +glabel D_802EB1D0 +.word 0x3FB70A3D, 0x70A3D70A + +glabel D_802EB1D8 +.word 0x3FA70A3D, 0x70A3D70A + +glabel D_802EB1E0 +.word 0x3FC70A3D, 0x70A3D70A + +glabel D_802EB1E8 +.word 0x3FB70A3D, 0x70A3D70A + +glabel D_802EB1F0 +.word 0x3FF33333, 0x33333333 + +glabel D_802EB1F8 +.word 0x3FD33333, 0x33333333 + +glabel D_802EB200 +.word 0x3FF33333, 0x33333333 + +glabel D_802EB208 +.word 0x3FD33333, 0x33333333 + +glabel D_802EB210 +.word 0x802E3DCC, 0x802E3DDC, 0x802E3C34, 0x802E3C34, 0x802E3C34, 0x802E3C34, 0x802E3C34, 0x802E3C34, 0x802E3DE4, 0x802E3C34, 0x802E3CD8, 0x802E3D2C, 0x802E3D84, 0x802E3CD8, 0x802E3D2C, 0x802E3D84, 0x802E3DCC, 0x802E3DCC, 0x802E3DCC, 0x802E3DCC, 0x802E3DCC, 0x00000000, 0x00000000, 0x00000000 \ No newline at end of file diff --git a/include/common_structs.h b/include/common_structs.h index 3225da015d..4cf2827eb1 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -776,17 +776,41 @@ typedef struct StaticItem { /* 0x1D */ char unk_1D[3]; } StaticItem; // size = 0x20 +typedef struct EffectInstance { + /* 0x00 */ s32 flags; + /* 0x04 */ s32 effectIndex; + /* 0x08 */ char unk_08[4]; + /* 0x0C */ void* unk_0C; + /* 0x10 */ struct Effect* effect; +} EffectInstance; + +typedef struct EffectBlueprint { + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 effectIndex; + /* 0x08 */ void (*init)(EffectInstance* effectInst); + /* 0x0C */ void (*update)(EffectInstance* effectInst); + /* 0x10 */ void (*renderWorld)(EffectInstance* effectInst); + /* 0x14 */ void (*unk_14)(EffectInstance* effectInst); +} EffectBlueprint; // size = 0x18 + typedef struct Effect { - /* 0x00 */ char unk_00[32]; + /* 0x00 */ s32 flags; + /* 0x04 */ s32 effectIndex; + /* 0x08 */ s32 instanceCounter; + /* 0x0C */ s32 unk_0C; + /* 0x10 */ void (*update)(EffectInstance* effectInst); + /* 0x14 */ void (*renderWorld)(EffectInstance* effectInst); + /* 0x18 */ void (*unk_18)(EffectInstance* effectInst); + /* 0x1C */ void* unk_1C; } Effect; // size = 0x20 typedef struct EffectTableEntry { - /* 0x00 */ s32 dmaStart; - /* 0x04 */ s32 dmaEnd; - /* 0x08 */ s32 dmaDest; - /* 0x0C */ s32 unkStartRom; - /* 0x10 */ s32 unkEndRom; - /* 0x14 */ UNK_FUN_PTR(delegate); + /* 0x00 */ UNK_FUN_PTR(entryPoint); + /* 0x04 */ void* dmaStart; + /* 0x08 */ void* dmaEnd; + /* 0x0C */ void* dmaDest; + /* 0x10 */ void* unkStartRom; + /* 0x14 */ void* unkEndRom; } EffectTableEntry; // size = 0x18 @@ -1606,6 +1630,21 @@ typedef struct { // BEGIN ENTITY-SPECIFIC STRUCTS +// from code_102c80, size unknown. +typedef struct struct802E1400 { + /* 0x000 */ Vec3f unk_00; + /* 0x00C */ char unk_0C[4]; + /* 0x010 */ s8 unk_10; + /* 0x011 */ s8 unk_11; + /* 0x014 */ Vec3f unk_14; + /* 0x020 */ u16 unk_20; + /* 0x022 */ s16 unk_22; + /* 0x024 */ char unk_24[4]; + /* 0x028 */ Entity* attachedEntity; + /* 0x02C */ char unk_2C[12]; + /* 0x038 */ f32 unk_38; +} struct802E1400; + // from code_104940_len_dc0, size unknown // appears to belong to the hammer blocks(?) typedef struct struct802E3650 { diff --git a/include/map.h b/include/map.h index 03e9cb971e..aee0afb754 100644 --- a/include/map.h +++ b/include/map.h @@ -31,7 +31,7 @@ typedef struct MapConfig { } tattle; } MapConfig; // size = 0x40 -typedef s32 MapInit(void); +typedef s32 (*MapInit)(void); #define MAP_ID_MAX_LEN 7 ///< "xxx_yyy" excluding null terminator. typedef struct Map { @@ -41,7 +41,7 @@ typedef struct Map { /* 0x0C */ void* dmaEnd; /* 0x10 */ void* dmaDest; /* 0x14 */ char* bgName; - /* 0x18 */ MapInit* init; ///< Return TRUE to skip normal asset (shape/hit/bg/tex) loading. + /* 0x18 */ MapInit init; ///< Return TRUE to skip normal asset (shape/hit/bg/tex) loading. /* 0x1C */ s16 unk_1C; // Unused? /* 0x1E */ s8 songVariation; ///< 0 or 1. @see get_song_variation_override_for_cur_map /* 0x1F */ s8 flags; diff --git a/src/code_102610_len_2330.c b/src/code_102610_len_2330.c index 0bd5f5fbe2..169452c7f4 100644 --- a/src/code_102610_len_2330.c +++ b/src/code_102610_len_2330.c @@ -108,9 +108,9 @@ void func_802E1350(Entity* entity) { } void func_802E13B8(Entity* entity) { - Trigger* trigger = (Trigger*)entity->dataBuf; // TODO: Fix this + struct802E3650* temp = entity->dataBuf; entity_init_Hammer23Block_normal(entity); entity->unk_3C = func_802E0DE0; - trigger->params1.s = 8; + temp->unk_04 = 8; } diff --git a/src/code_102c80.c b/src/code_102c80.c index 038b731aba..cdee6622f6 100644 --- a/src/code_102c80.c +++ b/src/code_102c80.c @@ -1,24 +1,10 @@ #include "common.h" -typedef struct struct802E1400 { - /* 0x000 */ Vec3f unk_00; - /* 0x00C */ char unk_0C[4]; - /* 0x010 */ s8 unk_10; - /* 0x011 */ s8 unk_11; - /* 0x014 */ Vec3f unk_14; - /* 0x020 */ u16 unk_20; - /* 0x022 */ s16 unk_22; - /* 0x024 */ char unk_24[4]; - /* 0x028 */ Entity* attachedEntity; - /* 0x02C */ char unk_2C[12]; - /* 0x038 */ f32 unk_38; -} struct802E1400; - void func_802E246C(Entity* entity, void* arg1, void* arg2); void func_802E1400(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; if (entity->unk_06 & 1) { if ((playerStatus->actionState == ActionState_GROUND_POUND) || (playerStatus->actionState == ActionState_ULTRA_POUND)) { @@ -29,11 +15,11 @@ void func_802E1400(Entity* entity) { } void func_802E1460(Entity* entity) { - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; u16 temp2 = temp->unk_22--; if (temp2) { - entity->position.y -= D_802EB000; + entity->position.y -= D_802EB000; // 1.8625; return; } func_80110678(entity); @@ -42,11 +28,11 @@ void func_802E1460(Entity* entity) { } void func_802E14D8(Entity* entity) { - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; u16 temp2 = temp->unk_22--; if (temp2) { - entity->position.y += D_802EB008; + entity->position.y += D_802EB008; // 1.8625; return; } func_8010FD68(entity); @@ -67,7 +53,7 @@ void func_802E1614(Entity* entity) { } void func_802E1660(Entity* entity) { - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; PlayerStatus* playerStatus = &gPlayerStatus; s8* temp2 = D_8010EBB0; @@ -121,7 +107,7 @@ void func_802E1740(Entity* entity) { } void func_802E176C(Entity* entity) { - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; temp->unk_00.x = 1.0f; temp->unk_00.y = 0.1f; @@ -133,7 +119,7 @@ void func_802E176C(Entity* entity) { INCLUDE_ASM(s32, "code_102c80", func_802E17A8); void func_802E1EA8(Entity* entity) { - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; set_area_flag(temp->unk_20); func_80110678(entity); } @@ -142,7 +128,7 @@ INCLUDE_ASM(s32, "code_102c80", func_802E1EDC); void func_802E234C(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; playerStatus->animFlags |= 0x1000000; temp->unk_14.x = 1.0f; @@ -152,7 +138,7 @@ void func_802E234C(Entity* entity) { void entity_init_BlueSwitch(Entity* entity) { Entity* temp_v0_2; - struct802E1400* temp = (struct802E1400*)entity->dataBuf; + struct802E1400* temp = entity->dataBuf; func_802E234C(entity); if (D_8015C7D0 == 2) { @@ -175,7 +161,7 @@ void entity_init_HugeBlueSwitch(Entity* entity) { struct802E1400* temp; func_802E234C(entity); - temp = (struct802E1400*)entity->dataBuf; + temp = entity->dataBuf; entity->scale.x = 3.0f; entity->scale.y = 3.0f; entity->scale.z = 3.0f; diff --git a/src/code_104940_len_dc0.c b/src/code_104940_len_dc0.c index c65476e32d..6b9e36fbeb 100644 --- a/src/code_104940_len_dc0.c +++ b/src/code_104940_len_dc0.c @@ -10,6 +10,7 @@ extern f64 D_802EB1F8; // 0.3 extern f64 D_802EB200; // 1.2 extern f64 D_802EB208; // 0.3 +//display list func INCLUDE_ASM(s32, "code_104940_len_dc0", func_802E30C0); void func_802E31B0(Entity* entity) { @@ -33,7 +34,7 @@ f32 func_802E31EC(Entity* entity) { void func_802E328C(Entity* entity) { - if ((get_entity_type(entity->listIndex) - 24) < 3U) { + if ((get_entity_type(entity->listIndex) - 24) < 3) { entity->scale.x -= D_802EB1D0; entity->scale.z -= D_802EB1D0; entity->scale.y += D_802EB1D8; @@ -185,7 +186,7 @@ void func_802E3A48(Entity* entity) { void func_802E3B08(Entity* entity) { s32 temp_v0; u16 temp_v1; - struct802E3650* temp = (struct802E3650*)entity->dataBuf; + struct802E3650* temp = entity->dataBuf; if (temp->unk_0A != 0xFFFF) { if (get_global_flag(temp->unk_0A) != 0) { @@ -195,7 +196,126 @@ void func_802E3B08(Entity* entity) { } } -INCLUDE_ASM(s32, "code_104940_len_dc0", func_802E3BA4); +extern s32 D_802E9E80; + +#ifdef NON_MATCHING +s32 func_802E3BA4(Entity* entity) { + u8 bVar1; + s32 bVar2; + s32 iVar3; + s32 uVar4; + PlayerStatus* playerStatus = &gPlayerStatus; + + if ((entity->alpha == 0) && ((entity->unk_06 & 1) != 0)) { + return 0; + } + + bVar1 = entity->unk_06; + if ((bVar1 & 4) != 0) { + s32 type = get_entity_type(entity->listIndex); + if((type == 0xC)) { + return 0; + } + + if((type >= 0xC)) { + if((type < 0x1b)) { + if((type > 0x14)) { + return 0; + } + } + } + + if ((playerStatus->flags & 2) == 0) { + return 1; + } + func_8010FD68(entity); + return 1; + } + if ((bVar1 & 0x80) != 0) { + func_8010FD68(entity); + return 1; + } + + bVar2 = FALSE; + if ((bVar1 & 1)) { + if ((playerStatus->actionState == 0xd) || (playerStatus->actionState == 0x0f)) { + return 0; + } + + if ((playerStatus->actionState == 0x0e) || (playerStatus->actionState == 0x10)) { + bVar2 = TRUE; + } else { + return 1; + } + } else { + if ((bVar1 & 0x40) == 0) { + return 1; + } + if ((playerStatus->flags & 0x1000000) == 0) { + return 1; + } + } + + switch(get_entity_type(entity->listIndex)) { + default: + break; + case 0x15: + case 0x18: + if (bVar2) { + if (gPlayerData.bootsLevel < 1) { + bVar2 = FALSE; + } + } else { + if (gPlayerData.hammerLevel > -1) { + bVar2 = TRUE; + } + } + if (!bVar2) { + return 1; + } + func_8010FBC0(entity,&D_802E9E80); + play_sound_at_position(0x14f, 0, entity->position.x, entity->position.y ,entity->position.z); + break; + case 0x16: + case 0x19: + if (bVar2) { + if (gPlayerData.bootsLevel < 2) { + bVar2 = FALSE; + } + } else if (gPlayerData.hammerLevel > 0) { + bVar2 = TRUE; + } + if (!bVar2) { + return 1; + } + func_8010FBC0(entity,&D_802E9E80); + play_sound_at_position(0x150, 0, entity->position.x, entity->position.y ,entity->position.z); + break; + case 0x17: + case 0x1a: + if (gPlayerData.hammerLevel < '\x02') { + return 1; + } + func_8010FBC0(entity,&D_802E9E80); + play_sound_at_position(0x151, 0, entity->position.x, entity->position.y ,entity->position.z); + break; + case 0x1b: + case 0x1c: + case 0x1d: + case 0x1e: + case 0x1f: + func_80110678(entity); + func_8010FD68(entity); + return 1; + case 0xb: + func_80110678(entity); + break; + } + return 1; +} +#else +INCLUDE_ASM(s32, "code_104940_len_dc0", func_802E3BA4, Entity* entity); +#endif void entity_init_Hammer1Block_normal(Entity* entity) { entity_init_Hammer23Block_normal(entity); @@ -204,7 +324,7 @@ void entity_init_Hammer1Block_normal(Entity* entity) { s32 entity_init_HammerBlock_small(Entity* entity) { s32 temp_v0; - struct802E3650* temp = (struct802E3650*)entity->dataBuf; + struct802E3650* temp = entity->dataBuf; temp->unk_10 = -1; temp->unk_14 = entity->position.y; diff --git a/src/code_1b40_len_20b0.c b/src/code_1b40_len_20b0.c index b9cd27006d..11c09112ca 100644 --- a/src/code_1b40_len_20b0.c +++ b/src/code_1b40_len_20b0.c @@ -2,7 +2,7 @@ extern Gfx D_00074210[]; extern Gfx D_00074230[]; -extern Gfx* D_8009A66C[1]; +extern Gfx* D_8009A66C[2]; extern int D_000759B0[]; extern int D_000759B0_end[]; // A55D0 @@ -115,16 +115,18 @@ s32 func_80027190(void) { return D_8009A5D8; } -INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800271A0); -/*void func_800271A0(void) { - Gfx *temp = D_8009A66C[0] + 1; +//INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800271A0); +void func_800271A0(void) { + Gfx *temp = D_8009A66C[0]; + + do{ + Gfx *_g = (Gfx *)((D_8009A66C[0]++)); + _g->words.w0 = (((unsigned int) (((unsigned int)((0xdb)) & ((0x01 << (8)) - 1)) << (24))) | ((unsigned int) (((unsigned int)((0x06)) & ((0x01 << (8)) - 1)) << (16))) | ((unsigned int) (((unsigned int)(((0x00)*4)) & ((0x01 << (16)) - 1)) << (0)))); _g->words.w1 = (unsigned int)(0x00000000); + }while(0); + do{ Gfx *_g = (Gfx *)(D_8009A66C[0]++); _g->words.w0 = (((unsigned int) (((unsigned int)((0xde)) & ((0x01 << (8)) - 1)) << (24))) | ((unsigned int) (((unsigned int)((0x00)) & ((0x01 << (8)) - 1)) << (16))) | ((unsigned int) (((unsigned int)((0)) & ((0x01 << (16)) - 1)) << (0)))); _g->words.w1 = (unsigned int)(&D_00074230); + Gfx *_g = (Gfx *)(D_8009A66C[0]++); _g->words.w0 = (((unsigned int) (((unsigned int)((0xde)) & ((0x01 << (8)) - 1)) << (24))) | ((unsigned int) (((unsigned int)((0x00)) & ((0x01 << (8)) - 1)) << (16))) | ((unsigned int) (((unsigned int)((0)) & ((0x01 << (16)) - 1)) << (0)))); _g->words.w1 = (unsigned int)(&D_00074210); }while(0); +} - gSPSegment(D_8009A66C[0], 0x00, 0x00000000); - D_8009A66C[0] = temp; - gSPDisplayList(temp, &D_00074230); - D_8009A66C[0]++; - gSPDisplayList(D_8009A66C[0]++, &D_00074210); -}*/ INCLUDE_ASM(s32, "code_1b40_len_20b0", func_800271FC); diff --git a/src/code_331940.c b/src/code_331940.c index adc657aa05..151c6139ec 100644 --- a/src/code_331940.c +++ b/src/code_331940.c @@ -1,6 +1,157 @@ #include "common.h" +typedef struct structE001E000 { + /* 0x000 */ s32 unk_00; + /* 0x004 */ Vec3f unk_04; + /* 0x010 */ Vec3f unk_10; + /* 0x01C */ s32 unk_1C; + /* 0x020 */ char unk_20[4]; + /* 0x024 */ f32 unk_24; + /* 0x028 */ s32 unk_28; + /* 0x02C */ f32 unk_2C; + /* 0x030 */ f32 unk_30; + /* 0x034 */ f32 unk_34; + /* 0x038 */ char unk_38[4]; + /* 0x03C */ s32 unk_3C; + /* 0x040 */ char unk_40[0x200]; + /* 0x240 */ f32 unk_240; + /* 0x244 */ s32 unk_244; + /* 0x248 */ s32 unk_248; + /* 0x24C */ s32 unk_24C; +} structE001E000; // size = 0x250 + +extern Camera D_800B1DEC[2]; + INCLUDE_ASM(s32, "code_331940", func_E001E000); +/* +void *func_E001E000(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { + f32 temp_f0; + f32 temp_f0_2; + f32 temp_f12; + f32 temp_f20; + f32 temp_f20_2; + f32 temp_f20_3; + f32 temp_f20_4; + f32 temp_f22; + f32 temp_f22_2; + f32 temp_f24; + f32 temp_f26; + f32 temp_f2; + f32 temp_f4; + s32 temp_a0; + s32 temp_a1; + s32 temp_s0; + s32 temp_v0_2; + s32 temp_v0_3; + void *temp_s0_2; + void *temp_s1; + void *temp_s2; + void *temp_v0; + void *temp_v0_4; + f32 phi_f4; + f32 phi_f0; + f32 phi_f12; + f32 phi_f26; + void *phi_v0; + void *phi_v1; + s32 phi_a1; + f32 phi_f12_2; + void *phi_a0; + + temp_s2 = func_E0200490(&subroutine_arg4, 0, 0xF, &D_E001E370, &D_E001E378, &D_E001E6E8, 0); + temp_s2->unk8 = 1; + temp_v0 = func_E02004B0(0x250); // some kind of allocation function. + temp_s1 = temp_v0; + temp_s2->unkC = temp_v0; + ASSERT(temp_s1 != NULL); + temp_s1->unk_00 = 1; + temp_s1->unk_04.x = arg1; + temp_s1->unk_04.y = arg2; + temp_s1->unk_04.z = arg3; + temp_s1->unk_1C = 0; + temp_s1->unk_24 = 0.0f; + temp_s1->unk_28 = 0; + temp_s1->unk_38 = arg0; + if (arg0 == 3) { + temp_s1->unk_240 = 0.2f; + temp_v0_2 = func_E02004E0(0xFF); + temp_a0 = 0xFF - temp_v0_2; + temp_s1->unk_244 = temp_v0_2; + temp_v0_3 = func_E02004E0(temp_a0); + temp_s0 = 0xFF - temp_v0_3; + temp_s1->unk_248 = temp_v0_3; + temp_s1->unk_24C = (s32) (temp_s0 - temp_s1->unk_244); + } else { + temp_s1->unk_244 = 0xD2; + temp_s1->unk_248 = 0xBA; + temp_s1->unk_24C = 0x5A; + temp_s1->unk_240 = 0.5f; + } + temp_f24 = arg4 - arg1; + temp_f22 = arg5 - arg2; + temp_f20 = arg6 - arg3; + temp_f26 = (temp_f24 * temp_f24) + (temp_f22 * temp_f22) + (temp_f20 * temp_f20); + phi_f4 = temp_f26; + phi_f26 = temp_f26; + if (temp_f26 != 0.0f) { + temp_f0 = func_E0200550(temp_f26); + phi_f4 = arg7 / temp_f0; + phi_f26 = temp_f0; + } + temp_s1->unk10.x = (f32) (temp_f24 * phi_f4); + temp_s1->unk10.y = (f32) (temp_f22 * phi_f4); + temp_s1->unk10.z = (f32) (temp_f20 * phi_f4); + temp_f20_2 = *(&D_800B1DEC + (gCurrentCameraID * 0x558)); + temp_f22_2 = -func_E0200510(temp_f20_2); + temp_f4 = temp_f22_2 * temp_s1->unk10; + temp_f20_3 = -func_E0200500(temp_f20_2); + temp_f2 = temp_f20_3 * temp_s1->unk18; + temp_f12 = (temp_f4 * temp_f4) + (temp_f2 * temp_f2); + phi_f12_2 = temp_f12; + if (temp_f12 != 0.0f) { + phi_f12_2 = func_E0200550(temp_f12); + } + if (((temp_f22_2 * temp_s1->unk10) + (temp_f20_3 * temp_s1->unk18)) < 0.0f) { + phi_f0 = -20.0f; + phi_f12 = -phi_f12_2; + } else { + phi_f0 = 20.0f; + phi_f12 = phi_f12_2; + } + temp_s1->unk2C = phi_f0; + temp_f20_4 = -phi_f12; + temp_f0_2 = func_E0200520(0, 0, -temp_s1->unk14, temp_f20_4); + temp_s1->unk_30 = (bitwise f32) (s32) (phi_f26 / arg7); + temp_s0_2 = temp_s1 + 0x40; + temp_s1->unk24 = temp_f0_2; + temp_s1->unk20 = temp_f0_2; + temp_s1->unk34 = temp_f20_4; + func_E0200430(temp_s0_2, (bitwise s32) temp_s1->unk4, (bitwise s32) temp_s1->unk8, (bitwise s32) temp_s1->unkC); + phi_a1 = 1; + phi_a0 = temp_s0_2; +loop_13: + phi_v0 = temp_s0_2; + phi_v1 = phi_a0 + 0x40; +loop_14: + phi_v1->unk0 = (s32) phi_v0->unk0; + phi_v1->unk4 = (s32) phi_v0->unk4; + phi_v1->unk8 = (s32) phi_v0->unk8; + phi_v1->unkC = (s32) phi_v0->unkC; + temp_v0_4 = phi_v0 + 0x10; + phi_v0 = temp_v0_4; + phi_v1 = phi_v1 + 0x10; + if (temp_v0_4 != (temp_s1 + 0x80)) { + goto loop_14; + } + temp_a1 = phi_a1 + 1; + phi_a1 = temp_a1; + phi_a0 = phi_a0 + 0x40; + if (temp_a1 < 8) { + goto loop_13; + } + temp_s1->unk3C = -1; + return temp_s2; +}*/ INCLUDE_ASM(s32, "code_331940", func_E001E370); diff --git a/src/os/code_4ac90_len_3910.c b/src/os/code_4ac90_len_3910.c index 363075c02d..8a13ee472d 100644 --- a/src/os/code_4ac90_len_3910.c +++ b/src/os/code_4ac90_len_3910.c @@ -1,5 +1,7 @@ #include "common.h" +extern EffectTableEntry D_8007F210[135]; + INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_8006F890); INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_8006F8F0); @@ -273,6 +275,7 @@ INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_80072A70); INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_80072AD0); +// FILE SPLIT INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_80072B30); INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_80072BB0); diff --git a/src/world/world.c b/src/world/world.c index 8b6632c172..6be9afbcf2 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -20,7 +20,7 @@ INCLUDE_ASM(s32, "world/world", func_80059AB8); INCLUDE_ASM(s32, "world/world", func_80059BD4); -void func_80059C80(void) { +void func_80059C80(EffectInstance* effectInst) { } INCLUDE_ASM(s32, "world/world", func_80059C88); @@ -32,18 +32,207 @@ void func_80059D48(void) { INCLUDE_ASM(s32, "world/world", func_80059D50); -INCLUDE_ASM(s32, "world/world", render_effects); +#define EFFECT_LOADED 1 + +extern EffectInstance* D_800B4398[96]; //effectInstanceList +extern Effect D_800A4000[15]; +extern void* D_80059C80; + +s32 render_effects(void) { + EffectInstance** curEffectInst; + s32 i; + + curEffectInst = &D_800B4398[0]; + for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) { + if ((curEffectInst[i] != NULL) && ((curEffectInst[i]->flags & 1) != 0) && ((curEffectInst[i]->flags & 8) != 0)) { + if(GAME_STATUS->isBattle) { + if((curEffectInst[i]->flags & 4) != 0) { + curEffectInst[i]->effect->renderWorld(curEffectInst[i]); + } + } else if((curEffectInst[i]->flags & 4) == 0) { + curEffectInst[i]->effect->renderWorld(curEffectInst[i]); + } + } + } +} INCLUDE_ASM(s32, "world/world", func_80059F94); -INCLUDE_ASM(s32, "world/world", func_8005A2BC); -INCLUDE_ASM(s32, "world/world", remove_effect); +EffectInstance* func_8005A2BC(EffectBlueprint* effectBp) { + EffectInstance *newEffectInst; + Effect* curEffect; + s32 i; + EffectInstance** temp = &D_800B4398[0]; -INCLUDE_ASM(s32, "world/world", remove_all_effects); + // Search for an unused instance + for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) { + if (temp[i] == NULL) { + break; + } + } + ASSERT(i < ARRAY_COUNT(D_800B4398)); + + // Allocate space for the new instance + D_800B4398[i] = newEffectInst = general_heap_malloc(sizeof(EffectInstance)); + ASSERT(newEffectInst != NULL); + + curEffect = &D_800A4000[0]; + newEffectInst->effectIndex = effectBp->effectIndex; + newEffectInst->flags = 1; + + // Look for a loaded effect of the proper index + for(i = 0; i < ARRAY_COUNT(D_800A4000); i++) { + if ((curEffect->flags & EFFECT_LOADED) && (curEffect->effectIndex == effectBp->effectIndex)) { + break; + } + curEffect++; + } + + ASSERT(i < ARRAY_COUNT(D_800A4000)); + + // If this is the first new instance of the effect, initialize the function pointers + if (curEffect->instanceCounter == 0) { + curEffect->update = effectBp->update; + if (curEffect->update == NULL) { + curEffect->renderWorld = func_80059C80; + } + + curEffect->renderWorld = effectBp->renderWorld; + if (curEffect->unk_18 == NULL) { + curEffect->unk_18 = func_80059C80; + } + + curEffect->unk_18 = effectBp->unk_14; + if (curEffect->unk_18 == NULL) { + curEffect->unk_18 = func_80059C80; + } + } + + curEffect->instanceCounter++; + newEffectInst->effect = curEffect; + + if (effectBp->init != NULL) { + effectBp->init(newEffectInst); + } + + if (GAME_STATUS->isBattle) { + newEffectInst->flags |= 4; + } + return newEffectInst; +} + +void remove_effect(EffectInstance* arg0) { + s32 i; + EffectInstance** temp = &D_800B4398[0]; + + for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) { + if (temp[i] == arg0) { + break; + } + } + + ASSERT(i < ARRAY_COUNT(D_800B4398)); + + if (arg0->unk_0C == NULL) { + general_heap_free(arg0); + D_800B4398[i] = NULL; + return; + } + + general_heap_free(arg0->unk_0C); + general_heap_free(arg0); + D_800B4398[i] = NULL; +} + +void remove_all_effects(void) { + s32 i; + EffectInstance** temp = &D_800B4398[0]; + + for(i = 0; i < ARRAY_COUNT(D_800B4398); i++) { + EffectInstance* temp2 = temp[i]; + if (temp2 != NULL && temp2->flags & 4) { + if(temp2->unk_0C != NULL) { + general_heap_free(temp2->unk_0C); + } + general_heap_free(temp2); + temp[i] = NULL; + } + } +} + +typedef s32 TlbEntry[0x1000 / 4]; +typedef TlbEntry TlbMappablePage[15]; + +extern TlbMappablePage D_80197000; +extern EffectTableEntry D_8007F210[135]; + +#ifdef NON_MATCHING +// Matching, but needs a file split +s32 play_effect(s32 effectIndex) { + + EffectTableEntry* effectTable = &D_8007F210[0]; + EffectTableEntry* effectEntry; + Effect* curEffect; + TlbMappablePage* tlbMappablePages; + s32 i; + + effectEntry = &effectTable[effectIndex]; + + // Look for a loaded effect matching the desired index + for(i = 0, curEffect = &D_800A4000[0]; i < ARRAY_COUNT(D_800A4000); i++) { + if ((curEffect->flags & EFFECT_LOADED) && (curEffect->effectIndex == effectIndex)) { + break; + } + curEffect++; + } + + // If an effect was found within the table, initialize it and return + if (i < ARRAY_COUNT(D_800A4000)) { + curEffect->effectIndex = effectIndex; + curEffect->unk_08 = NULL; + curEffect->flags = EFFECT_LOADED; + return 1; + } + + // If a loaded effect wasn't found, look for the first empty space + for(i = 0, curEffect = &D_800A4000[0]; i < ARRAY_COUNT(D_800A4000); i++) { + if (!(curEffect->flags & EFFECT_LOADED)) { + break; + } + curEffect++; + } + + // If no empty space was found, panic + ASSERT(i < ARRAY_COUNT(D_800A4000)); + + // Map space for the effect + tlbMappablePages = &D_80197000; + osMapTLB(i, 0, effectEntry->dmaDest, (s32)((*tlbMappablePages)[i]) & 0xFFFFFF, -1, -1); + + // Copy the effect into the newly mapped space + dma_copy(effectEntry->dmaStart, effectEntry->dmaEnd, effectEntry->dmaDest); + + // If there's extra data the effect normally loads, allocate space and copy into the new space + if (effectEntry->unkStartRom != NULL) { + void* effectDataBuf = general_heap_malloc(effectEntry->unkEndRom - effectEntry->unkStartRom); + curEffect->unk_1C = effectDataBuf; + ASSERT(effectDataBuf != NULL); + dma_copy(effectEntry->unkStartRom, effectEntry->unkEndRom, curEffect->unk_1C); + } + + // Initialize the newly loaded effect data + curEffect->effectIndex = effectIndex; + curEffect->unk_08 = NULL; + curEffect->flags = EFFECT_LOADED; + return 1; +} +#else INCLUDE_ASM(s32, "world/world", play_effect); +#endif +// FILE SPLIT void load_world_script_api(void) { dma_copy(&world_script_api_ROM_START, &world_script_api_ROM_END, &world_script_api_VRAM); } @@ -100,7 +289,7 @@ static Map mac_maps[] = { { MAP_UNSPLIT(mac_01, 0x80246730), .bgName = "nok_bg" }, { MAP_UNSPLIT(mac_02, 0x80243580), .bgName = "nok_bg" }, { MAP_UNSPLIT(mac_03, 0x802428B0), .bgName = "nok_bg" }, - { MAP_UNSPLIT(mac_04, 0x80242080), .bgName = "nok_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(mac_04, 0x80242080), .bgName = "nok_bg", .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(mac_05, 0x802441A0), .bgName = "nok_bg" }, { MAP_UNSPLIT(mac_06, 0x802416A0), .bgName = "nok_bg" }, }; @@ -127,7 +316,7 @@ static Map tik_maps[] = { { MAP_UNSPLIT(tik_21, 0x80240990), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(tik_22, 0x802409D0), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(tik_23, 0x80241160), .songVariation = 1, .flags = 2 }, - { MAP_UNSPLIT(tik_24, 0x80240ED0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(tik_24, 0x80240ED0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(tik_25, 0x802407D0), .songVariation = 1, .flags = 2 }, }; @@ -152,10 +341,10 @@ static Map kmr_maps[] = { { MAP_UNSPLIT(kmr_11, 0x80241180), .bgName = "kmr_bg" }, { MAP(kmr_12), .bgName = "kmr_bg" }, { MAP_UNSPLIT(kmr_20, 0x80242C00), .bgName = "kmr_bg" }, // Mario's House - { MAP_UNSPLIT(kmr_21, 0x802402F0), .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(kmr_22, 0x80240DA0), .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(kmr_23, 0x80241150), .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(kmr_24, 0x80240120), .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kmr_21, 0x802402F0), .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(kmr_22, 0x80240DA0), .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(kmr_23, 0x80241150), .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(kmr_24, 0x80240120), .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kmr_30, 0x802404F0) }, }; @@ -281,14 +470,14 @@ static Map nok_maps[] = { /// Star Region static Map hos_maps[] = { - { MAP_UNSPLIT(hos_00, 0x80240D50), .bgName = "nok_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(hos_00, 0x80240D50), .bgName = "nok_bg", .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(hos_01, 0x80240E40), .bgName = "hos_bg" }, { MAP_UNSPLIT(hos_02, 0x80242B90), .bgName = "hos_bg" }, { MAP_UNSPLIT(hos_03, 0x802435F0), .bgName = "hos_bg" }, { MAP_UNSPLIT(hos_04, 0x80240EE0), .bgName = "hos_bg" }, { MAP_UNSPLIT(hos_05, 0x80245910), .bgName = "hos_bg", .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(hos_06, 0x80242570), .bgName = "hos_bg" }, - { MAP_UNSPLIT(hos_10, 0x80240CE0), .bgName = "hos_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(hos_10, 0x80240CE0), .bgName = "hos_bg", .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(hos_20, 0x80240390), .bgName = "hos_bg" }, }; @@ -312,29 +501,29 @@ static Map kpa_maps[] = { { MAP_UNSPLIT(kpa_40, 0x80240040), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_41, 0x80240040), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_50, 0x80241A40), .songVariation = 1, .flags = 2 }, - { MAP_UNSPLIT(kpa_51, 0x80241C40), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kpa_51, 0x80241C40), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kpa_52, 0x80241360), .songVariation = 1, .flags = 2 }, - { MAP_UNSPLIT(kpa_53, 0x80240190), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kpa_53, 0x80240190), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kpa_60, 0x80240450), .bgName = "kpa_bg" }, { MAP_UNSPLIT(kpa_61, 0x80242360), .bgName = "kpa_bg" }, { MAP_UNSPLIT(kpa_62, 0x80240430), .bgName = "kpa_bg" }, { MAP_UNSPLIT(kpa_63, 0x802401B0), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_70, 0x80240B10), .songVariation = 1, .flags = 3 }, - { MAP_UNSPLIT(kpa_81, 0x80240480), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(kpa_82, 0x80240460), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(kpa_83, 0x80240090), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kpa_81, 0x80240480), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(kpa_82, 0x80240460), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(kpa_83, 0x80240090), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kpa_90, 0x80240020), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_91, 0x80241920), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_94, 0x80240020), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_95, 0x80241920), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_96, 0x80240040), .songVariation = 1, .flags = 1 }, - { MAP_UNSPLIT(kpa_100, 0x80240060), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(kpa_101, 0x80240060), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kpa_100, 0x80240060), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(kpa_101, 0x80240060), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kpa_102, 0x802435B0), .songVariation = 1, .flags = 3 }, { MAP_UNSPLIT(kpa_111, 0x802413E0), .songVariation = 1, .flags = 3 }, { MAP_UNSPLIT(kpa_112, 0x80240020), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_113, 0x80240AD0), .songVariation = 1, .flags = 3 }, - { MAP_UNSPLIT(kpa_114, 0x80240070), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kpa_114, 0x80240070), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kpa_115, 0x802413F0), .songVariation = 1, .flags = 3 }, { MAP_UNSPLIT(kpa_116, 0x80240020), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(kpa_117, 0x80240010), .songVariation = 1, .flags = 1 }, @@ -349,24 +538,24 @@ static Map kpa_maps[] = { /// Peach's Castle Grounds static Map osr_maps[] = { { MAP_UNSPLIT(osr_00, 0x802407E0), .bgName = "nok_bg" }, - { MAP_UNSPLIT(osr_01, 0x80240B00), .bgName = "nok_bg", .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(osr_02, 0x80240170), .bgName = "kpa_bg", .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(osr_03, 0x802403F0), .bgName = "kpa_bg", .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(osr_04, 0x802400D0), .bgName = "nok_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(osr_01, 0x80240B00), .bgName = "nok_bg", .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(osr_02, 0x80240170), .bgName = "kpa_bg", .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(osr_03, 0x802403F0), .bgName = "kpa_bg", .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(osr_04, 0x802400D0), .bgName = "nok_bg", .init = (MapInit)0x80240000 }, }; /// Peach's Castle /// @bug There are two entries for kkj_26; the latter is unreachable. static Map kkj_maps[] = { - { MAP_UNSPLIT(kkj_00, 0x80241030), .bgName = "nok_bg", .songVariation = 1, .flags = 3, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kkj_00, 0x80241030), .bgName = "nok_bg", .songVariation = 1, .flags = 3, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kkj_01, 0x80240F10), .bgName = "nok_bg", .songVariation = 1, .flags = 3 }, { MAP_UNSPLIT(kkj_02, 0x80240030), .bgName = "nok_bg", .flags = 2 }, - { MAP_UNSPLIT(kkj_03, 0x80240360), .bgName = "nok_bg", .flags = 3, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kkj_03, 0x80240360), .bgName = "nok_bg", .flags = 3, .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kkj_10, 0x80241120), .songVariation = 1, .flags = 3 }, { MAP_UNSPLIT(kkj_11, 0x80241160), .songVariation = 1, .flags = 3 }, { MAP_UNSPLIT(kkj_12, 0x802408D0), .songVariation = 1, .flags = 2 }, - { MAP_UNSPLIT(kkj_13, 0x802407A0), .bgName = "kpa_bg", .songVariation = 1, .flags = 3, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(kkj_14, 0x80240580), .bgName = "kpa_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kkj_13, 0x802407A0), .bgName = "kpa_bg", .songVariation = 1, .flags = 3, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(kkj_14, 0x80240580), .bgName = "kpa_bg", .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kkj_15, 0x80240640) }, { MAP_UNSPLIT(kkj_16, 0x80241090), .flags = 0x1 }, { MAP_UNSPLIT(kkj_17, 0x802405B0) }, @@ -375,9 +564,9 @@ static Map kkj_maps[] = { { MAP_UNSPLIT(kkj_20, 0x80240600) }, { MAP_UNSPLIT(kkj_21, 0x80240010), .flags = 0x1 }, { MAP_UNSPLIT(kkj_22, 0x80240020), .bgName = "kpa_bg", .songVariation = 1, .flags = 2 }, - { MAP_UNSPLIT(kkj_23, 0x802409F0), .bgName = "kpa_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kkj_23, 0x802409F0), .bgName = "kpa_bg", .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kkj_24, 0x80240040), .bgName = "kpa_bg", .songVariation = 1, .flags = 2 }, - { MAP_UNSPLIT(kkj_25, 0x80240F50), .bgName = "kpa_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(kkj_25, 0x80240F50), .bgName = "kpa_bg", .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(kkj_26, 0x80240070), .bgName = "kpa_bg" }, { MAP_UNSPLIT(kkj_26, 0x80240070), .flags = 0x2 }, { MAP_UNSPLIT(kkj_27, 0x802404C0), .flags = 0x1 }, @@ -457,7 +646,7 @@ static Map arn_maps[] = { /// Tubba Blubba's Castle static Map dgb_maps[] = { - { MAP_UNSPLIT(dgb_00, 0x802400D0), .bgName = "arn_bg", .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(dgb_00, 0x802400D0), .bgName = "arn_bg", .init = (MapInit)0x80240000 }, { MAP_UNSPLIT(dgb_01, 0x80243460), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(dgb_02, 0x80241470), .songVariation = 1, .flags = 2 }, { MAP_UNSPLIT(dgb_03, 0x80242830), .songVariation = 1, .flags = 2 }, @@ -541,38 +730,38 @@ static Map sam_maps[] = { /// Crystal Palace static Map pra_maps[] = { - { MAP_UNSPLIT(pra_01, 0x80241400), .bgName = "yki_bg", .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_02, 0x802416C0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_03, 0x802401E0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_04, 0x80240970), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_05, 0x802411F0), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_06, 0x80240F60), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_09, 0x80241670), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_10, 0x802416D0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_11, 0x802411F0), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_12, 0x80241220), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_13, 0x80241620), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_14, 0x80241200), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_15, 0x80240050), .bgName = "yki_bg", .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_16, 0x80240F60), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_18, 0x80240F50), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_19, 0x802419D0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_20, 0x80240F70), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_21, 0x80240140), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_22, 0x802402F0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_27, 0x80241220), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_28, 0x80241220), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_29, 0x802412C0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_31, 0x802410E0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_32, 0x80240850), .bgName = "sam_bg", .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_33, 0x802410C0), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_34, 0x80241040), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_35, 0x80242C40), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_36, 0x80240F70), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_37, 0x80241840), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_38, 0x80241700), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_39, 0x80241700), .songVariation = 1, .flags = 2, .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(pra_40, 0x80240F40), .songVariation = 1, .flags = 1, .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(pra_01, 0x80241400), .bgName = "yki_bg", .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_02, 0x802416C0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_03, 0x802401E0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_04, 0x80240970), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_05, 0x802411F0), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_06, 0x80240F60), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_09, 0x80241670), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_10, 0x802416D0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_11, 0x802411F0), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_12, 0x80241220), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_13, 0x80241620), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_14, 0x80241200), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_15, 0x80240050), .bgName = "yki_bg", .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_16, 0x80240F60), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_18, 0x80240F50), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_19, 0x802419D0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_20, 0x80240F70), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_21, 0x80240140), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_22, 0x802402F0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_27, 0x80241220), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_28, 0x80241220), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_29, 0x802412C0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_31, 0x802410E0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_32, 0x80240850), .bgName = "sam_bg", .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_33, 0x802410C0), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_34, 0x80241040), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_35, 0x80242C40), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_36, 0x80240F70), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_37, 0x80241840), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_38, 0x80241700), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_39, 0x80241700), .songVariation = 1, .flags = 2, .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(pra_40, 0x80240F40), .songVariation = 1, .flags = 1, .init = (MapInit)0x80240000 }, }; /// Shy Guy's Toy Box @@ -611,8 +800,8 @@ static Map tst_maps[] = { /// Credits static Map end_maps[] = { - { MAP_UNSPLIT(end_00, 0x80242B50), .init = (MapInit*)0x80240000 }, - { MAP_UNSPLIT(end_01, 0x80243000), .init = (MapInit*)0x80240000 }, + { MAP_UNSPLIT(end_00, 0x80242B50), .init = (MapInit)0x80240000 }, + { MAP_UNSPLIT(end_01, 0x80243000), .init = (MapInit)0x80240000 }, }; /// Toad Town Playroom diff --git a/tools/splat.yaml b/tools/splat.yaml index a47ae38b8c..1496707ad6 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -309,12 +309,16 @@ segments: - [0x1086a0, c, code_1086a0_len_fc0] - [0x109660, c, code_109660_len_1270] - [0x10A8D0, c, code_10A8D0] - - [0x10A9F0, i4, shadow/square, 16, 16] - - [0x10AA70, i4, shadow/circle, 16, 16] - - [0x10AAF0, bin] - - [0x10AB70, i4, shadow/10AB70, 32, 32] - - [0x10AD70, i4, shadow/10AD70, 32, 32] - - [0x10AF70, bin] # TODO + - [0x10A9F0, bin] + #- [0x10A9F0, i4, shadow/square, 16, 16] + #- [0x10AA70, i4, shadow/circle, 16, 16] + - [0x10AAF0, bin] + #- [0x10AB70, i4, shadow/10AB70, 32, 32] + #- [0x10AD70, i4, shadow/10AD70, 32, 32] + - [0x10AF70, bin] # TODO + - [0x10C880, rodata, code_102c80] + - [0x10CA50, rodata, code_104940_len_dc0] + - [0x10CAF0, bin] - [0x1164B8, ci8, peach_letter, 150, 105] - [0x11A23E, bin] - [0x11A240, palette, peach_letter] diff --git a/undefined_syms.txt b/undefined_syms.txt index 5079c7ed34..7a63b8ac45 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -405,7 +405,6 @@ D_0A002F78 = 0x0A002F78; D_0A001218 = 0x0A001218; D_0A003F70 = 0x0A003F70; D_0A002318 = 0x0A002318; -======= D_8014F738 = 0x8014F738; D_802BDF64 = 0x802BDF64;