diff --git a/include/dungeon_cutscenes.h b/include/dungeon_cutscenes.h index 36ca6ef9c..175306b38 100644 --- a/include/dungeon_cutscenes.h +++ b/include/dungeon_cutscenes.h @@ -55,7 +55,7 @@ void ZapdosReFightDialogue(void); void nullsub_100(u8, u8, u8); void sub_8086B14(void); void sub_8086B94(void); -void sub_8086BDC(u8, s32); // TODO: should be u8 +void sub_8086BDC(u8, u8); void sub_8086E40(void); void sub_8086E9C(void); void sub_8086F00(void); diff --git a/include/effect_main.h b/include/effect_main.h index 77a0cbbd6..84135747b 100644 --- a/include/effect_main.h +++ b/include/effect_main.h @@ -17,12 +17,6 @@ typedef struct unkStruct_80416E0 unkStruct_2039DB0 spriteMasks; } unkStruct_80416E0; -typedef struct unkStruct_800EA44 -{ - s16 unk0; - s16 unk2; -} unkStruct_800EA44; - struct UnkStruct_8040094 { u16 unk0; @@ -47,8 +41,8 @@ s32 sub_800E6D8(s32 a0); s32 sub_800E700(s32 a0); s32 sub_800E710(s32 species, s32 moveId); s32 sub_800E790(s32 a0_, s32 a1); -bool8 sub_800E7D0(u16 *param_1); -bool8 sub_800E838(u16 *param_1, s32 param_2); +bool8 sub_800E7D0(struct UnkStruct_8040094 *param_1); +bool8 sub_800E838(struct UnkStruct_8040094 *param_1, s32 param_2); s32 sub_800E890(unkStruct_80416E0 *param_1); void sub_800E8AC(s32 a0, DungeonPos *a1, DungeonPos *a2, s32 a3, unkStruct_2039DB0 *a4); bool8 sub_800E90C(DungeonPos *param_1); @@ -56,7 +50,7 @@ void sub_800E970(void); bool8 sub_800E9A8(s32 a0); bool8 sub_800E9E4(u32 param_1); bool8 sub_800E9FC(u8 a0); -u8 sub_800EA44(unkStruct_800EA44 param_1, s32 param_2); +u8 sub_800EA44(s32 monsterId_, s32 param_2); s32 sub_800EA84(struct UnkStruct_8040094 *a0); void sub_800EB24(s32 param_1, DungeonPos *param_2, DungeonPos *param_3, s32 r5, s32 r4); s32 sub_800EBC8(struct UnkStruct_8040094 *a0); diff --git a/src/code_800D090.c b/src/code_800D090.c index b39a41cfa..b9309b2a9 100644 --- a/src/code_800D090.c +++ b/src/code_800D090.c @@ -11,8 +11,7 @@ void Hang(void) } } -// Unused -void sub_800D098(void) +UNUSED static void sub_800D098(void) { u32 dispcnt_save; u32 ie_store; @@ -71,8 +70,7 @@ void sprintfStatic(char *buffer, const char *text, ...) va_end(vArgv); } -// Unused -void sub_800D16C(const char *text, ...) +UNUSED static void sub_800D16C(const char *text, ...) { char buffer[1024]; va_list vArgv; @@ -81,8 +79,7 @@ void sub_800D16C(const char *text, ...) va_end(vArgv); } -// Unused -void sub_800D10A(const char *r0, u32 r1, u32 r2, u32 r3, ...) +UNUSED static void sub_800D10A(const char *r0, u32 r1, u32 r2, u32 r3, ...) { } diff --git a/src/code_8040094_1.c b/src/code_8040094_1.c index e671e6dea..c9f236d94 100644 --- a/src/code_8040094_1.c +++ b/src/code_8040094_1.c @@ -13,43 +13,26 @@ #include "dungeon_info.h" #include "dungeon_message.h" #include "dungeon_move.h" +#include "dungeon_move_util.h" #include "dungeon_music.h" #include "dungeon_random.h" #include "dungeon_util.h" +#include "dungeon_logic.h" #include "sprite.h" #include "weather.h" #include "dungeon_map_access.h" #include "dungeon_strings.h" #include "dungeon_mon_sprite_render.h" #include "dungeon_8041AD0.h" - -struct UnkStruct_8040094 -{ - u16 unk0; - u16 unk2; - DungeonPos unk4; - DungeonPos unk8; - s32 unkC; - s32 unk10; -}; +#include "effect_main.h" extern u8 sub_800EC94(s32 param_1); -extern s32 sub_800E710(s32 species, u16 moveId); extern void sub_800EEC8(u16 r0); -extern u8 sub_800EA44(s32 species, u16 a2); -extern s32 sub_800E790(s32 species, u16 a2); -extern s32 sub_800E52C(struct UnkStruct_8040094 *a0); -extern s32 sub_800EA84(struct UnkStruct_8040094 *a0); -extern bool8 sub_800E838(struct UnkStruct_8040094 *a0, s32 a1); extern bool8 sub_800E9A8(s32 a0); extern void sub_800EEF8(u16 a0); extern bool8 sub_803F428(DungeonPos *pos); extern void sub_800EEE0(u16 a0); -extern s32 sub_800EBC8(struct UnkStruct_8040094 *a0); -extern bool8 sub_800E7D0(struct UnkStruct_8040094 *a0); extern bool8 EffectiveMoveHasSineWobble(s32 moveId); -extern bool8 MoveMatchesBideClassStatus(Entity *pokemon, Move *move); -extern bool8 IsMonsterSleeping(Entity *pokemon); extern const s32 gUnknown_8106A8C[]; diff --git a/src/effect_main.c b/src/effect_main.c index cb786cc81..dd3e245ed 100644 --- a/src/effect_main.c +++ b/src/effect_main.c @@ -925,16 +925,16 @@ s32 sub_800E790(s32 species_, s32 moveId) return unkPtr1->soundEffectId; } -bool8 sub_800E7D0(u16 *param_1) +bool8 sub_800E7D0(struct UnkStruct_8040094 *param_1) { s32 local_1c[4]; s32 index; bool8 flag = FALSE; - local_1c[0] = sub_800ECB8(*param_1)->unk0; - local_1c[1] = sub_800ECB8(*param_1)->unk2; - local_1c[2] = sub_800ECB8(*param_1)->unk4; - local_1c[3] = sub_800ECB8(*param_1)->unk6; + local_1c[0] = sub_800ECB8(param_1->unk0)->unk0; + local_1c[1] = sub_800ECB8(param_1->unk0)->unk2; + local_1c[2] = sub_800ECB8(param_1->unk0)->unk4; + local_1c[3] = sub_800ECB8(param_1->unk0)->unk6; for (index = 0; index < 4; index++) { flag = (sub_800ECA4(local_1c[index])->animType == 4); if (flag) @@ -943,14 +943,14 @@ bool8 sub_800E7D0(u16 *param_1) return flag; } -bool8 sub_800E838(u16 *param_1, s32 param_2) +bool8 sub_800E838(struct UnkStruct_8040094 *param_1, s32 param_2) { s32 local_1c[4]; - local_1c[0] = sub_800ECB8(*param_1)->unk0; - local_1c[1] = sub_800ECB8(*param_1)->unk2; - local_1c[2] = sub_800ECB8(*param_1)->unk4; - local_1c[3] = sub_800ECB8(*param_1)->unk6; + local_1c[0] = sub_800ECB8(param_1->unk0)->unk0; + local_1c[1] = sub_800ECB8(param_1->unk0)->unk2; + local_1c[2] = sub_800ECB8(param_1->unk0)->unk4; + local_1c[3] = sub_800ECB8(param_1->unk0)->unk6; return sub_800ECA4(local_1c[param_2])->animType == 4; } @@ -1065,15 +1065,15 @@ bool8 sub_800E9FC(u8 a0) return FALSE; } -u8 sub_800EA44(unkStruct_800EA44 param_1, s32 param_2) +u8 sub_800EA44(s32 monsterId_, s32 param_2) { s32 i; - s32 a = param_1.unk0; + s32 monsterId = (s16) monsterId_; const unkStruct_80BDBC4 *ret = sub_800ECB8(param_2); const unkStruct_80C183C *unkStruct2 = sub_800ECD0(ret->unk20); for (i = 0; i < ret->unk1C; i++, unkStruct2++) { - if (unkStruct2->species == a) { + if (unkStruct2->species == monsterId) { return unkStruct2->unk2; } } diff --git a/src/ground_bg.c b/src/ground_bg.c index 312f0150d..9bb2a8204 100644 --- a/src/ground_bg.c +++ b/src/ground_bg.c @@ -11,6 +11,7 @@ #include "debug.h" #include "bg_control.h" #include "unk_dungeon_load.h" +#include "palette_fade_util.h" #include "constants/dungeon.h" // This file most likely deals with map loading and writing to VRAM. It even has a custom decompression function. @@ -32,7 +33,6 @@ static void ClearDoubleBgTilemaps(MapRender *mapRender); static void RenderChunksToBgTilemaps_2x2(MapRender *mapRender); static void RenderChunksToBgTilemaps_3x3(MapRender *mapRender); -extern void sub_8003810(u16 param_1, RGB_Union param_2); extern void sub_809971C(u16 idx, const RGB_Array *strPtrs, s32 n); static const PixelPos sPositionZero = {0, 0}; @@ -199,8 +199,8 @@ void sub_80A2E64(GroundBg *groundBg) r6 = groundBg->unk52C.unk0 * 16; for (i = 0; i < groundBg->unk52C.unk2; i++) { - RGB_Union str1 = {0}; - RGB_Union str2 = {0xFF, 0xFF, 0xFF, 0}; + RGB_Array str1 = {0}; + RGB_Array str2 = {0xFF, 0xFF, 0xFF, 0}; sub_8003810(r6++, str1); for (j = 0; j < 15; j++) { @@ -225,8 +225,8 @@ void sub_80A2FBC(GroundBg *groundBg, s32 mapFileId_) const void *bmaData; const void *bplData; BmaHeader *bmaHeader; - RGB_Union str2; - RGB_Union str1; + RGB_Array str2; + RGB_Array str1; const RGB_Array *rgbPal; s32 unk0Id; s32 id; @@ -278,11 +278,11 @@ void sub_80A2FBC(GroundBg *groundBg, s32 mapFileId_) rgbPal = bplData; r5 = groundBg->unk52C.unk0 * 16; - str2 = (RGB_Union) {0}; - str1.asArr.c[0] = 0xff; - str1.asArr.c[1] = 0xff; - str1.asArr.c[2] = 0xff; - str1.asArr.c[3] = 0; + str2 = (RGB_Array) {0}; + str1.c[0] = 0xff; + str1.c[1] = 0xff; + str1.c[2] = 0xff; + str1.c[3] = 0; for (i = 0; i < bplHeader->numPalettes && i < groundBg->unk52C.unk2; i++) { sub_8003810(r5++, str2); sub_809971C(r5, rgbPal, 15); @@ -474,21 +474,21 @@ void sub_80A3440(GroundBg *groundBg, s32 mapFileId_, const DungeonLocation *dung groundBg->bplHeader.hasPalAnimations = FALSE; if (groundBg->unk43C != NULL) { s32 i, j; - const RGB_Union *strPtr = groundBg->unk43C->data; + const RGB_Array *strPtr = groundBg->unk43C->data; u16 r7 = 0; - RGB_Union str0 = {0}; - RGB_Union str1; + RGB_Array str0 = {0}; + RGB_Array str1; - str1.asArr.c[0] = 0xff; - str1.asArr.c[1] = 0xff; - str1.asArr.c[2] = 0xff; - str1.asArr.c[3] = 0; + str1.c[0] = 0xff; + str1.c[1] = 0xff; + str1.c[2] = 0xff; + str1.c[3] = 0; for (i = 0; i < 12 && i < groundBg->unk52C.unk2; i++) { sub_8003810(r7++, str0); strPtr++; for (j = 0; j < 15; j++) { - RGB_Union str2 = {strPtr->asArr.c[0], strPtr->asArr.c[1], strPtr->asArr.c[2], strPtr->asArr.c[3]}; + RGB_Array str2 = {strPtr->c[0], strPtr->c[1], strPtr->c[2], strPtr->c[3]}; sub_8003810(r7++, str2); strPtr++; } @@ -1360,7 +1360,7 @@ void sub_80A4764(GroundBg *groundBg) } if (sub0Ptr->unk8 != NULL) { - RGB_Union empty = {0}; + RGB_Array empty = {0}; sub_8003810(r6, empty); sub_809971C(r6 + 1, sub0Ptr->unk8, 15); sub0Ptr->unk8 += 60; @@ -1376,7 +1376,7 @@ void sub_80A4764(GroundBg *groundBg) s32 r6 = 160; for (i = 0; i < 32; i++, unkE0Ptr++, r6++) { - RGB_Union color; + RGB_Array color; if (sub_8004D14(unkE0Ptr, 1) && !sub_8004D40(unkE0Ptr, 1) && --unkE0Ptr->unk6 <= 0) { unkE0Ptr->unk6 = unkE0Ptr->unk4; @@ -1384,7 +1384,7 @@ void sub_80A4764(GroundBg *groundBg) unkE0Ptr->unkC = unkE0Ptr->unk8; } unkE0Ptr->unk14 = *unkE0Ptr->unkC++; - color = (RGB_Union) {unkE0Ptr->unk14.r, unkE0Ptr->unk14.g, unkE0Ptr->unk14.b, unkE0Ptr->unk14.unk4}; + color = (RGB_Array) {unkE0Ptr->unk14.r, unkE0Ptr->unk14.g, unkE0Ptr->unk14.b, unkE0Ptr->unk14.unk4}; sub_8003810(r6, color); } } diff --git a/src/ground_main.c b/src/ground_main.c index 63bc905ec..093c5c70f 100644 --- a/src/ground_main.c +++ b/src/ground_main.c @@ -33,6 +33,7 @@ #include "code_809D148.h" #include "adventure_info.h" #include "palette_util.h" +#include "code_800558C.h" EWRAM_DATA u32 gUnknown_20398A8 = {0}; EWRAM_DATA s32 gUnknown_20398AC = {0}; @@ -59,8 +60,6 @@ extern void nullsub_106(); extern void sub_80A73EC(); extern void sub_8095494(DungeonMailSeed *param_1, u8 index); -extern u16 gUnknown_2026E4E; - // TODO: Move these externs to headers extern s16 sub_80A2654(s16 r0); extern bool8 sub_80048BC(void); @@ -76,7 +75,6 @@ extern void sub_80060EC(void); extern void sub_809977C(void); extern void UpdateFadeInTile(s32); extern void sub_8001D88(void); -extern void sub_8005838(s32, s32); static s16 sub_8098FCC(u32 unused); @@ -271,7 +269,7 @@ u32 xxx_script_related_8098468(s32 param_1) GroundMap_ExecuteEvent(0x66,0); } GroundMap_Action(); - sub_8005838(0,0); + sub_8005838(NULL,0); sub_80060EC(); xxx_call_update_bg_sound_input(); while ( 1 ) { diff --git a/src/random.c b/src/random.c index 9ee169816..fd2bf240e 100644 --- a/src/random.c +++ b/src/random.c @@ -46,4 +46,4 @@ void SetRNGSeed(s32 state) { sPRNGState = state; sPRNGState = Rand32Bit(); -} \ No newline at end of file +}