diff --git a/include/fldeff_80F9BCC.h b/include/fldeff_misc.h similarity index 83% rename from include/fldeff_80F9BCC.h rename to include/fldeff_misc.h index afa41b310..954ecbb5c 100644 --- a/include/fldeff_80F9BCC.h +++ b/include/fldeff_misc.h @@ -1,11 +1,11 @@ -#ifndef GUARD_FLDEFF_80F9BCC_H -#define GUARD_FLDEFF_80F9BCC_H +#ifndef GUARD_FLDEFF_MISC_H +#define GUARD_FLDEFF_MISC_H void PopSecretBaseBalloon(s16 id, s16 x, s16 y); void ShatterSecretBaseBreakableDoor(s16 x, s16 y); u8 CreateRecordMixingSprite(void); void DestroyRecordMixingSprite(void); -void FldeffPoison_Start(void); +void FldEffPoison_Start(void); void PlaySecretBaseMusicNoteMatSound(s16 metatileId); void DoSecretBaseGlitterMatSparkle(void); bool8 sub_80FADE4(u16, u8); @@ -21,4 +21,4 @@ extern const struct OamData gEventObjectBaseOam_32x8; extern const u16 gTilesetPalettes_SecretBase[][16]; -#endif //GUARD_FLDEFF_80F9BCC_H +#endif //GUARD_FLDEFF_MISC_H diff --git a/ld_script.txt b/ld_script.txt index 060ee0064..c6b59be63 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -151,7 +151,7 @@ SECTIONS { src/script_pokemon_util_80F87D8.o(.text); src/field_poison.o(.text); src/pokemon_size_record.o(.text); - src/fldeff_80F9BCC.o(.text); + src/fldeff_misc.o(.text); src/field_special_scene.o(.text); src/rotating_gate.o(.text); src/safari_zone.o(.text); @@ -479,7 +479,7 @@ SECTIONS { data/contest_link_80F57C4.o(.rodata); src/script_pokemon_util_80F87D8.o(.rodata); src/pokemon_size_record.o(.rodata) - src/fldeff_80F9BCC.o(.rodata); + src/fldeff_misc.o(.rodata); src/field_special_scene.o(.rodata); src/rotating_gate.o(.rodata); src/item_use.o(.rodata); diff --git a/src/battle_setup.c b/src/battle_setup.c index 0705bd9f6..83ced1b7c 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -57,7 +57,7 @@ struct TrainerBattleParameter }; extern bool32 InTrainerHill(void); -extern bool32 FldeffPoison_IsActive(void); +extern bool32 FldEffPoison_IsActive(void); extern void RestartWildEncounterImmunitySteps(void); extern void ClearPoisonStepCounter(void); extern void sub_81BE72C(void); @@ -338,7 +338,7 @@ static void Task_BattleStart(u8 taskId) switch (tState) { case 0: - if (!FldeffPoison_IsActive()) // is poison not active? + if (!FldEffPoison_IsActive()) // is poison not active? { BattleTransition_StartOnField(tTransition); sub_81BE72C(); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 7b17413d3..3774ef2b3 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -12,7 +12,7 @@ #include "field_poison.h" #include "field_screen_effect.h" #include "field_specials.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "item_menu.h" #include "link.h" #include "metatile_behavior.h" diff --git a/src/field_poison.c b/src/field_poison.c index 02f37f69f..7aaab902f 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -4,7 +4,7 @@ #include "event_data.h" #include "field_message_box.h" #include "field_poison.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "frontier_util.h" #include "party_menu.h" #include "pokenav.h" @@ -136,7 +136,7 @@ s32 DoPoisonFieldEffect(void) } if (numFainted != 0 || numPoisoned != 0) { - FldeffPoison_Start(); + FldEffPoison_Start(); } if (numFainted != 0) { diff --git a/src/fieldmap.c b/src/fieldmap.c index 7e1fc03eb..11161b8df 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -1,7 +1,7 @@ #include "global.h" #include "bg.h" #include "fieldmap.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "fldeff_cut.h" #include "fldeff_groundshake.h" #include "frontier_util.h" diff --git a/src/fire.c b/src/fire.c index 44ae9d320..526da1ef6 100644 --- a/src/fire.c +++ b/src/fire.c @@ -1318,4 +1318,4 @@ void sub_810A094(u8 taskId) gSprites[spriteId].pos2.y = 0; DestroyAnimVisualTask(taskId); } -} \ No newline at end of file +} diff --git a/src/fldeff_80F9BCC.c b/src/fldeff_misc.c similarity index 98% rename from src/fldeff_80F9BCC.c rename to src/fldeff_misc.c index 26258f536..79f0a8ede 100644 --- a/src/fldeff_80F9BCC.c +++ b/src/fldeff_misc.c @@ -20,7 +20,7 @@ #include "constants/metatile_behaviors.h" #include "constants/songs.h" #include "constants/vars.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" void sub_80F9C90(u8); void sub_80F9DFC(u8); @@ -342,26 +342,11 @@ bool8 sub_80F9C30(void) void sub_80F9C44(void (*taskfunc) (u8), u16 a1, u16 a2, u8 a3) { - u16 tempA, tempB; - u8 taskId = CreateTask(taskfunc, a3); gTasks[taskId].data[0] = 0; - - tempA = 16; - if (a1 != 0) - { - tempA = a1; - } - gTasks[taskId].data[1] = tempA; - - tempB = 20; - if (a1 != 0) - { - tempB = a1; - } - gTasks[taskId].data[2] = tempB; - + gTasks[taskId].data[1] = a1 == 0 ? 16 : a1; + gTasks[taskId].data[2] = a1 == 0 ? 20 : a1; gTasks[taskId].func(taskId); } @@ -385,7 +370,6 @@ void sub_80F9C90(u8 taskId) SetGpuReg(REG_OFFSET_WINOUT, 0); break; - case 1: task->data[7] = GetGpuReg(REG_OFFSET_BLDCNT); task->data[8] = GetGpuReg(REG_OFFSET_BLDY); @@ -394,7 +378,6 @@ void sub_80F9C90(u8 taskId) SetGpuReg(REG_OFFSET_BLDY, 0x10); break; - case 2: task->data[3] -= task->data[1]; task->data[4] += task->data[1]; @@ -410,9 +393,9 @@ void sub_80F9C90(u8 taskId) } SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); - if (task->data[3] != 0) return; + if (task->data[3] != 0) + return; break; - case 3: task->data[5] -= task->data[2]; task->data[6] += task->data[2]; @@ -425,9 +408,9 @@ void sub_80F9C90(u8 taskId) } SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); - if (task->data[5] != 0) return; + if (task->data[5] != 0) + return; break; - default: SetGpuReg(REG_OFFSET_BLDCNT, task->data[7]); DestroyTask(taskId); @@ -626,7 +609,6 @@ void sub_80F9DFC(u8 taskId) case 0: gPlttBufferFaded[0] = temp; break; - case 1: task->data[3] = 0; task->data[4] = 0xF0; @@ -639,7 +621,6 @@ void sub_80F9DFC(u8 taskId) SetGpuReg(REG_OFFSET_WININ, 0x3F); SetGpuReg(REG_OFFSET_WINOUT, 0); break; - case 2: task->data[5] += task->data[2]; task->data[6] -= task->data[2]; @@ -653,9 +634,9 @@ void sub_80F9DFC(u8 taskId) } SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6])); - if (task->data[5] != 0x50) return; + if (task->data[5] != 0x50) + return; break; - case 3: task->data[3] += task->data[1]; task->data[4] -= task->data[1]; @@ -669,9 +650,9 @@ void sub_80F9DFC(u8 taskId) } SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4])); - if (task->data[3] != 0x78) return; + if (task->data[3] != 0x78) + return; break; - default: ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); SetGpuReg(REG_OFFSET_BLDY, 0); @@ -800,12 +781,10 @@ static void StartSecretBaseCaveFieldEffect(void) bool8 FldEff_SecretPowerCave(void) { AdjustSecretPowerSpritePixelOffsets(); - CreateSprite(&gUnknown_0858E600, gSprites[gPlayerAvatar.spriteId].oam.x + gFieldEffectArguments[5], gSprites[gPlayerAvatar.spriteId].oam.y + gFieldEffectArguments[6], 148); - return FALSE; } @@ -1325,9 +1304,7 @@ void GetShieldToyTVDecorationInfo(void) return; VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x10); - break; - case 734: ConvertIntToDecimalStringN(gStringVar1, 50, STR_CONV_MODE_LEFT_ALIGN, 2); StringCopy(gStringVar2, gText_Silver); @@ -1338,9 +1315,7 @@ void GetShieldToyTVDecorationInfo(void) return; VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x20); - break; - case 756: gSpecialVar_Result = 1; @@ -1348,9 +1323,7 @@ void GetShieldToyTVDecorationInfo(void) return; VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); - break; - case 757: gSpecialVar_Result = 2; @@ -1358,9 +1331,7 @@ void GetShieldToyTVDecorationInfo(void) return; VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); - break; - case 758: gSpecialVar_Result = 3; @@ -1368,7 +1339,6 @@ void GetShieldToyTVDecorationInfo(void) return; VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80); - break; } } @@ -1447,16 +1417,12 @@ void Task_FieldPoisonEffect(u8 taskId) data[1] += 2; if (data[1] > 8) data[0]++; - break; - case 1: data[1] -= 2; if (data[1] == 0) data[0]++; - break; - case 2: DestroyTask(taskId); return; @@ -1464,13 +1430,13 @@ void Task_FieldPoisonEffect(u8 taskId) SetGpuReg(REG_OFFSET_MOSAIC, (data[1] << 4) | data[1]); } -void FldeffPoison_Start(void) +void FldEffPoison_Start(void) { PlaySE(SE_DOKU); CreateTask(Task_FieldPoisonEffect, 80); } -bool32 FldeffPoison_IsActive(void) +bool32 FldEffPoison_IsActive(void) { return FuncIsActiveTask(Task_FieldPoisonEffect); } @@ -1541,7 +1507,6 @@ u8 CreateRecordMixingSprite(void) sprite->pos1.x += 16; sprite->pos1.y += 2; } - return spriteId; } diff --git a/src/record_mixing.c b/src/record_mixing.c index 6d5d49265..2b497c82b 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -23,7 +23,7 @@ #include "menu.h" #include "overworld.h" #include "field_screen_effect.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "script.h" #include "event_data.h" #include "lilycove_lady.h" diff --git a/src/secret_base.c b/src/secret_base.c index 39377e9df..a32186419 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -21,7 +21,7 @@ #include "field_weather.h" #include "event_object_movement.h" #include "field_effect.h" -#include "fldeff_80F9BCC.h" +#include "fldeff_misc.h" #include "metatile_behavior.h" #include "map_name_popup.h" #include "string_util.h"