From c10719ce155e9deef9f9ea71bb078593d0f76529 Mon Sep 17 00:00:00 2001 From: red031000 Date: Tue, 12 Nov 2024 09:46:58 +0200 Subject: [PATCH] remove assignment and bitfield alignment --- .clang-format | 7 +- arm9/overlays/05/src/ov05_021E72FC.c | 10 +- arm9/overlays/19/src/overlay_19.c | 18 +- arm9/overlays/21/src/ov21_02254854.c | 8 +- arm9/overlays/21/src/ov21_02254A6C.c | 28 +- arm9/overlays/24/include/overlay_24.h | 4 +- arm9/overlays/24/src/ov24_02254840.c | 28 +- arm9/overlays/24/src/ov24_02254CA0.c | 74 +- arm9/overlays/52/src/overlay_52.c | 2 +- arm9/overlays/59/src/ov59_Intro.c | 358 +++---- arm9/overlays/59/src/ov59_TV.c | 130 +-- arm9/overlays/63/src/ov63_021DB450.c | 16 +- arm9/src/ascii_util.c | 2 +- arm9/src/bag.c | 30 +- arm9/src/bag_view.c | 12 +- arm9/src/bg_window.c | 206 ++-- arm9/src/blackout.c | 70 +- arm9/src/brightness.c | 20 +- arm9/src/camera.c | 110 +-- arm9/src/communication_error.c | 62 +- arm9/src/daycare.c | 4 +- arm9/src/easy_chat.c | 28 +- arm9/src/encounter.c | 72 +- arm9/src/error_message_reset.c | 60 +- arm9/src/field_system_rtc_weather.c | 4 +- arm9/src/filesystem.c | 20 +- arm9/src/font.c | 2 +- arm9/src/game_init.c | 80 +- arm9/src/gf_gfx_loader.c | 4 +- arm9/src/gf_rtc.c | 20 +- arm9/src/hall_of_fame.c | 46 +- arm9/src/heap.c | 38 +- arm9/src/igt.c | 8 +- arm9/src/itemtool.c | 2 +- arm9/src/list_menu.c | 64 +- arm9/src/list_menu_items.c | 10 +- arm9/src/mail.c | 30 +- arm9/src/mail_message.c | 10 +- arm9/src/main.c | 18 +- arm9/src/map_header.c | 2 +- arm9/src/map_matrix.c | 42 +- arm9/src/map_object.c | 110 +-- arm9/src/math_util.c | 8 +- arm9/src/message_format.c | 16 +- arm9/src/move_relearner.c | 6 +- arm9/src/msgdata.c | 10 +- arm9/src/nutdata.c | 4 +- arm9/src/options.c | 6 +- arm9/src/overlay_manager.c | 14 +- arm9/src/palette.c | 32 +- arm9/src/party.c | 6 +- arm9/src/play_timer.c | 6 +- arm9/src/poke_overlay.c | 10 +- arm9/src/pokedex.c | 26 +- arm9/src/pokemon.c | 320 +++--- arm9/src/pokemon_storage_system.c | 4 +- arm9/src/poketch.c | 28 +- arm9/src/render_text.c | 34 +- arm9/src/render_window.c | 38 +- arm9/src/sav_chatot.c | 14 +- arm9/src/save.c | 112 +-- arm9/src/save_data_read_error.c | 62 +- arm9/src/save_data_write_error.c | 60 +- arm9/src/save_system_info.c | 8 +- arm9/src/scrcmd.c | 1286 ++++++++++++------------- arm9/src/scrcmd_13.c | 14 +- arm9/src/scrcmd_amity_square.c | 6 +- arm9/src/scrcmd_berry_trees.c | 18 +- arm9/src/scrcmd_coins.c | 36 +- arm9/src/scrcmd_daycare.c | 86 +- arm9/src/scrcmd_flags.c | 30 +- arm9/src/scrcmd_fossils.c | 8 +- arm9/src/scrcmd_items.c | 26 +- arm9/src/scrcmd_mart.c | 2 +- arm9/src/scrcmd_money.c | 14 +- arm9/src/scrcmd_move_relearner.c | 48 +- arm9/src/scrcmd_names.c | 262 ++--- arm9/src/scrcmd_party.c | 274 +++--- arm9/src/scrcmd_prizes.c | 6 +- arm9/src/scrcmd_sound.c | 4 +- arm9/src/scrcmd_underground.c | 84 +- arm9/src/scrcmd_union.c | 18 +- arm9/src/script.c | 18 +- arm9/src/script_pokemon_util.c | 6 +- arm9/src/sound.c | 6 +- arm9/src/string_util.c | 6 +- arm9/src/task.c | 32 +- arm9/src/text.c | 134 +-- arm9/src/timer3.c | 4 +- arm9/src/trainer_data.c | 4 +- arm9/src/unk_020040F4.c | 50 +- arm9/src/unk_020051F4.c | 10 +- arm9/src/unk_02006D98.c | 138 +-- arm9/src/unk_02008AA4.c | 6 +- arm9/src/unk_02008DEC.c | 18 +- arm9/src/unk_0200BB14.c | 14 +- arm9/src/unk_02021590.c | 20 +- arm9/src/unk_02021934.c | 28 +- arm9/src/unk_02021FF8.c | 8 +- arm9/src/unk_02022450.c | 8 +- arm9/src/unk_020286F8.c | 2 +- arm9/src/unk_0202A1E0.c | 22 +- arm9/src/unk_0202C144.c | 4 +- arm9/src/unk_0202E29C.c | 14 +- arm9/src/unk_0202F150.c | 30 +- arm9/src/unk_02031734.c | 4 +- arm9/src/unk_020337E8.c | 2 +- arm9/src/unk_0204AEA8.c | 2 +- arm9/src/unk_0204AF24.c | 2 +- arm9/src/unk_0204B0A0.c | 8 +- arm9/src/unk_0205FA2C.c | 32 +- arm9/src/unk_0206015C.c | 12 +- arm9/src/unk_0206439C.c | 4 +- arm9/src/unk_02064E20.c | 2 +- arm9/src/unk_02064E4C.c | 2 +- arm9/src/unk_0206B688.c | 14 +- arm9/src/unk_02085338.c | 18 +- arm9/src/unk_0208890C.c | 14 +- arm9/src/unk_02088AAC.c | 14 +- arm9/src/use_item_on_mon.c | 24 +- arm9/src/wfc_user_info_warning.c | 60 +- include/bag_view.h | 2 +- include/bg_window.h | 40 +- include/constants/pokemon.h | 158 +-- include/filesystem.h | 290 +++--- include/heap.h | 10 +- include/itemtool.h | 72 +- include/list_menu.h | 24 +- include/map_header.h | 8 +- include/map_object.h | 60 +- include/options.h | 6 +- include/palette.h | 24 +- include/player_data.h | 6 +- include/pokemon.h | 24 +- include/poketch.h | 14 +- include/render_text.h | 26 +- include/sections.h | 4 +- include/text.h | 2 +- include/unk_02006D98.h | 26 +- include/unk_0202A1E0.h | 20 +- include/unk_020377F0.h | 2 +- include/unk_0205FA2C.h | 2 +- 142 files changed, 3265 insertions(+), 3266 deletions(-) diff --git a/.clang-format b/.clang-format index ebd606a69..d9baf4915 100644 --- a/.clang-format +++ b/.clang-format @@ -5,12 +5,11 @@ LineEnding: LF ColumnLimit: 0 AlignAfterOpenBracket: DontAlign -AlignConsecutiveAssignments: - Enabled: true -AlignConsecutiveBitFields: - Enabled: true +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None AlignConsecutiveDeclarations: None AlignConsecutiveMacros: Consecutive +AlignEscapedNewlines: LeftWithLastLine AlignTrailingComments: true AlignArrayOfStructures: Left diff --git a/arm9/overlays/05/src/ov05_021E72FC.c b/arm9/overlays/05/src/ov05_021E72FC.c index 9a693335c..17a1fc7c0 100644 --- a/arm9/overlays/05/src/ov05_021E72FC.c +++ b/arm9/overlays/05/src/ov05_021E72FC.c @@ -43,9 +43,9 @@ BOOL ov05_021E72FC(FieldSystem *fieldSystem, u32 param1) { void ov05_021E7358(FieldSystem *fieldSystem, u32 param1, u32 param2) { UnkStruct021E7358 *res = ov05_021E74D4(24); - res->fieldSystem = fieldSystem; - res->Unk10 = param1; - res->Unk00 = param2; + res->fieldSystem = fieldSystem; + res->Unk10 = param1; + res->Unk00 = param2; PlaySE(SEQ_SE_DP_F209); FieldSystem_CreateTask(fieldSystem, ov05_021E73B4, res); } @@ -65,9 +65,9 @@ u32 ov05_021E7388(u32 param0) { } BOOL ov05_021E73B4(TaskManager *taskManager) { - UnkStruct021E7358 *strct = TaskManager_GetEnvironment(taskManager); + UnkStruct021E7358 *strct = TaskManager_GetEnvironment(taskManager); LocalMapObject *playerObject = PlayerAvatar_GetMapObject(strct->Unk10); - u8 res2 = (u8)sub_02058720(playerObject); + u8 res2 = (u8)sub_02058720(playerObject); switch (strct->Unk08) { case 0: MapObject_SetFlagsBits(playerObject, MAPOBJECTFLAG_UNK8); diff --git a/arm9/overlays/19/src/overlay_19.c b/arm9/overlays/19/src/overlay_19.c index 05f53c2df..9100bf967 100644 --- a/arm9/overlays/19/src/overlay_19.c +++ b/arm9/overlays/19/src/overlay_19.c @@ -10,17 +10,17 @@ #include "heap.h" const struct BgTemplate ov19_02252508 = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0x000, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GF_BG_CLR_4BPP, + .baseTile = 0x000, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GF_BG_CLR_4BPP, .screenBase = 12, - .charBase = 0, - .priority = 0, - .areaOver = 0, - .mosaic = 0 + .charBase = 0, + .priority = 0, + .areaOver = 0, + .mosaic = 0 }; void ov19_02252440(struct BgConfig *bgConfig) { diff --git a/arm9/overlays/21/src/ov21_02254854.c b/arm9/overlays/21/src/ov21_02254854.c index 1e68b7efa..8b96504e8 100644 --- a/arm9/overlays/21/src/ov21_02254854.c +++ b/arm9/overlays/21/src/ov21_02254854.c @@ -46,7 +46,7 @@ BOOL ov21_0225489C(UnkStruct02254854 *param0, u32 param1, u32 param2, u32 param3 param0->bytearray[2] = 0; param0->bytearray[3] = 1; param0->bytearray[6] = 0; - param0->Unk20 = 0; + param0->Unk20 = 0; GF_RTC_CopyTime(¶m0->time); if (param0->time.hour >= 0x18) { param0->time.hour = param0->time.hour % 0x18; @@ -55,7 +55,7 @@ BOOL ov21_0225489C(UnkStruct02254854 *param0, u32 param1, u32 param2, u32 param3 param0->time.hour = param0->time.hour % 0x3c; } param0->bytearray[5] = (u8)param0->time.minute; - param0->Unk10 = ov20_02254130((void *)ov21_02254D80, TRUE, ov21_02254974, param0, 8); + param0->Unk10 = ov20_02254130((void *)ov21_02254D80, TRUE, ov21_02254974, param0, 8); if (param0->Unk10 == FALSE) { return FALSE; } @@ -94,11 +94,11 @@ void ov21_02254974(u32 param0, u32 param1, u32 param2, UnkStruct02254854 *param3 #pragma unused(param0, param1) switch (param2) { case 1: - param3->Unk20 = 1; + param3->Unk20 = 1; param3->bytearray[6] = 1; return; case 0: - param3->Unk20 = 0; + param3->Unk20 = 0; param3->bytearray[6] = 1; return; default: diff --git a/arm9/overlays/21/src/ov21_02254A6C.c b/arm9/overlays/21/src/ov21_02254A6C.c index 737733e38..1dc1f1a5c 100644 --- a/arm9/overlays/21/src/ov21_02254A6C.c +++ b/arm9/overlays/21/src/ov21_02254A6C.c @@ -45,7 +45,7 @@ BOOL ov21_02254A6C(UnkStruct02254A6C *param0, void *param1) { ov20_022536F4(strct->Unk08, 8); strct->Unk00 = param1; strct->Unk04 = ov20_02252D34(); - void *res = GfGfxLoader_GetScrnData(12, 0x19, 1, &sp4, 8); + void *res = GfGfxLoader_GetScrnData(12, 0x19, 1, &sp4, 8); if (res == 0) { FreeToHeap(strct); return FALSE; @@ -100,13 +100,13 @@ BOOL ov21_02254B60(u32 param0, void *param1) { ov20_02252D7C(0, 0); ov21_02254C5C(strct); BgCommitTilemapBufferToVram(strct->Unk04, 6); - u32 r3 = reg_GXS_DB_DISPCNT; - u32 r2 = reg_GXS_DB_DISPCNT; + u32 r3 = reg_GXS_DB_DISPCNT; + u32 r2 = reg_GXS_DB_DISPCNT; vu32 tmp = r3; // unused? wtf - u32 r0 = ~0x1F00 & r2; - r2 = r3 << 19; // cast with shift? can't replicate both though - r3 = r2 >> 27; - r2 = 4 | r3; + u32 r0 = ~0x1F00 & r2; + r2 = r3 << 19; // cast with shift? can't replicate both though + r3 = r2 >> 27; + r2 = 4 | r3; r2 <<= 8; r0 |= r2; reg_GXS_DB_DISPCNT = r0; @@ -140,13 +140,13 @@ BOOL ov21_02254C40(u32 param0, void *param1) { } void ov21_02254C5C(UnkStruct02254A6C *param0) { - u32 tmp = (u32)param0->Unk00->Unk00; - reg_CP_DIVCNT = 0; + u32 tmp = (u32)param0->Unk00->Unk00; + reg_CP_DIVCNT = 0; (*(vu32 *)REG_DIV_NUMER_ADDR) = tmp; - reg_CP_DIV_DENOM = 10; + reg_CP_DIV_DENOM = 10; while (reg_CP_DIVCNT & ((u32)®_CP_DIVCNT >> 0xb)) {} - u32 regaddr = (u32)®_CP_DIV_RESULT_L; + u32 regaddr = (u32)®_CP_DIV_RESULT_L; u32 divResult = *(u32 *)regaddr; while (reg_CP_DIVCNT & (regaddr >> 0xb)) {} @@ -154,10 +154,10 @@ void ov21_02254C5C(UnkStruct02254A6C *param0) { CopyToBgTilemapRect(param0->Unk04, 6, 3, 7, 4, 9, param0->Unk30, (u8)(divResult << 2), 0, 40, 9); CopyToBgTilemapRect(param0->Unk04, 6, 8, 7, 4, 9, param0->Unk30, (u8)(divRemRes << 2), 0, 40, 9); - tmp = param0->Unk00->Unk04; - reg_CP_DIVCNT = 0; + tmp = param0->Unk00->Unk04; + reg_CP_DIVCNT = 0; (*(vu32 *)REG_DIV_NUMER_ADDR) = tmp; - reg_CP_DIV_DENOM = 10; + reg_CP_DIV_DENOM = 10; while (reg_CP_DIVCNT & ((u32)®_CP_DIVCNT >> 0xb)) {} diff --git a/arm9/overlays/24/include/overlay_24.h b/arm9/overlays/24/include/overlay_24.h index e992c7f85..91f0d760a 100644 --- a/arm9/overlays/24/include/overlay_24.h +++ b/arm9/overlays/24/include/overlay_24.h @@ -8,12 +8,12 @@ typedef enum { TOUCH_TYPE_ERASE = 0, - TOUCH_TYPE_DRAW = 1, + TOUCH_TYPE_DRAW = 1, } TouchType; typedef enum { MEMO_PAD_PIXEL_TYPE_FILLED = 1, - MEMO_PAD_PIXEL_TYPE_EMPTY = 4, + MEMO_PAD_PIXEL_TYPE_EMPTY = 4, } MemoPadPixelType; typedef struct MemoPadDrawState { diff --git a/arm9/overlays/24/src/ov24_02254840.c b/arm9/overlays/24/src/ov24_02254840.c index 0c09d13ac..6477fafc9 100644 --- a/arm9/overlays/24/src/ov24_02254840.c +++ b/arm9/overlays/24/src/ov24_02254840.c @@ -39,15 +39,15 @@ BOOL ov24_0225489C(MemoPadAppHandler *appHandler, u32 arg1, u32 arg2, u32 arg3) static const u8 ov24_022550F8[] = { 0x18, 0x58, 0xB4, 0xCC, 0x68, 0xA8, 0xB4, 0xCC }; - appHandler->drawState.unk16E8 = arg3; + appHandler->drawState.unk16E8 = arg3; appHandler->drawState.touchType = TOUCH_TYPE_DRAW; if (ov24_02254CA0(&(appHandler->displayHandler), &(appHandler->drawState))) { - appHandler->unk0 = 0; - appHandler->unk1 = 0; - appHandler->unk2 = 0; + appHandler->unk0 = 0; + appHandler->unk1 = 0; + appHandler->unk2 = 0; appHandler->touchHeld = FALSE; - appHandler->unk16FC = ov20_02254130(ov24_022550F8, 2, ov24_02254960, appHandler, 8); - appHandler->unk16F8 = arg1; + appHandler->unk16FC = ov20_02254130(ov24_022550F8, 2, ov24_02254960, appHandler, 8); + appHandler->unk16F8 = arg1; return TRUE; } return FALSE; @@ -151,8 +151,8 @@ BOOL ov24_02254A70(MemoPadAppHandler *appHandler) { y = (y - 16) >> 1; if (appHandler->drawState.pixelData[x][y] != appHandler->drawState.touchType) { appHandler->drawState.pixelData[x][y] = appHandler->drawState.touchType; - appHandler->drawState.lastModifiedX = x; - appHandler->drawState.lastModifiedY = y; + appHandler->drawState.lastModifiedX = x; + appHandler->drawState.lastModifiedY = y; return TRUE; } } @@ -164,8 +164,8 @@ BOOL ov24_02254AD4(MemoPadAppHandler *appHandler) { u32 x, y; if (TouchScreen_GetTapState(&x, &y)) { if (((x - 16) < 156) & ((y - 16) < 150)) { - x = (x - 16) >> 1; - y = (y - 16) >> 1; + x = (x - 16) >> 1; + y = (y - 16) >> 1; appHandler->drawState.lastModifiedX = x; appHandler->drawState.lastModifiedY = y; return TRUE; @@ -197,8 +197,8 @@ void ov24_02254B20(MemoPadAppHandler *appHandler, u32 x0, u32 y0, u32 x1, u32 y1 if ((x0 < 0x4e) && ((u32)offset < 0x4b)) { if (appHandler->drawState.touchType != appHandler->drawState.pixelData[x0][offset]) { appHandler->drawState.pixelData[x0][offset] = appHandler->drawState.touchType; - appHandler->drawState.lastModifiedX = x0; - appHandler->drawState.lastModifiedY = offset; + appHandler->drawState.lastModifiedX = x0; + appHandler->drawState.lastModifiedY = offset; ov24_02254D8C(appHandler->displayHandler, 3); } } @@ -220,8 +220,8 @@ void ov24_02254B20(MemoPadAppHandler *appHandler, u32 x0, u32 y0, u32 x1, u32 y1 if ((y0 < 0x4b) && ((u32)offset < 0x4e)) { if (appHandler->drawState.touchType != appHandler->drawState.pixelData[offset][y0]) { appHandler->drawState.pixelData[offset][y0] = appHandler->drawState.touchType; - appHandler->drawState.lastModifiedX = offset; - appHandler->drawState.lastModifiedY = y0; + appHandler->drawState.lastModifiedX = offset; + appHandler->drawState.lastModifiedY = y0; ov24_02254D8C(appHandler->displayHandler, 3); } } diff --git a/arm9/overlays/24/src/ov24_02254CA0.c b/arm9/overlays/24/src/ov24_02254CA0.c index ae3af749a..f9fab3f7f 100644 --- a/arm9/overlays/24/src/ov24_02254CA0.c +++ b/arm9/overlays/24/src/ov24_02254CA0.c @@ -35,8 +35,8 @@ BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState * ov20_022536F4(&(displayHandler->unk8), 0x10); GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN)); displayHandler->drawState = drawState; - displayHandler->config = ov20_02252D34(); - displayHandler->unk50 = ov20_02252D24(); + displayHandler->config = ov20_02252D34(); + displayHandler->unk50 = ov20_02252D24(); GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN)); *displayHandlerOut = displayHandler; return TRUE; @@ -46,12 +46,12 @@ BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState * BOOL ov24_02254D00(MemoPadDisplayHandler *displayHandler) { static const WindowTemplate template = { - .bgId = GF_BG_LYR_SUB_3, - .left = 2, - .top = 2, - .width = 20, - .height = 19, - .palette = 0, + .bgId = GF_BG_LYR_SUB_3, + .left = 2, + .top = 2, + .width = 20, + .height = 19, + .palette = 0, .baseTile = 12, }; displayHandler->window = AllocWindows(HEAP_ID_POKETCH_APP, 1); @@ -119,34 +119,34 @@ void ov24_02254DC8(void *arg0) { void ov24_02254DDC(void *arg0, void *arg1) { static const BgTemplate template_7000 = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0, - .baseTile = 0, - .size = 1, - .colorMode = 0, + .baseTile = 0, + .size = 1, + .colorMode = 0, .screenBase = GX_BG_SCRBASE_0x7000, - .charBase = GX_BG_CHARBASE_0x00000, - .bgExtPltt = 0, - .priority = 2, - .areaOver = 0, - .dummy = 0, - .mosaic = 0, + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = 0, + .priority = 2, + .areaOver = 0, + .dummy = 0, + .mosaic = 0, }; static const BgTemplate template_7800 = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0, - .size = 1, - .colorMode = 0, + .baseTile = 0, + .size = 1, + .colorMode = 0, .screenBase = GX_BG_SCRBASE_0x7800, - .charBase = GX_BG_CHARBASE_0x00000, - .bgExtPltt = 0, - .priority = 3, - .areaOver = 0, - .dummy = 0, - .mosaic = 0, + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = 0, + .priority = 3, + .areaOver = 0, + .dummy = 0, + .mosaic = 0, }; GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP)); GXSDispCnt dispcnt; @@ -191,12 +191,12 @@ void ov24_02254F28(s32 arg0, void *arg1) { void ov24_02254F40(u32 arg0, void *arg1) { MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1); - MemoPadDrawState *drawState = displayHandler->drawState; + MemoPadDrawState *drawState = displayHandler->drawState; if (drawState->touchType == TOUCH_TYPE_ERASE) { s32 width, height; width = height = 8; - s32 x = drawState->lastModifiedX * 2 - 4; - s32 y = drawState->lastModifiedY * 2 - 4; + s32 x = drawState->lastModifiedX * 2 - 4; + s32 y = drawState->lastModifiedY * 2 - 4; if (x < 0) { width += x; x = 0; @@ -215,10 +215,10 @@ void ov24_02254F40(u32 arg0, void *arg1) { } } else { s32 height = 2; - s32 width = 2; - s32 x = drawState->lastModifiedX * 2; - s32 y = drawState->lastModifiedY * 2; - s32 a = (x >> 3) + ((y >> 3) * 0x14); + s32 width = 2; + s32 x = drawState->lastModifiedX * 2; + s32 y = drawState->lastModifiedY * 2; + s32 a = (x >> 3) + ((y >> 3) * 0x14); FillWindowPixelRect(displayHandler->window, MEMO_PAD_PIXEL_TYPE_FILLED, x, y, width, height); GXS_LoadBG3Char((u8 *)(displayHandler->window->pixelBuffer) + a * 0x20, (a + 0xc) * 0x20, 0x20); } diff --git a/arm9/overlays/52/src/overlay_52.c b/arm9/overlays/52/src/overlay_52.c index a0aa4f840..adfa5e4f6 100644 --- a/arm9/overlays/52/src/overlay_52.c +++ b/arm9/overlays/52/src/overlay_52.c @@ -378,7 +378,7 @@ void ov52_021D7604(HeapID heapId, struct SaveData *save, BOOL set_trainerid) { sub_0206007C(save); PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(save); - u32 trainerid = MTRandom(); + u32 trainerid = MTRandom(); if (set_trainerid) { PlayerProfile_SetTrainerID(playerProfile, trainerid); diff --git a/arm9/overlays/59/src/ov59_Intro.c b/arm9/overlays/59/src/ov59_Intro.c index 826dcdc52..6499ca9f3 100644 --- a/arm9/overlays/59/src/ov59_Intro.c +++ b/arm9/overlays/59/src/ov59_Intro.c @@ -36,71 +36,71 @@ extern void *sub_02077A84(HeapID heapId, u32 param1, u32 param2, u32 param3, str extern void sub_0200E3A0(PMLCDTarget, int); const struct WindowTemplate ov59_021D9DB8 = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 2, - .top = 19, - .width = 27, - .height = 4, - .palette = 6, + .bgId = GF_BG_LYR_MAIN_0, + .left = 2, + .top = 19, + .width = 27, + .height = 4, + .palette = 6, .baseTile = 877, }; const struct WindowTemplate ov59_021D9DA8 = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 2, - .top = 3, - .width = 6, - .height = 4, - .palette = 5, + .bgId = GF_BG_LYR_MAIN_0, + .left = 2, + .top = 3, + .width = 6, + .height = 4, + .palette = 5, .baseTile = 853, }; const struct WindowTemplate ov59_021D9DB0 = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 1, - .top = 3, - .width = 16, - .height = 6, - .palette = 5, + .bgId = GF_BG_LYR_MAIN_0, + .left = 1, + .top = 3, + .width = 16, + .height = 6, + .palette = 5, .baseTile = 781, }; const struct WindowTemplate ov59_021D9D90 = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 8, - .top = 0, - .width = 24, - .height = 24, - .palette = 5, + .bgId = GF_BG_LYR_MAIN_0, + .left = 8, + .top = 0, + .width = 24, + .height = 24, + .palette = 5, .baseTile = 301, }; const struct WindowTemplate ov59_021D9D98 = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 4, - .top = 0, - .width = 24, - .height = 24, - .palette = 5, + .bgId = GF_BG_LYR_MAIN_0, + .left = 4, + .top = 0, + .width = 24, + .height = 24, + .palette = 5, .baseTile = 301, }; const struct WindowTemplate ov59_021D9DA0 = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 2, - .top = 3, - .width = 14, - .height = 10, - .palette = 5, + .bgId = GF_BG_LYR_MAIN_0, + .left = 2, + .top = 3, + .width = 14, + .height = 10, + .palette = 5, .baseTile = 737, }; const u32 ov59_021D9DC0[3] = { NARC_intro_pokeball_button_2_NCGR, NARC_intro_pokeball_button_3_NCGR, 0xFFFF }; const struct GraphicsModes ov59_021D9DCC = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D }; @@ -108,7 +108,7 @@ const struct OverlayManagerTemplate ov59_021D9DDC = { .initFunc = ov59_TVInit, .mainFunc = ov59_TVMain, .exitFunc = ov59_TVExit, - .ovly = SDK_OVERLAY_INVALID_ID + .ovly = SDK_OVERLAY_INVALID_ID }; const struct ov59_CharStruct021D9DEC ov59_021D9DEC = { @@ -154,61 +154,61 @@ const struct ov59_CharStruct021D9E70 ov59_021D9E88 = { }; const struct BgTemplate ov59_021D9EA0 = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 2048, - .baseTile = 0, + .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x00000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE }; const struct BgTemplate ov59_021D9EBC = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 2048, - .baseTile = 0, + .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x00000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 0, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 0, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE }; const u16 ov59_021D9ED8[0x10] = { 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C, 0x6A3C }; const struct ListMenuTemplate ov59_021D9EF8 = { - .items = NULL, - .moveCursorFunc = NULL, - .itemPrintFunc = NULL, - .window = NULL, - .totalItems = 0, - .maxShowed = 0, - .header_X = 0, - .item_X = 12, - .cursor_X = 0, - .upText_Y = 0, - .cursorPal = 1, - .fillValue = 15, - .cursorShadowPal = 2, - .lettersSpacing = 0, + .items = NULL, + .moveCursorFunc = NULL, + .itemPrintFunc = NULL, + .window = NULL, + .totalItems = 0, + .maxShowed = 0, + .header_X = 0, + .item_X = 12, + .cursor_X = 0, + .upText_Y = 0, + .cursorPal = 1, + .fillValue = 15, + .cursorShadowPal = 2, + .lettersSpacing = 0, .itemVerticalPadding = 0, - .scrollMultiple = 0, - .fontId = 0, - .cursorKind = 0, - .unk_1C = 0 + .scrollMultiple = 0, + .fontId = 0, + .cursorKind = 0, + .unk_1C = 0 }; const struct ov59_ListStruct021D9E0C ov59_021D9F40[5] = { @@ -238,50 +238,50 @@ const struct ov59_ListStruct021D9E0C ov59_021D9F68[5] = { }; const struct GraphicsBanks ov59_021D9F18 = { - .bg = GX_VRAM_BG_128_B, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_128_C, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_NONE, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_NONE, + .bg = GX_VRAM_BG_128_B, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_128_C, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_NONE, - .texpltt = GX_VRAM_TEXPLTT_NONE + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE }; const struct ov59_GraphicsPaletteMap021D9F90 ov59_021D9F90 = { .map = { - { .charNum = 0, + { .charNum = 0, .palNum = 0 }, // rowan sprite { .charNum = NARC_intro_rowan_front_NCGR, - .palNum = NARC_intro_rowan_front_NCLR }, + .palNum = NARC_intro_rowan_front_NCLR }, // boy sprites { .charNum = NARC_intro_lucas_walk_1_NCGR, - .palNum = NARC_intro_lucas_walk_NCLR }, - { .charNum = NARC_intro_lucas_walk_2_NCGR, .palNum = NARC_intro_lucas_walk_NCLR }, - { .charNum = NARC_intro_lucas_walk_3_NCGR, + { .charNum = NARC_intro_lucas_walk_2_NCGR, .palNum = NARC_intro_lucas_walk_NCLR }, - { .charNum = NARC_intro_lucas_walk_4_NCGR, + { .charNum = NARC_intro_lucas_walk_3_NCGR, + .palNum = NARC_intro_lucas_walk_NCLR }, + { .charNum = NARC_intro_lucas_walk_4_NCGR, .palNum = NARC_intro_lucas_walk_NCLR }, // girl sprites { .charNum = NARC_intro_dawn_walk_1_NCGR, - .palNum = NARC_intro_dawn_walk_NCLR }, - { .charNum = NARC_intro_dawn_walk_2_NCGR, .palNum = NARC_intro_dawn_walk_NCLR }, - { .charNum = NARC_intro_dawn_walk_3_NCGR, + { .charNum = NARC_intro_dawn_walk_2_NCGR, + .palNum = NARC_intro_dawn_walk_NCLR }, + { .charNum = NARC_intro_dawn_walk_3_NCGR, .palNum = NARC_intro_dawn_walk_NCLR }, - { .charNum = NARC_intro_dawn_walk_4_NCGR, + { .charNum = NARC_intro_dawn_walk_4_NCGR, .palNum = NARC_intro_dawn_walk_NCLR }, // barry sprite { .charNum = NARC_intro_barry_front_NCGR, - .palNum = NARC_intro_barry_front_NCLR } } + .palNum = NARC_intro_barry_front_NCLR } } }; const u8 ov59_021D9FE8[0x64] = { @@ -316,25 +316,25 @@ BOOL ov59_IntroInit(struct OverlayManager *overlayManager, u32 *status) { ov59_IntroOverlayData *data = (ov59_IntroOverlayData *)OverlayManager_CreateAndGetData(overlayManager, sizeof(ov59_IntroOverlayData), HEAP_ID_INTRO); memset((void *)data, 0, sizeof(ov59_IntroOverlayData)); - data->heapId = HEAP_ID_INTRO; - s32 *field18 = OverlayManager_GetField18(overlayManager); - data->save = (struct SaveData *)field18[2]; //? - data->options = Save_PlayerData_GetOptionsAddr(data->save); + data->heapId = HEAP_ID_INTRO; + s32 *field18 = OverlayManager_GetField18(overlayManager); + data->save = (struct SaveData *)field18[2]; //? + data->options = Save_PlayerData_GetOptionsAddr(data->save); data->nextControllerCounter = data->controllerCounter = 0; - data->loadedOverlay = NULL; - data->playerStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 0, 0, 7, data->options); - data->rivalStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 3, 0, 7, data->options); - data->scrnDataIndexMain = 0; - data->spriteDataIndex0 = 0; - data->spriteDataIndex1 = 0; - data->scrnDataIndexSub = 0; - data->tickTimer = 0; + data->loadedOverlay = NULL; + data->playerStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 0, 0, 7, data->options); + data->rivalStruct = (struct ov59_UnkPlayerStruct *)sub_02077A84(HEAP_ID_INTRO, 3, 0, 7, data->options); + data->scrnDataIndexMain = 0; + data->spriteDataIndex0 = 0; + data->spriteDataIndex1 = 0; + data->scrnDataIndexSub = 0; + data->tickTimer = 0; return TRUE; } BOOL ov59_IntroMain(struct OverlayManager *overlayManager, u32 *status) { ov59_IntroOverlayData *data = (ov59_IntroOverlayData *)OverlayManager_GetData(overlayManager); - BOOL ret = FALSE; + BOOL ret = FALSE; switch (*status) { case 0: @@ -481,23 +481,23 @@ void ov59_IntroSetupBg(ov59_IntroOverlayData *data) { SetBothScreensModesAndDisable(&graphicsModes); struct BgTemplate bgTemplateMain = ov59_021D9EA0; - bgTemplateMain.screenBase = GX_BG_SCRBASE_0x7800; - bgTemplateMain.charBase = GX_BG_CHARBASE_0x18000; + bgTemplateMain.screenBase = GX_BG_SCRBASE_0x7800; + bgTemplateMain.charBase = GX_BG_CHARBASE_0x18000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_0, &bgTemplateMain, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_0); bgTemplateMain.screenBase = GX_BG_SCRBASE_0x7000; - bgTemplateMain.charBase = GX_BG_CHARBASE_0x14000; + bgTemplateMain.charBase = GX_BG_CHARBASE_0x14000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_1, &bgTemplateMain, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_1); bgTemplateMain.screenBase = GX_BG_SCRBASE_0x6800; - bgTemplateMain.charBase = GX_BG_CHARBASE_0x10000; + bgTemplateMain.charBase = GX_BG_CHARBASE_0x10000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_2, &bgTemplateMain, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_2); bgTemplateMain.screenBase = GX_BG_SCRBASE_0x6000; - bgTemplateMain.charBase = GX_BG_CHARBASE_0x0c000; + bgTemplateMain.charBase = GX_BG_CHARBASE_0x0c000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_MAIN_3, &bgTemplateMain, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_3); @@ -507,23 +507,23 @@ void ov59_IntroSetupBg(ov59_IntroOverlayData *data) { LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_6_OFFSET, data->heapId); struct BgTemplate bgTemplateSub = ov59_021D9EBC; - bgTemplateSub.screenBase = GX_BG_SCRBASE_0x7800; - bgTemplateSub.charBase = GX_BG_CHARBASE_0x18000; + bgTemplateSub.screenBase = GX_BG_SCRBASE_0x7800; + bgTemplateSub.charBase = GX_BG_CHARBASE_0x18000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_0, &bgTemplateSub, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_0); bgTemplateSub.screenBase = GX_BG_SCRBASE_0x7000; - bgTemplateSub.charBase = GX_BG_CHARBASE_0x14000; + bgTemplateSub.charBase = GX_BG_CHARBASE_0x14000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_1, &bgTemplateSub, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_1); bgTemplateSub.screenBase = GX_BG_SCRBASE_0x6800; - bgTemplateSub.charBase = GX_BG_CHARBASE_0x10000; + bgTemplateSub.charBase = GX_BG_CHARBASE_0x10000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_2, &bgTemplateSub, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_2); bgTemplateSub.screenBase = GX_BG_SCRBASE_0x6000; - bgTemplateSub.charBase = GX_BG_CHARBASE_0x0c000; + bgTemplateSub.charBase = GX_BG_CHARBASE_0x0c000; InitBgFromTemplate(data->bgConfig, GF_BG_LYR_SUB_3, &bgTemplateSub, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_3); @@ -574,9 +574,9 @@ void ov59_IntroSetupMsg(ov59_IntroOverlayData *data) { data->messageFormat = MessageFormat_New(data->heapId); - data->displayMessageCounter = 0; + data->displayMessageCounter = 0; data->displayControlMessageCounter = 0; - data->createListCounter = 0; + data->createListCounter = 0; } void ov59_IntroDestroyMsg(ov59_IntroOverlayData *data) { @@ -673,10 +673,10 @@ BOOL ov59_FadeController(ov59_IntroOverlayData *data, u32 bgId, u32 param2) { } break; case 3: - reg_G2_BLDCNT = 0; + reg_G2_BLDCNT = 0; reg_G2S_DB_BLDCNT = 0; data->fadeCounter = 0; - ret = TRUE; + ret = TRUE; break; } return ret; @@ -710,15 +710,15 @@ BOOL ov59_DisplayMessage(ov59_IntroOverlayData *data, u32 msgNo, BOOL autoAdvanc sub_02002B7C(0); struct String *string = String_New(1024, data->heapId); - data->string = String_New(1024, data->heapId); + data->string = String_New(1024, data->heapId); ReadMsgDataIntoString(data->msgData, msgNo, string); BufferString(data->messageFormat, 0, data->playerStruct->name, data->selectedGender, 1, 2); BufferString(data->messageFormat, 1, data->rivalStruct->name, 0, 1, 2); StringExpandPlaceholders(data->messageFormat, data->string, string); String_Delete(string); - u32 delay = Options_GetTextFrameDelay(data->options); - data->minTextSpacing = AddTextPrinterParameterized(&data->window, 1, data->string, 0, 0, delay, NULL); + u32 delay = Options_GetTextFrameDelay(data->options); + data->minTextSpacing = AddTextPrinterParameterized(&data->window, 1, data->string, 0, 0, delay, NULL); data->displayMessageCounter = 1; break; case 1: @@ -732,7 +732,7 @@ BOOL ov59_DisplayMessage(ov59_IntroOverlayData *data, u32 msgNo, BOOL autoAdvanc if (autoAdvance != FALSE || (gSystem.newKeys & PAD_BUTTON_A) == 1) { RemoveWindow(&data->window); data->displayMessageCounter = 0; - ret = TRUE; + ret = TRUE; break; } } @@ -759,21 +759,21 @@ BOOL ov59_CreateListWithText(ov59_IntroOverlayData *data, u32 param1, u32 param2 default: case 0: windowTemplate = &ov59_021D9DA8; - listStruct = ov59_021D9E0C; + listStruct = ov59_021D9E0C; menuItemsCount = 2; break; case 1: windowTemplate = &ov59_021D9DB0; - listStruct = ov59_021D9E58; + listStruct = ov59_021D9E58; menuItemsCount = 3; break; case 2: windowTemplate = &ov59_021D9DA0; if ((u8)gGameVersion == VERSION_DIAMOND) { - listStruct = ov59_021D9F40; + listStruct = ov59_021D9F40; menuItemsCount = 5; } else { - listStruct = ov59_021D9F68; + listStruct = ov59_021D9F68; menuItemsCount = 5; } break; @@ -784,12 +784,12 @@ BOOL ov59_CreateListWithText(ov59_IntroOverlayData *data, u32 param1, u32 param2 ListMenuItems_AppendFromMsgData(data->listMenuItem, data->msgData, listStruct[i].msgNo, listStruct[i].val); } struct ListMenuTemplate template = ov59_021D9EF8; - template.items = data->listMenuItem; - template.totalItems = (u16)menuItemsCount; - template.maxShowed = (u16)menuItemsCount; - template.moveCursorFunc = ov59_PlaySelectSound; - template.window = &data->listWindow; - data->listMenu = ListMenuInit(&template, 0, 0, data->heapId); + template.items = data->listMenuItem; + template.totalItems = (u16)menuItemsCount; + template.maxShowed = (u16)menuItemsCount; + template.moveCursorFunc = ov59_PlaySelectSound; + template.window = &data->listWindow; + data->listMenu = ListMenuInit(&template, 0, 0, data->heapId); DrawFrameAndWindow1(template.window, TRUE, 985, 3); CopyWindowToVram(&data->listWindow); data->createListCounter = 1; @@ -805,7 +805,7 @@ BOOL ov59_CreateListWithText(ov59_IntroOverlayData *data, u32 param1, u32 param2 ListMenuItems_Delete(data->listMenuItem); PlaySE(SEQ_SE_DP_SELECT); data->createListCounter = 0; - ret = TRUE; + ret = TRUE; } return ret; } @@ -819,16 +819,16 @@ BOOL ov59_DisplayControlAdventureMessage(ov59_IntroOverlayData *data, u32 msgNo, ReadMsgDataIntoString(data->msgData, msgNo, data->string); struct WindowTemplate template; if (param2 == 1) { - template = ov59_021D9D98; - u32 count = sub_02002F90(data->string); - template.top = (u8)(12 - count); + template = ov59_021D9D98; + u32 count = sub_02002F90(data->string); + template.top = (u8)(12 - count); template.height = (u8)(count * 2); AddWindow(data->bgConfig, &data->window, &template); FillWindowPixelRect(&data->window, 0, 0, 0, 192, 192); AddTextPrinterParameterized2(&data->window, 0, data->string, 0, 0, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(1, 2, 0), NULL); } else { - template = ov59_021D9D90; - template.top = (u8)tilemapTop; + template = ov59_021D9D90; + template.top = (u8)tilemapTop; template.height = (u8)height; AddWindow(data->bgConfig, &data->window, &template); FillWindowPixelRect(&data->window, 0, 0, 0, 192, 192); @@ -862,7 +862,7 @@ BOOL ov59_DisplayControlAdventureMessage(ov59_IntroOverlayData *data, u32 msgNo, RemoveWindow(&data->window); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_0); data->displayControlMessageCounter = 0; - ret = TRUE; + ret = TRUE; } return ret; } @@ -876,10 +876,10 @@ void ov59_LoadInitialTilemap(ov59_IntroOverlayData *data) { u32 subPal; if ((u8)gGameVersion == VERSION_DIAMOND) { mainPal = NARC_intro_main_background_diamond_NCLR; - subPal = NARC_intro_sub_background_diamond_NCLR; + subPal = NARC_intro_sub_background_diamond_NCLR; } else { mainPal = NARC_intro_main_background_pearl_NCLR; - subPal = NARC_intro_sub_background_pearl_NCLR; + subPal = NARC_intro_sub_background_pearl_NCLR; } GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, mainPal, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_0_OFFSET, 0x60, data->heapId); GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, subPal, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_0_OFFSET, 0xa0, data->heapId); @@ -1150,10 +1150,10 @@ BOOL ov59_MoveSprite(ov59_IntroOverlayData *data, enum GFBgLayer layer, u32 para } void ov59_ResetPlayerAnimation(ov59_IntroOverlayData *data) { - data->maleAnimCounter = 0; - data->maleAnimTimer = 0; + data->maleAnimCounter = 0; + data->maleAnimTimer = 0; data->femaleAnimCounter = 0; - data->femaleAnimTimer = 0; + data->femaleAnimTimer = 0; } void ov59_AnimatePlayerSprite(ov59_IntroOverlayData *data) { @@ -1210,10 +1210,10 @@ BOOL ov59_PlayerShrinkAnimation(ov59_IntroOverlayData *data) { const struct ov59_CharStruct021D9E70 *addr; if (data->selectedGender == PLAYER_GENDER_MALE) { charStruct = ov59_021D9E88; - addr = &charStruct; + addr = &charStruct; } else { charStruct2 = ov59_021D9E70; - addr = &charStruct2; + addr = &charStruct2; } if (addr->charData[data->spriteDataIndex2] == 0xFF) { ret = TRUE; @@ -1237,15 +1237,15 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) { data->unkA8 = 0; data->unkAC = 8; data->unkB0 = 0; - *param1 = 1; + *param1 = 1; break; case 1: Bg_GetXpos(data->bgConfig, GF_BG_LYR_MAIN_2); // result discarded? fx32 pos = Bg_GetYpos(data->bgConfig, GF_BG_LYR_SUB_1); - b0 = data->unkB0; - ac = data->unkAC; - u32 unk = b0 * (ac + ac * 8); + b0 = data->unkB0; + ac = data->unkAC; + u32 unk = b0 * (ac + ac * 8); s32 unk2 = b0 * (b0 + b0 * 8); s32 unk3 = unk - unk2 / 2; // some kind of Y coordinate @@ -1258,7 +1258,7 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) { } else { ToggleBgLayer(GF_BG_LYR_SUB_1, GX_PLANE_TOGGLE_OFF); data->unkB0 = 30; - *param1 = 2; + *param1 = 2; } break; case 2: @@ -1269,15 +1269,15 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) { data->unkA8 = 0; data->unkAC = 9; data->unkB0 = 0; - *param1 = 3; + *param1 = 3; } break; case 3: Bg_GetXpos(data->bgConfig, GF_BG_LYR_MAIN_2); // result discarded? fx32 pos2 = Bg_GetYpos(data->bgConfig, GF_BG_LYR_MAIN_2); - b0 = data->unkB0; - ac = data->unkAC; + b0 = data->unkB0; + ac = data->unkAC; u32 unk4 = b0 * (ac + ac * 8); s32 unk5 = b0 * (b0 + b0 * 8); @@ -1288,7 +1288,7 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) { data->unkA8 = 0; data->unkAC = 1; data->unkB0 = 0; - *param1 = 4; + *param1 = 4; } else { data->unkB0++; data->unkA8 = unk6; @@ -1304,8 +1304,8 @@ BOOL ov59_MunchlaxJumpAnimation(ov59_IntroOverlayData *data, u32 *param1) { Bg_GetXpos(data->bgConfig, GF_BG_LYR_MAIN_2); // result discarded? fx32 pos3 = Bg_GetYpos(data->bgConfig, GF_BG_LYR_MAIN_2); - b0 = data->unkB0; - ac = data->unkAC; + b0 = data->unkB0; + ac = data->unkAC; u32 unk8 = b0 * (ac + ac * 8); s32 unk9 = b0 * (b0 + b0 * 8); @@ -1705,12 +1705,12 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) { switch (data->listMenuInput) { case 1: // Control Info data->nextControllerCounter = 10; - data->controllerCounter = 8; + data->controllerCounter = 8; break; case 2: // Adventure Info data->nextControllerCounter = 31; - data->controllerCounter = 8; + data->controllerCounter = 8; BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_0); break; @@ -2206,7 +2206,7 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) { if (ov59_DisplayMessage(data, narc_0341_00021, TRUE) != TRUE) { break; } - data->selectedGender = PLAYER_GENDER_MALE; + data->selectedGender = PLAYER_GENDER_MALE; data->controllerCounter = 67; break; @@ -2301,8 +2301,8 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) { case 76: // load keyboard overlay (except this is not an overlay at all) data->playerStruct->gender = data->selectedGender; - data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->playerStruct, data->heapId); - data->controllerCounter = 77; + data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->playerStruct, data->heapId); + data->controllerCounter = 77; break; case 77: // toggle bg layers and position, fade from black @@ -2344,14 +2344,14 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) { switch (data->listMenuInput) { case 1: data->nextControllerCounter = 82; - data->controllerCounter = 81; + data->controllerCounter = 81; break; case -2: case 2: String_SetEmpty(data->playerStruct->name); data->nextControllerCounter = 63; - data->controllerCounter = 81; + data->controllerCounter = 81; break; } break; @@ -2440,13 +2440,13 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) { u32 index; u32 msgNo; if ((u8)gGameVersion == VERSION_DIAMOND) { - index = data->listMenuInput - 1; + index = data->listMenuInput - 1; nameList = ov59_021D9F40; - msgNo = nameList[index].msgNo; + msgNo = nameList[index].msgNo; } else { - index = data->listMenuInput - 1; + index = data->listMenuInput - 1; nameList = ov59_021D9F68; - msgNo = nameList[index].msgNo; + msgNo = nameList[index].msgNo; } struct String *name = NewString_ReadMsgData(data->msgData, msgNo); StringCopy(data->rivalStruct->name, name); @@ -2464,7 +2464,7 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) { break; case 92: // load keyboard - data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->rivalStruct, data->heapId); + data->loadedOverlay = OverlayManager_New(&UNK_020FA5FC, (s32 *)data->rivalStruct, data->heapId); data->controllerCounter = 93; break; @@ -2597,7 +2597,7 @@ BOOL ov59_MasterController(ov59_IntroOverlayData *data) { break; case 108: // load overaly 59 TV - data->loadedOverlay = OverlayManager_New(&ov59_021D9DDC, 0, data->heapId); + data->loadedOverlay = OverlayManager_New(&ov59_021D9DDC, 0, data->heapId); data->controllerCounter = 109; break; diff --git a/arm9/overlays/59/src/ov59_TV.c b/arm9/overlays/59/src/ov59_TV.c index 3d95ace4c..19f6643a4 100644 --- a/arm9/overlays/59/src/ov59_TV.c +++ b/arm9/overlays/59/src/ov59_TV.c @@ -26,101 +26,101 @@ extern void BeginNormalPaletteFade(u32 pattern, u32 typeTop, u32 typeBottom, u16 extern BOOL IsPaletteFadeFinished(void); const struct WindowTemplate ov59_021DA04C = { - .bgId = GF_BG_LYR_MAIN_2, - .left = 0, - .top = 0, - .width = 32, - .height = 24, - .palette = 1, + .bgId = GF_BG_LYR_MAIN_2, + .left = 0, + .top = 0, + .width = 32, + .height = 24, + .palette = 1, .baseTile = 1, }; const struct GraphicsModes ov59_021DA054 = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D, }; const struct BgTemplate ov59_021DA080 = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 2048, - .baseTile = 0, + .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x18000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE }; const struct BgTemplate ov59_021DA09C = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 2048, - .baseTile = 0, + .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0800, - .charBase = GX_BG_CHARBASE_0x14000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x14000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE }; const struct BgTemplate ov59_021DA064 = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 2048, - .baseTile = 0, + .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x1000, - .charBase = GX_BG_CHARBASE_0x10000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x10000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE }; const struct BgTemplate ov59_021DA0B8 = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 2048, - .baseTile = 0, + .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_256, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_256, .screenBase = GX_BG_SCRBASE_0x1800, - .charBase = GX_BG_CHARBASE_0x20000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x20000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE }; const struct GraphicsBanks ov59_021DA0D4 = { - .bg = GX_VRAM_BG_256_AB, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_NONE, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_NONE, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_NONE, + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_NONE, - .texpltt = GX_VRAM_TEXPLTT_NONE + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE }; BOOL ov59_TVInit(struct OverlayManager *overlayManager, u32 *status) { @@ -129,13 +129,13 @@ BOOL ov59_TVInit(struct OverlayManager *overlayManager, u32 *status) { ov59_TVOverlayData *data = (ov59_TVOverlayData *)OverlayManager_CreateAndGetData(overlayManager, sizeof(ov59_TVOverlayData), HEAP_ID_INTRO_TV); memset((void *)data, 0, sizeof(ov59_TVOverlayData)); data->heapId = HEAP_ID_INTRO_TV; - data->unk24 = 0; + data->unk24 = 0; return TRUE; } BOOL ov59_TVMain(struct OverlayManager *overlayManager, u32 *status) { ov59_TVOverlayData *data = (ov59_TVOverlayData *)OverlayManager_GetData(overlayManager); - BOOL ret = FALSE; + BOOL ret = FALSE; switch (*status) { case 0: @@ -357,7 +357,7 @@ BOOL ov59_021D9C74(ov59_TVOverlayData *data, u32 msgNo, u32 param2, u32 param3) RemoveWindow(&data->window); BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_MAIN_2); data->unk0C = 0; - ret = TRUE; + ret = TRUE; break; } return ret; diff --git a/arm9/overlays/63/src/ov63_021DB450.c b/arm9/overlays/63/src/ov63_021DB450.c index 48262eb8a..e3ee0a33b 100644 --- a/arm9/overlays/63/src/ov63_021DB450.c +++ b/arm9/overlays/63/src/ov63_021DB450.c @@ -164,7 +164,7 @@ BOOL ov63_021DB5CC(UnkStruct63_021DB450 *param0, u32 param1, s32 param2) { param0->field_1D++; if (param0->field_1D >= 20) { param0->field_1D = 0; - *state = 0; + *state = 0; return TRUE; } break; @@ -263,11 +263,11 @@ void ov63_021DB934(void) { void ov63_021DB940(struct UnkStruct63_021DB450 *a0) { struct UnkStruct_02006D98_2 *r4 = sub_0201341C(a0); - int sp0[3] = { 0, 0, 0 }; - sp0[0] = (sub_0200782C(r4, 0) - 0x80) * 0xAC; - sp0[1] = (sub_0200782C(r4, 1) - 0x60) * 0xAC; - sp0[2] = 0x40; - a0->field_28 = sp0[0] + (*a0->field_20)[1]; - a0->field_2C = sp0[1] + (*a0->field_20)[2]; - a0->field_30 = sp0[2] + (*a0->field_20)[3]; + int sp0[3] = { 0, 0, 0 }; + sp0[0] = (sub_0200782C(r4, 0) - 0x80) * 0xAC; + sp0[1] = (sub_0200782C(r4, 1) - 0x60) * 0xAC; + sp0[2] = 0x40; + a0->field_28 = sp0[0] + (*a0->field_20)[1]; + a0->field_2C = sp0[1] + (*a0->field_20)[2]; + a0->field_30 = sp0[2] + (*a0->field_20)[3]; } diff --git a/arm9/src/ascii_util.c b/arm9/src/ascii_util.c index 55a4d7951..9aca6f513 100644 --- a/arm9/src/ascii_util.c +++ b/arm9/src/ascii_util.c @@ -29,7 +29,7 @@ s32 Ascii_StrToL(const s8 *str) { s32 length = Ascii_StrLen(str); s32 i; s32 pow10 = 1; - s32 num = 0; + s32 num = 0; // Traverse from right to left for (i = length - 1; i >= 0; i--) { diff --git a/arm9/src/bag.c b/arm9/src/bag.c index 2b8a0dc35..b108276f1 100644 --- a/arm9/src/bag.c +++ b/arm9/src/bag.c @@ -48,35 +48,35 @@ static u32 Bag_GetItemPocket(Bag *bag, u16 itemId, ItemSlot **itemSlots, u32 *co switch (pocket) { case POCKET_KEY_ITEMS: *itemSlots = bag->keyItems; - *countPtr = NUM_BAG_KEY_ITEMS; + *countPtr = NUM_BAG_KEY_ITEMS; break; case POCKET_ITEMS: *itemSlots = bag->items; - *countPtr = NUM_BAG_ITEMS; + *countPtr = NUM_BAG_ITEMS; break; case POCKET_BERRIES: *itemSlots = bag->berries; - *countPtr = NUM_BAG_BERRIES; + *countPtr = NUM_BAG_BERRIES; break; case POCKET_MEDICINE: *itemSlots = bag->medicine; - *countPtr = NUM_BAG_MEDICINE; + *countPtr = NUM_BAG_MEDICINE; break; case POCKET_BALLS: *itemSlots = bag->balls; - *countPtr = NUM_BAG_BALLS; + *countPtr = NUM_BAG_BALLS; break; case POCKET_BATTLE_ITEMS: *itemSlots = bag->battleItems; - *countPtr = NUM_BAG_BATTLE_ITEMS; + *countPtr = NUM_BAG_BATTLE_ITEMS; break; case POCKET_MAIL: *itemSlots = bag->mail; - *countPtr = NUM_BAG_MAIL; + *countPtr = NUM_BAG_MAIL; break; case POCKET_TMHMS: *itemSlots = bag->TMsHMs; - *countPtr = NUM_BAG_TMS_HMS; + *countPtr = NUM_BAG_TMS_HMS; break; } return pocket; @@ -252,8 +252,8 @@ u16 Pocket_GetQuantity(ItemSlot *slots, u32 count, u16 itemId) { static void SwapItemSlots(ItemSlot *a, ItemSlot *b) { ItemSlot c = *a; - *a = *b; - *b = c; + *a = *b; + *b = c; } static void PocketCompaction(ItemSlot *slots, u32 count) { @@ -367,7 +367,7 @@ BagCursor *BagCursor_New(HeapID heapId) { void BagCursor_Field_PocketGetPosition(BagCursor *cursor, u32 pocket, u8 *position, u8 *scroll) { *position = cursor->field.position[pocket]; - *scroll = cursor->field.scroll[pocket]; + *scroll = cursor->field.scroll[pocket]; } u16 BagCursor_Field_GetPocket(BagCursor *cursor) { @@ -376,7 +376,7 @@ u16 BagCursor_Field_GetPocket(BagCursor *cursor) { void BagCursor_Field_PocketSetPosition(BagCursor *cursor, u32 pocket, u8 position, u8 scroll) { cursor->field.position[pocket] = position; - cursor->field.scroll[pocket] = scroll; + cursor->field.scroll[pocket] = scroll; } void BagCursor_Field_SetPocket(BagCursor *cursor, u16 pocket) { @@ -385,7 +385,7 @@ void BagCursor_Field_SetPocket(BagCursor *cursor, u16 pocket) { void BagCursor_Battle_PocketGetPosition(BagCursor *cursor, u32 pocket, u8 *position, u8 *scroll) { *position = cursor->battle.position[pocket]; - *scroll = cursor->battle.scroll[pocket]; + *scroll = cursor->battle.scroll[pocket]; } u16 BagCursor_Battle_GetLastUsedItem(BagCursor *cursor) { @@ -402,7 +402,7 @@ u16 BagCursor_Battle_GetPocket(BagCursor *cursor) { void BagCursor_Battle_PocketSetPosition(BagCursor *cursor, u32 pocket, u8 position, u8 scroll) { cursor->battle.position[pocket] = position; - cursor->battle.scroll[pocket] = scroll; + cursor->battle.scroll[pocket] = scroll; } void BagCursor_Battle_Init(BagCursor *cursor) { @@ -413,7 +413,7 @@ void BagCursor_Battle_Init(BagCursor *cursor) { } void BagCursor_Battle_SetLastUsedItem(BagCursor *cursor, u16 itemId, u16 pocket) { - cursor->battle.lastUsedItem = itemId; + cursor->battle.lastUsedItem = itemId; cursor->battle.lastUsedPocket = pocket; } diff --git a/arm9/src/bag_view.c b/arm9/src/bag_view.c index 6a4f3d282..a3a27e2e2 100644 --- a/arm9/src/bag_view.c +++ b/arm9/src/bag_view.c @@ -48,12 +48,12 @@ void sub_0206E314(BagView *bagView, SaveData *save, u8 r2, BagCursor *cursor) { sub_0206E30C(bagView, r2); bagView->saveData = save; - bagView->cursor = cursor; - bagView->unk66 = 0; + bagView->cursor = cursor; + bagView->unk66 = 0; } void BagView_SetItem(BagView *bagView, ItemSlot *slot, u8 pocket, u8 idx) { - bagView->pockets[idx].slot = slot; + bagView->pockets[idx].slot = slot; bagView->pockets[idx].pocket = pocket; } @@ -118,7 +118,7 @@ static u32 GetNumBattlePoints(SaveData *saveData) { } BOOL TryFormatRegisteredKeyItemUseMessage(SaveData *saveData, String *dest, u32 itemId, HeapID heapId) { - MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0007_bin, heapId); + MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0007_bin, heapId); MessageFormat *messageFormat = MessageFormat_New(heapId); String *string; @@ -169,9 +169,9 @@ void GetItemUseErrorMessage(PlayerProfile *playerProfile, String *dest, u16 item break; default: // Rowan’s words echoed... {STRVAR_1 3, 0}! There’s a time and place for everything! But not now. - msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0199_bin, heapId); + msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0199_bin, heapId); MessageFormat *messageFormat = MessageFormat_New(heapId); - String *src = NewString_ReadMsgData(msgData, narc_0199_00036); + String *src = NewString_ReadMsgData(msgData, narc_0199_00036); BufferPlayersName(messageFormat, 0, playerProfile); StringExpandPlaceholders(messageFormat, dest, src); String_Delete(src); diff --git a/arm9/src/bg_window.c b/arm9/src/bg_window.c index 4b716e64d..200618c37 100644 --- a/arm9/src/bg_window.c +++ b/arm9/src/bg_window.c @@ -46,11 +46,11 @@ static void Bg_SetAffinePos(Background *bg, enum BgPosAdjustOp op, fx32 val); static void ApplyFlipFlagsToTile(BgConfig *bgConfig, u8 flags, u8 *tile); static const u8 sTilemapWidthByBufferSize[] = { - [GF_BG_SCR_SIZE_128x128] = 0x10, - [GF_BG_SCR_SIZE_256x256] = 0x20, - [GF_BG_SCR_SIZE_256x512] = 0x20, - [GF_BG_SCR_SIZE_512x256] = 0x20, - [GF_BG_SCR_SIZE_512x512] = 0x20, + [GF_BG_SCR_SIZE_128x128] = 0x10, + [GF_BG_SCR_SIZE_256x256] = 0x20, + [GF_BG_SCR_SIZE_256x512] = 0x20, + [GF_BG_SCR_SIZE_512x256] = 0x20, + [GF_BG_SCR_SIZE_512x512] = 0x20, [GF_BG_SCR_SIZE_1024x1024] = 0x20, }; @@ -95,8 +95,8 @@ static void (*const sClearWindowTilemapFuncs[])(Window *) = { BgConfig *BgConfig_Alloc(HeapID heapId) { BgConfig *ret = AllocFromHeap(heapId, sizeof(BgConfig)); memset(ret, 0, sizeof(BgConfig)); - ret->heapId = heapId; - ret->scrollScheduled = 0; // redundant to above memset + ret->heapId = heapId; + ret->scrollScheduled = 0; // redundant to above memset ret->bufferTransferScheduled = 0; // redundant to above memset return ret; } @@ -231,10 +231,10 @@ void InitBgFromTemplate(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, } bgConfig->bgs[bgId].rotation = 0; - bgConfig->bgs[bgId].xScale = FX32_ONE; - bgConfig->bgs[bgId].yScale = FX32_ONE; - bgConfig->bgs[bgId].centerX = 0; - bgConfig->bgs[bgId].centerY = 0; + bgConfig->bgs[bgId].xScale = FX32_ONE; + bgConfig->bgs[bgId].yScale = FX32_ONE; + bgConfig->bgs[bgId].centerX = 0; + bgConfig->bgs[bgId].centerY = 0; if (template->bufferSize != 0) { bgConfig->bgs[bgId].tilemapBuffer = AllocFromHeap(bgConfig->heapId, template->bufferSize); @@ -242,15 +242,15 @@ void InitBgFromTemplate(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, MI_CpuClear16(bgConfig->bgs[bgId].tilemapBuffer, template->bufferSize); bgConfig->bgs[bgId].bufferSize = template->bufferSize; - bgConfig->bgs[bgId].baseTile = template->baseTile; + bgConfig->bgs[bgId].baseTile = template->baseTile; } else { bgConfig->bgs[bgId].tilemapBuffer = NULL; - bgConfig->bgs[bgId].bufferSize = 0; - bgConfig->bgs[bgId].baseTile = 0; + bgConfig->bgs[bgId].bufferSize = 0; + bgConfig->bgs[bgId].baseTile = 0; } - bgConfig->bgs[bgId].size = template->size; - bgConfig->bgs[bgId].mode = bgMode; + bgConfig->bgs[bgId].size = template->size; + bgConfig->bgs[bgId].mode = bgMode; bgConfig->bgs[bgId].colorMode = template->colorMode; if (bgMode == GF_BG_TYPE_TEXT && template->colorMode == GX_BG_COLORMODE_16) { @@ -497,27 +497,27 @@ static u8 TranslateGFBgModePairToGXScreenSize(enum GFBgScreenSize size, enum GFB static void GetBgScreenDimensions(u32 screenSize, u8 *widthPtr, u8 *heightPtr) { switch (screenSize) { case GF_BG_SCR_SIZE_128x128: - *widthPtr = 0x10; + *widthPtr = 0x10; *heightPtr = 0x10; break; case GF_BG_SCR_SIZE_256x256: - *widthPtr = 0x20; + *widthPtr = 0x20; *heightPtr = 0x20; break; case GF_BG_SCR_SIZE_256x512: - *widthPtr = 0x20; + *widthPtr = 0x20; *heightPtr = 0x40; break; case GF_BG_SCR_SIZE_512x256: - *widthPtr = 0x40; + *widthPtr = 0x40; *heightPtr = 0x20; break; case GF_BG_SCR_SIZE_512x512: - *widthPtr = 0x40; + *widthPtr = 0x40; *heightPtr = 0x40; break; case GF_BG_SCR_SIZE_1024x1024: - *widthPtr = 0x80; + *widthPtr = 0x80; *heightPtr = 0x80; break; } @@ -733,7 +733,7 @@ void BgCopyOrUncompressTilemapBufferRangeToVram(BgConfig *bgConfig, u8 bgId, con } u32 uncompSize = MI_GetUncompressedSize(buffer); - void *ptr = AllocFromHeapAtEnd(bgConfig->heapId, uncompSize); + void *ptr = AllocFromHeapAtEnd(bgConfig->heapId, uncompSize); CopyOrUncompressTilemapData(buffer, ptr, bufferSize); LoadBgVramScr(bgId, ptr, baseTile * 2, uncompSize); FreeToHeap(ptr); @@ -787,7 +787,7 @@ void BG_LoadCharTilesData(BgConfig *bgConfig, u8 bgId, const void *data, u32 siz static void BG_LoadCharPixelData(BgConfig *bgConfig, u8 bgId, const void *buffer, u32 size, u32 offset) { if (size == 0) { - u32 uncompressedSize = MI_GetUncompressedSize(buffer); + u32 uncompressedSize = MI_GetUncompressedSize(buffer); void *uncompressedBuffer = AllocFromHeapAtEnd(bgConfig->heapId, uncompressedSize); CopyOrUncompressTilemapData(buffer, uncompressedBuffer, size); LoadBgVramChar(bgId, uncompressedBuffer, offset, uncompressedSize); @@ -838,9 +838,9 @@ void BG_ClearCharDataRange(u8 bgId, u32 size, u32 offset, HeapID heapId) { void BG_FillCharDataRange(BgConfig *bgConfig, enum GFBgLayer bgId, u32 fillValue, u32 ntiles, u32 offset) { void *buffer; - u32 size = ntiles * bgConfig->bgs[bgId].tileSize; + u32 size = ntiles * bgConfig->bgs[bgId].tileSize; u32 value = fillValue; - buffer = AllocFromHeapAtEnd(bgConfig->heapId, size); + buffer = AllocFromHeapAtEnd(bgConfig->heapId, size); if (bgConfig->bgs[bgId].tileSize == TILE_SIZE_4BPP) { value = (value << 12) | (value << 8) | (value << 4) | (value << 0); @@ -890,9 +890,9 @@ static u16 GetTileMapIndexFromCoords(u8 x, u8 y, u8 size) { } static u16 GetSrcTileMapIndexFromCoords(u8 x, u8 y, u8 width, u8 height) { - u8 coordType = 0; - u16 tilemapIndex = 0; - s16 adjustedWidth = width - 32; + u8 coordType = 0; + u16 tilemapIndex = 0; + s16 adjustedWidth = width - 32; s16 adjustedHeight = height - 32; if (x / 32) { @@ -1124,7 +1124,7 @@ void BgTilemapRectChangePalette(BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u8 widt if (j >= screenWidth) { break; } - u16 pos = GetTileMapIndexFromCoords(j, i, bgConfig->bgs[bgId].size); + u16 pos = GetTileMapIndexFromCoords(j, i, bgConfig->bgs[bgId].size); tilemapBuffer[pos] = (tilemapBuffer[pos] & 0xFFF) | (palette << 12); } } @@ -1286,29 +1286,29 @@ void BlitBitmapRect4Bit(const Bitmap *src, const Bitmap *dest, u16 srcX, u16 src } else { yEnd = height + srcY; } - multiplierSrcY = ConvertPixelsToTiles(src->width); + multiplierSrcY = ConvertPixelsToTiles(src->width); multiplierDestY = ConvertPixelsToTiles(dest->width); if (colorKey == 0xFFFF) { for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) { for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) { - pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); + pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); pixelsDest = GetPixelAddressFromBlit4bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY); - toOrr = (*pixelsSrc >> ((loopSrcX & 1) * 4)) & 0xF; - toShift = (loopDestX & 1) * 4; + toOrr = (*pixelsSrc >> ((loopSrcX & 1) * 4)) & 0xF; + toShift = (loopDestX & 1) * 4; *pixelsDest = ((toOrr << toShift) | (*pixelsDest & (0xF0 >> toShift))); } } } else { for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) { for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) { - pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); + pixelsSrc = GetPixelAddressFromBlit4bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); pixelsDest = GetPixelAddressFromBlit4bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY); toOrr = (*pixelsSrc >> ((loopSrcX & 1) * 4)) & 0xF; if (toOrr != colorKey) { - toShift = (loopDestX & 1) * 4; + toShift = (loopDestX & 1) * 4; *pixelsDest = (u8)((toOrr << toShift) | (*pixelsDest & (0xF0 >> toShift))); } } @@ -1333,13 +1333,13 @@ static void BlitBitmapRect8Bit(const struct Bitmap *src, const struct Bitmap *de } else { yEnd = height + srcY; } - multiplierSrcY = ConvertPixelsToTiles(src->width); + multiplierSrcY = ConvertPixelsToTiles(src->width); multiplierDestY = ConvertPixelsToTiles(dest->width); if (colorKey == 0xFFFF) { for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) { for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) { - pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); + pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); pixelsDest = GetPixelAddressFromBlit8bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY); *pixelsDest = *pixelsSrc; @@ -1348,7 +1348,7 @@ static void BlitBitmapRect8Bit(const struct Bitmap *src, const struct Bitmap *de } else { for (loopSrcY = srcY, loopDestY = destY; loopSrcY < yEnd; loopSrcY++, loopDestY++) { for (loopSrcX = srcX, loopDestX = destX; loopSrcX < xEnd; loopSrcX++, loopDestX++) { - pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); + pixelsSrc = GetPixelAddressFromBlit8bpp(src->pixels, loopSrcX, loopSrcY, multiplierSrcY); pixelsDest = GetPixelAddressFromBlit8bpp(dest->pixels, loopDestX, loopDestY, multiplierDestY); if (*pixelsSrc != colorKey) { @@ -1403,7 +1403,7 @@ void FillBitmapRect8Bit(const Bitmap *surface, u16 x, u16 y, u16 width, u16 heig for (int i = y; i < yEnd; i++) { for (int j = x; j < xEnd; j++) { u8 *pixels = GetPixelAddressFromBlit8bpp(surface->pixels, j, i, blitWidth); - *pixels = fillValue; + *pixels = fillValue; } } } @@ -1417,16 +1417,16 @@ Window *AllocWindows(HeapID heapId, s32 num) { } void InitWindow(Window *window) { - window->bgConfig = NULL; - window->bgId = GF_BG_LYR_UNALLOC; + window->bgConfig = NULL; + window->bgId = GF_BG_LYR_UNALLOC; window->tilemapLeft = 0; - window->tilemapTop = 0; - window->width = 0; - window->height = 0; - window->paletteNum = 0; - window->baseTile = 0; + window->tilemapTop = 0; + window->width = 0; + window->height = 0; + window->paletteNum = 0; + window->baseTile = 0; window->pixelBuffer = NULL; - window->colorMode = GF_BG_CLR_4BPP; + window->colorMode = GF_BG_CLR_4BPP; } BOOL WindowIsInUse(const Window *window) { @@ -1447,16 +1447,16 @@ void AddWindowParameterized(BgConfig *bgConfig, Window *window, u8 bgId, u8 x, u if (buffer == NULL) { return; } - window->bgConfig = bgConfig; - window->bgId = bgId; + window->bgConfig = bgConfig; + window->bgId = bgId; window->tilemapLeft = x; - window->tilemapTop = y; - window->width = width; - window->height = height; - window->paletteNum = paletteNum; - window->baseTile = baseTile; + window->tilemapTop = y; + window->width = width; + window->height = height; + window->paletteNum = paletteNum; + window->baseTile = baseTile; window->pixelBuffer = buffer; - window->colorMode = bgConfig->bgs[bgId].colorMode == GX_BG_COLORMODE_16 ? GF_BG_CLR_4BPP : GF_BG_CLR_8BPP; + window->colorMode = bgConfig->bgs[bgId].colorMode == GX_BG_COLORMODE_16 ? GF_BG_CLR_4BPP : GF_BG_CLR_8BPP; } void AddTextWindowTopLeftCorner(BgConfig *bgConfig, Window *window, u8 width, u8 height, u16 baseTile, u8 paletteNum) { @@ -1468,12 +1468,12 @@ void AddTextWindowTopLeftCorner(BgConfig *bgConfig, Window *window, u8 width, u8 memset(ptr, paletteNum, size); // could cause a data protection abort if below is true if (ptr != NULL) { - window->bgConfig = bgConfig; - window->width = width; - window->height = height; - window->baseTile = baseTile; + window->bgConfig = bgConfig; + window->width = width; + window->height = height; + window->baseTile = baseTile; window->pixelBuffer = ptr; - window->colorMode = GF_BG_CLR_4BPP; + window->colorMode = GF_BG_CLR_4BPP; } } @@ -1484,14 +1484,14 @@ void AddWindow(BgConfig *bgConfig, Window *window, const WindowTemplate *templat void RemoveWindow(Window *window) { FreeToHeap(window->pixelBuffer); - window->bgConfig = NULL; - window->bgId = GF_BG_LYR_UNALLOC; + window->bgConfig = NULL; + window->bgId = GF_BG_LYR_UNALLOC; window->tilemapLeft = 0; - window->tilemapTop = 0; - window->width = 0; - window->height = 0; - window->paletteNum = 0; - window->baseTile = 0; + window->tilemapTop = 0; + window->width = 0; + window->height = 0; + window->paletteNum = 0; + window->baseTile = 0; window->pixelBuffer = NULL; } @@ -1526,14 +1526,14 @@ void PutWindowTilemap(Window *window) { } void PutWindowTilemapRectAnchoredTopLeft(Window *window, u8 width, u8 height) { - u8 widthBak = window->width; + u8 widthBak = window->width; u8 heightBak = window->height; - window->width = width; + window->width = width; window->height = height; sPutWindowTilemapFuncs[window->bgConfig->bgs[window->bgId].mode](window); - window->width = widthBak; + window->width = widthBak; window->height = heightBak; } @@ -1551,8 +1551,8 @@ static void PutWindowTilemap_TextMode(Window *window) { return; } - tile = window->baseTile; - tilemapRight = window->tilemapLeft + window->width; + tile = window->baseTile; + tilemapRight = window->tilemapLeft + window->width; tilemapBottom = window->tilemapTop + window->height; for (i = window->tilemapTop; i < tilemapBottom; i++) { @@ -1577,7 +1577,7 @@ static void PutWindowTilemap_AffineMode(Window *window) { tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size]; tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer + window->tilemapTop * tilemapWidth + window->tilemapLeft; - tile = window->baseTile; + tile = window->baseTile; for (i = 0; i < window->height; i++) { for (j = 0; j < window->width; j++) { @@ -1596,9 +1596,9 @@ static void ClearWindowTilemapText(Window *window) { if (window->bgConfig->bgs[window->bgId].tilemapBuffer == NULL) { return; } - tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer; - tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size]; - tilemapRight = window->tilemapLeft + window->width; + tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer; + tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size]; + tilemapRight = window->tilemapLeft + window->width; tilemapBottom = window->tilemapTop + window->height; for (i = window->tilemapTop; i < tilemapBottom; i++) { for (j = window->tilemapLeft; j < tilemapRight; j++) { @@ -1617,7 +1617,7 @@ static void ClearWindowTilemapAffine(Window *window) { } tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size]; - tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer + window->tilemapTop * tilemapWidth + window->tilemapLeft; + tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer + window->tilemapTop * tilemapWidth + window->tilemapLeft; for (i = 0; i < window->height; i++) { for (j = 0; j < window->width; j++) { tilemap[j] = 0; @@ -1698,11 +1698,11 @@ void BlitBitmapRect(Window *window, void *src, u16 srcX, u16 srcY, u16 srcWidth, Bitmap bmpSrc, bmpDest; bmpSrc.pixels = src; - bmpSrc.width = srcWidth; + bmpSrc.width = srcWidth; bmpSrc.height = srcHeight; bmpDest.pixels = window->pixelBuffer; - bmpDest.width = window->width * 8; + bmpDest.width = window->width * 8; bmpDest.height = window->height * 8; if (window->bgConfig->bgs[window->bgId].colorMode == GF_BG_CLR_4BPP) { @@ -1716,7 +1716,7 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width, Bitmap bmp; bmp.pixels = window->pixelBuffer; - bmp.width = window->width * 8; + bmp.width = window->width * 8; bmp.height = window->height * 8; if (window->bgConfig->bgs[window->bgId].colorMode == GF_BG_CLR_4BPP) { @@ -1738,7 +1738,7 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width, \ src = glyphPixels + (srcY / 8 * 64) + (srcX / 8 * 32); \ if (srcY == 0) { \ - destI = destY + srcY; \ + destI = destY + srcY; \ tableBit = table & 0xFF; \ } else { \ destI = destY + srcY; \ @@ -1753,14 +1753,14 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width, pixelData = *(u32 *)src; \ tableFlag = (tableBit >> srcI) & 1; \ for (srcJ = 0, destJ = destX + srcX; srcJ < srcWidth; srcJ++, destJ++) { \ - dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI, destWidth); \ + dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI, destWidth); \ toOrr = (pixelData >> (srcJ * 4)) & 0xF; \ if (toOrr != 0) { \ - bits = (destJ & 1) * 4; \ + bits = (destJ & 1) * 4; \ toOrr = (toOrr << bits) | (*dest & (0xF0 >> bits)); \ *dest = toOrr; \ if (tableFlag) { \ - dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI + 1, destWidth); \ + dest = GetPixelAddressFromBlit4bpp(windowPixels, destJ, destI + 1, destWidth); \ *dest = toOrr; \ } \ } \ @@ -1786,7 +1786,7 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width, \ src = glyphPixels + (srcY / 8 * 128) + (srcX / 8 * 64); \ if (srcY == 0) { \ - destI = destY + srcY; \ + destI = destY + srcY; \ tableBit = table & 0xFF; \ } else { \ destI = destY + srcY; \ @@ -1801,12 +1801,12 @@ void FillWindowPixelRect(Window *window, u8 fillValue, u16 x, u16 y, u16 width, pixelData = (u8 *)src; \ tableFlag = (tableBit >> srcI) & 1; \ for (srcJ = 0, destJ = destX + srcX; srcJ < srcWidth; srcJ++, destJ++) { \ - dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI, destWidth); \ + dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI, destWidth); \ toOrr = pixelData[srcJ]; \ if (toOrr != 0) { \ *dest = toOrr; \ if (tableFlag) { \ - dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI + 1, destWidth); \ + dest = GetPixelAddressFromBlit8bpp(windowPixels, destJ, destI + 1, destWidth); \ *dest = toOrr; \ } \ } \ @@ -1827,8 +1827,8 @@ void CopyGlyphToWindow(Window *window, u8 *glyphPixels, u16 srcWidth, u16 srcHei u8 glyphSizeParam; windowPixels = (u8 *)window->pixelBuffer; - destWidth = (u16)(window->width * 8); - destHeight = (u16)(window->height * 8); + destWidth = (u16)(window->width * 8); + destHeight = (u16)(window->height * 8); // Don't overflow the window if (destWidth - destX < srcWidth) { @@ -1920,9 +1920,9 @@ static void ScrollWindow4bpp(Window *window, u8 direction, u8 y, u8 fillValue) { int i, j; pixelBuffer = window->pixelBuffer; - fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0); - size = window->height * window->width * TILE_SIZE_4BPP; - width = window->width; + fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0); + size = window->height * window->width * TILE_SIZE_4BPP; + width = window->width; switch (direction) { case 0: // up @@ -1970,9 +1970,9 @@ static void ScrollWindow8bpp(Window *window, u8 direction, u8 y, u8 fillValue) { int i, j; pixelBuffer = window->pixelBuffer; - fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0); - size = window->height * window->width * TILE_SIZE_8BPP; - width = window->width; + fillWord = (fillValue << 24) | (fillValue << 16) | (fillValue << 8) | (fillValue << 0); + size = window->height * window->width * TILE_SIZE_8BPP; + width = window->width; switch (direction) { case 0: // up @@ -2078,7 +2078,7 @@ NNSG2dPaletteData *LoadPaletteDataFromFile(void **pltt_ret, HeapID heapId, const void DoScheduledBgGpuUpdates(BgConfig *bgConfig) { BgConfig_HandleScheduledScrolls(bgConfig); BgConfig_HandleScheduledBufferTransfers(bgConfig); - bgConfig->scrollScheduled = 0; + bgConfig->scrollScheduled = 0; bgConfig->bufferTransferScheduled = 0; } @@ -2228,16 +2228,16 @@ BOOL DoesPixelAtScreenXYMatchPtrVal(BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u16 } tilemapIdx = GetTileMapIndexFromCoords(x >> 3, y >> 3, bgConfig->bgs[bgId].size); - bgCharPtr = BgGetCharPtr(bgId); - xPixOffs = x & 7; - yPixOffs = y & 7; + bgCharPtr = BgGetCharPtr(bgId); + xPixOffs = x & 7; + yPixOffs = y & 7; if (bgConfig->bgs[bgId].colorMode == GX_BG_COLORMODE_16) { u16 *tilemapBuffer = bgConfig->bgs[bgId].tilemapBuffer; - u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40); + u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40); bgCharPtr += (tilemapBuffer[tilemapIdx] & 0x3FF) * TILE_SIZE_4BPP; for (i = 0; i < TILE_SIZE_4BPP; i++) { - tile[i * 2] = bgCharPtr[i] & 0xF; + tile[i * 2] = bgCharPtr[i] & 0xF; tile[i * 2 + 1] = bgCharPtr[i] >> 4; } ApplyFlipFlagsToTile(bgConfig, (tilemapBuffer[tilemapIdx] >> 10) & 3, tile); @@ -2249,7 +2249,7 @@ BOOL DoesPixelAtScreenXYMatchPtrVal(BgConfig *bgConfig, u8 bgId, u8 x, u8 y, u16 } else { if (bgConfig->bgs[bgId].mode != GF_BG_TYPE_AFFINE) { u16 *tilemapBuffer = bgConfig->bgs[bgId].tilemapBuffer; - u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40); + u8 *tile = AllocFromHeapAtEnd(bgConfig->heapId, 0x40); memcpy(tile, bgCharPtr + (tilemapBuffer[tilemapIdx] & 0x3FF) * TILE_SIZE_8BPP, TILE_SIZE_8BPP); ApplyFlipFlagsToTile(bgConfig, (tilemapBuffer[tilemapIdx] >> 10) & 3, tile); diff --git a/arm9/src/blackout.c b/arm9/src/blackout.c index 0cf9c3846..dd7d656a6 100644 --- a/arm9/src/blackout.c +++ b/arm9/src/blackout.c @@ -38,48 +38,48 @@ extern void sub_0204AB0C(void); extern u16 GetMomSpawnId(void); static const struct GraphicsBanks sBlackoutGraphicsBanks = { - .bg = GX_VRAM_BG_128_B, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_128_C, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_64_E, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_16_I, + .bg = GX_VRAM_BG_128_B, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_128_C, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_64_E, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_16_I, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_0_A, - .texpltt = GX_VRAM_TEXPLTT_01_FG, + .tex = GX_VRAM_TEX_0_A, + .texpltt = GX_VRAM_TEXPLTT_01_FG, }; static const struct GraphicsModes sBlackoutGraphicsModes = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D, }; static const BgTemplate sBlackoutBgTemplate = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0xf800, - .charBase = GX_BG_CHARBASE_0x00000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE }; static const WindowTemplate sBlackoutWindowTemplate = { - .bgId = GF_BG_LYR_MAIN_3, - .left = 4, - .top = 5, - .width = 25, - .height = 15, - .palette = 13, + .bgId = GF_BG_LYR_MAIN_3, + .left = 4, + .top = 5, + .width = 25, + .height = 15, + .palette = 13, .baseTile = 0x01 }; @@ -95,13 +95,13 @@ static void Blackout_DrawMessage(FieldSystem *fieldSystem, TaskManager *taskMana GF_ASSERT(env != NULL); memset(env, 0, sizeof(BlackoutScreenEnvironment)); - env->state = 0; + env->state = 0; env->fieldSystem = fieldSystem; - env->bgConfig = BgConfig_Alloc(HEAP_ID_FIELD); + env->bgConfig = BgConfig_Alloc(HEAP_ID_FIELD); Blackout_InitDisplays(env->bgConfig); env->msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0328_bin, HEAP_ID_FIELD); - env->msgFmt = MessageFormat_New(HEAP_ID_FIELD); + env->msgFmt = MessageFormat_New(HEAP_ID_FIELD); AddWindow(env->bgConfig, &env->window, &sBlackoutWindowTemplate); @@ -172,7 +172,7 @@ static void Blackout_PrintMessage(BlackoutScreenEnvironment *environment, s32 ms StringExpandPlaceholders(environment->msgFmt, finStr, tmpStr); u32 width = FontID_String_GetWidthMultiline(0, finStr, 0); - x = (environment->window.width * 8 - width); + x = (environment->window.width * 8 - width); x /= 2; x -= 4; @@ -194,7 +194,7 @@ enum { BOOL Task_Blackout(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); LocalFieldData *localFieldData; Location deathWarp; u16 deathSpawn; @@ -202,7 +202,7 @@ BOOL Task_Blackout(TaskManager *taskManager) { switch (*state) { case STATE_BLACKOUT_TASK_INIT: localFieldData = Save_LocalFieldData_Get(fieldSystem->saveData); - deathSpawn = LocalFieldData_GetBlackoutSpawn(localFieldData); + deathSpawn = LocalFieldData_GetBlackoutSpawn(localFieldData); GetDeathWarpData(deathSpawn, &deathWarp); GetSpecialSpawnWarpData(deathSpawn, LocalFieldData_GetSpecialSpawnWarpPtr(localFieldData)); sub_02049160(taskManager, &deathWarp); diff --git a/arm9/src/brightness.c b/arm9/src/brightness.c index 422e1744d..fdd2fbc6a 100644 --- a/arm9/src/brightness.c +++ b/arm9/src/brightness.c @@ -25,7 +25,7 @@ void DoBrightnessTransitionStep(BrightnessData *brightness) { } } else { brightness->currentBrightness = brightness->targetBrightness; - transitionFinished = TRUE; + transitionFinished = TRUE; } if (brightness->screenMask & SCREEN_MASK_MAIN) { @@ -42,13 +42,13 @@ void DoBrightnessTransitionStep(BrightnessData *brightness) { void InitBrightnessTransition(BrightnessData *brightnessData, u16 stepCount, s16 targetBrightness, s16 startBrightness, GXBlendPlaneMask surfaceMask, u32 screenMask) { GF_ASSERT(!brightnessData->transitionActive); - brightnessData->transitionActive = TRUE; - brightnessData->surfaceMask = (GXBlendPlaneMask)(u8)surfaceMask; - brightnessData->screenMask = (u8)screenMask; - brightnessData->stepCount = stepCount; - brightnessData->targetBrightness = targetBrightness; + brightnessData->transitionActive = TRUE; + brightnessData->surfaceMask = (GXBlendPlaneMask)(u8)surfaceMask; + brightnessData->screenMask = (u8)screenMask; + brightnessData->stepCount = stepCount; + brightnessData->targetBrightness = targetBrightness; brightnessData->currentBrightness = startBrightness; - brightnessData->brightnessDiff = startBrightness - targetBrightness; + brightnessData->brightnessDiff = startBrightness - targetBrightness; if (brightnessData->brightnessDiff > 0) { brightnessData->transitionDirection = -1; @@ -57,9 +57,9 @@ void InitBrightnessTransition(BrightnessData *brightnessData, u16 stepCount, s16 brightnessData->brightnessDiff *= -1; } - brightnessData->stepSizeInteger = brightnessData->brightnessDiff / stepCount; + brightnessData->stepSizeInteger = brightnessData->brightnessDiff / stepCount; brightnessData->stepSizeFractional = brightnessData->brightnessDiff % stepCount; - brightnessData->fractionalCount = 0; + brightnessData->fractionalCount = 0; } void StartBrightnessTransition(u16 stepCount, s16 targetBrightness, s16 startBrightness, GXBlendPlaneMask surfaceMask, u32 screenMask) { @@ -93,7 +93,7 @@ void ScreenBrightnessData_InitAll(void) { MI_CpuFill8(&sSubScreenBrightnessData, 0, sizeof(BrightnessData)); sMainScreenBrightnessData.transitionActive = FALSE; - sSubScreenBrightnessData.transitionActive = FALSE; + sSubScreenBrightnessData.transitionActive = FALSE; } void InitScreenBrightnessData(u32 screenMask) { diff --git a/arm9/src/camera.c b/arm9/src/camera.c index 185fb90d9..df52e54a9 100644 --- a/arm9/src/camera.c +++ b/arm9/src/camera.c @@ -20,7 +20,7 @@ GXBufferMode gG3dDepthBufferingMode = GX_BUFFERMODE_W; static Camera *sCameraPtr; static void Camera_CalcLookAtPosFromTargetAndAngle(Camera *camera) { - u16 negx = -camera->angle.x; + u16 negx = -camera->angle.x; camera->lookAt.camPos.x = FX_Mul(FX_Mul(FX_SinIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x)); camera->lookAt.camPos.z = FX_Mul(FX_Mul(FX_CosIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x)); camera->lookAt.camPos.y = FX_Mul(FX_SinIdx(negx), camera->distance); @@ -28,7 +28,7 @@ static void Camera_CalcLookAtPosFromTargetAndAngle(Camera *camera) { } static void Camera_CalcLookAtTargetFromPosAndAngle(Camera *camera) { - u16 negx = -camera->angle.x; + u16 negx = -camera->angle.x; camera->lookAt.camTarget.x = -FX_Mul(FX_Mul(FX_SinIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x)); camera->lookAt.camTarget.z = -FX_Mul(FX_Mul(FX_CosIdx(camera->angle.y), camera->distance), FX_CosIdx(camera->angle.x)); camera->lookAt.camTarget.y = -FX_Mul(FX_SinIdx(negx), camera->distance); @@ -36,20 +36,20 @@ static void Camera_CalcLookAtTargetFromPosAndAngle(Camera *camera) { } static void Camera_InitInternal(u16 perspectiveAngle, Camera *camera) { - camera->perspectiveAngle = perspectiveAngle; + camera->perspectiveAngle = perspectiveAngle; camera->perspective.fovySin = FX_SinIdx(perspectiveAngle); camera->perspective.fovyCos = FX_CosIdx(perspectiveAngle); - camera->perspective.aspect = FX32_CONST(1.33333333); // 4x3 - camera->perspective.near = FX32_CONST(150); - camera->perspective.far = FX32_CONST(900); - camera->lookAt.camUp.x = 0; - camera->lookAt.camUp.y = FX32_ONE; - camera->lookAt.camUp.z = 0; - camera->curTarget = NULL; - camera->enableOffsetX = FALSE; - camera->enableOffsetY = FALSE; - camera->enableOffsetZ = FALSE; - camera->history = NULL; + camera->perspective.aspect = FX32_CONST(1.33333333); // 4x3 + camera->perspective.near = FX32_CONST(150); + camera->perspective.far = FX32_CONST(900); + camera->lookAt.camUp.x = 0; + camera->lookAt.camUp.y = FX32_ONE; + camera->lookAt.camUp.z = 0; + camera->curTarget = NULL; + camera->enableOffsetX = FALSE; + camera->enableOffsetY = FALSE; + camera->enableOffsetZ = FALSE; + camera->history = NULL; } static void Camera_VecResetCoordsIfOffsetComponentNotEnabled(Camera *camera, VecFx32 *vec) { @@ -68,7 +68,7 @@ static void Camera_GetVecFromSomeRingBufferMaybe(Camera *camera, const VecFx32 * if (camera->history == NULL) { *vecDest = *vecDefault; } else { - s32 *idxPtr = &camera->history->readIdx; + s32 *idxPtr = &camera->history->readIdx; s32 *idx2Ptr = &camera->history->writeIdx; if (!camera->history->overrideEnabled) { *vecDest = *vecDefault; @@ -78,9 +78,9 @@ static void Camera_GetVecFromSomeRingBufferMaybe(Camera *camera, const VecFx32 * } else { *vecDest = camera->history->vecs[camera->history->readIdx]; } - *idxPtr = (*idxPtr + 1) % camera->history->count; + *idxPtr = (*idxPtr + 1) % camera->history->count; camera->history->vecs[*idx2Ptr] = *vecDefault; - *idx2Ptr = (*idx2Ptr + 1) % camera->history->count; + *idx2Ptr = (*idx2Ptr + 1) % camera->history->count; if (!camera->history->enableUpdateX) { vecDest->x = vecDefault->x; } @@ -99,20 +99,20 @@ void Camera_History_New(s32 count, s32 initialWriteIdx, s32 updateEnableFlags, H } GF_ASSERT(initialWriteIdx + 1 <= count); CameraHistory *history = AllocFromHeap(heapId, sizeof(CameraHistory)); - history->vecs = AllocFromHeap(heapId, sizeof(VecFx32) * count); + history->vecs = AllocFromHeap(heapId, sizeof(VecFx32) * count); for (s32 i = 0; i < count; i++) { history->vecs[i].x = 0; history->vecs[i].y = 0; history->vecs[i].z = 0; } - history->count = count; - history->readIdx = 0; - history->writeIdx = initialWriteIdx; - history->writeIdxInit = initialWriteIdx; + history->count = count; + history->readIdx = 0; + history->writeIdx = initialWriteIdx; + history->writeIdxInit = initialWriteIdx; history->overrideEnabled = FALSE; - history->enableUpdateX = FALSE; - history->enableUpdateY = FALSE; - history->enableUpdateZ = FALSE; + history->enableUpdateX = FALSE; + history->enableUpdateY = FALSE; + history->enableUpdateZ = FALSE; if (updateEnableFlags & CAMERA_UPDATE_ENABLE_X) { history->enableUpdateX = TRUE; } @@ -174,15 +174,15 @@ void Camera_SetLookAtCamUp(VecFx32 *camUp, Camera *camera) { } void Camera_SetFixedTarget(VecFx32 *target, Camera *camera) { - camera->curTarget = target; - camera->lastTarget = *target; + camera->curTarget = target; + camera->lastTarget = *target; camera->enableOffsetX = TRUE; camera->enableOffsetY = TRUE; camera->enableOffsetZ = TRUE; } void Camera_ClearFixedTarget(Camera *camera) { - camera->curTarget = NULL; + camera->curTarget = NULL; camera->enableOffsetX = FALSE; camera->enableOffsetY = FALSE; camera->enableOffsetZ = FALSE; @@ -190,22 +190,22 @@ void Camera_ClearFixedTarget(Camera *camera) { void Camera_SetPerspectiveClippingPlane(fx32 near, fx32 far, Camera *camera) { camera->perspective.near = near; - camera->perspective.far = far, + camera->perspective.far = far, Camera_ApplyPerspectiveType(camera->perspectiveType, camera); } void Camera_Init_FromTargetDistanceAndAngle(VecFx32 *target, fx32 distance, CameraAngle *angle, u16 perspectiveAngle, u8 perspectiveType, BOOL setReference, Camera *camera) { Camera_InitInternal(perspectiveAngle, camera); camera->lookAt.camTarget = *target; - camera->distance = distance; - camera->angle = *angle; + camera->distance = distance; + camera->angle = *angle; Camera_CalcLookAtPosFromTargetAndAngle(camera); Camera_ApplyPerspectiveType(perspectiveType, camera); if (!setReference) { return; } - camera->curTarget = target; - camera->lastTarget = *target; + camera->curTarget = target; + camera->lastTarget = *target; camera->enableOffsetX = TRUE; camera->enableOffsetY = TRUE; camera->enableOffsetZ = TRUE; @@ -214,8 +214,8 @@ void Camera_Init_FromTargetDistanceAndAngle(VecFx32 *target, fx32 distance, Came void Camera_Init_FromPosDistanceAndAngle(VecFx32 *pos, fx32 distance, CameraAngle *angle, u16 perspectiveAngle, u8 perspectiveType, Camera *camera) { Camera_InitInternal(perspectiveAngle, camera); camera->lookAt.camPos = *pos; - camera->distance = distance; - camera->angle = *angle; + camera->distance = distance; + camera->angle = *angle; Camera_CalcLookAtTargetFromPosAndAngle(camera); Camera_ApplyPerspectiveType(perspectiveType, camera); } @@ -225,28 +225,28 @@ void Camera_Init_FromTargetAndPos(const VecFx32 *target, const VecFx32 *pos, u16 Camera_InitInternal(perspectiveAngle, camera); camera->lookAt.camTarget = *target; - camera->lookAt.camPos = *pos; + camera->lookAt.camPos = *pos; VEC_Subtract(pos, target, &vec_from_pos_to_target); camera->distance = VEC_Mag(&vec_from_pos_to_target); - VecFx32 sp24 = { 0, 0, 0 }; // unused - VecFx32 sp18 = { 0, 0, 0 }; // unused - VecFx32 sp0C = { 0, 0, 0 }; + VecFx32 sp24 = { 0, 0, 0 }; // unused + VecFx32 sp18 = { 0, 0, 0 }; // unused + VecFx32 sp0C = { 0, 0, 0 }; VecFx32 sp00; - sp00.x = 0; - sp00.y = 0; - sp00.z = FX32_ONE; - sp0C = vec_from_pos_to_target; - sp0C.y = 0; + sp00.x = 0; + sp00.y = 0; + sp00.z = FX32_ONE; + sp0C = vec_from_pos_to_target; + sp0C.y = 0; camera->angle.y = CalcAngleBetweenVecs(&sp00, &sp0C); - sp00.x = FX32_ONE; - sp00.y = 0; - sp00.z = 0; - sp0C.x = vec_from_pos_to_target.z; - sp0C.z = vec_from_pos_to_target.y; - sp0C.y = 0; + sp00.x = FX32_ONE; + sp00.y = 0; + sp00.z = 0; + sp0C.x = vec_from_pos_to_target.z; + sp0C.z = vec_from_pos_to_target.y; + sp0C.y = 0; camera->angle.x = CalcAngleBetweenVecs(&sp00, &sp0C); camera->angle.z = 0; @@ -255,8 +255,8 @@ void Camera_Init_FromTargetAndPos(const VecFx32 *target, const VecFx32 *pos, u16 if (!setReference) { return; } - camera->curTarget = target; - camera->lastTarget = *target; + camera->curTarget = target; + camera->lastTarget = *target; camera->enableOffsetX = TRUE; camera->enableOffsetY = TRUE; camera->enableOffsetZ = TRUE; @@ -266,18 +266,18 @@ void Camera_ApplyPerspectiveType(u8 perspectiveType, Camera *camera) { if (perspectiveType == CAMERA_PERSPECTIVE_TYPE_PERSPECTIVE) { NNS_G3dGlbPerspective(camera->perspective.fovySin, camera->perspective.fovyCos, camera->perspective.aspect, camera->perspective.near, camera->perspective.far); camera->perspectiveType = CAMERA_PERSPECTIVE_TYPE_PERSPECTIVE; - gG3dDepthBufferingMode = GX_BUFFERMODE_Z; + gG3dDepthBufferingMode = GX_BUFFERMODE_Z; } else { fx32 y = FX_Mul(FX_Div(camera->perspective.fovySin, camera->perspective.fovyCos), camera->distance); fx32 x = FX_Mul(y, camera->perspective.aspect); NNS_G3dGlbOrtho(y, -y, -x, x, camera->perspective.near, camera->perspective.far); camera->perspectiveType = CAMERA_PERSPECTIVE_TYPE_ORTHOGRAPHIC; - gG3dDepthBufferingMode = GX_BUFFERMODE_Z; + gG3dDepthBufferingMode = GX_BUFFERMODE_Z; } } void Camera_SetPerspectiveAngle(u16 perspectiveAngle, Camera *camera) { - camera->perspectiveAngle = perspectiveAngle; + camera->perspectiveAngle = perspectiveAngle; camera->perspective.fovySin = FX_SinIdx(camera->perspectiveAngle); camera->perspective.fovyCos = FX_CosIdx(camera->perspectiveAngle); Camera_ApplyPerspectiveType(camera->perspectiveType, camera); diff --git a/arm9/src/communication_error.c b/arm9/src/communication_error.c index 9c98a6047..6bd7cdc27 100644 --- a/arm9/src/communication_error.c +++ b/arm9/src/communication_error.c @@ -19,49 +19,49 @@ extern void SetMasterBrightnessNeutral(BOOL set_brightness_on_bottom_screen); extern void sub_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); static const struct WindowTemplate sCommunicationErrorWindowTemplate = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 3, - .top = 3, - .width = 26, - .height = 18, - .palette = 1, + .bgId = GF_BG_LYR_MAIN_0, + .left = 3, + .top = 3, + .width = 26, + .height = 18, + .palette = 1, .baseTile = 0x23, }; static const struct GraphicsModes sCommunicationErrorGraphicsModes = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D, }; static const struct BgTemplate sCommunicationErrorBgTemplate = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x18000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE, + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE, }; static const GraphicsBanks sCommunicationErrorGraphicsBanks = { - .bg = GX_VRAM_BG_256_AB, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_NONE, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_NONE, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_NONE, + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_NONE, - .texpltt = GX_VRAM_TEXPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE, }; static void VBlankIntr(void); @@ -131,8 +131,8 @@ void ShowCommunicationError(HeapID heapId, u32 error, u32 errorCode) { BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27)); MsgData *errorMessageData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0200_bin, heapId); - String *errorMessageStr = String_New(384, heapId); - String *tmpStr = String_New(384, heapId); + String *errorMessageStr = String_New(384, heapId); + String *tmpStr = String_New(384, heapId); ResetAllTextPrinters(); MessageFormat *messageFormat = MessageFormat_New(heapId); diff --git a/arm9/src/daycare.c b/arm9/src/daycare.c index 3a749e3bc..5b59f166d 100644 --- a/arm9/src/daycare.c +++ b/arm9/src/daycare.c @@ -14,7 +14,7 @@ void Save_Daycare_Init(Daycare *daycare) { memset(daycare, 0, sizeof(Daycare)); ZeroBoxMonData(&daycare->mons[0].mon); ZeroBoxMonData(&daycare->mons[1].mon); - daycare->egg_pid = 0; + daycare->egg_pid = 0; daycare->egg_cycles = 0; } @@ -85,7 +85,7 @@ void DaycareMon_Extras_Init(DaycareMail *mail) { mail->nickname[i] = 0; } - mail->ot_name[0] = EOS; + mail->ot_name[0] = EOS; mail->nickname[0] = EOS; } diff --git a/arm9/src/easy_chat.c b/arm9/src/easy_chat.c index 68bb3f1f5..192c251f8 100644 --- a/arm9/src/easy_chat.c +++ b/arm9/src/easy_chat.c @@ -51,18 +51,18 @@ static const u16 sNarcMsgCounts[EC_GROUP_MAX] = { EC_WORDS_UNION_COUNT, }; -static const ecword_t sEasyChatHey[] = { EC_WORD_GREETINGS_HEY, EC_WORD_GREETINGS_HEY_2 }; -static const ecword_t sEasyChatHuh_[] = { EC_WORD_GREETINGS_HUH_, EC_WORD_GREETINGS_HUH__2 }; -static const ecword_t sEasyChatI[] = { EC_WORD_PEOPLE_I, EC_WORD_PEOPLE_I_2, EC_WORD_PEOPLE_I_3, EC_WORD_PEOPLE_I_4 }; -static const ecword_t sEasyChatKids[] = { EC_WORD_PEOPLE_KIDS, EC_WORD_PEOPLE_KIDS_2 }; -static const ecword_t sEasyChatNoWay[] = { EC_WORD_GREETINGS_NO_WAY, EC_WORD_FEELINGS_NO_WAY }; -static const ecword_t sEasyChatYou[] = { EC_WORD_PEOPLE_YOU, EC_WORD_PEOPLE_YOU_2 }; +static const ecword_t sEasyChatHey[] = { EC_WORD_GREETINGS_HEY, EC_WORD_GREETINGS_HEY_2 }; +static const ecword_t sEasyChatHuh_[] = { EC_WORD_GREETINGS_HUH_, EC_WORD_GREETINGS_HUH__2 }; +static const ecword_t sEasyChatI[] = { EC_WORD_PEOPLE_I, EC_WORD_PEOPLE_I_2, EC_WORD_PEOPLE_I_3, EC_WORD_PEOPLE_I_4 }; +static const ecword_t sEasyChatKids[] = { EC_WORD_PEOPLE_KIDS, EC_WORD_PEOPLE_KIDS_2 }; +static const ecword_t sEasyChatNoWay[] = { EC_WORD_GREETINGS_NO_WAY, EC_WORD_FEELINGS_NO_WAY }; +static const ecword_t sEasyChatYou[] = { EC_WORD_PEOPLE_YOU, EC_WORD_PEOPLE_YOU_2 }; static const ecword_t sEasyChatAnticipation[] = { EC_WORD_ABILITY(ABILITY_ANTICIPATION), EC_WORD_FEELINGS_ANTICIPATION }; -static const ecword_t sEasyChatSimple[] = { EC_WORD_ABILITY(ABILITY_SIMPLE), EC_WORD_FEELINGS_SIMPLE }; -static const ecword_t sEasyChatWelcome[] = { EC_WORD_GREETINGS_WELCOME, EC_WORD_GREETINGS_WELCOME_2 }; -static const ecword_t sEasyChatWow[] = { EC_WORD_GREETINGS_WOW, EC_WORD_GREETINGS_WOW_2 }; -static const ecword_t sEasyChatPsychic[] = { EC_WORD_MOVE(MOVE_PSYCHIC), EC_WORD_TYPE(TYPE_PSYCHIC) }; -static const ecword_t sEasyChatOk[] = { EC_WORD_GREETINGS_OK, EC_WORD_GREETINGS_OK_2 }; +static const ecword_t sEasyChatSimple[] = { EC_WORD_ABILITY(ABILITY_SIMPLE), EC_WORD_FEELINGS_SIMPLE }; +static const ecword_t sEasyChatWelcome[] = { EC_WORD_GREETINGS_WELCOME, EC_WORD_GREETINGS_WELCOME_2 }; +static const ecword_t sEasyChatWow[] = { EC_WORD_GREETINGS_WOW, EC_WORD_GREETINGS_WOW_2 }; +static const ecword_t sEasyChatPsychic[] = { EC_WORD_MOVE(MOVE_PSYCHIC), EC_WORD_TYPE(TYPE_PSYCHIC) }; +static const ecword_t sEasyChatOk[] = { EC_WORD_GREETINGS_OK, EC_WORD_GREETINGS_OK_2 }; typedef struct ECIdenticalPhrases { const ecword_t *data; @@ -88,7 +88,7 @@ EasyChatManager *EasyChatManager_New(HeapID heapId) { EasyChatManager *ret = AllocFromHeap(heapId, sizeof(EasyChatManager)); for (s32 i = 0; i < EC_GROUP_MAX; i++) { - ret->heapId = heapId; // inadvertently inside the loop + ret->heapId = heapId; // inadvertently inside the loop ret->msgData[i] = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, sNarcMsgBanks[i], heapId); } return ret; @@ -145,7 +145,7 @@ void GetCategoryAndMsgNoByECWordIdx(u32 ecWord, u32 *category, u32 *msgNo) { count += sNarcMsgCounts[bank]; if (wordId < count) { *category = bank; - *msgNo = (wordId - (count - sNarcMsgCounts[bank])); + *msgNo = (wordId - (count - sNarcMsgCounts[bank])); return; } } @@ -159,7 +159,7 @@ void Save_EasyChat_Init(SaveEasyChat *saveEasyChat) { u32 i; saveEasyChat->greetings = 0; - saveEasyChat->trendy = 0; + saveEasyChat->trendy = 0; for (i = 0; i < NELEMS(sLanguageToGreetingMap); i++) { if (sLanguageToGreetingMap[i][0] == GAME_LANGUAGE) { Save_EasyChat_SetGreetingFlag(saveEasyChat, sLanguageToGreetingMap[i][1]); diff --git a/arm9/src/encounter.c b/arm9/src/encounter.c index 8abac57f8..4b6998427 100644 --- a/arm9/src/encounter.c +++ b/arm9/src/encounter.c @@ -86,7 +86,7 @@ static void sub_020473CC(FieldSystem *fieldSystem, BattleSetup *setup); static BOOL Task_StartBattle(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); BattleSetup *battleSetup = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: @@ -109,13 +109,13 @@ static void CallTask_StartBattle(TaskManager *taskManager, BattleSetup *setup) { static Encounter *Encounter_New(BattleSetup *setup, s32 effect, s32 bgm, u32 *winFlag) { Encounter *encounter = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(Encounter)); - encounter->winFlag = winFlag; + encounter->winFlag = winFlag; if (winFlag != NULL) { *winFlag = BATTLE_OUTCOME_NONE; } encounter->effect = effect; - encounter->bgm = bgm; - encounter->setup = setup; + encounter->bgm = bgm; + encounter->setup = setup; return encounter; } @@ -139,8 +139,8 @@ static void sub_020465E4(BattleSetup *setup, FieldSystem *fieldSystem) { static BOOL Task_StartEncounter(TaskManager *taskManager) { // todo: better name FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - Encounter *encounter = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: @@ -210,8 +210,8 @@ static void sub_0204671C(s32 flag, FieldSystem *fieldSystem) { static BOOL Task_02046758(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - Encounter *encounter = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: sub_0204AEF8(taskManager, encounter->effect, encounter->bgm); @@ -242,8 +242,8 @@ static BOOL Task_02046758(TaskManager *taskManager) { static BOOL Task_020467FC(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - Encounter *encounter = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: @@ -266,8 +266,8 @@ static BOOL Task_020467FC(TaskManager *taskManager) { static BOOL Task_02046878(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - Encounter *encounter = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: @@ -308,21 +308,21 @@ static void CallTask_02046878(TaskManager *taskManager, BattleSetup *battleSetup void sub_02046948(TaskManager *taskManager, u32 param1, u32 *winFlag) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); BattleSetup *battleSetup = ov06_02244558(param1, fieldSystem); - s32 effect = sub_020475A0(battleSetup); - s32 bgm = sub_020475B0(battleSetup); + s32 effect = sub_020475A0(battleSetup); + s32 bgm = sub_020475B0(battleSetup); CallTask_02046878(taskManager, battleSetup, effect, bgm, winFlag); } static WildEncounter *WildEncounter_New(BattleSetup *setup, s32 effect, s32 bgm, u32 *winFlag) { WildEncounter *encounter = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(WildEncounter)); - encounter->winFlag = winFlag; + encounter->winFlag = winFlag; if (winFlag != NULL) { *winFlag = BATTLE_OUTCOME_NONE; } encounter->effect = effect; - encounter->bgm = bgm; - encounter->setup = setup; - encounter->state = 0; + encounter->bgm = bgm; + encounter->setup = setup; + encounter->state = 0; return encounter; } @@ -429,9 +429,9 @@ static BOOL Task_WildEncounter(TaskManager *taskManager) { static BOOL Task_SafariEncounter(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - Encounter *encounter = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); - u16 *safariBalls = LocalFieldData_GetSafariBallsCounter(Save_LocalFieldData_Get(fieldSystem->saveData)); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); + u16 *safariBalls = LocalFieldData_GetSafariBallsCounter(Save_LocalFieldData_Get(fieldSystem->saveData)); switch (*state) { case 0: @@ -452,7 +452,7 @@ static BOOL Task_SafariEncounter(TaskManager *taskManager) { sub_020465E4(encounter->setup, fieldSystem); if (encounter->setup->winFlag == BATTLE_OUTCOME_MON_CAUGHT) { SafariZone *safariZone = Save_SafariZone_Get(fieldSystem->saveData); - Pokemon *pokemon = Party_GetMonByIndex(encounter->setup->party[BATTLER_ENEMY], 0); + Pokemon *pokemon = Party_GetMonByIndex(encounter->setup->party[BATTLER_ENEMY], 0); sub_02060FE0(safariZone, pokemon); } @@ -483,7 +483,7 @@ static BOOL Task_SafariEncounter(TaskManager *taskManager) { } } else { PCStorage *pc = SaveArray_PCStorage_Get(fieldSystem->saveData); - Party *party = SaveArray_Party_Get(fieldSystem->saveData); + Party *party = SaveArray_Party_Get(fieldSystem->saveData); if (PCStorage_FindFirstBoxWithEmptySlot(pc) == NUM_BOXES && Party_GetCount(party) == PARTY_SIZE) { QueueScript(taskManager, 0x2276, NULL, NULL); } @@ -531,8 +531,8 @@ void SetupAndStartWildBattle(TaskManager *taskManager, u16 species, u8 level, u3 static BOOL Task_PalParkEncounter(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - Encounter *encounter = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: @@ -583,7 +583,7 @@ void sub_02046F70(FieldSystem *fieldSystem, BattleSetup *setup) { void SetupAndStartFirstBattle(TaskManager *taskManager, u16 species, u8 level) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - BattleSetup *setup = BattleSetup_New(HEAP_ID_FIELD, BATTLE_TYPE_NONE); + BattleSetup *setup = BattleSetup_New(HEAP_ID_FIELD, BATTLE_TYPE_NONE); BattleSetup_InitFromFieldSystem(setup, fieldSystem); ov06_0223CD7C(fieldSystem, species, level, setup); @@ -596,9 +596,9 @@ void SetupAndStartFirstBattle(TaskManager *taskManager, u16 species, u8 level) { } static BOOL Task_TutorialBattle(TaskManager *taskManager) { - Encounter *encounter = TaskManager_GetEnvironment(taskManager); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: @@ -638,7 +638,7 @@ void SetupAndStartTutorialBattle(TaskManager *taskManager) { BattleSetup *setup; FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - setup = sub_02047814(HEAP_ID_FIELD, fieldSystem); + setup = sub_02047814(HEAP_ID_FIELD, fieldSystem); encounter = Encounter_New(setup, sub_020475A0(setup), sub_020475B0(setup), NULL); TaskManager_Call(taskManager, Task_TutorialBattle, encounter); @@ -665,8 +665,8 @@ void SetupAndStartTrainerBattle(TaskManager *taskManager, u32 opponentTrainer1, setup = BattleSetup_New(HEAP_ID_FIELD, battleType); BattleSetup_InitFromFieldSystem(setup, fieldSystem); - setup->trainerId[BATTLER_ENEMY] = opponentTrainer1; - setup->trainerId[BATTLER_ENEMY2] = opponentTrainer2; + setup->trainerId[BATTLER_ENEMY] = opponentTrainer1; + setup->trainerId[BATTLER_ENEMY2] = opponentTrainer2; setup->trainerId[BATTLER_PLAYER2] = followerTrainerNum; EnemyTrainerSet_Init(setup, fieldSystem->saveData, heapId); @@ -703,7 +703,7 @@ void sub_020471C0(TaskManager *taskManager, s32 target, s32 maxLevel, u32 flag) sub_02047BC0(setup, fieldSystem, maxLevel); - encounter = Encounter_New(setup, sub_020475A0(setup), sub_020475B0(setup), NULL); + encounter = Encounter_New(setup, sub_020475A0(setup), sub_020475B0(setup), NULL); encounter->unkC = target; TaskManager_Call(taskManager, Task_020467FC, encounter); @@ -711,8 +711,8 @@ void sub_020471C0(TaskManager *taskManager, s32 target, s32 maxLevel, u32 flag) static BOOL sub_02047220(TaskManager *taskManager) { FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - Encounter *encounter = TaskManager_GetEnvironment(taskManager); - u32 *state = TaskManager_GetStatePtr(taskManager); + Encounter *encounter = TaskManager_GetEnvironment(taskManager); + u32 *state = TaskManager_GetStatePtr(taskManager); switch (*state) { case 0: @@ -751,7 +751,7 @@ void sub_020472B0(FieldSystem *fieldSystem, Party *party, s32 battleType) { static void sub_020472F4(FieldSystem *fieldSystem, BattleSetup *setup) { Pokemon *mon; u32 battleType = setup->flags; - u32 winFlag = setup->winFlag; + u32 winFlag = setup->winFlag; if (battleType & BATTLE_TYPE_LINK || battleType & BATTLE_TYPE_TOWER) { return; @@ -785,7 +785,7 @@ static void sub_020472F4(FieldSystem *fieldSystem, BattleSetup *setup) { static void sub_020473CC(FieldSystem *fieldSystem, BattleSetup *setup) { Pokemon *mon; u32 battleType = setup->flags; - u32 winFlag = setup->winFlag; + u32 winFlag = setup->winFlag; if (battleType & BATTLE_TYPE_LINK || battleType & BATTLE_TYPE_TOWER || battleType & BATTLE_TYPE_PAL_PARK) { return; diff --git a/arm9/src/error_message_reset.c b/arm9/src/error_message_reset.c index 073edfd44..91b7b1745 100644 --- a/arm9/src/error_message_reset.c +++ b/arm9/src/error_message_reset.c @@ -19,53 +19,53 @@ #include "unk_02031734.h" static const struct WindowTemplate sErrorMessageWindowTemplate = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 3, - .top = 3, - .width = 26, - .height = 18, - .palette = 1, + .bgId = GF_BG_LYR_MAIN_0, + .left = 3, + .top = 3, + .width = 26, + .height = 18, + .palette = 1, .baseTile = 0x23 }; static const struct HeapParam sErrorMessageHeapParams = { - .size = 0x00020000, + .size = 0x00020000, .arena = OS_ARENA_MAIN }; static const struct GraphicsModes sErrorMessageBgModeSet = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D }; static const struct BgTemplate sErrorMessageBgTemplate = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x18000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .mosaic = FALSE + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = FALSE }; static const struct GraphicsBanks sErrorMessageBanksConfig = { - .bg = GX_VRAM_BG_256_AB, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_NONE, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_NONE, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_NONE, + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_NONE, - .texpltt = GX_VRAM_TEXPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE, }; static u32 sErrorMessagePrinterLock; @@ -131,7 +131,7 @@ void PrintErrorMessageAndReset() { BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27)); struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0200_bin, HEAP_ID_DEFAULT); - struct String *str = String_New(6 << 6, HEAP_ID_DEFAULT); + struct String *str = String_New(6 << 6, HEAP_ID_DEFAULT); ResetAllTextPrinters(); AddWindow(ptr, &buf, &sErrorMessageWindowTemplate); diff --git a/arm9/src/field_system_rtc_weather.c b/arm9/src/field_system_rtc_weather.c index 969d1a4b7..e1a5cb9a0 100644 --- a/arm9/src/field_system_rtc_weather.c +++ b/arm9/src/field_system_rtc_weather.c @@ -1845,7 +1845,7 @@ u32 FieldSystem_GetWeather(FieldSystem *fieldSystem, u32 mapId) { return weatherType; } SysInfo_RTC *sysInfoRTC = Save_SysInfo_RTC_Get(fieldSystem->saveData); - s32 dayOfYear = GF_RTC_GetDayOfYear(&sysInfoRTC->date) - 1; + s32 dayOfYear = GF_RTC_GetDayOfYear(&sysInfoRTC->date) - 1; GF_ASSERT(dayOfYear >= 0 && dayOfYear < 366); if (sysInfoRTC->date.month > 2) { u32 year = sysInfoRTC->date.year; @@ -1863,7 +1863,7 @@ u32 FieldSystem_GetWeather(FieldSystem *fieldSystem, u32 mapId) { dayOfYear = 1; } weatherType -= WEATHER_UNKNOWN_24; - u32 index = 5 * dayOfYear + weatherType; + u32 index = 5 * dayOfYear + weatherType; weatherType = sWeatherTable[index]; return weatherType; } diff --git a/arm9/src/filesystem.c b/arm9/src/filesystem.c index 06a482d2c..acaa45ada 100644 --- a/arm9/src/filesystem.c +++ b/arm9/src/filesystem.c @@ -161,11 +161,11 @@ static char *sNarcFileList[] = { void ReadFromNarcMemberByPathAndId(void *dest, const char *path, s32 file_idx, u32 offset, u32 size) { FSFile file; register u32 chunk_starts[3]; - u32 btnf_size = 0; + u32 btnf_size = 0; u32 chunk_size = 0; u32 file_start = 0; - u32 file_end = 0; - u16 num_files = 0; + u32 file_end = 0; + u16 num_files = 0; FS_InitFile(&file); FS_OpenFile(&file, path); @@ -199,12 +199,12 @@ void ReadFromNarcMemberByPathAndId(void *dest, const char *path, s32 file_idx, u void *AllocAndReadFromNarcMemberByPathAndId(const char *path, s32 file_idx, HeapID heapId, u32 offset, u32 size, BOOL r4) { FSFile file; register u32 chunk_starts[3]; - u32 btnf_size = 0; + u32 btnf_size = 0; u32 chunk_size = 0; u32 file_start = 0; - u32 file_end = 0; - u16 num_files = 0; - void *dest = NULL; + u32 file_end = 0; + u16 num_files = 0; + void *dest = NULL; FS_InitFile(&file); FS_OpenFile(&file, path); @@ -271,11 +271,11 @@ void *AllocAtEndAndReadFromNarcMemberByIdPair(NarcId narc_id, s32 file_id, HeapI u32 GetNarcMemberSizeByIdPair(NarcId narc_id, s32 file_idx) { FSFile file; register u32 chunk_starts[3]; - u32 btnf_size = 0; + u32 btnf_size = 0; u32 chunk_size = 0; u32 file_start = 0; - u32 file_end = 0; - u16 num_files = 0; + u32 file_end = 0; + u16 num_files = 0; FS_InitFile(&file); FS_OpenFile(&file, sNarcFileList[narc_id]); diff --git a/arm9/src/font.c b/arm9/src/font.c index 9f1b57045..e8b3470d9 100644 --- a/arm9/src/font.c +++ b/arm9/src/font.c @@ -94,7 +94,7 @@ u32 FontFunc(u32 fontId, struct TextPrinter *printer) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&printer->subStructFields); if (subStruct->hasGlyphIdBeenSet == 0) { - subStruct->glyphId = fontId; + subStruct->glyphId = fontId; subStruct->hasGlyphIdBeenSet = 1; } diff --git a/arm9/src/game_init.c b/arm9/src/game_init.c index 6c0c1eda7..40eb6a002 100644 --- a/arm9/src/game_init.c +++ b/arm9/src/game_init.c @@ -44,25 +44,25 @@ void sub_02015EF4(void) { } void Main_SetVBlankIntrCB(void (*a0)(void *), void *a1) { - gSystem.vBlankIntr = a0; + gSystem.vBlankIntr = a0; gSystem.vBlankIntrArg = a1; } void sub_02015F1C(void) { Main_ToggleHBlankInterrupt(FALSE); - gSystem.hBlankIntr = NULL; + gSystem.hBlankIntr = NULL; gSystem.hBlankIntrArg = NULL; } BOOL Main_SetHBlankIntrCB(void (*a0)(void *), void *a1) { if (a0 == 0) { Main_ToggleHBlankInterrupt(FALSE); - gSystem.hBlankIntr = NULL; + gSystem.hBlankIntr = NULL; gSystem.hBlankIntrArg = NULL; return TRUE; } else if (gSystem.hBlankIntr == NULL) { gSystem.hBlankIntrArg = a1; - gSystem.hBlankIntr = a0; + gSystem.hBlankIntr = a0; Main_ToggleHBlankInterrupt(TRUE); return TRUE; } else { @@ -135,15 +135,15 @@ void InitSystemForTheGame(void) { GX_VBlankIntr(TRUE); FS_Init(1); sub_02022450(); - u32 size = FS_TryLoadTable(NULL, 0); + u32 size = FS_TryLoadTable(NULL, 0); void *table = OS_AllocFromArenaLo(OS_ARENA_MAIN, size, 4); GF_ASSERT(table != NULL); FS_TryLoadTable(table, size); - gSystem.vBlankIntr = NULL; - gSystem.hBlankIntr = NULL; - gSystem.unk10 = 0; - gSystem.unk14 = 0; - gSystem.unk2C = 0; + gSystem.vBlankIntr = NULL; + gSystem.hBlankIntr = NULL; + gSystem.unk10 = 0; + gSystem.unk14 = 0; + gSystem.unk2C = 0; gSystem.screensFlipped = 0; } @@ -164,7 +164,7 @@ void *AllocAndReadFile(HeapID heapId, const char *path) { FS_InitFile(&file); if (FS_OpenFile(&file, path)) { u32 size = file.prop.file.bottom - file.prop.file.top; - ret = AllocFromHeap(heapId, size); + ret = AllocFromHeap(heapId, size); if (ret != NULL) { if (size != FS_ReadFile(&file, ret, (s32)size)) { FreeToHeapExplicit(heapId, ret); @@ -226,7 +226,7 @@ int GetFileCacheId(u32 hash) { int AddFileToCache(void *contents, u32 hash) { for (int i = 0; i < 128; i++) { if (sFileCache[i].contents == NULL) { - sFileCache[i].contents = contents; + sFileCache[i].contents = contents; sFileCache[i].name_hash = hash; return i; } @@ -238,7 +238,7 @@ void ClearFileCache(void) { for (int i = 127; i > -1; i--) { if (sFileCache[i].contents != NULL) { FreeToHeap(sFileCache[i].contents); - sFileCache[i].contents = NULL; + sFileCache[i].contents = NULL; sFileCache[i].name_hash = 0; } } @@ -256,7 +256,7 @@ void *OpenFileCached(const s8 *str, HeapID heapId) { } else { strcpy(filenameBuf, str); } - u32 hash = GetFilenameHash(filenameBuf); + u32 hash = GetFilenameHash(filenameBuf); s32 cacheId = GetFileCacheId(hash); if (cacheId >= 0 && skipCache == 0) { ret = sFileCache[cacheId].contents; @@ -264,7 +264,7 @@ void *OpenFileCached(const s8 *str, HeapID heapId) { FS_InitFile(&file); if (FS_OpenFile(&file, (const char *)filenameBuf)) { u32 size = file.prop.file.bottom - file.prop.file.top; - ret = AllocFromHeap(heapId, size); + ret = AllocFromHeap(heapId, size); if (ret != NULL) { if (size != FS_ReadFile(&file, ret, (s32)size)) { FreeToHeap(ret); @@ -284,27 +284,27 @@ void *OpenFileCached(const s8 *str, HeapID heapId) { void InitKeypadAndTouchpad(void) { TPCalibrateParam tp; - gSystem.buttonMode = 0; - gSystem.heldKeysRaw = 0; - gSystem.newKeysRaw = 0; - gSystem.newAndRepeatedKeysRaw = 0; - gSystem.heldKeys = 0; - gSystem.newKeys = 0; - gSystem.newAndRepeatedKeys = 0; - gSystem.keyRepeatCounter = 0; + gSystem.buttonMode = 0; + gSystem.heldKeysRaw = 0; + gSystem.newKeysRaw = 0; + gSystem.newAndRepeatedKeysRaw = 0; + gSystem.heldKeys = 0; + gSystem.newKeys = 0; + gSystem.newAndRepeatedKeys = 0; + gSystem.keyRepeatCounter = 0; gSystem.keyRepeatContinueDelay = 8; - gSystem.keyRepeatStartDelay = 15; - gSystem.touchX = 0; - gSystem.touchY = 0; - gSystem.touchNew = 0; - gSystem.touchHeld = 0; - gSystem.touchpadReadAuto = 0; + gSystem.keyRepeatStartDelay = 15; + gSystem.touchX = 0; + gSystem.touchY = 0; + gSystem.touchNew = 0; + gSystem.touchHeld = 0; + gSystem.touchpadReadAuto = 0; TP_Init(); if (TP_GetUserInfo(&tp) == TRUE) { TP_SetCalibrateParam(&tp); } else { - tp.x0 = 686; - tp.y0 = 1420; + tp.x0 = 686; + tp.y0 = 1420; tp.xDotSize = 3621; tp.yDotSize = 4616; TP_SetCalibrateParam(&tp); @@ -327,11 +327,11 @@ void ReadKeypadAndTocuhpad(void) { TPData raw, calib; if (PAD_DetectFold()) { // Can't press any buttons while the lid is closed. - gSystem.newKeys = 0; - gSystem.heldKeys = 0; + gSystem.newKeys = 0; + gSystem.heldKeys = 0; gSystem.newAndRepeatedKeys = 0; - gSystem.touchNew = 0; - gSystem.touchHeld = 0; + gSystem.touchNew = 0; + gSystem.touchHeld = 0; return; } @@ -349,7 +349,7 @@ void ReadKeypadAndTocuhpad(void) { if (padRead != 0 && gSystem.heldKeysRaw == padRead) { if (--gSystem.keyRepeatCounter == 0) { gSystem.newAndRepeatedKeysRaw = padRead; - gSystem.keyRepeatCounter = gSystem.keyRepeatContinueDelay; + gSystem.keyRepeatCounter = gSystem.keyRepeatContinueDelay; } } else { gSystem.keyRepeatCounter = gSystem.keyRepeatStartDelay; @@ -357,8 +357,8 @@ void ReadKeypadAndTocuhpad(void) { gSystem.heldKeysRaw = padRead; // Apply the button mode option to the read key input - gSystem.newKeys = gSystem.newKeysRaw; - gSystem.heldKeys = padRead; + gSystem.newKeys = gSystem.newKeysRaw; + gSystem.heldKeys = padRead; gSystem.newAndRepeatedKeys = gSystem.newAndRepeatedKeysRaw; ApplyButtonModeToInput(); @@ -395,7 +395,7 @@ void ReadKeypadAndTocuhpad(void) { else { calib.touch = 0; } - gSystem.touchNew = (u16)((gSystem.touchHeld ^ calib.touch) & calib.touch); + gSystem.touchNew = (u16)((gSystem.touchHeld ^ calib.touch) & calib.touch); gSystem.touchHeld = calib.touch; } @@ -468,7 +468,7 @@ void ApplyButtonModeToInput(void) { void SetKeyRepeatTimers(int continueDelay, int startDelay) { gSystem.keyRepeatContinueDelay = continueDelay; - gSystem.keyRepeatStartDelay = startDelay; + gSystem.keyRepeatStartDelay = startDelay; } void SetSoftResetDisableMask(u8 a0) { diff --git a/arm9/src/gf_gfx_loader.c b/arm9/src/gf_gfx_loader.c index bdfec3e4a..d60cff9b9 100644 --- a/arm9/src/gf_gfx_loader.c +++ b/arm9/src/gf_gfx_loader.c @@ -243,10 +243,10 @@ void *GfGfxLoader_LoadFromNarc(NarcId narcId, s32 memberNo, BOOL isCompressed, H void *dest2; if (isCompressed || allocAtEnd == TRUE) { u32 size = GetNarcMemberSizeByIdPair(narcId, memberNo); - dest = AllocFromHeapAtEnd(heapId, size); + dest = AllocFromHeapAtEnd(heapId, size); } else { u32 size = GetNarcMemberSizeByIdPair(narcId, memberNo); - dest = AllocFromHeap(heapId, size); + dest = AllocFromHeap(heapId, size); } if (dest != NULL) { ReadWholeNarcMemberByIdPair(dest, narcId, memberNo); diff --git a/arm9/src/gf_rtc.c b/arm9/src/gf_rtc.c index c3ea32174..f008fd2d0 100644 --- a/arm9/src/gf_rtc.c +++ b/arm9/src/gf_rtc.c @@ -26,8 +26,8 @@ void GF_InitRTCWork(void) { RTC_Init(); memset(&sGFRTCWork, 0, sizeof(sGFRTCWork)); // todo: figure out how to use memset sGFRTCWork.getDateTimeSuccess = FALSE; - sGFRTCWork.getDateTimeLock = FALSE; - sGFRTCWork.getDateTimeSleep = 0; + sGFRTCWork.getDateTimeLock = FALSE; + sGFRTCWork.getDateTimeSleep = 0; GF_RTC_GetDateTime(&sGFRTCWork); } @@ -41,18 +41,18 @@ void GF_RTC_UpdateOnFrame(void) { } void GF_RTC_GetDateTime_Callback(RTCResult result, void *data) { - GF_RTC_Work *work = (GF_RTC_Work *)data; + GF_RTC_Work *work = (GF_RTC_Work *)data; work->getDateTimeErrorCode = result; GF_ASSERT(result == RTC_RESULT_SUCCESS); work->getDateTimeSuccess = TRUE; - work->date = work->date_async; - work->time = work->time_async; - work->getDateTimeLock = FALSE; + work->date = work->date_async; + work->time = work->time_async; + work->getDateTimeLock = FALSE; } void GF_RTC_GetDateTime(GF_RTC_Work *work) { - work->getDateTimeLock = TRUE; - RTCResult result = RTC_GetDateTimeAsync(&work->date_async, &work->time_async, GF_RTC_GetDateTime_Callback, work); + work->getDateTimeLock = TRUE; + RTCResult result = RTC_GetDateTimeAsync(&work->date_async, &work->time_async, GF_RTC_GetDateTime_Callback, work); work->getDateTimeErrorCode = result; GF_ASSERT(result == RTC_RESULT_SUCCESS); } @@ -109,9 +109,9 @@ s32 GF_RTC_GetDayOfYear(const RTCDate *date) { if (date->month >= RTC_MONTH_MARCH && IsLeapYear(date->year)) { days++; } - date_stack = *date; + date_stack = *date; date_stack.month = RTC_MONTH_JANUARY; - date_stack.day = 1; + date_stack.day = 1; RTC_ConvertDateToDay(&date_stack); RTC_ConvertDateToDay(date); return days; diff --git a/arm9/src/hall_of_fame.c b/arm9/src/hall_of_fame.c index 5759b9b31..ba2a118f2 100644 --- a/arm9/src/hall_of_fame.c +++ b/arm9/src/hall_of_fame.c @@ -23,23 +23,23 @@ void Save_HOF_RecordParty(struct HallOfFame *hof, struct Party *party, RTCDate * GF_ASSERT(hof->next_record < NUM_HOF_RECORDS); if (hof->num_total < 9999) { struct HOFParty *hof_party = &hof->parties[hof->next_record]; - int nmons = Party_GetCount(party); - struct String *str = String_New(POKEMON_NAME_LENGTH + 1, HEAP_ID_DEFAULT); + int nmons = Party_GetCount(party); + struct String *str = String_New(POKEMON_NAME_LENGTH + 1, HEAP_ID_DEFAULT); MI_CpuClear16(hof_party->party, 6 * sizeof(struct HOFMon)); int i, j; for (i = 0, j = 0; i < nmons; i++) { struct Pokemon *mon = Party_GetMonByIndex(party, i); - BOOL lock = AcquireMonLock(mon); + BOOL lock = AcquireMonLock(mon); if (!GetMonData(mon, MON_DATA_IS_EGG, NULL)) { - hof_party->party[j].species = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL); - hof_party->party[j].level = (u8)GetMonData(mon, MON_DATA_LEVEL, NULL); - hof_party->party[j].form = (u8)GetMonData(mon, MON_DATA_FORM, NULL); + hof_party->party[j].species = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL); + hof_party->party[j].level = (u8)GetMonData(mon, MON_DATA_LEVEL, NULL); + hof_party->party[j].form = (u8)GetMonData(mon, MON_DATA_FORM, NULL); hof_party->party[j].personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); - hof_party->party[j].otid = GetMonData(mon, MON_DATA_OTID, NULL); - hof_party->party[j].moves[0] = (u16)GetMonData(mon, MON_DATA_MOVE1, NULL); - hof_party->party[j].moves[1] = (u16)GetMonData(mon, MON_DATA_MOVE2, NULL); - hof_party->party[j].moves[2] = (u16)GetMonData(mon, MON_DATA_MOVE3, NULL); - hof_party->party[j].moves[3] = (u16)GetMonData(mon, MON_DATA_MOVE4, NULL); + hof_party->party[j].otid = GetMonData(mon, MON_DATA_OTID, NULL); + hof_party->party[j].moves[0] = (u16)GetMonData(mon, MON_DATA_MOVE1, NULL); + hof_party->party[j].moves[1] = (u16)GetMonData(mon, MON_DATA_MOVE2, NULL); + hof_party->party[j].moves[2] = (u16)GetMonData(mon, MON_DATA_MOVE3, NULL); + hof_party->party[j].moves[3] = (u16)GetMonData(mon, MON_DATA_MOVE4, NULL); if (str != NULL) { GetMonData(mon, MON_DATA_NICKNAME_3, str); CopyStringToU16Array(str, hof_party->party[j].nickname, POKEMON_NAME_LENGTH + 1); @@ -47,15 +47,15 @@ void Save_HOF_RecordParty(struct HallOfFame *hof, struct Party *party, RTCDate * CopyStringToU16Array(str, hof_party->party[j].otname, PLAYER_NAME_LENGTH + 1); } else { hof_party->party[j].nickname[0] = EOS; - hof_party->party[j].otname[0] = EOS; + hof_party->party[j].otname[0] = EOS; } j++; } ReleaseMonLock(mon, lock); } - hof_party->year = (u16)date->year; + hof_party->year = (u16)date->year; hof_party->month = (u8)date->month; - hof_party->day = (u8)date->day; + hof_party->day = (u8)date->day; hof->next_record++; if (hof->next_record >= NUM_HOF_RECORDS) { hof->next_record = 0; @@ -111,11 +111,11 @@ void Save_HOF_GetMonStatsByIndexPair(struct HallOfFame *hof, int a1, int a2, str hofno += NUM_HOF_RECORDS; } struct HOFMon *mon = &hof->parties[hofno].party[a2]; - dest->species = mon->species; - dest->level = mon->level; - dest->personality = mon->personality; - dest->otid = mon->otid; - dest->form = mon->form; + dest->species = mon->species; + dest->level = mon->level; + dest->personality = mon->personality; + dest->otid = mon->otid; + dest->form = mon->form; CopyU16ArrayToString(dest->nickname, mon->nickname); CopyU16ArrayToString(dest->otname, mon->otname); for (int i = 0; i < 4; i++) { @@ -132,8 +132,8 @@ void Save_HOF_GetClearDate(struct HallOfFame *hof, int a1, RTCDate *dest) { hofno += NUM_HOF_RECORDS; } struct HOFParty *party = &hof->parties[hofno]; - dest->year = party->year; - dest->month = party->month; - dest->day = party->day; - dest->week = RTC_WEEK_SUNDAY; + dest->year = party->year; + dest->month = party->month; + dest->day = party->day; + dest->week = RTC_WEEK_SUNDAY; } diff --git a/arm9/src/heap.c b/arm9/src/heap.c index 120ac7914..fa3958f65 100644 --- a/arm9/src/heap.c +++ b/arm9/src/heap.c @@ -21,7 +21,7 @@ struct HeapInfo { typedef struct MemoryBlock { u8 filler_00[12]; - u32 heapId : 8; + u32 heapId : 8; u32 filler_0D : 24; } MemoryBlock; @@ -54,14 +54,14 @@ void InitHeapSystem(const struct HeapParam *templates, u32 nTemplates, u32 total + totalNumHeaps, 4); sHeapInfo.parentHeapHandles = sHeapInfo.heapHandles + (unk_size + 1); - sHeapInfo.subHeapRawPtrs = (void **)(sHeapInfo.parentHeapHandles + unk_size); - sHeapInfo.numMemBlocks = (u16 *)(sHeapInfo.subHeapRawPtrs + unk_size); - sHeapInfo.heapIdxs = (u8 *)(sHeapInfo.numMemBlocks + totalNumHeaps); - sHeapInfo.totalNumHeaps = (u16)totalNumHeaps; - sHeapInfo.nTemplates = (u16)nTemplates; + sHeapInfo.subHeapRawPtrs = (void **)(sHeapInfo.parentHeapHandles + unk_size); + sHeapInfo.numMemBlocks = (u16 *)(sHeapInfo.subHeapRawPtrs + unk_size); + sHeapInfo.heapIdxs = (u8 *)(sHeapInfo.numMemBlocks + totalNumHeaps); + sHeapInfo.totalNumHeaps = (u16)totalNumHeaps; + sHeapInfo.nTemplates = (u16)nTemplates; sHeapInfo.unallocatedHeapId = (u16)unk_size; - sHeapInfo.maxHeaps = (u16)unk_size; + sHeapInfo.maxHeaps = (u16)unk_size; for (i = 0; i < nTemplates; i++) { switch (templates[i].arena) { @@ -77,7 +77,7 @@ void InitHeapSystem(const struct HeapParam *templates, u32 nTemplates, u32 total if (ptr != NULL) { sHeapInfo.heapHandles[i] = NNS_FndCreateExpHeap(ptr, templates[i].size); - sHeapInfo.heapIdxs[i] = (u8)i; + sHeapInfo.heapIdxs[i] = (u8)i; } else { GF_ASSERT(0); } @@ -85,7 +85,7 @@ void InitHeapSystem(const struct HeapParam *templates, u32 nTemplates, u32 total for (i = nTemplates; i < unk_size + 1; i++) { sHeapInfo.heapHandles[i] = NULL; - sHeapInfo.heapIdxs[i] = (u8)sHeapInfo.unallocatedHeapId; + sHeapInfo.heapIdxs[i] = (u8)sHeapInfo.unallocatedHeapId; } while (i < totalNumHeaps) { @@ -134,8 +134,8 @@ BOOL CreateHeapInternal(u32 parent, u32 child, u32 size, s32 alignment) { if (sHeapInfo.heapHandles[i] != NULL) { sHeapInfo.parentHeapHandles[i] = parentHeap; - sHeapInfo.subHeapRawPtrs[i] = newHeapAddr; - sHeapInfo.heapIdxs[child] = (u8)i; + sHeapInfo.subHeapRawPtrs[i] = newHeapAddr; + sHeapInfo.heapIdxs[child] = (u8)i; return TRUE; } else { @@ -164,18 +164,18 @@ void DestroyHeap(HeapID heapId) { if (handle != NULL) { NNS_FndDestroyExpHeap(handle); - u8 index = sHeapInfo.heapIdxs[heapId]; + u8 index = sHeapInfo.heapIdxs[heapId]; NNSFndHeapHandle parentHeap = sHeapInfo.parentHeapHandles[index]; - void *childRaw = sHeapInfo.subHeapRawPtrs[index]; + void *childRaw = sHeapInfo.subHeapRawPtrs[index]; if (parentHeap != NULL && childRaw != NULL) { NNS_FndFreeToExpHeap(parentHeap, childRaw); } else { GF_ASSERT(0); } - sHeapInfo.heapHandles[sHeapInfo.heapIdxs[heapId]] = NULL; + sHeapInfo.heapHandles[sHeapInfo.heapIdxs[heapId]] = NULL; sHeapInfo.parentHeapHandles[sHeapInfo.heapIdxs[heapId]] = NULL; - sHeapInfo.subHeapRawPtrs[sHeapInfo.heapIdxs[heapId]] = NULL; + sHeapInfo.subHeapRawPtrs[sHeapInfo.heapIdxs[heapId]] = NULL; sHeapInfo.heapIdxs[heapId] = (u8)sHeapInfo.unallocatedHeapId; } @@ -208,7 +208,7 @@ void *AllocFromHeap(HeapID heapId, u32 size) { void *ptr = NULL; if ((u32)heapId < sHeapInfo.totalNumHeaps) { u8 index = sHeapInfo.heapIdxs[heapId]; - ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, 4, heapId); + ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, 4, heapId); } if (ptr != NULL) { sHeapInfo.numMemBlocks[heapId]++; @@ -223,7 +223,7 @@ void *AllocFromHeapAtEnd(HeapID heapId, u32 size) { void *ptr = NULL; if ((u32)heapId < sHeapInfo.totalNumHeaps) { u8 index = sHeapInfo.heapIdxs[heapId]; - ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, -4, heapId); + ptr = AllocFromHeapInternal(sHeapInfo.heapHandles[index], size, -4, heapId); } if (ptr != NULL) { @@ -240,7 +240,7 @@ void FreeToHeap(void *ptr) { HeapID heapId = (HeapID)(((MemoryBlock *)ptr)->heapId); if ((u32)heapId < sHeapInfo.totalNumHeaps) { - u8 index = sHeapInfo.heapIdxs[heapId]; + u8 index = sHeapInfo.heapIdxs[heapId]; NNSFndHeapHandle heap = sHeapInfo.heapHandles[index]; GF_ASSERT(heap != NULL); @@ -263,7 +263,7 @@ void FreeToHeapExplicit(HeapID heapId, void *ptr) { GF_ASSERT(OS_GetProcMode() != OS_PROCMODE_IRQ); if ((u32)heapId < sHeapInfo.totalNumHeaps) { - u8 index = sHeapInfo.heapIdxs[heapId]; + u8 index = sHeapInfo.heapIdxs[heapId]; NNSFndHeapHandle heap = sHeapInfo.heapHandles[index]; GF_ASSERT(heap != NULL); diff --git a/arm9/src/igt.c b/arm9/src/igt.c index 3f4886aa4..7cd56632e 100644 --- a/arm9/src/igt.c +++ b/arm9/src/igt.c @@ -3,7 +3,7 @@ #include "global.h" void InitIGT(struct IGT *igt) { - igt->hours = 0; + igt->hours = 0; igt->minutes = 0; igt->seconds = 0; } @@ -15,7 +15,7 @@ void AddIGTSeconds(struct IGT *igt, u32 to_add) { } seconds = (u32)(igt->seconds + to_add); minutes = (u32)igt->minutes; - hours = (u32)igt->hours; + hours = (u32)igt->hours; if (seconds > 59) { minutes += seconds / 60; seconds %= 60; @@ -23,13 +23,13 @@ void AddIGTSeconds(struct IGT *igt, u32 to_add) { hours += minutes / 60; minutes %= 60; if (hours >= 999) { - hours = 999; + hours = 999; minutes = 59; seconds = 59; } } } - igt->hours = (u16)hours; + igt->hours = (u16)hours; igt->minutes = (u8)minutes; igt->seconds = (u8)seconds; } diff --git a/arm9/src/itemtool.c b/arm9/src/itemtool.c index a72c36ecf..d4057c725 100644 --- a/arm9/src/itemtool.c +++ b/arm9/src/itemtool.c @@ -773,7 +773,7 @@ void GetItemDescIntoString(struct String *dest, u16 item_id, HeapID heapId) { u32 GetItemAttr(u16 item, u32 attr, HeapID heapId) { u32 ret; struct ItemData *itemData = (struct ItemData *)LoadItemDataOrGfx(item, 0, heapId); - ret = GetItemAttr_PreloadedItemData(itemData, attr); + ret = GetItemAttr_PreloadedItemData(itemData, attr); FreeToHeapExplicit(heapId, itemData); return ret; } diff --git a/arm9/src/list_menu.c b/arm9/src/list_menu.c index 3b13ac5ca..de25faa51 100644 --- a/arm9/src/list_menu.c +++ b/arm9/src/list_menu.c @@ -14,20 +14,20 @@ void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 onInit); struct ListMenu *ListMenuInit(const struct ListMenuTemplate *template, u16 cursorPos, u16 itemsAbove, u8 heapId) { struct ListMenu *list = AllocFromHeap((HeapID)heapId, sizeof(struct ListMenu)); - list->template = *template; - list->cursor = ListMenuCursorNew((HeapID)heapId); - list->cursorPos = cursorPos; - list->itemsAbove = itemsAbove; - list->unk_30 = 0; - list->unk_31 = 0; - list->taskId = 0xFF; - list->unk_33 = 0; - list->heapId = heapId; - list->cursorPal = list->template.cursorPal; - list->fillValue = list->template.fillValue; + list->template = *template; + list->cursor = ListMenuCursorNew((HeapID)heapId); + list->cursorPos = cursorPos; + list->itemsAbove = itemsAbove; + list->unk_30 = 0; + list->unk_31 = 0; + list->taskId = 0xFF; + list->unk_33 = 0; + list->heapId = heapId; + list->cursorPal = list->template.cursorPal; + list->fillValue = list->template.fillValue; list->cursorShadowPal = list->template.cursorShadowPal; - list->lettersSpacing = list->template.lettersSpacing; - list->fontId = list->template.fontId; + list->lettersSpacing = list->template.lettersSpacing; + list->fontId = list->template.fontId; list->overrideEnabled = FALSE; if (list->template.totalItems < list->template.maxShowed) { list->template.maxShowed = list->template.totalItems; @@ -63,15 +63,15 @@ s32 ListMenu_ProcessInput(struct ListMenu *list) { switch (list->template.scrollMultiple) { case LIST_NO_MULTIPLE_SCROLL: default: - leftButton = FALSE; + leftButton = FALSE; rightButton = FALSE; break; case LIST_MULTIPLE_SCROLL_DPAD: - leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_LEFT_MASK); + leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_LEFT_MASK); rightButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_RIGHT_MASK); break; case LIST_MULTIPLE_SCROLL_L_R: - leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_L_MASK); + leftButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_L_MASK); rightButton = (u16)(gSystem.newAndRepeatedKeys & REG_PAD_KEYINPUT_R_MASK); break; } @@ -113,10 +113,10 @@ s32 ListMenuTestInputInternal(struct ListMenu *list, const struct ListMenuTempla if (template != NULL) { list->template = *template; } - list->cursorPos = cursorPos; + list->cursorPos = cursorPos; list->itemsAbove = itemsAbove; - list->unk_30 = 0; - list->unk_31 = 0; + list->unk_30 = 0; + list->unk_31 = 0; if (input == REG_PAD_KEYINPUT_UP_MASK) { ListMenuChangeSelection(list, (u8)updateFlag, 1, FALSE); @@ -137,8 +137,8 @@ s32 ListMenuTestInput(struct ListMenu *list, const struct ListMenuTemplate *temp } void ListMenuOverrideSetColors(struct ListMenu *list, u8 cursorPal, u8 fillValue, u8 cursorShadowPal) { - list->cursorPal = cursorPal; - list->fillValue = fillValue; + list->cursorPal = cursorPal; + list->fillValue = fillValue; list->cursorShadowPal = cursorShadowPal; list->overrideEnabled = TRUE; } @@ -310,8 +310,8 @@ void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u1 void ListMenuDrawCursor(struct ListMenu *list) { u8 yMultiplier = (u8)(GetFontAttribute((u8)list->template.fontId, 1) + list->template.itemVerticalPadding); - u8 x = list->template.cursor_X; - u8 y = (u8)(list->itemsAbove * yMultiplier + list->template.upText_Y); + u8 x = list->template.cursor_X; + u8 y = (u8)(list->itemsAbove * yMultiplier + list->template.upText_Y); switch (list->template.cursorKind) { case 0: ListMenuUpdateCursorObj(list->cursor, list->template.window, x, y); @@ -327,8 +327,8 @@ void ListMenuErasePrintedCursor(struct ListMenu *list, u16 itemsAbove) { switch (list->template.cursorKind) { case 0: u8 yMultiplier = (u8)(GetFontAttribute(list->template.fontId, 1) + list->template.itemVerticalPadding); - u8 width = 8; - u8 height = 16; + u8 width = 8; + u8 height = 16; FillWindowPixelRect(list->template.window, list->template.fillValue, list->template.cursor_X, @@ -349,7 +349,7 @@ u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, u8 movin u16 newRow; itemsAbove = list->itemsAbove; - cursorPos = list->cursorPos; + cursorPos = list->cursorPos; if (!movingDown) { if (list->template.maxShowed == 1) { @@ -376,7 +376,7 @@ u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, u8 movin } } list->itemsAbove = newRow; - list->cursorPos = (u16)(cursorPos - 1); + list->cursorPos = (u16)(cursorPos - 1); } } else { if (list->template.maxShowed == 1) { @@ -403,7 +403,7 @@ u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, u8 movin } } list->itemsAbove = newRow; - list->cursorPos = (u16)(cursorPos + 1); + list->cursorPos = (u16)(cursorPos + 1); } } return 2; @@ -422,8 +422,8 @@ void ListMenuScroll(struct ListMenu *list, u8 count, u8 movingDown) { ScrollWindow(list->template.window, 1, (u8)(count * yMultiplier), (u8)((list->template.fillValue << 4) | list->template.fillValue)); ListMenuPrintEntries(list, list->cursorPos, 0, count); - y = (u16)((list->template.maxShowed * yMultiplier) + list->template.upText_Y); - width = GetWindowWidth(list->template.window); + y = (u16)((list->template.maxShowed * yMultiplier) + list->template.upText_Y); + width = GetWindowWidth(list->template.window); height = GetWindowHeight(list->template.window); FillWindowPixelRect(list->template.window, list->template.fillValue, @@ -452,8 +452,8 @@ BOOL ListMenuChangeSelection(struct ListMenu *list, u8 updateCursorAndCallCallba u16 oldSelectedRow; u8 selectionChange, i, cursorCount; - oldSelectedRow = list->itemsAbove; - cursorCount = 0; + oldSelectedRow = list->itemsAbove; + cursorCount = 0; selectionChange = 0; for (i = 0; i < count; i++) { do { diff --git a/arm9/src/list_menu_items.c b/arm9/src/list_menu_items.c index a52b6775e..58e2cf0eb 100644 --- a/arm9/src/list_menu_items.c +++ b/arm9/src/list_menu_items.c @@ -12,10 +12,10 @@ struct ListMenuItem *ListMenuItems_New(u32 count, HeapID heapId) { struct ListMenuItem *ret = AllocFromHeap(heapId, (count + 1) * sizeof(struct ListMenuItem)); if (ret != NULL) { for (i = 0; i < count; i++) { - ret[i].text = NULL; + ret[i].text = NULL; ret[i].value = 0; } - ret[i].text = (struct String *)-1u; + ret[i].text = (struct String *)-1u; ret[i].value = (s32)heapId; } return ret; @@ -30,7 +30,7 @@ void ListMenuItems_AppendFromMsgData(struct ListMenuItem *items, struct MsgData HeapID heapId; struct ListMenuItem *newItem = ListMenuItems_SeekEnd(items, &heapId); if (newItem != NULL) { - newItem->text = NewString_ReadMsgData(msgData, msgNo); + newItem->text = NewString_ReadMsgData(msgData, msgNo); newItem->value = value; } } @@ -39,7 +39,7 @@ void ListMenuItems_AddItem(struct ListMenuItem *items, struct String *str, s32 v HeapID heapId; struct ListMenuItem *newItem = ListMenuItems_SeekEnd(items, &heapId); if (newItem != NULL) { - newItem->text = StringDup(str, heapId); + newItem->text = StringDup(str, heapId); newItem->value = value; } } @@ -48,7 +48,7 @@ void ListMenuItems_CopyItem(struct ListMenuItem *items, struct ListMenuItem *src HeapID heapId; struct ListMenuItem *newItem = ListMenuItems_SeekEnd(items, &heapId); if (newItem != NULL) { - newItem->text = src->text; + newItem->text = src->text; newItem->value = src->value; } } diff --git a/arm9/src/mail.c b/arm9/src/mail.c index 0016e6904..49085ef7f 100644 --- a/arm9/src/mail.c +++ b/arm9/src/mail.c @@ -14,11 +14,11 @@ extern u16 sub_0206B7BC(u16 species, u32 form, BOOL is_egg); void Mail_Init(struct Mail *mail) { s32 i; - mail->author_otId = 0; - mail->author_gender = 0; + mail->author_otId = 0; + mail->author_gender = 0; mail->author_language = (u8)gGameLanguage; - mail->author_version = (u8)gGameVersion; - mail->mail_type = 0xFF; + mail->author_version = (u8)gGameVersion; + mail->mail_type = 0xFF; StringFillEOS(mail->author_name, 8); for (i = 0; i < 3; i++) { mail->unk_18[i].raw = 0xFFFF; @@ -55,21 +55,21 @@ void Mail_SetNewMessageDetails(struct Mail *mail, u8 type, u8 monIdx, struct Sav Mail_Init(mail); mail->mail_type = type; - party = SaveArray_Party_Get(save); - profile = Save_PlayerData_GetProfileAddr(save); + party = SaveArray_Party_Get(save); + profile = Save_PlayerData_GetProfileAddr(save); CopyU16StringArray(mail->author_name, PlayerProfile_GetNamePtr(profile)); mail->author_gender = (u8)PlayerProfile_GetTrainerGender(profile); - mail->author_otId = PlayerProfile_GetTrainerID(profile); + mail->author_otId = PlayerProfile_GetTrainerID(profile); for (i = 0; monIdx < Party_GetCount(party); monIdx++) { union MailPatternData *ptr; - pokemon = Party_GetMonByIndex(party, monIdx); - species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - is_egg = (BOOL)GetMonData(pokemon, MON_DATA_IS_EGG, NULL); - form = GetMonData(pokemon, MON_DATA_FORM, NULL); - sp10 = sub_0206B6C8(pokemon); - r7 = sub_0206B7BC(species, form, is_egg); - ptr = &mail->unk_18[i]; + pokemon = Party_GetMonByIndex(party, monIdx); + species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); + is_egg = (BOOL)GetMonData(pokemon, MON_DATA_IS_EGG, NULL); + form = GetMonData(pokemon, MON_DATA_FORM, NULL); + sp10 = sub_0206B6C8(pokemon); + r7 = sub_0206B7BC(species, form, is_egg); + ptr = &mail->unk_18[i]; ptr->bits.unk_0 = sp10; i++; ptr->bits.unk_C = r7; @@ -188,7 +188,7 @@ s32 Mailbox_CountMessages(struct Mail *mail, BOOL r1) { struct Mail *Mailbox_AllocAndFetchMailI(struct Mail *mail, BOOL r1, s32 idx, HeapID heapId) { struct Mail *ret; mail = Mailbox_GetPtrToSlotI(mail, r1, idx); - ret = Mail_New(heapId); + ret = Mail_New(heapId); if (mail != NULL) { Mail_Copy(mail, ret); } diff --git a/arm9/src/mail_message.c b/arm9/src/mail_message.c index 492194975..a2e4dd24b 100644 --- a/arm9/src/mail_message.c +++ b/arm9/src/mail_message.c @@ -47,7 +47,7 @@ void MailMsg_Init(struct MailMessage *mailMsg) { void MailMsg_Init_WithBank(struct MailMessage *mailMsg, u16 bank) { s32 i; mailMsg->msg_bank = bank; - mailMsg->msg_no = 0; + mailMsg->msg_no = 0; for (i = 0; i < MAILMSG_FIELDS_MAX; i++) { mailMsg->fields[i] = EC_WORD_NULL; } @@ -84,7 +84,7 @@ struct String *MailMsg_GetExpandedString(struct MailMessage *mailMsg, HeapID hea BufferECWord(messageFormat, (u32)i, mailMsg->fields[i]); } msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, sMessageBanks[mailMsg->msg_bank], heapId); - ret = ReadMsgData_ExpandPlaceholders(messageFormat, msgData, mailMsg->msg_no, heapId); + ret = ReadMsgData_ExpandPlaceholders(messageFormat, msgData, mailMsg->msg_no, heapId); DestroyMsgData(msgData); MessageFormat_Delete(messageFormat); return ret; @@ -115,8 +115,8 @@ u32 MailMsg_NumFields(u16 bank, u16 num) { u32 count; GF_ASSERT(bank < NELEMS(sMessageBanks)); GF_ASSERT(num < MailMsg_NumMsgsInBank(bank)); - str = ReadMsgData_NewNarc_NewString(NARC_MSGDATA_MSG, sMessageBanks[bank], num, HEAP_ID_DEFAULT); - cstr = String_c_str(str); + str = ReadMsgData_NewNarc_NewString(NARC_MSGDATA_MSG, sMessageBanks[bank], num, HEAP_ID_DEFAULT); + cstr = String_c_str(str); count = 0; while (*cstr != EOS) { if (*cstr == EXT_CTRL_CODE_BEGIN) { @@ -168,7 +168,7 @@ u32 MailMsg_NumMsgsInBank(u16 bank) { void MailMsg_SetMsgBankAndNum(struct MailMessage *mailMsg, u16 bank, u16 num) { GF_ASSERT(bank < NELEMS(sMessageBanks)); mailMsg->msg_bank = bank; - mailMsg->msg_no = num; + mailMsg->msg_no = num; } void MailMsg_SetFieldI(struct MailMessage *mailMsg, u32 idx, u16 word) { diff --git a/arm9/src/main.c b/arm9/src/main.c index a5a73769d..eb4ce533e 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -48,7 +48,7 @@ extern struct OverlayManagerTemplate ov63_021DBE18; extern u8 SDK_STATIC_BSS_START[]; const int gGameLanguage = GAME_LANGUAGE; -const int gGameVersion = GAME_VERSION; +const int gGameVersion = GAME_VERSION; __declspec(noreturn) void NitroMain(void) { InitSystemForTheGame(); @@ -66,7 +66,7 @@ __declspec(noreturn) void NitroMain(void) { sub_02002C50(1, HEAP_ID_MAIN); sub_02002C50(3, HEAP_ID_MAIN); UNK_02016FA8.unk10 = -1; - UNK_02016FA8.save = SaveData_New(); + UNK_02016FA8.save = SaveData_New(); InitSoundData(Save_Chatot_Get(UNK_02016FA8.save), Save_PlayerData_GetOptionsAddr(UNK_02016FA8.save)); Init_Timer3(); if (sub_020337E8(3) == 3) { @@ -132,10 +132,10 @@ __declspec(noreturn) void NitroMain(void) { } void sub_02000DF4(void) { - UNK_02016FA8.mainOverlayId = SDK_OVERLAY_INVALID_ID; - UNK_02016FA8.overlayManager = NULL; + UNK_02016FA8.mainOverlayId = SDK_OVERLAY_INVALID_ID; + UNK_02016FA8.overlayManager = NULL; UNK_02016FA8.queuedMainOverlayId = SDK_OVERLAY_INVALID_ID; // overlay invalid - UNK_02016FA8.template = NULL; + UNK_02016FA8.template = NULL; } void Main_RunOverlayManager(void) { @@ -146,10 +146,10 @@ void Main_RunOverlayManager(void) { if (UNK_02016FA8.queuedMainOverlayId != SDK_OVERLAY_INVALID_ID) { HandleLoadOverlay(UNK_02016FA8.queuedMainOverlayId, 0); } - UNK_02016FA8.mainOverlayId = UNK_02016FA8.queuedMainOverlayId; - UNK_02016FA8.overlayManager = OverlayManager_New(UNK_02016FA8.template, &UNK_02016FA8.unk10, HEAP_ID_DEFAULT); + UNK_02016FA8.mainOverlayId = UNK_02016FA8.queuedMainOverlayId; + UNK_02016FA8.overlayManager = OverlayManager_New(UNK_02016FA8.template, &UNK_02016FA8.unk10, HEAP_ID_DEFAULT); UNK_02016FA8.queuedMainOverlayId = SDK_OVERLAY_INVALID_ID; - UNK_02016FA8.template = NULL; + UNK_02016FA8.template = NULL; } if (OverlayManager_Run(UNK_02016FA8.overlayManager)) { OverlayManager_Delete(UNK_02016FA8.overlayManager); @@ -163,7 +163,7 @@ void Main_RunOverlayManager(void) { void RegisterMainOverlay(FSOverlayID id, const struct OverlayManagerTemplate *template) { GF_ASSERT(UNK_02016FA8.template == NULL); UNK_02016FA8.queuedMainOverlayId = id; - UNK_02016FA8.template = template; + UNK_02016FA8.template = template; } void sub_02000E9C(void) { diff --git a/arm9/src/map_header.c b/arm9/src/map_header.c index 71b733f97..222d582af 100644 --- a/arm9/src/map_header.c +++ b/arm9/src/map_header.c @@ -663,7 +663,7 @@ u8 MapHeader_GetMoveModelBank(u32 mapno) { u16 MapHeader_GetMatrixId(u32 mapno) { u16 ret; mapno = MapNumberBoundsCheck(mapno); - ret = sMapHeaders[mapno].matrix_id; + ret = sMapHeaders[mapno].matrix_id; // Spear Pillar if (ret == NARC_map_matrix_narc_0022_bin && gGameVersion == VERSION_PEARL) { ret = NARC_map_matrix_narc_0023_bin; diff --git a/arm9/src/map_matrix.c b/arm9/src/map_matrix.c index ef1318b68..ec3152b8a 100644 --- a/arm9/src/map_matrix.c +++ b/arm9/src/map_matrix.c @@ -9,12 +9,12 @@ static void MapMatrix_MapMatrixData_Load( struct MapMatrixData *map_matrix, u16 file_id, u32 map_id) { - map_matrix->width = 0; + map_matrix->width = 0; map_matrix->height = 0; s32 i; for (i = 0; i < MAP_MATRIX_MAX_SIZE; i++) { - map_matrix->headers[i] = 0; + map_matrix->headers[i] = 0; map_matrix->altitudes[i] = 0; map_matrix->maps.data[i] = 0; } @@ -24,13 +24,13 @@ static void MapMatrix_MapMatrixData_Load( } void *buffer = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX, file_id, HEAP_ID_FIELD); - u8 *cursor = (u8 *)buffer; + u8 *cursor = (u8 *)buffer; - map_matrix->width = *(cursor++); - map_matrix->height = *(cursor++); - u8 has_headers_section = *(cursor++); + map_matrix->width = *(cursor++); + map_matrix->height = *(cursor++); + u8 has_headers_section = *(cursor++); u8 has_altitudes_section = *(cursor++); - u8 name_length = *(cursor++); + u8 name_length = *(cursor++); GF_ASSERT(name_length <= MAP_MATRIX_MAX_NAME_LENGTH); @@ -61,8 +61,8 @@ static void MapMatrix_MapMatrixData_Load( struct MapMatrix *MapMatrix_New(void) { struct MapMatrix *map_matrix = AllocFromHeap(HEAP_ID_FIELD, sizeof(struct MapMatrix)); - map_matrix->width = 0; - map_matrix->height = 0; + map_matrix->width = 0; + map_matrix->height = 0; map_matrix->matrix_id = 0; return map_matrix; @@ -74,8 +74,8 @@ void MapMatrix_Load(u16 map_id, struct MapMatrix *map_matrix) { MapMatrix_MapMatrixData_Load(&map_matrix->data, matrix_id, map_id); map_matrix->matrix_id = (u8)matrix_id; - map_matrix->height = map_matrix->data.height; - map_matrix->width = map_matrix->data.width; + map_matrix->height = map_matrix->data.height; + map_matrix->width = map_matrix->data.width; } void MapMatrix_Free(struct MapMatrix *map_matrix) { @@ -101,7 +101,7 @@ u8 MapMatrix_GetHeight(struct MapMatrix *map_matrix) { } u16 MapMatrix_GetMapHeader(struct MapMatrix *map_matrix, s32 x, s32 y) { - s32 width = map_matrix->width; + s32 width = map_matrix->width; s32 height = map_matrix->height; GF_ASSERT(x >= 0 && x < width); @@ -133,8 +133,8 @@ u32 MapMatrix_GetMapAltitude( struct MapData *MapMatrix_MapData_New(HeapID heapId) { struct MapData *map_data = AllocFromHeap(heapId, sizeof(struct MapData)); - void *buffer = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX, 0, heapId); - u8 *cursor = (u8 *)buffer; + void *buffer = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX, 0, heapId); + u8 *cursor = (u8 *)buffer; cursor += 4; u8 name_length = *cursor; @@ -172,18 +172,18 @@ u16 GetMapData(s32 map_id, struct MapMatrix *map_matrix) { } void sub_02034678(struct MapMatrix *map_matrix) { - u16 *maps = map_matrix->data.maps.data; + u16 *maps = map_matrix->data.maps.data; u8 *altitudes = map_matrix->data.altitudes; - u8 width = map_matrix->width; + u8 width = map_matrix->width; if (map_matrix->matrix_id != 0) { return; } - maps[width * 0x15 + 0x17] = 0xB0; - maps[width * 0x15 + 0x18] = 0xB0; - maps[width * 0x16 + 0x17] = 0xB0; - maps[width * 0x16 + 0x18] = 0xB0; + maps[width * 0x15 + 0x17] = 0xB0; + maps[width * 0x15 + 0x18] = 0xB0; + maps[width * 0x16 + 0x17] = 0xB0; + maps[width * 0x16 + 0x18] = 0xB0; altitudes[width * 0x15 + 0x17] = 2; altitudes[width * 0x15 + 0x18] = 2; altitudes[width * 0x16 + 0x17] = 2; @@ -192,7 +192,7 @@ void sub_02034678(struct MapMatrix *map_matrix) { void sub_020346CC(struct MapMatrix *map_matrix) { u16 *maps = map_matrix->data.maps.data; - u8 width = map_matrix->width; + u8 width = map_matrix->width; if (map_matrix->matrix_id != 0) { return; diff --git a/arm9/src/map_object.c b/arm9/src/map_object.c index 3997251df..e2a14cf53 100644 --- a/arm9/src/map_object.c +++ b/arm9/src/map_object.c @@ -160,7 +160,7 @@ void MapObjectManager_Delete(MapObjectManager *manager) { } void sub_020573C8(MapObjectManager *manager, u32 unused, u32 mapId, u32 objectCount, ObjectEvent *objectEvents) { - u32 count = MapObjectManager_GetObjectCount(manager); + u32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); for (; count != 0; count--) { @@ -254,11 +254,11 @@ LocalMapObject *MapObject_Create(MapObjectManager *manager, u32 x, u32 y, u32 di } LocalMapObject *MapObject_CreateFromObjectEventWithId(MapObjectManager *manager, u16 id, u32 objectEventCount, u32 mapNo, const ObjectEvent *events) { - LocalMapObject *ret = NULL; + LocalMapObject *ret = NULL; ObjectEvent *objectEvent = ObjectEvent_GetByID(id, objectEventCount, (ObjectEvent *)events); if (objectEvent != NULL) { // casts and typing required to match - u32 eventFlag = ObjectEvent_GetEventFlag(objectEvent); + u32 eventFlag = ObjectEvent_GetEventFlag(objectEvent); FieldSystem *fieldSystem = MapObjectManager_GetFieldSystem(manager); if (FieldSystem_FlagCheck(fieldSystem, (u16)eventFlag) == FALSE) { ret = MapObject_CreateFromObjectEvent(manager, objectEvent, mapNo); @@ -293,7 +293,7 @@ void MapObject_Remove(LocalMapObject *object) { } void MapObject_Delete(LocalMapObject *object) { - u32 eventFlag = MapObject_GetEventFlag(object); + u32 eventFlag = MapObject_GetEventFlag(object); FieldSystem *fieldSystem = MapObject_GetFieldSystem(object); FieldSystem_FlagSet(fieldSystem, eventFlag); MapObject_Remove(object); @@ -315,8 +315,8 @@ void sub_020576A8(LocalMapObject *object) { } void MapObjectManager_RemoveAllActiveObjects(MapObjectManager *manager) { - s32 i = 0; - s32 count = MapObjectManager_GetObjectCount(manager); + s32 i = 0; + s32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { // BUG: does not check for if count is zero, and will always execute at least once @@ -332,8 +332,8 @@ void MapObjectManager_RemoveAllActiveObjects(MapObjectManager *manager) { void sub_02057750(MapObjectManager *manager) { GF_ASSERT(sub_020587E0(manager) == TRUE); - s32 i = 0; - s32 count = MapObjectManager_GetObjectCount(manager); + s32 i = 0; + s32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { @@ -350,8 +350,8 @@ void sub_02057750(MapObjectManager *manager) { void sub_020577A8(MapObjectManager *manager) { GF_ASSERT(sub_020587E0(manager) == TRUE); - s32 i = 0; - s32 count = MapObjectManager_GetObjectCount(manager); + s32 i = 0; + s32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { @@ -403,29 +403,29 @@ void MapObjectManager_RestoreFromSave(MapObjectManager *manager, SavedMapObject } static void SavedMapObject_InitFromLocalMapObject(FieldSystem *fieldSystem, LocalMapObject *localObject, SavedMapObject *savedObject) { - savedObject->flags = MapObject_GetFlags(localObject); - savedObject->flags2 = MapObject_GetFlags2(localObject); - savedObject->objId = MapObject_GetID(localObject); - savedObject->mapId = MapObject_GetMapID(localObject); - savedObject->spriteId = MapObject_GetSpriteID(localObject); - savedObject->movement = MapObject_GetMovement(localObject); - savedObject->type = MapObject_GetType(localObject); - savedObject->eventFlag = MapObject_GetEventFlag(localObject); - savedObject->script = MapObject_GetScriptID(localObject); + savedObject->flags = MapObject_GetFlags(localObject); + savedObject->flags2 = MapObject_GetFlags2(localObject); + savedObject->objId = MapObject_GetID(localObject); + savedObject->mapId = MapObject_GetMapID(localObject); + savedObject->spriteId = MapObject_GetSpriteID(localObject); + savedObject->movement = MapObject_GetMovement(localObject); + savedObject->type = MapObject_GetType(localObject); + savedObject->eventFlag = MapObject_GetEventFlag(localObject); + savedObject->script = MapObject_GetScriptID(localObject); savedObject->initialFacing = MapObject_GetInitialFacingDirection(localObject); savedObject->currentFacing = MapObject_GetFacingDirection(localObject); - savedObject->nextFacing = MapObject_GetNextFacingDirection(localObject); - savedObject->param[0] = MapObject_GetParam(localObject, 0); - savedObject->param[1] = MapObject_GetParam(localObject, 1); - savedObject->param[2] = MapObject_GetParam(localObject, 2); - savedObject->xRange = MapObject_GetXRange(localObject); - savedObject->yRange = MapObject_GetYRange(localObject); - savedObject->initialX = MapObject_GetInitialX(localObject); - savedObject->initialY = MapObject_GetInitialY(localObject); - savedObject->initialZ = MapObject_GetInitialZ(localObject); - savedObject->currentX = MapObject_GetCurrentX(localObject); - savedObject->currentY = MapObject_GetCurrentY(localObject); - savedObject->currentZ = MapObject_GetCurrentZ(localObject); + savedObject->nextFacing = MapObject_GetNextFacingDirection(localObject); + savedObject->param[0] = MapObject_GetParam(localObject, 0); + savedObject->param[1] = MapObject_GetParam(localObject, 1); + savedObject->param[2] = MapObject_GetParam(localObject, 2); + savedObject->xRange = MapObject_GetXRange(localObject); + savedObject->yRange = MapObject_GetYRange(localObject); + savedObject->initialX = MapObject_GetInitialX(localObject); + savedObject->initialY = MapObject_GetInitialY(localObject); + savedObject->initialZ = MapObject_GetInitialZ(localObject); + savedObject->currentX = MapObject_GetCurrentX(localObject); + savedObject->currentY = MapObject_GetCurrentY(localObject); + savedObject->currentZ = MapObject_GetCurrentZ(localObject); VecFx32 coords; sub_02059E60(savedObject->currentX, savedObject->currentZ, &coords); // some kind of x y vec copy with convertion between int and fx32 @@ -467,7 +467,7 @@ static void LocalMapObject_InitFromSavedMapObject(LocalMapObject *localObject, S MapObject_SetCurrentZ(localObject, savedObject->currentZ); VecFx32 coords = {}; - coords.y = savedObject->vecY; + coords.y = savedObject->vecY; MapObject_SetPositionVector(localObject, &coords); memcpy(sub_020585B0(localObject), savedObject->unk30, 16); @@ -496,13 +496,13 @@ static void MapObject_ConvertXZToPositionVec(LocalMapObject *object) { VecFx32 position; MapObject_CopyPositionVector(object, &position); - u32 x = MapObject_GetCurrentX(object); + u32 x = MapObject_GetCurrentX(object); position.x = x * FX32_CONST(16) + FX32_CONST(8); MapObject_SetPreviousX(object, x); MapObject_SetPreviousY(object, MapObject_GetCurrentY(object)); - u32 z = MapObject_GetCurrentZ(object); + u32 z = MapObject_GetCurrentZ(object); position.z = z * FX32_CONST(16) + FX32_CONST(8); MapObject_SetPreviousZ(object, z); @@ -518,17 +518,17 @@ void MapObject_CreateFromMultipleObjectEvents(MapObjectManager *manager, u32 map MapObjectInitArgs *args = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(MapObjectInitArgs)); GF_ASSERT(args != NULL); - args->mapNo = mapNo; + args->mapNo = mapNo; args->objectEventCount = objectEventCount; - args->index = 0; - args->manager = manager; - args->objectEvents = objectEventsCopy; + args->index = 0; + args->manager = manager; + args->objectEvents = objectEventsCopy; MapObject_CreateFromInitArgs(args); } static void MapObject_CreateFromInitArgs(MapObjectInitArgs *args) { - FieldSystem *fieldSystem = MapObjectManager_GetFieldSystem(args->manager); + FieldSystem *fieldSystem = MapObjectManager_GetFieldSystem(args->manager); ObjectEvent *objectEvents = args->objectEvents; do { // must be do while due to initial check @@ -543,8 +543,8 @@ static void MapObject_CreateFromInitArgs(MapObjectInitArgs *args) { } static LocalMapObject *MapObjectManager_GetFirstInactiveObject(MapObjectManager *manager) { - s32 i = 0; - s32 count = MapObjectManager_GetObjectCount(manager); + s32 i = 0; + s32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { @@ -605,19 +605,19 @@ static void MapObject_InitFromObjectEvent(LocalMapObject *object, ObjectEvent *o static void MapObject_SetPositionVectorFromObjectEvent(LocalMapObject *object, ObjectEvent *objectEvent) { VecFx32 coords; - u16 x = ObjectEvent_GetXCoord(objectEvent); + u16 x = ObjectEvent_GetXCoord(objectEvent); coords.x = x * FX32_CONST(16) + FX32_CONST(8); MapObject_SetInitialX(object, x); MapObject_SetPreviousX(object, x); MapObject_SetCurrentX(object, x); coords.y = ObjectEvent_GetYCoord(objectEvent); - u32 y = (coords.y >> 3) / FX32_ONE; + u32 y = (coords.y >> 3) / FX32_ONE; MapObject_SetInitialY(object, y); MapObject_SetPreviousY(object, y); MapObject_SetCurrentY(object, y); - u16 z = ObjectEvent_GetZCoord(objectEvent); + u16 z = ObjectEvent_GetZCoord(objectEvent); coords.z = z * FX32_CONST(16) + FX32_CONST(8); MapObject_SetInitialZ(object, z); MapObject_SetPreviousZ(object, z); @@ -647,7 +647,7 @@ static void sub_02057E90(LocalMapObject *object, MapObjectManager *manager) { // extern const UnkLMOCallbackStruct2 ov05_021F9080; static void sub_02057F18(LocalMapObject *object) { - u32 spriteId = MapObject_GetSpriteID(object); + u32 spriteId = MapObject_GetSpriteID(object); UnkLMOCallbackStruct2 *unk = (spriteId == SPRITE_CAMERA_FOCUS) ? (UnkLMOCallbackStruct2 *)&ov05_021F9080 : sub_02058D4C(spriteId); sub_02058684(object, sub_02058D38(unk)); @@ -703,7 +703,7 @@ static LocalMapObject *MapObjectManager_GetFirstObjectWithIDAndMap(MapObjectMana LocalMapObject *MapObjectManager_GetFirstActiveObjectByID(MapObjectManager *manager, u32 id) { GF_ASSERT(manager != NULL); - s32 count = MapObjectManager_GetObjectCount(manager); + s32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects3(manager); do { if (MapObject_TestFlagsBits(objects, MAPOBJECTFLAG_ACTIVE) == TRUE && MapObject_CheckFlag25(objects) == FALSE && MapObject_GetID(objects) == id) { @@ -718,7 +718,7 @@ LocalMapObject *MapObjectManager_GetFirstActiveObjectByID(MapObjectManager *mana } LocalMapObject *MapObjectManager_GetFirstActiveObjectWithMovement(MapObjectManager *manager, u32 movement) { - s32 count = MapObjectManager_GetObjectCount(manager); + s32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects3(manager); do { @@ -740,7 +740,7 @@ BOOL MapObjectManager_GetNextObjectWithFlagFromIndex(MapObjectManager *manager, } LocalMapObject *objects = MapObjectManager_GetObjects3(manager); - LocalMapObject *object = objects + *index; + LocalMapObject *object = objects + *index; do { (*index)++; @@ -1079,13 +1079,13 @@ u32 MapObject_GetInitialFacingDirection(LocalMapObject *object) { void MapObject_SetFacingDirectionDirect(LocalMapObject *object, u32 direction) { object->previousFacing = object->currentFacing; - object->currentFacing = direction; + object->currentFacing = direction; } void MapObject_SetFacingDirection(LocalMapObject *object, u32 direction) { if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK7) == 0) { object->previousFacing = object->currentFacing; - object->currentFacing = direction; + object->currentFacing = direction; } } @@ -1099,7 +1099,7 @@ u32 MapObject_GetPreviousFacingDirection(LocalMapObject *object) { void MapObject_SetNextFacingDirection(LocalMapObject *object, u32 direction) { object->nextFacingBackup = object->nextFacing; - object->nextFacing = direction; + object->nextFacing = direction; } u32 MapObject_GetNextFacingDirection(LocalMapObject *object) { @@ -1365,7 +1365,7 @@ void sub_02058774(MapObjectManager *manager) { } void MapObjectManager_PauseAllMovement(MapObjectManager *manager) { - u32 count = MapObjectManager_GetObjectCount(manager); + u32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { if (MapObject_CheckActive(objects)) { @@ -1378,7 +1378,7 @@ void MapObjectManager_PauseAllMovement(MapObjectManager *manager) { } void MapObjectManager_UnpauseAllMovement(MapObjectManager *manager) { - u32 count = MapObjectManager_GetObjectCount(manager); + u32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { if (MapObject_CheckActive(objects)) { @@ -1851,7 +1851,7 @@ static u16 ObjectEvent_GetZCoord(ObjectEvent *objectEvent) { } static ObjectEvent *ObjectEvent_GetByID(u16 id, s32 objectEventCount, ObjectEvent *objectEvents) { - s32 i = 0; + s32 i = 0; ObjectEvent *objectEvent = objectEvents; do { if (!ObjectEvent_ScriptIDIsUnset(objectEvent) && id == ObjectEvent_GetID(objectEvent)) { @@ -1927,7 +1927,7 @@ static UnkLMOCallbackStruct2 *sub_02058D4C(u32 spriteId) { } LocalMapObject *MapObjectManager_GetFirstObjectWithXAndZ(MapObjectManager *manager, u32 x, u32 z) { - u32 count = MapObjectManager_GetObjectCount(manager); + u32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { diff --git a/arm9/src/math_util.c b/arm9/src/math_util.c index 3f7f8c936..fba1e3e01 100644 --- a/arm9/src/math_util.c +++ b/arm9/src/math_util.c @@ -585,15 +585,15 @@ u32 MTRandom(void) { } for (i = 0; i < 227; i++) { - val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff); + val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff); sMTRNG_State[i] = sMTRNG_State[i + 397] ^ (val >> 1) ^ sMTRNG_XOR[val & 0x1]; } for (; i < 623; i++) { - val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff); + val = (sMTRNG_State[i] & 0x80000000) | (sMTRNG_State[i + 1] & 0x7fffffff); sMTRNG_State[i] = sMTRNG_State[i + -227] ^ (val >> 1) ^ sMTRNG_XOR[val & 0x1]; } - val = (sMTRNG_State[623] & 0x80000000) | (sMTRNG_State[0] & 0x7fffffff); + val = (sMTRNG_State[623] & 0x80000000) | (sMTRNG_State[0] & 0x7fffffff); sMTRNG_State[623] = sMTRNG_State[396] ^ (val >> 1) ^ sMTRNG_XOR[val & 0x1]; sMTRNG_Cycles = 0; @@ -665,7 +665,7 @@ s32 CircularDistance(s32 x1, s32 y1, s32 x2, s32 y2) { v2.z = 0; VEC_Subtract(&v2, &v1, &v4); - f2 = VEC_DotProduct(&v3, &v4); + f2 = VEC_DotProduct(&v3, &v4); ret = f2 >> FX32_INT_SHIFT; ret = (ret < 0) ? -ret : ret; diff --git a/arm9/src/message_format.c b/arm9/src/message_format.c index c51546cfe..e50cc2193 100644 --- a/arm9/src/message_format.c +++ b/arm9/src/message_format.c @@ -52,7 +52,7 @@ MessageFormat *MessageFormat_New_Custom(u32 nstr, u32 strlen, HeapID heapId) { GF_ASSERT(strlen != 0); MessageFormat *messageFormat = AllocFromHeapAtEnd(heapId, sizeof(MessageFormat)); if (messageFormat != NULL) { - messageFormat->count = nstr; + messageFormat->count = nstr; messageFormat->heapId = heapId; messageFormat->buffer = String_New(strlen, heapId); if (messageFormat->buffer != NULL) { @@ -125,7 +125,7 @@ void BufferRivalsName(MessageFormat *messageFormat, u32 idx, struct SaveData *sa } void BufferFriendsName(MessageFormat *messageFormat, u32 idx, struct SaveData *save) { - PlayerProfile *profile = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *profile = Save_PlayerData_GetProfileAddr(save); struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0497_bin, messageFormat->heapId); if (PlayerProfile_GetTrainerGender(profile) == PLAYER_GENDER_MALE) { ReadMsgDataIntoString(msgData, narc_0497_00001, messageFormat->buffer); // Dawn @@ -518,8 +518,8 @@ void BufferSealNamePlural(MessageFormat *messageFormat, u32 idx, u32 seal) { } void BufferLocationName(MessageFormat *messageFormat, u32 idx, u16 location) { - u32 r6 = (u32)sub_02015CC0(location); - u32 r4 = (u32)sub_02015CE0(location); + u32 r6 = (u32)sub_02015CC0(location); + u32 r4 = (u32)sub_02015CE0(location); struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, UNK_020ECE64[r6], messageFormat->heapId); if (msgData != NULL) { if (r4 < MsgDataGetCount(msgData)) { @@ -577,9 +577,9 @@ void BufferContestBackgroundName(MessageFormat *messageFormat, u32 idx, u32 bg) } void BufferGroupName(MessageFormat *messageFormat, struct SaveData *save, u32 r5, u32 idx, u32 sp28) { - void *r6 = sub_0202881C(save); - u8 sp10 = sub_020287F8(r6, r5); - u8 r7 = sub_02028804(r6, r5); + void *r6 = sub_0202881C(save); + u8 sp10 = sub_020287F8(r6, r5); + u8 r7 = sub_02028804(r6, r5); struct String *r4 = String_New(64, HEAP_ID_4); CopyU16ArrayToString(r4, sub_020287A8(r6, r5, sp28)); BufferString(messageFormat, idx, r4, sp10, 1, r7); @@ -614,7 +614,7 @@ void StringExpandPlaceholders(MessageFormat *messageFormat, struct String *dest, cstr = MsgArray_SkipControlCode(cstr); } else { const u16 *before = cstr; - cstr = MsgArray_SkipControlCode(cstr); + cstr = MsgArray_SkipControlCode(cstr); while (before < cstr) { StrAddChar(dest, *before++); } diff --git a/arm9/src/move_relearner.c b/arm9/src/move_relearner.c index 75da98e61..5be967a3d 100644 --- a/arm9/src/move_relearner.c +++ b/arm9/src/move_relearner.c @@ -16,8 +16,8 @@ void MoveRelearner_Delete(MoveRelearner *moveRelearner) { u16 *MoveRelearner_GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId) { u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); - u8 form = GetMonData(mon, MON_DATA_FORM, NULL); - u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL); + u8 form = GetMonData(mon, MON_DATA_FORM, NULL); + u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL); u16 moves[MAX_MON_MOVES]; for (u8 i = 0; i < MAX_MON_MOVES; ++i) { @@ -25,7 +25,7 @@ u16 *MoveRelearner_GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId) { } u16 *tableFromFile = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2); - u16 *returnTable = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2); + u16 *returnTable = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2); LoadLevelUpLearnset_HandleAlternateForm(species, form, tableFromFile); diff --git a/arm9/src/msgdata.c b/arm9/src/msgdata.c index 6a3bfb7eb..992739b3d 100644 --- a/arm9/src/msgdata.c +++ b/arm9/src/msgdata.c @@ -142,7 +142,7 @@ static void ReadMsgData_ExistingNarc_ExistingString(NARC *narc, u32 group, u32 n NARC_ReadFromMember(narc, group, 8 * num + 4, 8, &alloc); Decrypt1(&alloc, num, sp10[1]); size = alloc.length * 2; - buf = AllocFromHeapAtEnd(heapId, size); + buf = AllocFromHeapAtEnd(heapId, size); if (buf != NULL) { NARC_ReadFromMember(narc, group, alloc.offset, size, buf); Decrypt2(buf, alloc.length, num); @@ -182,7 +182,7 @@ static struct String *ReadMsgData_ExistingNarc_NewString(NARC *narc, u32 group, dest = String_New(alloc.length, heapId); if (dest != NULL) { size = alloc.length * 2; - buf = AllocFromHeapAtEnd(heapId, size); + buf = AllocFromHeapAtEnd(heapId, size); if (buf != NULL) { NARC_ReadFromMember(narc, group, alloc.offset, size, buf); Decrypt2(buf, alloc.length, num); @@ -219,10 +219,10 @@ struct MsgData *NewMsgDataFromNarc(MsgDataLoadType type, NarcId narc_id, s32 fil } else { msgData->data.narc = NARC_New(narc_id, heapId); } - msgData->type = (u16)type; + msgData->type = (u16)type; msgData->narc_id = (u16)narc_id; msgData->file_id = (u16)file_id; - msgData->heapId = (u16)heapId; + msgData->heapId = (u16)heapId; } return msgData; } @@ -293,7 +293,7 @@ void GetSpeciesNameIntoArray(u16 species, HeapID heapId, u16 *dest) { struct String *ReadMsgData_ExpandPlaceholders(MessageFormat *messageFormat, struct MsgData *msgData, u32 msgno, HeapID heapId) { struct String *ret = NULL; - struct String *r4 = String_New(1024, HEAP_ID_DEFAULT); + struct String *r4 = String_New(1024, HEAP_ID_DEFAULT); struct String *r5; if (r4 != NULL) { r5 = NewString_ReadMsgData(msgData, msgno); diff --git a/arm9/src/nutdata.c b/arm9/src/nutdata.c index 27025b4d0..ea0d56663 100644 --- a/arm9/src/nutdata.c +++ b/arm9/src/nutdata.c @@ -62,14 +62,14 @@ u32 GetNutAttr(struct NutData *nut, u32 attr) { struct String *GetNutName(u32 berry_idx, HeapID heapId) { struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0373_bin, heapId); - struct String *ret = NewString_ReadMsgData(msgData, berry_idx); + struct String *ret = NewString_ReadMsgData(msgData, berry_idx); DestroyMsgData(msgData); return ret; } struct String *GetNutDesc(u32 berry_idx, HeapID heapId) { struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0372_bin, heapId); - struct String *ret = NewString_ReadMsgData(msgData, berry_idx); + struct String *ret = NewString_ReadMsgData(msgData, berry_idx); DestroyMsgData(msgData); return ret; } diff --git a/arm9/src/options.c b/arm9/src/options.c index 5100fe503..958e3fe67 100644 --- a/arm9/src/options.c +++ b/arm9/src/options.c @@ -20,12 +20,12 @@ void Options_Copy(struct Options *src, struct Options *dest) { void Options_Init(struct Options *options) { MI_CpuFill8(options, 0, sizeof(struct Options)); - options->textSpeed = 1; // mid speed + options->textSpeed = 1; // mid speed options->soundMethod = 0; // stereo options->battleStyle = 0; // shift options->battleScene = 0; // on - options->buttonMode = 0; // normal - options->frame = 0; // frame 1 + options->buttonMode = 0; // normal + options->frame = 0; // frame 1 } void Options_SetButtonModeOnMain(struct SaveData *save, u32 buttonMode) { diff --git a/arm9/src/overlay_manager.c b/arm9/src/overlay_manager.c index 4c9a28685..f52feec3b 100644 --- a/arm9/src/overlay_manager.c +++ b/arm9/src/overlay_manager.c @@ -8,13 +8,13 @@ struct OverlayManager *OverlayManager_New(const struct OverlayManagerTemplate *template, s32 *a1, HeapID heapId) { struct OverlayManager *ret = (struct OverlayManager *)AllocFromHeap(heapId, sizeof(struct OverlayManager)); - ret->template = *template; - ret->managerStatus = 0; - ret->overlayStatus = 0; - ret->unk18 = a1; - ret->data = NULL; - ret->save = NULL; - ret->unk24 = 0; + ret->template = *template; + ret->managerStatus = 0; + ret->overlayStatus = 0; + ret->unk18 = a1; + ret->data = NULL; + ret->save = NULL; + ret->unk24 = 0; return ret; } diff --git a/arm9/src/palette.c b/arm9/src/palette.c index 60b7e6682..511f655e5 100644 --- a/arm9/src/palette.c +++ b/arm9/src/palette.c @@ -22,13 +22,13 @@ void sub_02002FEC(struct PaletteData *ptr) { void PaletteData_SetBuffers( struct PaletteData *paletteData, u32 index, void *unfadedBuf, void *fadedBuf, u32 size) { paletteData->pltt[index].unfadedBuf = unfadedBuf; - paletteData->pltt[index].fadedBuf = fadedBuf; - paletteData->pltt[index].bufSize = size; + paletteData->pltt[index].fadedBuf = fadedBuf; + paletteData->pltt[index].bufSize = size; } void PaletteData_AllocBuffers( struct PaletteData *paletteData, u32 index, u32 size, HeapID heapId) { - void *ptr = AllocFromHeap(heapId, size); + void *ptr = AllocFromHeap(heapId, size); void *ptr2 = AllocFromHeap(heapId, size); PaletteData_SetBuffers(paletteData, index, ptr, ptr2, size); @@ -151,7 +151,7 @@ u32 sub_02003210(struct PaletteData *paletteData, u16 color) { u16 stc = param2; - u32 r6 = 0; + u32 r6 = 0; for (u8 i = 0; i < 14; i++) { if (IsPaletteSelected(param1, i) != 1) { @@ -175,7 +175,7 @@ u32 sub_02003210(struct PaletteData *paletteData, } param2 = stc; - r6 = 1; + r6 = 1; } if (r6 == 1) { @@ -184,7 +184,7 @@ u32 sub_02003210(struct PaletteData *paletteData, paletteData->unk11a_e = 1; paletteData->unk118_0 = 1; - paletteData->unk11c = 0; + paletteData->unk11c = 0; SysTask_CreateOnMainQueue((SysTaskFunc)sub_02003464, (void *)paletteData, (u32)(-2)); } @@ -232,16 +232,16 @@ void sub_020033A4(struct PaletteFadeControl *paletteFade, u16 color) { if (delay < 0) { paletteFade->deltaY = abs(delay) + 2; - paletteFade->delay = 0; + paletteFade->delay = 0; } else { paletteFade->deltaY = 2; - paletteFade->delay = delay; + paletteFade->delay = delay; } paletteFade->selectedPalettes = selectedPalettes; - paletteFade->y = startY; - paletteFade->targetY = targetY; - paletteFade->blendColor = color; + paletteFade->y = startY; + paletteFade->targetY = targetY; + paletteFade->blendColor = color; paletteFade->delayCounter = paletteFade->delay; @@ -254,10 +254,10 @@ void sub_020033A4(struct PaletteFadeControl *paletteFade, void sub_02003464(SysTask *task, struct PaletteData *param1) { if (param1->unk11c == 1) { - param1->unk11c = 0; - param1->unk11a_0 = 0; + param1->unk11c = 0; + param1->unk11a_0 = 0; param1->activeFadePalettes = 0; - param1->unk11a_e = 0; + param1->unk11a_e = 0; SysTask_Destroy(task); return; } @@ -317,7 +317,7 @@ void sub_020035F8( for (u32 i = 0; i < numEntries; i++) { u8 lo = (u8)((src[i] & 0x1f) + ((((fadeCtrl->blendColor & 0x1f) - (src[i] & 0x1f)) * fadeCtrl->y) >> 4)); - u8 hi = (u8)(((src[i] >> 10) & 0x1f) + (((((fadeCtrl->blendColor >> 10) & 0x1f) - ((src[i] >> 10) & 0x1f)) * fadeCtrl->y) >> 4)); + u8 hi = (u8)(((src[i] >> 10) & 0x1f) + (((((fadeCtrl->blendColor >> 10) & 0x1f) - ((src[i] >> 10) & 0x1f)) * fadeCtrl->y) >> 4)); u8 mid = (u8)(((src[i] >> 5) & 0x1f) + (((((fadeCtrl->blendColor >> 5) & 0x1f) - ((src[i] >> 5) & 0x1f)) * fadeCtrl->y) >> 4)); dest[i] = (u16)((hi << 10) | (mid << 5) | lo); @@ -524,7 +524,7 @@ void BlendPalettes(u16 *src, u16 *dest, u16 selectedPalettes, u8 coeff, u16 blen void BlendPalettesUnfaded( struct PaletteData *paletteData, u32 index, u16 selectedPalettes, u8 coeff, u16 blendColor) { - u32 r4 = 0; + u32 r4 = 0; BOOL r0 = FALSE; if (paletteData->pltt[index].unfadedBuf != 0 && paletteData->pltt[index].fadedBuf != 0) { r0 = TRUE; diff --git a/arm9/src/party.c b/arm9/src/party.c index 84c1e8b81..556b6b63a 100644 --- a/arm9/src/party.c +++ b/arm9/src/party.c @@ -74,7 +74,7 @@ void ReplacePartySlotWithMon(struct Party *party, int pos, struct Pokemon *pokem GF_ASSERT(pos >= 0); GF_ASSERT(pos < party->curCount); GF_ASSERT(pos < party->maxCount); - r2 = (int)(GetMonData(&party->mons[pos], MON_DATA_SPECIES_EXISTS, NULL) - GetMonData(pokemon, MON_DATA_SPECIES_EXISTS, NULL)); + r2 = (int)(GetMonData(&party->mons[pos], MON_DATA_SPECIES_EXISTS, NULL) - GetMonData(pokemon, MON_DATA_SPECIES_EXISTS, NULL)); party->mons[pos] = *pokemon; party->curCount += r2; } @@ -87,8 +87,8 @@ BOOL SwapSlotsInParty(struct Party *party, int pos1, int pos2) { GF_ASSERT(pos2 >= 0); GF_ASSERT(pos2 < party->curCount); GF_ASSERT(pos2 < party->maxCount); - buffer = AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct Pokemon)); - *buffer = party->mons[pos1]; + buffer = AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct Pokemon)); + *buffer = party->mons[pos1]; party->mons[pos1] = party->mons[pos2]; party->mons[pos2] = *buffer; FreeToHeap(buffer); diff --git a/arm9/src/play_timer.c b/arm9/src/play_timer.c index 66debea2d..1062a424f 100644 --- a/arm9/src/play_timer.c +++ b/arm9/src/play_timer.c @@ -15,9 +15,9 @@ void PlayTimerInit() { void PlayTimerStart(struct IGT *igt) { sTimerActive = TRUE; - sUnused = 0; - sDuration = 0; - sIGT_p = igt; + sUnused = 0; + sDuration = 0; + sIGT_p = igt; sTimer3Start = GetTimer3Count(); } diff --git a/arm9/src/poke_overlay.c b/arm9/src/poke_overlay.c index ba4278419..66f71ba46 100644 --- a/arm9/src/poke_overlay.c +++ b/arm9/src/poke_overlay.c @@ -31,12 +31,12 @@ s32 GetOverlayLoadDestination(FSOverlayID id) { u8 *start; GF_ASSERT(FS_LoadOverlayInfo(&info, MI_PROCESSOR_ARM9, id) == TRUE); start = (u8 *)HW_ITCM_IMAGE; - end = (u8 *)HW_ITCM_END; + end = (u8 *)HW_ITCM_END; if (info.header.ram_address <= end && info.header.ram_address >= start) { return OVERLAY_LOAD_ITCM; } start = (u8 *)HW_DTCM; - end = start + HW_DTCM_SIZE; + end = start + HW_DTCM_SIZE; if (info.header.ram_address <= end && info.header.ram_address >= start) { return OVERLAY_LOAD_DTCM; } @@ -58,9 +58,9 @@ BOOL HandleLoadOverlay(FSOverlayID id, s32 a1) { for (r6 = 0; r6 < 8; r6++) { if (!r3[r6].active) { struct LoadedOverlay *ovly; - ovly = &r3[r6]; + ovly = &r3[r6]; ovly->active = TRUE; - ovly->id = id; + ovly->id = id; break; } } @@ -133,7 +133,7 @@ BOOL GetOverlayRamBounds(FSOverlayID id, void **start, void **end) { return FALSE; } *start = (void *)info.header.ram_address; - *end = (char *)*start + (info.header.ram_size + info.header.bss_size); + *end = (char *)*start + (info.header.ram_size + info.header.bss_size); return TRUE; } diff --git a/arm9/src/pokedex.c b/arm9/src/pokedex.c index a7f57bdea..e0097802d 100644 --- a/arm9/src/pokedex.c +++ b/arm9/src/pokedex.c @@ -57,8 +57,8 @@ s32 Pokedex_CountSeenShellosOrGastrodon_Internal(struct Pokedex *pokedex, u32 sp return 0; } u8 *flags = species == SPECIES_SHELLOS ? &pokedex->shellosGastrodon[0] : &pokedex->shellosGastrodon[1]; - BOOL r2 = CheckDexFlag(flags, 1); - BOOL r0 = CheckDexFlag(flags, 2); + BOOL r2 = CheckDexFlag(flags, 1); + BOOL r0 = CheckDexFlag(flags, 2); return (r2 == r0) ? 1 : 2; } @@ -68,7 +68,7 @@ BOOL Pokedex_HasSeenShellosOrGastrodonForm(struct Pokedex *pokedex, u32 species, return FALSE; } u8 *flags = species == SPECIES_SHELLOS ? &pokedex->shellosGastrodon[0] : &pokedex->shellosGastrodon[1]; - u32 r0 = (u32)Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species); + u32 r0 = (u32)Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species); for (int i = 0; i < r0; i++) { BOOL r2 = CheckDexFlag(flags, (u16)(i + 1)); if (r2 == state) { @@ -84,7 +84,7 @@ void Pokedex_SetSeenShellosOrGastrodonForm(struct Pokedex *pokedex, u32 species, return; } u8 *flags = species == SPECIES_SHELLOS ? &pokedex->shellosGastrodon[0] : &pokedex->shellosGastrodon[1]; - s32 r5 = Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species); + s32 r5 = Pokedex_CountSeenShellosOrGastrodon_Internal(pokedex, species); if (r5 < 2) { UpdateDexFlag(flags, (u16)(r5 + 1), (u8)state); if (r5 == 0) { @@ -131,7 +131,7 @@ void Pokedex_SetSeenBurmyOrWormadamForm(struct Pokedex *pokedex, u32 species, s3 return; } u8 *flags = species == SPECIES_BURMY ? &pokedex->burmyWormadam[0] : &pokedex->burmyWormadam[1]; - s32 r5 = Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, species); + s32 r5 = Pokedex_CountSeenBurmyOrWormadam_Internal(pokedex, species); if (r5 >= 3) { return; } @@ -317,13 +317,13 @@ BOOL Pokedex_SpeciesIsNotSinnohMythical(u16 species) { void Save_Pokedex_Init(struct Pokedex *pokedex) { memset(pokedex, 0, sizeof(struct Pokedex)); - pokedex->magic = 0xBEEFCAFE; + pokedex->magic = 0xBEEFCAFE; pokedex->unlockedNationalDex = 0; memset(pokedex->seenUnown, 0xFF, 28); pokedex->shellosGastrodon[0] = 0xFF; pokedex->shellosGastrodon[1] = 0xFF; - pokedex->burmyWormadam[0] = 0xFF; - pokedex->burmyWormadam[1] = 0xFF; + pokedex->burmyWormadam[0] = 0xFF; + pokedex->burmyWormadam[1] = 0xFF; Pokedex_InitSeenDeoxysFormsArray(pokedex); } @@ -572,9 +572,9 @@ static inline void SetSeenGender(struct Pokedex *pokedex, u16 species, u8 gender } void Pokedex_SetMonSeenFlag(struct Pokedex *pokedex, struct Pokemon *pokemon) { - u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); + u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); u32 personality = GetMonData(pokemon, MON_DATA_PERSONALITY, NULL); - u32 gender = GetMonGender(pokemon); + u32 gender = GetMonGender(pokemon); GF_ASSERT(pokedex->magic == 0xBEEFCAFE); if (DexSpeciesIsInvalid(species)) { return; @@ -600,10 +600,10 @@ void Pokedex_SetMonCaughtFlag(struct Pokedex *pokedex, struct Pokemon *pokemon) u32 gender; // r7 u16 species; // r6 - species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - language = GetMonData(pokemon, MON_DATA_GAME_LANGUAGE, NULL); + species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); + language = GetMonData(pokemon, MON_DATA_GAME_LANGUAGE, NULL); personality = GetMonData(pokemon, MON_DATA_PERSONALITY, NULL); - gender = GetMonGender(pokemon); + gender = GetMonGender(pokemon); GF_ASSERT(pokedex->magic == 0xBEEFCAFE); if (DexSpeciesIsInvalid(species)) { return; diff --git a/arm9/src/pokemon.c b/arm9/src/pokemon.c index c5f22cee7..a2255c841 100644 --- a/arm9/src/pokemon.c +++ b/arm9/src/pokemon.c @@ -200,7 +200,7 @@ BOOL AcquireMonLock(struct Pokemon *mon) { ret = TRUE; GF_ASSERT(!mon->box.box_lock); mon->box.party_lock = TRUE; - mon->box.box_lock = TRUE; + mon->box.box_lock = TRUE; DECRYPT_PTY(mon); DECRYPT_BOX(&mon->box); } @@ -210,9 +210,9 @@ BOOL AcquireMonLock(struct Pokemon *mon) { BOOL ReleaseMonLock(struct Pokemon *mon, BOOL decrypt_result) { BOOL ret = FALSE; if (mon->box.party_lock == TRUE && decrypt_result == TRUE) { - ret = TRUE; + ret = TRUE; mon->box.party_lock = FALSE; - mon->box.box_lock = FALSE; + mon->box.box_lock = FALSE; ENCRYPT_PTY(mon); mon->box.checksum = CHECKSUM(&mon->box); ENCRYPT_BOX(&mon->box); @@ -224,7 +224,7 @@ BOOL AcquireBoxMonLock(struct BoxPokemon *mon) { BOOL ret = FALSE; if (!mon->box_lock) { - ret = TRUE; + ret = TRUE; mon->box_lock = TRUE; DECRYPT_BOX(mon); } @@ -234,7 +234,7 @@ BOOL AcquireBoxMonLock(struct BoxPokemon *mon) { BOOL ReleaseBoxMonLock(struct BoxPokemon *mon, BOOL decrypt_result) { BOOL ret = FALSE; if (mon->box_lock == TRUE && decrypt_result == TRUE) { - ret = TRUE; + ret = TRUE; mon->box_lock = FALSE; mon->checksum = CHECKSUM(mon); ENCRYPT_BOX(mon); @@ -300,14 +300,14 @@ void CreateBoxMon(struct BoxPokemon *boxPokemon, int species, int level, int fix SetBoxMonData(boxPokemon, MON_DATA_SPDEF_IV, &fixedIV); } else { exp = LCRandom(); - iv = exp & 0x1F; + iv = exp & 0x1F; SetBoxMonData(boxPokemon, MON_DATA_HP_IV, &iv); iv = (exp & 0x3E0) >> 5; SetBoxMonData(boxPokemon, MON_DATA_ATK_IV, &iv); iv = (exp & 0x7C00) >> 10; SetBoxMonData(boxPokemon, MON_DATA_DEF_IV, &iv); exp = LCRandom(); - iv = exp & 0x1F; + iv = exp & 0x1F; SetBoxMonData(boxPokemon, MON_DATA_SPEED_IV, &iv); iv = (exp & 0x3E0) >> 5; SetBoxMonData(boxPokemon, MON_DATA_SPATK_IV, &iv); @@ -315,7 +315,7 @@ void CreateBoxMon(struct BoxPokemon *boxPokemon, int species, int level, int fix SetBoxMonData(boxPokemon, MON_DATA_SPDEF_IV, &iv); } exp = (u32)GetMonBaseStat(species, BASE_ABILITY_1); - iv = (u32)GetMonBaseStat(species, BASE_ABILITY_2); + iv = (u32)GetMonBaseStat(species, BASE_ABILITY_2); if (iv != 0) { if (fixedPersonality & 1) { SetBoxMonData(boxPokemon, MON_DATA_ABILITY, &iv); @@ -341,11 +341,11 @@ void CreateMonWithNature(struct Pokemon *pokemon, u16 species, u8 level, u8 fixe // FIXME: stack storage of pokemon, fixedIv swapped void CreateMonWithGenderNatureLetter(struct Pokemon *pokemon, u16 species, u8 level, u8 fixedIv, u8 gender, u8 nature, u8 letter) { - u32 pid = 0; + u32 pid = 0; u16 test = 0; if (letter != 0 && letter < 29) { do { - pid = (u32)(LCRandom() | (LCRandom() << 16)); + pid = (u32)(LCRandom() | (LCRandom() << 16)); test = (u16)CALC_UNOWN_LETTER(pid); } while (nature != GetNatureFromPersonality(pid) || gender != GetGenderBySpeciesAndPersonality(species, pid) || test != letter - 1); } else { @@ -355,7 +355,7 @@ void CreateMonWithGenderNatureLetter(struct Pokemon *pokemon, u16 species, u8 le } u32 GenPersonalityByGenderAndNature(u16 species, u8 gender, u8 nature) { - int pid = nature; + int pid = nature; u8 ratio = (u8)GetMonBaseStat(species, BASE_GENDER_RATIO); switch (ratio) { case MON_RATIO_MALE: @@ -382,7 +382,7 @@ void CreateMonWithFixedIVs(struct Pokemon *pokemon, int species, int level, int void CalcMonLevelAndStats(struct Pokemon *pokemon) { BOOL decry = AcquireMonLock(pokemon); - u32 level = (u32)CalcMonLevel(pokemon); + u32 level = (u32)CalcMonLevel(pokemon); SetMonData(pokemon, MON_DATA_LEVEL, &level); CalcMonStats(pokemon); ReleaseMonLock(pokemon, decry); @@ -414,23 +414,23 @@ void CalcMonStats(struct Pokemon *pokemon) { int newSpatk; int newSpdef; BOOL decry = AcquireMonLock(pokemon); - level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL); - maxHp = (int)GetMonData(pokemon, MON_DATA_MAXHP, NULL); - hp = (int)GetMonData(pokemon, MON_DATA_HP, NULL); - hpIv = (int)GetMonData(pokemon, MON_DATA_HP_IV, NULL); - hpEv = (int)GetMonData(pokemon, MON_DATA_HP_EV, NULL); - atkIv = (int)GetMonData(pokemon, MON_DATA_ATK_IV, NULL); - atkEv = (int)GetMonData(pokemon, MON_DATA_ATK_EV, NULL); - defIv = (int)GetMonData(pokemon, MON_DATA_DEF_IV, NULL); - defEv = (int)GetMonData(pokemon, MON_DATA_DEF_EV, NULL); - speedIv = (int)GetMonData(pokemon, MON_DATA_SPEED_IV, NULL); - speedEv = (int)GetMonData(pokemon, MON_DATA_SPEED_EV, NULL); - spatkIv = (int)GetMonData(pokemon, MON_DATA_SPATK_IV, NULL); - spatkEv = (int)GetMonData(pokemon, MON_DATA_SPATK_EV, NULL); - spdefIv = (int)GetMonData(pokemon, MON_DATA_SPDEF_IV, NULL); - spdefEv = (int)GetMonData(pokemon, MON_DATA_SPDEF_EV, NULL); - form = (int)GetMonData(pokemon, MON_DATA_FORM, NULL); - species = (int)GetMonData(pokemon, MON_DATA_SPECIES, NULL); + level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL); + maxHp = (int)GetMonData(pokemon, MON_DATA_MAXHP, NULL); + hp = (int)GetMonData(pokemon, MON_DATA_HP, NULL); + hpIv = (int)GetMonData(pokemon, MON_DATA_HP_IV, NULL); + hpEv = (int)GetMonData(pokemon, MON_DATA_HP_EV, NULL); + atkIv = (int)GetMonData(pokemon, MON_DATA_ATK_IV, NULL); + atkEv = (int)GetMonData(pokemon, MON_DATA_ATK_EV, NULL); + defIv = (int)GetMonData(pokemon, MON_DATA_DEF_IV, NULL); + defEv = (int)GetMonData(pokemon, MON_DATA_DEF_EV, NULL); + speedIv = (int)GetMonData(pokemon, MON_DATA_SPEED_IV, NULL); + speedEv = (int)GetMonData(pokemon, MON_DATA_SPEED_EV, NULL); + spatkIv = (int)GetMonData(pokemon, MON_DATA_SPATK_IV, NULL); + spatkEv = (int)GetMonData(pokemon, MON_DATA_SPATK_EV, NULL); + spdefIv = (int)GetMonData(pokemon, MON_DATA_SPDEF_IV, NULL); + spdefEv = (int)GetMonData(pokemon, MON_DATA_SPDEF_EV, NULL); + form = (int)GetMonData(pokemon, MON_DATA_FORM, NULL); + species = (int)GetMonData(pokemon, MON_DATA_SPECIES, NULL); baseStats = (struct BaseStats *)AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct BaseStats)); LoadMonBaseStats_HandleAlternateForm(species, form, baseStats); @@ -551,7 +551,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxmon, int attr, void *dest) { } u32 GetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *dest) { - u32 ret = 0; + u32 ret = 0; PokemonDataBlockA *blockA = &GetSubstruct(boxmon, boxmon->pid, 0)->blockA; PokemonDataBlockB *blockB = &GetSubstruct(boxmon, boxmon->pid, 1)->blockB; PokemonDataBlockC *blockC = &GetSubstruct(boxmon, boxmon->pid, 2)->blockC; @@ -1254,7 +1254,7 @@ void SetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *value) { case MON_DATA_NICKNAME: for (i = 0; i < POKEMON_NAME_LENGTH + 1; i++) { blockC->nickname[i] = VALUE(u16); - value = (void *const)((char *)value + 2); + value = (void *const)((char *)value + 2); } break; case MON_DATA_NICKNAME_4: @@ -1303,7 +1303,7 @@ void SetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *value) { case MON_DATA_OT_NAME: for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) { blockD->otTrainerName[i] = VALUE(u16); - value = (void *)((char *)value + 2); + value = (void *)((char *)value + 2); } break; case MON_DATA_OT_NAME_2: @@ -1352,10 +1352,10 @@ void SetBoxMonDataInternal(struct BoxPokemon *boxmon, int attr, void *value) { blockD->HGSS_Pokeball = VALUE(u16); break; case MON_DATA_IVS_WORD: - blockB->hpIV = (VALUE(u32) >> 0) & 0x1F; - blockB->atkIV = (VALUE(u32) >> 5) & 0x1F; - blockB->defIV = (VALUE(u32) >> 10) & 0x1F; - blockB->spdIV = (VALUE(u32) >> 15) & 0x1F; + blockB->hpIV = (VALUE(u32) >> 0) & 0x1F; + blockB->atkIV = (VALUE(u32) >> 5) & 0x1F; + blockB->defIV = (VALUE(u32) >> 10) & 0x1F; + blockB->spdIV = (VALUE(u32) >> 15) & 0x1F; blockB->spatkIV = (VALUE(u32) >> 20) & 0x1F; blockB->spdefIV = (VALUE(u32) >> 25) & 0x1F; break; @@ -1839,7 +1839,7 @@ void FreeMonPersonal(struct BaseStats *personal) { int GetMonBaseStat_HandleFormConversion(int species, int form, enum BaseStat attr) { int ret; struct BaseStats *personal = AllocAndLoadMonPersonal(ResolveMonForm(species, form), HEAP_ID_DEFAULT); - ret = GetPersonalAttr(personal, attr); + ret = GetPersonalAttr(personal, attr); FreeMonPersonal(personal); return ret; } @@ -1847,18 +1847,18 @@ int GetMonBaseStat_HandleFormConversion(int species, int form, enum BaseStat att int GetMonBaseStat(int species, enum BaseStat attr) { int ret; struct BaseStats *personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT); - ret = GetPersonalAttr(personal, attr); + ret = GetPersonalAttr(personal, attr); FreeMonPersonal(personal); return ret; } u8 GetPercentProgressTowardsNextLevel(struct Pokemon *pokemon) { - BOOL decry = AcquireMonLock(pokemon); + BOOL decry = AcquireMonLock(pokemon); u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL); - u32 lo = GetMonExpBySpeciesAndLevel(species, level); - u32 hi = GetMonExpBySpeciesAndLevel(species, level + 1); - u32 cur = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL); + u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL); + u32 lo = GetMonExpBySpeciesAndLevel(species, level); + u32 hi = GetMonExpBySpeciesAndLevel(species, level + 1); + u32 cur = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL); ReleaseMonLock(pokemon, decry); return (u8)(100 * (cur - lo) / (hi - lo)); } @@ -1869,15 +1869,15 @@ u32 CalcMonExpToNextLevel(struct Pokemon *pokemon) { u32 CalcBoxMonExpToNextLevel(struct BoxPokemon *boxmon) { u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - u16 level = (u16)(CalcBoxMonLevel(boxmon) + 1); - u32 cur = GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL); - u32 hi = GetMonExpBySpeciesAndLevel(species, level); + u16 level = (u16)(CalcBoxMonLevel(boxmon) + 1); + u32 cur = GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL); + u32 hi = GetMonExpBySpeciesAndLevel(species, level); return hi - cur; } u32 GetMonBaseExperienceAtCurrentLevel(struct Pokemon *pokemon) { int species = (int)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - int level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL); + int level = (int)GetMonData(pokemon, MON_DATA_LEVEL, NULL); return GetMonExpBySpeciesAndLevel(species, level); } @@ -1907,9 +1907,9 @@ int CalcMonLevel(struct Pokemon *pokemon) { } int CalcBoxMonLevel(struct BoxPokemon *boxmon) { - BOOL decry = AcquireBoxMonLock(boxmon); + BOOL decry = AcquireBoxMonLock(boxmon); int species = (int)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - int exp = (int)GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL); + int exp = (int)GetBoxMonData(boxmon, MON_DATA_EXPERIENCE, NULL); ReleaseBoxMonLock(boxmon, decry); return CalcLevelBySpeciesAndExp((u16)species, (u32)exp); } @@ -1917,7 +1917,7 @@ int CalcBoxMonLevel(struct BoxPokemon *boxmon) { int CalcLevelBySpeciesAndExp(u16 species, u32 exp) { int level; struct BaseStats *personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT); - level = CalcLevelBySpeciesAndExp_PreloadedPersonal(personal, species, exp); + level = CalcLevelBySpeciesAndExp_PreloadedPersonal(personal, species, exp); FreeMonPersonal(personal); return level; } @@ -1940,7 +1940,7 @@ u8 GetMonNature(struct Pokemon *pokemon) { } u8 GetBoxMonNature(struct BoxPokemon *boxmon) { - BOOL decry = AcquireBoxMonLock(boxmon); + BOOL decry = AcquireBoxMonLock(boxmon); u32 personality = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); ReleaseBoxMonLock(boxmon, decry); return GetNatureFromPersonality(personality); @@ -1988,8 +1988,8 @@ void MonApplyFriendshipMod(struct Pokemon *pokemon, u32 kind, u32 location) { return; } - effect = (u8)GetItemAttr((u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL), 1, HEAP_ID_DEFAULT); - r4 = 0; + effect = (u8)GetItemAttr((u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL), 1, HEAP_ID_DEFAULT); + r4 = 0; friendship = (s16)GetMonData(pokemon, MON_DATA_FRIENDSHIP, NULL); if (friendship >= 100) { r4++; @@ -2022,8 +2022,8 @@ u8 GetMonGender(struct Pokemon *pokemon) { } u8 GetBoxMonGender(struct BoxPokemon *boxmon) { - BOOL decry = AcquireBoxMonLock(boxmon); - u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); + BOOL decry = AcquireBoxMonLock(boxmon); + u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); u32 personality = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); ReleaseBoxMonLock(boxmon, decry); return GetGenderBySpeciesAndPersonality(species, personality); @@ -2031,7 +2031,7 @@ u8 GetBoxMonGender(struct BoxPokemon *boxmon) { u8 GetGenderBySpeciesAndPersonality(u16 species, u32 pid) { struct BaseStats *personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT); - u8 gender = GetGenderBySpeciesAndPersonality_PreloadedPersonal(personal, species, pid); + u8 gender = GetGenderBySpeciesAndPersonality_PreloadedPersonal(personal, species, pid); FreeMonPersonal(personal); return gender; } @@ -2061,7 +2061,7 @@ u8 MonIsShiny(struct Pokemon *pokemon) { u8 BoxMonIsShiny(struct BoxPokemon *boxmon) { u32 otid = GetBoxMonData(boxmon, MON_DATA_OTID, NULL); - u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); + u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); return CalcShininessByOtIdAndPersonality(otid, pid); } @@ -2074,8 +2074,8 @@ u32 GenerateShinyPersonality(u32 otid) { u16 r6; u16 r5; otid = (u32)((((otid & 0xFFFF0000) >> 16) ^ (otid & 0xFFFF)) >> 3u); - r6 = (u16)(LCRandom() & 7); - r5 = (u16)(LCRandom() & 7); + r6 = (u16)(LCRandom() & 7); + r5 = (u16)(LCRandom() & 7); for (r4 = 0; r4 < 13; r4++) { if (MaskOfFlagNo(r4) & otid) { if (LCRandom() & 1) { @@ -2096,10 +2096,10 @@ void sub_02068B68(struct SomeDrawPokemonStruct *spC, struct Pokemon *pokemon, u8 } void sub_02068B70(struct SomeDrawPokemonStruct *spC, struct BoxPokemon *boxmon, u8 sp10) { - BOOL decry = AcquireBoxMonLock(boxmon); - u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL); - u8 gender = GetBoxMonGender(boxmon); - u8 shiny = BoxMonIsShiny(boxmon); + BOOL decry = AcquireBoxMonLock(boxmon); + u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL); + u8 gender = GetBoxMonGender(boxmon); + u8 shiny = BoxMonIsShiny(boxmon); u32 personality = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); u8 form; if (species == SPECIES_EGG) { @@ -2224,8 +2224,8 @@ u8 sub_02068E14(struct Pokemon *pokemon, u32 a1) { u8 sub_02068E1C(struct BoxPokemon *boxmon, u32 a1) { u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL); - u8 gender = GetBoxMonGender(boxmon); - u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); + u8 gender = GetBoxMonGender(boxmon); + u32 pid = GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); u8 form; if (species == SPECIES_EGG) { if (GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { @@ -2249,78 +2249,78 @@ u8 sub_02068E88(int species, u8 gender, u32 a1, u8 form, u32 pid) { if (form > 2) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 / 2 + 0x48 + form * 2); break; case SPECIES_WORMADAM: if (form > 2) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 / 2 + 0x4E + form * 2); break; case SPECIES_SHELLOS: if (form > 1) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 + 0x54 + form); break; case SPECIES_GASTRODON: if (form > 1) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 + 0x58 + form); break; case SPECIES_CHERRIM: if (form > 1) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 + 0x5C + form); break; case SPECIES_ARCEUS: if (form > 17) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 / 2 + 0x60 + 2 * form); break; case SPECIES_CASTFORM: if (form > 3) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 * 2 + 0x40 + form); break; case SPECIES_DEOXYS: if (form > 3) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 / 2 + form * 2); break; case SPECIES_UNOWN: if (form >= 28) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(a1 / 2 + 0x8 + form * 2); break; case SPECIES_EGG: if (form > 1) { form = 0; } - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = (s32)(0x84 + form); break; case SPECIES_MANAPHY_EGG: - narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; + narc = NARC_POKETOOL_POKEGRA_HEIGHT_O; fileId = 0x84; break; default: - narc = NARC_POKETOOL_POKEGRA_HEIGHT; + narc = NARC_POKETOOL_POKEGRA_HEIGHT; fileId = (s32)(4 * species + a1 + (gender != MON_FEMALE ? 1 : 0)); break; } @@ -2333,7 +2333,7 @@ void sub_02068FE0(struct SomeDrawPokemonStruct *a0, u16 a1, int a2) { a0->unk0 = NARC_POKETOOL_TRGRA_TRFGRA; } else { a0->unk0 = NARC_POKETOOL_TRGRA_TRBGRA; - a1 = (u16)sub_0206AA30(a1); + a1 = (u16)sub_0206AA30(a1); } a0->unk2 = (u16)(a1 * 2); a0->unk4 = (u16)(a1 * 2 + 1); @@ -2396,11 +2396,11 @@ struct BoxPokemon *sub_020690E4(struct Pokemon *pokemon) { } BOOL sub_020690E8(struct Pokemon *pokemon) { - u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - u8 level = (u8)(GetMonData(pokemon, MON_DATA_LEVEL, NULL) + 1); - u32 exp = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL); + u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); + u8 level = (u8)(GetMonData(pokemon, MON_DATA_LEVEL, NULL) + 1); + u32 exp = GetMonData(pokemon, MON_DATA_EXPERIENCE, NULL); u32 growthrate = (u32)GetMonBaseStat(species, BASE_GROWTH_RATE); - u32 maxexp = GetExpByGrowthRateAndLevel((int)growthrate, 100); + u32 maxexp = GetExpByGrowthRateAndLevel((int)growthrate, 100); if (exp > maxexp) { exp = maxexp; SetMonData(pokemon, MON_DATA_EXPERIENCE, &exp); @@ -2429,12 +2429,12 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u struct Evolution *evoTable; u8 r1; - species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - heldItem = (u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL); + species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); + heldItem = (u16)GetMonData(pokemon, MON_DATA_HELD_ITEM, NULL); personality = GetMonData(pokemon, MON_DATA_PERSONALITY, NULL); - beauty = (u8)GetMonData(pokemon, MON_DATA_BEAUTY, NULL); - pid_hi = (u16)((personality & 0xFFFF0000) >> 16); - r1 = (u8)GetItemAttr(heldItem, 1, HEAP_ID_DEFAULT); + beauty = (u8)GetMonData(pokemon, MON_DATA_BEAUTY, NULL); + pid_hi = (u16)((personality & 0xFFFF0000) >> 16); + r1 = (u8)GetItemAttr(heldItem, 1, HEAP_ID_DEFAULT); if (species != SPECIES_KADABRA && r1 == HOLD_EFFECT_NO_EVOLVE && context != 3) { return SPECIES_NONE; } @@ -2445,7 +2445,7 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u LoadMonEvolutionTable(species, evoTable); switch (context) { case 0: - level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL); + level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL); friendship = (u16)GetMonData(pokemon, MON_DATA_FRIENDSHIP, NULL); for (i = 0; i < 7; i++) { switch (evoTable[i].method) { @@ -2453,25 +2453,25 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u break; case EVO_FRIENDSHIP: if (friendship >= 220) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_FRIENDSHIP; } break; case EVO_FRIENDSHIP_DAY: if (IsNighttime() == 0 && friendship >= 220) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_FRIENDSHIP_DAY; } break; case EVO_FRIENDSHIP_NIGHT: if (IsNighttime() == 1 && friendship >= 220) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_FRIENDSHIP_NIGHT; } break; case EVO_LEVEL: if (evoTable[i].param <= level) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL; } break; @@ -2483,37 +2483,37 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u break; case EVO_LEVEL_ATK_GT_DEF: if (evoTable[i].param <= level && GetMonData(pokemon, MON_DATA_ATK, NULL) > GetMonData(pokemon, MON_DATA_DEF, NULL)) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_ATK_GT_DEF; } break; case EVO_LEVEL_ATK_EQ_DEF: if (evoTable[i].param <= level && GetMonData(pokemon, MON_DATA_ATK, NULL) == GetMonData(pokemon, MON_DATA_DEF, NULL)) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_ATK_EQ_DEF; } break; case EVO_LEVEL_ATK_LT_DEF: if (evoTable[i].param <= level && GetMonData(pokemon, MON_DATA_ATK, NULL) < GetMonData(pokemon, MON_DATA_DEF, NULL)) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_ATK_LT_DEF; } break; case EVO_LEVEL_PID_LO: if (evoTable[i].param <= level && pid_hi % 10 < 5) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_PID_LO; } break; case EVO_LEVEL_PID_HI: if (evoTable[i].param <= level && pid_hi % 10 >= 5) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_PID_HI; } break; case EVO_LEVEL_NINJASK: if (evoTable[i].param <= level) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_NINJASK; } break; @@ -2522,7 +2522,7 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u break; case EVO_BEAUTY: if (evoTable[i].param <= beauty) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_BEAUTY; } break; @@ -2532,55 +2532,55 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u break; case EVO_ITEM_DAY: if (IsNighttime() == 0 && evoTable[i].param == heldItem) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_ITEM_DAY; } break; case EVO_ITEM_NIGHT: if (IsNighttime() == 1 && evoTable[i].param == heldItem) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_ITEM_NIGHT; } break; case EVO_HAS_MOVE: if (MonHasMove(pokemon, evoTable[i].param) == TRUE) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_HAS_MOVE; } break; case EVO_OTHER_PARTY_MON: if (party != NULL && Party_HasMon(party, evoTable[i].param) == 1) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_OTHER_PARTY_MON; } break; case EVO_LEVEL_MALE: if (GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_MALE && evoTable[i].param <= level) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_MALE; } break; case EVO_LEVEL_FEMALE: if (GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_FEMALE && evoTable[i].param <= level) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_LEVEL_FEMALE; } break; case EVO_CORONET: if (usedItem == evoTable[i].method) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_CORONET; } break; case EVO_ETERNA: if (usedItem == evoTable[i].method) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_ETERNA; } break; case EVO_ROUTE217: if (usedItem == evoTable[i].method) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_ROUTE217; } break; @@ -2594,12 +2594,12 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u for (i = 0; i < 7; i++) { switch (evoTable[i].method) { case EVO_TRADE: - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_TRADE; break; case EVO_TRADE_ITEM: if (heldItem == evoTable[i].param) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = EVO_TRADE_ITEM; } break; @@ -2613,17 +2613,17 @@ u16 GetMonEvolution(struct Party *party, struct Pokemon *pokemon, u32 context, u case 3: for (i = 0; i < 7; i++) { if (evoTable[i].method == EVO_STONE && usedItem == evoTable[i].param) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = 0; break; } if (evoTable[i].method == EVO_STONE_MALE && GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_MALE && usedItem == evoTable[i].param) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = 0; break; } if (evoTable[i].method == EVO_STONE_FEMALE && GetMonData(pokemon, MON_DATA_GENDER, NULL) == MON_FEMALE && usedItem == evoTable[i].param) { - target = evoTable[i].target; + target = evoTable[i].target; *method_ret = 0; break; } @@ -2674,10 +2674,10 @@ void InitBoxMonMoveset(struct BoxPokemon *boxmon) { u8 level; u16 move; levelUpLearnset = AllocFromHeap(HEAP_ID_DEFAULT, MAX_LEARNED_MOVES * sizeof(u16)); - decry = AcquireBoxMonLock(boxmon); - species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - form = GetBoxMonData(boxmon, MON_DATA_FORM, NULL); - level = (u8)CalcBoxMonLevel(boxmon); + decry = AcquireBoxMonLock(boxmon); + species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); + form = GetBoxMonData(boxmon, MON_DATA_FORM, NULL); + level = (u8)CalcBoxMonLevel(boxmon); LoadLevelUpLearnset_HandleAlternateForm(species, (int)form, levelUpLearnset); for (i = 0; levelUpLearnset[i] != LEVEL_UP_LEARNSET_END; i++) { if ((levelUpLearnset[i] & LEVEL_UP_LEARNSET_LEVEL_MASK) > (level << LEVEL_UP_LEARNSET_LEVEL_SHIFT)) { @@ -2730,13 +2730,13 @@ void sub_02069718(struct BoxPokemon *boxmon, u16 move) { for (i = 0; i < 3; i++) { moves[i] = (u16)GetBoxMonData(boxmon, MON_DATA_MOVE1 + i + 1, NULL); - pp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + i + 1, NULL); - ppUp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + i + 1, NULL); + pp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + i + 1, NULL); + ppUp[i] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + i + 1, NULL); } moves[3] = move; - pp[3] = (u8)GetWazaAttr(move, MOVEATTR_PP); - ppUp[3] = 0; + pp[3] = (u8)GetWazaAttr(move, MOVEATTR_PP); + ppUp[3] = 0; for (i = 0; i < 4; i++) { SetBoxMonData(boxmon, MON_DATA_MOVE1 + i, &moves[i]); @@ -2757,16 +2757,16 @@ void BoxMonSetMoveInSlot(struct BoxPokemon *boxmon, u16 move, u8 slot) { SetBoxMonData(boxmon, MON_DATA_MOVE1 + slot, &move); ppUp = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot, NULL); - pp = (u8)WazaGetMaxPp(move, ppUp); + pp = (u8)WazaGetMaxPp(move, ppUp); SetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot, &pp); } u32 sub_02069818(struct Pokemon *pokemon, u32 *r5, u16 *sp0) { - u32 ret = 0; + u32 ret = 0; u16 *levelUpLearnset = AllocFromHeap(HEAP_ID_DEFAULT, MAX_LEARNED_MOVES * sizeof(u16)); - u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); - u32 form = GetMonData(pokemon, MON_DATA_FORM, NULL); - u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL); + u16 species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, NULL); + u32 form = GetMonData(pokemon, MON_DATA_FORM, NULL); + u8 level = (u8)GetMonData(pokemon, MON_DATA_LEVEL, NULL); LoadLevelUpLearnset_HandleAlternateForm(species, (int)form, levelUpLearnset); if (levelUpLearnset[*r5] == 0xFFFF) { @@ -2799,11 +2799,11 @@ void sub_020698E8(struct BoxPokemon *boxmon, int slot1, int slot2) { u8 ppUp[2]; moves[0] = (u16)GetBoxMonData(boxmon, MON_DATA_MOVE1 + slot1, NULL); - pp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot1, NULL); - ppUp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot1, NULL); + pp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot1, NULL); + ppUp[0] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot1, NULL); moves[1] = (u16)GetBoxMonData(boxmon, MON_DATA_MOVE1 + slot2, NULL); - pp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot2, NULL); - ppUp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot2, NULL); + pp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot2, NULL); + ppUp[1] = (u8)GetBoxMonData(boxmon, MON_DATA_MOVE1PPUP + slot2, NULL); SetBoxMonData(boxmon, MON_DATA_MOVE1 + slot1, &moves[1]); SetBoxMonData(boxmon, MON_DATA_MOVE1PP + slot1, &pp[1]); @@ -2819,14 +2819,14 @@ void sub_020699A4(struct Pokemon *pokemon, u32 slot) { u8 ppUp; for (; slot < 3; slot++) { move = (u16)GetMonData(pokemon, (int)(MON_DATA_MOVE1 + slot + 1), NULL); - pp = (u8)GetMonData(pokemon, (int)(MON_DATA_MOVE1PP + slot + 1), NULL); + pp = (u8)GetMonData(pokemon, (int)(MON_DATA_MOVE1PP + slot + 1), NULL); ppUp = (u8)GetMonData(pokemon, (int)(MON_DATA_MOVE1PPUP + slot + 1), NULL); SetMonData(pokemon, (int)(MON_DATA_MOVE1 + slot), &move); SetMonData(pokemon, (int)(MON_DATA_MOVE1PP + slot), &pp); SetMonData(pokemon, (int)(MON_DATA_MOVE1PPUP + slot), &ppUp); } move = MOVE_NONE; - pp = 0; + pp = 0; ppUp = 0; SetMonData(pokemon, MON_DATA_MOVE1 + 3, &move); SetMonData(pokemon, MON_DATA_MOVE1PP + 3, &pp); @@ -2945,7 +2945,7 @@ void Party_GivePokerusAtRandom(struct Party *party) { case 0x8000: case 0xC000: do { - idx = LCRandom() % count; + idx = LCRandom() % count; pokemon = Party_GetMonByIndex(party, idx); } while (GetMonData(pokemon, MON_DATA_SPECIES, NULL) == SPECIES_NONE || GetMonData(pokemon, MON_DATA_IS_EGG, NULL)); if (!Party_MaskMonsWithPokerus(party, (u8)MaskOfFlagNo(idx))) { @@ -2964,9 +2964,9 @@ void Party_GivePokerusAtRandom(struct Party *party) { } u8 Party_MaskMonsWithPokerus(struct Party *party, u8 mask) { - int i = 0; + int i = 0; u32 flag = 1; - u8 ret = 0; + u8 ret = 0; struct Pokemon *pokemon; if (mask != 0) { do { @@ -3071,8 +3071,8 @@ void Pokemon_UpdateArceusForm(struct Pokemon *pokemon) { } void BoxMon_UpdateArceusForm(struct BoxPokemon *boxmon) { - u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - u32 ability = GetBoxMonData(boxmon, MON_DATA_ABILITY, NULL); + u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); + u32 ability = GetBoxMonData(boxmon, MON_DATA_ABILITY, NULL); u32 heldItem = GetBoxMonData(boxmon, MON_DATA_HELD_ITEM, NULL); u32 form; if (species == SPECIES_ARCEUS && ability == ABILITY_MULTITYPE) { @@ -3165,11 +3165,11 @@ void sub_0206A094(struct Pokemon *pokemon, u32 a1, u32 a2) { u16 item1; u16 item2; if (!(a1 & 0x81)) { - chance = (u32)(LCRandom() % 100); + chance = (u32)(LCRandom() % 100); species = (u16)GetMonData(pokemon, MON_DATA_SPECIES, 0); - form = (u16)GetMonData(pokemon, MON_DATA_FORM, 0); - item1 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_1); - item2 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_2); + form = (u16)GetMonData(pokemon, MON_DATA_FORM, 0); + item1 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_1); + item2 = (u16)GetMonBaseStat_HandleFormConversion(species, form, BASE_ITEM_2); if (item1 == item2 && item1 != ITEM_NONE) { SetMonData(pokemon, MON_DATA_HELD_ITEM, &item1); } else { @@ -3190,7 +3190,7 @@ BOOL sub_0206A13C(struct Pokemon *pokemon, u32 a1) { BOOL sub_0206A144(struct BoxPokemon *boxmon, u32 a1) { u16 species = (u16)GetBoxMonData(boxmon, MON_DATA_SPECIES2, NULL); - int form = (int)GetBoxMonData(boxmon, MON_DATA_FORM, NULL); + int form = (int)GetBoxMonData(boxmon, MON_DATA_FORM, NULL); return sub_0206A16C(species, form, a1); } @@ -3221,9 +3221,9 @@ void sub_0206A1C4(struct Pokemon *pokemon) { } void sub_0206A1CC(struct BoxPokemon *boxmon) { - BOOL decry = AcquireBoxMonLock(boxmon); - int species = (int)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - int pid = (int)GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); + BOOL decry = AcquireBoxMonLock(boxmon); + int species = (int)GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); + int pid = (int)GetBoxMonData(boxmon, MON_DATA_PERSONALITY, NULL); int ability1 = (int)GetMonBaseStat(species, BASE_ABILITY_1); int ability2 = (int)GetMonBaseStat(species, BASE_ABILITY_2); @@ -3252,11 +3252,11 @@ void sub_0206A23C(struct Pokemon *r5, u32 personality) { sp4 = AllocMonZeroed(HEAP_ID_DEFAULT); CopyPokemonToPokemon(r5, sp4); - r4 = &GetSubstruct(&sp4->box, r5->box.pid, 0)->blockA; - r6 = &GetSubstruct(&sp4->box, r5->box.pid, 1)->blockB; - r7 = &GetSubstruct(&sp4->box, r5->box.pid, 2)->blockC; - sp8 = &GetSubstruct(&sp4->box, r5->box.pid, 3)->blockD; - spC = &GetSubstruct(&r5->box, personality, 0)->blockA; + r4 = &GetSubstruct(&sp4->box, r5->box.pid, 0)->blockA; + r6 = &GetSubstruct(&sp4->box, r5->box.pid, 1)->blockB; + r7 = &GetSubstruct(&sp4->box, r5->box.pid, 2)->blockC; + sp8 = &GetSubstruct(&sp4->box, r5->box.pid, 3)->blockD; + spC = &GetSubstruct(&r5->box, personality, 0)->blockA; sp10 = &GetSubstruct(&r5->box, personality, 1)->blockB; sp14 = &GetSubstruct(&r5->box, personality, 2)->blockC; sp18 = &GetSubstruct(&r5->box, personality, 3)->blockD; @@ -3264,11 +3264,11 @@ void sub_0206A23C(struct Pokemon *r5, u32 personality) { DECRYPT_BOX(&sp4->box); DECRYPT_PTY(r5); DECRYPT_BOX(&r5->box); - r5->box.pid = personality; - *spC = *r4; - *sp10 = *r6; - *sp14 = *r7; - *sp18 = *sp8; + r5->box.pid = personality; + *spC = *r4; + *sp10 = *r6; + *sp14 = *r7; + *sp18 = *sp8; r5->box.checksum = CHECKSUM(&r5->box); ENCRYPT_BOX(&r5->box); ENCRYPT_PTY(r5); @@ -3459,13 +3459,13 @@ BOOL sub_0206A998(struct Pokemon *pokemon) { } BOOL sub_0206A9AC(struct BoxPokemon *boxmon, PlayerProfile *sb2, HeapID heapId) { - u32 myId = PlayerProfile_GetTrainerID(sb2); - u32 otId = GetBoxMonData(boxmon, MON_DATA_OTID, NULL); - u32 myGender = PlayerProfile_GetTrainerGender(sb2); - u32 otGender = GetBoxMonData(boxmon, MON_DATA_MET_GENDER, NULL); + u32 myId = PlayerProfile_GetTrainerID(sb2); + u32 otId = GetBoxMonData(boxmon, MON_DATA_OTID, NULL); + u32 myGender = PlayerProfile_GetTrainerGender(sb2); + u32 otGender = GetBoxMonData(boxmon, MON_DATA_MET_GENDER, NULL); struct String *r7 = PlayerProfile_GetPlayerName_NewString(sb2, heapId); struct String *r6 = String_New(PLAYER_NAME_LENGTH + 1, heapId); - BOOL ret = FALSE; + BOOL ret = FALSE; GetBoxMonData(boxmon, MON_DATA_OT_NAME_2, r6); if (myId == otId && myGender == otGender && String_Compare(r7, r6) == 0) { ret = TRUE; diff --git a/arm9/src/pokemon_storage_system.c b/arm9/src/pokemon_storage_system.c index 1ba743598..019748027 100644 --- a/arm9/src/pokemon_storage_system.c +++ b/arm9/src/pokemon_storage_system.c @@ -32,7 +32,7 @@ void PCStorage_InitializeBoxes(struct PCStorage *pc) { j = 0; } } - pc->unlockedWallpapers = 0; + pc->unlockedWallpapers = 0; struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0014_bin, HEAP_ID_DEFAULT); if (msgData != NULL) { for (i = 0; i < NUM_BOXES; i++) { @@ -129,7 +129,7 @@ BOOL PCStorage_FindFirstEmptySlot(struct PCStorage *pc, int *boxno, int *slotno) do { while (j < (int)MONS_PER_BOX) { if (!GetBoxMonData(&pc->boxes[i][j], MON_DATA_SPECIES_EXISTS, NULL)) { - *boxno = i; + *boxno = i; *slotno = j; return TRUE; } diff --git a/arm9/src/poketch.c b/arm9/src/poketch.c index 3e8d3d620..e6c6b205e 100644 --- a/arm9/src/poketch.c +++ b/arm9/src/poketch.c @@ -26,17 +26,17 @@ void Save_Poketch_Init(struct Poketch *poketch) { for (i = 0; i < 32; i++) { poketch->unlockedApps[i] = 0; } - poketch->numApps = 0; - poketch->selectedApp = 0; - poketch->isGiven = 0; - poketch->color = 0; + poketch->numApps = 0; + poketch->selectedApp = 0; + poketch->isGiven = 0; + poketch->color = 0; poketch->pedometerActive = 0; - poketch->stepCounter = 0; - poketch->alarmActive = 0; - poketch->alarmHour = 0; - poketch->alarmMinute = 0; - poketch->calendarMonth = 1; // January - poketch->calendarFlags = 0; + poketch->stepCounter = 0; + poketch->alarmActive = 0; + poketch->alarmHour = 0; + poketch->alarmMinute = 0; + poketch->calendarMonth = 1; // January + poketch->calendarFlags = 0; for (i = 0; i < 6; i++) { poketch->markingMapPos[i][0] = sMarkingMapInitialPos[i][0]; poketch->markingMapPos[i][1] = sMarkingMapInitialPos[i][1]; @@ -80,7 +80,7 @@ PoketchApp Save_Poketch_GetSelectedApp(struct Poketch *poketch) { } PoketchApp Save_Poketch_CycleNextApp(struct Poketch *poketch) { - PoketchApp app = (PoketchApp)poketch->selectedApp; + PoketchApp app = (PoketchApp)poketch->selectedApp; PoketchApp prev = app; while (1) { @@ -125,12 +125,12 @@ BOOL Save_Poketch_GetAlarmState(struct Poketch *poketch) { void Save_Poketch_GetAlarmSetTime(struct Poketch *poketch, u32 *hour_p, u32 *min_p) { *hour_p = poketch->alarmHour; - *min_p = poketch->alarmMinute; + *min_p = poketch->alarmMinute; } void Save_Poketch_SetAlarm(struct Poketch *poketch, BOOL enabled, u32 hour, u32 minute) { poketch->alarmActive = enabled; - poketch->alarmHour = hour; + poketch->alarmHour = hour; poketch->alarmMinute = minute; } @@ -214,7 +214,7 @@ void Save_Poketch_PokemonHistoryGetSlotN(struct Poketch *poketch, s32 i, u32 *sp GF_ASSERT(i < 12); GF_ASSERT(poketch->pokemonHistory[i][0] != SPECIES_NONE); *species_p = poketch->pokemonHistory[i][0]; - *form_p = poketch->pokemonHistory[i][1]; + *form_p = poketch->pokemonHistory[i][1]; } struct Poketch *Save_Poketch_Get(struct SaveData *save) { diff --git a/arm9/src/render_text.c b/arm9/src/render_text.c index f44c7dd46..76455198f 100644 --- a/arm9/src/render_text.c +++ b/arm9/src/render_text.c @@ -37,7 +37,7 @@ u32 RenderText(struct TextPrinter *printer) { if (gTextFlags.canABSpeedUpPrint != 0) { if ((gSystem.newKeys & 3) || (gSystem.touchNew != 0 && gTextFlags.unk0_4)) { subStruct->hasPrintBeenSpedUp = 1; - printer->delayCounter = 0; + printer->delayCounter = 0; } } @@ -45,7 +45,7 @@ u32 RenderText(struct TextPrinter *printer) { } printer->delayCounter = printer->textSpeedBottom; - currentChar = *printer->printerTemplate.currentChar.raw; + currentChar = *printer->printerTemplate.currentChar.raw; printer->printerTemplate.currentChar.raw++; GF_ASSERT(currentChar != 0xF100); @@ -55,7 +55,7 @@ u32 RenderText(struct TextPrinter *printer) { return 1; case CHAR_LF: printer->printerTemplate.currentX = printer->printerTemplate.x; - s32 fontAttribute = GetFontAttribute(printer->printerTemplate.fontId, 1); + s32 fontAttribute = GetFontAttribute(printer->printerTemplate.fontId, 1); printer->printerTemplate.currentY += printer->printerTemplate.lineSpacing + fontAttribute; @@ -71,7 +71,7 @@ u32 RenderText(struct TextPrinter *printer) { u16 field = (u16)MsgArray_ControlCodeGetField( printer->printerTemplate.currentChar.raw, 0); if (field == 0xff) { - u8 r2 = printer->printerTemplate.unk4; + u8 r2 = printer->printerTemplate.unk4; printer->printerTemplate.unk4 = (u8)((printer->printerTemplate.fgColor - 1) / 2 + 100); if (!(r2 >= 100 && r2 < 107)) { @@ -86,7 +86,7 @@ u32 RenderText(struct TextPrinter *printer) { } } - printer->printerTemplate.fgColor = (u8)(field * 2 + 1); + printer->printerTemplate.fgColor = (u8)(field * 2 + 1); printer->printerTemplate.shadowColor = (u8)(field * 2 + 2); GenerateFontHalfRowLookupTable(printer->printerTemplate.fgColor, @@ -112,7 +112,7 @@ u32 RenderText(struct TextPrinter *printer) { printer->delayCounter = (u8)MsgArray_ControlCodeGetField( printer->printerTemplate.currentChar.raw, 0); printer->printerTemplate.currentChar.raw = MsgArray_SkipControlCode(printer->printerTemplate.currentChar.raw); - printer->state = 6; + printer->state = 6; return 3; case 0x202: @@ -211,16 +211,16 @@ u32 RenderText(struct TextPrinter *printer) { printer->printerTemplate.window, printer->printerTemplate.bgColor); printer->printerTemplate.currentX = printer->printerTemplate.x; printer->printerTemplate.currentY = printer->printerTemplate.y; - printer->state = 0; + printer->state = 0; } return 3; case 3: if (TextPrinterWaitWithDownArrow(printer) != 0) { TextPrinterClearDownArrow(printer); - printer->scrollDistance = (u8)(GetFontAttribute(printer->printerTemplate.fontId, 1) + printer->printerTemplate.lineSpacing); + printer->scrollDistance = (u8)(GetFontAttribute(printer->printerTemplate.fontId, 1) + printer->printerTemplate.lineSpacing); printer->printerTemplate.currentX = printer->printerTemplate.x; - printer->state = 4; + printer->state = 4; } return 3; @@ -276,7 +276,7 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *printer) { } subStruct->downArrowYPosIdx = 0; - subStruct->downArrowDelay = 0; + subStruct->downArrowDelay = 0; } void TextPrinterDrawDownArrow(struct TextPrinter *printer) { @@ -292,10 +292,10 @@ void TextPrinterDrawDownArrow(struct TextPrinter *printer) { } u8 bg_id = GetWindowBgId(printer->printerTemplate.window); - u8 x = GetWindowX(printer->printerTemplate.window); - u8 y = GetWindowY(printer->printerTemplate.window); + u8 x = GetWindowX(printer->printerTemplate.window); + u8 y = GetWindowY(printer->printerTemplate.window); u8 width = GetWindowWidth(printer->printerTemplate.window); - u16 r6 = unk00; + u16 r6 = unk00; FillBgTilemapRect(printer->printerTemplate.window->bgConfig, bg_id, @@ -338,10 +338,10 @@ void TextPrinterDrawDownArrow(struct TextPrinter *printer) { void TextPrinterClearDownArrow(struct TextPrinter *printer) { u8 bg_id = GetWindowBgId(printer->printerTemplate.window); - u8 x = GetWindowX(printer->printerTemplate.window); - u8 y = GetWindowY(printer->printerTemplate.window); + u8 x = GetWindowX(printer->printerTemplate.window); + u8 y = GetWindowY(printer->printerTemplate.window); u8 width = GetWindowWidth(printer->printerTemplate.window); - u16 r6 = unk00; + u16 r6 = unk00; FillBgTilemapRect(printer->printerTemplate.window->bgConfig, bg_id, @@ -413,7 +413,7 @@ void TextFlags_SetCanABSpeedUpPrint(BOOL param0) { void sub_02002B7C(s32 param0) { gTextFlags.autoScroll = param0 & 1; - gTextFlags.unk0_5 = (param0 >> 1) & 1; + gTextFlags.unk0_5 = (param0 >> 1) & 1; } void sub_02002BB8(u32 param0) { diff --git a/arm9/src/render_window.c b/arm9/src/render_window.c index e89cc292a..d17d7af4e 100644 --- a/arm9/src/render_window.c +++ b/arm9/src/render_window.c @@ -285,12 +285,12 @@ void BlitRect4Bit(u8 *srcPixels, u16 height) { struct Bitmap src; src.pixels = srcPixels; - src.width = srcWidth; + src.width = srcWidth; src.height = srcHeight; struct Bitmap dst; dst.pixels = dstPixels; - dst.width = dstWidth; + dst.width = dstWidth; dst.height = dstHeight; BlitBitmapRect4Bit(&src, &dst, srcX, srcY, dstX, dstY, width, height, 0); @@ -298,9 +298,9 @@ void BlitRect4Bit(u8 *srcPixels, void sub_0200D18C(struct Window *window, u16 fill_value) { HeapID heapId = BgConfig_GetHeapId(window->bgConfig); - u8 bg_id = GetWindowBgId(window); + u8 bg_id = GetWindowBgId(window); - void *ptr = AllocFromHeap(heapId, 0x180); + void *ptr = AllocFromHeap(heapId, 0x180); void *charptr = BgGetCharPtr((u8)bg_id); NNSG2dCharacterData *pCharData; @@ -449,8 +449,8 @@ void DrawWindowCorner(struct Window *window, u16 fillValue, u8 paletteNum) { u8 bg_id; bg_id = GetWindowBgId(window); - x = (u16)(GetWindowX(window) - 7); - y = GetWindowY(window); + x = (u16)(GetWindowX(window) - 7); + y = GetWindowY(window); for (i = 0; i < 4; i++) { for (j = 0; j < 6; j++) { @@ -546,11 +546,11 @@ WaitingIcon *WaitingIcon_New(struct Window *window, u32 param1) { BlitRect4Bit(pCharData->pRawData, 0, 0, 0x10, 0x80, waitingIcon->unk004[0], 0x10, 0x80, 0, 0, 0x10, 0x80); FreeToHeap(r5); - waitingIcon->window = window; + waitingIcon->window = window; waitingIcon->fillValue = (u16)param1; - waitingIcon->unk486 = 0; - waitingIcon->unk487 = 0; - waitingIcon->unk488 = 0; + waitingIcon->unk486 = 0; + waitingIcon->unk487 = 0; + waitingIcon->unk488 = 0; sub_0200CA60((SysTaskFunc)sub_0200DB7C, waitingIcon, 0); sub_0200D980(waitingIcon, 1); @@ -560,8 +560,8 @@ WaitingIcon *WaitingIcon_New(struct Window *window, u32 param1) { void sub_0200D980(WaitingIcon *waitingIcon, u32 param1) { u8 bg_id = GetWindowBgId(waitingIcon->window); - u8 x = GetWindowX(waitingIcon->window); - u8 y = GetWindowY(waitingIcon->window); + u8 x = GetWindowX(waitingIcon->window); + u8 y = GetWindowY(waitingIcon->window); u8 width = GetWindowWidth(waitingIcon->window); if (param1 == 2) { @@ -619,7 +619,7 @@ void sub_0200DC24(WaitingIcon *waitingIcon) { } PokepicManager *DrawPokemonPicFromSpecies(struct BgConfig *bg_config, u8 bg_id, u8 param2, u8 param3, u8 param4, u16 numTiles, u16 species, u8 gender, HeapID heapId) { - s32 heap = heapId; // weirdness needed for matching + s32 heap = heapId; // weirdness needed for matching struct UnkStruct_0200CABC_2 *r4 = sub_0200DD70(bg_config, bg_id, param2, param3, (HeapID)heap); sub_0200DDAC(r4, (HeapID)heap); sub_0200DDD8(r4); @@ -632,7 +632,7 @@ PokepicManager *DrawPokemonPicFromSpecies(struct BgConfig *bg_config, u8 bg_id, } PokepicManager *DrawPokemonPicFromMon(struct BgConfig *bg_config, u8 bg_id, u8 param2, u8 param3, u8 param4, u16 numTiles, struct Pokemon *mon, HeapID heapId) { - s32 heap = heapId; // weirdness needed for matching + s32 heap = heapId; // weirdness needed for matching struct UnkStruct_0200CABC_2 *r4 = sub_0200DD70(bg_config, bg_id, param2, param3, (HeapID)heap); sub_0200DDAC(r4, (HeapID)heap); sub_0200DDD8(r4); @@ -672,10 +672,10 @@ struct UnkStruct_0200CABC_2 *sub_0200DD70( struct UnkStruct_0200CABC_2 *res = sub_0201B6C8(sub_020061E8((SysTaskFunc)sub_0200DCF8, 0x170, 0, heapId)); res->pokepicManager.unk00 = 0; - res->bgConfig = bg_config; - res->bgId = bg_id; - res->x = param2; - res->y = param3; + res->bgConfig = bg_config; + res->bgId = bg_id; + res->x = param2; + res->y = param3; return res; } @@ -718,7 +718,7 @@ void sub_0200DE30(struct UnkStruct_0200CABC_2 *param0, u8 param1, u8 param2) { }; ((u16 *)UNK_020ECEC0)[0] = (u16)((param1 + 5) * 8); ((u16 *)UNK_020ECEC0)[1] = (u16)((param2 + 5) * 8); - param0->unk164 = ov05_021D9820(param0, UNK_020ECEC0); + param0->unk164 = ov05_021D9820(param0, UNK_020ECEC0); sub_0201FDEC(param0->unk000); GfGfx_EngineBTogglePlanes(0x10, GX_PLANE_TOGGLE_ON); } diff --git a/arm9/src/sav_chatot.c b/arm9/src/sav_chatot.c index be8ed9272..7ae2e41b1 100644 --- a/arm9/src/sav_chatot.c +++ b/arm9/src/sav_chatot.c @@ -47,11 +47,11 @@ void Chatot_Decode(s8 *dest, const s8 *data) { s8 val2; for (dest_i = 0, i = 0; i < 1000; i++, dest_i += 2) { - val = (u8)(data[i] & 0xF); - val2 = transform(val); + val = (u8)(data[i] & 0xF); + val2 = transform(val); dest[dest_i + 0] = (s8)(val2 << 4); - val = (u8)(data[i] >> 4); - val2 = transform(val); + val = (u8)(data[i] >> 4); + val2 = transform(val); dest[dest_i + 1] = (s8)(val2 << 4); } } @@ -69,11 +69,11 @@ void Chatot_Encode(struct SaveChatotSoundClip *chatot, const s8 *data) { chatot->exists = TRUE; for (src_i = 0; src_i < 2000; src_i += 2) { - val = data[src_i + 0]; - val2 = untransform(val); + val = data[src_i + 0]; + val2 = untransform(val); chatot->data[i] = (s8)val2; - val = data[src_i + 1]; + val = data[src_i + 1]; val2 = untransform(val); chatot->data[i] |= val2 << 4; diff --git a/arm9/src/save.c b/arm9/src/save.c index ab9274f05..3fe96c8e2 100644 --- a/arm9/src/save.c +++ b/arm9/src/save.c @@ -21,10 +21,10 @@ static SaveData *sSaveDataPtr; struct SaveData *SaveData_New(void) { struct SaveData *save = AllocFromHeap(HEAP_ID_1, sizeof(struct SaveData)); MI_CpuClearFast(save, sizeof(struct SaveData)); - sSaveDataPtr = save; - save->flashOkay = SaveDetectFlash(); - save->saveFileExists = 0; - save->isNewGame = 1; + sSaveDataPtr = save; + save->flashOkay = SaveDetectFlash(); + save->saveFileExists = 0; + save->isNewGame = 1; save->largeSectorChanged = 1; MATH_CRC16InitTable(&save->crcTable); SaveData_InitSubstructs(save->arrayHeaders); @@ -37,7 +37,7 @@ struct SaveData *SaveData_New(void) { case 2: Save_LoadDynamicRegion(save); save->saveFileExists = 1; - save->isNewGame = 0; + save->isNewGame = 0; break; case 0: case 3: @@ -89,7 +89,7 @@ BOOL sub_020226FC(struct SaveData *save) { } if (Save_LoadDynamicRegion(save)) { save->saveFileExists = 1; - save->isNewGame = 0; + save->isNewGame = 0; return TRUE; } return FALSE; @@ -110,7 +110,7 @@ int SaveGame(struct SaveData *save) { int ret = sub_02023044(save); if (ret == 2) { save->saveFileExists = 1; - save->isNewGame = 0; + save->isNewGame = 0; } return ret; } @@ -127,7 +127,7 @@ void sub_020227A0(struct SaveData *save, int a1) { } void Save_InitDynamicRegion(struct SaveData *save) { - save->isNewGame = 1; + save->isNewGame = 1; save->largeSectorChanged = 1; Save_InitDynamicRegion_Internal(save->dynamic_region, save->arrayHeaders); } @@ -177,9 +177,9 @@ void sub_0202287C(struct SaveData *save) { } void sub_0202288C(struct UnkStruct_0202288C *header) { - header->unk_0 = 0; + header->unk_0 = 0; header->offset = 0; - header->size = 0; + header->size = 0; } u16 sub_02022898(struct SaveData *save, void *data, u32 size) { @@ -201,7 +201,7 @@ struct SaveChunkFooter *sub_020228B8(struct SaveData *save, u8 *offset, int idx) struct SaveSlotSpec *spec; spec = &save->saveSlotSpecs[idx]; - r4 = offset + spec->offset; + r4 = offset + spec->offset; GF_ASSERT(spec->size != 0); return (struct SaveChunkFooter *)(r4 + spec->size - 20); } @@ -210,9 +210,9 @@ BOOL sub_020228E0(struct SaveData *save, void *data, int idx) { struct SaveChunkFooter *r4; struct SaveSlotSpec *spec; - spec = &save->saveSlotSpecs[idx]; - r4 = sub_020228B8(save, data, idx); - u32 size = spec->size; + spec = &save->saveSlotSpecs[idx]; + r4 = sub_020228B8(save, data, idx); + u32 size = spec->size; u32 offset = spec->offset; if (r4->size != size) { return FALSE; @@ -228,25 +228,25 @@ BOOL sub_020228E0(struct SaveData *save, void *data, int idx) { void sub_0202293C(struct UnkStruct_0202288C *r5, struct SaveData *save, void *data, int idx) { struct SaveChunkFooter *r4; - r4 = sub_020228B8(save, data, idx); - r5->unk_0 = sub_020228E0(save, data, idx); + r4 = sub_020228B8(save, data, idx); + r5->unk_0 = sub_020228E0(save, data, idx); r5->offset = r4->unk_0; - r5->size = r4->offset; + r5->size = r4->offset; } void sub_02022968(struct SaveData *save, void *data, int idx) { struct SaveChunkFooter *r4; struct SaveSlotSpec *spec; - spec = &save->saveSlotSpecs[idx]; - r4 = sub_020228B8(save, data, idx); - data = (void *)((u8 *)data + spec->offset); - r4->unk_0 = save->unk_20214; + spec = &save->saveSlotSpecs[idx]; + r4 = sub_020228B8(save, data, idx); + data = (void *)((u8 *)data + spec->offset); + r4->unk_0 = save->unk_20214; r4->offset = save->unk_20218[idx]; - r4->size = spec->size; - r4->magic = 0x20060623; + r4->size = spec->size; + r4->magic = 0x20060623; r4->unk_10 = (u8)idx; - r4->crc = sub_02022898(save, data, spec->size); + r4->crc = sub_02022898(save, data, spec->size); } int sub_020229B8(u32 x, u32 y) { @@ -264,7 +264,7 @@ int sub_020229B8(u32 x, u32 y) { int sub_020229F0(struct UnkStruct_0202288C *r7, struct UnkStruct_0202288C *r6, u32 *r5, u32 *r4) { int sp0 = sub_020229B8(r7->offset, r6->offset); - int r0 = sub_020229B8(r7->size, r6->size); + int r0 = sub_020229B8(r7->size, r6->size); if (r7->unk_0 != 0 && r6->unk_0 != 0) { if (sp0 > 0) { GF_ASSERT(r0 > 0); @@ -301,7 +301,7 @@ int sub_020229F0(struct UnkStruct_0202288C *r7, struct UnkStruct_0202288C *r6, u } void sub_02022AA0(struct SaveData *save, struct UnkStruct_0202288C *a1, struct UnkStruct_0202288C *a2, u32 a3, u32 a4) { - save->unk_20214 = a1[a3].offset; + save->unk_20214 = a1[a3].offset; save->unk_20218[0] = a1[a3].size; save->unk_20218[1] = a2[a4].size; save->unk_20220[0] = (u8)a3; @@ -405,13 +405,13 @@ int sub_02022D54(struct SaveData *save, int chunk, u8 slot) { int sub_02022D94(struct SaveData *save, int chunk, u8 slot) { struct SaveSlotSpec *header = &save->saveSlotSpecs[chunk]; - u32 size = header->size; + u32 size = header->size; return FlashWriteChunkInternal(GetChunkOffsetFromCurrentSaveSlot(slot, header) + size - 20, save->dynamic_region + header->offset + size - 20, 20); } int sub_02022DC8(struct SaveData *save, int chunk, u8 slot) { struct SaveSlotSpec *header = &save->saveSlotSpecs[chunk]; - u32 size = header->size; + u32 size = header->size; return FlashWriteChunkInternal(GetChunkOffsetFromCurrentSaveSlot(slot, header) + size - 12, save->dynamic_region + header->offset + size - 12, 8); } @@ -420,24 +420,24 @@ void sub_02022DFC(struct SaveData *save, struct AsyncWriteManager *a1, int a2) { a1->unk_1C[i] = save->unk_20218[i]; save->unk_20218[i]++; } - a1->state = 0; + a1->state = 0; a1->rollbackCounter = 0; if (a2 == 2) { if (save->largeSectorChanged) { a1->rollbackCounter = 1; - a1->count = save->unk_20214; + a1->count = save->unk_20214; save->unk_20214++; - a1->unk_4 = 0; - a1->curSector = 0; + a1->unk_4 = 0; + a1->curSector = 0; a1->numSectors = 2; } else { - a1->unk_4 = 0; - a1->curSector = 0; + a1->unk_4 = 0; + a1->curSector = 0; a1->numSectors = 1; } } else { - a1->unk_4 = a2; - a1->curSector = a2; + a1->unk_4 = a2; + a1->curSector = a2; a1->numSectors = a2 + 1; } sub_02016444(1); @@ -509,8 +509,8 @@ void sub_02022F80(struct SaveData *save, struct AsyncWriteManager *a1, int a2) { for (i = a1->unk_4; i < a1->numSectors; i++) { save->unk_20220[i] = (u8)(save->unk_20220[i] == 0); } - save->saveFileExists = 1; - save->isNewGame = 0; + save->saveFileExists = 1; + save->isNewGame = 0; save->largeSectorChanged = 0; } sub_02016454(1); @@ -559,15 +559,15 @@ u32 SaveArray_sizeof(int idx) { void SaveData_InitSubstructs(struct SaveArrayHeader *headers) { const struct SaveChunkHeader *sch = UNK_020EE700; - s32 offset = 0; + s32 offset = 0; GF_ASSERT(UNK_020EE6DC == 36); for (int i = 0; i < UNK_020EE6DC; i++) { GF_ASSERT(i == sch[i].id); - headers[i].id = sch[i].id; - headers[i].size = SaveArray_sizeof(i); + headers[i].id = sch[i].id; + headers[i].size = SaveArray_sizeof(i); headers[i].offset = (u32)offset; - headers[i].crc = 0; - headers[i].slot = (u16)sch[i].linkedId; + headers[i].crc = 0; + headers[i].slot = (u16)sch[i].linkedId; offset += headers[i].size; if (i == UNK_020EE6DC - 1 || sch[i].linkedId != sch[i + 1].linkedId) { offset += 20; @@ -577,12 +577,12 @@ void SaveData_InitSubstructs(struct SaveArrayHeader *headers) { } void sub_02023160(struct SaveSlotSpec *spec, struct SaveArrayHeader *headers) { - int i = 0; + int i = 0; int sp4 = 0; u32 r12 = 0; - int j = 0; + int j = 0; for (i = 0; i < 2; i++) { - spec[i].id = (u8)i; + spec[i].id = (u8)i; spec[i].size = 0; while (i == headers[j].slot && j < UNK_020EE6DC) { spec[i].size += headers[j].size; @@ -590,8 +590,8 @@ void sub_02023160(struct SaveSlotSpec *spec, struct SaveArrayHeader *headers) { } spec[i].size += 20; spec[i].firstPage = (u8)sp4; - spec[i].offset = r12; - spec[i].numPages = (u8)((spec[i].size + 0xFFF) / 0x1000); + spec[i].offset = r12; + spec[i].numPages = (u8)((spec[i].size + 0xFFF) / 0x1000); sp4 += spec[i].numPages; r12 += spec[i].size; } @@ -611,11 +611,11 @@ void Save_InitDynamicRegion_Internal(u8 *dynamic_region, struct SaveArrayHeader void CreateChunkFooter(struct SaveData *save, u8 *data, int id, u32 size) { struct SaveArrayFooter *footer = (struct SaveArrayFooter *)(data + size); - footer->magic = 0x20060623; - footer->saveno = save->unk_204A4 + 1; - footer->size = size; - footer->idx = (u16)id; - footer->crc = MATH_CalcCRC16CCITT(&save->crcTable, data, size + 14); + footer->magic = 0x20060623; + footer->saveno = save->unk_204A4 + 1; + footer->size = size; + footer->idx = (u16)id; + footer->crc = MATH_CalcCRC16CCITT(&save->crcTable, data, size + 14); } BOOL ValidateChunk(struct SaveData *save, u8 *data, int id, u32 size) { @@ -681,8 +681,8 @@ u8 *ReadSaveFileFromFlash(struct SaveData *save, HeapID heapId, int idx, int *re spC = ValidateChunk(save, r6, idx, sch->sizeFunc()); sp8 = sub_020232B4(r6, sch->sizeFunc()); FlashLoadChunk((u32)((sch->linkedId + 0x40) << 12), r6, sp10); - r7 = ValidateChunk(save, r6, idx, sch->sizeFunc()); - sp4 = sub_020232B4(r6, sch->sizeFunc()); + r7 = ValidateChunk(save, r6, idx, sch->sizeFunc()); + sp4 = sub_020232B4(r6, sch->sizeFunc()); *ret_p = 1; if (spC == 1 && r7 == 0) { save->unk_204A0 = 0; @@ -708,7 +708,7 @@ u8 *ReadSaveFileFromFlash(struct SaveData *save, HeapID heapId, int idx, int *re FlashLoadChunk((u32)((sch->linkedId + 0x40) << 12), r6, sp10); return r6; } - *ret_p = 2; + *ret_p = 2; save->unk_204A0 = 0; save->unk_204A4 = 0; return r6; diff --git a/arm9/src/save_data_read_error.c b/arm9/src/save_data_read_error.c index bf632e906..188b88a0f 100644 --- a/arm9/src/save_data_read_error.c +++ b/arm9/src/save_data_read_error.c @@ -19,49 +19,49 @@ extern void SetMasterBrightnessNeutral(BOOL set_brightness_on_bottom_screen); extern void sub_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); static const struct WindowTemplate sSaveDataReadErrorWindowTemplate = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 3, - .top = 3, - .width = 26, - .height = 18, - .palette = 1, + .bgId = GF_BG_LYR_MAIN_0, + .left = 3, + .top = 3, + .width = 26, + .height = 18, + .palette = 1, .baseTile = 0x23, }; static const struct GraphicsModes sSaveDataReadErrorGraphicsModes = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D, }; static const struct BgTemplate sSaveDataReadErrorBgTemplate = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x18000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE, + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE, }; static const struct GraphicsBanks sSaveDataReadErrorGraphicsBanks = { - .bg = GX_VRAM_BG_256_AB, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_NONE, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_NONE, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_NONE, + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_NONE, - .texpltt = GX_VRAM_TEXPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE, }; void ShowSaveDataReadError(HeapID heapId) { @@ -102,7 +102,7 @@ void ShowSaveDataReadError(HeapID heapId) { BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27)); struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0005_bin, heapId); - struct String *str = String_New(384, heapId); + struct String *str = String_New(384, heapId); ResetAllTextPrinters(); @@ -163,7 +163,7 @@ void ShowGBACartRemovedError(HeapID heapId) { BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27)); struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0005_bin, heapId); - struct String *str = String_New(384, heapId); + struct String *str = String_New(384, heapId); ResetAllTextPrinters(); diff --git a/arm9/src/save_data_write_error.c b/arm9/src/save_data_write_error.c index 1c5df29ce..b9841ed71 100644 --- a/arm9/src/save_data_write_error.c +++ b/arm9/src/save_data_write_error.c @@ -19,49 +19,49 @@ extern void SetMasterBrightnessNeutral(BOOL set_brightness_on_bottom_screen); extern void sub_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); static const struct WindowTemplate sSaveDataWriteErrorWindowTemplate = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 3, - .top = 3, - .width = 26, - .height = 18, - .palette = 1, + .bgId = GF_BG_LYR_MAIN_0, + .left = 3, + .top = 3, + .width = 26, + .height = 18, + .palette = 1, .baseTile = 0x23, }; static const struct GraphicsModes sSaveDataWriteErrorGraphicsModes = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D, }; static const struct BgTemplate sSaveDataWriteErrorBgTemplate = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x18000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE, + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE, }; static const struct GraphicsBanks sSaveDataWriteErrorGraphicsBanks = { - .bg = GX_VRAM_BG_256_AB, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_NONE, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_NONE, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_NONE, + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_NONE, - .texpltt = GX_VRAM_TEXPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE, }; void ShowSaveDataWriteError(HeapID heapId, u32 err_no) { @@ -110,7 +110,7 @@ void ShowSaveDataWriteError(HeapID heapId, u32 err_no) { BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27)); struct MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0006_bin, heapId); - struct String *str = String_New(384, heapId); + struct String *str = String_New(384, heapId); ResetAllTextPrinters(); diff --git a/arm9/src/save_system_info.c b/arm9/src/save_system_info.c index 5248132e2..a13149809 100644 --- a/arm9/src/save_system_info.c +++ b/arm9/src/save_system_info.c @@ -33,7 +33,7 @@ void Save_SysInfo_InitFromSystem(struct SaveSysInfo *unk) { OS_GetMacAddress(unk->macAddr); OS_GetOwnerInfo(&info); unk->birthMonth = info.birthday.month; - unk->birthDay = info.birthday.day; + unk->birthDay = info.birthday.day; } BOOL Save_SysInfo_MacAddressIsMine(struct SaveSysInfo *unk) { @@ -80,10 +80,10 @@ void sub_02023834(struct SaveSysInfo *unk, u32 val) { void Save_SysInfo_RTC_Init(SysInfo_RTC *sub) { sub->field_00 = 1; GF_RTC_CopyDateTime(&sub->date, &sub->time); - sub->daysSinceNitroEpoch = RTC_ConvertDateToDay(&sub->date); + sub->daysSinceNitroEpoch = RTC_ConvertDateToDay(&sub->date); sub->secondsSinceNitroEpoch = RTC_ConvertDateTimeToSecond(&sub->date, &sub->time); - sub->field_2C = 0; - sub->field_34 = 0; + sub->field_2C = 0; + sub->field_34 = 0; } BOOL sub_02023874(SysInfo_RTC *sub) { diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 9b3db7e3f..9daf08a28 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -440,18 +440,18 @@ BOOL ScrCmd_End(ScriptContext *ctx) // 0002 BOOL ScrCmd_Wait(ScriptContext *ctx) // 0003 { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 num = ScriptReadHalfword(ctx); - u16 wk = ScriptReadHalfword(ctx); - u16 *VarPointer = GetVarPointer(fieldSystem, wk); - *VarPointer = num; - ctx->data[0] = wk; + u16 num = ScriptReadHalfword(ctx); + u16 wk = ScriptReadHalfword(ctx); + u16 *VarPointer = GetVarPointer(fieldSystem, wk); + *VarPointer = num; + ctx->data[0] = wk; SetupNativeScript(ctx, RunPauseTimer); return TRUE; } static BOOL RunPauseTimer(ScriptContext *ctx) { u16 *VarPointer = GetVarPointer(ctx->fieldSystem, (u16)ctx->data[0]); - *VarPointer = (u16)(*VarPointer - 1); + *VarPointer = (u16)(*VarPointer - 1); return !(*VarPointer); } @@ -463,21 +463,21 @@ BOOL ScrCmd_DebugWatch(ScriptContext *ctx) // 01F9 BOOL ScrCmd_LoadByte(ScriptContext *ctx) // 0004 { - u8 index = ScriptReadByte(ctx); + u8 index = ScriptReadByte(ctx); ctx->data[index] = ScriptReadByte(ctx); return FALSE; } BOOL ScrCmd_LoadWord(ScriptContext *ctx) // 0005 { - u8 index = ScriptReadByte(ctx); + u8 index = ScriptReadByte(ctx); ctx->data[index] = ScriptReadWord(ctx); return FALSE; } BOOL ScrCmd_LoadByteFromAddr(ScriptContext *ctx) // 0006 { - u8 index = ScriptReadByte(ctx); + u8 index = ScriptReadByte(ctx); ctx->data[index] = *(u8 *)ScriptReadWord(ctx); return FALSE; } @@ -485,21 +485,21 @@ BOOL ScrCmd_LoadByteFromAddr(ScriptContext *ctx) // 0006 BOOL ScrCmd_WriteByteToAddr(ScriptContext *ctx) // 0007 { u8 *ptr = (u8 *)ScriptReadWord(ctx); - *ptr = ScriptReadByte(ctx); + *ptr = ScriptReadByte(ctx); return FALSE; } BOOL ScrCmd_SetPtrByte(ScriptContext *ctx) // 0008 { u8 *ptr = (u8 *)ScriptReadWord(ctx); - *ptr = (u8)ctx->data[ScriptReadByte(ctx)]; + *ptr = (u8)ctx->data[ScriptReadByte(ctx)]; return FALSE; } BOOL ScrCmd_CopyLocal(ScriptContext *ctx) // 0009 { - u8 index_store = ScriptReadByte(ctx); - u8 index_load = ScriptReadByte(ctx); + u8 index_store = ScriptReadByte(ctx); + u8 index_load = ScriptReadByte(ctx); ctx->data[index_store] = ctx->data[index_load]; return FALSE; } @@ -508,7 +508,7 @@ BOOL ScrCmd_CopyByte(ScriptContext *ctx) // 000A { u8 *target = (u8 *)ScriptReadWord(ctx); u8 *source = (u8 *)ScriptReadWord(ctx); - *target = *source; + *target = *source; return FALSE; } @@ -524,74 +524,74 @@ static u32 Compare(u16 a, u16 b) { BOOL ScrCmd_CompareLocalToLocal(ScriptContext *ctx) // 000B { - u8 a = (u8)ctx->data[ScriptReadByte(ctx)]; - u8 b = (u8)ctx->data[ScriptReadByte(ctx)]; + u8 a = (u8)ctx->data[ScriptReadByte(ctx)]; + u8 b = (u8)ctx->data[ScriptReadByte(ctx)]; ctx->comparisonResult = (u8)Compare(a, b); return FALSE; } BOOL ScrCmd_CompareLocalToValue(ScriptContext *ctx) // 000C { - u8 a = (u8)ctx->data[ScriptReadByte(ctx)]; - u8 b = ScriptReadByte(ctx); + u8 a = (u8)ctx->data[ScriptReadByte(ctx)]; + u8 b = ScriptReadByte(ctx); ctx->comparisonResult = (u8)Compare(a, b); return FALSE; } BOOL ScrCmd_CompareLocalToAddr(ScriptContext *ctx) // 000D { - u8 a = (u8)ctx->data[ScriptReadByte(ctx)]; - u8 b = *(u8 *)ScriptReadWord(ctx); + u8 a = (u8)ctx->data[ScriptReadByte(ctx)]; + u8 b = *(u8 *)ScriptReadWord(ctx); ctx->comparisonResult = (u8)Compare(a, b); return FALSE; } BOOL ScrCmd_CompareAddrToLocal(ScriptContext *ctx) // 000E { - u8 a = *(u8 *)ScriptReadWord(ctx); - u8 b = (u8)ctx->data[ScriptReadByte(ctx)]; + u8 a = *(u8 *)ScriptReadWord(ctx); + u8 b = (u8)ctx->data[ScriptReadByte(ctx)]; ctx->comparisonResult = (u8)Compare(a, b); return FALSE; } BOOL ScrCmd_CompareAddrToValue(ScriptContext *ctx) // 000F { - u8 a = *(u8 *)ScriptReadWord(ctx); - u8 b = (u8)ScriptReadByte(ctx); + u8 a = *(u8 *)ScriptReadWord(ctx); + u8 b = (u8)ScriptReadByte(ctx); ctx->comparisonResult = (u8)Compare(a, b); return FALSE; } BOOL ScrCmd_CompareAddrToAddr(ScriptContext *ctx) // 0010 { - u8 a = *(u8 *)ScriptReadWord(ctx); - u8 b = *(u8 *)ScriptReadWord(ctx); + u8 a = *(u8 *)ScriptReadWord(ctx); + u8 b = *(u8 *)ScriptReadWord(ctx); ctx->comparisonResult = (u8)Compare(a, b); return FALSE; } BOOL ScrCmd_CompareVarToValue(ScriptContext *ctx) // 0011 { - u16 a = *ScriptGetVarPointer(ctx); - u16 b = ScriptReadHalfword(ctx); + u16 a = *ScriptGetVarPointer(ctx); + u16 b = ScriptReadHalfword(ctx); ctx->comparisonResult = (u8)Compare(a, b); return FALSE; } BOOL ScrCmd_CompareVarToVar(ScriptContext *ctx) // 0012 { - u16 *a = ScriptGetVarPointer(ctx); - u16 *b = ScriptGetVarPointer(ctx); + u16 *a = ScriptGetVarPointer(ctx); + u16 *b = ScriptGetVarPointer(ctx); ctx->comparisonResult = (u8)Compare(*a, *b); return FALSE; } BOOL ScrCmd_RunScript(ScriptContext *ctx) // 0013 { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; u8 *activeScriptContextsNumber = (u8 *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_ACTIVE_SCRIPTCONTEXT_COUNT); ScriptContext **scriptContext1 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SCRIPT_CONTEXT_1); - u16 id = ScriptReadHalfword(ctx); + u16 id = ScriptReadHalfword(ctx); *scriptContext1 = CreateScriptContext(fieldSystem, id); (*activeScriptContextsNumber)++; @@ -600,13 +600,13 @@ BOOL ScrCmd_RunScript(ScriptContext *ctx) // 0013 BOOL ScrCmd_RunScriptWait(ScriptContext *ctx) // 0014 { - FieldSystem *fieldSystem = ctx->fieldSystem; - u8 *unk1 = (u8 *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_05); + FieldSystem *fieldSystem = ctx->fieldSystem; + u8 *unk1 = (u8 *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_05); u8 *activeScriptContextsNumber = (u8 *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_ACTIVE_SCRIPTCONTEXT_COUNT); ScriptContext **scriptContext1 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SCRIPT_CONTEXT_1); - u16 id = ScriptReadHalfword(ctx); - *unk1 = 1; + u16 id = ScriptReadHalfword(ctx); + *unk1 = 1; *scriptContext1 = CreateScriptContext(fieldSystem, id); (*activeScriptContextsNumber)++; @@ -641,8 +641,8 @@ BOOL ScrCmd_GoTo(ScriptContext *ctx) // 0016 BOOL ScrCmd_ObjectGoTo(ScriptContext *ctx) // 0017 { LocalMapObject **lastInteracted = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u8 id = ScriptReadByte(ctx); - s32 offset = (s32)ScriptReadWord(ctx); + u8 id = ScriptReadByte(ctx); + s32 offset = (s32)ScriptReadWord(ctx); if (MapObject_GetID(*lastInteracted) == id) { ScriptJump(ctx, ctx->scriptPtr + offset); } @@ -651,8 +651,8 @@ BOOL ScrCmd_ObjectGoTo(ScriptContext *ctx) // 0017 BOOL ScrCmd_BgGoTo(ScriptContext *ctx) // 0018 { - u32 bgId = sub_02046534(ctx->taskManager); - u8 id = ScriptReadByte(ctx); + u32 bgId = sub_02046534(ctx->taskManager); + u8 id = ScriptReadByte(ctx); s32 offset = (s32)ScriptReadWord(ctx); if (bgId == id) { @@ -664,8 +664,8 @@ BOOL ScrCmd_BgGoTo(ScriptContext *ctx) // 0018 BOOL ScrCmd_DirectionGoTo(ScriptContext *ctx) // 0019 { u32 *playerDirection = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_FACING_DIRECTION); - u8 dir = ScriptReadByte(ctx); - s32 offset = (s32)ScriptReadWord(ctx); + u8 dir = ScriptReadByte(ctx); + s32 offset = (s32)ScriptReadWord(ctx); if (*playerDirection == dir) { ScriptJump(ctx, ctx->scriptPtr + offset); @@ -689,7 +689,7 @@ BOOL ScrCmd_Return(ScriptContext *ctx) // 001B BOOL ScrCmd_GoToIf(ScriptContext *ctx) // 001C { u8 compareType = ScriptReadByte(ctx); - s32 offset = (s32)ScriptReadWord(ctx); + s32 offset = (s32)ScriptReadWord(ctx); if (sScriptConditionTable[compareType][ctx->comparisonResult] == TRUE) { ScriptJump(ctx, ctx->scriptPtr + offset); @@ -700,7 +700,7 @@ BOOL ScrCmd_GoToIf(ScriptContext *ctx) // 001C BOOL ScrCmd_CallIf(ScriptContext *ctx) // 001D { u8 compareType = ScriptReadByte(ctx); - s32 offset = (s32)ScriptReadWord(ctx); + s32 offset = (s32)ScriptReadWord(ctx); if (sScriptConditionTable[compareType][ctx->comparisonResult] == TRUE) { ScriptCall(ctx, ctx->scriptPtr + offset); @@ -711,7 +711,7 @@ BOOL ScrCmd_CallIf(ScriptContext *ctx) // 001D BOOL ScrCmd_SetFlag(ScriptContext *ctx) // 001E { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 flag = ScriptReadHalfword(ctx); + u16 flag = ScriptReadHalfword(ctx); FieldSystem_FlagSet(fieldSystem, flag); return FALSE; } @@ -719,7 +719,7 @@ BOOL ScrCmd_SetFlag(ScriptContext *ctx) // 001E BOOL ScrCmd_ClearFlag(ScriptContext *ctx) // 001F { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 flag = ScriptReadHalfword(ctx); + u16 flag = ScriptReadHalfword(ctx); FlagClear(fieldSystem, flag); return FALSE; } @@ -727,24 +727,24 @@ BOOL ScrCmd_ClearFlag(ScriptContext *ctx) // 001F BOOL ScrCmd_CheckFlag(ScriptContext *ctx) // 0020 { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 flag = ScriptReadHalfword(ctx); - ctx->comparisonResult = FieldSystem_FlagCheck(fieldSystem, flag); + u16 flag = ScriptReadHalfword(ctx); + ctx->comparisonResult = FieldSystem_FlagCheck(fieldSystem, flag); return FALSE; } BOOL ScrCmd_CheckFlagVar(ScriptContext *ctx) // 0021 { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *wk1 = ScriptGetVarPointer(ctx); - u16 *wk2 = ScriptGetVarPointer(ctx); - *wk2 = FieldSystem_FlagCheck(fieldSystem, *wk1); + u16 *wk1 = ScriptGetVarPointer(ctx); + u16 *wk2 = ScriptGetVarPointer(ctx); + *wk2 = FieldSystem_FlagCheck(fieldSystem, *wk1); return FALSE; } BOOL ScrCmd_SetFlagVar(ScriptContext *ctx) // 0022 { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *wk = ScriptGetVarPointer(ctx); + u16 *wk = ScriptGetVarPointer(ctx); FieldSystem_FlagSet(fieldSystem, *wk); return FALSE; } @@ -752,7 +752,7 @@ BOOL ScrCmd_SetFlagVar(ScriptContext *ctx) // 0022 BOOL ScrCmd_SetTrainerFlag(ScriptContext *ctx) // 0023 { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 flag = ScriptGetVar(ctx); + u16 flag = ScriptGetVar(ctx); TrainerFieldSystem_FlagSet(fieldSystem, flag); return FALSE; } @@ -760,7 +760,7 @@ BOOL ScrCmd_SetTrainerFlag(ScriptContext *ctx) // 0023 BOOL ScrCmd_ClearTrainerFlag(ScriptContext *ctx) // 0024 { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 flag = ScriptGetVar(ctx); + u16 flag = ScriptGetVar(ctx); TrainerFlagClear(fieldSystem, flag); return FALSE; } @@ -768,31 +768,31 @@ BOOL ScrCmd_ClearTrainerFlag(ScriptContext *ctx) // 0024 BOOL ScrCmd_CheckTrainerFlag(ScriptContext *ctx) // 0025 { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 flag = ScriptGetVar(ctx); - ctx->comparisonResult = TrainerFieldSystem_FlagCheck(fieldSystem, flag); + u16 flag = ScriptGetVar(ctx); + ctx->comparisonResult = TrainerFieldSystem_FlagCheck(fieldSystem, flag); return FALSE; } BOOL ScrCmd_AddVar(ScriptContext *ctx) // 0026 { u16 *wk1 = ScriptGetVarPointer(ctx); - u16 wk2 = ScriptGetVar(ctx); - *wk1 = (u16)(*wk1 + wk2); + u16 wk2 = ScriptGetVar(ctx); + *wk1 = (u16)(*wk1 + wk2); return FALSE; } BOOL ScrCmd_SubVar(ScriptContext *ctx) // 0027 { u16 *wk1 = ScriptGetVarPointer(ctx); - u16 wk2 = ScriptGetVar(ctx); - *wk1 = (u16)(*wk1 - wk2); + u16 wk2 = ScriptGetVar(ctx); + *wk1 = (u16)(*wk1 - wk2); return FALSE; } BOOL ScrCmd_SetVar(ScriptContext *ctx) // 0028 { u16 *wk = ScriptGetVarPointer(ctx); - *wk = ScriptReadHalfword(ctx); + *wk = ScriptReadHalfword(ctx); return FALSE; } @@ -800,15 +800,15 @@ BOOL ScrCmd_CopyVar(ScriptContext *ctx) // 0029 { u16 *wk1 = ScriptGetVarPointer(ctx); u16 *wk2 = ScriptGetVarPointer(ctx); - *wk1 = *wk2; + *wk1 = *wk2; return FALSE; } BOOL ScrCmd_SetOrCopyVar(ScriptContext *ctx) // 002A - todo: better name { u16 *wk1 = ScriptGetVarPointer(ctx); - u16 wk2 = ScriptGetVar(ctx); - *wk1 = wk2; + u16 wk2 = ScriptGetVar(ctx); + *wk1 = wk2; return FALSE; } @@ -821,8 +821,8 @@ BOOL ScrCmd_Message(ScriptContext *ctx) // 002B - todo: MessageAll? BOOL ScrCmd_MessageFrom(ScriptContext *ctx) // 01FA - todo: MessageAllFromNarc? { - u16 arc = ScriptGetVar(ctx); - u16 msg = ScriptGetVar(ctx); + u16 arc = ScriptGetVar(ctx); + u16 msg = ScriptGetVar(ctx); MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, arc, HEAP_ID_32); ov05_ShowMessageInField(ctx, msgData, msg); DestroyMsgData(msgData); @@ -831,8 +831,8 @@ BOOL ScrCmd_MessageFrom(ScriptContext *ctx) // 01FA - todo: MessageAllFromNarc? BOOL ScrCmd_MessageFrom2(ScriptContext *ctx) // 01FB - todo: MessageFromNarc? { - u16 arc = ScriptGetVar(ctx); - u16 msg = ScriptGetVar(ctx); + u16 arc = ScriptGetVar(ctx); + u16 msg = ScriptGetVar(ctx); MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, arc, HEAP_ID_32); ov05_021E2BD0(ctx, msgData, msg, 1, NULL); DestroyMsgData(msgData); @@ -842,8 +842,8 @@ BOOL ScrCmd_MessageFrom2(ScriptContext *ctx) // 01FB - todo: MessageFromNarc? BOOL ScrCmd_Unk01FC(ScriptContext *ctx) // 01FC { - u16 typ = ScriptReadHalfword(ctx); - u16 id = ScriptReadHalfword(ctx); + u16 typ = ScriptReadHalfword(ctx); + u16 id = ScriptReadHalfword(ctx); u16 word1 = ScriptReadHalfword(ctx); s16 word2 = (s16)ScriptReadHalfword(ctx); @@ -853,8 +853,8 @@ BOOL ScrCmd_Unk01FC(ScriptContext *ctx) // 01FC BOOL ScrCmd_Unk01FD(ScriptContext *ctx) // 01FD { - u16 typ = ScriptReadHalfword(ctx); - u16 id = ScriptReadHalfword(ctx); + u16 typ = ScriptReadHalfword(ctx); + u16 id = ScriptReadHalfword(ctx); u16 word1 = ScriptReadHalfword(ctx); s16 word2 = (s16)ScriptReadHalfword(ctx); @@ -886,11 +886,11 @@ BOOL ScrCmd_Unk01FE(ScriptContext *ctx) // 01FE BOOL ScrCmd_Unk01FF(ScriptContext *ctx) // 01FF { FieldSystem *fieldSystem = ctx->fieldSystem; - u8 msg = ScriptReadByte(ctx); - u16 poke = ScriptGetVar(ctx); - u16 sex = ScriptReadHalfword(ctx); - u8 flag = ScriptReadByte(ctx); - u8 unk = 0; + u8 msg = ScriptReadByte(ctx); + u16 poke = ScriptGetVar(ctx); + u16 sex = ScriptReadHalfword(ctx); + u8 flag = ScriptReadByte(ctx); + u8 unk = 0; MessageFormat *messageFormat = ov06_02244210(fieldSystem->saveData, poke, sex, flag, &unk); ov05_021E2CBC(ctx, messageFormat, (u8)(msg + unk), 1); @@ -960,7 +960,7 @@ BOOL ScrCmd_Unk002E(ScriptContext *ctx) // 002E - todo: MessageWait? MessageNoSk BOOL ScrCmd_Unk020C(ScriptContext *ctx) // 020C { LocalMapObject **lastInteracted = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u8 msg = (u8)MapObject_GetType(*lastInteracted); + u8 msg = (u8)MapObject_GetType(*lastInteracted); ov05_021E2BD0(ctx, ctx->msgData, msg, 1, NULL); SetupNativeScript(ctx, sub_0203A2F0); return TRUE; @@ -1061,7 +1061,7 @@ static BOOL sub_0203A570(ScriptContext *ctx) { BOOL ScrCmd_Unk0033(ScriptContext *ctx) // 0033 - todo: OpenMessageBox? { FieldSystem *fieldSystem = ctx->fieldSystem; - u8 *unk = (u8 *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); + u8 *unk = (u8 *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); sub_020545B8(fieldSystem->bgConfig, (Window *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW), 3); sub_02054608((Window *)FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW), Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData)); *unk = 1; @@ -1071,8 +1071,8 @@ BOOL ScrCmd_Unk0033(ScriptContext *ctx) // 0033 - todo: OpenMessageBox? BOOL ScrCmd_CloseMessageBox(ScriptContext *ctx) // 0034 { FieldSystem *fieldSystem = ctx->fieldSystem; - Window *window = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW); - u8 *unk2 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); + Window *window = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW); + u8 *unk2 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); ClearFrameAndWindow2(window, FALSE); RemoveWindow(window); *unk2 = 0; @@ -1082,8 +1082,8 @@ BOOL ScrCmd_CloseMessageBox(ScriptContext *ctx) // 0034 BOOL ScrCmd_Unk0035(ScriptContext *ctx) // 0035 - todo: FreezeMessageBox? { FieldSystem *fieldSystem = ctx->fieldSystem; - Window *window = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW); - u8 *unk2 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); + Window *window = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW); + u8 *unk2 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); RemoveWindow(window); *unk2 = 0; return FALSE; @@ -1092,12 +1092,12 @@ BOOL ScrCmd_Unk0035(ScriptContext *ctx) // 0035 - todo: FreezeMessageBox? BOOL ScrCmd_ScrollBg(ScriptContext *ctx) // 003C { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *xval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8008); - u16 *xcnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8004); - u16 *xdir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8009); - u16 *yval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800A); - u16 *ycnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8005); - u16 *ydir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800B); + u16 *xval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8008); + u16 *xcnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8004); + u16 *xdir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8009); + u16 *yval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800A); + u16 *ycnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8005); + u16 *ydir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800B); *xval = ScriptReadByte(ctx); *xcnt = ScriptReadByte(ctx); @@ -1112,12 +1112,12 @@ BOOL ScrCmd_ScrollBg(ScriptContext *ctx) // 003C static BOOL sub_0203A6C8(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *xval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8008); - u16 *xdir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8009); - u16 *yval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800A); - u16 *ydir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800B); - u16 *xcnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8004); - u16 *ycnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8005); + u16 *xval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8008); + u16 *xdir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8009); + u16 *yval = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800A); + u16 *ydir = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_800B); + u16 *xcnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8004); + u16 *ycnt = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SPECIAL_VAR_8005); if (*xcnt == 0 && *ycnt == 0) { return TRUE; @@ -1152,9 +1152,9 @@ static BOOL sub_0203A6C8(ScriptContext *ctx) { BOOL ScrCmd_CreateMessageBox(ScriptContext *ctx) // 003C { - FieldSystem *fieldSystem = ctx->fieldSystem; - String **stringBuffer1 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_1); - String **stringBuffer0 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_0); + FieldSystem *fieldSystem = ctx->fieldSystem; + String **stringBuffer1 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_1); + String **stringBuffer0 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_0); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); u8 typ, msg; u16 wk, map; @@ -1162,11 +1162,11 @@ BOOL ScrCmd_CreateMessageBox(ScriptContext *ctx) // 003C msg = ScriptReadByte(ctx); typ = ScriptReadByte(ctx); map = ScriptReadHalfword(ctx); - wk = ScriptReadHalfword(ctx); + wk = ScriptReadHalfword(ctx); if (map == 0) { LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); - map = (u16)MapObject_GetParam(*lastInteracted, 0); + map = (u16)MapObject_GetParam(*lastInteracted, 0); } ov05_021E8128(fieldSystem->unk60, typ, map); @@ -1182,8 +1182,8 @@ BOOL ScrCmd_CreateMessageBox(ScriptContext *ctx) // 003C BOOL ScrCmd_Unk0037(ScriptContext *ctx) // 0037 - todo: SetTextBoard? ColourMessageBox? { FieldSystem *fieldSystem = ctx->fieldSystem; - u8 typ = ScriptReadByte(ctx); - u16 map = ScriptReadHalfword(ctx); + u8 typ = ScriptReadByte(ctx); + u16 map = ScriptReadHalfword(ctx); ov05_021E8128(fieldSystem->unk60, typ, map); ov05_021E8130(fieldSystem->unk60, 1); @@ -1193,7 +1193,7 @@ BOOL ScrCmd_Unk0037(ScriptContext *ctx) // 0037 - todo: SetTextBoard? ColourMess BOOL ScrCmd_Unk0038(ScriptContext *ctx) { // 0038 - todo: ShowMessageBox? FieldSystem *fieldSystem = ctx->fieldSystem; - u8 req = ScriptReadByte(ctx); + u8 req = ScriptReadByte(ctx); ov05_021E8130(fieldSystem->unk60, req); return TRUE; } @@ -1216,10 +1216,10 @@ static BOOL sub_0203A8A0(ScriptContext *ctx) { } BOOL ScrCmd_Unk003A(ScriptContext *ctx) { // 003A - todo: CreateMessageBoxText? - FieldSystem *fieldSystem = ctx->fieldSystem; - u8 *printerNumber = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_TEXT_PRINTER_NUMBER); - String **stringBuffer1 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_1); - String **stringBuffer0 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_0); + FieldSystem *fieldSystem = ctx->fieldSystem; + u8 *printerNumber = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_TEXT_PRINTER_NUMBER); + String **stringBuffer1 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_1); + String **stringBuffer0 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_0); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); u8 msg = ScriptReadByte(ctx); @@ -1229,15 +1229,15 @@ BOOL ScrCmd_Unk003A(ScriptContext *ctx) { // 003A - todo: CreateMessageBoxText? StringExpandPlaceholders(*messageFormat, *stringBuffer0, *stringBuffer1); *printerNumber = (u8)sub_02054658(ov05_021E8140(fieldSystem->unk60), *stringBuffer0, Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData), 1); - ctx->data[0] = wk; + ctx->data[0] = wk; SetupNativeScript(ctx, sub_0203A94C); return TRUE; } static BOOL sub_0203A94C(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - u8 *printerNumber = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_TEXT_PRINTER_NUMBER); - u16 *varPtr = GetVarPointer(fieldSystem, (u16)ctx->data[0]); + u8 *printerNumber = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_TEXT_PRINTER_NUMBER); + u16 *varPtr = GetVarPointer(fieldSystem, (u16)ctx->data[0]); ov05_021E8144(fieldSystem->unk60); u32 tmp = 0xFFFF; @@ -1316,10 +1316,10 @@ BOOL ScrCmd_Menu(ScriptContext *ctx) { // 003C BOOL ScrCmd_YesNoMenu(ScriptContext *ctx) { // 003E FieldSystem *fieldSystem = ctx->fieldSystem; - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LIST_MENU_2D); - u16 wk = ScriptReadHalfword(ctx); + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LIST_MENU_2D); + u16 wk = ScriptReadHalfword(ctx); LoadUserFrameGfx1(fieldSystem->bgConfig, GF_BG_LYR_MAIN_3, 985, 11, 0, HEAP_ID_4); - *unk = Std_CreateYesNoMenu(fieldSystem->bgConfig, &UNK_020F34E0, 985, 11, 4); + *unk = Std_CreateYesNoMenu(fieldSystem->bgConfig, &UNK_020F34E0, 985, 11, 4); ctx->data[0] = wk; SetupNativeScript(ctx, sub_0203AB00); return TRUE; @@ -1327,9 +1327,9 @@ BOOL ScrCmd_YesNoMenu(ScriptContext *ctx) { // 003E static BOOL sub_0203AB00(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LIST_MENU_2D); - u16 *ptr = GetVarPointer(fieldSystem, (u16)ctx->data[0]); - u32 unk2 = sub_020021AC(*unk, 4); + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LIST_MENU_2D); + u16 *ptr = GetVarPointer(fieldSystem, (u16)ctx->data[0]); + u32 unk2 = sub_020021AC(*unk, 4); if (unk2 == -1) { return FALSE; @@ -1344,9 +1344,9 @@ static BOOL sub_0203AB00(ScriptContext *ctx) { } BOOL ScrCmd_ShowWaitingIcon(ScriptContext *ctx) { // 018D - Window *window = (Window *)FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); + Window *window = (Window *)FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); WaitingIcon **waitingIcon = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WAITING_ICON); - *waitingIcon = WaitingIcon_New(window, 994); + *waitingIcon = WaitingIcon_New(window, 994); return FALSE; } @@ -1357,50 +1357,50 @@ BOOL ScrCmd_HideWaitingIcon(ScriptContext *ctx) { // 018E } BOOL ScrCmd_Unk0040(ScriptContext *ctx) { // 0040 - FieldSystem *fieldSystem = ctx->fieldSystem; - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); + FieldSystem *fieldSystem = ctx->fieldSystem; + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 unk3 = ScriptReadByte(ctx); - u8 unk4 = ScriptReadByte(ctx); - u8 unk5 = ScriptReadByte(ctx); - u8 unk6 = ScriptReadByte(ctx); - u16 unk7 = ScriptReadHalfword(ctx); - u16 *ptr = GetVarPointer(fieldSystem, unk7); - Window *window = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); - *unk = ov05_021E1BF8(fieldSystem, unk3, unk4, unk5, unk6, ptr, *messageFormat, window, NULL); - ctx->data[0] = unk7; + u8 unk3 = ScriptReadByte(ctx); + u8 unk4 = ScriptReadByte(ctx); + u8 unk5 = ScriptReadByte(ctx); + u8 unk6 = ScriptReadByte(ctx); + u16 unk7 = ScriptReadHalfword(ctx); + u16 *ptr = GetVarPointer(fieldSystem, unk7); + Window *window = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); + *unk = ov05_021E1BF8(fieldSystem, unk3, unk4, unk5, unk6, ptr, *messageFormat, window, NULL); + ctx->data[0] = unk7; return TRUE; } BOOL ScrCmd_Unk0041(ScriptContext *ctx) { // 0041 - FieldSystem *fieldSystem = ctx->fieldSystem; - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); + FieldSystem *fieldSystem = ctx->fieldSystem; + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 unk3 = ScriptReadByte(ctx); - u8 unk4 = ScriptReadByte(ctx); - u8 unk5 = ScriptReadByte(ctx); - u8 unk6 = ScriptReadByte(ctx); - u16 unk7 = ScriptReadHalfword(ctx); - u16 *ptr = GetVarPointer(fieldSystem, unk7); - Window *window = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); - *unk = ov05_021E1BF8(fieldSystem, unk3, unk4, unk5, unk6, ptr, *messageFormat, window, ctx->msgData); - ctx->data[0] = unk7; + u8 unk3 = ScriptReadByte(ctx); + u8 unk4 = ScriptReadByte(ctx); + u8 unk5 = ScriptReadByte(ctx); + u8 unk6 = ScriptReadByte(ctx); + u16 unk7 = ScriptReadHalfword(ctx); + u16 *ptr = GetVarPointer(fieldSystem, unk7); + Window *window = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); + *unk = ov05_021E1BF8(fieldSystem, unk3, unk4, unk5, unk6, ptr, *messageFormat, window, ctx->msgData); + ctx->data[0] = unk7; return TRUE; } BOOL ScrCmd_Unk0042(ScriptContext *ctx) { // 0042 u32 *unk = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MENU_WINDOW); - u8 unk2 = ScriptReadByte(ctx); - u8 unk3 = ScriptReadByte(ctx); + u8 unk2 = ScriptReadByte(ctx); + u8 unk3 = ScriptReadByte(ctx); ov05_021E1C4C(*unk, unk2, unk3); return FALSE; } BOOL ScrCmd_Unk029D(ScriptContext *ctx) { // 029D FieldSystem *fieldSystem = ctx->fieldSystem; - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); - u16 unk2 = ScriptGetVar(ctx); - u16 unk3 = ScriptGetVar(ctx); + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); + u16 unk2 = ScriptGetVar(ctx); + u16 unk3 = ScriptGetVar(ctx); ov05_021E1C4C(*unk, unk2, unk3); return FALSE; } @@ -1430,8 +1430,8 @@ BOOL ScrCmd_Unk02B9(ScriptContext *ctx) { // 02B9 static BOOL sub_0203AD78(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *varPtr = GetVarPointer(fieldSystem, (u16)ctx->data[0]); - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); + u16 *varPtr = GetVarPointer(fieldSystem, (u16)ctx->data[0]); + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); if (*varPtr == 0xEEEE) { if (sub_02052714(fieldSystem->unk78)) { @@ -1447,36 +1447,36 @@ static BOOL sub_0203AD78(ScriptContext *ctx) { } BOOL ScrCmd_Unk0044(ScriptContext *ctx) { // 0044 - FieldSystem *fieldSystem = ctx->fieldSystem; - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); + FieldSystem *fieldSystem = ctx->fieldSystem; + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 unk3 = ScriptReadByte(ctx); - u8 unk4 = ScriptReadByte(ctx); - u8 unk5 = ScriptReadByte(ctx); - u8 unk6 = ScriptReadByte(ctx); + u8 unk3 = ScriptReadByte(ctx); + u8 unk4 = ScriptReadByte(ctx); + u8 unk5 = ScriptReadByte(ctx); + u8 unk6 = ScriptReadByte(ctx); - u16 halfWord = ScriptReadHalfword(ctx); - u16 *varPtr = GetVarPointer(fieldSystem, halfWord); + u16 halfWord = ScriptReadHalfword(ctx); + u16 *varPtr = GetVarPointer(fieldSystem, halfWord); Window *window = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); - *unk = ov05_021E1F34(fieldSystem, unk3, unk4, unk5, unk6, varPtr, *messageFormat, window, NULL); - ctx->data[0] = halfWord; + *unk = ov05_021E1F34(fieldSystem, unk3, unk4, unk5, unk6, varPtr, *messageFormat, window, NULL); + ctx->data[0] = halfWord; return TRUE; } BOOL ScrCmd_Unk0045(ScriptContext *ctx) { // 0045 - FieldSystem *fieldSystem = ctx->fieldSystem; - u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); + FieldSystem *fieldSystem = ctx->fieldSystem; + u32 *unk = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MENU_WINDOW); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 unk3 = ScriptReadByte(ctx); - u8 unk4 = ScriptReadByte(ctx); - u8 unk5 = ScriptReadByte(ctx); - u8 unk6 = ScriptReadByte(ctx); + u8 unk3 = ScriptReadByte(ctx); + u8 unk4 = ScriptReadByte(ctx); + u8 unk5 = ScriptReadByte(ctx); + u8 unk6 = ScriptReadByte(ctx); - u16 halfWord = ScriptReadHalfword(ctx); - u16 *varPtr = GetVarPointer(fieldSystem, halfWord); + u16 halfWord = ScriptReadHalfword(ctx); + u16 *varPtr = GetVarPointer(fieldSystem, halfWord); Window *window = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_WINDOW); - *unk = ov05_021E1F34(fieldSystem, unk3, unk4, unk5, unk6, varPtr, *messageFormat, window, ctx->msgData); - ctx->data[0] = halfWord; + *unk = ov05_021E1F34(fieldSystem, unk3, unk4, unk5, unk6, varPtr, *messageFormat, window, ctx->msgData); + ctx->data[0] = halfWord; return TRUE; } @@ -1516,13 +1516,13 @@ BOOL ScrCmd_Unk02D0(ScriptContext *ctx) { // 02D0 } BOOL ScrCmd_Unk005E(ScriptContext *ctx) { // 005E - todo: ApplyMovement? - u16 unk = ScriptGetVar(ctx); + u16 unk = ScriptGetVar(ctx); u32 unk2 = ScriptReadWord(ctx); LocalMapObject *event = sub_0203B120(ctx->fieldSystem, unk); GF_ASSERT(event); - u32 unk4 = sub_0205AEA4(event, ctx->scriptPtr + unk2); + u32 unk4 = sub_0205AEA4(event, ctx->scriptPtr + unk2); u8 *movementCounter = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_ACTIVE_MOVEMENT_COUNTER); (*movementCounter)++; @@ -1541,8 +1541,8 @@ BOOL ScrCmd_Unk02A1(ScriptContext *ctx) { // 02A1 GF_ASSERT(event); u16 *unk4 = AllocFromHeap(HEAP_ID_4, 0x100); - u16 xVal = (u16)MapObject_GetCurrentX(event); - u16 zVal = (u16)MapObject_GetCurrentZ(event); + u16 xVal = (u16)MapObject_GetCurrentX(event); + u16 zVal = (u16)MapObject_GetCurrentZ(event); u32 pos = 0; @@ -1557,19 +1557,19 @@ BOOL ScrCmd_Unk02A1(ScriptContext *ctx) { // 02A1 } if (zVal < unk2) { - unk4[pos * 2] = 12; + unk4[pos * 2] = 12; unk4[pos * 2 + 1] = (u16)(unk2 - zVal); pos++; } else if (zVal > unk2) { - unk4[pos * 2] = 13; + unk4[pos * 2] = 13; unk4[pos * 2 + 1] = (u16)(zVal - unk2); pos++; } - unk4[pos * 2] = 254; + unk4[pos * 2] = 254; unk4[pos * 2 + 1] = 0; - u32 unk7 = sub_0205AEA4(event, unk4); + u32 unk7 = sub_0205AEA4(event, unk4); u8 *movementCounter = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_ACTIVE_MOVEMENT_COUNTER); (*movementCounter)++; @@ -1606,9 +1606,9 @@ static void sub_0203B174(FieldSystem *fieldSystem, u32 param1, void *param2) { return; } unkStruct->fieldSystem = fieldSystem; - unkStruct->Unk04 = param1; - unkStruct->Unk08 = param2; - unkStruct->sysTask = SysTask_CreateOnMainQueue((SysTaskFunc)sub_0203B1A8, unkStruct, 0); + unkStruct->Unk04 = param1; + unkStruct->Unk08 = param2; + unkStruct->sysTask = SysTask_CreateOnMainQueue((SysTaskFunc)sub_0203B1A8, unkStruct, 0); } void sub_0203B1A8(SysTask *task, UnkStruct_0203B174 *param1) { @@ -1636,7 +1636,7 @@ void sub_0203B1A8(SysTask *task, UnkStruct_0203B174 *param1) { } BOOL ScrCmd_LockAllEvents(ScriptContext *ctx) { // 0060 - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); if (*lastInteracted == NULL) { @@ -1648,9 +1648,9 @@ BOOL ScrCmd_LockAllEvents(ScriptContext *ctx) { // 0060 } static BOOL sub_0203B218(ScriptContext *ctx) { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); - LocalMapObject *playerAvatar = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar); + LocalMapObject *playerAvatar = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar); if (UNK_021C5A0C[0] & 1) { if (sub_0205AE28(playerAvatar) == 1) { MapObject_PauseMovement(playerAvatar); @@ -1685,13 +1685,13 @@ static BOOL sub_0203B218(ScriptContext *ctx) { } BOOL ScrCmd_LockAllEvents2(ScriptContext *ctx) { // 02B4 - FieldSystem *fieldSystem = ctx->fieldSystem; - LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); - LocalMapObject *playerAvatar = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar); - LocalMapObject *unk1 = MapObjectManager_GetFirstActiveObjectWithMovement(fieldSystem->mapObjectManager, 48); - LocalMapObject *unk2 = sub_0205E7C4(*lastInteracted); + FieldSystem *fieldSystem = ctx->fieldSystem; + LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); + LocalMapObject *playerAvatar = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar); + LocalMapObject *unk1 = MapObjectManager_GetFirstActiveObjectWithMovement(fieldSystem->mapObjectManager, 48); + LocalMapObject *unk2 = sub_0205E7C4(*lastInteracted); MapObjectManager *mapObjectManager = fieldSystem->mapObjectManager; - UNK_021C5A0C[0] = 0; + UNK_021C5A0C[0] = 0; MapObjectManager_PauseAllMovement(mapObjectManager); if (sub_0205AE28(playerAvatar) == 0) { @@ -1728,24 +1728,24 @@ BOOL ScrCmd_ReleaseAllEvents(ScriptContext *ctx) { // 0061 BOOL ScrCmd_LockEvent(ScriptContext *ctx) { // 0062 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 eventId = ScriptReadHalfword(ctx); + u16 eventId = ScriptReadHalfword(ctx); MapObject_PauseMovement(MapObjectManager_GetFirstActiveObjectByID(fieldSystem->mapObjectManager, eventId)); return FALSE; } BOOL ScrCmd_ReleaseEvent(ScriptContext *ctx) { // 0063 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 eventId = ScriptReadHalfword(ctx); + u16 eventId = ScriptReadHalfword(ctx); MapObject_UnpauseMovement(MapObjectManager_GetFirstActiveObjectByID(fieldSystem->mapObjectManager, eventId)); return FALSE; } BOOL ScrCmd_AddEvent(ScriptContext *ctx) { // 0064 - FieldSystem *fieldSystem = ctx->fieldSystem; - u16 eventId = ScriptGetVar(ctx); - u32 eventCount = sub_02034B64(fieldSystem); + FieldSystem *fieldSystem = ctx->fieldSystem; + u16 eventId = ScriptGetVar(ctx); + u32 eventCount = sub_02034B64(fieldSystem); const ObjectEvent *objectEvents = sub_02034B6C(fieldSystem); - LocalMapObject *object = MapObject_CreateFromObjectEventWithId(fieldSystem->mapObjectManager, eventId, eventCount, fieldSystem->location->mapId, objectEvents); + LocalMapObject *object = MapObject_CreateFromObjectEventWithId(fieldSystem->mapObjectManager, eventId, eventCount, fieldSystem->location->mapId, objectEvents); GF_ASSERT(object); return FALSE; @@ -1753,16 +1753,16 @@ BOOL ScrCmd_AddEvent(ScriptContext *ctx) { // 0064 BOOL ScrCmd_RemoveEvent(ScriptContext *ctx) { // 0065 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 eventId = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); MapObject_Delete(MapObjectManager_GetFirstActiveObjectByID(fieldSystem->mapObjectManager, eventId)); return FALSE; } BOOL ScrCmd_LockCamera(ScriptContext *ctx) { // 0066 - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); LocalMapObject **targetPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_CAMERA_TARGET); - *targetPtr = MapObject_Create(ctx->fieldSystem->mapObjectManager, x, y, 0, 0x2000, 0, ctx->fieldSystem->location->mapId); + *targetPtr = MapObject_Create(ctx->fieldSystem->mapObjectManager, x, y, 0, 0x2000, 0, ctx->fieldSystem->location->mapId); sub_02059D1C(*targetPtr); MapObject_SetVisible(*targetPtr, TRUE); MapObject_ClearFlag18(*targetPtr, FALSE); @@ -1782,8 +1782,8 @@ BOOL ScrCmd_ReleaseCamera(ScriptContext *ctx) { // 0067 } BOOL ScrCmd_FacePlayer(ScriptContext *ctx) { // 0068 - FieldSystem *fieldSystem = ctx->fieldSystem; - u32 unk0 = sub_02059E74(PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar)); + FieldSystem *fieldSystem = ctx->fieldSystem; + u32 unk0 = sub_02059E74(PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar)); LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); if (*lastInteracted == NULL) { @@ -1808,8 +1808,8 @@ BOOL ScrCmd_GetPlayerPosition(ScriptContext *ctx) { // 0069 BOOL ScrCmd_GetEventPosition(ScriptContext *ctx) { // 006A FieldSystem *fieldSystem = ctx->fieldSystem; - u16 eventId = ScriptGetVar(ctx); - LocalMapObject *event = MapObjectManager_GetFirstActiveObjectByID(fieldSystem->mapObjectManager, eventId); + u16 eventId = ScriptGetVar(ctx); + LocalMapObject *event = MapObjectManager_GetFirstActiveObjectByID(fieldSystem->mapObjectManager, eventId); u16 *x = ScriptGetVarPointer(ctx); u16 *z = ScriptGetVarPointer(ctx); @@ -1842,24 +1842,24 @@ BOOL ScrCmd_Unk006B(ScriptContext *ctx) { // 006B - todo: CheckPersonPosition? } BOOL ScrCmd_KeepEvent(ScriptContext *ctx) { // 006C - u16 eventId = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); LocalMapObject *event = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, eventId); MapObject_SetKeep(event, (BOOL)ScriptReadByte(ctx)); return FALSE; } BOOL ScrCmd_SetEventMovement(ScriptContext *ctx) { // 006D - u16 eventId = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); LocalMapObject *event = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, eventId); - u16 movement = ScriptReadHalfword(ctx); + u16 movement = ScriptReadHalfword(ctx); sub_02058E90(event, movement); return FALSE; } BOOL ScrCmd_GetEventMovement(ScriptContext *ctx) { // 02AD u16 *variable = ScriptGetVarPointer(ctx); - *variable = 0; - u16 eventId = ScriptGetVar(ctx); + *variable = 0; + u16 eventId = ScriptGetVar(ctx); LocalMapObject *event = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, eventId); if (event != NULL) { @@ -1875,17 +1875,17 @@ BOOL ScrCmd_EventStopFollowing(ScriptContext *ctx) { // 006E } BOOL ScrCmd_Unk02AB(ScriptContext *ctx) { // 02AB - u16 *variable = ScriptGetVarPointer(ctx); + u16 *variable = ScriptGetVarPointer(ctx); SealCase *sealCase = Save_SealCase_Get(ctx->fieldSystem->saveData); - *variable = sub_02029E0C(sealCase); + *variable = sub_02029E0C(sealCase); return FALSE; } BOOL ScrCmd_GetSealCountFromId(ScriptContext *ctx) { // 0093 - u16 sealId = ScriptGetVar(ctx); - u16 *variable = ScriptGetVarPointer(ctx); + u16 sealId = ScriptGetVar(ctx); + u16 *variable = ScriptGetVarPointer(ctx); SealCase *sealCase = Save_SealCase_Get(ctx->fieldSystem->saveData); - *variable = SealCase_CountSealOccurrenceAnywhere(sealCase, sealId); + *variable = SealCase_CountSealOccurrenceAnywhere(sealCase, sealId); return FALSE; } @@ -1900,36 +1900,36 @@ BOOL ScrCmd_GiveSeals(ScriptContext *ctx) { // 0094 BOOL ScrCmd_GetPokemonForm(ScriptContext *ctx) { // 0095 u16 partyPosition = ScriptGetVar(ctx); - u16 *variable = ScriptGetVarPointer(ctx); + u16 *variable = ScriptGetVarPointer(ctx); Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); - *variable = GetMonUnownLetter(Party_GetMonByIndex(party, partyPosition)); + *variable = GetMonUnownLetter(Party_GetMonByIndex(party, partyPosition)); return FALSE; } BOOL ScrCmd_ChoosePokemonMenu(ScriptContext *ctx) { // 0191 PartyMenuAppData **partyMenu = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *partyMenu = sub_020379F8(0x20, ctx->fieldSystem); + *partyMenu = sub_020379F8(0x20, ctx->fieldSystem); SetupNativeScript(ctx, sub_0203BC04); return TRUE; } BOOL ScrCmd_OpenTradeScreen(ScriptContext *ctx) { // 02A5 PartyMenuAppData **partyMenu = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *partyMenu = sub_02037A1C(0x20, ctx->fieldSystem); + *partyMenu = sub_02037A1C(0x20, ctx->fieldSystem); SetupNativeScript(ctx, sub_0203BC04); return TRUE; } BOOL ScrCmd_UnionChoosePokemonMenu(ScriptContext *ctx) { // 0192 PartyMenuAppData **partyMenu = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *partyMenu = sub_02037B44(ctx->fieldSystem->taskManager, 0x20); + *partyMenu = sub_02037B44(ctx->fieldSystem->taskManager, 0x20); return TRUE; } BOOL ScrCmd_GetSelectedPartySlot(ScriptContext *ctx) { // 0193 - u16 *variable = ScriptGetVarPointer(ctx); + u16 *variable = ScriptGetVarPointer(ctx); PartyMenuAppData **partyMenu = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); GF_ASSERT(*partyMenu); @@ -1945,10 +1945,10 @@ BOOL ScrCmd_GetSelectedPartySlot(ScriptContext *ctx) { // 0193 BOOL ScrCmd_Unk0194(ScriptContext *ctx) { // 0194 void **runningAppData = (void **)FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); - u16 unk2 = ScriptGetVar(ctx); - u16 unk3 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); + u16 unk2 = ScriptGetVar(ctx); + u16 unk3 = ScriptGetVar(ctx); *runningAppData = sub_02037BB0(0x20, ctx->fieldSystem, unk2, unk1, unk3, unk0); SetupNativeScript(ctx, sub_0203BC04); @@ -1956,8 +1956,8 @@ BOOL ScrCmd_Unk0194(ScriptContext *ctx) { // 0194 } BOOL ScrCmd_Unk0195(ScriptContext *ctx) { // 0195 - u16 *unk0 = ScriptGetVarPointer(ctx); - u16 *unk1 = ScriptGetVarPointer(ctx); + u16 *unk0 = ScriptGetVarPointer(ctx); + u16 *unk1 = ScriptGetVarPointer(ctx); PartyMenuAppData **partyMenuData = (PartyMenuAppData **)FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); GF_ASSERT(*partyMenuData); @@ -1977,7 +1977,7 @@ BOOL ScrCmd_Unk0195(ScriptContext *ctx) { // 0195 BOOL ScrCmd_Unk0196(ScriptContext *ctx) { // 0196 void **runningAppData = (void **)FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); *runningAppData = sub_02037C00(0x20, ctx->fieldSystem, unk0); SetupNativeScript(ctx, sub_0203BC04); @@ -1985,7 +1985,7 @@ BOOL ScrCmd_Unk0196(ScriptContext *ctx) { // 0196 } BOOL ScrCmd_Unk0197(ScriptContext *ctx) { // 0197 - u16 *unk0 = ScriptGetVarPointer(ctx); + u16 *unk0 = ScriptGetVarPointer(ctx); void **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); GF_ASSERT(*runningAppData); @@ -1999,8 +1999,8 @@ BOOL ScrCmd_Unk0197(ScriptContext *ctx) { // 0197 BOOL ScrCmd_Unk009B(ScriptContext *ctx) { // 009B LocalMapObject **lastInteracted = (LocalMapObject **)FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 unk0 = ScriptGetVar(ctx); - u16 *unk1 = ScriptGetVarPointer(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 *unk1 = ScriptGetVarPointer(ctx); *unk1 = ov05_021E1858(ctx->fieldSystem, *lastInteracted, unk0); return FALSE; @@ -2028,7 +2028,7 @@ BOOL ScrCmd_DummyGetMapPosition(ScriptContext *ctx) { // 009F /*static*/ BOOL sub_0203BB90(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - void **runningAppData = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_RUNNING_APP_DATA); + void **runningAppData = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_RUNNING_APP_DATA); if (FieldSystem_ApplicationIsRunning(fieldSystem)) { return FALSE; @@ -2039,9 +2039,9 @@ BOOL ScrCmd_DummyGetMapPosition(ScriptContext *ctx) { // 009F } static BOOL sub_0203BBBC(ScriptContext *ctx) { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; PCBoxAppData **pcBoxDataPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - PCBoxAppData *pcBoxData = *pcBoxDataPtr; + PCBoxAppData *pcBoxData = *pcBoxDataPtr; if (FieldSystem_ApplicationIsRunning(fieldSystem)) { return FALSE; } @@ -2088,8 +2088,8 @@ static FashionAppData *sub_0203BC6C(HeapID heapId, FieldSystem *fieldSystem, BOO } FashionAppData *appData = AllocFromHeap(heapId, sizeof(FashionAppData)); memset(appData, 0, sizeof(FashionAppData)); - appData->fashionData = fashionData; - appData->isContest = isContest; + appData->fashionData = fashionData; + appData->isContest = isContest; appData->portraitSlot = portraitSlot; return appData; } @@ -2106,22 +2106,22 @@ BOOL ScrCmd_Unk00A3(ScriptContext *ctx) { // 00A3 BOOL ScrCmd_GetDressupPortraitSlot(ScriptContext *ctx) { // 00A4 FashionAppData **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - u16 *portraitSlotPtr = ScriptGetVarPointer(ctx); - *portraitSlotPtr = (*runningAppData)->portraitSlot; + u16 *portraitSlotPtr = ScriptGetVarPointer(ctx); + *portraitSlotPtr = (*runningAppData)->portraitSlot; FreeToHeap(*runningAppData); return FALSE; } BOOL ScrCmd_Unk0207(ScriptContext *ctx) { // 0207 u16 *ptr = ScriptGetVarPointer(ctx); - *ptr = sub_02031190(); + *ptr = sub_02031190(); return TRUE; } BOOL ScrCmd_ShowPokemonPic(ScriptContext *ctx) { // 0208 PokepicManager **pokepicManager = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - u16 species = ScriptGetVar(ctx); - u16 gender = ScriptGetVar(ctx); + u16 species = ScriptGetVar(ctx); + u16 gender = ScriptGetVar(ctx); LoadUserFrameGfx1(ctx->fieldSystem->bgConfig, GF_BG_LYR_MAIN_3, 0x3D9, 11, 0, HEAP_ID_4); *pokepicManager = DrawPokemonPicFromSpecies(ctx->fieldSystem->bgConfig, GF_BG_LYR_MAIN_3, 10, 5, 11, 0x3D9, species, gender, HEAP_ID_4); Script_SetMonSeenFlagBySpecies(ctx->fieldSystem, species); @@ -2130,24 +2130,24 @@ BOOL ScrCmd_ShowPokemonPic(ScriptContext *ctx) { // 0208 BOOL ScrCmd_ShowPartyPokemonPic(ScriptContext *ctx) { // 028C PokepicManager **pokepicManager = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - u16 partyId = ScriptGetVar(ctx); - Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyId); + u16 partyId = ScriptGetVar(ctx); + Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyId); LoadUserFrameGfx1(ctx->fieldSystem->bgConfig, GF_BG_LYR_MAIN_3, 0x3D9, 11, 0, HEAP_ID_4); *pokepicManager = DrawPokemonPicFromMon(ctx->fieldSystem->bgConfig, GF_BG_LYR_MAIN_3, 10, 5, 11, 0x3D9, mon, HEAP_ID_4); - u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL); Script_SetMonSeenFlagBySpecies(ctx->fieldSystem, (u16)species); return FALSE; } BOOL ScrCmd_Unk0209(ScriptContext *ctx) { // 0209 PokepicManager **pokepicManager = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - (*pokepicManager)->unk00 = 1; + (*pokepicManager)->unk00 = 1; return TRUE; } BOOL ScrCmd_Unk028D(ScriptContext *ctx) { // 028D PokepicManager **pokepicManager = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - (*pokepicManager)->unk00 = 2; + (*pokepicManager)->unk00 = 2; return TRUE; } @@ -2159,14 +2159,14 @@ BOOL ScrCmd_Unk028E(ScriptContext *ctx) { // 028E static BOOL sub_0203BE9C(ScriptContext *ctx) { PokepicManager **pokepicManager = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); // unused + u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); // unused return (*pokepicManager)->unk00 != 3; } BOOL ScrCmd_Unk020A(ScriptContext *ctx) { // 020A - u16 unk0 = ScriptReadHalfword(ctx); + u16 unk0 = ScriptReadHalfword(ctx); MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u16 *ptr = GetVarPointer(ctx->fieldSystem, unk0); + u16 *ptr = GetVarPointer(ctx->fieldSystem, unk0); ov05_021E1374(ctx->taskManager, *messageFormat, ptr); return TRUE; } @@ -2186,17 +2186,17 @@ BOOL ScrCmd_Unk00A5(ScriptContext *ctx) { // 00A5 BOOL ScrCmd_DressupPokemon(ScriptContext *ctx) { // 00A6 u16 partyPos = ScriptGetVar(ctx); - u16 *unk0 = ScriptGetVarPointer(ctx); - u16 unk1 = ScriptGetVar(ctx); + u16 *unk0 = ScriptGetVarPointer(ctx); + u16 unk1 = ScriptGetVar(ctx); sub_020380CC(ctx->fieldSystem->taskManager, unk0, ctx->fieldSystem->saveData, partyPos, unk1); return TRUE; } BOOL ScrCmd_ShowDressedPokemon(ScriptContext *ctx) { // 00A7 FashionAppData **fashionAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - u16 portraitSlot = ScriptReadHalfword(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *fashionAppData = sub_0203BC6C(HEAP_ID_FIELD, ctx->fieldSystem, FALSE, portraitSlot); + u16 portraitSlot = ScriptReadHalfword(ctx); + u16 *var = ScriptGetVarPointer(ctx); + *fashionAppData = sub_0203BC6C(HEAP_ID_FIELD, ctx->fieldSystem, FALSE, portraitSlot); if (*fashionAppData == NULL) { *var = 1; return TRUE; @@ -2209,9 +2209,9 @@ BOOL ScrCmd_ShowDressedPokemon(ScriptContext *ctx) { // 00A7 BOOL ScrCmd_ShowContestPokemon(ScriptContext *ctx) { // 00A8 FashionAppData **fashionAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - u16 portraitSlot = ScriptReadHalfword(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *fashionAppData = sub_0203BC6C(HEAP_ID_FIELD, ctx->fieldSystem, TRUE, portraitSlot); + u16 portraitSlot = ScriptReadHalfword(ctx); + u16 *var = ScriptGetVarPointer(ctx); + *fashionAppData = sub_0203BC6C(HEAP_ID_FIELD, ctx->fieldSystem, TRUE, portraitSlot); if (*fashionAppData == NULL) { *var = 1; return TRUE; @@ -2224,7 +2224,7 @@ BOOL ScrCmd_ShowContestPokemon(ScriptContext *ctx) { // 00A8 BOOL ScrCmd_CheckPortraitSlot(ScriptContext *ctx) { // 012E u16 portraitSlot = ScriptReadHalfword(ctx); - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); if (Script_CheckPortraitSlotFull(ctx->fieldSystem, FALSE, portraitSlot) == TRUE) { *var = TRUE; return TRUE; @@ -2235,7 +2235,7 @@ BOOL ScrCmd_CheckPortraitSlot(ScriptContext *ctx) { // 012E BOOL ScrCmd_CheckContestPortraitSlot(ScriptContext *ctx) { // 012F u16 portraitSlot = ScriptReadHalfword(ctx); - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); if (Script_CheckPortraitSlotFull(ctx->fieldSystem, TRUE, portraitSlot) == TRUE) { *var = TRUE; return TRUE; @@ -2245,7 +2245,7 @@ BOOL ScrCmd_CheckContestPortraitSlot(ScriptContext *ctx) { // 012F } BOOL ScrCmd_Unk0130(ScriptContext *ctx) { // 0130 - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); SaveFashionData *fashionData = Save_FashionData_Get(ctx->fieldSystem->saveData); sub_02027478(sub_02027008(fashionData, 0), unk0); return TRUE; @@ -2264,7 +2264,7 @@ BOOL ScrCmd_ShowSealCapsuleEditor(ScriptContext *ctx) { // 00A9 BOOL ScrCmd_ShowTownMapScreen(ScriptContext *ctx) { // 00AA TownMapAppData **townMap = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *townMap = AllocFromHeap(HEAP_ID_FIELD, sizeof(TownMapAppData)); + *townMap = AllocFromHeap(HEAP_ID_FIELD, sizeof(TownMapAppData)); sub_0205F7A0(ctx->fieldSystem, *townMap, 2); // TownMap_Init? sub_02037E90(ctx->fieldSystem, *townMap); // ShowTownMap? SetupNativeScript(ctx, sub_0203BB90); @@ -2273,15 +2273,15 @@ BOOL ScrCmd_ShowTownMapScreen(ScriptContext *ctx) { // 00AA BOOL ScrCmd_Unk01D7(ScriptContext *ctx) { // 01D7 - TODO: ShowPoffinCaseScreen? PoffinCaseAppData **poffinCaseAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - u8 unk0 = ScriptReadHalfword(ctx); - *poffinCaseAppData = sub_02088960(ctx->fieldSystem, unk0, HEAP_ID_FIELD); + u8 unk0 = ScriptReadHalfword(ctx); + *poffinCaseAppData = sub_02088960(ctx->fieldSystem, unk0, HEAP_ID_FIELD); SetupNativeScript(ctx, sub_0203BB90); return TRUE; } BOOL ScrCmd_Unk01D8(ScriptContext *ctx) { // 01D8 u16 *unk0 = ScriptGetVarPointer(ctx); - Bag *bag = Save_Bag_Get(ctx->fieldSystem->saveData); + Bag *bag = Save_Bag_Get(ctx->fieldSystem->saveData); if (!Bag_PocketNotEmpty(bag, POCKET_BERRIES)) { *unk0 = 1; return FALSE; @@ -2294,15 +2294,15 @@ BOOL ScrCmd_Unk01D8(ScriptContext *ctx) { // 01D8 } BOOL ScrCmd_Unk01D9(ScriptContext *ctx) { // 01D9 - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); ScrCmdUnkStruct01D9 **unkStructPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *unkStructPtr = AllocFromHeap(HEAP_ID_FIELD, sizeof(ScrCmdUnkStruct01D9)); - ScrCmdUnkStruct01D9 *unkStruct = *unkStructPtr; + *unkStructPtr = AllocFromHeap(HEAP_ID_FIELD, sizeof(ScrCmdUnkStruct01D9)); + ScrCmdUnkStruct01D9 *unkStruct = *unkStructPtr; MI_CpuFill8(unkStruct, 0, sizeof(ScrCmdUnkStruct01D9)); // consider inlining as is in heartgold unkStruct->unk04 = unk0; unkStruct->unk06 = unk1; - unkStruct->save = ctx->fieldSystem->saveData; + unkStruct->save = ctx->fieldSystem->saveData; sub_02037FE4(ctx->fieldSystem, *unkStructPtr); SetupNativeScript(ctx, sub_0203BB90); return TRUE; @@ -2310,10 +2310,10 @@ BOOL ScrCmd_Unk01D9(ScriptContext *ctx) { // 01D9 BOOL ScrCmd_ShowPCBoxScreen(ScriptContext *ctx) { // 00AB PCBoxAppData **pcBoxAppDataPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - PCBoxAppData *pcBoxAppData = AllocFromHeap(HEAP_ID_FIELD, sizeof(PCBoxAppData)); // also seems inlined - pcBoxAppData->save = ctx->fieldSystem->saveData; - pcBoxAppData->operation = (enum PCBoxOperation)ScriptReadByte(ctx); - *pcBoxAppDataPtr = pcBoxAppData; + PCBoxAppData *pcBoxAppData = AllocFromHeap(HEAP_ID_FIELD, sizeof(PCBoxAppData)); // also seems inlined + pcBoxAppData->save = ctx->fieldSystem->saveData; + pcBoxAppData->operation = (enum PCBoxOperation)ScriptReadByte(ctx); + *pcBoxAppDataPtr = pcBoxAppData; LaunchStoragePCInterface(ctx->fieldSystem, *pcBoxAppDataPtr); SetupNativeScript(ctx, sub_0203BBBC); return TRUE; @@ -2337,7 +2337,7 @@ BOOL ScrCmd_Unk00AE(ScriptContext *ctx) { // 00AE BOOL ScrCmd_Unk00AF(ScriptContext *ctx) { // 00AF void **appData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); // todo: define an app type for this - *appData = sub_0203842C(ctx->fieldSystem); + *appData = sub_0203842C(ctx->fieldSystem); SetupNativeScript(ctx, sub_0203BB90); return TRUE; } @@ -2349,13 +2349,13 @@ BOOL ScrCmd_ShowEndGameScreen(ScriptContext *ctx) { // 00B0 BOOL ScrCmd_InitHallOfFame(ScriptContext *ctx) { // 00B1 HallOfFame **hallOfFameData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *hallOfFameData = sub_02038824(ctx->fieldSystem); + *hallOfFameData = sub_02038824(ctx->fieldSystem); SetupNativeScript(ctx, sub_0203BB90); return TRUE; } BOOL ScrCmd_Unk00B2(ScriptContext *ctx) { // 00B2 - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); u16 *unk1 = ScriptGetVarPointer(ctx); if (sub_0203384C(ctx->fieldSystem->saveData)) { *unk1 = 1; @@ -2375,9 +2375,9 @@ BOOL ScrCmd_Unk00B3(ScriptContext *ctx) { // 00B3 BOOL ScrCmd_StarterSelectionScreen(ScriptContext *ctx) { // 00B4 StarterSelectionData **starterSelectionPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - *starterSelectionPtr = AllocFromHeap(HEAP_ID_FIELD, sizeof(StarterSelectionData)); + *starterSelectionPtr = AllocFromHeap(HEAP_ID_FIELD, sizeof(StarterSelectionData)); StarterSelectionData *starterSelectionData = *starterSelectionPtr; // consider inlining - starterSelectionData->options = Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData); + starterSelectionData->options = Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData); sub_020386A4(ctx->fieldSystem, *starterSelectionPtr); SetupNativeScript(ctx, sub_0203BC04); return TRUE; @@ -2385,7 +2385,7 @@ BOOL ScrCmd_StarterSelectionScreen(ScriptContext *ctx) { // 00B4 BOOL ScrCmd_EndStarterSelectionScreen(ScriptContext *ctx) { // 00B5 StarterSelectionData **starterSelectionData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - SaveVarsFlags *flags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + SaveVarsFlags *flags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); sub_0205F378(flags, (*starterSelectionData)->state); FreeToHeap(*starterSelectionData); return FALSE; @@ -2403,7 +2403,7 @@ BOOL ScrCmd_ShowBagScreen(ScriptContext *ctx) { // 0178 } BOOL ScrCmd_GetBagScreenSelection(ScriptContext *ctx) { // 0179 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); BagScreenAppData **bagData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); GF_ASSERT(*bagData != NULL); @@ -2445,37 +2445,37 @@ BOOL ScrCmd_WriteWhiteRockInscription(ScriptContext *ctx) { // 0271 BOOL ScrCmd_Unk0243(ScriptContext *ctx) { // 0243 u16 unused = ScriptGetVar(ctx); - u16 *unk1 = ScriptGetVarPointer(ctx); - u16 *unk2 = ScriptGetVarPointer(ctx); - *unk2 = 0xFFFF; + u16 *unk1 = ScriptGetVarPointer(ctx); + u16 *unk2 = ScriptGetVarPointer(ctx); + *unk2 = 0xFFFF; sub_02037E18(ctx->fieldSystem->taskManager, unk1, unk2, NULL); return TRUE; } BOOL ScrCmd_Unk0244(ScriptContext *ctx) { // 0244 - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); u16 *unk1 = ScriptGetVarPointer(ctx); u16 *unk2 = ScriptGetVarPointer(ctx); u16 *unk3 = ScriptGetVarPointer(ctx); - *unk2 = 0xFFFF; - *unk3 = 0xFFFF; + *unk2 = 0xFFFF; + *unk3 = 0xFFFF; sub_02037E18(ctx->fieldSystem->taskManager, unk1, unk2, unk3); return TRUE; } BOOL ScrCmd_Unk0245(ScriptContext *ctx) { // 0245 MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); BufferECWord(*messageFormat, unk0, unk1); return FALSE; } BOOL ScrCmd_FadeScreen(ScriptContext *ctx) { // 00BC8 u16 duration = ScriptReadHalfword(ctx); - u16 speed = ScriptReadHalfword(ctx); - u16 type = ScriptReadHalfword(ctx); - u16 colour = ScriptReadHalfword(ctx); + u16 speed = ScriptReadHalfword(ctx); + u16 type = ScriptReadHalfword(ctx); + u16 colour = ScriptReadHalfword(ctx); BeginNormalPaletteFade(0, type, type, colour, duration, speed, HEAP_ID_4); sub_0200E388(0); sub_0200E388(1); @@ -2493,20 +2493,20 @@ static BOOL sub_0203C71C(ScriptContext *ctx) { BOOL ScrCmd_Warp(ScriptContext *ctx) { // 00BE u16 mapId = ScriptReadHalfword(ctx); - u16 door = ScriptReadHalfword(ctx); // unused? - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); - u16 dir = ScriptReadHalfword(ctx); + u16 door = ScriptReadHalfword(ctx); // unused? + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); + u16 dir = ScriptReadHalfword(ctx); CallTask_ScriptWarp(ctx->taskManager, mapId, -1, x, y, dir); return TRUE; } BOOL ScrCmd_BattleRoomWarp(ScriptContext *ctx) { // 0203 u16 mapId = ScriptReadHalfword(ctx); - u16 door = ScriptReadHalfword(ctx); // unused? - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); - u16 dir = ScriptReadHalfword(ctx); + u16 door = ScriptReadHalfword(ctx); // unused? + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); + u16 dir = ScriptReadHalfword(ctx); sub_02049F98(ctx->fieldSystem->taskManager, mapId, -1, x, y, dir); return TRUE; } @@ -2518,19 +2518,19 @@ BOOL ScrCmd_ExitBattleRoom(ScriptContext *ctx) { // 0204 BOOL ScrCmd_GetPreviousMapID(ScriptContext *ctx) { // 0200 Location *location = sub_02034DC8(Save_LocalFieldData_Get(ctx->fieldSystem->saveData)); - u16 *var = ScriptGetVarPointer(ctx); - *var = location->mapId; + u16 *var = ScriptGetVarPointer(ctx); + *var = location->mapId; return FALSE; } BOOL ScrCmd_GetCurrentMapID(ScriptContext *ctx) { // 0201 u16 *var = ScriptGetVarPointer(ctx); - *var = ctx->fieldSystem->location->mapId; + *var = ctx->fieldSystem->location->mapId; return FALSE; } BOOL ScrCmd_RockClimb(ScriptContext *ctx) { // 00BF - u16 partyPosition = ScriptGetVar(ctx); + u16 partyPosition = ScriptGetVar(ctx); u32 playerDirection = PlayerAvatar_GetFacingDirection(ctx->fieldSystem->playerAvatar); CallFieldTask_RockClimb(ctx->taskManager, playerDirection, partyPosition); return TRUE; @@ -2538,14 +2538,14 @@ BOOL ScrCmd_RockClimb(ScriptContext *ctx) { // 00BF BOOL ScrCmd_Surf(ScriptContext *ctx) { // 00C0 sub_0205DD40(ctx->fieldSystem->unk90); - u16 partyPosition = ScriptGetVar(ctx); + u16 partyPosition = ScriptGetVar(ctx); u32 playerDirection = PlayerAvatar_GetFacingDirection(ctx->fieldSystem->playerAvatar); CallFieldTask_Surf(ctx->taskManager, playerDirection, partyPosition); return TRUE; } BOOL ScrCmd_Waterfall(ScriptContext *ctx) { // 00C1 - u16 partyPosition = ScriptGetVar(ctx); + u16 partyPosition = ScriptGetVar(ctx); u32 playerDirection = PlayerAvatar_GetFacingDirection(ctx->fieldSystem->playerAvatar); CallFieldTask_Waterfall(ctx->taskManager, playerDirection, partyPosition); return TRUE; @@ -2553,8 +2553,8 @@ BOOL ScrCmd_Waterfall(ScriptContext *ctx) { // 00C1 BOOL ScrCmd_Fly(ScriptContext *ctx) { // 00C2 u16 mapId = ScriptReadHalfword(ctx); - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); sub_02049274(ctx->fieldSystem, mapId, -1, x, y, DIR_SOUTH); // fly function return TRUE; } @@ -2573,12 +2573,12 @@ BOOL ScrCmd_Defog(ScriptContext *ctx) { // 00C4 return TRUE; } -BOOL ScrCmd_Cut(ScriptContext *ctx) { // 00C5 - void **miscData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); // todo identify +BOOL ScrCmd_Cut(ScriptContext *ctx) { // 00C5 + void **miscData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); // todo identify u16 partyPosition = ScriptGetVar(ctx); - Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyPosition); - u32 gender = PlayerAvatar_GetGender(ctx->fieldSystem->playerAvatar); - *miscData = ov06_0224666C(ctx->fieldSystem, 0, mon, gender); + Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyPosition); + u32 gender = PlayerAvatar_GetGender(ctx->fieldSystem->playerAvatar); + *miscData = ov06_0224666C(ctx->fieldSystem, 0, mon, gender); SetupNativeScript(ctx, sub_0203C9F8); return TRUE; } @@ -2637,7 +2637,7 @@ BOOL ScrCmd_CyclingRoad(ScriptContext *ctx) { // 00C9 BOOL ScrCmd_GetPlayerState(ScriptContext *ctx) { // 00CA u16 *var = ScriptGetVarPointer(ctx); - *var = PlayerAvatar_GetState(ctx->fieldSystem->playerAvatar); + *var = PlayerAvatar_GetState(ctx->fieldSystem->playerAvatar); return FALSE; } @@ -2654,15 +2654,15 @@ BOOL ScrCmd_ApplyPlayerState(ScriptContext *ctx) { // 00CC BOOL ScrCmd_GetSwarmInfo(ScriptContext *ctx) { // 00E3 RoamerSaveData *roamerData = Save_Roamers_Get(ctx->fieldSystem->saveData); - u16 *map = ScriptGetVarPointer(ctx); - u16 *species = ScriptGetVarPointer(ctx); + u16 *map = ScriptGetVarPointer(ctx); + u16 *species = ScriptGetVarPointer(ctx); GetSwarmInfoFromRand(Roamers_GetRand(roamerData, 2), map, species); return FALSE; } BOOL ScrCmd_GetStarter(ScriptContext *ctx) { // 00DE u16 *var = ScriptGetVarPointer(ctx); - *var = Save_VarsFlags_GetStarter(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); + *var = Save_VarsFlags_GetStarter(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); return FALSE; } @@ -2670,12 +2670,12 @@ BOOL ScrCmd_TrainerMessage(ScriptContext *ctx) { // 00E6 FieldSystem *fieldSystem = ctx->fieldSystem; u16 *scriptNumber = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_ACTIVE_SCRIPT_NUMBER); - String **string = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_0); - void *unk06 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); + String **string = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_STRING_BUFFER_0); + void *unk06 = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_UNKNOWN_06); u8 *printerNumber = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_TEXT_PRINTER_NUMBER); u16 trainerId = ScriptGetVar(ctx); - u16 msgNo = ScriptGetVar(ctx); + u16 msgNo = ScriptGetVar(ctx); GetTrainerMessageByIdPair(trainerId, msgNo, *string, HEAP_ID_FIELD); FillWindowPixelBuffer(FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW), 15); *printerNumber = sub_02054658(FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_WINDOW), *string, Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData), TRUE); @@ -2685,10 +2685,10 @@ BOOL ScrCmd_TrainerMessage(ScriptContext *ctx) { // 00E6 BOOL ScrCmd_Unk00F2(ScriptContext *ctx) { // 00F2 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); - u16 unk2 = ScriptGetVar(ctx); - u16 unk3 = ScriptReadHalfword(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); + u16 unk2 = ScriptGetVar(ctx); + u16 unk3 = ScriptReadHalfword(ctx); ov06_02240790(fieldSystem, unk0, unk1, unk2); ctx->data[0] = unk3; SetupNativeScript(ctx, sub_0203CCF8); @@ -2696,7 +2696,7 @@ BOOL ScrCmd_Unk00F2(ScriptContext *ctx) { // 00F2 } static BOOL sub_0203CCF8(ScriptContext *ctx) { - u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); + u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); u32 result = ov06_022407DC(); if (result == 0) { return FALSE; @@ -2708,10 +2708,10 @@ static BOOL sub_0203CCF8(ScriptContext *ctx) { BOOL ScrCmd_Unk00F3(ScriptContext *ctx) { // 00F3 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); - u16 unk2 = ScriptGetVar(ctx); - u16 unk3 = ScriptReadHalfword(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); + u16 unk2 = ScriptGetVar(ctx); + u16 unk3 = ScriptReadHalfword(ctx); ov06_022407F8(fieldSystem, unk0, unk1, unk2); ctx->data[0] = unk3; SetupNativeScript(ctx, sub_0203CD90); @@ -2719,7 +2719,7 @@ BOOL ScrCmd_Unk00F3(ScriptContext *ctx) { // 00F3 } static BOOL sub_0203CD90(ScriptContext *ctx) { - u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); + u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); u32 result = ov06_02240844(); if (result == 0) { return FALSE; @@ -2741,7 +2741,7 @@ BOOL ScrCmd_Unk00F5(ScriptContext *ctx) { // 00F5 BOOL ScrCmd_Unk00F6(ScriptContext *ctx) { // 00F6 ScrCmdUnkStruct00F4 **appDataPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - ScrCmdUnkStruct00F4 *appData = *appDataPtr; + ScrCmdUnkStruct00F4 *appData = *appDataPtr; sub_02047174(ctx->fieldSystem->taskManager, &appData->unk2C, 5); FreeToHeap(appData); *appDataPtr = NULL; @@ -2755,57 +2755,57 @@ BOOL ScrCmd_Unk00F7(ScriptContext *ctx) { // 00F7 BOOL ScrCmd_SetDynamicWarp(ScriptContext *ctx) { // 011B Location warp; - warp.mapId = ScriptGetVar(ctx); - warp.warpId = ScriptGetVar(ctx); - warp.x = ScriptGetVar(ctx); - warp.y = ScriptGetVar(ctx); + warp.mapId = ScriptGetVar(ctx); + warp.warpId = ScriptGetVar(ctx); + warp.x = ScriptGetVar(ctx); + warp.y = ScriptGetVar(ctx); warp.direction = ScriptGetVar(ctx); LocalFieldData_SetDynamicWarp(Save_LocalFieldData_Get(ctx->fieldSystem->saveData), &warp); return FALSE; } BOOL ScrCmd_GetDynamicWarpFloorNumber(ScriptContext *ctx) { // 011C - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); Location *dynamicWarp = LocalFieldData_GetDynamicWarp(Save_LocalFieldData_Get(ctx->fieldSystem->saveData)); - *var = MapNumToFloorNo(dynamicWarp->mapId); + *var = MapNumToFloorNo(dynamicWarp->mapId); return FALSE; } BOOL ScrCmd_ShowCurrentFloorNumber(ScriptContext *ctx) { // 011D - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 x = ScriptReadByte(ctx); - u8 y = ScriptReadByte(ctx); - u16 *var = ScriptGetVarPointer(ctx); + u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx); + u16 *var = ScriptGetVarPointer(ctx); PrintCurrentFloorInNewWindow(fieldSystem, x, y, var, *messageFormat); return FALSE; } BOOL ScrCmd_CountSinnohDexSeen(ScriptContext *ctx) { // 011E Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = Pokedex_CountSinnohDexSeen(pokedex); + u16 *var = ScriptGetVarPointer(ctx); + *var = Pokedex_CountSinnohDexSeen(pokedex); return FALSE; } BOOL ScrCmd_CountSinnohDexOwned(ScriptContext *ctx) { // 011F Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = Pokedex_CountSinnohDexOwned(pokedex); + u16 *var = ScriptGetVarPointer(ctx); + *var = Pokedex_CountSinnohDexOwned(pokedex); return FALSE; } BOOL ScrCmd_CountNationalDexSeen(ScriptContext *ctx) { // 0120 Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = Pokedex_CountNationalDexSeen(pokedex); + u16 *var = ScriptGetVarPointer(ctx); + *var = Pokedex_CountNationalDexSeen(pokedex); return FALSE; } BOOL ScrCmd_CountNationalDexOwned(ScriptContext *ctx) { // 0121 Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = Pokedex_CountNationalDexOwned(pokedex); + u16 *var = ScriptGetVarPointer(ctx); + *var = Pokedex_CountNationalDexOwned(pokedex); return FALSE; } @@ -2814,10 +2814,10 @@ BOOL ScrCmd_DummyDexCheck(ScriptContext *ctx) { // 0122 } BOOL ScrCmd_GetDexEvaluationMessage(ScriptContext *ctx) { // 0123 - Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); + Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); - u8 mode = ScriptReadByte(ctx); - u16 *var = ScriptGetVarPointer(ctx); + u8 mode = ScriptReadByte(ctx); + u16 *var = ScriptGetVarPointer(ctx); if (mode == 0) { *var = sub_02054CC8(Pokedex_CountSinnohDexSeen_OmitMythicals(pokedex), sub_0205F2E4(Save_VarsFlags_Get(ctx->fieldSystem->saveData), 2, 10)); } else { @@ -2828,23 +2828,23 @@ BOOL ScrCmd_GetDexEvaluationMessage(ScriptContext *ctx) { // 0123 BOOL ScrCmd_WildBattle(ScriptContext *ctx) { // 0124 u32 *winFlag = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_BATTLE_WIN_FLAG); - u16 species = ScriptGetVar(ctx); - u16 level = ScriptGetVar(ctx); + u16 species = ScriptGetVar(ctx); + u16 level = ScriptGetVar(ctx); SetupAndStartWildBattle(ctx->taskManager, species, level, winFlag, FALSE); return TRUE; } BOOL ScrCmd_LegendaryBattle(ScriptContext *ctx) { // 02BD u32 *winFlag = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_BATTLE_WIN_FLAG); - u16 species = ScriptGetVar(ctx); - u16 level = ScriptGetVar(ctx); + u16 species = ScriptGetVar(ctx); + u16 level = ScriptGetVar(ctx); SetupAndStartWildBattle(ctx->taskManager, species, level, winFlag, TRUE); return TRUE; } BOOL ScrCmd_FirstBattle(ScriptContext *ctx) { // 0125 u16 species = ScriptGetVar(ctx); - u16 level = ScriptGetVar(ctx); + u16 level = ScriptGetVar(ctx); SetupAndStartFirstBattle(ctx->taskManager, species, level); return TRUE; } @@ -2861,8 +2861,8 @@ BOOL ScrCmd_UpdateHoneyTree(ScriptContext *ctx) { // 0127 BOOL ScrCmd_CheckHoneyTree(ScriptContext *ctx) { // 0128 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *var = ScriptGetVarPointer(ctx); - *var = CheckHoneyTree(fieldSystem); + u16 *var = ScriptGetVarPointer(ctx); + *var = CheckHoneyTree(fieldSystem); return FALSE; } @@ -2885,7 +2885,7 @@ BOOL ScrCmd_ShowSignatureScreen(ScriptContext *ctx) { // 012B BOOL ScrCmd_CheckSaveStatus(ScriptContext *ctx) { // 012C SaveData *saveData = ctx->fieldSystem->saveData; - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); if (Save_FileDoesNotBelongToPlayer(saveData)) { *var = 0; @@ -2901,8 +2901,8 @@ BOOL ScrCmd_CheckSaveStatus(ScriptContext *ctx) { // 012C BOOL ScrCmd_SaveGame(ScriptContext *ctx) { // 012D FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *var = ScriptGetVarPointer(ctx); - *var = Field_SaveGame(fieldSystem); + u16 *var = ScriptGetVarPointer(ctx); + *var = Field_SaveGame(fieldSystem); return FALSE; } @@ -2913,30 +2913,30 @@ BOOL ScrCmd_GivePoketch(ScriptContext *ctx) { // 0131 BOOL ScrCmd_CheckPoketch(ScriptContext *ctx) { // 0132 Poketch *poketch = Save_Poketch_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = Save_Poketch_IsGiven(poketch); + u16 *var = ScriptGetVarPointer(ctx); + *var = Save_Poketch_IsGiven(poketch); return FALSE; } BOOL ScrCmd_UnlockPoketchApp(ScriptContext *ctx) { // 0133 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 appNumber = ScriptGetVar(ctx); - Poketch *poketch = Save_Poketch_Get(fieldSystem->saveData); + u16 appNumber = ScriptGetVar(ctx); + Poketch *poketch = Save_Poketch_Get(fieldSystem->saveData); Save_Poketch_UnlockApp(poketch, (PoketchApp)appNumber); return FALSE; } BOOL ScrCmd_CheckPoketchApp(ScriptContext *ctx) { // 0134 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 appNumber = ScriptGetVar(ctx); - u16 *var = ScriptGetVarPointer(ctx); - Poketch *poketch = Save_Poketch_Get(fieldSystem->saveData); - *var = Save_Poketch_AppIsUnlocked(poketch, (PoketchApp)appNumber); + u16 appNumber = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + Poketch *poketch = Save_Poketch_Get(fieldSystem->saveData); + *var = Save_Poketch_AppIsUnlocked(poketch, (PoketchApp)appNumber); return FALSE; } BOOL ScrCmd_Unk0135(ScriptContext *ctx) { // 0135 - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); ctx->data[0] = unk0; sub_02031588(unk0); SetupNativeScript(ctx, sub_0203D314); @@ -2957,15 +2957,15 @@ BOOL ScrCmd_Unk0136(ScriptContext *ctx) { // 0136 BOOL ScrCmd_Unk0137(ScriptContext *ctx) { // 0137 MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205296C(*messageFormat); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205296C(*messageFormat); return FALSE; } BOOL ScrCmd_Unk0138(ScriptContext *ctx) { // 0138 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - *var = sub_02052C0C(ctx->fieldSystem->unk78, *messageFormat); + *var = sub_02052C0C(ctx->fieldSystem->unk78, *messageFormat); return FALSE; } @@ -2985,10 +2985,10 @@ BOOL ScrCmd_Unk0139(ScriptContext *ctx) { // 0139 BOOL ScrCmd_Unk013C(ScriptContext *ctx) { // 013C LocalMapObject **lastInteracted = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u16 unk0 = ScriptReadHalfword(ctx); - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); - SaveEasyChat *easyChat = Save_EasyChat_Get(FieldSystem_GetSaveData(ctx->fieldSystem)); + MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + u16 unk0 = ScriptReadHalfword(ctx); + PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + SaveEasyChat *easyChat = Save_EasyChat_Get(FieldSystem_GetSaveData(ctx->fieldSystem)); u16 objId; if (unk0 == 0) { @@ -3018,16 +3018,16 @@ static BOOL sub_0203D47C(ScriptContext *ctx) { BOOL ScrCmd_Unk013F(ScriptContext *ctx) { // 013F LocalMapObject **lastInteracted = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 unk0 = ScriptReadHalfword(ctx); - u16 *var = ScriptGetVarPointer(ctx); - MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - *var = sub_02052A10(ctx->fieldSystem->unk78, MapObject_GetID(*lastInteracted), unk0, *messageFormat); + u16 unk0 = ScriptReadHalfword(ctx); + u16 *var = ScriptGetVarPointer(ctx); + MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + *var = sub_02052A10(ctx->fieldSystem->unk78, MapObject_GetID(*lastInteracted), unk0, *messageFormat); return FALSE; } BOOL ScrCmd_Unk02BA(ScriptContext *ctx) { // 02BA u16 *var = ScriptGetVarPointer(ctx); - *var = sub_020527A8(ctx->fieldSystem->unk78); + *var = sub_020527A8(ctx->fieldSystem->unk78); if (*var) { void **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); FreeToHeap(*runningAppData); @@ -3036,19 +3036,19 @@ BOOL ScrCmd_Unk02BA(ScriptContext *ctx) { // 02BA } BOOL ScrCmd_Unk0140(ScriptContext *ctx) { // 0140 - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_020524CC(fieldSystem->unk78, MapObject_GetID(*lastInteracted)); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_020524CC(fieldSystem->unk78, MapObject_GetID(*lastInteracted)); return FALSE; } BOOL ScrCmd_Unk0146(ScriptContext *ctx) { // 0146 - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; LocalMapObject **lastInteracted = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 unk0 = ScriptGetVar(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_02052544(fieldSystem->unk78, MapObject_GetID(*lastInteracted), unk0); + u16 unk0 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_02052544(fieldSystem->unk78, MapObject_GetID(*lastInteracted), unk0); return FALSE; } @@ -3060,8 +3060,8 @@ BOOL ScrCmd_Unk0141(ScriptContext *ctx) { // 0141 static BOOL sub_0203D5CC(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - u32 unk0 = sub_02052604(fieldSystem->unk78); - u16 *var = GetVarPointer(fieldSystem, ctx->data[0]); + u32 unk0 = sub_02052604(fieldSystem->unk78); + u16 *var = GetVarPointer(fieldSystem, ctx->data[0]); if (unk0 == 0) { return FALSE; } else { @@ -3090,8 +3090,8 @@ BOOL ScrCmd_Unk013B(ScriptContext *ctx) { // 013B BOOL ScrCmd_Unk0143(ScriptContext *ctx) { // 0143 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); sub_0205265C(fieldSystem->unk78, unk0, unk1); return FALSE; } @@ -3139,7 +3139,7 @@ BOOL ScrCmd_Unk0153(ScriptContext *ctx) { // 0153 } BOOL ScrCmd_Unk0154(ScriptContext *ctx) { // 0154 - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); sub_0205363C(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), *messageFormat); return FALSE; @@ -3147,24 +3147,24 @@ BOOL ScrCmd_Unk0154(ScriptContext *ctx) { // 0154 BOOL ScrCmd_Unk0155(ScriptContext *ctx) { // 0155 PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); - u16 unk0 = ScriptGetVar(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_02053678(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), unk0); - *var = sub_020536D0(PlayerProfile_GetTrainerGender(playerProfile), *var, 2); + u16 unk0 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_02053678(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), unk0); + *var = sub_020536D0(PlayerProfile_GetTrainerGender(playerProfile), *var, 2); return FALSE; } BOOL ScrCmd_Unk029C(ScriptContext *ctx) { // 029C PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); - u16 unk0 = ScriptGetVar(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_02053678(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), unk0); + u16 unk0 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_02053678(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), unk0); return FALSE; } BOOL ScrCmd_SetPlayerAvatar(ScriptContext *ctx) { // 0156 PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); - u16 avatar = ScriptGetVar(ctx); + u16 avatar = ScriptGetVar(ctx); PlayerProfile_SetAvatar(playerProfile, avatar); return FALSE; } @@ -3175,7 +3175,7 @@ BOOL ScrCmd_DummyBlackout(ScriptContext *ctx) { // 014B } BOOL ScrCmd_SetSpawn(ScriptContext *ctx) { // 014C - u16 spawnPoint = ScriptGetVar(ctx); + u16 spawnPoint = ScriptGetVar(ctx); LocalFieldData *localFieldData = Save_LocalFieldData_Get(ctx->fieldSystem->saveData); LocalFieldData_SetBlackoutSpawn(localFieldData, spawnPoint); return FALSE; @@ -3183,8 +3183,8 @@ BOOL ScrCmd_SetSpawn(ScriptContext *ctx) { // 014C BOOL ScrCmd_GetPlayerGender(ScriptContext *ctx) { // 014D PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); - u16 *var = ScriptGetVarPointer(ctx); - *var = PlayerProfile_GetTrainerGender(playerProfile); + u16 *var = ScriptGetVarPointer(ctx); + *var = PlayerProfile_GetTrainerGender(playerProfile); return FALSE; } @@ -3230,26 +3230,26 @@ BOOL ScrCmd_Unk0152(ScriptContext *ctx) { // 0152 BOOL ScrCmd_CheckPocketNotEmpty(ScriptContext *ctx) { // 017A u16 pocket = ScriptGetVar(ctx); - u16 *var = ScriptGetVarPointer(ctx); - Bag *bag = Save_Bag_Get(ctx->fieldSystem->saveData); - *var = Bag_PocketNotEmpty(bag, pocket); + u16 *var = ScriptGetVarPointer(ctx); + Bag *bag = Save_Bag_Get(ctx->fieldSystem->saveData); + *var = Bag_PocketNotEmpty(bag, pocket); return FALSE; } BOOL ScrCmd_SetEventDefaultPosition(ScriptContext *ctx) { // 0186 u16 eventId = ScriptGetVar(ctx); - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); SetEventDefaultXYPos(ctx->fieldSystem, eventId, x, y); return FALSE; } BOOL ScrCmd_SetEventPosition(ScriptContext *ctx) { // 0187 - u16 eventId = ScriptGetVar(ctx); - u16 x = ScriptGetVar(ctx); - u16 z = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); - u16 direction = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 z = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); + u16 direction = ScriptGetVar(ctx); LocalMapObject *object = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, eventId); MapObject_SetPositionFromXYZAndDirection(object, x, z, y, direction); sub_02059D1C(object); @@ -3257,14 +3257,14 @@ BOOL ScrCmd_SetEventPosition(ScriptContext *ctx) { // 0187 } BOOL ScrCmd_SetEventDefaultMovement(ScriptContext *ctx) { // 0188 - u16 eventId = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); u16 movementId = ScriptGetVar(ctx); SetEventDefaultMovement(ctx->fieldSystem, eventId, movementId); return FALSE; } BOOL ScrCmd_SetEventDefaultDirection(ScriptContext *ctx) { // 0189 - u16 eventId = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); u16 direction = ScriptGetVar(ctx); SetEventDefaultDirection(ctx->fieldSystem, eventId, direction); return FALSE; @@ -3272,23 +3272,23 @@ BOOL ScrCmd_SetEventDefaultDirection(ScriptContext *ctx) { // 0189 BOOL ScrCmd_SetWarpPosition(ScriptContext *ctx) { // 018A u16 warpId = ScriptGetVar(ctx); - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); SetWarpXYPos(ctx->fieldSystem, warpId, x, y); return FALSE; } BOOL ScrCmd_SetBgEventPosition(ScriptContext *ctx) { // 018B u16 bgEventId = ScriptGetVar(ctx); - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); SetBgEventXYPos(ctx->fieldSystem, bgEventId, x, y); return FALSE; } BOOL ScrCmd_SetEventDirection(ScriptContext *ctx) { // 018C - u16 eventId = ScriptGetVar(ctx); - u16 direction = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); + u16 direction = ScriptGetVar(ctx); LocalMapObject *localMapObject = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, eventId); GF_ASSERT(localMapObject); ov05_021F1EC0(localMapObject, direction); @@ -3297,7 +3297,7 @@ BOOL ScrCmd_SetEventDirection(ScriptContext *ctx) { // 018C BOOL ScrCmd_Unk018F(ScriptContext *ctx) { // 018F u16 **unk0 = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_UNKNOWN_12); - u16 unk1 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); if (*unk0 != NULL) { **unk0 = unk1; } @@ -3307,9 +3307,9 @@ BOOL ScrCmd_Unk018F(ScriptContext *ctx) { // 018F BOOL ScrCmd_PrepareDoorAnimation(ScriptContext *ctx) { // 0168 u16 matrixX = ScriptReadHalfword(ctx); u16 matrixY = ScriptReadHalfword(ctx); - u16 mapX = ScriptGetVar(ctx); - u16 mapY = ScriptGetVar(ctx); - u8 doorId = ScriptReadByte(ctx); + u16 mapX = ScriptGetVar(ctx); + u16 mapY = ScriptGetVar(ctx); + u8 doorId = ScriptReadByte(ctx); ov05_021DAE40(ctx->fieldSystem, mapX + 32 * matrixX, mapY + 32 * matrixY, doorId); // Field_PrepareDoorAnimation? return FALSE; } @@ -3370,14 +3370,14 @@ BOOL ScrCmd_InitVeilstoneGym(ScriptContext *ctx) { // 0174 BOOL ScrCmd_InitSunyshoreGym(ScriptContext *ctx) { // 0175 FieldSystem *fieldSystem = ctx->fieldSystem; - u8 room = ScriptReadByte(ctx); + u8 room = ScriptReadByte(ctx); InitSunyshoreGym(fieldSystem, room); return FALSE; } BOOL ScrCmd_RotateSunyshoreGymGear(ScriptContext *ctx) { // 0176 FieldSystem *fieldSystem = ctx->fieldSystem; - u8 rotation = ScriptReadByte(ctx); + u8 rotation = ScriptReadByte(ctx); RotateSunyshoreGymGear(fieldSystem, rotation); return TRUE; } @@ -3387,20 +3387,20 @@ BOOL ScrCmd_HatchEgg(ScriptContext *ctx) { // 01AC return TRUE; } -BOOL ScrCmd_Unk019E(ScriptContext *ctx) { // 019E - void **miscDataPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); // todo: identify what this is +BOOL ScrCmd_Unk019E(ScriptContext *ctx) { // 019E + void **miscDataPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); // todo: identify what this is LocalMapObject **lastInteracted = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 unk0 = ScriptGetVar(ctx); - ctx->data[0] = ScriptReadHalfword(ctx); - *miscDataPtr = ov18_0224CA54(unk0, ctx->fieldSystem, MapObject_GetID(*lastInteracted)); + u16 unk0 = ScriptGetVar(ctx); + ctx->data[0] = ScriptReadHalfword(ctx); + *miscDataPtr = ov18_0224CA54(unk0, ctx->fieldSystem, MapObject_GetID(*lastInteracted)); SetupNativeScript(ctx, sub_0203DDC0); return TRUE; } static BOOL sub_0203DDC0(ScriptContext *ctx) { void **miscDataPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); // todo: identify what this is - u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); - *var = ov18_0224CA2C(*miscDataPtr); + u16 *var = GetVarPointer(ctx->fieldSystem, ctx->data[0]); + *var = ov18_0224CA2C(*miscDataPtr); if (*var != 0xFFFE) { return TRUE; } @@ -3409,8 +3409,8 @@ static BOOL sub_0203DDC0(ScriptContext *ctx) { BOOL ScrCmd_Unk019F(ScriptContext *ctx) { // 019F u8 *textPrinterNumber = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_TEXT_PRINTER_NUMBER); - u16 unk0 = ScriptGetVar(ctx); - *textPrinterNumber = ov18_0224CA58(unk0); + u16 unk0 = ScriptGetVar(ctx); + *textPrinterNumber = ov18_0224CA58(unk0); SetupNativeScript(ctx, sub_0203DE38); return TRUE; } @@ -3426,14 +3426,14 @@ BOOL ScrCmd_Unk01A0(ScriptContext *ctx) { // 01A0 } BOOL ScrCmd_Unk01A1(ScriptContext *ctx) { // 01A1 - u8 unk0 = ScriptReadByte(ctx); + u8 unk0 = ScriptReadByte(ctx); u16 unk1 = ScriptGetVar(ctx); ov18_0224CAA0(unk0, unk1); return FALSE; } BOOL ScrCmd_Unk01A2(ScriptContext *ctx) { // 01A2 - u8 unk0 = ScriptReadByte(ctx); + u8 unk0 = ScriptReadByte(ctx); u16 unk1 = ScriptGetVar(ctx); ov18_0224CAB4(unk0, unk1); return FALSE; @@ -3445,8 +3445,8 @@ BOOL ScrCmd_Unk003F(ScriptContext *ctx) { // 003F } BOOL ScrCmd_HideEvent(ScriptContext *ctx) { // 01B1 - FieldSystem *fieldSystem = ctx->fieldSystem; - u16 eventId = ScriptGetVar(ctx); + FieldSystem *fieldSystem = ctx->fieldSystem; + u16 eventId = ScriptGetVar(ctx); LocalMapObject *localMapObject = MapObjectManager_GetFirstActiveObjectByID(fieldSystem->mapObjectManager, eventId); GF_ASSERT(localMapObject); MapObject_SetVisible(localMapObject, FALSE); @@ -3454,8 +3454,8 @@ BOOL ScrCmd_HideEvent(ScriptContext *ctx) { // 01B1 } BOOL ScrCmd_ShowEvent(ScriptContext *ctx) { // 01B2 - FieldSystem *fieldSystem = ctx->fieldSystem; - u16 eventId = ScriptGetVar(ctx); + FieldSystem *fieldSystem = ctx->fieldSystem; + u16 eventId = ScriptGetVar(ctx); LocalMapObject *localMapObject = MapObjectManager_GetFirstActiveObjectByID(fieldSystem->mapObjectManager, eventId); GF_ASSERT(localMapObject); MapObject_SetVisible(localMapObject, TRUE); @@ -3469,9 +3469,9 @@ BOOL ScrCmd_ShowMailbox(ScriptContext *ctx) { // 01B3 BOOL ScrCmd_CountMail(ScriptContext *ctx) { // 01B4 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *var = ScriptGetVarPointer(ctx); - Mail *mailbox = Save_Mailbox_Get(fieldSystem->saveData); - *var = Mailbox_CountMessages(mailbox, 0); + u16 *var = ScriptGetVarPointer(ctx); + Mail *mailbox = Save_Mailbox_Get(fieldSystem->saveData); + *var = Mailbox_CountMessages(mailbox, 0); return FALSE; } @@ -3483,53 +3483,53 @@ BOOL ScrCmd_Unk01B5(ScriptContext *ctx) { // 01B5 BOOL ScrCmd_GetTimeOfDay(ScriptContext *ctx) { // 01B6 u16 *var = ScriptGetVarPointer(ctx); - *var = Script_GetTimeOfDay(ctx->fieldSystem); + *var = Script_GetTimeOfDay(ctx->fieldSystem); return FALSE; } BOOL ScrCmd_Random(ScriptContext *ctx) { // 01B7 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); u16 range = ScriptGetVar(ctx); - *var = LCRandom() % range; + *var = LCRandom() % range; return TRUE; } BOOL ScrCmd_DummyRandom(ScriptContext *ctx) { // 01B8 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); u16 range = ScriptGetVar(ctx); - *var = LCRandom() % range; + *var = LCRandom() % range; return TRUE; } BOOL ScrCmd_CheckPokemonSizeRecord(ScriptContext *ctx) { // 01C1 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *var = ScriptGetVarPointer(ctx); - u16 partyPosition = ScriptGetVar(ctx); - *var = Field_CheckPokemonSizeRecord(fieldSystem, partyPosition); + u16 *var = ScriptGetVarPointer(ctx); + u16 partyPosition = ScriptGetVar(ctx); + *var = Field_CheckPokemonSizeRecord(fieldSystem, partyPosition); return FALSE; } BOOL ScrCmd_SetPokemonSizeRecord(ScriptContext *ctx) { // 01C2 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 partyPosition = ScriptGetVar(ctx); + u16 partyPosition = ScriptGetVar(ctx); Field_SetPokemonSizeRecord(fieldSystem, partyPosition); return FALSE; } BOOL ScrCmd_BufferPartyPokemonSize(ScriptContext *ctx) { // 01C3 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 intStrBuffer = ScriptGetVar(ctx); - u16 decimalStrBuffer = ScriptGetVar(ctx); - u16 partyPosition = ScriptGetVar(ctx); + u16 intStrBuffer = ScriptGetVar(ctx); + u16 decimalStrBuffer = ScriptGetVar(ctx); + u16 partyPosition = ScriptGetVar(ctx); Field_BufferPartyPokemonSize(fieldSystem, intStrBuffer, decimalStrBuffer, partyPosition); return FALSE; } BOOL ScrCmd_BufferPokemonRecordSize(ScriptContext *ctx) { // 01C4 FieldSystem *fieldSystem = ctx->fieldSystem; - u16 intStrBuffer = ScriptGetVar(ctx); - u16 decimalStrBuffer = ScriptGetVar(ctx); - u16 species = ScriptGetVar(ctx); + u16 intStrBuffer = ScriptGetVar(ctx); + u16 decimalStrBuffer = ScriptGetVar(ctx); + u16 species = ScriptGetVar(ctx); Field_BufferPokemonRecordSize(fieldSystem, intStrBuffer, decimalStrBuffer, species); return FALSE; } @@ -3542,34 +3542,34 @@ BOOL ScrCmd_InitPokemonRecordSize(ScriptContext *ctx) { // 01C5 BOOL ScrCmd_Unk01CC(ScriptContext *ctx) { // 01CC FieldSystem *fieldSystem = ctx->fieldSystem; - SaveVarsFlags *state = Save_VarsFlags_Get(fieldSystem->saveData); + SaveVarsFlags *state = Save_VarsFlags_Get(fieldSystem->saveData); sub_0205F2D4(state, 1); // set flag - u32 unk0 = sub_020289A4(fieldSystem->saveData); - u32 *unk1 = sub_020289B0(unk0, 1); + u32 unk0 = sub_020289A4(fieldSystem->saveData); + u32 *unk1 = sub_020289B0(unk0, 1); fieldSystem->unk98 = unk1; sub_02048C58(fieldSystem); return FALSE; } BOOL ScrCmd_Unk01CD(ScriptContext *ctx) { // 01CD - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); - u16 unk2 = ScriptGetVar(ctx); - u16 unk3 = ScriptGetVar(ctx); - u16 unk4 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); + u16 unk2 = ScriptGetVar(ctx); + u16 unk3 = ScriptGetVar(ctx); + u16 unk4 = ScriptGetVar(ctx); void **miscDataPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); // todo: identify this u32 unk5; // this will literally always be 1... GF why? switch (unk0 - 16) { case 0: - unk5 = 1; + unk5 = 1; *miscDataPtr = sub_02029120(4); break; case 1: - unk5 = 1; + unk5 = 1; *miscDataPtr = sub_0202912C(4); break; case 2: - unk5 = 1; + unk5 = 1; *miscDataPtr = sub_02029138(unk1, 4); break; case 3: @@ -3579,7 +3579,7 @@ BOOL ScrCmd_Unk01CD(ScriptContext *ctx) { // 01CD case 8: case 9: case 10: - unk5 = 1; + unk5 = 1; *miscDataPtr = sub_0202914C(unk0 - 19, unk1, 4); break; default: @@ -3604,7 +3604,7 @@ BOOL ScrCmd_Unk01D3(ScriptContext *ctx) { // 01D3 u16 unk0 = ScriptGetVar(ctx); u16 unk1 = ScriptGetVar(ctx); u16 *var = ScriptGetVarPointer(ctx); - *var = sub_020270D8(Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)), unk0, unk1); + *var = sub_020270D8(Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)), unk0, unk1); return FALSE; } @@ -3612,7 +3612,7 @@ BOOL ScrCmd_Unk01D4(ScriptContext *ctx) { // 01D4 u16 unk0 = ScriptGetVar(ctx); u16 unk1 = ScriptGetVar(ctx); u16 *var = ScriptGetVarPointer(ctx); - *var = unk1 <= sub_02027114(Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)), unk0); + *var = unk1 <= sub_02027114(Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)), unk0); return FALSE; } @@ -3625,14 +3625,14 @@ BOOL ScrCmd_Unk01D5(ScriptContext *ctx) { // 01D5 BOOL ScrCmd_Unk01D6(ScriptContext *ctx) { // 01D6 u16 unk0 = ScriptGetVar(ctx); u16 *var = ScriptGetVarPointer(ctx); - *var = sub_02027100(Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)), unk0); + *var = sub_02027100(Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)), unk0); return FALSE; } BOOL ScrCmd_CheckSinnohDexComplete(ScriptContext *ctx) { // 01E8 Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = FALSE; + u16 *var = ScriptGetVarPointer(ctx); + *var = FALSE; if (Pokedex_SinnohDexIsComplete(pokedex) == TRUE) { *var = TRUE; } @@ -3641,8 +3641,8 @@ BOOL ScrCmd_CheckSinnohDexComplete(ScriptContext *ctx) { // 01E8 BOOL ScrCmd_CheckNationalDexComplete(ScriptContext *ctx) { // 01E9 Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = FALSE; + u16 *var = ScriptGetVarPointer(ctx); + *var = FALSE; if (Pokedex_NationalDexIsComplete(pokedex) == TRUE) { *var = TRUE; } @@ -3651,14 +3651,14 @@ BOOL ScrCmd_CheckNationalDexComplete(ScriptContext *ctx) { // 01E9 BOOL ScrCmd_RegisterSinnohPokedex(ScriptContext *ctx) { // 01EA PokedexAppData **pokedexAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *pokedexAppData = sub_02038AF4(ctx->fieldSystem, HEAP_ID_32, FALSE); + *pokedexAppData = sub_02038AF4(ctx->fieldSystem, HEAP_ID_32, FALSE); SetupNativeScript(ctx, sub_0203BB90); return TRUE; } BOOL ScrCmd_RegisterNationalPokedex(ScriptContext *ctx) { // 01EB PokedexAppData **pokedexAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *pokedexAppData = sub_02038AF4(ctx->fieldSystem, HEAP_ID_32, TRUE); + *pokedexAppData = sub_02038AF4(ctx->fieldSystem, HEAP_ID_32, TRUE); SetupNativeScript(ctx, sub_0203BB90); return TRUE; } @@ -3670,7 +3670,7 @@ BOOL ScrCmd_Unk01EC(ScriptContext *ctx) { // 01EC BOOL ScrCmd_Unk01ED(ScriptContext *ctx) { // 01ED u16 *var = ScriptGetVarPointer(ctx); - *var = ov06_0224CC24(ctx->fieldSystem->saveData); + *var = ov06_0224CC24(ctx->fieldSystem->saveData); return FALSE; } @@ -3680,29 +3680,29 @@ BOOL ScrCmd_Unk01EF(ScriptContext *ctx) { // 01EF } BOOL ScrCmd_IncrementGameStat(ScriptContext *ctx) { // 01E5 - u16 stat = ScriptReadHalfword(ctx); + u16 stat = ScriptReadHalfword(ctx); GameStats *gameStats = Save_GameStats_Get(ctx->fieldSystem->saveData); GameStats_Inc(gameStats, stat); return FALSE; } BOOL ScrCmd_GetGameStat(ScriptContext *ctx) { // 01E6 - u16 stat = ScriptReadHalfword(ctx); + u16 stat = ScriptReadHalfword(ctx); u16 statHighVarNo = ScriptReadHalfword(ctx); - u16 statLowVarNo = ScriptReadHalfword(ctx); - u16 *statHighVar = GetVarPointer(ctx->fieldSystem, statHighVarNo); - u16 *statLowVar = GetVarPointer(ctx->fieldSystem, statLowVarNo); - u32 statVal = GameStats_GetCapped(Save_GameStats_Get(ctx->fieldSystem->saveData), stat); - *statHighVar = (u16)((statVal & 0xFFFF0000) >> 16); - *statLowVar = (u16)statVal; + u16 statLowVarNo = ScriptReadHalfword(ctx); + u16 *statHighVar = GetVarPointer(ctx->fieldSystem, statHighVarNo); + u16 *statLowVar = GetVarPointer(ctx->fieldSystem, statLowVarNo); + u32 statVal = GameStats_GetCapped(Save_GameStats_Get(ctx->fieldSystem->saveData), stat); + *statHighVar = (u16)((statVal & 0xFFFF0000) >> 16); + *statLowVar = (u16)statVal; return FALSE; } BOOL ScrCmd_SetGameStat(ScriptContext *ctx) { // 01E7 - u16 stat = ScriptReadHalfword(ctx); + u16 stat = ScriptReadHalfword(ctx); u16 valueHigh = ScriptReadHalfword(ctx); - u16 valueLow = ScriptReadHalfword(ctx); - u8 action = ScriptReadByte(ctx); + u16 valueLow = ScriptReadHalfword(ctx); + u8 action = ScriptReadByte(ctx); u32 value = ((valueHigh << 16) | valueLow); switch (action) { @@ -3721,11 +3721,11 @@ BOOL ScrCmd_SetGameStat(ScriptContext *ctx) { // 01E7 BOOL ScrCmd_EnableDisableSafariZone(ScriptContext *ctx) { // 0202 LocalFieldData *localFieldData = Save_LocalFieldData_Get(ctx->fieldSystem->saveData); - SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - SafariZone *safariZone = Save_SafariZone_Get(ctx->fieldSystem->saveData); - u8 action = ScriptReadByte(ctx); - u16 *safariBalls = LocalFieldData_GetSafariBallsCounter(localFieldData); - u16 *safariSteps = LocalFieldData_GetSafariStepsCounter(localFieldData); + SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + SafariZone *safariZone = Save_SafariZone_Get(ctx->fieldSystem->saveData); + u8 action = ScriptReadByte(ctx); + u16 *safariBalls = LocalFieldData_GetSafariBallsCounter(localFieldData); + u16 *safariSteps = LocalFieldData_GetSafariStepsCounter(localFieldData); switch (action) { case 0: // enable Save_VarsFlags_SetSafariSysFlag(varsFlags); @@ -3751,8 +3751,8 @@ BOOL ScrCmd_UseGreatMarshBinoculars(ScriptContext *ctx) { // 0206 BOOL ScrCmd_SpearPillarSequence(ScriptContext *ctx) { // 020D u8 operation = ScriptReadByte(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *var = SpearPillarSequence(ctx->fieldSystem, operation); + u16 *var = ScriptGetVarPointer(ctx); + *var = SpearPillarSequence(ctx->fieldSystem, operation); return TRUE; } @@ -3771,8 +3771,8 @@ BOOL ScrCmd_MoveSafariTrain(ScriptContext *ctx) { // 020F BOOL ScrCmd_CheckSafariTrainPosition(ScriptContext *ctx) { // 0210 u16 position = ScriptReadHalfword(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *var = ov06_02245340(ctx->fieldSystem, position); + u16 *var = ScriptGetVarPointer(ctx); + *var = ov06_02245340(ctx->fieldSystem, position); return FALSE; } @@ -3784,19 +3784,19 @@ BOOL ScrCmd_IgnoreHeights(ScriptContext *ctx) { // 0211 BOOL ScrCmd_GetSpiritombTalkCounter(ScriptContext *ctx) { // 0214 SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = Save_VarsFlags_GetSpiritombTalkCounter(varsFlags); + u16 *var = ScriptGetVarPointer(ctx); + *var = Save_VarsFlags_GetSpiritombTalkCounter(varsFlags); return FALSE; } BOOL ScrCmd_Unk0218(ScriptContext *ctx) { // 0218 - Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *speciesVar = ScriptGetVarPointer(ctx); - s32 sinnohSeen = Pokedex_CountSinnohDexSeen(pokedex); + Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); + u16 *speciesVar = ScriptGetVarPointer(ctx); + s32 sinnohSeen = Pokedex_CountSinnohDexSeen(pokedex); u16 randomSeenCount = LCRandom() % sinnohSeen; - *speciesVar = SPECIES_PIKACHU; - u16 i = SPECIES_BULBASAUR; - u16 speciesIndex = 0; + *speciesVar = SPECIES_PIKACHU; + u16 i = SPECIES_BULBASAUR; + u16 speciesIndex = 0; while (i <= NATIONAL_DEX_COUNT) { // can't do for loop - needed for matching if (Pokedex_CheckMonSeenFlag(pokedex, i) == TRUE && SpeciesToSinnohDexNo(i) != 0) { if (speciesIndex == randomSeenCount) { @@ -3811,7 +3811,7 @@ BOOL ScrCmd_Unk0218(ScriptContext *ctx) { // 0218 } BOOL ScrCmd_Unk0219(ScriptContext *ctx) { // 0219 - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); sub_0205F5A4(varsFlags, unk0); return FALSE; @@ -3819,7 +3819,7 @@ BOOL ScrCmd_Unk0219(ScriptContext *ctx) { // 0219 BOOL ScrCmd_Unk021A(ScriptContext *ctx) { // 021A u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205F594(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); + *var = sub_0205F594(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); return FALSE; } @@ -3836,28 +3836,28 @@ BOOL ScrCmd_CreateRoamer(ScriptContext *ctx) { // 021C BOOL ScrCmd_NPCTradeInit(ScriptContext *ctx) { // 0226 NPCTradeAppData **tradeAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - u8 tradeId = ScriptReadByte(ctx); - *tradeAppData = NPCTradeApp_Init(HEAP_ID_FIELD, tradeId); + u8 tradeId = ScriptReadByte(ctx); + *tradeAppData = NPCTradeApp_Init(HEAP_ID_FIELD, tradeId); return FALSE; } BOOL ScrCmd_NPCTradeGetOfferedSpecies(ScriptContext *ctx) { // 0227 NPCTradeAppData **tradeData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - u16 *var = ScriptGetVarPointer(ctx); - *var = NPCTradeApp_GetOfferedSpecies(*tradeData); + u16 *var = ScriptGetVarPointer(ctx); + *var = NPCTradeApp_GetOfferedSpecies(*tradeData); return FALSE; } BOOL ScrCmd_NPCTradeGetRequestedSpecies(ScriptContext *ctx) { // 0228 NPCTradeAppData **tradeData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - u16 *var = ScriptGetVarPointer(ctx); - *var = NPCTradeApp_GetRequestedSpecies(*tradeData); + u16 *var = ScriptGetVarPointer(ctx); + *var = NPCTradeApp_GetRequestedSpecies(*tradeData); return FALSE; } BOOL ScrCmd_NPCTradeExecute(ScriptContext *ctx) { // 0229 NPCTradeAppData **tradeData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MISC_DATA_PTR); - u16 partyPosition = ScriptGetVar(ctx); + u16 partyPosition = ScriptGetVar(ctx); CallTask_NPCTrade(ctx->taskManager, *tradeData, partyPosition, HEAP_ID_FIELD); return TRUE; } @@ -3880,8 +3880,8 @@ BOOL ScrCmd_UnlockGenderEntries(ScriptContext *ctx) { // 022C BOOL ScrCmd_NationalDex(ScriptContext *ctx) { // 022D u8 action = ScriptReadByte(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *var = 0; + u16 *var = ScriptGetVarPointer(ctx); + *var = 0; if (action == 1) { Pokedex_SetNatDexFlag(Save_Pokedex_Get(ctx->fieldSystem->saveData)); PlayerProfile_SetNatDexFlag(Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData)); @@ -3894,13 +3894,13 @@ BOOL ScrCmd_NationalDex(ScriptContext *ctx) { // 022D } BOOL ScrCmd_GetTotalPokemonEVs(ScriptContext *ctx) { // 0233 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); u16 partyPosition = ScriptGetVar(ctx); - Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyPosition); + Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyPosition); - u32 hpEv = GetMonData(mon, MON_DATA_HP_EV, NULL); - u32 atkEv = GetMonData(mon, MON_DATA_ATK_EV, NULL); - u32 defEv = GetMonData(mon, MON_DATA_DEF_EV, NULL); + u32 hpEv = GetMonData(mon, MON_DATA_HP_EV, NULL); + u32 atkEv = GetMonData(mon, MON_DATA_ATK_EV, NULL); + u32 defEv = GetMonData(mon, MON_DATA_DEF_EV, NULL); u32 speedEv = GetMonData(mon, MON_DATA_SPEED_EV, NULL); u32 spAtkEv = GetMonData(mon, MON_DATA_SPATK_EV, NULL); u32 spDefEv = GetMonData(mon, MON_DATA_SPDEF_EV, NULL); @@ -3924,13 +3924,13 @@ BOOL ScrCmd_Unk0239(ScriptContext *ctx) { // 0239 } BOOL ScrCmd_GetPokemonFootprint(ScriptContext *ctx) { // 023A - u16 *var = ScriptGetVarPointer(ctx); - u16 *var2 = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); + u16 *var2 = ScriptGetVarPointer(ctx); u16 partyPosition = ScriptGetVar(ctx); - Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyPosition); - u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); - *var = ov05_021F61E8(species); - *var2 = ov05_021F61DC(species); + Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), partyPosition); + u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + *var = ov05_021F61E8(species); + *var2 = ov05_021F61DC(species); return FALSE; } @@ -3942,17 +3942,17 @@ BOOL ScrCmd_PokecenterHealAnimation(ScriptContext *ctx) { // 023B BOOL ScrCmd_ElevatorAnimation(ScriptContext *ctx) { // 023C u16 direction = ScriptGetVar(ctx); - u16 length = ScriptGetVar(ctx); + u16 length = ScriptGetVar(ctx); ov06_0224C520(ctx->fieldSystem, direction, length); return TRUE; } BOOL ScrCmd_ShipAnimation(ScriptContext *ctx) { // 023D - u8 shipDirection = ScriptReadByte(ctx); + u8 shipDirection = ScriptReadByte(ctx); u8 playerOrientation = ScriptReadByte(ctx); - u16 destId = ScriptReadHalfword(ctx); - u16 destX = ScriptReadHalfword(ctx); - u16 destZ = ScriptReadHalfword(ctx); + u16 destId = ScriptReadHalfword(ctx); + u16 destX = ScriptReadHalfword(ctx); + u16 destZ = ScriptReadHalfword(ctx); sub_020607D4(ctx->fieldSystem, shipDirection, playerOrientation, destId, destX, destZ); return TRUE; @@ -3960,19 +3960,19 @@ BOOL ScrCmd_ShipAnimation(ScriptContext *ctx) { // 023D BOOL ScrCmd_GetGameVersion(ScriptContext *ctx) { // 0246 u16 *var = ScriptGetVarPointer(ctx); - *var = GAME_VERSION; + *var = GAME_VERSION; return FALSE; } BOOL ScrCmd_GiveWallpaper(ScriptContext *ctx) { // 0249 - used for easy chat unlock, todo: find better name - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(fieldSystem)); - u16 *var = ScriptGetVarPointer(ctx); - PCStorage *pcStorage = SaveArray_PCStorage_Get(fieldSystem->saveData); - u16 unk0 = ScriptGetVar(ctx); - u16 unk1 = ScriptGetVar(ctx); - u16 unk2 = ScriptGetVar(ctx); - u16 unk3 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + PCStorage *pcStorage = SaveArray_PCStorage_Get(fieldSystem->saveData); + u16 unk0 = ScriptGetVar(ctx); + u16 unk1 = ScriptGetVar(ctx); + u16 unk2 = ScriptGetVar(ctx); + u16 unk3 = ScriptGetVar(ctx); s32 wallpaperId = ov06_0224D14C(playerProfile, unk0, unk1, unk2, unk3); if (wallpaperId == -1 || wallpaperId > 7) { @@ -3991,7 +3991,7 @@ BOOL ScrCmd_GiveWallpaper(ScriptContext *ctx) { // 0249 - used for easy chat unl BOOL ScrCmd_Unk024A(ScriptContext *ctx) { // 024A SaveData *saveData = ctx->fieldSystem->saveData; - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); *var = sub_020269CC(sub_02026CB4(saveData)); return FALSE; @@ -3999,28 +3999,28 @@ BOOL ScrCmd_Unk024A(ScriptContext *ctx) { // 024A BOOL ScrCmd_Unk024B(ScriptContext *ctx) { // 024B - todo: PreparePCAnimation? FieldSystem *fieldSystem = ctx->fieldSystem; - u8 unk0 = ScriptReadByte(ctx); + u8 unk0 = ScriptReadByte(ctx); ov06_0224C678(fieldSystem, unk0); return FALSE; } BOOL ScrCmd_Unk024C(ScriptContext *ctx) { // 024C - todo: OpenPCAnimation? FieldSystem *fieldSystem = ctx->fieldSystem; - u8 unk0 = ScriptReadByte(ctx); + u8 unk0 = ScriptReadByte(ctx); ov06_0224C6E8(fieldSystem, unk0); return FALSE; } BOOL ScrCmd_Unk024D(ScriptContext *ctx) { // 024D - todo: ClosePCAnimation? FieldSystem *fieldSystem = ctx->fieldSystem; - u8 unk0 = ScriptReadByte(ctx); + u8 unk0 = ScriptReadByte(ctx); ov06_0224C6F4(fieldSystem, unk0); return FALSE; } static void Script_SetMonSeenFlagBySpecies(FieldSystem *fieldSystem, u16 species) { Pokedex *pokedex = Save_Pokedex_Get(fieldSystem->saveData); - Pokemon *mon = AllocMonZeroed(HEAP_ID_32); + Pokemon *mon = AllocMonZeroed(HEAP_ID_32); ZeroMonData(mon); CreateMon(mon, species, 50, 32, FALSE, 0, OT_ID_PLAYER_ID, 0); Pokedex_SetMonSeenFlag(pokedex, mon); @@ -4028,16 +4028,16 @@ static void Script_SetMonSeenFlagBySpecies(FieldSystem *fieldSystem, u16 species } BOOL ScrCmd_CountPCFreeSpace(ScriptContext *ctx) { // 0252 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); u16 count = PCStorage_CountMonsAndEggsInAllBoxes(SaveArray_PCStorage_Get(ctx->fieldSystem->saveData)); - *var = MONS_PER_BOX * NUM_BOXES - count; + *var = MONS_PER_BOX * NUM_BOXES - count; return FALSE; } BOOL ScrCmd_Unk0258(ScriptContext *ctx) { // 0258 - to do with player state types u32 *playerState = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_UNKNOWN_22); - *playerState = PLAYER_STATE_WALKING; - *playerState = ov05_021E7184(ctx->fieldSystem); + *playerState = PLAYER_STATE_WALKING; + *playerState = ov05_021E7184(ctx->fieldSystem); return TRUE; } @@ -4091,16 +4091,16 @@ BOOL ScrCmd_AddSpecialGameStat(ScriptContext *ctx) { // 0260 BOOL ScrCmd_CheckPokemonInParty(ScriptContext *ctx) { // 0262 u16 species = ScriptGetVar(ctx); - u16 *var = ScriptGetVarPointer(ctx); - *var = Party_HasMon(SaveArray_Party_Get(ctx->fieldSystem->saveData), species); + u16 *var = ScriptGetVarPointer(ctx); + *var = Party_HasMon(SaveArray_Party_Get(ctx->fieldSystem->saveData), species); return TRUE; } BOOL ScrCmd_SetDeoxysForm(ScriptContext *ctx) { // 0263 - u16 form = ScriptGetVar(ctx); + u16 form = ScriptGetVar(ctx); Party *playerParty = SaveArray_Party_Get(ctx->fieldSystem->saveData); - s32 partyCount = Party_GetCount(playerParty); - Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); + s32 partyCount = Party_GetCount(playerParty); + Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); for (s32 i = 0; i < partyCount; i++) { Pokemon *mon = Party_GetMonByIndex(playerParty, i); @@ -4115,9 +4115,9 @@ BOOL ScrCmd_SetDeoxysForm(ScriptContext *ctx) { // 0263 #ifdef NONMATCHING BOOL ScrCmd_CheckBurmyForms(ScriptContext *ctx) { // 0264 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); Party *playerParty = SaveArray_Party_Get(ctx->fieldSystem->saveData); - s32 partyCount = Party_GetCount(playerParty); + s32 partyCount = Party_GetCount(playerParty); u32 unk0[PARTY_SIZE]; memcpy(unk0, UNK_020F34FC, sizeof(unk0)); @@ -4127,11 +4127,11 @@ BOOL ScrCmd_CheckBurmyForms(ScriptContext *ctx) { // 0264 s32 j; BOOL hasMultiple; Pokemon *mon = Party_GetMonByIndex(playerParty, i); - u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL); - u32 form = GetMonData(mon, MON_DATA_FORM, NULL); + u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + u32 form = GetMonData(mon, MON_DATA_FORM, NULL); if (species == SPECIES_BURMY) { hasMultiple = FALSE; - unk0[i] = form; + unk0[i] = form; for (j = 0; j < i; j++) { if (unk0[j] == form) { hasMultiple = TRUE; @@ -4257,16 +4257,16 @@ BOOL ScrCmd_SlotMachine(ScriptContext *ctx) { // 0267 BOOL ScrCmd_GetHour(ScriptContext *ctx) { // 0268 u16 *var = ScriptGetVarPointer(ctx); - *var = Script_GetHour(ctx->fieldSystem); + *var = Script_GetHour(ctx->fieldSystem); return FALSE; } BOOL ScrCmd_ShakeEvent(ScriptContext *ctx) { // 0269 - u16 eventId = ScriptGetVar(ctx); - u16 count = ScriptGetVar(ctx); - u16 frames = ScriptGetVar(ctx); - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); + u16 count = ScriptGetVar(ctx); + u16 frames = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); LocalMapObject *mapObject = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, eventId); GF_ASSERT(mapObject != NULL); sub_02054F50(ctx->taskManager, mapObject, count, frames, x, y); @@ -4274,9 +4274,9 @@ BOOL ScrCmd_ShakeEvent(ScriptContext *ctx) { // 0269 } BOOL ScrCmd_BlinkEvent(ScriptContext *ctx) { // 026A - u16 eventId = ScriptGetVar(ctx); - u16 count = ScriptGetVar(ctx); - u16 frames = ScriptGetVar(ctx); + u16 eventId = ScriptGetVar(ctx); + u16 count = ScriptGetVar(ctx); + u16 frames = ScriptGetVar(ctx); LocalMapObject *mapObject = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, eventId); GF_ASSERT(mapObject != NULL); sub_0205502C(ctx->taskManager, mapObject, count, frames); @@ -4285,12 +4285,12 @@ BOOL ScrCmd_BlinkEvent(ScriptContext *ctx) { // 026A BOOL ScrCmd_CheckRegis(ScriptContext *ctx) { // 026B u16 *var = ScriptGetVarPointer(ctx); - *var = Save_PlayerHasAllRegisInParty(ctx->fieldSystem->saveData); + *var = Save_PlayerHasAllRegisInParty(ctx->fieldSystem->saveData); return FALSE; } BOOL ScrCmd_Unk026C(ScriptContext *ctx) { // 026C - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); FashionCase *fashionCase = Save_FashionData_GetFashionCase(Save_FashionData_Get(ctx->fieldSystem->saveData)); s32 i; u32 k; @@ -4322,7 +4322,7 @@ BOOL ScrCmd_Unk026C(ScriptContext *ctx) { // 026C BOOL ScrCmd_CheckGBACartridge(ScriptContext *ctx) { // 026E u16 *var = ScriptGetVarPointer(ctx); - *var = gSystem.gbaCartId; + *var = gSystem.gbaCartId; return TRUE; } @@ -4332,8 +4332,8 @@ BOOL ScrCmd_ResetSpiritombTalkCounter(ScriptContext *ctx) { // 026F } BOOL ScrCmd_Unk0270(ScriptContext *ctx) { // 0270 - todo: SetMatrixAlternativeMap - u16 alternativeId = ScriptGetVar(ctx); - u8 status = ScriptReadByte(ctx); + u16 alternativeId = ScriptGetVar(ctx); + u8 status = ScriptReadByte(ctx); SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); if (status) { @@ -4346,15 +4346,15 @@ BOOL ScrCmd_Unk0270(ScriptContext *ctx) { // 0270 - todo: SetMatrixAlternativeMa BOOL ScrCmd_BufferContestBackgroundName(ScriptContext *ctx) { // 0273 MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 bufferId = ScriptReadByte(ctx); - u16 backgroundId = ScriptGetVar(ctx); + u8 bufferId = ScriptReadByte(ctx); + u16 backgroundId = ScriptGetVar(ctx); BufferContestBackgroundName(*messageFormat, bufferId, backgroundId); return TRUE; } BOOL ScrCmd_Unk0275(ScriptContext *ctx) { // 0275 SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); if (sub_0205F6C8(varsFlags) >= 10) { *var = 1; } else { @@ -4365,7 +4365,7 @@ BOOL ScrCmd_Unk0275(ScriptContext *ctx) { // 0275 BOOL ScrCmd_Unk0277(ScriptContext *ctx) { // 0277 u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205F648(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); + *var = sub_0205F648(Save_VarsFlags_Get(ctx->fieldSystem->saveData)); return FALSE; } @@ -4387,10 +4387,10 @@ BOOL ScrCmd_Unk027B(ScriptContext *ctx) { // 027B } BOOL ScrCmd_BufferRandomTrendySaying(ScriptContext *ctx) { // 027D - u16 *var = ScriptGetVarPointer(ctx); - u16 fieldId = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + u16 fieldId = ScriptGetVar(ctx); MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u32 trendy = Save_EasyChat_SetRandomTrendySaying(Save_EasyChat_Get(ctx->fieldSystem->saveData)); + u32 trendy = Save_EasyChat_SetRandomTrendySaying(Save_EasyChat_Get(ctx->fieldSystem->saveData)); if (trendy == 32) { *var = -1; return FALSE; @@ -4402,21 +4402,21 @@ BOOL ScrCmd_BufferRandomTrendySaying(ScriptContext *ctx) { // 027D BOOL ScrCmd_Unk027F(ScriptContext *ctx) { // 027F u16 *var = ScriptGetVarPointer(ctx); - *var = Save_EasyChat_TrendySayingsUnlockedAllCheck(Save_EasyChat_Get(ctx->fieldSystem->saveData)) == TRUE; + *var = Save_EasyChat_TrendySayingsUnlockedAllCheck(Save_EasyChat_Get(ctx->fieldSystem->saveData)) == TRUE; return FALSE; } BOOL ScrCmd_Unk027E(ScriptContext *ctx) { // 027E SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205F710(varsFlags) >= 5; + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F710(varsFlags) >= 5; return FALSE; } BOOL ScrCmd_CheckBirthday(ScriptContext *ctx) { // 0282 - u16 *var = ScriptGetVarPointer(ctx); + u16 *var = ScriptGetVarPointer(ctx); FieldSystem *fieldSystem = ctx->fieldSystem; - SaveSysInfo *sysInfo = Save_SysInfo_Get(ctx->fieldSystem->saveData); + SaveSysInfo *sysInfo = Save_SysInfo_Get(ctx->fieldSystem->saveData); if (Save_SysInfo_GetBirthMonth(sysInfo) == Script_GetMonth(fieldSystem) && Save_SysInfo_GetBirthDay(sysInfo) == Script_GetDay(fieldSystem)) { *var = TRUE; } else { @@ -4427,16 +4427,16 @@ BOOL ScrCmd_CheckBirthday(ScriptContext *ctx) { // 0282 BOOL ScrCmd_CountSeenUnown(ScriptContext *ctx) { // 0284 Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = Pokedex_CountSeenUnown(pokedex); + u16 *var = ScriptGetVarPointer(ctx); + *var = Pokedex_CountSeenUnown(pokedex); return FALSE; } BOOL ScrCmd_Unk0285(ScriptContext *ctx) { // 0285 u16 unk0 = ScriptGetVar(ctx); u16 unk1 = ScriptGetVar(ctx); - u16 x = ctx->fieldSystem->location->x; - u16 y = ctx->fieldSystem->location->y; + u16 x = ctx->fieldSystem->location->x; + u16 y = ctx->fieldSystem->location->y; u16 unk2 = 0; if (unk0 >= 3) { @@ -4479,22 +4479,22 @@ BOOL ScrCmd_Unk0285(ScriptContext *ctx) { // 0285 BOOL ScrCmd_Unk0286(ScriptContext *ctx) { // 0286 SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205F720(varsFlags); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F720(varsFlags); return FALSE; } BOOL ScrCmd_Unk0287(ScriptContext *ctx) { // 0287 SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205F740(varsFlags); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F740(varsFlags); return FALSE; } BOOL ScrCmd_Unk0288(ScriptContext *ctx) { // 0288 SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205F760(varsFlags); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F760(varsFlags); return FALSE; } @@ -4505,11 +4505,11 @@ BOOL ScrCmd_Unk0289(ScriptContext *ctx) { // 0289 for (s32 i = 0; i < 5; i++) { bytes[i] = ScriptReadByte(ctx); } - u8 unk0 = ScriptReadByte(ctx); - Poffin *poffin = Poffin_New(HEAP_ID_4); - u32 unk1 = sub_02027F04(poffin, bytes, unk0, 0); + u8 unk0 = ScriptReadByte(ctx); + Poffin *poffin = Poffin_New(HEAP_ID_4); + u32 unk1 = sub_02027F04(poffin, bytes, unk0, 0); SavePoffinData *poffinSave = Save_PoffinData_Get(ctx->fieldSystem->saveData); - u16 unk2 = sub_02028094(poffinSave, poffin); + u16 unk2 = sub_02028094(poffinSave, poffin); FreeToHeap(poffin); if (unk2 == 0xFFFF) { @@ -4531,8 +4531,8 @@ BOOL ScrCmd_Unk028A(ScriptContext *ctx) { // 028A } BOOL ScrCmd_CheckEventValidity(ScriptContext *ctx) { // 028B - u8 eventId = ScriptReadByte(ctx); - u16 *var = ScriptGetVarPointer(ctx); + u8 eventId = ScriptReadByte(ctx); + u16 *var = ScriptGetVarPointer(ctx); SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); GF_ASSERT(eventId <= 3); *var = sub_0205F4A0(varsFlags, eventId); @@ -4561,16 +4561,16 @@ BOOL ScrCmd_Unk028F(ScriptContext *ctx) { // 028F } BOOL ScrCmd_Unk0290(ScriptContext *ctx) { // 0290 - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); void **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); // todo: find out what this is - *runningAppData = sub_02037A48(HEAP_ID_32, ctx->fieldSystem, unk0); + *runningAppData = sub_02037A48(HEAP_ID_32, ctx->fieldSystem, unk0); SetupNativeScript(ctx, sub_0203BC04); return TRUE; } BOOL ScrCmd_Unk0291(ScriptContext *ctx) { // 0291 - u16 *var1 = ScriptGetVarPointer(ctx); - u16 *var2 = ScriptGetVarPointer(ctx); + u16 *var1 = ScriptGetVarPointer(ctx); + u16 *var2 = ScriptGetVarPointer(ctx); PartyMenuAppData **partyMenu = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); GF_ASSERT(*partyMenu != NULL); *var1 = sub_02037A40(*partyMenu); @@ -4591,13 +4591,13 @@ BOOL ScrCmd_Unk0292(ScriptContext *ctx) { // 0292 limit = 100; } u16 rnd = LCRandom() % 101; - *var = (rnd <= limit); + *var = (rnd <= limit); return FALSE; } BOOL ScrCmd_Unk029E(ScriptContext *ctx) { // 029E - u16 unk0 = ScriptGetVar(ctx); - u16 *var = ScriptGetVarPointer(ctx); + u16 unk0 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); FieldSystem *fieldSystem = ctx->fieldSystem; switch (unk0) { case 0: @@ -4618,8 +4618,8 @@ BOOL ScrCmd_Unk029E(ScriptContext *ctx) { // 029E BOOL ScrCmd_Unk0293(ScriptContext *ctx) { // 0293 SaveVarsFlags *varsFlags = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0205F6A8(varsFlags); + u16 *var = ScriptGetVarPointer(ctx); + *var = sub_0205F6A8(varsFlags); return FALSE; } @@ -4635,19 +4635,19 @@ BOOL ScrCmd_ShakeCamera(ScriptContext *ctx) { // 029F BOOL ScrCmd_Unk02A3(ScriptContext *ctx) { // 02A3 u16 *var = ScriptGetVarPointer(ctx); - *var = sub_0203384C(ctx->fieldSystem->saveData); + *var = sub_0203384C(ctx->fieldSystem->saveData); return FALSE; } BOOL ScrCmd_Unk02A4(ScriptContext *ctx) { // 02A4 u16 *var = ScriptGetVarPointer(ctx); - *var = sub_02028448(sub_020286EC(ctx->fieldSystem->saveData)); + *var = sub_02028448(sub_020286EC(ctx->fieldSystem->saveData)); return FALSE; } BOOL ScrCmd_Unk02A2(ScriptContext *ctx) { // 02A2 u16 unk0 = ScriptGetVar(ctx); - u32 res = sub_02026CC4(ctx->fieldSystem->saveData); + u32 res = sub_02026CC4(ctx->fieldSystem->saveData); u16 unk1 = unk0 + 0xFF79; // this is weird if (unk1 <= 1) { sub_02025C30(res); @@ -4658,7 +4658,7 @@ BOOL ScrCmd_Unk02A2(ScriptContext *ctx) { // 02A2 BOOL ScrCmd_Unk02A7(ScriptContext *ctx) { // 02A7 u16 unk0 = ScriptGetVar(ctx); u16 *var = ScriptGetVarPointer(ctx); - *var = 0; + *var = 0; if (unk0 >= 0x12A && unk0 <= 0x139) { *var = 1; } @@ -4666,20 +4666,20 @@ BOOL ScrCmd_Unk02A7(ScriptContext *ctx) { // 02A7 } BOOL ScrCmd_CompareMysteryGiftEasyChatInput(ScriptContext *ctx) { // 02AA - u16 *var = ScriptGetVarPointer(ctx); - u16 word0 = ScriptGetVar(ctx); - u16 word1 = ScriptGetVar(ctx); - u16 word2 = ScriptGetVar(ctx); - u16 word3 = ScriptGetVar(ctx); + u16 *var = ScriptGetVarPointer(ctx); + u16 word0 = ScriptGetVar(ctx); + u16 word1 = ScriptGetVar(ctx); + u16 word2 = ScriptGetVar(ctx); + u16 word3 = ScriptGetVar(ctx); MessageFormat *messageFormat = MessageFormat_New(HEAP_ID_32); - MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0327_bin, HEAP_ID_32); + MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_MSGDATA_MSG, NARC_msg_narc_0327_bin, HEAP_ID_32); BufferECWord(messageFormat, 0, word0); BufferECWord(messageFormat, 1, word1); BufferECWord(messageFormat, 2, word2); BufferECWord(messageFormat, 3, word3); - String *userInput = ReadMsgData_ExpandPlaceholders(messageFormat, msgData, narc_0327_00001, HEAP_ID_32); + String *userInput = ReadMsgData_ExpandPlaceholders(messageFormat, msgData, narc_0327_00001, HEAP_ID_32); String *targetString = NewString_ReadMsgData(msgData, narc_0327_00000); - *var = String_Compare(userInput, targetString) == FALSE; + *var = String_Compare(userInput, targetString) == FALSE; String_Delete(userInput); String_Delete(targetString); DestroyMsgData(msgData); @@ -4693,10 +4693,10 @@ BOOL ScrCmd_ActivateMysteryGift(ScriptContext *ctx) { // 02AC } BOOL ScrCmd_Unk02AF(ScriptContext *ctx) { // 02AF - FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *var = ScriptGetVarPointer(ctx); + FieldSystem *fieldSystem = ctx->fieldSystem; + u16 *var = ScriptGetVarPointer(ctx); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - *var = sub_0205296C(*messageFormat); + *var = sub_0205296C(*messageFormat); return FALSE; } @@ -4716,21 +4716,21 @@ BOOL ScrCmd_Unk02B2(ScriptContext *ctx) { // 02B2 } BOOL ScrCmd_Unk02B5(ScriptContext *ctx) { // 02B5 - u16 mapId = ScriptGetVar(ctx); - u16 x = ScriptGetVar(ctx); - u16 y = ScriptGetVar(ctx); - Location *specialSpawn = LocalFieldData_GetSpecialSpawnWarpPtr(Save_LocalFieldData_Get(ctx->fieldSystem->saveData)); - specialSpawn->mapId = mapId; - specialSpawn->x = x; - specialSpawn->y = y; - specialSpawn->warpId = -1; + u16 mapId = ScriptGetVar(ctx); + u16 x = ScriptGetVar(ctx); + u16 y = ScriptGetVar(ctx); + Location *specialSpawn = LocalFieldData_GetSpecialSpawnWarpPtr(Save_LocalFieldData_Get(ctx->fieldSystem->saveData)); + specialSpawn->mapId = mapId; + specialSpawn->x = x; + specialSpawn->y = y; + specialSpawn->warpId = -1; specialSpawn->direction = DIR_SOUTH; return FALSE; } BOOL ScrCmd_Unk02B6(ScriptContext *ctx) { // 02B6 - u16 objectId = ScriptGetVar(ctx); - BOOL clear = (BOOL)ScriptReadByte(ctx); + u16 objectId = ScriptGetVar(ctx); + BOOL clear = (BOOL)ScriptReadByte(ctx); LocalMapObject *object = MapObjectManager_GetFirstActiveObjectByID(ctx->fieldSystem->mapObjectManager, objectId); GF_ASSERT(object != NULL); MapObject_ClearFlag18(object, clear); @@ -4739,13 +4739,13 @@ BOOL ScrCmd_Unk02B6(ScriptContext *ctx) { // 02B6 BOOL ScrCmd_GetTrainerCardLevel(ScriptContext *ctx) { // 02BE FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *var = ScriptGetVarPointer(ctx); - *var = GetTrainerCardLevel(fieldSystem); + u16 *var = ScriptGetVarPointer(ctx); + *var = GetTrainerCardLevel(fieldSystem); return FALSE; } BOOL ScrCmd_ShowSaveStats(ScriptContext *ctx) { // 02C1 - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; SaveStatsPrinter **saveStatsPrinter = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SAVE_STATS_PRINTER); if (!Save_FileDoesNotBelongToPlayer(fieldSystem->saveData)) { *saveStatsPrinter = Field_SaveStatsPrinter_New(fieldSystem, HEAP_ID_4, 3); @@ -4755,7 +4755,7 @@ BOOL ScrCmd_ShowSaveStats(ScriptContext *ctx) { // 02C1 } BOOL ScrCmd_HideSaveStats(ScriptContext *ctx) { // 02C2 - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; SaveStatsPrinter **saveStatsPrinter = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_SAVE_STATS_PRINTER); if (!Save_FileDoesNotBelongToPlayer(fieldSystem->saveData)) { Field_SaveStatsPrinter_RemoveFromScreen(*saveStatsPrinter); diff --git a/arm9/src/scrcmd_13.c b/arm9/src/scrcmd_13.c index ef89ac5c3..1d5b9ceea 100644 --- a/arm9/src/scrcmd_13.c +++ b/arm9/src/scrcmd_13.c @@ -24,7 +24,7 @@ extern void sub_0208089C(struct Pokemon *pokemon, PlayerProfile *player, u32 a2, BOOL ScrCmd_Unk0253(struct ScriptContext *ctx) // 0253 { struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u16 unk = ScriptGetVar(ctx); + u16 unk = ScriptGetVar(ctx); if (unk == 0) { sub_0205F224(state); @@ -41,9 +41,9 @@ BOOL ScrCmd_Unk0253(struct ScriptContext *ctx) // 0253 BOOL ScrCmd_Unk0254(struct ScriptContext *ctx) // 0254 { - void *unk = sub_02022528(ctx->fieldSystem->saveData); + void *unk = sub_02022528(ctx->fieldSystem->saveData); struct Pokemon *pokemon = AllocMonZeroed(HEAP_ID_32); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); u16 eggs = sub_0202C000(unk); if (eggs == 6) { @@ -59,10 +59,10 @@ BOOL ScrCmd_Unk0254(struct ScriptContext *ctx) // 0254 BOOL ScrCmd_Unk0255(struct ScriptContext *ctx) // 0255 { - void *unk = sub_02022528(ctx->fieldSystem->saveData); - struct PCStorage *pc = SaveArray_PCStorage_Get(ctx->fieldSystem->saveData); + void *unk = sub_02022528(ctx->fieldSystem->saveData); + struct PCStorage *pc = SaveArray_PCStorage_Get(ctx->fieldSystem->saveData); struct Pokemon *pokemon = AllocMonZeroed(HEAP_ID_32); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); struct Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); // unused for (s32 i = 0; i < PARTY_SIZE; i++) { @@ -83,7 +83,7 @@ BOOL ScrCmd_Unk0255(struct ScriptContext *ctx) // 0255 BOOL ScrCmd_Unk0256(struct ScriptContext *ctx) // 0256 { - u16 unk = ScriptGetVar(ctx); + u16 unk = ScriptGetVar(ctx); u16 *ret_ptr = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx)); switch (unk) { diff --git a/arm9/src/scrcmd_amity_square.c b/arm9/src/scrcmd_amity_square.c index cb487f7d4..54f1c9751 100644 --- a/arm9/src/scrcmd_amity_square.c +++ b/arm9/src/scrcmd_amity_square.c @@ -106,7 +106,7 @@ BOOL ScrCmd_ClearAmitySquareSteps(struct ScriptContext *ctx) // 0215 BOOL ScrCmd_CheckAmitySquareSteps(struct ScriptContext *ctx) // 0216 { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); *ret_ptr = sub_0205F55C(state); @@ -116,8 +116,8 @@ BOOL ScrCmd_CheckAmitySquareSteps(struct ScriptContext *ctx) // 0216 BOOL ScrCmd_GetAmitySquareAccessory(struct ScriptContext *ctx) // 0217 { u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 species = ScriptGetVar(ctx); - u16 rand = (u16)(LCRandom() % 100); + u16 species = ScriptGetVar(ctx); + u16 rand = (u16)(LCRandom() % 100); u32 j; if (rand < 15) { diff --git a/arm9/src/scrcmd_berry_trees.c b/arm9/src/scrcmd_berry_trees.c index bb33b9910..f5b3ce016 100644 --- a/arm9/src/scrcmd_berry_trees.c +++ b/arm9/src/scrcmd_berry_trees.c @@ -17,7 +17,7 @@ extern void sub_0204B9A0(struct FieldSystem *); extern void sub_0204B4FC(struct FieldSystem *, LocalMapObject *berryTree); BOOL ScrCmd_GetBerryTreeGrowth(struct ScriptContext *ctx) { // 017D - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); *ret_ptr = sub_0204B5FC(ctx->fieldSystem, *berryTree); @@ -27,7 +27,7 @@ BOOL ScrCmd_GetBerryTreeGrowth(struct ScriptContext *ctx) { // 017D BOOL ScrCmd_GetBerryTreeType(struct ScriptContext *ctx) { // 017E LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = sub_0204B63C(ctx->fieldSystem, *berryTree); @@ -36,7 +36,7 @@ BOOL ScrCmd_GetBerryTreeType(struct ScriptContext *ctx) { // 017E BOOL ScrCmd_GetBerryTreeMulch(struct ScriptContext *ctx) { // 017F LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = sub_0204B660(ctx->fieldSystem, *berryTree); @@ -45,7 +45,7 @@ BOOL ScrCmd_GetBerryTreeMulch(struct ScriptContext *ctx) { // 017F BOOL ScrCmd_GetBerryTreeWater(struct ScriptContext *ctx) { // 0180 LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = sub_0204B684(ctx->fieldSystem, *berryTree); @@ -54,7 +54,7 @@ BOOL ScrCmd_GetBerryTreeWater(struct ScriptContext *ctx) { // 0180 BOOL ScrCmd_GetBerryTreeAmount(struct ScriptContext *ctx) { // 0181 LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = sub_0204B6A4(ctx->fieldSystem, *berryTree); @@ -63,7 +63,7 @@ BOOL ScrCmd_GetBerryTreeAmount(struct ScriptContext *ctx) { // 0181 BOOL ScrCmd_SetBerryTreeMulch(struct ScriptContext *ctx) { // 0182 LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); - u16 mulchVal = ScriptGetVar(ctx); + u16 mulchVal = ScriptGetVar(ctx); sub_0204B57C(ctx->fieldSystem, *berryTree, mulchVal); @@ -72,9 +72,9 @@ BOOL ScrCmd_SetBerryTreeMulch(struct ScriptContext *ctx) { // 0182 BOOL ScrCmd_SetBerryTreeType(struct ScriptContext *ctx) // 0183 - todo: PlantBerryTree? { - LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); + LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); struct GameStats *gameStats = Save_GameStats_Get(ctx->fieldSystem->saveData); - u16 treeType = ScriptGetVar(ctx); + u16 treeType = ScriptGetVar(ctx); sub_0204B5A8(ctx->fieldSystem, *berryTree, treeType); GameStats_Inc(gameStats, 3); @@ -104,7 +104,7 @@ BOOL ScrCmd_Unk0184(struct ScriptContext *ctx) // 0184 - todo: SetBerryTreeWater BOOL ScrCmd_TakeBerryTreeBerries(struct ScriptContext *ctx) // 0185 { struct GameStats *gameStats = Save_GameStats_Get(ctx->fieldSystem->saveData); - LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); + LocalMapObject **berryTree = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); sub_0204B4FC(ctx->fieldSystem, *berryTree); GameStats_AddSpecial(gameStats, 0); diff --git a/arm9/src/scrcmd_coins.c b/arm9/src/scrcmd_coins.c index 1478b617d..9c51586de 100644 --- a/arm9/src/scrcmd_coins.c +++ b/arm9/src/scrcmd_coins.c @@ -12,12 +12,12 @@ extern void ov05_021E29C8(struct FieldSystem *arg, Window *coinBox); BOOL ScrCmd_ShowCoinBox(struct ScriptContext *ctx) // 0075 { struct FieldSystem *sav_ptr = ctx->fieldSystem; - u16 xVal = ScriptGetVar(ctx); - u16 yVal = ScriptGetVar(ctx); - Window **coinBoxPtr = (Window **)FieldSysGetAttrAddr(sav_ptr, SCRIPTENV_COIN_BOX); + u16 xVal = ScriptGetVar(ctx); + u16 yVal = ScriptGetVar(ctx); + Window **coinBoxPtr = (Window **)FieldSysGetAttrAddr(sav_ptr, SCRIPTENV_COIN_BOX); Window *coinBox = ov05_021E2950(ctx->fieldSystem, (u8)xVal, (u8)yVal); - *coinBoxPtr = coinBox; + *coinBoxPtr = coinBox; return FALSE; } @@ -41,7 +41,7 @@ BOOL ScrCmd_UpdateCoinBox(struct ScriptContext *ctx) // 0077 BOOL ScrCmd_GetCoins(struct ScriptContext *ctx) // 0078 - todo: CheckCoins instead? { u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = CheckCoins(coins_ptr); @@ -51,7 +51,7 @@ BOOL ScrCmd_GetCoins(struct ScriptContext *ctx) // 0078 - todo: CheckCoins inste BOOL ScrCmd_GiveCoins(struct ScriptContext *ctx) // 0079 { u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData); - u16 amount = ScriptGetVar(ctx); + u16 amount = ScriptGetVar(ctx); GiveCoins(coins_ptr, amount); @@ -61,7 +61,7 @@ BOOL ScrCmd_GiveCoins(struct ScriptContext *ctx) // 0079 BOOL ScrCmd_TakeCoinsImmediate(struct ScriptContext *ctx) // 0080 - todo: TakeCoins instead? { u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData); - u16 amount = ScriptGetVar(ctx); + u16 amount = ScriptGetVar(ctx); TakeCoins(coins_ptr, amount); @@ -71,7 +71,7 @@ BOOL ScrCmd_TakeCoinsImmediate(struct ScriptContext *ctx) // 0080 - todo: TakeCo BOOL ScrCmd_TakeCoinsAddress(struct ScriptContext *ctx) // 02A8 - todo: TakeCoinsVar instead? { u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData); - u16 *amount = ScriptGetVarPointer(ctx); + u16 *amount = ScriptGetVarPointer(ctx); TakeCoins(coins_ptr, *amount); @@ -81,14 +81,14 @@ BOOL ScrCmd_TakeCoinsAddress(struct ScriptContext *ctx) // 02A8 - todo: TakeCoin BOOL ScrCmd_HasEnoughCoinsImmediate(struct ScriptContext *ctx) // 0274 - todo: CanAffordCoins? { struct FieldSystem *fieldSystem = ctx->fieldSystem; - struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); + struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); // Created, but discarded. PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); - u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData); + u16 *ret_ptr = ScriptGetVarPointer(ctx); u32 amount = ScriptReadWord(ctx); - u16 coins = CheckCoins(coins_ptr); + u16 coins = CheckCoins(coins_ptr); if (coins < amount) { *ret_ptr = 0; @@ -102,14 +102,14 @@ BOOL ScrCmd_HasEnoughCoinsImmediate(struct ScriptContext *ctx) // 0274 - todo: C BOOL ScrCmd_HasEnoughCoinsAddress(struct ScriptContext *ctx) // 02A9 - todo: CanAffordCoinsVar? { struct FieldSystem *fieldSystem = ctx->fieldSystem; - struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); + struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); // Created, but discarded PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); - u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData); + u16 *ret_ptr = ScriptGetVarPointer(ctx); u16 amount = *ScriptGetVarPointer(ctx); - u16 coins = CheckCoins(coins_ptr); + u16 coins = CheckCoins(coins_ptr); if (coins < amount) { *ret_ptr = 0; @@ -123,8 +123,8 @@ BOOL ScrCmd_HasEnoughCoinsAddress(struct ScriptContext *ctx) // 02A9 - todo: Can BOOL ScrCmd_CanGiveCoins(struct ScriptContext *ctx) // 0276 { u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 amount = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 amount = ScriptGetVar(ctx); *ret_ptr = (u16)CanGiveCoins(coins_ptr, amount); diff --git a/arm9/src/scrcmd_daycare.c b/arm9/src/scrcmd_daycare.c index 4f48cccf6..ca03ff428 100644 --- a/arm9/src/scrcmd_daycare.c +++ b/arm9/src/scrcmd_daycare.c @@ -21,9 +21,9 @@ extern u32 ov05_021ED644(struct Daycare *daycare); BOOL ScrCmd_GetDaycarePokemonNames(struct ScriptContext *ctx) // 016D { - struct SaveData *save = ctx->fieldSystem->saveData; + struct SaveData *save = ctx->fieldSystem->saveData; MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - struct Daycare *daycare = Save_Daycare_Get(save); + struct Daycare *daycare = Save_Daycare_Get(save); ov05_021ED4E0(daycare, *messageFormat); @@ -33,9 +33,9 @@ BOOL ScrCmd_GetDaycarePokemonNames(struct ScriptContext *ctx) // 016D BOOL ScrCmd_GetDaycareStatus(struct ScriptContext *ctx) // 016E { struct FieldSystem *fieldSystem = ctx->fieldSystem; - struct SaveData *save = fieldSystem->saveData; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - struct Daycare *daycare = SaveArray_Get(save, 8); + struct SaveData *save = fieldSystem->saveData; + u16 *ret_ptr = ScriptGetVarPointer(ctx); + struct Daycare *daycare = SaveArray_Get(save, 8); *ret_ptr = ov05_021ED5EC(daycare); @@ -53,10 +53,10 @@ BOOL ScrCmd_DeleteDaycareEgg(struct ScriptContext *ctx) // 01A8 BOOL ScrCmd_GiveDaycareEgg(struct ScriptContext *ctx) // 01A9 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - struct Daycare *daycare = SaveArray_Get(fieldSystem->saveData, 8); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + struct Daycare *daycare = SaveArray_Get(fieldSystem->saveData, 8); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); + PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); ov05_Daycare_GiveEggToPlayer(daycare, party, player); @@ -66,12 +66,12 @@ BOOL ScrCmd_GiveDaycareEgg(struct ScriptContext *ctx) // 01A9 BOOL ScrCmd_Unk01A4(struct ScriptContext *ctx) // 01A4 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - struct SaveData *save = fieldSystem->saveData; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 idx = ScriptGetVar(ctx); - struct Daycare *daycare = SaveArray_Get(save, 8); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + struct SaveData *save = fieldSystem->saveData; + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 idx = ScriptGetVar(ctx); + struct Daycare *daycare = SaveArray_Get(save, 8); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); *ret_ptr = ov05_021EC71C(party, *messageFormat, daycare, (u8)idx); @@ -81,11 +81,11 @@ BOOL ScrCmd_Unk01A4(struct ScriptContext *ctx) // 01A4 BOOL ScrCmd_Unk01AA(struct ScriptContext *ctx) // 01AA { struct FieldSystem *fieldSystem = ctx->fieldSystem; - MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - struct SaveData *save = fieldSystem->saveData; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 idx = ScriptGetVar(ctx); - struct Daycare *daycare = SaveArray_Get(save, 8); + MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + struct SaveData *save = fieldSystem->saveData; + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 idx = ScriptGetVar(ctx); + struct Daycare *daycare = SaveArray_Get(save, 8); *ret_ptr = ov05_021EC854(daycare, (u8)idx, *messageFormat); @@ -94,11 +94,11 @@ BOOL ScrCmd_Unk01AA(struct ScriptContext *ctx) // 01AA BOOL ScrCmd_GetDaycareLevel(struct ScriptContext *ctx) // 01AE { - struct SaveData *save = ctx->fieldSystem->saveData; + struct SaveData *save = ctx->fieldSystem->saveData; MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 idx = ScriptGetVar(ctx); - struct Daycare *daycare = SaveArray_Get(save, 8); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 idx = ScriptGetVar(ctx); + struct Daycare *daycare = SaveArray_Get(save, 8); *ret_ptr = ov05_021EC864(daycare, idx, *messageFormat); @@ -108,11 +108,11 @@ BOOL ScrCmd_GetDaycareLevel(struct ScriptContext *ctx) // 01AE BOOL ScrCmd_Unk01AF(struct ScriptContext *ctx) // 01AF { struct FieldSystem *fieldSystem = ctx->fieldSystem; - MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u16 unused = ScriptReadHalfword(ctx); - u16 idx = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + u16 unused = ScriptReadHalfword(ctx); + u16 idx = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); *ret_ptr = ov05_021ED5C4(party, idx, *messageFormat); @@ -122,10 +122,10 @@ BOOL ScrCmd_Unk01AF(struct ScriptContext *ctx) // 01AF BOOL ScrCmd_Unk01B0(struct ScriptContext *ctx) // 01B0 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - struct SaveData *save = fieldSystem->saveData; - u16 idx = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Daycare *daycare = SaveArray_Get(save, 8); + struct SaveData *save = fieldSystem->saveData; + u16 idx = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Daycare *daycare = SaveArray_Get(save, 8); ov05_021EC57C(party, (u8)idx, daycare, save); @@ -134,13 +134,13 @@ BOOL ScrCmd_Unk01B0(struct ScriptContext *ctx) // 01B0 BOOL ScrCmd_Unk01BC(struct ScriptContext *ctx) // 01BC { - struct SaveData *save = ctx->fieldSystem->saveData; + struct SaveData *save = ctx->fieldSystem->saveData; MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u16 idx1 = ScriptGetVar(ctx); - u16 idx2 = ScriptGetVar(ctx); - u16 idx3 = ScriptGetVar(ctx); - u16 idx4 = ScriptGetVar(ctx); - struct Daycare *daycare = Save_Daycare_Get(save); + u16 idx1 = ScriptGetVar(ctx); + u16 idx2 = ScriptGetVar(ctx); + u16 idx3 = ScriptGetVar(ctx); + u16 idx4 = ScriptGetVar(ctx); + struct Daycare *daycare = Save_Daycare_Get(save); ov05_021ED52C(daycare, (u8)idx1, (u8)idx2, (u8)idx3, (u8)idx4, *messageFormat); @@ -149,8 +149,8 @@ BOOL ScrCmd_Unk01BC(struct ScriptContext *ctx) // 01BC BOOL ScrCmd_Unk01BE(struct ScriptContext *ctx) // 01BE { - struct SaveData *save = ctx->fieldSystem->saveData; - u16 *ret_ptr = ScriptGetVarPointer(ctx); + struct SaveData *save = ctx->fieldSystem->saveData; + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct Daycare *daycare = SaveArray_Get(save, 8); *ret_ptr = (u16)ov05_021ED644(daycare); @@ -160,8 +160,8 @@ BOOL ScrCmd_Unk01BE(struct ScriptContext *ctx) // 01BE BOOL ScrCmd_Unk01BF(struct ScriptContext *ctx) // 01BF - todo: SaveEggPID? { - struct SaveData *save = ctx->fieldSystem->saveData; - u16 *ret_ptr = ScriptGetVarPointer(ctx); + struct SaveData *save = ctx->fieldSystem->saveData; + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct Daycare *daycare = SaveArray_Get(save, 8); *ret_ptr = (u16)Save_Daycare_GetEggPID(daycare); diff --git a/arm9/src/scrcmd_flags.c b/arm9/src/scrcmd_flags.c index d563823f8..a95aa6ba9 100644 --- a/arm9/src/scrcmd_flags.c +++ b/arm9/src/scrcmd_flags.c @@ -40,7 +40,7 @@ const u8 UNK_020F457F[8] = { BOOL ScrCmd_HasSinnohDex(struct ScriptContext *ctx) // 0157 { struct Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = (u16)Pokedex_GetSinnohDexFlag(pokedex); @@ -58,9 +58,9 @@ BOOL ScrCmd_GiveSinnohDex(struct ScriptContext *ctx) // 0158 BOOL ScrCmd_HasRunningShoes(struct ScriptContext *ctx) // 0159 { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); void *unk_sav_ptr = Save_LocalFieldData_Get(ctx->fieldSystem->saveData); - void *unk = sub_02034E20(unk_sav_ptr); + void *unk = sub_02034E20(unk_sav_ptr); *ret_ptr = (u16)sub_02055474(unk); @@ -70,7 +70,7 @@ BOOL ScrCmd_HasRunningShoes(struct ScriptContext *ctx) // 0159 BOOL ScrCmd_GiveRunningShoes(struct ScriptContext *ctx) // 015A { void *unk_sav_ptr = Save_LocalFieldData_Get(ctx->fieldSystem->saveData); - void *unk = sub_02034E20(unk_sav_ptr); + void *unk = sub_02034E20(unk_sav_ptr); sub_02055488(unk, 1); @@ -102,7 +102,7 @@ BOOL ScrCmd_GiveBadge(struct ScriptContext *ctx) // 015C BOOL ScrCmd_HasBag(struct ScriptContext *ctx) // 015E { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); *ret_ptr = (u16)sub_0205ECE0(state); @@ -118,7 +118,7 @@ BOOL ScrCmd_GetTotalEarnedBadges(struct ScriptContext *ctx) // 015D - todo: Coun u16 badges; for (i = 0, badges = 0; i < 8; i++) { PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); - BOOL has_badge = PlayerProfile_TestBadgeFlag(player, UNK_020F457F[i]); + BOOL has_badge = PlayerProfile_TestBadgeFlag(player, UNK_020F457F[i]); if (has_badge == TRUE) { badges++; } @@ -139,7 +139,7 @@ BOOL ScrCmd_GiveBag(struct ScriptContext *ctx) // 015F BOOL ScrCmd_Unk0160(struct ScriptContext *ctx) // 0160 - todo: HasPartner? CheckPartner? { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); *ret_ptr = (u16)Save_VarsFlags_CheckHaveFollower(state); @@ -167,7 +167,7 @@ BOOL ScrCmd_Unk0162(struct ScriptContext *ctx) // 0162 - todo: RemovePartner? Cl BOOL ScrCmd_Unk0163(struct ScriptContext *ctx) // 0163 - todo: GetSteps? CheckSteps? GetStepFlag? CheckStepFlag? { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); *ret_ptr = (u16)sub_0205ED6C(state); @@ -195,7 +195,7 @@ BOOL ScrCmd_Unk0165(struct ScriptContext *ctx) // 0165 - todo: ClearStepFlag? BOOL ScrCmd_CheckGameCompleted(struct ScriptContext *ctx) // 0166 { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); *ret_ptr = (u16)sub_0205ED0C(state); @@ -215,7 +215,7 @@ BOOL ScrCmd_SetGameCompleted(struct ScriptContext *ctx) // 0167 BOOL ScrCmd_GetSetStrength(struct ScriptContext *ctx) // 01CF - todo: Strength? { struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u8 option = ScriptReadByte(ctx); + u8 option = ScriptReadByte(ctx); u16 *ret_ptr; switch (option) { @@ -226,7 +226,7 @@ BOOL ScrCmd_GetSetStrength(struct ScriptContext *ctx) // 01CF - todo: Strength? sub_0205F264(state, 0); break; case 2: // get whether strength is on or off - ret_ptr = ScriptGetVarPointer(ctx); + ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = (u16)sub_0205F264(state, 2); break; default: @@ -240,7 +240,7 @@ BOOL ScrCmd_GetSetStrength(struct ScriptContext *ctx) // 01CF - todo: Strength? BOOL ScrCmd_GetSetFlash(struct ScriptContext *ctx) // 01D0 - todo Flash? { struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u8 option = ScriptReadByte(ctx); + u8 option = ScriptReadByte(ctx); u16 *ret_ptr; switch (option) { @@ -251,7 +251,7 @@ BOOL ScrCmd_GetSetFlash(struct ScriptContext *ctx) // 01D0 - todo Flash? sub_0205F284(state); break; case 2: // get whether flash is on or off - ret_ptr = ScriptGetVarPointer(ctx); + ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = (u16)sub_0205F294(state); break; default: @@ -265,7 +265,7 @@ BOOL ScrCmd_GetSetFlash(struct ScriptContext *ctx) // 01D0 - todo Flash? BOOL ScrCmd_GetSetDefog(struct ScriptContext *ctx) // 01D1 - todo: Defog { struct SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u8 option = ScriptReadByte(ctx); + u8 option = ScriptReadByte(ctx); u16 *ret_ptr; switch (option) { @@ -276,7 +276,7 @@ BOOL ScrCmd_GetSetDefog(struct ScriptContext *ctx) // 01D1 - todo: Defog sub_0205F2B4(state); break; case 2: // get whether defog is on or off - ret_ptr = ScriptGetVarPointer(ctx); + ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = (u16)sub_0205F2C4(state); break; default: diff --git a/arm9/src/scrcmd_fossils.c b/arm9/src/scrcmd_fossils.c index d6041dd41..5e56bfa33 100644 --- a/arm9/src/scrcmd_fossils.c +++ b/arm9/src/scrcmd_fossils.c @@ -49,14 +49,14 @@ BOOL ScrCmd_GetFossilPokemon(struct ScriptContext *ctx) // 01F4 BOOL ScrCmd_GetFossilMinimumAmount(struct ScriptContext *ctx) // 01F5 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr1 = ScriptGetVarPointer(ctx); - u16 *ret_ptr2 = ScriptGetVarPointer(ctx); - u16 needed_amount = ScriptGetVar(ctx); + u16 *ret_ptr1 = ScriptGetVarPointer(ctx); + u16 *ret_ptr2 = ScriptGetVarPointer(ctx); + u16 needed_amount = ScriptGetVar(ctx); *ret_ptr1 = 0; *ret_ptr2 = 0; - u8 i = 0; + u8 i = 0; u16 total = 0; for (; i < 7; i++) { total += Bag_GetQuantity(Save_Bag_Get(fieldSystem->saveData), gFossilPokemonMap[i][0], HEAP_ID_4); diff --git a/arm9/src/scrcmd_items.c b/arm9/src/scrcmd_items.c index 2699dd477..9ca670f68 100644 --- a/arm9/src/scrcmd_items.c +++ b/arm9/src/scrcmd_items.c @@ -9,10 +9,10 @@ BOOL ScrCmd_GiveItem(struct ScriptContext *ctx) // 007B { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 item_id = ScriptGetVar(ctx); - u16 quantity = ScriptGetVar(ctx); + u16 item_id = ScriptGetVar(ctx); + u16 quantity = ScriptGetVar(ctx); u16 *item_was_added = ScriptGetVarPointer(ctx); - struct Bag *bag = Save_Bag_Get(fieldSystem->saveData); + struct Bag *bag = Save_Bag_Get(fieldSystem->saveData); *item_was_added = (u16)Bag_AddItem(bag, item_id, quantity, HEAP_ID_4); @@ -23,10 +23,10 @@ BOOL ScrCmd_TakeItem(struct ScriptContext *ctx) // 007C { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 item_id = ScriptGetVar(ctx); - u16 quantity = ScriptGetVar(ctx); + u16 item_id = ScriptGetVar(ctx); + u16 quantity = ScriptGetVar(ctx); u16 *item_was_taken = ScriptGetVarPointer(ctx); - struct Bag *bag = Save_Bag_Get(fieldSystem->saveData); + struct Bag *bag = Save_Bag_Get(fieldSystem->saveData); *item_was_taken = (u16)Bag_TakeItem(bag, item_id, quantity, HEAP_ID_4); @@ -37,9 +37,9 @@ BOOL ScrCmd_HasSpaceForItem(struct ScriptContext *ctx) // 007D { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 item_id = ScriptGetVar(ctx); - u16 quantity = ScriptGetVar(ctx); - u16 *has_space = ScriptGetVarPointer(ctx); + u16 item_id = ScriptGetVar(ctx); + u16 quantity = ScriptGetVar(ctx); + u16 *has_space = ScriptGetVarPointer(ctx); struct Bag *bag = Save_Bag_Get(fieldSystem->saveData); *has_space = (u16)Bag_HasSpaceForItem(bag, item_id, quantity, HEAP_ID_4); @@ -51,9 +51,9 @@ BOOL ScrCmd_HasItem(struct ScriptContext *ctx) // 007E { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 item_id = ScriptGetVar(ctx); - u16 quantity = ScriptGetVar(ctx); - u16 *has_item = ScriptGetVarPointer(ctx); + u16 item_id = ScriptGetVar(ctx); + u16 quantity = ScriptGetVar(ctx); + u16 *has_item = ScriptGetVarPointer(ctx); struct Bag *bag = Save_Bag_Get(fieldSystem->saveData); *has_item = (u16)Bag_HasItem(bag, item_id, quantity, HEAP_ID_FIELD); @@ -65,7 +65,7 @@ BOOL ScrCmd_ItemIdIsTMOrHM(struct ScriptContext *ctx) // 007F { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 item_id = ScriptGetVar(ctx); + u16 item_id = ScriptGetVar(ctx); u16 *is_tm_or_hm = ScriptGetVarPointer(ctx); *is_tm_or_hm = (u16)sub_02054CB0(item_id); diff --git a/arm9/src/scrcmd_mart.c b/arm9/src/scrcmd_mart.c index 21a0e57d9..192d2c104 100644 --- a/arm9/src/scrcmd_mart.c +++ b/arm9/src/scrcmd_mart.c @@ -351,7 +351,7 @@ BOOL ScrCmd_NormalMart(ScriptContext *ctx) // 0147 - todo: Pokemart? u16 whichMart = ScriptGetVar(ctx); s32 param; u16 martItems[64]; - u8 martIdx = 0; + u8 martIdx = 0; u8 badgeCount = 0; u8 i; diff --git a/arm9/src/scrcmd_money.c b/arm9/src/scrcmd_money.c index 52dbf0c94..0af6215d4 100644 --- a/arm9/src/scrcmd_money.c +++ b/arm9/src/scrcmd_money.c @@ -46,10 +46,10 @@ BOOL ScrCmd_HasEnoughMoneyImmediate(struct ScriptContext *ctx) // 0071 - todo: C { struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); u32 amount = ScriptReadWord(ctx); - u32 money = PlayerProfile_GetMoney(player); + u32 money = PlayerProfile_GetMoney(player); if (money < amount) { *ret_ptr = 0; @@ -64,10 +64,10 @@ BOOL ScrCmd_HasEnoughMoneyAddress(struct ScriptContext *ctx) // 01AB - todo: Can { struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); u16 amount = ScriptGetVar(ctx); - u32 money = PlayerProfile_GetMoney(player); + u32 money = PlayerProfile_GetMoney(player); if (money < amount) { *ret_ptr = 0; @@ -81,9 +81,9 @@ BOOL ScrCmd_HasEnoughMoneyAddress(struct ScriptContext *ctx) // 01AB - todo: Can BOOL ScrCmd_ShowMoneyBox(struct ScriptContext *ctx) // 0072 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 xVal = ScriptGetVar(ctx); - u16 yVal = ScriptGetVar(ctx); - Window **moneyBox = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MONEY_BOX); + u16 xVal = ScriptGetVar(ctx); + u16 yVal = ScriptGetVar(ctx); + Window **moneyBox = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MONEY_BOX); *moneyBox = ov05_021E27E8(ctx->fieldSystem, (u8)xVal, (u8)yVal); diff --git a/arm9/src/scrcmd_move_relearner.c b/arm9/src/scrcmd_move_relearner.c index b2501b25f..233484d0c 100644 --- a/arm9/src/scrcmd_move_relearner.c +++ b/arm9/src/scrcmd_move_relearner.c @@ -14,16 +14,16 @@ extern void sub_02038864(struct FieldSystem *, MoveRelearner *moveRelearner); extern BOOL sub_0203BC04(struct ScriptContext *ctx); BOOL ScrCmd_Unk01C6(struct ScriptContext *ctx) { // 01C6 - todo: MoveInfo? - u16 unk = ScriptGetVar(ctx); + u16 unk = ScriptGetVar(ctx); struct UnkStruct_02037CF0 **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - *runningAppData = sub_02037CF0(HEAP_ID_32, ctx->fieldSystem, (u8)unk); + *runningAppData = sub_02037CF0(HEAP_ID_32, ctx->fieldSystem, (u8)unk); SetupNativeScript(ctx, sub_0203BC04); return TRUE; } BOOL ScrCmd_Unk01C7(struct ScriptContext *ctx) { // 01C7 - todo: StoreMove? - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); struct UnkStruct_02037CF0 **runningAppData = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); GF_ASSERT(*runningAppData != NULL); @@ -44,11 +44,11 @@ BOOL ScrCmd_Unk021E(struct ScriptContext *ctx) // 021E } BOOL ScrCmd_Unk021F(struct ScriptContext *ctx) { // 021F - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_idx = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_idx = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx); - u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32); + u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32); *ret_ptr = (u16)MoveRelearner_IsValidMove(eligibleMoves); FreeToHeap(eligibleMoves); @@ -58,17 +58,17 @@ BOOL ScrCmd_Unk021F(struct ScriptContext *ctx) { // 021F void sub_02045E74(struct ScriptContext *ctx, u8 a1, struct Pokemon *pokemon, u16 *eligibleMoves) { MoveRelearner **moveRelearnerPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - MoveRelearner *moveRelearner = MoveRelearner_New(HEAP_ID_32); - *moveRelearnerPtr = moveRelearner; + MoveRelearner *moveRelearner = MoveRelearner_New(HEAP_ID_32); + *moveRelearnerPtr = moveRelearner; moveRelearner->mon = pokemon; - struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); + struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); moveRelearner->profile = Save_PlayerData_GetProfileAddr(save); - moveRelearner->options = Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData); + moveRelearner->options = Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData); moveRelearner->eligibleMoves = eligibleMoves; - moveRelearner->unk15 = a1; + moveRelearner->unk15 = a1; sub_02038864(ctx->fieldSystem, moveRelearner); SetupNativeScript(ctx, sub_0203BC04); @@ -83,10 +83,10 @@ BOOL ScrCmd_Unk0220(struct ScriptContext *ctx) // 0220 BOOL ScrCmd_Unk0221(struct ScriptContext *ctx) // 0221 - todo: RememberMove? { - u16 mon_idx = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 mon_idx = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx); - u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32); + u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(pokemon, HEAP_ID_32); sub_02045E74(ctx, 1, pokemon, eligibleMoves); return TRUE; @@ -94,14 +94,14 @@ BOOL ScrCmd_Unk0221(struct ScriptContext *ctx) // 0221 - todo: RememberMove? BOOL ScrCmd_Unk0224(struct ScriptContext *ctx) // 0224 - todo: TeachMove? { - u16 mon_idx = ScriptGetVar(ctx); - u16 move = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 mon_idx = ScriptGetVar(ctx); + u16 move = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx); u16 *eligibleMoves = AllocFromHeap(HEAP_ID_32, 2 * sizeof(u16)); - eligibleMoves[0] = move; - eligibleMoves[1] = 0xFFFF; + eligibleMoves[0] = move; + eligibleMoves[1] = 0xFFFF; sub_02045E74(ctx, 0, pokemon, eligibleMoves); return TRUE; @@ -115,9 +115,9 @@ BOOL ScrCmd_Unk0222(struct ScriptContext *ctx) // 0222 - todo: DummyMoveCmd? BOOL ScrCmd_Unk0223(struct ScriptContext *ctx) // 0223 - todo: RememberMoveResponse? - destroys the MoveRelearner - find better name { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); MoveRelearner **moveRelearnerPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - MoveRelearner *moveRelearner = *moveRelearnerPtr; + MoveRelearner *moveRelearner = *moveRelearnerPtr; GF_ASSERT(moveRelearner != NULL); @@ -133,9 +133,9 @@ BOOL ScrCmd_Unk0223(struct ScriptContext *ctx) // 0223 - todo: RememberMoveRespo BOOL ScrCmd_Unk0225(struct ScriptContext *ctx) // 0225 - todo: TeachMoveResponse? - destroys the MoveRelearner - find better name { - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); MoveRelearner **moveRelearnerPtr = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); - MoveRelearner *moveRelearner = *moveRelearnerPtr; + MoveRelearner *moveRelearner = *moveRelearnerPtr; GF_ASSERT(moveRelearner != NULL); diff --git a/arm9/src/scrcmd_names.c b/arm9/src/scrcmd_names.c index f002ca06d..d79639e5c 100644 --- a/arm9/src/scrcmd_names.c +++ b/arm9/src/scrcmd_names.c @@ -28,11 +28,11 @@ static String *sub_02040AE4(u32 msg_no, HeapID heapId); BOOL ScrCmd_GetPlayerName(ScriptContext *ctx) // 00CD - todo: BufferPlayerName? TextPlayerName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - SaveData *save = FieldSystem_GetSaveData(fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + u8 idx = ScriptReadByte(ctx); + SaveData *save = FieldSystem_GetSaveData(fieldSystem); + PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); BufferPlayersName(*messageFormat, idx, player); @@ -41,9 +41,9 @@ BOOL ScrCmd_GetPlayerName(ScriptContext *ctx) // 00CD - todo: BufferPlayerName? BOOL ScrCmd_GetRivalName(ScriptContext *ctx) // 00CE - todo: BufferRivalName? TextRivalName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); + u8 idx = ScriptReadByte(ctx); BufferRivalsName(*messageFormat, idx, fieldSystem->saveData); @@ -52,9 +52,9 @@ BOOL ScrCmd_GetRivalName(ScriptContext *ctx) // 00CE - todo: BufferRivalName? Te BOOL ScrCmd_GetFriendName(ScriptContext *ctx) // 00CF - todo: BufferFriendName? TextFriendName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); + u8 idx = ScriptReadByte(ctx); BufferFriendsName(*messageFormat, idx, fieldSystem->saveData); @@ -63,12 +63,12 @@ BOOL ScrCmd_GetFriendName(ScriptContext *ctx) // 00CF - todo: BufferFriendName? BOOL ScrCmd_GetPokemonName(ScriptContext *ctx) // 00D0 - todo: BufferPartyPokemonName? TextPartyPokemonName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 mon_idx = ScriptGetVar(ctx); - Party *party = SaveArray_Party_Get(fieldSystem->saveData); - Pokemon *mon = Party_GetMonByIndex(party, mon_idx); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = ScriptGetVar(ctx); + Party *party = SaveArray_Party_Get(fieldSystem->saveData); + Pokemon *mon = Party_GetMonByIndex(party, mon_idx); BufferBoxMonSpeciesName(*messageFormat, idx, &mon->box); @@ -77,10 +77,10 @@ BOOL ScrCmd_GetPokemonName(ScriptContext *ctx) // 00D0 - todo: BufferPartyPokemo BOOL ScrCmd_GetItemName(ScriptContext *ctx) // 00D1 - todo: BufferItemName? TextItemName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 item = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 item = ScriptGetVar(ctx); BufferItemName(*messageFormat, idx, item); @@ -89,10 +89,10 @@ BOOL ScrCmd_GetItemName(ScriptContext *ctx) // 00D1 - todo: BufferItemName? Text BOOL ScrCmd_GetPocketName(ScriptContext *ctx) // 00D2 - todo: BufferPocketName? TextPocketName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 pocket = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 pocket = ScriptGetVar(ctx); BufferPocketName(*messageFormat, idx, pocket); @@ -101,11 +101,11 @@ BOOL ScrCmd_GetPocketName(ScriptContext *ctx) // 00D2 - todo: BufferPocketName? BOOL ScrCmd_GetTMHMMoveName(ScriptContext *ctx) // 00D3 - todo: BufferTMHMName? BufferMachineName? TextTMHMName? TextMachineName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 tmhm = ScriptGetVar(ctx); - u16 move = TMHMGetMove(tmhm); + u8 idx = ScriptReadByte(ctx); + u16 tmhm = ScriptGetVar(ctx); + u16 move = TMHMGetMove(tmhm); BufferMoveName(*messageFormat, idx, move); @@ -114,10 +114,10 @@ BOOL ScrCmd_GetTMHMMoveName(ScriptContext *ctx) // 00D3 - todo: BufferTMHMName? BOOL ScrCmd_GetMoveName(ScriptContext *ctx) // 00D4 - todo: BufferMoveName? TextMoveName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 move = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 move = ScriptGetVar(ctx); BufferMoveName(*messageFormat, idx, move); @@ -127,9 +127,9 @@ BOOL ScrCmd_GetMoveName(ScriptContext *ctx) // 00D4 - todo: BufferMoveName? Text BOOL ScrCmd_Unk00D5(ScriptContext *ctx) // 00D5 - todo: BufferNumber? TextNumber? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 unk = ScriptGetVar(ctx); - u32 digits = sub_02054C14(unk); + u8 idx = ScriptReadByte(ctx); + u16 unk = ScriptGetVar(ctx); + u32 digits = sub_02054C14(unk); BufferIntegerAsString(*messageFormat, idx, unk, digits, PRINTING_MODE_RIGHT_ALIGN, TRUE); @@ -138,11 +138,11 @@ BOOL ScrCmd_Unk00D5(ScriptContext *ctx) // 00D5 - todo: BufferNumber? TextNumber BOOL ScrCmd_Unk0280(ScriptContext *ctx) // 0280 - todo: BufferNumberSpecial? need more info { - MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 unk = ScriptGetVar(ctx); + MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + u8 idx = ScriptReadByte(ctx); + u16 unk = ScriptGetVar(ctx); enum PrintingMode printingMode = (enum PrintingMode)ScriptReadByte(ctx); - u8 digits = ScriptReadByte(ctx); + u8 digits = ScriptReadByte(ctx); if (printingMode == PRINTING_MODE_LEFT_ALIGN) { digits = (u8)sub_02054C14(unk); } @@ -154,12 +154,12 @@ BOOL ScrCmd_Unk0280(ScriptContext *ctx) // 0280 - todo: BufferNumberSpecial? nee BOOL ScrCmd_GetPokemonNickname(ScriptContext *ctx) // 00D6 - todo: BufferPartyPokemonNickname? TextPartyPokemonNickname? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 mon_idx = ScriptGetVar(ctx); - Party *party = SaveArray_Party_Get(fieldSystem->saveData); - Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = ScriptGetVar(ctx); + Party *party = SaveArray_Party_Get(fieldSystem->saveData); + Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx); BufferBoxMonNickname(*messageFormat, idx, &pokemon->box); @@ -168,14 +168,14 @@ BOOL ScrCmd_GetPokemonNickname(ScriptContext *ctx) // 00D6 - todo: BufferPartyPo BOOL ScrCmd_Unk0251(ScriptContext *ctx) // 0251 - todo: BufferBoxPokemonNickname? TextBoxPokemonNickname? { - FieldSystem *fieldSystem = ctx->fieldSystem; - PCStorage *pc = SaveArray_PCStorage_Get(fieldSystem->saveData); + FieldSystem *fieldSystem = ctx->fieldSystem; + PCStorage *pc = SaveArray_PCStorage_Get(fieldSystem->saveData); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 box_mon_idx = ScriptGetVar(ctx); - s32 box_no = box_mon_idx / 30; - s32 slot_no = box_mon_idx % 30; - BoxPokemon *box_mon = PCStorage_GetMonByIndexPair(pc, box_no, slot_no); + u8 idx = ScriptReadByte(ctx); + u16 box_mon_idx = ScriptGetVar(ctx); + s32 box_no = box_mon_idx / 30; + s32 slot_no = box_mon_idx % 30; + BoxPokemon *box_mon = PCStorage_GetMonByIndexPair(pc, box_no, slot_no); BufferBoxMonNickname(*messageFormat, idx, box_mon); @@ -185,8 +185,8 @@ BOOL ScrCmd_Unk0251(ScriptContext *ctx) // 0251 - todo: BufferBoxPokemonNickname BOOL ScrCmd_GetPoketchAppName(ScriptContext *ctx) // 00D7 - todo: BufferPoketchAppName? TextPoketchAppName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 app = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 app = ScriptGetVar(ctx); BufferPoketchAppName(*messageFormat, idx, app); @@ -196,8 +196,8 @@ BOOL ScrCmd_GetPoketchAppName(ScriptContext *ctx) // 00D7 - todo: BufferPoketchA BOOL ScrCmd_GetTrainerClassName(ScriptContext *ctx) // 00D8 - todo: BufferTrainerClassName? TextTrainerClassName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 trainer_class = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 trainer_class = ScriptGetVar(ctx); BufferTrainerClassName(*messageFormat, idx, trainer_class); @@ -206,14 +206,14 @@ BOOL ScrCmd_GetTrainerClassName(ScriptContext *ctx) // 00D8 - todo: BufferTraine BOOL ScrCmd_Unk00D9(ScriptContext *ctx) // 00D9 - todo: BufferPlayerTrainerClassName? TextPlayerTrainerClassName? { - FieldSystem *fieldSystem = ctx->fieldSystem; - SaveData *save = FieldSystem_GetSaveData(fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + FieldSystem *fieldSystem = ctx->fieldSystem; + SaveData *save = FieldSystem_GetSaveData(fieldSystem); + PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u32 gender = PlayerProfile_GetTrainerGender(player); - u32 avatar = PlayerProfile_GetAvatar(player); - u32 trainer_class = sub_020536D0(gender, avatar, 2); + u8 idx = ScriptReadByte(ctx); + u32 gender = PlayerProfile_GetTrainerGender(player); + u32 avatar = PlayerProfile_GetAvatar(player); + u32 trainer_class = sub_020536D0(gender, avatar, 2); BufferTrainerClassNameWithArticle(*messageFormat, idx, trainer_class); @@ -223,11 +223,11 @@ BOOL ScrCmd_Unk00D9(ScriptContext *ctx) // 00D9 - todo: BufferPlayerTrainerClass BOOL ScrCmd_Unk00DA(ScriptContext *ctx) // 00DA - todo: BufferPokemonSpeciesName? TextPokemonSpeciesName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 msg_no = ScriptGetVar(ctx); - u16 unk1 = ScriptReadHalfword(ctx); - u8 unk2 = ScriptReadByte(ctx); - String *str = sub_02040AE4(msg_no, HEAP_ID_4); + u8 idx = ScriptReadByte(ctx); + u16 msg_no = ScriptGetVar(ctx); + u16 unk1 = ScriptReadHalfword(ctx); + u8 unk2 = ScriptReadByte(ctx); + String *str = sub_02040AE4(msg_no, HEAP_ID_4); BufferString(*messageFormat, idx, str, unk1, unk2, 2); String_Delete(str); @@ -238,7 +238,7 @@ BOOL ScrCmd_Unk00DA(ScriptContext *ctx) // 00DA - todo: BufferPokemonSpeciesName static String *sub_02040AE4(u32 msg_no, HeapID heapId) // todo: GetPokemonSpeciesName? { MsgData *msg_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0362_bin, heapId); - String *ret = NewString_ReadMsgData(msg_data, msg_no); + String *ret = NewString_ReadMsgData(msg_data, msg_no); DestroyMsgData(msg_data); return ret; @@ -247,10 +247,10 @@ static String *sub_02040AE4(u32 msg_no, HeapID heapId) // todo: GetPokemonSpecie BOOL ScrCmd_GetPlayerStarterName(ScriptContext *ctx) // 00DB - todo: BufferPlayerStarterSpecies? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u32 msg_no = Save_VarsFlags_GetStarter(state); - String *str = sub_02040AE4(msg_no, HEAP_ID_4); + u8 idx = ScriptReadByte(ctx); + SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u32 msg_no = Save_VarsFlags_GetStarter(state); + String *str = sub_02040AE4(msg_no, HEAP_ID_4); BufferString(*messageFormat, idx, str, 0, 1, 2); String_Delete(str); @@ -261,10 +261,10 @@ BOOL ScrCmd_GetPlayerStarterName(ScriptContext *ctx) // 00DB - todo: BufferPlaye BOOL ScrCmd_GetRivalStarterName(ScriptContext *ctx) // 00DC - todo: BufferRivalStarterSpecies? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u32 msg_no = sub_0205F398(state); - String *str = sub_02040AE4(msg_no, HEAP_ID_4); + u8 idx = ScriptReadByte(ctx); + SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u32 msg_no = sub_0205F398(state); + String *str = sub_02040AE4(msg_no, HEAP_ID_4); BufferString(*messageFormat, idx, str, 0, 1, 2); String_Delete(str); @@ -275,10 +275,10 @@ BOOL ScrCmd_GetRivalStarterName(ScriptContext *ctx) // 00DC - todo: BufferRivalS BOOL ScrCmd_GetCounterpartStarterName(ScriptContext *ctx) // 00DD - todo: BufferFriendStarterSpecies? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u32 msg_no = sub_0205F3C0(state); - String *str = sub_02040AE4(msg_no, HEAP_ID_4); + u8 idx = ScriptReadByte(ctx); + SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u32 msg_no = sub_0205F3C0(state); + String *str = sub_02040AE4(msg_no, HEAP_ID_4); BufferString(*messageFormat, idx, str, 0, 1, 2); String_Delete(str); @@ -289,8 +289,8 @@ BOOL ScrCmd_GetCounterpartStarterName(ScriptContext *ctx) // 00DD - todo: Buffer BOOL ScrCmd_GetDecorationName(ScriptContext *ctx) // 00DF - todo: BufferDecorationName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 decoration = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 decoration = ScriptGetVar(ctx); BufferDecorationName(*messageFormat, idx, decoration); @@ -300,8 +300,8 @@ BOOL ScrCmd_GetDecorationName(ScriptContext *ctx) // 00DF - todo: BufferDecorati BOOL ScrCmd_GetUndergroundTrapName(ScriptContext *ctx) // 00E0 - todo: BufferUndergroundTrapName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 underground_trap = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 underground_trap = ScriptGetVar(ctx); BufferUndergroundTrapName(*messageFormat, idx, underground_trap); @@ -311,8 +311,8 @@ BOOL ScrCmd_GetUndergroundTrapName(ScriptContext *ctx) // 00E0 - todo: BufferUnd BOOL ScrCmd_GetUndergroundItemName(ScriptContext *ctx) // 00E1 - todo: BufferUndergroundItemName? BufferTreasureName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 underground_item = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 underground_item = ScriptGetVar(ctx); BufferUndergroundItemName(*messageFormat, idx, underground_item); @@ -321,10 +321,10 @@ BOOL ScrCmd_GetUndergroundItemName(ScriptContext *ctx) // 00E1 - todo: BufferUnd BOOL ScrCmd_GetMapName(ScriptContext *ctx) // 00E2 - todo: BufferMapName? { - String *str = String_New(22, HEAP_ID_4); + String *str = String_New(22, HEAP_ID_4); MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 map_no = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 map_no = ScriptGetVar(ctx); sub_02064E60(map_no, HEAP_ID_4, str); BufferString(*messageFormat, idx, str, 0, 1, 2); @@ -336,10 +336,10 @@ BOOL ScrCmd_GetMapName(ScriptContext *ctx) // 00E2 - todo: BufferMapName? BOOL ScrCmd_GetBerryName(ScriptContext *ctx) // 017B - todo: BufferBerryName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 berry = ScriptGetVar(ctx); - u16 unk = ScriptGetVar(ctx); - String *nut_name = GetNutName((u16)(berry - FIRST_BERRY_IDX), HEAP_ID_32); + u8 idx = ScriptReadByte(ctx); + u16 berry = ScriptGetVar(ctx); + u16 unk = ScriptGetVar(ctx); + String *nut_name = GetNutName((u16)(berry - FIRST_BERRY_IDX), HEAP_ID_32); BufferString(*messageFormat, idx, nut_name, 0, unk < 2, 2); String_Delete(nut_name); @@ -350,8 +350,8 @@ BOOL ScrCmd_GetBerryName(ScriptContext *ctx) // 017B - todo: BufferBerryName? BOOL ScrCmd_GetNatureName(ScriptContext *ctx) // 017C - todo: BufferNatureName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 nature = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 nature = ScriptGetVar(ctx); BufferNatureName(*messageFormat, idx, nature); @@ -361,8 +361,8 @@ BOOL ScrCmd_GetNatureName(ScriptContext *ctx) // 017C - todo: BufferNatureName? BOOL ScrCmd_GetFashionName(ScriptContext *ctx) // 0261 - todo: BufferAccessoryName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 fashion = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 fashion = ScriptGetVar(ctx); BufferFashionName(*messageFormat, idx, fashion); @@ -372,10 +372,10 @@ BOOL ScrCmd_GetFashionName(ScriptContext *ctx) // 0261 - todo: BufferAccessoryNa BOOL ScrCmd_GetWhiteRockInscription(ScriptContext *ctx) // 0272 - todo: BufferWhiteRockInscription? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - String *str = String_New(11, HEAP_ID_FIELD); - UnkStruct_02024E64 *unk = sub_02024EB4(ctx->fieldSystem->saveData); - u16 *unk_buffer = sub_02024F0C(unk); + u8 idx = ScriptReadByte(ctx); + String *str = String_New(11, HEAP_ID_FIELD); + UnkStruct_02024E64 *unk = sub_02024EB4(ctx->fieldSystem->saveData); + u16 *unk_buffer = sub_02024F0C(unk); CopyU16ArrayToString(str, unk_buffer); BufferString(*messageFormat, idx, str, 0, 0, gGameLanguage); @@ -386,14 +386,14 @@ BOOL ScrCmd_GetWhiteRockInscription(ScriptContext *ctx) // 0272 - todo: BufferWh BOOL ScrCmd_GetPokemonMoveName(ScriptContext *ctx) // 01CB - todo: BufferPartyPokemonMoveName? { - FieldSystem *fieldSystem = ctx->fieldSystem; + FieldSystem *fieldSystem = ctx->fieldSystem; MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 mon_idx = ScriptGetVar(ctx); - u16 mon_move_idx = ScriptGetVar(ctx); - Party *party = SaveArray_Party_Get(fieldSystem->saveData); - Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx); - u16 move = (u16)GetMonData(pokemon, MON_DATA_MOVE1 + mon_move_idx, NULL); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = ScriptGetVar(ctx); + u16 mon_move_idx = ScriptGetVar(ctx); + Party *party = SaveArray_Party_Get(fieldSystem->saveData); + Pokemon *pokemon = Party_GetMonByIndex(party, mon_idx); + u16 move = (u16)GetMonData(pokemon, MON_DATA_MOVE1 + mon_move_idx, NULL); BufferMoveName(*messageFormat, idx, move); @@ -403,9 +403,9 @@ BOOL ScrCmd_GetPokemonMoveName(ScriptContext *ctx) // 01CB - todo: BufferPartyPo BOOL ScrCmd_GetRibbonName(ScriptContext *ctx) // 0232 - todo: BufferRibbonName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u8 unk = (u8)ScriptGetVar(ctx); - u16 ribbon = (u16)sub_0207FC5C(unk, 3); + u8 idx = ScriptReadByte(ctx); + u8 unk = (u8)ScriptGetVar(ctx); + u16 ribbon = (u16)sub_0207FC5C(unk, 3); BufferRibbonNameOrDesc(*messageFormat, idx, ribbon); @@ -415,8 +415,8 @@ BOOL ScrCmd_GetRibbonName(ScriptContext *ctx) // 0232 - todo: BufferRibbonName? BOOL ScrCmd_GetSealName(ScriptContext *ctx) // 02B3 - todo: BufferSealName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 seal = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 seal = ScriptGetVar(ctx); BufferSealName(*messageFormat, idx, (u16)(seal - 1)); @@ -426,8 +426,8 @@ BOOL ScrCmd_GetSealName(ScriptContext *ctx) // 02B3 - todo: BufferSealName? BOOL ScrCmd_GetItemNameWithIndefArticle(ScriptContext *ctx) // 02C4 - todo: BufferIndefItemName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 item = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 item = ScriptGetVar(ctx); BufferItemNameWithIndefArticle(*messageFormat, idx, item); @@ -437,8 +437,8 @@ BOOL ScrCmd_GetItemNameWithIndefArticle(ScriptContext *ctx) // 02C4 - todo: Buff BOOL ScrCmd_GetItemNamePlural(ScriptContext *ctx) // 02C5 - todo: BufferPluralItemName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 item = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 item = ScriptGetVar(ctx); BufferItemNamePlural(*messageFormat, idx, item); @@ -448,8 +448,8 @@ BOOL ScrCmd_GetItemNamePlural(ScriptContext *ctx) // 02C5 - todo: BufferPluralIt BOOL ScrCmd_GetDecorationNameWithArticle(ScriptContext *ctx) // 02C6 - todo: BufferIndefDecorationName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 decoration = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 decoration = ScriptGetVar(ctx); BufferDecorationNameWithArticle(*messageFormat, idx, decoration); @@ -459,8 +459,8 @@ BOOL ScrCmd_GetDecorationNameWithArticle(ScriptContext *ctx) // 02C6 - todo: Buf BOOL ScrCmd_GetUndergroundTrapNameWithArticle(ScriptContext *ctx) // 02C7 - todo: BufferIndefTrapName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 underground_trap = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 underground_trap = ScriptGetVar(ctx); BufferUndergroundTrapNameWithArticle(*messageFormat, idx, underground_trap); @@ -470,8 +470,8 @@ BOOL ScrCmd_GetUndergroundTrapNameWithArticle(ScriptContext *ctx) // 02C7 - todo BOOL ScrCmd_GetUndergroundItemNameWithArticle(ScriptContext *ctx) // 02C8 - todo: BufferIndefUndergroundItemName? BufferIndefTreasureName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 underground_item = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 underground_item = ScriptGetVar(ctx); BufferUndergroundItemNameWithArticle(*messageFormat, idx, underground_item); @@ -481,10 +481,10 @@ BOOL ScrCmd_GetUndergroundItemNameWithArticle(ScriptContext *ctx) // 02C8 - todo BOOL ScrCmd_Unk02C9(ScriptContext *ctx) // 02C9 - todo: BufferIndefSpeciesName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 species = ScriptGetVar(ctx); - u16 unused1 = ScriptReadHalfword(ctx); - u8 unused2 = ScriptReadByte(ctx); + u8 idx = ScriptReadByte(ctx); + u16 species = ScriptGetVar(ctx); + u16 unused1 = ScriptReadHalfword(ctx); + u8 unused2 = ScriptReadByte(ctx); BufferSpeciesNameWithArticle(*messageFormat, idx, species); @@ -494,9 +494,9 @@ BOOL ScrCmd_Unk02C9(ScriptContext *ctx) // 02C9 - todo: BufferIndefSpeciesName? BOOL ScrCmd_Unk02CA(ScriptContext *ctx) // 02CA - todo: BufferIndefFriendStarterSpecies? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); - u32 species = sub_0205F3C0(state); + u8 idx = ScriptReadByte(ctx); + SaveVarsFlags *state = Save_VarsFlags_Get(ctx->fieldSystem->saveData); + u32 species = sub_0205F3C0(state); BufferSpeciesNameWithArticle(*messageFormat, idx, species); @@ -506,8 +506,8 @@ BOOL ScrCmd_Unk02CA(ScriptContext *ctx) // 02CA - todo: BufferIndefFriendStarter BOOL ScrCmd_GetFashionNameWithArticle(ScriptContext *ctx) // 02CB - todo: BufferIndefAccessoryName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 fashion = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 fashion = ScriptGetVar(ctx); BufferFashionNameWithArticle(*messageFormat, idx, fashion); @@ -517,8 +517,8 @@ BOOL ScrCmd_GetFashionNameWithArticle(ScriptContext *ctx) // 02CB - todo: Buffer BOOL ScrCmd_Unk02CC(ScriptContext *ctx) // 02CC - todo: BufferIndefTrainerClassName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 trainer_class = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 trainer_class = ScriptGetVar(ctx); BufferTrainerClassNameWithArticle(*messageFormat, idx, trainer_class); @@ -528,8 +528,8 @@ BOOL ScrCmd_Unk02CC(ScriptContext *ctx) // 02CC - todo: BufferIndefTrainerClassN BOOL ScrCmd_GetSealNamePlural(ScriptContext *ctx) // 02CD - todo: BufferPluralSealName? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); - u16 seal = ScriptGetVar(ctx); + u8 idx = ScriptReadByte(ctx); + u16 seal = ScriptGetVar(ctx); BufferSealNamePlural(*messageFormat, idx, (u16)(seal - 1)); @@ -539,7 +539,7 @@ BOOL ScrCmd_GetSealNamePlural(ScriptContext *ctx) // 02CD - todo: BufferPluralSe BOOL ScrCmd_CapitalizeFirstChar(ScriptContext *ctx) // 02CE - todo CapitalizeText? { MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); - u8 idx = ScriptReadByte(ctx); + u8 idx = ScriptReadByte(ctx); MessageFormat_UpperFirstChar(*messageFormat, idx); diff --git a/arm9/src/scrcmd_party.c b/arm9/src/scrcmd_party.c index 70c38a63e..eecbecb8c 100644 --- a/arm9/src/scrcmd_party.c +++ b/arm9/src/scrcmd_party.c @@ -18,14 +18,14 @@ extern u16 sub_02054DEC(struct SaveData *save); BOOL ScrCmd_GiveMon(struct ScriptContext *ctx) // 0096 - todo: GivePokemon? { - u32 mapSec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId); + u32 mapSec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId); struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 species = ScriptGetVar(ctx); - u16 level = ScriptGetVar(ctx); - u16 item = ScriptGetVar(ctx); - u16 *varPtr = ScriptGetVarPointer(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - *varPtr = (u16)GiveMon(HEAP_ID_FIELD, fieldSystem->saveData, species, (u8)level, item, mapSec, 12); + u16 species = ScriptGetVar(ctx); + u16 level = ScriptGetVar(ctx); + u16 item = ScriptGetVar(ctx); + u16 *varPtr = ScriptGetVarPointer(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + *varPtr = (u16)GiveMon(HEAP_ID_FIELD, fieldSystem->saveData, species, (u8)level, item, mapSec, 12); return FALSE; } @@ -35,10 +35,10 @@ BOOL ScrCmd_GetPartyMonSpecies(struct ScriptContext *ctx) // 0198 - todo: GetPar u16 *ret_ptr; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *mon_slot = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx)); // for some reason this is *required* for matching, cannot use ScriptGetVarPointer here - ret_ptr = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx)); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, *mon_slot); + u16 *mon_slot = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx)); // for some reason this is *required* for matching, cannot use ScriptGetVarPointer here + ret_ptr = GetVarPointer(ctx->fieldSystem, ScriptReadHalfword(ctx)); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, *mon_slot); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); if (party_mon_is_egg == FALSE) { @@ -54,17 +54,17 @@ BOOL ScrCmd_GetPartyMonSpecies(struct ScriptContext *ctx) // 0198 - todo: GetPar BOOL ScrCmd_CheckPartyMonOTID(struct ScriptContext *ctx) // 0199 - todo: CheckPartyPokemonTraded? { struct FieldSystem *fieldSystem = ctx->fieldSystem; - struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); + PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); u16 *mon_slot = ScriptGetVarPointer(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, *mon_slot); u16 party_mon_otid = (u16)GetMonData(party_mon, MON_DATA_OTID, NULL); - u16 player_otid = (u16)PlayerProfile_GetTrainerID(player); + u16 player_otid = (u16)PlayerProfile_GetTrainerID(player); if (party_mon_otid == player_otid) { *ret_ptr = 0; } else { @@ -77,11 +77,11 @@ BOOL ScrCmd_CheckPartyMonOTID(struct ScriptContext *ctx) // 0199 - todo: CheckPa BOOL ScrCmd_GiveEgg(struct ScriptContext *ctx) // 0097 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - PlayerProfile *player = Save_PlayerData_GetProfileAddr(fieldSystem->saveData); - u16 species = ScriptGetVar(ctx); - u16 unk = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - u8 party_count = (u8)Party_GetCount(party); + PlayerProfile *player = Save_PlayerData_GetProfileAddr(fieldSystem->saveData); + u16 species = ScriptGetVar(ctx); + u16 unk = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + u8 party_count = (u8)Party_GetCount(party); if (party_count < PARTY_SIZE) { struct Pokemon *egg = AllocMonZeroed(HEAP_ID_FIELD); @@ -99,9 +99,9 @@ BOOL ScrCmd_GiveEgg(struct ScriptContext *ctx) // 0097 BOOL ScrCmd_SetPartyMonMove(struct ScriptContext *ctx) // 0098 - todo: ReplacePartyPokemonMove? { - u16 mon_slot = ScriptGetVar(ctx); - u16 move_slot = ScriptGetVar(ctx); - u16 move = ScriptGetVar(ctx); + u16 mon_slot = ScriptGetVar(ctx); + u16 move_slot = ScriptGetVar(ctx); + u16 move = ScriptGetVar(ctx); struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); PartyMonSetMoveInSlot(party, mon_slot, move_slot, move); @@ -112,11 +112,11 @@ BOOL ScrCmd_SetPartyMonMove(struct ScriptContext *ctx) // 0098 - todo: ReplacePa BOOL ScrCmd_PartyMonHasMove(struct ScriptContext *ctx) // 0099 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 required_move = ScriptGetVar(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 required_move = ScriptGetVar(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = 0; @@ -135,13 +135,13 @@ BOOL ScrCmd_PartyMonHasMove(struct ScriptContext *ctx) // 0099 BOOL ScrCmd_FindPartyMonWithMove(struct ScriptContext *ctx) // 009A - todo: CheckMoveInParty? { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 required_move = ScriptGetVar(ctx); - u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 required_move = ScriptGetVar(ctx); + u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); u8 i; for (i = 0, *ret_ptr = PARTY_SIZE; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -158,9 +158,9 @@ BOOL ScrCmd_FindPartyMonWithMove(struct ScriptContext *ctx) // 009A - todo: Chec BOOL ScrCmd_SurvivePsn(struct ScriptContext *ctx) // 01F7 { - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = (u16)SurvivePoisoning(party_mon); @@ -173,13 +173,13 @@ BOOL ScrCmd_CountPartyMonsAtOrBelowLevel(struct ScriptContext *ctx) // 01F6 u8 i; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 highest_level = ScriptGetVar(ctx); - party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 highest_level = ScriptGetVar(ctx); + party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); u8 mons; for (i = 0, mons = 0, *ret_ptr = 0; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -198,10 +198,10 @@ BOOL ScrCmd_CountPartyMonsAtOrBelowLevel(struct ScriptContext *ctx) // 01F6 BOOL ScrCmd_GetPartyMonLevel(struct ScriptContext *ctx) // 0278 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = 0; @@ -216,16 +216,16 @@ BOOL ScrCmd_GetPartyMonLevel(struct ScriptContext *ctx) // 0278 BOOL ScrCmd_GetPartyMonNature(struct ScriptContext *ctx) // 0212 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); if (mon_slot >= party_count) { *ret_ptr = 0; return FALSE; } - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -241,13 +241,13 @@ BOOL ScrCmd_GetPartyMonNature(struct ScriptContext *ctx) // 0212 BOOL ScrCmd_FindPartyMonWithNature(struct ScriptContext *ctx) // 0213 - todo: CheckNatureInParty { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 required_nature = ScriptGetVar(ctx); - u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 required_nature = ScriptGetVar(ctx); + u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); u8 i; for (i = 0, *ret_ptr = 0xFF; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -266,10 +266,10 @@ BOOL ScrCmd_FindPartyMonWithNature(struct ScriptContext *ctx) // 0213 - todo: Ch BOOL ScrCmd_GetPartyMonFriendship(struct ScriptContext *ctx) // 01B9 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = (u16)GetMonData(party_mon, MON_DATA_FRIENDSHIP, NULL); return FALSE; @@ -278,16 +278,16 @@ BOOL ScrCmd_GetPartyMonFriendship(struct ScriptContext *ctx) // 01B9 BOOL ScrCmd_AddPartyMonFriendship(struct ScriptContext *ctx) // 01BA { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 friendship_to_add = ScriptGetVar(ctx); - u16 mon_slot = ScriptGetVar(ctx); - u16 map_sec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 friendship_to_add = ScriptGetVar(ctx); + u16 mon_slot = ScriptGetVar(ctx); + u16 map_sec = MapHeader_GetMapSec(ctx->fieldSystem->location->mapId); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); u16 friendship = (u16)GetMonData(party_mon, MON_DATA_FRIENDSHIP, NULL); if (friendship_to_add != 0) { - u16 party_mon_held_item = (u16)GetMonData(party_mon, MON_DATA_HELD_ITEM, NULL); + u16 party_mon_held_item = (u16)GetMonData(party_mon, MON_DATA_HELD_ITEM, NULL); u32 held_item_hold_effect = GetItemAttr(party_mon_held_item, ITEMATTR_HOLD_EFFECT, HEAP_ID_FIELD); if (held_item_hold_effect == HOLD_EFFECT_FRIENDSHIP_UP) { friendship_to_add = (u16)((friendship_to_add * 150) / 100); @@ -317,10 +317,10 @@ BOOL ScrCmd_AddPartyMonFriendship(struct ScriptContext *ctx) // 01BA BOOL ScrCmd_SubtractPartyMonFriendship(struct ScriptContext *ctx) // 01BB { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 friendship_to_deplete = ScriptGetVar(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 friendship_to_deplete = ScriptGetVar(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); u16 friendship = (u16)GetMonData(party_mon, MON_DATA_FRIENDSHIP, NULL); if (friendship_to_deplete > friendship) { @@ -336,10 +336,10 @@ BOOL ScrCmd_SubtractPartyMonFriendship(struct ScriptContext *ctx) // 01BB BOOL ScrCmd_GetPartyMonContestCondition(struct ScriptContext *ctx) // 0281 { - u16 mon_slot = ScriptGetVar(ctx); - u16 contest_condition_id = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 mon_slot = ScriptGetVar(ctx); + u16 contest_condition_id = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = (u16)GetMonData(party_mon, MON_DATA_COOL + contest_condition_id, NULL); @@ -357,11 +357,11 @@ BOOL ScrCmd_GetLeadingPartyMonSlot(struct ScriptContext *ctx) // 0247 BOOL ScrCmd_GetPartyMonTypes(struct ScriptContext *ctx) // 0248 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *type1 = ScriptGetVarPointer(ctx); - u16 *type2 = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 *type1 = ScriptGetVarPointer(ctx); + u16 *type2 = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *type1 = (u16)GetMonData(party_mon, MON_DATA_TYPE_1, NULL); *type2 = (u16)GetMonData(party_mon, MON_DATA_TYPE_2, NULL); @@ -371,8 +371,8 @@ BOOL ScrCmd_GetPartyMonTypes(struct ScriptContext *ctx) // 0248 BOOL ScrCmd_CountPartyMons(struct ScriptContext *ctx) // 0177 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); *ret_ptr = (u16)Party_GetCount(party); return FALSE; @@ -384,11 +384,11 @@ BOOL ScrCmd_CountPartyMons_OmitEggs(struct ScriptContext *ctx) // 019A s32 i; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - s32 party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + s32 party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); for (i = 0, non_egg_mons = 0; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -407,15 +407,15 @@ BOOL ScrCmd_CountAvailablePartyMons_IgnoreSlot(struct ScriptContext *ctx) // 019 s32 party_count; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - slot_to_ignore = ScriptGetVar(ctx); - party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + slot_to_ignore = ScriptGetVar(ctx); + party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); u32 available_mons; s32 i; for (i = 0, available_mons = 0; i < party_count; i++) { if (i != slot_to_ignore) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -438,14 +438,14 @@ BOOL ScrCmd_CountAvailablePartyAndPCMons(struct ScriptContext *ctx) // 019C struct PCStorage *pc; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - pc = SaveArray_PCStorage_Get(fieldSystem->saveData); - party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + pc = SaveArray_PCStorage_Get(fieldSystem->saveData); + party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); u32 mons; s32 i; for (i = 0, mons = 0; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -467,12 +467,12 @@ BOOL ScrCmd_GetPartyEggCount(struct ScriptContext *ctx) // 019D u32 eggs_in_party; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + party_count = Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); s32 i; for (i = 0, eggs_in_party = 0; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -491,11 +491,11 @@ BOOL ScrCmd_CheckPartyForPokerus(struct ScriptContext *ctx) // 0119 u16 i; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - party_count = (u16)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + party_count = (u16)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); for (i = 0, *ret_ptr = 0; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_has_pokerus = (BOOL)GetMonData(party_mon, MON_DATA_POKERUS, NULL); @@ -510,9 +510,9 @@ BOOL ScrCmd_CheckPartyForPokerus(struct ScriptContext *ctx) // 0119 BOOL ScrCmd_GetPartyMonGender(struct ScriptContext *ctx) // 011A { - u16 mon_slot = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 mon_slot = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = (u16)GetMonData(party_mon, MON_DATA_GENDER, NULL); @@ -525,10 +525,10 @@ BOOL ScrCmd_CountPartyMonMoves(struct ScriptContext *ctx) // 01C8 u8 moves; struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - party_mon = Party_GetMonByIndex(party, mon_slot); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + party_mon = Party_GetMonByIndex(party, mon_slot); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); if (party_mon_is_egg) { @@ -565,10 +565,10 @@ BOOL ScrCmd_CountPartyMonMoves(struct ScriptContext *ctx) // 01C8 BOOL ScrCmd_ForgetPartyMonMove(struct ScriptContext *ctx) // 01C9 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 mon_slot = ScriptGetVar(ctx); - u16 move_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 mon_slot = ScriptGetVar(ctx); + u16 move_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); sub_020699A4(party_mon, move_slot); @@ -578,11 +578,11 @@ BOOL ScrCmd_ForgetPartyMonMove(struct ScriptContext *ctx) // 01C9 BOOL ScrCmd_GetPartyMonMove(struct ScriptContext *ctx) // 01CA { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - u16 move_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + u16 move_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = (u16)GetMonData(party_mon, MON_DATA_MOVE1 + move_slot, NULL); return FALSE; @@ -591,10 +591,10 @@ BOOL ScrCmd_GetPartyMonMove(struct ScriptContext *ctx) // 01CA BOOL ScrCmd_GetPartyMonHeldItem(struct ScriptContext *ctx) // 01EE { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = (u16)GetMonData(party_mon, MON_DATA_HELD_ITEM, NULL); return FALSE; @@ -603,9 +603,9 @@ BOOL ScrCmd_GetPartyMonHeldItem(struct ScriptContext *ctx) // 01EE BOOL ScrCmd_ResetPartyMonHeldItem(struct ScriptContext *ctx) // 01F0 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); - struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); u16 party_mon_held_item = ITEM_NONE; SetMonData(party_mon, MON_DATA_HELD_ITEM, &party_mon_held_item); @@ -616,13 +616,13 @@ BOOL ScrCmd_ResetPartyMonHeldItem(struct ScriptContext *ctx) // 01F0 BOOL ScrCmd_CheckPartyForSpecies(struct ScriptContext *ctx) // 01C0 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 species = ScriptGetVar(ctx); - u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 species = ScriptGetVar(ctx); + u8 party_count = (u8)Party_GetCount(SaveArray_Party_Get(fieldSystem->saveData)); u8 i; for (i = 0, *ret_ptr = 0; i < party_count; i++) { - struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); + struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, i); BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); @@ -640,9 +640,9 @@ BOOL ScrCmd_CheckPartyForSpecies(struct ScriptContext *ctx) // 01C0 BOOL ScrCmd_CountPartyMonRibbons(struct ScriptContext *ctx) // 022E { - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); u16 ribbon_idx; @@ -664,9 +664,9 @@ BOOL ScrCmd_CountTotalPartyRibbons(struct ScriptContext *ctx) // 022F u16 ribbon_idx; u16 ribbons; - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); u16 party_count = (u16)Party_GetCount(SaveArray_Party_Get(ctx->fieldSystem->saveData)); - party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + party = SaveArray_Party_Get(ctx->fieldSystem->saveData); for (ribbon_idx = 0, ribbons = 0; ribbon_idx < 80; ribbon_idx++) { for (u16 i = 0; i < party_count; i++) { @@ -693,10 +693,10 @@ BOOL ScrCmd_CountTotalPartyRibbons(struct ScriptContext *ctx) // 022F BOOL ScrCmd_PartyMonHasRibbon(struct ScriptContext *ctx) // 0230 { - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 mon_slot = ScriptGetVar(ctx); - u16 ribbon_idx = ScriptGetVar(ctx); - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 mon_slot = ScriptGetVar(ctx); + u16 ribbon_idx = ScriptGetVar(ctx); + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); *ret_ptr = (u16)GetMonData(party_mon, sub_0207FC5C((u8)ribbon_idx, 0), NULL); @@ -705,10 +705,10 @@ BOOL ScrCmd_PartyMonHasRibbon(struct ScriptContext *ctx) // 0230 BOOL ScrCmd_GivePartyMonRibbon(struct ScriptContext *ctx) // 0231 { - u16 mon_slot = ScriptGetVar(ctx); - u16 ribbon_idx = ScriptGetVar(ctx); - u8 mon_has_ribbon = TRUE; - struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); + u16 mon_slot = ScriptGetVar(ctx); + u16 ribbon_idx = ScriptGetVar(ctx); + u8 mon_has_ribbon = TRUE; + struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); struct Pokemon *party_mon = Party_GetMonByIndex(party, mon_slot); SetMonData(party_mon, (s32)sub_0207FC5C((u8)ribbon_idx, 0), &mon_has_ribbon); @@ -720,8 +720,8 @@ BOOL ScrCmd_CheckPartyForBadEgg(struct ScriptContext *ctx) // 02B7 { u16 ribbon_idx; - u16 *ret_ptr = ScriptGetVarPointer(ctx); - u16 party_count = (u16)Party_GetCount(SaveArray_Party_Get(ctx->fieldSystem->saveData)); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 party_count = (u16)Party_GetCount(SaveArray_Party_Get(ctx->fieldSystem->saveData)); struct Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData); // BUG: Probably a copy-paste fail. Checks if your party has a Bad Egg in it, @@ -729,7 +729,7 @@ BOOL ScrCmd_CheckPartyForBadEgg(struct ScriptContext *ctx) // 02B7 for (ribbon_idx = 0; ribbon_idx < 80; ribbon_idx++) { for (u16 i = 0; i < party_count; i++) { struct Pokemon *party_mon = Party_GetMonByIndex(party, i); - BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); + BOOL party_mon_is_egg = (BOOL)GetMonData(party_mon, MON_DATA_IS_EGG, NULL); if (party_mon_is_egg) { BOOL party_mon_is_bad_egg = (BOOL)GetMonData(party_mon, MON_DATA_CHECKSUM_FAILED, NULL); if (party_mon_is_bad_egg) { diff --git a/arm9/src/scrcmd_prizes.c b/arm9/src/scrcmd_prizes.c index 1ed67ac76..e26cf7158 100644 --- a/arm9/src/scrcmd_prizes.c +++ b/arm9/src/scrcmd_prizes.c @@ -28,11 +28,11 @@ const u16 gGameCornerPrizes[19][2] = { BOOL ScrCmd_GetPrizeItemIdAndCost(struct ScriptContext *ctx) // 02A6 { - u16 idx = ScriptGetVar(ctx); - u16 *prize_item_id = ScriptGetVarPointer(ctx); + u16 idx = ScriptGetVar(ctx); + u16 *prize_item_id = ScriptGetVarPointer(ctx); u16 *prize_cost_in_coins = ScriptGetVarPointer(ctx); - *prize_item_id = gGameCornerPrizes[idx][0]; + *prize_item_id = gGameCornerPrizes[idx][0]; *prize_cost_in_coins = gGameCornerPrizes[idx][1]; return FALSE; diff --git a/arm9/src/scrcmd_sound.c b/arm9/src/scrcmd_sound.c index c2189c629..7053c9197 100644 --- a/arm9/src/scrcmd_sound.c +++ b/arm9/src/scrcmd_sound.c @@ -17,7 +17,7 @@ extern BOOL sub_02005670(void); BOOL ScrCmd_Unk02AE(struct ScriptContext *ctx) // 02AE { - u16 unk0 = ScriptReadHalfword(ctx); + u16 unk0 = ScriptReadHalfword(ctx); u16 *unk1 = ScriptGetVarPointer(ctx); *unk1 = sub_02005410(unk0); @@ -141,7 +141,7 @@ BOOL sub_02041540(struct ScriptContext *ctx) { BOOL ScrCmd_PlayCry(struct ScriptContext *ctx) // 004C { - u16 unk0 = ScriptGetVar(ctx); + u16 unk0 = ScriptGetVar(ctx); u16 unused = ScriptGetVar(ctx); sub_02005578(unk0); return FALSE; diff --git a/arm9/src/scrcmd_underground.c b/arm9/src/scrcmd_underground.c index 1ff0fc7dc..018df6870 100644 --- a/arm9/src/scrcmd_underground.c +++ b/arm9/src/scrcmd_underground.c @@ -13,10 +13,10 @@ extern BOOL sub_020260C4(void *, u16, u16); BOOL ScrCmd_GiveSecretBaseDecoration(struct ScriptContext *ctx) // 0083 { struct SaveData *save = ctx->fieldSystem->saveData; - u16 unk1 = ScriptGetVar(ctx); - u16 unused = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - void *unk2 = sub_02026CC4(save); + u16 unk1 = ScriptGetVar(ctx); + u16 unused = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + void *unk2 = sub_02026CC4(save); *ret_ptr = (u16)sub_02025D6C(unk2, unk1); @@ -25,8 +25,8 @@ BOOL ScrCmd_GiveSecretBaseDecoration(struct ScriptContext *ctx) // 0083 BOOL ScrCmd_TakeSecretBaseDecoration(struct ScriptContext *ctx) // 0084 { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -35,10 +35,10 @@ BOOL ScrCmd_TakeSecretBaseDecoration(struct ScriptContext *ctx) // 0084 BOOL ScrCmd_HasSpaceForDecoration(struct ScriptContext *ctx) // 0085 { struct SaveData *save = ctx->fieldSystem->saveData; - u16 unk1 = ScriptGetVar(ctx); - u16 unused = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - void *unk2 = sub_02026CC4(save); + u16 unk1 = ScriptGetVar(ctx); + u16 unused = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + void *unk2 = sub_02026CC4(save); *ret_ptr = (u16)sub_02025D94(unk2, unk1); @@ -47,8 +47,8 @@ BOOL ScrCmd_HasSpaceForDecoration(struct ScriptContext *ctx) // 0085 BOOL ScrCmd_GetDecorationCount(struct ScriptContext *ctx) // 0086 - somewhat unsure on name, was originally CheckGoods { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -57,10 +57,10 @@ BOOL ScrCmd_GetDecorationCount(struct ScriptContext *ctx) // 0086 - somewhat uns BOOL ScrCmd_GiveUndergroundTrap(struct ScriptContext *ctx) // 0087 { struct SaveData *save = ctx->fieldSystem->saveData; - u16 unk1 = ScriptGetVar(ctx); - u16 unused = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - void *unk2 = sub_02026CC4(save); + u16 unk1 = ScriptGetVar(ctx); + u16 unused = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + void *unk2 = sub_02026CC4(save); *ret_ptr = (u16)sub_02026298(unk2, unk1); @@ -69,8 +69,8 @@ BOOL ScrCmd_GiveUndergroundTrap(struct ScriptContext *ctx) // 0087 BOOL ScrCmd_TakeUndergroundTrap(struct ScriptContext *ctx) // 0088 { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -78,8 +78,8 @@ BOOL ScrCmd_TakeUndergroundTrap(struct ScriptContext *ctx) // 0088 BOOL ScrCmd_HasSpaceForTrap(struct ScriptContext *ctx) // 0089 { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -87,8 +87,8 @@ BOOL ScrCmd_HasSpaceForTrap(struct ScriptContext *ctx) // 0089 BOOL ScrCmd_GetTrapCount(struct ScriptContext *ctx) // 008A { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -97,18 +97,18 @@ BOOL ScrCmd_GetTrapCount(struct ScriptContext *ctx) // 008A BOOL ScrCmd_GiveTreasure(struct ScriptContext *ctx) // 008B { struct SaveData *save = ctx->fieldSystem->saveData; - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - void *unused3 = sub_02026CC4(save); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + void *unused3 = sub_02026CC4(save); return FALSE; } BOOL ScrCmd_TakeTreasure(struct ScriptContext *ctx) // 008C { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -116,8 +116,8 @@ BOOL ScrCmd_TakeTreasure(struct ScriptContext *ctx) // 008C BOOL ScrCmd_HasSpaceForTreasure(struct ScriptContext *ctx) // 008D { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -125,8 +125,8 @@ BOOL ScrCmd_HasSpaceForTreasure(struct ScriptContext *ctx) // 008D BOOL ScrCmd_GetTreasureCount(struct ScriptContext *ctx) // 008E { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -135,10 +135,10 @@ BOOL ScrCmd_GetTreasureCount(struct ScriptContext *ctx) // 008E BOOL ScrCmd_GiveUndergroundSphere(struct ScriptContext *ctx) // 008F { struct SaveData *save = ctx->fieldSystem->saveData; - u16 unk1 = ScriptGetVar(ctx); - u16 unk2 = ScriptGetVar(ctx); - u16 *ret_ptr = ScriptGetVarPointer(ctx); - void *unk3 = sub_02026CC4(save); + u16 unk1 = ScriptGetVar(ctx); + u16 unk2 = ScriptGetVar(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); + void *unk3 = sub_02026CC4(save); *ret_ptr = (u16)sub_020260C4(unk3, unk1, unk2); @@ -147,8 +147,8 @@ BOOL ScrCmd_GiveUndergroundSphere(struct ScriptContext *ctx) // 008F BOOL ScrCmd_TakeUndergroundSphere(struct ScriptContext *ctx) // 0090 { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -156,8 +156,8 @@ BOOL ScrCmd_TakeUndergroundSphere(struct ScriptContext *ctx) // 0090 BOOL ScrCmd_HasSpaceForSphere(struct ScriptContext *ctx) // 0091 { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; @@ -165,8 +165,8 @@ BOOL ScrCmd_HasSpaceForSphere(struct ScriptContext *ctx) // 0091 BOOL ScrCmd_GetSphereCount(struct ScriptContext *ctx) // 0092 { - u16 unused1 = ScriptGetVar(ctx); - u16 unused2 = ScriptGetVar(ctx); + u16 unused1 = ScriptGetVar(ctx); + u16 unused2 = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); return FALSE; diff --git a/arm9/src/scrcmd_union.c b/arm9/src/scrcmd_union.c index e76c697d7..f8203b882 100644 --- a/arm9/src/scrcmd_union.c +++ b/arm9/src/scrcmd_union.c @@ -13,21 +13,21 @@ extern BOOL sub_020612F8(struct FieldSystem *); BOOL ScrCmd_UnionGroup(struct ScriptContext *ctx) // 021D { - MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); + MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); struct UnkSaveStruct_020286F8 *unk_sav_ptr = sub_0202881C(ctx->fieldSystem->saveData); - struct SaveData *save = ctx->fieldSystem->saveData; + struct SaveData *save = ctx->fieldSystem->saveData; u16 option = ScriptReadHalfword(ctx); switch (option) { case 0: { // check if group ID exists - u16 unk_var = ScriptGetVar(ctx); + u16 unk_var = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = (u16)sub_02028828(unk_sav_ptr, unk_var); return FALSE; } case 1: { // check if group ID is accessible - u16 unk_var = ScriptGetVar(ctx); + u16 unk_var = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); *ret_ptr = (u16)sub_02028840(unk_sav_ptr, unk_var); @@ -35,27 +35,27 @@ BOOL ScrCmd_UnionGroup(struct ScriptContext *ctx) // 021D } case 2: { // writes group ID to string buffer u16 unk_var = ScriptGetVar(ctx); - u16 idx = ScriptGetVar(ctx); + u16 idx = ScriptGetVar(ctx); BufferGroupName(*messageFormat, save, unk_var, idx, 0); break; } case 3: { // writes group leader name to string buffer u16 unk_var = ScriptGetVar(ctx); - u16 idx = ScriptGetVar(ctx); + u16 idx = ScriptGetVar(ctx); BufferGroupName(*messageFormat, save, unk_var, idx, 1); break; } case 4: { // opens keyboard, 2 if group id exists, 1 if cancel, 0 otherwise u16 *unk_str_ptr = sub_020287A8(unk_sav_ptr, 0, 0); - u16 *ret_ptr = ScriptGetVarPointer(ctx); + u16 *ret_ptr = ScriptGetVarPointer(ctx); CreateNamingScreen(ctx->taskManager, NAMINGSCREEN_GROUP, 0, PLAYER_NAME_LENGTH, 0, unk_str_ptr, ret_ptr); // should be GROUP_NAME_LENGTH? return TRUE; } case 5: { // enter in group id (whatever this means, needs more investigation) - u16 src_idx = ScriptGetVar(ctx); + u16 src_idx = ScriptGetVar(ctx); BOOL unk_bool = sub_02028828(unk_sav_ptr, 1); sub_02028700(unk_sav_ptr, src_idx, 1); @@ -67,7 +67,7 @@ BOOL ScrCmd_UnionGroup(struct ScriptContext *ctx) // 021D } case 6: { // create a group struct String *player_name = String_New(64, HEAP_ID_32); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); PlayerName_FlatToString(player, player_name); sub_020287C0(unk_sav_ptr, 0, 1, player_name); diff --git a/arm9/src/script.c b/arm9/src/script.c index 25c9b9f45..d967b960e 100644 --- a/arm9/src/script.c +++ b/arm9/src/script.c @@ -5,12 +5,12 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, u32 cmdCount) { int i; - ctx->mode = 0; - ctx->scriptPtr = NULL; + ctx->mode = 0; + ctx->scriptPtr = NULL; ctx->stackDepth = 0; - ctx->nativePtr = NULL; - ctx->cmdTable = cmdTable; - ctx->cmdCount = cmdCount; + ctx->nativePtr = NULL; + ctx->cmdTable = cmdTable; + ctx->cmdCount = cmdCount; for (i = 0; i < NELEMS(ctx->data); i++) { ctx->data[i] = 0; @@ -25,17 +25,17 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, u32 cmdCount) u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr) { ctx->scriptPtr = ptr; - ctx->mode = 1; + ctx->mode = 1; return 1; } void SetupNativeScript(struct ScriptContext *ctx, BOOL (*ptr)(struct ScriptContext *)) { - ctx->mode = 2; + ctx->mode = 2; ctx->nativePtr = ptr; } void StopScript(struct ScriptContext *ctx) { - ctx->mode = 0; + ctx->mode = 0; ctx->scriptPtr = 0; } @@ -111,7 +111,7 @@ void ScriptJump(struct ScriptContext *ctx, const u8 *ptr) { } u8 ScriptCall(struct ScriptContext *ctx, const u8 *ptr) { - u8 ret = ScriptPush(ctx, ctx->scriptPtr); + u8 ret = ScriptPush(ctx, ctx->scriptPtr); ctx->scriptPtr = ptr; return ret; } diff --git a/arm9/src/script_pokemon_util.c b/arm9/src/script_pokemon_util.c index 697579f94..54fca5242 100644 --- a/arm9/src/script_pokemon_util.c +++ b/arm9/src/script_pokemon_util.c @@ -128,7 +128,7 @@ BOOL HasEnoughAlivePokemonForDoubleBattle(struct Party *party) { } void GiveAllMonsTheSinnohChampRibbon(struct Party *party) { - u8 var = 1; + u8 var = 1; int partyCount = Party_GetCount(party); for (int i = 0; i < partyCount; i++) { @@ -145,8 +145,8 @@ void GiveAllMonsTheSinnohChampRibbon(struct Party *party) { int ApplyPoisonStep(struct Party *party, int location) { u32 hp; int numPoisoned = 0; - int numHealed = 0; - int partyCount = Party_GetCount(party); + int numHealed = 0; + int partyCount = Party_GetCount(party); for (int i = 0; i < partyCount; i++) { struct Pokemon *mon = Party_GetMonByIndex(party, i); diff --git a/arm9/src/sound.c b/arm9/src/sound.c index 553704c35..386ce84c3 100644 --- a/arm9/src/sound.c +++ b/arm9/src/sound.c @@ -81,8 +81,8 @@ void sub_02003C40(void) { void sub_02003CE8(int a0) { struct SoundData *sdat = GetSoundDataPointer(); - sdat->unk_BCCFC = 0; - UNK_02107070 = (u32)a0; + sdat->unk_BCCFC = 0; + UNK_02107070 = (u32)a0; } BOOL sub_02003D04(void) { @@ -188,7 +188,7 @@ void *sub_02003D38(u32 a0) { int GF_Snd_SaveState(int *level_p) { struct SoundData *sdat = GetSoundDataPointer(); - int level = NNS_SndHeapSaveState(sdat->heap); + int level = NNS_SndHeapSaveState(sdat->heap); GF_ASSERT(level != -1); if (level_p != NULL) { *level_p = level; diff --git a/arm9/src/string_util.c b/arm9/src/string_util.c index d4d200263..71a1cfd80 100644 --- a/arm9/src/string_util.c +++ b/arm9/src/string_util.c @@ -39,7 +39,7 @@ void CopyU16StringArray(u16 *dest, const u16 *src) { while (c != EOS) { src++; *dest = c; - c = *src; + c = *src; dest++; } *dest = EOS; @@ -115,12 +115,12 @@ u16 *StringFillEOS(u16 *dest, u32 num) { u16 *ConvertUIntToDecimalString(u16 *dest, u32 value, enum PrintingMode mode, u32 n) { for (u32 x = (u32)gPowersOfTen[n - 1]; x != 0; x = x / 10) { u16 res = (u16)(value / x); - value = value - x * res; + value = value - x * res; if (mode == PRINTING_MODE_LEADING_ZEROS) { *dest = res >= 10 ? (u16)CHAR_JP_QUESTION_MARK : gDigitTable[res]; dest++; } else if (res != 0 || x == 1) { - mode = PRINTING_MODE_LEADING_ZEROS; + mode = PRINTING_MODE_LEADING_ZEROS; *dest = res >= 10 ? (u16)CHAR_JP_QUESTION_MARK : gDigitTable[res]; dest++; } else if (mode == PRINTING_MODE_RIGHT_ALIGN) { diff --git a/arm9/src/task.c b/arm9/src/task.c index b35c2a41d..de228486e 100644 --- a/arm9/src/task.c +++ b/arm9/src/task.c @@ -7,14 +7,14 @@ struct TaskManager *Task_New(struct FieldSystem *fieldSystem, TaskFunc taskFunc, void *env) { struct TaskManager *taskManager = AllocFromHeapAtEnd(HEAP_ID_32, sizeof(struct TaskManager)); - taskManager->prev = NULL; - taskManager->func = taskFunc; - taskManager->state = 0; - taskManager->env = env; - taskManager->unk10 = NULL; - taskManager->unk14 = NULL; - taskManager->fieldSystem = fieldSystem; - taskManager->unk1C = AllocFromHeapAtEnd(HEAP_ID_32, 4); + taskManager->prev = NULL; + taskManager->func = taskFunc; + taskManager->state = 0; + taskManager->env = env; + taskManager->unk10 = NULL; + taskManager->unk14 = NULL; + taskManager->fieldSystem = fieldSystem; + taskManager->unk1C = AllocFromHeapAtEnd(HEAP_ID_32, 4); return taskManager; } @@ -24,9 +24,9 @@ void FieldSystem_CreateTask(struct FieldSystem *fieldSystem, TaskFunc taskFunc, } void TaskManager_Jump(struct TaskManager *taskManager, TaskFunc taskFunc, void *env) { - taskManager->func = taskFunc; + taskManager->func = taskFunc; taskManager->state = 0; - taskManager->env = env; + taskManager->env = env; if (taskManager->unk14 != NULL || taskManager->unk14 != NULL) { FreeToHeap(taskManager->unk14); taskManager->unk10 = NULL; @@ -35,8 +35,8 @@ void TaskManager_Jump(struct TaskManager *taskManager, TaskFunc taskFunc, void * } void TaskManager_Call(struct TaskManager *taskManager, TaskFunc taskFunc, void *env) { - struct TaskManager *taskManager2 = Task_New(taskManager->fieldSystem, taskFunc, env); - taskManager2->prev = taskManager; + struct TaskManager *taskManager2 = Task_New(taskManager->fieldSystem, taskFunc, env); + taskManager2->prev = taskManager; taskManager->fieldSystem->taskManager = taskManager2; } @@ -77,7 +77,7 @@ BOOL sub_020464A4(void *r0) { BOOL sub_020464B8(struct TaskManager *taskManager) { struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - u32 *r4_2 = TaskManager_GetEnvironment(taskManager); + u32 *r4_2 = TaskManager_GetEnvironment(taskManager); switch (r4_2[0]) { case 0: sub_020373D4(fieldSystem, (struct OverlayManagerTemplate *)r4_2[1], (void *)r4_2[2]); // FIXME: typing is wrong @@ -95,9 +95,9 @@ BOOL sub_020464B8(struct TaskManager *taskManager) { void sub_02046500(struct TaskManager *taskManager, u32 r5, u32 r4) { u32 *r2 = AllocFromHeapAtEnd(HEAP_ID_32, 3 * sizeof(u32)); - r2[0] = 0; - r2[1] = r5; - r2[2] = r4; + r2[0] = 0; + r2[1] = r5; + r2[2] = r4; TaskManager_Call(taskManager, sub_020464B8, r2); } diff --git a/arm9/src/text.c b/arm9/src/text.c index 5074afa50..cdb27de57 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -86,66 +86,66 @@ void sub_0201BD7C(u8 textPrinterNumber) { u16 AddTextPrinterParameterized(struct Window *window, u8 fontId, struct String *str, u32 x, u32 y, u32 speed, u8 (*callback)(struct TextPrinterTemplate *, u16)) { struct TextPrinterTemplate printerTemplate; - printerTemplate.window = window; + printerTemplate.window = window; printerTemplate.currentChar.wrapped = str; - printerTemplate.fontId = fontId; - printerTemplate.x = (u8)x; - printerTemplate.y = (u8)y; - printerTemplate.currentX = (u8)x; - printerTemplate.currentY = (u8)y; - printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; - printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; - printerTemplate.unk = gFonts[fontId].unk; - printerTemplate.fgColor = gFonts[fontId].fgColor; - printerTemplate.bgColor = gFonts[fontId].bgColor; - printerTemplate.shadowColor = gFonts[fontId].shadowColor; - printerTemplate.unk2 = 0; - printerTemplate.unk3 = 0; - printerTemplate.unk4 = 255; + printerTemplate.fontId = fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; + printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = gFonts[fontId].fgColor; + printerTemplate.bgColor = gFonts[fontId].bgColor; + printerTemplate.shadowColor = gFonts[fontId].shadowColor; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; return AddTextPrinter(&printerTemplate, speed, callback); } u16 AddTextPrinterParameterized2(struct Window *window, u8 fontId, struct String *str, u32 x, u32 y, u32 speed, u32 colors, u8 (*callback)(struct TextPrinterTemplate *, u16)) { struct TextPrinterTemplate printerTemplate; - printerTemplate.window = window; + printerTemplate.window = window; printerTemplate.currentChar.wrapped = str; - printerTemplate.fontId = fontId; - printerTemplate.x = (u8)x; - printerTemplate.y = (u8)y; - printerTemplate.currentX = (u8)x; - printerTemplate.currentY = (u8)y; - printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; - printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; - printerTemplate.unk = gFonts[fontId].unk; - printerTemplate.fgColor = (u8)(colors >> 16); - printerTemplate.shadowColor = (u8)(colors >> 8); - printerTemplate.bgColor = (u8)colors; - printerTemplate.unk2 = 0; - printerTemplate.unk3 = 0; - printerTemplate.unk4 = 255; + printerTemplate.fontId = fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; + printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = (u8)(colors >> 16); + printerTemplate.shadowColor = (u8)(colors >> 8); + printerTemplate.bgColor = (u8)colors; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; return AddTextPrinter(&printerTemplate, speed, callback); } u16 AddTextPrinterParameterized3(struct Window *window, u32 fontId, struct String *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, u8 (*callback)(struct TextPrinterTemplate *, u16)) { struct TextPrinterTemplate printerTemplate; - printerTemplate.window = window; + printerTemplate.window = window; printerTemplate.currentChar.wrapped = str; - printerTemplate.fontId = (u8)fontId; - printerTemplate.x = (u8)x; - printerTemplate.y = (u8)y; - printerTemplate.currentX = (u8)x; - printerTemplate.currentY = (u8)y; - printerTemplate.letterSpacing = (u8)letterSpacing; - printerTemplate.lineSpacing = (u8)lineSpacing; - printerTemplate.unk = gFonts[fontId].unk; - printerTemplate.fgColor = (u8)(colors >> 16); - printerTemplate.shadowColor = (u8)(colors >> 8); - printerTemplate.bgColor = (u8)colors; - printerTemplate.unk2 = 0; - printerTemplate.unk3 = 0; - printerTemplate.unk4 = 255; + printerTemplate.fontId = (u8)fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = (u8)letterSpacing; + printerTemplate.lineSpacing = (u8)lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = (u8)(colors >> 16); + printerTemplate.shadowColor = (u8)(colors >> 8); + printerTemplate.bgColor = (u8)colors; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; return AddTextPrinter(&printerTemplate, speed, callback); } @@ -156,31 +156,31 @@ u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 speed, u8 (* struct TextPrinter *printer = (struct TextPrinter *)AllocFromHeap(HEAP_ID_DEFAULT, sizeof(struct TextPrinter)); - printer->active = TRUE; - printer->state = 0; + printer->active = TRUE; + printer->state = 0; printer->textSpeedBottom = (u8)speed; - printer->delayCounter = 0; - printer->scrollDistance = 0; - printer->Unk29 = 0; + printer->delayCounter = 0; + printer->scrollDistance = 0; + printer->Unk29 = 0; for (s32 i = 0; i < 7; i++) { printer->subStructFields[i] = 0; } - printer->printerTemplate = *printerTemplate; + printer->printerTemplate = *printerTemplate; printer->printerTemplate.currentChar.raw = String_c_str(printer->printerTemplate.currentChar.wrapped); - printer->callback = callback; - UNK_021C570C = 0; + printer->callback = callback; + UNK_021C570C = 0; sub_0201C1A8(printer); if (speed != 0xff && speed != 0) { printer->textSpeedBottom--; - printer->textSpeedTop = 1; + printer->textSpeedTop = 1; printer->minLetterSpacing = sub_0201BCC8((SysTaskFunc)RunTextPrinter, printer, 1); return printer->minLetterSpacing; } else { - u32 j = 0; + u32 j = 0; printer->textSpeedBottom = 0; - printer->textSpeedTop = 0; + printer->textSpeedTop = 0; GenerateFontHalfRowLookupTable(printerTemplate->fgColor, printerTemplate->bgColor, printerTemplate->shadowColor); for (; j < 0x400; ++j) { if (RenderFont(printer) == 1) { @@ -265,16 +265,16 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) { } void DecompressGlyphTile(const u16 *src, u16 *dst) { - dst[0] = sFontHalfRowLookupTable[(u32)src[0] >> 8]; - dst[1] = sFontHalfRowLookupTable[(u8)src[0]]; - dst[2] = sFontHalfRowLookupTable[(u32)src[1] >> 8]; - dst[3] = sFontHalfRowLookupTable[(u8)src[1]]; - dst[4] = sFontHalfRowLookupTable[(u32)src[2] >> 8]; - dst[5] = sFontHalfRowLookupTable[(u8)src[2]]; - dst[6] = sFontHalfRowLookupTable[(u32)src[3] >> 8]; - dst[7] = sFontHalfRowLookupTable[(u8)src[3]]; - dst[8] = sFontHalfRowLookupTable[(u32)src[4] >> 8]; - dst[9] = sFontHalfRowLookupTable[(u8)src[4]]; + dst[0] = sFontHalfRowLookupTable[(u32)src[0] >> 8]; + dst[1] = sFontHalfRowLookupTable[(u8)src[0]]; + dst[2] = sFontHalfRowLookupTable[(u32)src[1] >> 8]; + dst[3] = sFontHalfRowLookupTable[(u8)src[1]]; + dst[4] = sFontHalfRowLookupTable[(u32)src[2] >> 8]; + dst[5] = sFontHalfRowLookupTable[(u8)src[2]]; + dst[6] = sFontHalfRowLookupTable[(u32)src[3] >> 8]; + dst[7] = sFontHalfRowLookupTable[(u8)src[3]]; + dst[8] = sFontHalfRowLookupTable[(u32)src[4] >> 8]; + dst[9] = sFontHalfRowLookupTable[(u8)src[4]]; dst[10] = sFontHalfRowLookupTable[(u32)src[5] >> 8]; dst[11] = sFontHalfRowLookupTable[(u8)src[5]]; dst[12] = sFontHalfRowLookupTable[(u32)src[6] >> 8]; @@ -303,7 +303,7 @@ void sub_0201C1EC(struct TextPrinter *printer, u32 param1, u32 param2, u32 param printer->Unk2C = sub_0201C1B0(); } u16 *r6 = printer->Unk2C + param3 * 24 * 8; - u16 r2 = (u16)((GetWindowWidth(window) - 3) * 8); + u16 r2 = (u16)((GetWindowWidth(window) - 3) * 8); BlitBitmapRectToWindow(window, r6, 0, 0, 24, 32, r2, 0, 24, 32); } diff --git a/arm9/src/timer3.c b/arm9/src/timer3.c index 89dc366dd..c5beaa2b2 100644 --- a/arm9/src/timer3.c +++ b/arm9/src/timer3.c @@ -12,7 +12,7 @@ static BOOL timer3_needReset; static vu64 timer3_counter; void Init_Timer3() { - timer3_counter = 0; + timer3_counter = 0; timer3_needReset = FALSE; OS_SetTimerControl(OS_TIMER_3, 0); @@ -40,7 +40,7 @@ void CountUpTimer3() { u64 internal_GetTimer3Count() { OSIntrMode intr_mode = OS_DisableInterrupts(); - vu16 timer3 = reg_OS_TM3CNT_L; + vu16 timer3 = reg_OS_TM3CNT_L; vu64 counter = timer3_counter & 0x0000ffffffffffff; if (reg_OS_IF & OS_IE_TIMER3 && !(timer3 & 0x8000)) { diff --git a/arm9/src/trainer_data.c b/arm9/src/trainer_data.c index a712b1b32..02b7f6ddb 100644 --- a/arm9/src/trainer_data.c +++ b/arm9/src/trainer_data.c @@ -22,7 +22,7 @@ void EnemyTrainerSet_Init(BattleSetup *setup, struct SaveData *save, HeapID heap s32 i; struct String *str; - msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0559_bin, heapId); + msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0559_bin, heapId); rivalName = GetRivalNamePtr(sub_02024EC0(save)); for (i = 0; i < 4; i++) { if (setup->trainerId[i] != 0) { @@ -266,7 +266,7 @@ void CreateNPCTrainerParty(BattleSetup *setup, s32 party_id, HeapID heapId) { // state seed_bak = GetLCRNGSeed(); Party_InitWithMaxSize(setup->party[party_id], PARTY_SIZE); - data = (union TrainerMon *)AllocFromHeap(heapId, sizeof(union TrainerMon) * PARTY_SIZE); + data = (union TrainerMon *)AllocFromHeap(heapId, sizeof(union TrainerMon) * PARTY_SIZE); pokemon = AllocMonZeroed(heapId); TrainerData_ReadTrPoke(setup->trainerId[party_id], data); diff --git a/arm9/src/unk_020040F4.c b/arm9/src/unk_020040F4.c index 9b9b0ef38..e43274010 100644 --- a/arm9/src/unk_020040F4.c +++ b/arm9/src/unk_020040F4.c @@ -52,7 +52,7 @@ extern void NNS_SndPlayerSetPlayerVolume(u32, u8); void sub_020040F4(u8 param0) { u8 *ptr = sub_02003D38(5); - *ptr = param0; + *ptr = param0; } u8 sub_02004104(void) { @@ -63,7 +63,7 @@ u8 sub_02004104(void) { void sub_02004110(u16 param0) { u16 *ptr = sub_02003D38(9); - *ptr = param0; + *ptr = param0; sub_02004130(0); } @@ -76,7 +76,7 @@ u16 sub_02004124(void) { void sub_02004130(u16 param0) { u16 *ptr = sub_02003D38(10); - *ptr = param0; + *ptr = param0; } u16 sub_02004140(void) { @@ -87,15 +87,15 @@ u16 sub_02004140(void) { void sub_0200414C(u16 param0) { u16 *ptr = sub_02003D38(31); - *ptr = param0; + *ptr = param0; } void sub_0200415C(u8 param0) { - u8 *ptr = sub_02003D38(20); + u8 *ptr = sub_02003D38(20); u8 *ptr2 = sub_02003D38(21); if (param0 < 51) { - *ptr = param0; + *ptr = param0; *ptr2 = 0; } else { *ptr2 = param0; @@ -342,7 +342,7 @@ void sub_02004568(int seqNo, u16 param1) { } void sub_020045C4(int seqNo, u32 param1) { - u8 *ptr = sub_02003D38(18); + u8 *ptr = sub_02003D38(18); u16 *ptr2 = sub_02003D38(31); if (*ptr != 1 && param1 != 0) { @@ -471,14 +471,14 @@ void sub_020047C8(u8 param0, u8 param1) { int r4; if (param0 == 1) { ptr = sub_02003D38(11); - r4 = 0; + r4 = 0; } else { if (param0 != 7) { return; } ptr = sub_02003D38(12); - r4 = 7; + r4 = 7; } if (param1 == 0) { @@ -490,10 +490,10 @@ void sub_020047C8(u8 param0, u8 param1) { } void sub_02004810(void) { - u8 *ptr = sub_02003D38(11); + u8 *ptr = sub_02003D38(11); u8 *ptr2 = sub_02003D38(12); - *ptr = 0; - *ptr2 = 0; + *ptr = 0; + *ptr2 = 0; } void GF_SndPlayerMoveVolume(int playerNo, s32 param1, s32 param2) { @@ -589,7 +589,7 @@ u32 GF_MIC_DoSamplingAsync(u32 param0, u32 param1, u32 param2, u32 param3) { void *sub_02004930(u32 param0) { GetSoundDataPointer(); - u8 *ptr = sub_02003D38(15); + u8 *ptr = sub_02003D38(15); u8 *ptr2 = sub_02003D38(16); GF_ASSERT(param0 == 14 || param0 == 15); GF_ASSERT(param0 != 14 || *ptr != 0); @@ -604,14 +604,14 @@ void *sub_02004930(u32 param0) { BOOL sub_02004984(u32 param0) { GetSoundDataPointer(); - u8 *ptr = sub_02003D38(15); + u8 *ptr = sub_02003D38(15); u8 *ptr2 = sub_02003D38(16); GF_ASSERT(param0 == 14 || param0 == 15); if (param0 == 14) { if (*ptr == 0) { u32 *r4 = sub_02003D38(0); - *r4 = NNS_SndWaveOutAllocChannel(param0); + *r4 = NNS_SndWaveOutAllocChannel(param0); if (*r4 == 0) { return FALSE; } @@ -622,7 +622,7 @@ BOOL sub_02004984(u32 param0) { } else { if (*ptr2 == 0) { u32 *r6 = sub_02003D38(1); - *r6 = NNS_SndWaveOutAllocChannel(param0); + *r6 = NNS_SndWaveOutAllocChannel(param0); if (*r6 == 0) { return FALSE; } @@ -638,7 +638,7 @@ BOOL sub_02004984(u32 param0) { void sub_02004A04(u32 param0) { GetSoundDataPointer(); - u8 *ptr = sub_02003D38(15); + u8 *ptr = sub_02003D38(15); u8 *ptr2 = sub_02003D38(16); if (param0 != 14 && param0 != 15) { GF_AssertFail(); @@ -732,7 +732,7 @@ u32 sub_02004B30(u32 param0, s32 param1, s32 param2, u32 param3, HeapID heapId) if (param3 == 14) { void *ptr = AllocFromHeap(heapId, r6); - *r4 = ptr; + *r4 = ptr; if (ptr == NULL) { GF_AssertFail(); return 0; @@ -764,22 +764,22 @@ u32 sub_02004B30(u32 param0, s32 param1, s32 param2, u32 param3, HeapID heapId) u32 ret = sub_02004A6C(&st8, param3); sub_02004AF8(param3, param1); u8 *r0 = sub_02003D38(14); - *r0 = 1; + *r0 = 1; return ret; } void sub_02004C1C(u8 *param0, u32 param1) { for (u32 r5 = 0; r5 < param1 / 2; r5++) { - u8 r4 = param0[r5]; - param0[r5] = param0[param1 - 1 - r5]; + u8 r4 = param0[r5]; + param0[r5] = param0[param1 - 1 - r5]; param0[param1 - 1 - r5] = r4; } } void sub_02004C3C(u32 param0) { GetSoundDataPointer(); - u8 *ptr = sub_02003D38(14); + u8 *ptr = sub_02003D38(14); void **ptr2 = sub_02003D38(33); GF_ASSERT(param0 == 14 || param0 == 15); @@ -815,7 +815,7 @@ void sub_02004CB4(void) { MI_CpuFill8(sub_02003D38(4), 0, 0x1c); - void *r4 = sub_02003D38(3); + void *r4 = sub_02003D38(3); void *st8 = sub_02003D38(4); NNS_SndCaptureStartEffect(r4, 0x1000, 0, 0x55F0, 2, sub_02005068, st8); @@ -1003,7 +1003,7 @@ void sub_02004F70( s32 r1; int i, j; u32 r12 = sub_02004F28(1, param0, param3); - r1 = (s32)r12 - 100; + r1 = (s32)r12 - 100; if (r1 < 0) { r1 = 0; } @@ -1078,7 +1078,7 @@ void sub_02004F70( void sub_02005068(s16 *param0, s16 *param1, u32 param2, u32 param3, void *param4) { s16 st10[8][2]; s16(*st0)[2] = param4; - u8 *r7 = sub_02003D38(19); + u8 *r7 = sub_02003D38(19); int r0; int i, j; diff --git a/arm9/src/unk_020051F4.c b/arm9/src/unk_020051F4.c index 4dae2779c..a2276a259 100644 --- a/arm9/src/unk_020051F4.c +++ b/arm9/src/unk_020051F4.c @@ -30,7 +30,7 @@ u32 sub_020051F4(u16 param0) { } u32 sub_0200521C(u16 param0) { - u8 r4 = sub_020048D0(param0); + u8 r4 = sub_020048D0(param0); int playerNo = sub_02004018(r4); u32 ret; @@ -238,7 +238,7 @@ void sub_0200554C(u32 param0) { } u32 sub_02005578(u16 species) { - u8 *r4 = sub_02003D38(17); + u8 *r4 = sub_02003D38(17); struct SaveChatotSoundClip **r0 = sub_02003D38(35); if (species != SPECIES_CHATOT) { @@ -311,8 +311,8 @@ u32 sub_020056AC(u32 param0, u16 param1, s32 param2, s32 param3, HeapID heapId) s32 st1c, st18; u8 *st14 = sub_02003D38(15); u8 *st10 = sub_02003D38(16); - u8 *r4 = sub_02003D38(17); - u8 *stc = sub_02003D38(29); + u8 *r4 = sub_02003D38(17); + u8 *stc = sub_02003D38(29); sub_02003D38(35); st1c = 64 + (param2 / 2); @@ -502,7 +502,7 @@ void sub_02005AE0(u32 param0, HeapID heapId) { ptr[0] = param0; u32 r0 = (u32)SysTask_CreateOnMainQueue((SysTaskFunc)sub_02005B2C, (void *)ptr, 0); // TODO: fix this func ptr[1] = r0; - *r6 = r0; + *r6 = r0; } void sub_02005B2C(SysTask *task, s32 *param1) { diff --git a/arm9/src/unk_02006D98.c b/arm9/src/unk_02006D98.c index 9133f4e26..13b4d50fc 100644 --- a/arm9/src/unk_02006D98.c +++ b/arm9/src/unk_02006D98.c @@ -304,12 +304,12 @@ extern void NNS_G2dDrawSpriteFast(s16 param0, struct UnkStruct_02006D98 *sub_02006D98(HeapID heapId) { struct UnkStruct_02006D98 *ptr = AllocFromHeap(heapId, sizeof(struct UnkStruct_02006D98)); - ptr->heapId = heapId; - ptr->unk2E0 = 0; - ptr->unk29C = 0; - ptr->unk2A0 = 0x8000; - ptr->unk2A4 = 0; - ptr->unk2A8 = 0x80; + ptr->heapId = heapId; + ptr->unk2E0 = 0; + ptr->unk29C = 0; + ptr->unk2A0 = 0x8000; + ptr->unk2A4 = 0; + ptr->unk2A8 = 0x80; ptr->unk2AC = AllocFromHeap(heapId, 0x8000); @@ -332,10 +332,10 @@ struct UnkStruct_02006D98 *sub_02006D98(HeapID heapId) { NNSG2dCharacterData *stc; NNS_G2dGetUnpackedCharacterData(st4, &stc); - ptr->unk2B8.pixelFmt = stc->pixelFmt; - ptr->unk2B8.mapingType = stc->mapingType; + ptr->unk2B8.pixelFmt = stc->pixelFmt; + ptr->unk2B8.mapingType = stc->mapingType; ptr->unk2B8.characterFmt = stc->characterFmt; - st8 = stc->pRawData; + st8 = stc->pRawData; sub_02008A74(st8); MI_CpuFill8(ptr->unk2AC, *st8, 0x8000); @@ -423,11 +423,11 @@ void sub_02006ED4(struct UnkStruct_02006D98 *param0) { 0); if (param0->unk000[st18].unk54_1 != 0) { - int r6 = param0->unk000[st18].unk44 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][0]; + int r6 = param0->unk000[st18].unk44 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][0]; int r12 = param0->unk000[st18].unk46; - int r1 = param0->unk000[st18].unk45 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][1]; - int r7 = param0->unk000[st18].unk47; - int r0 = r12 + r6; + int r1 = param0->unk000[st18].unk45 + UNK_020ECD4C[st18][param0->unk000[st18].unk5B][1]; + int r7 = param0->unk000[st18].unk47; + int r0 = r12 + r6; NNS_G2dDrawSpriteFast((s16)(param0->unk000[st18].unk24 - 40 + param0->unk000[st18].unk44 + param0->unk000[st18].unk2C), (s16)(param0->unk000[st18].unk26 - 40 + param0->unk000[st18].unk45 + param0->unk000[st18].unk2E - param0->unk000[st18].unk6C.unk2), @@ -565,23 +565,23 @@ struct UnkStruct_02006D98_2 *sub_020073E8(struct UnkStruct_02006D98 *param0, param0->unk000[param6].unk00_8 = 1; param0->unk000[param6].unk00_1 = param5; - param0->unk000[param6].unk04 = *param1; - param0->unk000[param6].unk14 = *param1; - param0->unk000[param6].unk24 = (s16)param2; - param0->unk000[param6].unk26 = (s16)param3; - param0->unk000[param6].unk28 = param4; - param0->unk000[param6].unk34 = 0x100; - param0->unk000[param6].unk36 = 0x100; - param0->unk000[param6].unk54_2 = 0x1f; - param0->unk000[param6].unk50_0 = 0x1f; - param0->unk000[param6].unk50_5 = 0x1f; - param0->unk000[param6].unk50_a = 0x1f; - param0->unk000[param6].unk50_f = 0x10; - param0->unk000[param6].unk50_14 = 0x10; - param0->unk000[param6].unk50_19 = 0x10; - param0->unk000[param6].unk68 = param8; - param0->unk000[param6].unk6C.unk4 = (s16)param2; - param0->unk000[param6].unk6C.unk6 = (s16)param3; + param0->unk000[param6].unk04 = *param1; + param0->unk000[param6].unk14 = *param1; + param0->unk000[param6].unk24 = (s16)param2; + param0->unk000[param6].unk26 = (s16)param3; + param0->unk000[param6].unk28 = param4; + param0->unk000[param6].unk34 = 0x100; + param0->unk000[param6].unk36 = 0x100; + param0->unk000[param6].unk54_2 = 0x1f; + param0->unk000[param6].unk50_0 = 0x1f; + param0->unk000[param6].unk50_5 = 0x1f; + param0->unk000[param6].unk50_a = 0x1f; + param0->unk000[param6].unk50_f = 0x10; + param0->unk000[param6].unk50_14 = 0x10; + param0->unk000[param6].unk50_19 = 0x10; + param0->unk000[param6].unk68 = param8; + param0->unk000[param6].unk6C.unk4 = (s16)param2; + param0->unk000[param6].unk6C.unk6 = (s16)param3; param0->unk000[param6].unk6C.unk0_2 = 1; param0->unk000[param6].unk6C.unk0_3 = 1; param0->unk000[param6].unk6C.unk0_4 = 1; @@ -700,15 +700,15 @@ void sub_02007558(struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2) { param0->unk00_8 = 1; break; case 31: - param0->unk4C = param2; + param0->unk4C = param2; param0->unk00_8 = 1; break; case 32: - param0->unk48 = (u8)param2; + param0->unk48 = (u8)param2; param0->unk00_8 = 1; break; case 33: - param0->unk49 = (u8)param2; + param0->unk49 = (u8)param2; param0->unk00_8 = 1; break; case 34: @@ -737,7 +737,7 @@ void sub_02007558(struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2) { break; case 42: param0->unk6C.unk0_0 = (u16)param2; - param0->unk00_8 = 1; + param0->unk00_8 = 1; break; case 43: param0->unk6C.unk0_2 = (u16)param2; @@ -1054,20 +1054,20 @@ void sub_020079E0(struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2) { void sub_02007E40( struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2, u32 param3, u32 param4) { param0->unk54_1 = 1; - param0->unk44 = (u8)param1; - param0->unk45 = (u8)param2; - param0->unk46 = (u8)param3; - param0->unk47 = (u8)param4; + param0->unk44 = (u8)param1; + param0->unk45 = (u8)param2; + param0->unk46 = (u8)param3; + param0->unk47 = (u8)param4; } void sub_02007E68( struct UnkStruct_02006D98_2 *param0, u32 param1, u32 param2, u32 param3, u32 param4) { param0->unk54_C = 1; - param0->unk48 = (u8)param1; - param0->unk49 = (u8)param2; - param0->unk4A = 0; - param0->unk4B = (u8)param3; - param0->unk4C = param4; + param0->unk48 = (u8)param1; + param0->unk49 = (u8)param2; + param0->unk4A = 0; + param0->unk4B = (u8)param3; + param0->unk4C = param4; } void sub_02007E98( @@ -1078,21 +1078,21 @@ void sub_02007E98( } param0->unk000[i].unk54_C = 1; - param0->unk000[i].unk48 = (u8)param1; - param0->unk000[i].unk49 = (u8)param2; - param0->unk000[i].unk4A = 0; - param0->unk000[i].unk4B = (u8)param3; - param0->unk000[i].unk4C = param4; + param0->unk000[i].unk48 = (u8)param1; + param0->unk000[i].unk49 = (u8)param2; + param0->unk000[i].unk4A = 0; + param0->unk000[i].unk4B = (u8)param3; + param0->unk000[i].unk4C = param4; } } void sub_02007EEC(struct UnkStruct_02006D98_2 *param0) { param0->unk54_C = 0; - param0->unk48 = 0; - param0->unk49 = 0; - param0->unk4A = 0; - param0->unk4B = 0; - param0->unk4C = 0; + param0->unk48 = 0; + param0->unk49 = 0; + param0->unk4A = 0; + param0->unk4B = 0; + param0->unk4C = 0; param0->unk00_8 = 1; } @@ -1189,8 +1189,8 @@ void sub_020080E0(struct UnkStruct_02006D98_2 *param0) { } void sub_0200813C(struct UnkStruct_02006D98_2 *param0) { - param0->unk04 = param0->unk14; - param0->unk6C = param0->unk78; + param0->unk04 = param0->unk14; + param0->unk6C = param0->unk78; param0->unk00_7 = 1; param0->unk00_8 = 1; } @@ -1214,9 +1214,9 @@ void sub_020081C4(struct UnkStruct_02006D98 *param0) { param0->unk2E1 = 0; NNS_G2dInitImageProxy(¶m0->unk260); - param0->unk2B8.H = 0x20; - param0->unk2B8.W = 0x20; - param0->unk2B8.szByte = param0->unk2A0; + param0->unk2B8.H = 0x20; + param0->unk2B8.W = 0x20; + param0->unk2B8.szByte = param0->unk2A0; param0->unk2B8.pRawData = param0->unk2AC; NNS_G2dLoadImage2DMapping( @@ -1227,7 +1227,7 @@ void sub_020081C4(struct UnkStruct_02006D98 *param0) { param0->unk2E2 = 0; NNS_G2dInitImagePaletteProxy(¶m0->unk284); - param0->unk2D0.szByte = param0->unk2A8; + param0->unk2D0.szByte = param0->unk2A8; param0->unk2D0.pRawData = param0->unk2B0; NNS_G2dLoadPalette( @@ -1264,13 +1264,13 @@ void sub_020082A8(struct UnkStruct_02006D98 *param0) { for (st54 = 0; st54 < 4; st54++) { if (param0->unk000[st54].unk00_0 != 0 && param0->unk000[st54].unk00_7 != 0) { param0->unk000[st54].unk00_7 = 0; - st48 = 1; - st4c = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st54].unk04.field_00, + st48 = 1; + st4c = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st54].unk04.field_00, param0->unk000[st54].unk04.field_02, param0->heapId); NNS_G2dGetUnpackedCharacterData(st4c, &st58); - param0->unk2B8.pixelFmt = st58->pixelFmt; - param0->unk2B8.mapingType = st58->mapingType; + param0->unk2B8.pixelFmt = st58->pixelFmt; + param0->unk2B8.mapingType = st58->mapingType; param0->unk2B8.characterFmt = st58->characterFmt; st50 = st58->pRawData; @@ -1371,13 +1371,13 @@ void sub_020086F4(struct UnkStruct_02006D98 *param0) { for (st14 = 0; st14 < 4; st14++) { if (param0->unk000[st14].unk00_0 != 0 && param0->unk000[st14].unk00_8 != 0) { param0->unk000[st14].unk00_8 = 0; - stc = 1; - st10 = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st14].unk04.field_00, + stc = 1; + st10 = AllocAndReadWholeNarcMemberByIdPair((NarcId)param0->unk000[st14].unk04.field_00, param0->unk000[st14].unk04.field_04, param0->heapId); NNS_G2dGetUnpackedPaletteData(st10, &st18); param0->unk2D0.fmt = st18->fmt; - r1 = st18->pRawData; + r1 = st18->pRawData; for (r7 = 0; r7 < 0x10; r7++) { param0->unk2B0[st14 * 0x10 + r7] = r1[r7]; param0->unk2B4[st14 * 0x10 + r7] = r1[r7]; @@ -1400,7 +1400,7 @@ void sub_020086F4(struct UnkStruct_02006D98 *param0) { if (param0->unk000[st14].unk00_0 != 0 && param0->unk000[st14].unk54_C != 0) { if (param0->unk000[st14].unk4A == 0) { - stc = 1; + stc = 1; param0->unk000[st14].unk4A = param0->unk000[st14].unk4B; BlendPalette(param0->unk2B4 + st14 * 0x10, param0->unk2B0 + st14 * 0x10, @@ -1453,7 +1453,7 @@ void sub_02008904(u8 *param0, u32 param1, u32 param2) { for (i = 0; i < 4; i++) { st10 = UNK_02105AE8[i]; - r1 = 0; + r1 = 0; while (st10[r1].unk0 != 0xff) { r0 = (u8)(st10[r1].unk0 + ((param1 & 0xf) - 8)); r4 = (u8)(st10[r1].unk1 + (((param1 & 0xf0) >> 4) - 8)); @@ -1478,7 +1478,7 @@ void sub_02008904(u8 *param0, u32 param1, u32 param2) { if (param2 != 0) { for (i = 0; i < 4; i++) { st10 = UNK_02105AE8[i]; - r1 = 0; + r1 = 0; while (st10[r1].unk0 != 0xff) { r0 = (u8)(st10[r1].unk0 - 14 + ((param1 & 0xf) - 8) + 0x50); r4 = (u8)(st10[r1].unk1 + (((param1 & 0xf0) >> 4) - 8)); diff --git a/arm9/src/unk_02008AA4.c b/arm9/src/unk_02008AA4.c index e5e117c91..ffc3523f3 100644 --- a/arm9/src/unk_02008AA4.c +++ b/arm9/src/unk_02008AA4.c @@ -34,7 +34,7 @@ void sub_02008AA4(struct UnkStruct_0200BB14_sub *param0, struct UnkStruct_02008DEC_sub *st10; struct UnkStruct_02008DEC_sub *stc = NULL; - struct UnkStruct_02008DEC_sub *r4 = NULL; + struct UnkStruct_02008DEC_sub *r4 = NULL; struct UnkStruct_02008DEC_sub *st8 = NULL; GF_ASSERT(param9); @@ -117,8 +117,8 @@ struct UnkStruct_02008AA4_1 *sub_02008BE0(struct UnkStruct_02008AA4_2 *param0, } struct UnkStruct_02008AA4_1 *r6 = AllocFromHeap(heapId, sizeof(struct UnkStruct_02008AA4_1)); - r6->unk00 = AllocFromHeap(heapId, r4 * sizeof(struct UnkStruct_0200BB14_sub)); - r6->unk04 = r4; + r6->unk00 = AllocFromHeap(heapId, r4 * sizeof(struct UnkStruct_0200BB14_sub)); + r6->unk04 = r4; for (int r7 = 0; r7 < r6->unk04; r7++) { sub_02008AA4(&r6->unk00[r7], diff --git a/arm9/src/unk_02008DEC.c b/arm9/src/unk_02008DEC.c index a58db0d59..bbd8de8a9 100644 --- a/arm9/src/unk_02008DEC.c +++ b/arm9/src/unk_02008DEC.c @@ -35,8 +35,8 @@ extern s32 NNS_G2dGetImagePaletteLocation(u32, u32); struct UnkStruct_02008DEC_1 *sub_02008DEC(u32 param0, s32 param1, HeapID heapId) { struct UnkStruct_02008DEC_1 *ptr = AllocFromHeap(heapId, sizeof(struct UnkStruct_02008DEC_1)); - ptr->unk00 = sub_02020C44(param0, heapId); - ptr->unk04 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub)); + ptr->unk00 = sub_02020C44(param0, heapId); + ptr->unk04 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub)); memset(ptr->unk04, 0, param0 * sizeof(struct UnkStruct_02008DEC_sub)); ptr->unk08 = (s32)param0; ptr->unk0C = 0; @@ -226,8 +226,8 @@ void sub_02009168(struct UnkStruct_02008DEC_1 *param0, GF_ASSERT(param1); GF_ASSERT(param1->unk04 == 1); - s32 r6 = sub_02009530(param1); - u32 r7 = sub_020095E4(param1); + s32 r6 = sub_02009530(param1); + u32 r7 = sub_020095E4(param1); u32 st24 = sub_02009610(param1); sub_02009490(param0, param1); @@ -360,9 +360,9 @@ void sub_020093DC(struct UnkStruct_02008DEC_1 *param0, struct UnkStruct_02008DEC_5 *sub_02009424(s32 param0, HeapID heapId) { struct UnkStruct_02008DEC_5 *r4 = AllocFromHeap(heapId, sizeof(struct UnkStruct_02008DEC_5)); - r4->unk00 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub *)); - r4->unk04 = param0; - r4->unk08 = 0; + r4->unk00 = AllocFromHeap(heapId, param0 * sizeof(struct UnkStruct_02008DEC_sub *)); + r4->unk04 = param0; + r4->unk08 = 0; return r4; } @@ -524,7 +524,7 @@ void sub_020096B4(struct UnkStruct_02008DEC_2 *param0) { FreeToHeap(param0->unk00_4); } param0->unk00_4 = NULL; - param0->unk04 = 0; + param0->unk04 = 0; } s32 sub_020096CC(struct UnkStruct_02008DEC_2 *param0) { @@ -719,7 +719,7 @@ void sub_02009978(struct UnkStruct_02008DEC_1 *param0, u32 param8, HeapID heapId, BOOL param10) { - void *r1 = GfGfxLoader_LoadFromNarc(param2, param3, param4, heapId, param10); + void *r1 = GfGfxLoader_LoadFromNarc(param2, param3, param4, heapId, param10); param1->unk00 = sub_02020CD4(param0->unk00, r1, param5); param1->unk04 = param8; diff --git a/arm9/src/unk_0200BB14.c b/arm9/src/unk_0200BB14.c index 5cb5b224e..003f8c93a 100644 --- a/arm9/src/unk_0200BB14.c +++ b/arm9/src/unk_0200BB14.c @@ -209,7 +209,7 @@ void sub_0200BD04(u32 *param0) { BOOL sub_0200BD20( struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1, const char **param2) { - s32 st14 = 6; + s32 st14 = 6; const char **st10 = param2; if (param0 == NULL || param1 == NULL) { @@ -221,12 +221,12 @@ BOOL sub_0200BD20( } param1->unk54 = st14; - u32 r2 = sub_0200965C(); + u32 r2 = sub_0200965C(); param1->unk08 = AllocFromHeap(param0->heapId, r2 * st14); for (s32 i = 0; i < st14; i++) { struct UnkStruct_02008DEC_2 *st18 = sub_02009660(param1->unk08, i); - void *st1c = AllocAndReadFile(param0->heapId, st10[i]); + void *st1c = AllocAndReadFile(param0->heapId, st10[i]); sub_02009668(st1c, st18, param0->heapId); FreeToHeap(st1c); @@ -238,14 +238,14 @@ BOOL sub_0200BD20( for (s32 i = 0; i < st14; i++) { struct UnkStruct_02008DEC_2 *st20 = sub_02009660(param1->unk08, i); - param1->unk24[i] = sub_02009424(sub_020096CC(st20), param0->heapId); - param1->unk3c[i] = sub_020093A8(param1->unk0c[i], st20, param1->unk24[i], param0->heapId); + param1->unk24[i] = sub_02009424(sub_020096CC(st20), param0->heapId); + param1->unk3c[i] = sub_020093A8(param1->unk0c[i], st20, param1->unk24[i], param0->heapId); } sub_02009A90(param1->unk24[0]); sub_02009D34(param1->unk24[1]); struct UnkStruct_02008AA4_2 *r6 = AllocAndReadFile(param0->heapId, st10[6]); - param1->unk04 = sub_02008BE0(r6, + param1->unk04 = sub_02008BE0(r6, param0->heapId, param1->unk0c[0], param1->unk0c[1], @@ -473,7 +473,7 @@ struct UnkStruct_0200BB14_5 *sub_0200C154( } ptr->unk08->unk0 = AllocFromHeap(param0->heapId, sizeof(struct UnkStruct_0200BB14_sub)); - ptr->unk04 = ptr->unk08->unk0; + ptr->unk04 = ptr->unk08->unk0; if (ptr->unk08->unk0 == NULL) { if (ptr->unk08 != NULL) { FreeToHeap(ptr->unk08); diff --git a/arm9/src/unk_02021590.c b/arm9/src/unk_02021590.c index 0c6002213..f67514417 100644 --- a/arm9/src/unk_02021590.c +++ b/arm9/src/unk_02021590.c @@ -50,18 +50,18 @@ void FontData_Init(struct FontData *ptr, NarcId narcId, s32 fileId, BOOL unk, He NARC_ReadFromMember(ptr->narc, (u32)fileId, 0, 16, &ptr->gfxHeader); ptr->isFixedWidthFont = unk; if (unk) { - ptr->glyphWidths = NULL; + ptr->glyphWidths = NULL; ptr->glyphWidthFunc = GetGlyphWidth_FixedWidth; } else { GF_ASSERT(ptr->gfxHeader.widthDataStart != 0); - ptr->glyphWidths = AllocFromHeap(heapId, ptr->gfxHeader.numGlyphs); + ptr->glyphWidths = AllocFromHeap(heapId, ptr->gfxHeader.numGlyphs); ptr->glyphWidthFunc = GetGlyphWidth_VariableWidth; NARC_ReadFromMember(ptr->narc, (u32)fileId, ptr->gfxHeader.widthDataStart, ptr->gfxHeader.numGlyphs, ptr->glyphWidths); } GF_ASSERT(ptr->gfxHeader.glyphWidth <= 2 && ptr->gfxHeader.glyphHeight <= 2); ptr->glyphShape = sGlyphShapes[ptr->gfxHeader.glyphWidth - 1][ptr->gfxHeader.glyphHeight - 1]; - ptr->glyphSize = (u32)(16 * ptr->gfxHeader.glyphWidth * ptr->gfxHeader.glyphHeight); - ptr->fileId = (u32)fileId; + ptr->glyphSize = (u32)(16 * ptr->gfxHeader.glyphWidth * ptr->gfxHeader.glyphHeight); + ptr->fileId = (u32)fileId; } } @@ -80,8 +80,8 @@ void InitFontResources(struct FontData *ptr, u32 a1, HeapID heapId) { } void InitFontResources_FromPreloaded(struct FontData *ptr, HeapID heapId) { - u32 r4 = ptr->glyphSize * ptr->gfxHeader.numGlyphs; - ptr->narcReadBuf = AllocFromHeap(heapId, r4); + u32 r4 = ptr->glyphSize * ptr->gfxHeader.numGlyphs; + ptr->narcReadBuf = AllocFromHeap(heapId, r4); ptr->uncompGlyphFunc = DecompressGlyphTiles_FromPreloaded; NARC_ReadFromMember(ptr->narc, ptr->fileId, ptr->gfxHeader.headerSize, r4, ptr->narcReadBuf); } @@ -108,7 +108,7 @@ void TryLoadGlyph(struct FontData *ptr, u32 param1, struct UnkStruct_02002C14_su if (param1 <= ptr->gfxHeader.numGlyphs) { ptr->uncompGlyphFunc(ptr, (u16)(param1 - 1), ptr2); } else { - ptr2->width = 0; + ptr2->width = 0; ptr2->height = 0; } } @@ -134,7 +134,7 @@ void DecompressGlyphTiles_FromPreloaded(struct FontData *ptr, u16 param1, struct DecompressGlyphTile((void *)(r4 + 0x30), (void *)(param2->buf + 0x60)); break; } - param2->width = (u8)ptr->glyphWidthFunc(ptr, param1); + param2->width = (u8)ptr->glyphWidthFunc(ptr, param1); param2->height = ptr->gfxHeader.fixedHeight; } @@ -159,7 +159,7 @@ void DecompressGlyphTiles_LazyFromNarc(struct FontData *ptr, u16 param1, struct DecompressGlyphTile((void *)(ptr->glyphReadBuf + 0x30), (void *)(param2->buf + 0x60)); break; } - param2->width = (u8)ptr->glyphWidthFunc(ptr, param1); + param2->width = (u8)ptr->glyphWidthFunc(ptr, param1); param2->height = ptr->gfxHeader.fixedHeight; } @@ -190,7 +190,7 @@ int GetGlyphWidth_FixedWidth(struct FontData *ptr, int a1) { s32 GetStringWidthMultiline(struct FontData *r7, const u16 *arr, u32 r6) { s32 ret = 0; - u32 r4 = 0; + u32 r4 = 0; while (*arr != EOS) { if (*arr == EXT_CTRL_CODE_BEGIN) { arr = MsgArray_SkipControlCode(arr); diff --git a/arm9/src/unk_02021934.c b/arm9/src/unk_02021934.c index 47616ec0d..1b99e5381 100644 --- a/arm9/src/unk_02021934.c +++ b/arm9/src/unk_02021934.c @@ -9,9 +9,9 @@ struct String *String_New(u32 length, HeapID heapId) { struct String *ret = AllocFromHeap(heapId, length * 2 + 10); if (ret != NULL) { - ret->magic = STR16_MAGIC; + ret->magic = STR16_MAGIC; ret->maxsize = (u16)length; - ret->size = 0; + ret->size = 0; ret->data[0] = EOS; } return ret; @@ -25,7 +25,7 @@ void String_Delete(struct String *str) { void String_SetEmpty(struct String *str) { ASSERT_STR16(str); - str->size = 0; + str->size = 0; str->data[0] = EOS; } @@ -81,7 +81,7 @@ void String16_FormatInteger(struct String *str, int num, u32 ndigits, enum Print String_SetEmpty(str); if (isNegative) { num *= -1; - u16 hyphen = (u16)((whichCharset == 0) ? 0x00F1 : 0x01BE); + u16 hyphen = (u16)((whichCharset == 0) ? 0x00F1 : 0x01BE); str->data[str->size++] = hyphen; } u32 dividend = sPowersOfTen[ndigits - 1]; @@ -89,14 +89,14 @@ void String16_FormatInteger(struct String *str, int num, u32 ndigits, enum Print u16 digit = (u16)(num / dividend); num -= dividend * digit; if (printingMode == PRINTING_MODE_LEADING_ZEROS) { - u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2); + u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2); str->data[str->size++] = value; } else if (digit != 0 || dividend == 1) { - printingMode = PRINTING_MODE_LEADING_ZEROS; - u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2); + printingMode = PRINTING_MODE_LEADING_ZEROS; + u16 value = (u16)((digit < 10) ? charbase[digit] : 0x00E2); str->data[str->size++] = value; } else if (printingMode == PRINTING_MODE_RIGHT_ALIGN) { - u16 value = (u16)((whichCharset == 0) ? 0x0001 : 0x01E2); + u16 value = (u16)((whichCharset == 0) ? 0x0001 : 0x01E2); str->data[str->size++] = value; } dividend /= 10; @@ -108,7 +108,7 @@ void String16_FormatInteger(struct String *str, int num, u32 ndigits, enum Print } s64 String_atoi(struct String *str, BOOL *flag) { - s64 ret = 0; + s64 ret = 0; s64 pow10 = 1; if (str->size > 18) { return 0; @@ -252,7 +252,7 @@ void StrAddChar(struct String *str, u16 val) { if (str->size + 1 < str->maxsize) { str->data[str->size++] = val; - str->data[str->size] = EOS; + str->data[str->size] = EOS; return; } GF_ASSERT(0); @@ -276,10 +276,10 @@ BOOL String_IsTrainerName(struct String *string) { void StringCat_HandleTrainerName(struct String *dest, struct String *src) { if (String_IsTrainerName(src)) { - u16 *dest_p = &dest->data[dest->size]; - u16 *src_p = &src->data[1]; - s32 bit = 0; - u32 outsize = 0; + u16 *dest_p = &dest->data[dest->size]; + u16 *src_p = &src->data[1]; + s32 bit = 0; + u32 outsize = 0; u16 cur_char = 0; while (1) { diff --git a/arm9/src/unk_02021FF8.c b/arm9/src/unk_02021FF8.c index fb51d3924..b739a4a24 100644 --- a/arm9/src/unk_02021FF8.c +++ b/arm9/src/unk_02021FF8.c @@ -11,10 +11,10 @@ struct UnkStruct_020220C4 *sub_020220C4(u8 *a0, u32 a1, void (*a2)(s32, s32, u32 GF_ASSERT(a1 != 0); ret = AllocFromHeap(heapId, sizeof(struct UnkStruct_020220C4)); if (ret != NULL) { - ret->field_0 = a0; - ret->field_4 = a1; - ret->field_8 = a2; - ret->field_C = a3; + ret->field_0 = a0; + ret->field_4 = a1; + ret->field_8 = a2; + ret->field_C = a3; ret->field_10 = AllocFromHeap(heapId, a1 * sizeof(struct UnkStruct_020220C4_sub)); if (ret->field_10 != NULL) { for (i = 0; i < a1; i++) { diff --git a/arm9/src/unk_02022450.c b/arm9/src/unk_02022450.c index e7096bbe1..e04ea499a 100644 --- a/arm9/src/unk_02022450.c +++ b/arm9/src/unk_02022450.c @@ -40,10 +40,10 @@ void sub_02022450() { SetBakRomCode(ROM_CODE_ADAJ_BE); } FSArchive *const r0 = FS_FindArchive(arc_name, 3); - r0->fat = card_header_buffer->fat.offset; - r0->fat_size = card_header_buffer->fat.length; - r0->fnt = card_header_buffer->fnt.offset; - r0->fnt_size = card_header_buffer->fnt.length; + r0->fat = card_header_buffer->fat.offset; + r0->fat_size = card_header_buffer->fat.length; + r0->fnt = card_header_buffer->fnt.offset; + r0->fnt_size = card_header_buffer->fnt.length; if (GetBakRomCode() != ROM_CODE_ADAJ_BE || GetBakRomMaker() != MAKER_CODE_01_BE) { OS_Terminate(); } diff --git a/arm9/src/unk_020286F8.c b/arm9/src/unk_020286F8.c index 5ca69c6e5..dd08cc95c 100644 --- a/arm9/src/unk_020286F8.c +++ b/arm9/src/unk_020286F8.c @@ -21,7 +21,7 @@ void sub_02028700(struct UnkSaveStruct_020286F8 *ptr, int a, int b) { void sub_02028724(struct UnkSaveStruct_020286F8 *ptr) { MI_CpuClearFast(ptr, 6 * sizeof(struct UnkSaveStruct_020286F8)); for (int i = 0; i < 6; i++) { - ptr[i].unk_0[0] = EOS; + ptr[i].unk_0[0] = EOS; ptr[i].unk_10[0] = EOS; } UNK_021C59D0 = ptr; diff --git a/arm9/src/unk_0202A1E0.c b/arm9/src/unk_0202A1E0.c index 646b2757b..49e9322fe 100644 --- a/arm9/src/unk_0202A1E0.c +++ b/arm9/src/unk_0202A1E0.c @@ -157,14 +157,14 @@ u16 FrontierData_BattlePointAction(struct FrontierData *frontierData, u16 value, u8 FrontierData_SetField_0x2(struct FrontierData *frontierData, DataSetMode mode) { switch (mode) { case DATA_RESET: - frontierData->u_2 = 0; + frontierData->u_2 = 0; frontierData->flag4 = 0; break; case DATA_INCREMENT: if (frontierData->flag4) { frontierData->u_2++; } else { - frontierData->u_2 = 1; + frontierData->u_2 = 1; frontierData->flag4 = 1; } break; @@ -226,7 +226,7 @@ u16 FrontierData_SetField_0x16(struct FrontierData *frontierData, struct Unk0202 var5 = (u16)((1000 - arg1->u_6) / 30); } - total = (u16)(var1 + var4 + var5); + total = (u16)(var1 + var4 + var5); frontierData->u_16 = total; return total; } @@ -310,8 +310,8 @@ void SaveStruct23_Substruct4_SetArrayFlag(struct SaveStruct23_Substruct4 *substr return; } - u16 var1 = (u16)((arg1 - 1) * 200 + (arg2 - 1)); - u8 index = (u8)(var1 / 8); + u16 var1 = (u16)((arg1 - 1) * 200 + (arg2 - 1)); + u8 index = (u8)(var1 / 8); u8 remainder = (u8)(var1 % 8); flag <<= remainder; @@ -356,8 +356,8 @@ BOOL SaveStruct23_Substruct4_GetArrayFlag(struct SaveStruct23_Substruct4 *substr return FALSE; } - u16 var2 = (u16)((arg1 - 1) * 200 + (arg2 - 1)); - u8 index = (u8)(var2 / 8); + u16 var2 = (u16)((arg1 - 1) * 200 + (arg2 - 1)); + u8 index = (u8)(var2 / 8); u8 remainder = (u8)(var2 % 8); flag <<= remainder; @@ -379,7 +379,7 @@ void SaveStruct23_Substruct4_SetSubstruct1(struct SaveStruct23_Substruct4 *subst MI_CpuCopy8(substruct1, &substruct4->substruct1, sizeof(struct SaveStruct23_Substruct4_Substruct1) * 7); substruct4->u_101 = arg2; substruct4->u_100 = arg3; - substruct4->u_FE = 1; + substruct4->u_FE = 1; } void sub_0202A784(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A784 *dst) { @@ -388,8 +388,8 @@ void sub_0202A784(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A784 } void sub_0202A798(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A798 *arg1, u32 arg2) { - struct Unk0202A798_substruct *unk_substruct = &arg1->u_0; - u8 *var1 = arg1->u_30; + struct Unk0202A798_substruct *unk_substruct = &arg1->u_0; + u8 *var1 = arg1->u_30; struct SaveStruct23_Substruct4_Substruct1 *substruct4_substruct1 = &substruct4->substruct1[arg2]; struct MsgData *message; @@ -414,7 +414,7 @@ void sub_0202A838(struct SaveStruct23_Substruct4 *substruct4, struct SaveStruct2 MI_CpuCopy8(substruct4_substruct2, &substruct4->substruct2, sizeof(struct SaveStruct23_Substruct4_Substruct2)); substruct4->u_103 = arg2; substruct4->u_102 = arg3; - substruct4->u_FF = 1; + substruct4->u_FF = 1; } void sub_0202A864(struct SaveStruct23_Substruct4 *substruct4, struct Unk0202A784 *dst) { diff --git a/arm9/src/unk_0202C144.c b/arm9/src/unk_0202C144.c index 5a8dd261a..ec5bc371e 100644 --- a/arm9/src/unk_0202C144.c +++ b/arm9/src/unk_0202C144.c @@ -10,8 +10,8 @@ void sub_0202C144(struct SaveData *save, struct Pokemon *mon) { u32 is_egg = GetMonData(mon, MON_DATA_IS_EGG, NULL); if (!is_egg) { struct Pokedex *pokedex = Save_Pokedex_Get(save); - struct GameStats *unk = Save_GameStats_Get(save); - u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + struct GameStats *unk = Save_GameStats_Get(save); + u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL); GameStats_IncSpeciesCaught(unk, pokedex, (u16)species); Pokedex_SetMonCaughtFlag(pokedex, mon); diff --git a/arm9/src/unk_0202E29C.c b/arm9/src/unk_0202E29C.c index a01f904ba..64eb0325c 100644 --- a/arm9/src/unk_0202E29C.c +++ b/arm9/src/unk_0202E29C.c @@ -101,8 +101,8 @@ BOOL sub_0202E358(u8 *param0, u8 *param1, s32 param2) { void sub_0202E380(struct UnkStruct_0202E29C_sub *param0, u32 param1) { #pragma unused(param1) - s32 r5 = sub_02033534(); - u8 r6 = sub_0203354C(); + s32 r5 = sub_02033534(); + u8 r6 = sub_0203354C(); struct UnkStruct_0202E29C_sub4 *r4 = ¶m0->unk50; if (r5 != 0xe) { @@ -466,7 +466,7 @@ u32 sub_0202E9E8(u32 param0) { } if (sub_0202CBD4() == 1) { - s32 ret = sub_02033534(); + s32 ret = sub_02033534(); UNK_021C59F0->unkDA8 = (u8)UNK_021C59F0->unk054[param0].unk36; if (sub_0202D8B0(ret) != 0) { sub_0202C4D8(1, UNK_021C59F0->unk054[param0].unk04, 0); @@ -498,7 +498,7 @@ void sub_0202EA54() { } void sub_0202EA9C() { - s32 res = sub_02033534(); + s32 res = sub_02033534(); PlayerProfile *player_data = sub_0202EF70(); if (res != 0xf) { @@ -518,9 +518,9 @@ void sub_0202EA9C() { res->unk08.unk4C = (u8)sub_0202D358(); } else { struct UnkStruct_0202E29C_sub2 *res = &UNK_021C59F0->unkCC4; - res->unk00 = PlayerProfile_GetTrainerID(player_data); - res->unk04 = (u8)sub_02033534(); - res->unk05 = sub_0203354C(); + res->unk00 = PlayerProfile_GetTrainerID(player_data); + res->unk04 = (u8)sub_02033534(); + res->unk05 = sub_0203354C(); MI_CpuCopy8(&UNK_021C59F0->unk000, &res->unk08, sizeof(struct UnkStruct_0202E29C_sub3)); } diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index 421e39831..d66e49e06 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -46,7 +46,7 @@ extern void sub_0202D830(u8 *param0, u32 param1); extern u32 ov04_021D8624(); u32 sub_0202F150(u32 param0, u32 param1) { - u32 r4 = 0; + u32 r4 = 0; UNK_021C59F4 = 0; if (param0 != 0) { int res = sub_0202D858((u16)sub_02033534()) + 1; @@ -57,7 +57,7 @@ u32 sub_0202F150(u32 param0, u32 param1) { sub_02031480(HEAP_ID_15); struct UnkStruct0202F150 *ptr = (struct UnkStruct0202F150 *)AllocFromHeap(HEAP_ID_15, sizeof(struct UnkStruct0202F150)); - UNK_021C59F8 = ptr; + UNK_021C59F8 = ptr; MI_CpuFill8(ptr, 0, 0x68C); UNK_021C59F8->unk658 = param1 + 0x40; @@ -341,12 +341,12 @@ void sub_0202F984() { if (UNK_021C59F8->unk67D == 2) { UNK_021C59F8->unk67D = 0; - r4 = 1; + r4 = 1; } if (UNK_021C59F8->unk67D == 3) { UNK_021C59F8->unk67D = 1; - r4 = 1; + r4 = 1; } if (r4 != 0) { @@ -750,7 +750,7 @@ void sub_0202FEEC() { } int st0 = sub_02031228((u16)sub_02033534()); - int r6 = sub_0202D858((u16)sub_02033534()) + 1; + int r6 = sub_0202D858((u16)sub_02033534()) + 1; if (UNK_02105D59 == 2 || UNK_02105D59 == 0) { @@ -912,7 +912,7 @@ void sub_0203026C(u32 param0, u8 *param1, u32 param2) { UNK_021C59F8->unk682 = 0; if (sub_0202FA28() == 1) { - int r6 = sub_02031228((u16)sub_02033534()); + int r6 = sub_02031228((u16)sub_02033534()); int st4 = sub_0202D858((u16)sub_02033534()) + 1; int r4 = 0; @@ -1121,8 +1121,8 @@ void sub_02030674() { } UNK_021C59F8->unk5F8[0] = UNK_021C59F8->unk5F8[2] + UNK_021C59F8->unk5F8[1] * UNK_021C59F8->unk5F8[0]; - UNK_021C59F8->unk62D = UNK_021C59F8->unk5F8[0] >> 0x3c | (0 << 4); - UNK_021C59F8->unk62E = r4; + UNK_021C59F8->unk62D = UNK_021C59F8->unk5F8[0] >> 0x3c | (0 << 4); + UNK_021C59F8->unk62E = r4; } } @@ -1418,7 +1418,7 @@ void sub_02030A00(u8 *param0) { param0[1] = 1; } - u16 res = sub_0202CB8C(); + u16 res = sub_0202CB8C(); param0[2] = (u8)(res >> 8); param0[3] = (u8)res; @@ -1427,13 +1427,13 @@ void sub_02030A00(u8 *param0) { st0[0] = (int)param0 + 5; if (sub_0202D760(UNK_021C59F8->unk56C, st0, 0) != 0) { UNK_021C59F8->unk685 = 0; - param0[4] = (u8)(0xbb - st0[1]); + param0[4] = (u8)(0xbb - st0[1]); return; } UNK_021C59F8->unk685 = 1; - param0[4] = 0xbb; + param0[4] = 0xbb; } u32 sub_02030A78(u32 param0, u8 *param1, u32 param2) { @@ -1551,9 +1551,9 @@ void sub_02030C8C(struct UnkStruct0202F150_sub1 *param0, } } - int st10 = param0->unk04; + int st10 = param0->unk04; param4->unk0a = (u8)r7; - int r4 = param4->unk08; + int r4 = param4->unk08; if (r4 == 0xffff) { r4 = sub_0202D9A0(r7); @@ -1717,7 +1717,7 @@ u32 sub_02030F88(u32 param0) { return 0; } - u32 ret = UNK_021C59F8->unk610[param0]; + u32 ret = UNK_021C59F8->unk610[param0]; UNK_021C59F8->unk610[param0] = 0; return ret; @@ -2032,7 +2032,7 @@ void sub_02031400(u32 param0) { if (sub_02033534() >= 0x13) { UNK_021C59F8->unk630 = param0; if (param0 != 0) { - UNK_021C59F8->unk634 = 0; + UNK_021C59F8->unk634 = 0; UNK_021C59F8->unk638[0] = 0; UNK_021C59F8->unk638[1] = 0; } diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index 8648ebc74..ce96244fc 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -62,7 +62,7 @@ void sub_02031734(struct SaveData *save, u8 param1) { if (UNK_021C5A00 == NULL) { sub_0202E49C(); struct UnkStruct_02031734 *ptr = AllocFromHeap(HEAP_ID_15, sizeof(struct UnkStruct_02031734)); - UNK_021C5A00 = ptr; + UNK_021C5A00 = ptr; MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct_02031734)); UNK_021C5A00->unk3A = 0x32; @@ -430,7 +430,7 @@ void sub_02031E08() { u32 r1 = compute(UNK_021C5A00->unk0C, 0x40); if (UNK_021C5A00->unk38 != 0) { - r1 = (u32)(UNK_021C5A00->unk38 << 6); + r1 = (u32)(UNK_021C5A00->unk38 << 6); UNK_021C5A00->unk38 = 0; } sub_02031D20(sub_02031EE0, r1); diff --git a/arm9/src/unk_020337E8.c b/arm9/src/unk_020337E8.c index 9ed4187f9..f018302b2 100644 --- a/arm9/src/unk_020337E8.c +++ b/arm9/src/unk_020337E8.c @@ -20,7 +20,7 @@ extern BOOL DWC_CheckUserData(struct DWC_Struct *); extern s32 DWC_GetGsProfileId(struct DWC_Struct *, struct DWC_token *); s32 sub_020337E8(HeapID heapId) { - s32 ret = (s32)AllocFromHeap(heapId, 0x720); + s32 ret = (s32)AllocFromHeap(heapId, 0x720); s32 ret1 = DWC_Init((ret + 0x1F) & ~0x1F); FreeToHeap((void *)ret); return ret1; diff --git a/arm9/src/unk_0204AEA8.c b/arm9/src/unk_0204AEA8.c index 1b0d38536..d7c9f256d 100644 --- a/arm9/src/unk_0204AEA8.c +++ b/arm9/src/unk_0204AEA8.c @@ -10,7 +10,7 @@ extern void ov05_021E3444(u32, struct FieldSystem *, u32); BOOL sub_0204AEA8(struct TaskManager *taskManager) { struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - u32 *v1 = TaskManager_GetEnvironment(taskManager); + u32 *v1 = TaskManager_GetEnvironment(taskManager); switch (v1[0]) { case 0: diff --git a/arm9/src/unk_0204AF24.c b/arm9/src/unk_0204AF24.c index a5785742b..3e7b51c5b 100644 --- a/arm9/src/unk_0204AF24.c +++ b/arm9/src/unk_0204AF24.c @@ -95,7 +95,7 @@ void sub_0204B090(struct TaskManager *taskManager) { } BOOL sub_0204B0A0(struct TaskManager *taskManager) { - u32 *r4 = TaskManager_GetStatePtr(taskManager); + u32 *r4 = TaskManager_GetStatePtr(taskManager); struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); switch (r4[0]) { case 0: diff --git a/arm9/src/unk_0204B0A0.c b/arm9/src/unk_0204B0A0.c index 8461b2d89..4fa5812d0 100644 --- a/arm9/src/unk_0204B0A0.c +++ b/arm9/src/unk_0204B0A0.c @@ -39,7 +39,7 @@ void sub_0204B0F8(struct FieldSystem *fieldSystem) { } void sub_0204B130(struct FieldSystem *fieldSystem, SysInfo_RTC *rtc_info, struct RTCDate *date) { - u32 days = (u32)RTC_ConvertDateToDay(date); + u32 days = (u32)RTC_ConvertDateToDay(date); u32 days_since_nitro_epoch = (u32)rtc_info->daysSinceNitroEpoch; if (days < days_since_nitro_epoch) { @@ -80,15 +80,15 @@ void sub_0204B1DC(struct FieldSystem *fieldSystem, s32 a1) { sub_02028754(unk_sav_ptr1, (u32)a1); void *unk_sav_ptr2 = Save_Roamers_Get(fieldSystem->saveData); - unk_sav_ptr1 = sub_0202881C(fieldSystem->saveData); - u32 unk1 = sub_020287A4(unk_sav_ptr1); + unk_sav_ptr1 = sub_0202881C(fieldSystem->saveData); + u32 unk1 = sub_020287A4(unk_sav_ptr1); sub_0202A988(unk_sav_ptr2, unk1); struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); Party_UpdatePokerus(party, a1); struct SaveVarsFlags *state = Save_VarsFlags_Get(fieldSystem->saveData); - s32 unk2 = sub_0205F594(state); + s32 unk2 = sub_0205F594(state); u16 unk3; if (unk2 > a1) { diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index f487efcea..478c7efcd 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -46,12 +46,12 @@ u32 sub_0205FA2C( ptr->bag = Save_Bag_Get(save); - ptr->unk21 = 0; - ptr->unk20 = param0->unk08; - ptr->unk32 = param0->unk0a; + ptr->unk21 = 0; + ptr->unk20 = param0->unk08; + ptr->unk32 = param0->unk0a; ptr->unk322 = param0->unk0b; - ptr->unk33 = param0->unk0c; - ptr->unk22 = param0->unk0d; + ptr->unk33 = param0->unk0c; + ptr->unk22 = param0->unk0d; for (u8 i = 0; i < 6; i++) { ptr->unk2c[i] = param0->unk0e[i]; @@ -101,10 +101,10 @@ u32 sub_0205FB34( heapId, sizeof(struct UnkPlayerStruct2_0205FA2C)); MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct2_0205FA2C)); - ptr->options = Save_PlayerData_GetOptionsAddr(save); + ptr->options = Save_PlayerData_GetOptionsAddr(save); ptr->player_party = SaveArray_Party_Get(save); - ptr->IsNatDex = SaveArray_IsNatDexEnabled(save); - ptr->unk2c = sub_02079C70(save); + ptr->IsNatDex = SaveArray_IsNatDexEnabled(save); + ptr->unk2c = sub_02079C70(save); ptr->unk11 = 1; ptr->unk14 = param0->unk0d; @@ -134,7 +134,7 @@ u32 sub_0205FBC0( } struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)*param0->unk14; - param0->unk0d = ptr->unk14; + param0->unk0d = ptr->unk14; FreeToHeap(ptr); *param0->unk14 = NULL; @@ -143,7 +143,7 @@ u32 sub_0205FBC0( } BOOL sub_0205FBE8(struct TaskManager *taskManager) { - struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); + struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); struct UnkCallbackStruct1_0205FA2C *res2 = (struct UnkCallbackStruct1_0205FA2C *)TaskManager_GetEnvironment(taskManager); switch (res2->unk04) { case 0: @@ -216,7 +216,7 @@ u32 sub_0205FCC4( } BOOL sub_0205FCE8(struct TaskManager *taskManager) { - struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); + struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); struct UnkCallbackStruct2_0205FA2C *res2 = (struct UnkCallbackStruct2_0205FA2C *)TaskManager_GetEnvironment(taskManager); switch (res2->unk04) { @@ -228,7 +228,7 @@ BOOL sub_0205FCE8(struct TaskManager *taskManager) { break; case 2: u16 *var = GetVarPointer(fieldSystem, res2->unk10); - *var = (u16)res2->unk00; + *var = (u16)res2->unk00; FreeToHeap(res2); return TRUE; @@ -238,7 +238,7 @@ BOOL sub_0205FCE8(struct TaskManager *taskManager) { } void sub_0205FD38(struct TaskManager *taskManager, u16 param1, u16 param2, u16 param3) { - struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); + struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); struct UnkCallbackStruct2_0205FA2C *ptr = (struct UnkCallbackStruct2_0205FA2C *)AllocFromHeap( HEAP_ID_FIELD, sizeof(struct UnkCallbackStruct2_0205FA2C)); MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct2_0205FA2C)); @@ -252,8 +252,8 @@ void sub_0205FD38(struct TaskManager *taskManager, u16 param1, u16 param2, u16 p BOOL sub_0205FD70(struct TaskManager *taskManager) { struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); - u16 *res2 = (u16 *)TaskManager_GetEnvironment(taskManager); - u8 *res3 = sub_020316E0(1 - sub_02031190()); + u16 *res2 = (u16 *)TaskManager_GetEnvironment(taskManager); + u8 *res3 = sub_020316E0(1 - sub_02031190()); if (res3 == NULL) { return FALSE; } @@ -454,7 +454,7 @@ u32 sub_020600DC(struct SaveData *save) { u32 res3 = sub_02060064(FrontierData_GetField_0x4(frontierData)); - int i = 0; + int i = 0; int res4 = FrontierData_SetField_0xC(frontierData, (u16)SaveStruct23_Substruct1_GetField(saveStruct23_substruct1, FIELD_0x0_2, 0), DATA_GET) * 0x18; for (i = 0; i < res4; i++) { diff --git a/arm9/src/unk_0206015C.c b/arm9/src/unk_0206015C.c index cf0779793..1a6dfe14d 100644 --- a/arm9/src/unk_0206015C.c +++ b/arm9/src/unk_0206015C.c @@ -37,16 +37,16 @@ extern void sub_0206367C(struct FieldSystem *, u32); void CallTask_UseGreatMarshBinoculars(struct FieldSystem *fieldSystem) { struct UnkStruct_0206015C *unkStruct = AllocFromHeapAtEnd(HEAP_ID_FIELD, 0x10); - unkStruct->unk0 = ov06_02244DB0(HEAP_ID_FIELD); - unkStruct->unk4 = ov06_02245114(HEAP_ID_FIELD, fieldSystem); - unkStruct->unkC = 0; - unkStruct->unkD = 0; + unkStruct->unk0 = ov06_02244DB0(HEAP_ID_FIELD); + unkStruct->unk4 = ov06_02245114(HEAP_ID_FIELD, fieldSystem); + unkStruct->unkC = 0; + unkStruct->unkD = 0; TaskManager_Call(fieldSystem->taskManager, Task_UseGreatMarshBinoculars, (u32 *)unkStruct); } BOOL Task_UseGreatMarshBinoculars(struct TaskManager *taskManager) { - struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); + struct FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); struct UnkStruct_0204652C *unkStruct1 = (struct UnkStruct_0204652C *)TaskManager_GetEnvironment(taskManager); switch (unkStruct1->action) { @@ -65,7 +65,7 @@ BOOL Task_UseGreatMarshBinoculars(struct TaskManager *taskManager) { case 2: struct SaveVarsFlags *scrState = Save_VarsFlags_Get(fieldSystem->saveData); - u8 unkD = unkStruct1->unkD; + u8 unkD = unkStruct1->unkD; if (unkD == 0) { sub_0205F1C4(scrState); } else if (unkD == 5) { diff --git a/arm9/src/unk_0206439C.c b/arm9/src/unk_0206439C.c index a6cf6d8b7..301bf5764 100644 --- a/arm9/src/unk_0206439C.c +++ b/arm9/src/unk_0206439C.c @@ -8,10 +8,10 @@ UnkStruct_0206439C *sub_0206439C(HeapID heapId, u8 mon_idx, SaveData *save) { UnkStruct_0206439C *ret = AllocFromHeapAtEnd(heapId, sizeof(UnkStruct_0206439C)); - Party *party = SaveArray_Party_Get(save); + Party *party = SaveArray_Party_Get(save); ret->pokemon = Party_GetMonByIndex(party, mon_idx); - ret->unk4 = NULL; + ret->unk4 = NULL; return ret; } diff --git a/arm9/src/unk_02064E20.c b/arm9/src/unk_02064E20.c index 1b678fa49..a329e84af 100644 --- a/arm9/src/unk_02064E20.c +++ b/arm9/src/unk_02064E20.c @@ -13,5 +13,5 @@ void KeepSafariTrain(struct FieldSystem *fieldSystem) { } sub_02025490(r4, 6); u16 *ptr0 = (u16 *)sub_020254A0(r4, 6); - ptr0[0] = 2; + ptr0[0] = 2; } diff --git a/arm9/src/unk_02064E4C.c b/arm9/src/unk_02064E4C.c index c48ef8271..4d8932a86 100644 --- a/arm9/src/unk_02064E4C.c +++ b/arm9/src/unk_02064E4C.c @@ -15,7 +15,7 @@ void sub_02064E4C(struct MsgData *msgData, u16 map_sec, struct String *dest) { void sub_02064E60(u32 map_no, HeapID heapId, struct String *dest) { struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0382_bin, heapId); - u16 map_sec = MapHeader_GetMapSec(map_no); + u16 map_sec = MapHeader_GetMapSec(map_no); sub_02064E4C(msgData, map_sec, dest); diff --git a/arm9/src/unk_0206B688.c b/arm9/src/unk_0206B688.c index d7034ad08..5016201d9 100644 --- a/arm9/src/unk_0206B688.c +++ b/arm9/src/unk_0206B688.c @@ -8,11 +8,11 @@ u16 BoxMon_GetAlternateForm(struct BoxPokemon *boxmon); u32 sub_0206B6D4(u32 species, u32 is_egg, u32 form); u32 sub_0206B688(struct BoxPokemon *boxmon) { - BOOL decry = AcquireBoxMonLock(boxmon); + BOOL decry = AcquireBoxMonLock(boxmon); u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - u32 is_egg = GetBoxMonData(boxmon, MON_DATA_IS_EGG, NULL); - u32 form = BoxMon_GetAlternateForm(boxmon); - u32 ret = sub_0206B6D4(species, is_egg, form); + u32 is_egg = GetBoxMonData(boxmon, MON_DATA_IS_EGG, NULL); + u32 form = BoxMon_GetAlternateForm(boxmon); + u32 ret = sub_0206B6D4(species, is_egg, form); ReleaseBoxMonLock(boxmon, decry); return ret; } @@ -100,10 +100,10 @@ u32 sub_0206B7BC(u32 species, u32 form, u32 is_egg) { } u32 sub_0206B83C(struct BoxPokemon *boxmon) { - BOOL decry = AcquireBoxMonLock(boxmon); - u32 form = BoxMon_GetAlternateForm(boxmon); + BOOL decry = AcquireBoxMonLock(boxmon); + u32 form = BoxMon_GetAlternateForm(boxmon); u32 species = GetBoxMonData(boxmon, MON_DATA_SPECIES, NULL); - u32 is_egg = GetBoxMonData(boxmon, MON_DATA_IS_EGG, NULL); + u32 is_egg = GetBoxMonData(boxmon, MON_DATA_IS_EGG, NULL); ReleaseBoxMonLock(boxmon, decry); return sub_0206B7BC(species, form, is_egg); } diff --git a/arm9/src/unk_02085338.c b/arm9/src/unk_02085338.c index 6003c3465..86c7bdd8c 100644 --- a/arm9/src/unk_02085338.c +++ b/arm9/src/unk_02085338.c @@ -9,15 +9,15 @@ extern BOOL sub_0205ED0C(struct SaveVarsFlags *state); struct UnkStruct_02085338 *sub_02085338(u8 r5, u8 r7, struct SaveData *save, HeapID heapId) { struct UnkStruct_02085338 *ret = (struct UnkStruct_02085338 *)AllocFromHeap(heapId, sizeof(struct UnkStruct_02085338)); - ret->unk_00 = r5; - ret->unk_01 = r7; - ret->unk_0c = Save_Pokedex_Get(save); - ret->unk_10 = Save_EasyChat_Get(save); - ret->unk_04 = (u8)sub_0205ED0C(Save_VarsFlags_Get(save)); - ret->unk_05 = 0; - ret->unk_02 = 1; - ret->unk_03 = 0; - ret->unk_08 = Options_GetFrame(Save_PlayerData_GetOptionsAddr(save)); + ret->unk_00 = r5; + ret->unk_01 = r7; + ret->unk_0c = Save_Pokedex_Get(save); + ret->unk_10 = Save_EasyChat_Get(save); + ret->unk_04 = (u8)sub_0205ED0C(Save_VarsFlags_Get(save)); + ret->unk_05 = 0; + ret->unk_02 = 1; + ret->unk_03 = 0; + ret->unk_08 = Options_GetFrame(Save_PlayerData_GetOptionsAddr(save)); if (r5 == 2) { MailMsg_Init_WithBank(&ret->unk_14, 3); } else { diff --git a/arm9/src/unk_0208890C.c b/arm9/src/unk_0208890C.c index d7c8d6372..705523e44 100644 --- a/arm9/src/unk_0208890C.c +++ b/arm9/src/unk_0208890C.c @@ -27,13 +27,13 @@ struct PoffinCaseAppData *sub_0208890C(u32 a0, struct SaveData *save, HeapID hea struct PoffinCaseAppData *ret = AllocFromHeap(heapId, sizeof(struct PoffinCaseAppData)); MI_CpuFill8(ret, 0, sizeof(struct PoffinCaseAppData)); - ret->save = save; + ret->save = save; ret->savePoffinData = Save_PoffinData_Get(save); - ret->player = Save_PlayerData_GetProfileAddr(save); - ret->bag = Save_Bag_Get(save); - ret->options = Save_PlayerData_GetOptionsAddr(save); - ret->unk1C = a3; - ret->unk4 = a0; + ret->player = Save_PlayerData_GetProfileAddr(save); + ret->bag = Save_Bag_Get(save); + ret->options = Save_PlayerData_GetOptionsAddr(save); + ret->unk1C = a3; + ret->unk4 = a0; return ret; } @@ -43,7 +43,7 @@ void sub_02088950(struct FieldSystem *fieldSystem, struct PoffinCaseAppData *par } struct PoffinCaseAppData *sub_02088960(struct FieldSystem *fieldSystem, u32 a1, HeapID heapId) { - struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); + struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); struct PoffinCaseAppData *ret = sub_0208890C(a1, save, heapId, fieldSystem->unk98); sub_02088950(fieldSystem, ret); diff --git a/arm9/src/unk_02088AAC.c b/arm9/src/unk_02088AAC.c index 3645ab704..a6fb7d660 100644 --- a/arm9/src/unk_02088AAC.c +++ b/arm9/src/unk_02088AAC.c @@ -48,7 +48,7 @@ u32 sub_02088AFC(struct UnkStruct_02088AAC *r0) { .initFunc = ov73_021D74F0, .mainFunc = ov73_021D758C, .exitFunc = ov73_021D7640, - .ovly = FS_OVERLAY_ID(OVERLAY_73) + .ovly = FS_OVERLAY_ID(OVERLAY_73) }; r0->ovly_data = OverlayManager_New(&OVERLAY_73_MANAGER, (s32 *)r0, r0->heapId); @@ -74,18 +74,18 @@ u32 sub_02088B48() { u32 sub_02088B4C(struct UnkStruct_02088AAC *r0) { FS_EXTERN_OVERLAY(OVERLAY_75); - static const u8 UNK_020FD6F4[] = { 0x04, 0xFF }; + static const u8 UNK_020FD6F4[] = { 0x04, 0xFF }; const struct OverlayManagerTemplate OVERLAY_75_MANAGER = { .initFunc = ov75_021E6BA0, .mainFunc = ov75_021E6D6C, .exitFunc = ov75_021E6F00, - .ovly = FS_OVERLAY_ID(OVERLAY_75) + .ovly = FS_OVERLAY_ID(OVERLAY_75) }; struct BagView *bag_view = Bag_CreateView(r0->poffinCaseAppData->bag, UNK_020FD6F4, r0->heapId); sub_0206E314(bag_view, r0->poffinCaseAppData->save, (u8)((u8)r0->unk06 == 1 ? 5 : 4), r0->unk0C); - r0->ovly_data = OverlayManager_New(&OVERLAY_75_MANAGER, (s32 *)bag_view, r0->heapId); + r0->ovly_data = OverlayManager_New(&OVERLAY_75_MANAGER, (s32 *)bag_view, r0->heapId); r0->ovly_param = bag_view; return 1; @@ -102,7 +102,7 @@ u32 sub_02088BA8(struct UnkStruct_02088AAC *r0) { FreeToHeap(r0->ovly_param); r0->ovly_param = NULL; - r0->item = sub_0206E37C(bag_view); + r0->item = sub_0206E37C(bag_view); FreeToHeap(bag_view); @@ -126,12 +126,12 @@ u32 sub_02088BA8(struct UnkStruct_02088AAC *r0) { u32 sub_02088C3C(struct UnkStruct_02088AAC *r0) { FS_EXTERN_OVERLAY(OVERLAY_68); - struct Bag *bag = r0->poffinCaseAppData->bag; + struct Bag *bag = r0->poffinCaseAppData->bag; const struct OverlayManagerTemplate OVERLAY_68_MANAGER = { .initFunc = ov68_021D74E0, .mainFunc = ov68_021D75D8, .exitFunc = ov68_021D762C, - .ovly = FS_OVERLAY_ID(OVERLAY_68) + .ovly = FS_OVERLAY_ID(OVERLAY_68) }; r0->ovly_param = sub_020851B8((u8)r0->heapId); diff --git a/arm9/src/use_item_on_mon.c b/arm9/src/use_item_on_mon.c index fb5675e3e..0f9089886 100644 --- a/arm9/src/use_item_on_mon.c +++ b/arm9/src/use_item_on_mon.c @@ -89,9 +89,9 @@ BOOL CanUseItemOnPokemon(struct Pokemon *pokemon, u16 itemId, s32 moveId, HeapID } } } - hpEv = (s32)GetMonData(pokemon, MON_DATA_HP_EV, NULL); - atkEv = (s32)GetMonData(pokemon, MON_DATA_ATK_EV, NULL); - defEv = (s32)GetMonData(pokemon, MON_DATA_DEF_EV, NULL); + hpEv = (s32)GetMonData(pokemon, MON_DATA_HP_EV, NULL); + atkEv = (s32)GetMonData(pokemon, MON_DATA_ATK_EV, NULL); + defEv = (s32)GetMonData(pokemon, MON_DATA_DEF_EV, NULL); speedEv = (s32)GetMonData(pokemon, MON_DATA_SPEED_EV, NULL); spAtkEv = (s32)GetMonData(pokemon, MON_DATA_SPATK_EV, NULL); spDefEv = (s32)GetMonData(pokemon, MON_DATA_SPDEF_EV, NULL); @@ -225,7 +225,7 @@ BOOL UseItemOnPokemon(struct Pokemon *pokemon, u16 itemId, s32 moveIdx, u16 loca FreeToHeap(itemData); return FALSE; } - hadEffect = FALSE; + hadEffect = FALSE; effectFound = FALSE; { sp54 = sp50 = (int)GetMonData(pokemon, MON_DATA_STATUS, NULL); @@ -446,7 +446,7 @@ u8 MonMoveCanRestorePP(struct Pokemon *pokemon, s32 moveIdx) { if (move_id == MOVE_NONE) { return FALSE; } - u8 pp = (u8)GetMonData(pokemon, MON_DATA_MOVE1PP + moveIdx, NULL); + u8 pp = (u8)GetMonData(pokemon, MON_DATA_MOVE1PP + moveIdx, NULL); u8 ppUp = (u8)GetMonData(pokemon, MON_DATA_MOVE1PPUP + moveIdx, NULL); return (u8)(pp < WazaGetMaxPp(move_id, ppUp)); } @@ -462,10 +462,10 @@ BOOL MonMoveRestorePP(struct Pokemon *pokemon, s32 moveIdx, s32 ppRestore) { if (move_id == MOVE_NONE) { return FALSE; } - ppAttr = MON_DATA_MOVE1PP + moveIdx; - pp = (u8)GetMonData(pokemon, ppAttr, NULL); + ppAttr = MON_DATA_MOVE1PP + moveIdx; + pp = (u8)GetMonData(pokemon, ppAttr, NULL); ppUpAttr = MON_DATA_MOVE1PPUP + moveIdx; - maxPp = WazaGetMaxPp(move_id, (u8)GetMonData(pokemon, ppUpAttr, NULL)); + maxPp = WazaGetMaxPp(move_id, (u8)GetMonData(pokemon, ppUpAttr, NULL)); if (pp < maxPp) { if (ppRestore == PP_RESTORE_ALL) { pp = maxPp; @@ -488,7 +488,7 @@ BOOL BoostMonMovePpUpBy(struct Pokemon *pokemon, s32 moveIdx, u32 nPpUp) { s32 ppAttr; ppUpAttr = MON_DATA_MOVE1PPUP + moveIdx; - ppUp = (u8)GetMonData(pokemon, ppUpAttr, NULL); + ppUp = (u8)GetMonData(pokemon, ppUpAttr, NULL); if (ppUp == 3) { return FALSE; } @@ -497,15 +497,15 @@ BOOL BoostMonMovePpUpBy(struct Pokemon *pokemon, s32 moveIdx, u32 nPpUp) { return FALSE; } ppAttr = MON_DATA_MOVE1PP + moveIdx; - pp = (u8)GetMonData(pokemon, ppAttr, NULL); - maxPp = WazaGetMaxPp(move, ppUp); + pp = (u8)GetMonData(pokemon, ppAttr, NULL); + maxPp = WazaGetMaxPp(move, ppUp); if (ppUp + nPpUp > 3) { ppUp = 3; } else { ppUp = (u8)(ppUp + nPpUp); } newMaxPp = WazaGetMaxPp(move, ppUp); - pp = (u8)(pp + newMaxPp - maxPp); + pp = (u8)(pp + newMaxPp - maxPp); SetMonData(pokemon, ppUpAttr, &ppUp); SetMonData(pokemon, ppAttr, &pp); return TRUE; diff --git a/arm9/src/wfc_user_info_warning.c b/arm9/src/wfc_user_info_warning.c index 36a48c92d..23369a368 100644 --- a/arm9/src/wfc_user_info_warning.c +++ b/arm9/src/wfc_user_info_warning.c @@ -24,49 +24,49 @@ extern void SetMasterBrightnessNeutral(BOOL set_brightness_on_bottom_screen); extern void sub_0200E3A0(BOOL set_brightness_on_bottom_screen, s32); static const struct WindowTemplate sWFCWarningMsgWindowTemplate = { - .bgId = GF_BG_LYR_MAIN_0, - .left = 3, - .top = 3, - .width = 26, - .height = 18, - .palette = 1, + .bgId = GF_BG_LYR_MAIN_0, + .left = 3, + .top = 3, + .width = 26, + .height = 18, + .palette = 1, .baseTile = 0x23, }; static const struct GraphicsModes sWFCWarningMsgGraphicsModes = { - .dispMode = GX_DISPMODE_GRAPHICS, - .bgMode = GX_BGMODE_0, - .subMode = GX_BGMODE_0, + .dispMode = GX_DISPMODE_GRAPHICS, + .bgMode = GX_BGMODE_0, + .subMode = GX_BGMODE_0, ._2d3dMode = GX_BG0_AS_2D, }; static const struct BgTemplate sWFCWarningMsgBgTemplate = { - .x = 0, - .y = 0, + .x = 0, + .y = 0, .bufferSize = 0x800, - .baseTile = 0, - .size = GF_BG_SCR_SIZE_256x256, - .colorMode = GX_BG_COLORMODE_16, + .baseTile = 0, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, .screenBase = GX_BG_SCRBASE_0x0000, - .charBase = GX_BG_CHARBASE_0x18000, - .bgExtPltt = GX_BG_EXTPLTT_01, - .priority = 1, - .areaOver = GX_BG_AREAOVER_XLU, - .dummy = 0, - .mosaic = FALSE, + .charBase = GX_BG_CHARBASE_0x18000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .dummy = 0, + .mosaic = FALSE, }; static const struct GraphicsBanks sWFCWarningMsgGraphicsBanks = { - .bg = GX_VRAM_BG_256_AB, - .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, - .subbg = GX_VRAM_SUB_BG_NONE, - .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, - .obj = GX_VRAM_OBJ_NONE, - .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, - .subobj = GX_VRAM_SUB_OBJ_NONE, + .bg = GX_VRAM_BG_256_AB, + .bgextpltt = GX_VRAM_BGEXTPLTT_NONE, + .subbg = GX_VRAM_SUB_BG_NONE, + .subbgextpltt = GX_VRAM_SUB_BGEXTPLTT_NONE, + .obj = GX_VRAM_OBJ_NONE, + .objextpltt = GX_VRAM_OBJEXTPLTT_NONE, + .subobj = GX_VRAM_SUB_OBJ_NONE, .subobjextpltt = GX_VRAM_SUB_OBJEXTPLTT_NONE, - .tex = GX_VRAM_TEX_NONE, - .texpltt = GX_VRAM_TEXPLTT_NONE, + .tex = GX_VRAM_TEX_NONE, + .texpltt = GX_VRAM_TEXPLTT_NONE, }; void ShowWFCUserInfoWarning(HeapID heapId, u32 a1) { @@ -109,7 +109,7 @@ void ShowWFCUserInfoWarning(HeapID heapId, u32 a1) { BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27)); struct MsgData *warning_messages_data = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0613_bin, heapId); - struct String *warning_message = String_New(384, heapId); + struct String *warning_message = String_New(384, heapId); ResetAllTextPrinters(); AddWindow(bg_config, &window, &sWFCWarningMsgWindowTemplate); FillWindowPixelRect(&window, 0xF, 0, 0, 208, 144); diff --git a/include/bag_view.h b/include/bag_view.h index 02c2c1bd2..db874cbcc 100644 --- a/include/bag_view.h +++ b/include/bag_view.h @@ -7,7 +7,7 @@ #include "save.h" enum ItemUseError { - ITEMUSEERROR_OKAY = 0, // no error + ITEMUSEERROR_OKAY = 0, // no error ITEMUSEERROR_NODISMOUNT = 1, // can't get off bike ITEMUSEERROR_NOFOLLOWER = 2, // have a companion diff --git a/include/bg_window.h b/include/bg_window.h index b94f9a380..01adbda01 100644 --- a/include/bg_window.h +++ b/include/bg_window.h @@ -79,14 +79,14 @@ typedef struct Window { u8 width; u8 height; u8 paletteNum; - u16 baseTile : 15; + u16 baseTile : 15; u16 colorMode : 1; void *pixelBuffer; } Window; enum GFScreen { SCREEN_MAIN = 0, - SCREEN_SUB = 1, + SCREEN_SUB = 1, }; enum GFBppMode { @@ -103,20 +103,20 @@ enum GFBgLayer { GF_BG_LYR_SUB_1, GF_BG_LYR_SUB_2, GF_BG_LYR_SUB_3, - GF_BG_LYR_MAIN_CNT = 4, - GF_BG_LYR_SUB_CNT = 4, + GF_BG_LYR_MAIN_CNT = 4, + GF_BG_LYR_SUB_CNT = 4, GF_BG_LYR_MAIN_FIRST = GF_BG_LYR_MAIN_0, - GF_BG_LYR_SUB_FIRST = GF_BG_LYR_SUB_0, - GF_BG_LYR_MAX = 8, + GF_BG_LYR_SUB_FIRST = GF_BG_LYR_SUB_0, + GF_BG_LYR_MAX = 8, GF_BG_LYR_MAIN_0_F = 1 << (GF_BG_LYR_MAIN_0 - GF_BG_LYR_MAIN_FIRST), GF_BG_LYR_MAIN_1_F = 1 << (GF_BG_LYR_MAIN_1 - GF_BG_LYR_MAIN_FIRST), GF_BG_LYR_MAIN_2_F = 1 << (GF_BG_LYR_MAIN_2 - GF_BG_LYR_MAIN_FIRST), GF_BG_LYR_MAIN_3_F = 1 << (GF_BG_LYR_MAIN_3 - GF_BG_LYR_MAIN_FIRST), - GF_BG_LYR_SUB_0_F = 1 << (GF_BG_LYR_SUB_0 - GF_BG_LYR_SUB_FIRST), - GF_BG_LYR_SUB_1_F = 1 << (GF_BG_LYR_SUB_1 - GF_BG_LYR_SUB_FIRST), - GF_BG_LYR_SUB_2_F = 1 << (GF_BG_LYR_SUB_2 - GF_BG_LYR_SUB_FIRST), - GF_BG_LYR_SUB_3_F = 1 << (GF_BG_LYR_SUB_3 - GF_BG_LYR_SUB_FIRST), + GF_BG_LYR_SUB_0_F = 1 << (GF_BG_LYR_SUB_0 - GF_BG_LYR_SUB_FIRST), + GF_BG_LYR_SUB_1_F = 1 << (GF_BG_LYR_SUB_1 - GF_BG_LYR_SUB_FIRST), + GF_BG_LYR_SUB_2_F = 1 << (GF_BG_LYR_SUB_2 - GF_BG_LYR_SUB_FIRST), + GF_BG_LYR_SUB_3_F = 1 << (GF_BG_LYR_SUB_3 - GF_BG_LYR_SUB_FIRST), GF_BG_LYR_UNALLOC = 0xFF, }; @@ -133,16 +133,16 @@ enum GFPalLoadLocation { }; enum GFPalSlotOffset { - GF_PAL_SLOT_0_OFFSET = 0x00, - GF_PAL_SLOT_1_OFFSET = 0x20, - GF_PAL_SLOT_2_OFFSET = 0x40, - GF_PAL_SLOT_3_OFFSET = 0x60, - GF_PAL_SLOT_4_OFFSET = 0x80, - GF_PAL_SLOT_5_OFFSET = 0xA0, - GF_PAL_SLOT_6_OFFSET = 0xC0, - GF_PAL_SLOT_7_OFFSET = 0xE0, - GF_PAL_SLOT_8_OFFSET = 0x100, - GF_PAL_SLOT_9_OFFSET = 0x120, + GF_PAL_SLOT_0_OFFSET = 0x00, + GF_PAL_SLOT_1_OFFSET = 0x20, + GF_PAL_SLOT_2_OFFSET = 0x40, + GF_PAL_SLOT_3_OFFSET = 0x60, + GF_PAL_SLOT_4_OFFSET = 0x80, + GF_PAL_SLOT_5_OFFSET = 0xA0, + GF_PAL_SLOT_6_OFFSET = 0xC0, + GF_PAL_SLOT_7_OFFSET = 0xE0, + GF_PAL_SLOT_8_OFFSET = 0x100, + GF_PAL_SLOT_9_OFFSET = 0x120, GF_PAL_SLOT_10_OFFSET = 0x140, GF_PAL_SLOT_11_OFFSET = 0x160, GF_PAL_SLOT_12_OFFSET = 0x180, diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index b99dac91c..92c467d50 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -308,8 +308,8 @@ #define GENDER_RATIO(frac) ((frac) <= 1 ? (u8)((frac) * 254.75) : 255) enum MonGender { - MON_MALE = 0, - MON_FEMALE = 1, + MON_MALE = 0, + MON_FEMALE = 1, MON_GENDERLESS = 2 }; @@ -362,91 +362,91 @@ enum BaseStat { }; typedef enum { - EGG = 0, - EVENT = 0, - HATCHED = 0, - PAL_PARK = 0, - TALL_GRASS = 2, + EGG = 0, + EVENT = 0, + HATCHED = 0, + PAL_PARK = 0, + TALL_GRASS = 2, DIALGA_GAME_EVENT = 4, PALKIA_GAME_EVENT = 4, - CAVE = 5, - HALL_OF_ORIGIN = 5, - SURFING = 7, - FISHING = 7, - BUILDING = 9, - SAFARI_ZONE = 10, - STARTER = 12, - FOSSIL = 12, - GIFT_EEVEE = 12 + CAVE = 5, + HALL_OF_ORIGIN = 5, + SURFING = 7, + FISHING = 7, + BUILDING = 9, + SAFARI_ZONE = 10, + STARTER = 12, + FOSSIL = 12, + GIFT_EEVEE = 12 } EncounterType; typedef int OriginLanguage; typedef enum { - ARCEUS_NORMAL = 0, - ARCEUS_FIST = 1, - ARCEUS_SKY = 2, - ARCEUS_TOXIC = 3, - ARCEUS_EARTH = 4, - ARCEUS_STONE = 5, - ARCEUS_INSECT = 6, - ARCEUS_SPOOKY = 7, - ARCEUS_IRON = 8, - ARCEUS_FLAME = 9, - ARCEUS_SPLASH = 10, - ARCEUS_MEADOW = 11, - ARCEUS_ZAP = 12, - ARCEUS_MIND = 13, - ARCEUS_ICICLE = 14, - ARCEUS_DRACO = 15, - ARCEUS_DREAD = 16, - BURMY_PLANT = 0, - BURMY_SANDY = 1, - BURMY_TRASH = 2, - DEOXYS_NORMAL = 0, - DEOXYS_ATTACK = 1, - DEOXYS_DEFENSE = 2, - DEOXYS_SPEED = 3, - GIRATINA_ALTERED = 0, - GIRATINA_ORIGIN = 1, - ROTOM_NORMAL = 0, - ROTOM_HEAT = 1, - ROTOM_WASH = 2, - ROTOM_FROST = 3, - ROTOM_FAN = 4, - ROTOM_MOW = 5, - SHAYMIN_LAND = 0, - SHAYMIN_SKY = 1, - SHELLOS_WEST = 0, - SHELLOS_EAST = 1, - UNOWN_A = 0, - UNOWN_B = 1, - UNOWN_C = 2, - UNOWN_D = 3, - UNOWN_E = 4, - UNOWN_F = 5, - UNOWN_G = 6, - UNOWN_H = 7, - UNOWN_I = 8, - UNOWN_J = 9, - UNOWN_K = 10, - UNOWN_L = 11, - UNOWN_M = 12, - UNOWN_N = 13, - UNOWN_O = 14, - UNOWN_P = 15, - UNOWN_Q = 16, - UNOWN_R = 17, - UNOWN_S = 18, - UNOWN_T = 19, - UNOWN_U = 20, - UNOWN_V = 21, - UNOWN_W = 22, - UNOWN_X = 23, - UNOWN_Y = 24, - UNOWN_Z = 25, + ARCEUS_NORMAL = 0, + ARCEUS_FIST = 1, + ARCEUS_SKY = 2, + ARCEUS_TOXIC = 3, + ARCEUS_EARTH = 4, + ARCEUS_STONE = 5, + ARCEUS_INSECT = 6, + ARCEUS_SPOOKY = 7, + ARCEUS_IRON = 8, + ARCEUS_FLAME = 9, + ARCEUS_SPLASH = 10, + ARCEUS_MEADOW = 11, + ARCEUS_ZAP = 12, + ARCEUS_MIND = 13, + ARCEUS_ICICLE = 14, + ARCEUS_DRACO = 15, + ARCEUS_DREAD = 16, + BURMY_PLANT = 0, + BURMY_SANDY = 1, + BURMY_TRASH = 2, + DEOXYS_NORMAL = 0, + DEOXYS_ATTACK = 1, + DEOXYS_DEFENSE = 2, + DEOXYS_SPEED = 3, + GIRATINA_ALTERED = 0, + GIRATINA_ORIGIN = 1, + ROTOM_NORMAL = 0, + ROTOM_HEAT = 1, + ROTOM_WASH = 2, + ROTOM_FROST = 3, + ROTOM_FAN = 4, + ROTOM_MOW = 5, + SHAYMIN_LAND = 0, + SHAYMIN_SKY = 1, + SHELLOS_WEST = 0, + SHELLOS_EAST = 1, + UNOWN_A = 0, + UNOWN_B = 1, + UNOWN_C = 2, + UNOWN_D = 3, + UNOWN_E = 4, + UNOWN_F = 5, + UNOWN_G = 6, + UNOWN_H = 7, + UNOWN_I = 8, + UNOWN_J = 9, + UNOWN_K = 10, + UNOWN_L = 11, + UNOWN_M = 12, + UNOWN_N = 13, + UNOWN_O = 14, + UNOWN_P = 15, + UNOWN_Q = 16, + UNOWN_R = 17, + UNOWN_S = 18, + UNOWN_T = 19, + UNOWN_U = 20, + UNOWN_V = 21, + UNOWN_W = 22, + UNOWN_X = 23, + UNOWN_Y = 24, + UNOWN_Z = 25, UNOWN_EXCLAMATION_MARK = 26, - UNOWN_QUESTION_MARK = 27 + UNOWN_QUESTION_MARK = 27 } AlternateForms; typedef enum EvoMethod { diff --git a/include/filesystem.h b/include/filesystem.h index 9c6315d01..929f1d54a 100644 --- a/include/filesystem.h +++ b/include/filesystem.h @@ -14,152 +14,152 @@ typedef struct NARC { } NARC; typedef enum NarcId { - NARC_BATTLE_SKILL_WAZA_SEQ = 0, - NARC_BATTLE_SKILL_SUB_SEQ = 1, - NARC_POKETOOL_PERSONAL_PERSONAL = 2, - NARC_POKETOOL_PERSONAL_GROWTBL = 3, - NARC_POKETOOL_POKEGRA_POKEGRA = 4, - NARC_POKETOOL_POKEGRA_HEIGHT = 5, - NARC_POKETOOL_TRGRA_TRBGRA = 6, - NARC_BATTLE_GRAPHIC_BATT_BG = 7, - NARC_WAZAEFFECT_WE = 8, - NARC_POKETOOL_WAZA_WAZA_TBL = 9, - NARC_FIELDDATA_SCRIPT_SCR_SEQ_RELEASE = 10, - NARC_MSGDATA_SCENARIO_SCR_MSG = 11, - NARC_GRAPHIC_POKETCH = 12, - NARC_GRAPHIC_BAG_GRA = 13, - NARC_GRAPHIC_FONT = 14, - NARC_ITEMTOOL_ITEMDATA_ITEM_DATA = 15, - NARC_ITEMTOOL_ITEMDATA_ITEM_ICON = 16, - NARC_GRAPHIC_TMAP_GRA = 17, - NARC_GRAPHIC_BOX = 18, - NARC_POKETOOL_ICONGRA_POKE_ICON = 19, - NARC_GRAPHIC_PLIST_GRA = 20, - NARC_WAZAEFFECT_EFFECTCLACT_WECHAR = 21, - NARC_WAZAEFFECT_EFFECTCLACT_WEPLTT = 22, - NARC_WAZAEFFECT_EFFECTCLACT_WECELL = 23, - NARC_WAZAEFFECT_EFFECTCLACT_WECELLANM = 24, - NARC_GRAPHIC_IMAGECLIP = 25, - NARC_MSGDATA_MSG = 26, - NARC_BATTLE_GRAPHIC_BATT_OBJ = 27, - NARC_DATA_UNDERG_RADAR = 28, - NARC_WAZAEFFECT_EFFECTDATA_WAZA_PARTICLE = 29, - NARC_BATTLE_SKILL_BE_SEQ = 30, - NARC_DATA_NAMEIN = 31, - NARC_FIELDDATA_EVENTDATA_ZONE_EVENT_RELEASE = 32, - NARC_POKETOOL_PERSONAL_WOTBL = 33, - NARC_POKETOOL_PERSONAL_EVO = 34, - NARC_GRAPHIC_FONTOAM = 35, - NARC_GRAPHIC_FIELD_BOARD = 36, - NARC_FIELDDATA_ENCOUNTDATA_D_ENC_DATA = 37, - NARC_GRAPHIC_WINFRAME = 38, - NARC_GRAPHIC_PST_GRA = 39, - NARC_FIELDDATA_BUILD_MODEL_BUILD_MODEL = 40, - NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX = 41, - NARC_FIELDDATA_AREADATA_AREA_DATA = 42, - NARC_FIELDDATA_AREADATA_AREA_BUILD_MODEL_AREA_BUILD = 43, - NARC_FIELDDATA_AREADATA_AREA_MAP_TEX_MAP_TEX_SET = 44, - NARC_CONTEST_GRAPHIC_CONTEST_BG = 45, - NARC_CONTEST_GRAPHIC_CONTEST_OBJ = 46, - NARC_DATA_UGEFFECT_OBJ_GRAPHIC = 47, - NARC_DEMO_TITLE_TITLEDEMO = 48, + NARC_BATTLE_SKILL_WAZA_SEQ = 0, + NARC_BATTLE_SKILL_SUB_SEQ = 1, + NARC_POKETOOL_PERSONAL_PERSONAL = 2, + NARC_POKETOOL_PERSONAL_GROWTBL = 3, + NARC_POKETOOL_POKEGRA_POKEGRA = 4, + NARC_POKETOOL_POKEGRA_HEIGHT = 5, + NARC_POKETOOL_TRGRA_TRBGRA = 6, + NARC_BATTLE_GRAPHIC_BATT_BG = 7, + NARC_WAZAEFFECT_WE = 8, + NARC_POKETOOL_WAZA_WAZA_TBL = 9, + NARC_FIELDDATA_SCRIPT_SCR_SEQ_RELEASE = 10, + NARC_MSGDATA_SCENARIO_SCR_MSG = 11, + NARC_GRAPHIC_POKETCH = 12, + NARC_GRAPHIC_BAG_GRA = 13, + NARC_GRAPHIC_FONT = 14, + NARC_ITEMTOOL_ITEMDATA_ITEM_DATA = 15, + NARC_ITEMTOOL_ITEMDATA_ITEM_ICON = 16, + NARC_GRAPHIC_TMAP_GRA = 17, + NARC_GRAPHIC_BOX = 18, + NARC_POKETOOL_ICONGRA_POKE_ICON = 19, + NARC_GRAPHIC_PLIST_GRA = 20, + NARC_WAZAEFFECT_EFFECTCLACT_WECHAR = 21, + NARC_WAZAEFFECT_EFFECTCLACT_WEPLTT = 22, + NARC_WAZAEFFECT_EFFECTCLACT_WECELL = 23, + NARC_WAZAEFFECT_EFFECTCLACT_WECELLANM = 24, + NARC_GRAPHIC_IMAGECLIP = 25, + NARC_MSGDATA_MSG = 26, + NARC_BATTLE_GRAPHIC_BATT_OBJ = 27, + NARC_DATA_UNDERG_RADAR = 28, + NARC_WAZAEFFECT_EFFECTDATA_WAZA_PARTICLE = 29, + NARC_BATTLE_SKILL_BE_SEQ = 30, + NARC_DATA_NAMEIN = 31, + NARC_FIELDDATA_EVENTDATA_ZONE_EVENT_RELEASE = 32, + NARC_POKETOOL_PERSONAL_WOTBL = 33, + NARC_POKETOOL_PERSONAL_EVO = 34, + NARC_GRAPHIC_FONTOAM = 35, + NARC_GRAPHIC_FIELD_BOARD = 36, + NARC_FIELDDATA_ENCOUNTDATA_D_ENC_DATA = 37, + NARC_GRAPHIC_WINFRAME = 38, + NARC_GRAPHIC_PST_GRA = 39, + NARC_FIELDDATA_BUILD_MODEL_BUILD_MODEL = 40, + NARC_FIELDDATA_MAPMATRIX_MAP_MATRIX = 41, + NARC_FIELDDATA_AREADATA_AREA_DATA = 42, + NARC_FIELDDATA_AREADATA_AREA_BUILD_MODEL_AREA_BUILD = 43, + NARC_FIELDDATA_AREADATA_AREA_MAP_TEX_MAP_TEX_SET = 44, + NARC_CONTEST_GRAPHIC_CONTEST_BG = 45, + NARC_CONTEST_GRAPHIC_CONTEST_OBJ = 46, + NARC_DATA_UGEFFECT_OBJ_GRAPHIC = 47, + NARC_DEMO_TITLE_TITLEDEMO = 48, NARC_FIELDDATA_AREADATA_AREA_MOVE_MODEL_MOVE_MODEL_LIST = 49, - NARC_DATA_UG_TRAP = 50, - NARC_GRAPHIC_TRAINER_CASE = 51, - NARC_DATA_UG_FOSSIL = 52, - NARC_GRAPHIC_NTAG_GRA = 53, - NARC_DATA_TRADELIST = 54, - NARC_DATA_UG_PARTS = 55, - NARC_GRAPHIC_OPENING = 56, - NARC_POKETOOL_TRAINER_TRDATA = 57, - NARC_POKETOOL_TRAINER_TRPOKE = 58, - NARC_POKETOOL_TRMSG_TRTBL = 59, - NARC_POKETOOL_TRGRA_TRFGRA = 60, - NARC_PARTICLEDATA_PARTICLEDATA = 61, - NARC_GRAPHIC_SHOP_GRA = 62, - NARC_WAZAEFFECT_WE_SUB = 63, - NARC_DATA_UG_ANIM = 64, - NARC_DATA_WEATHER_SYS = 65, - NARC_GRAPHIC_MENU_GRA = 66, - NARC_FIELDDATA_LAND_DATA_LAND_DATA_RELEASE = 67, - NARC_ITEMTOOL_ITEMDATA_NUTS_DATA = 68, - NARC_RESOURCE_ENG_ZUKAN_ZUKAN = 69, - NARC_POKETOOL_POKEFOOT_POKEFOOT = 70, - NARC_FIELDDATA_AREADATA_AREA_BUILD_MODEL_AREABM_TEXSET = 71, - NARC_BATTLE_GRAPHIC_B_PLIST_GRA = 72, - NARC_GRAPHIC_CONFIG_GRA = 73, - NARC_GRAPHIC_UNIONROOM = 74, - NARC_APPLICATION_ZUKANLIST_ZKN_DATA_ZUKAN_DATA = 75, - NARC_GRAPHIC_PMSI = 76, - NARC_BATTLE_GRAPHIC_B_BAG_GRA = 77, - NARC_GRAPHIC_OEKAKI = 78, - NARC_GRAPHIC_MAIL_GRA = 79, - NARC_GRAPHIC_F_NOTE_GRA = 80, - NARC_DATA_MMODEL_MMODEL = 81, - NARC_GRAPHIC_EV_POKESELECT = 82, - NARC_GRAPHIC_PORU_GRA = 83, - NARC_GRAPHIC_TOUCH_SUBWINDOW = 84, - NARC_GRAPHIC_FLD_COMACT = 85, - NARC_GRAPHIC_RECORD = 86, - NARC_GRAPHIC_PORUDEMO = 87, - NARC_GRAPHIC_PORUACT = 88, - NARC_DATA_WIFINOTE = 89, - NARC_CONTEST_DATA_CONTEST_DATA = 90, - NARC_APPLICATION_CUSTOM_BALL_DATA_CB_DATA = 91, - NARC_DATA_WIFIP2PMATCH = 92, - NARC_GRAPHIC_DEMO_TRADE = 93, - NARC_POKEANIME_POKE_ANM = 94, - NARC_GRAPHIC_MYSIGN = 95, - NARC_FIELDDATA_MM_LIST_MOVE_MODEL_LIST = 96, - NARC_DATA_FIELD_CUTIN = 97, - NARC_DATA_DEMO_CLIMAX = 98, - NARC_WAZAEFFECT_EFFECTDATA_BALL_PARTICLE = 99, - NARC_WAZAEFFECT_PT_DEBUG_DEBUG_PARTICLE = 100, - NARC_GRAPHIC_DENDOU_PC = 101, - NARC_APPLICATION_WIFI_EARTH_WIFI_EARTH_PLACE = 102, - NARC_BATTLE_TR_AI_TR_AI_SEQ = 103, - NARC_GRAPHIC_WORLDTRADE = 104, - NARC_GRAPHIC_DENDOU_DEMO = 105, - NARC_ARC_ENCDATA_EX = 106, - NARC_DATA_MMODEL_FLDEFF = 107, - NARC_BATTLE_GRAPHIC_VS_DEMO_GRA = 108, - NARC_POKETOOL_POKEZUKAN = 109, - NARC_ARC_BM_ANIME = 110, - NARC_ARC_BM_ANIME_LIST = 111, - NARC_GRAPHIC_FIELD_ENCOUNTEFFECT = 112, - NARC_GRAPHIC_WAZA_OSHIE_GRA = 113, - NARC_POKETOOL_POKEANM_POKEANM = 114, - NARC_FIELDDATA_POKEMON_TRADE_FLD_TRADE = 115, - NARC_GRAPHIC_MYSTERY = 116, - NARC_POKETOOL_POKEGRA_OTHERPOKE = 117, - NARC_DEMO_EGG_DATA_EGG_DATA = 118, - NARC_DEMO_EGG_DATA_PARTICLE_EGG_DEMO_PARTICLE = 119, - NARC_ARC_SHIP_DEMO = 120, - NARC_POKETOOL_POKEGRA_HEIGHT_O = 121, - NARC_GRAPHIC_NUTMIXER = 122, - NARC_GRAPHIC_BTOWER = 123, - NARC_DEMO_SHINKA_DATA_PARTICLE_SHINKA_DEMO_PARTICLE = 124, - NARC_DEMO_INTRO_INTRO = 125, - NARC_ARC_TV = 126, - NARC_GRAPHIC_ENDING = 127, - NARC_DEMO_TITLE_OP_DEMO = 128, - NARC_APPLICATION_WIFI_EARTH_WIFI_EARTH = 129, - NARC_GRAPHIC_RANKING = 130, - NARC_ARC_PPARK = 131, - NARC_DEMO_SYOUJYOU_SYOUJYOU = 132, - NARC_DATA_SLOT = 133, - NARC_BATTLE_B_TOWER_BTDTR = 134, - NARC_BATTLE_B_TOWER_BTDPM = 135, - NARC_DEMO_INTRO_INTRO_TV = 136, - NARC_POKETOOL_TRMSG_TRTBLOFS = 137, - NARC_POKETOOL_POKEGRA_POKE_YOFS = 138, - NARC_APPLICATION_ZUKANLIST_ZKN_DATA_ZUKAN_ENC_DIAMOND = 139, - NARC_APPLICATION_ZUKANLIST_ZKN_DATA_ZUKAN_ENC_PEARL = 140, - NARC_GRAPHIC_HIDEN_EFFECT = 141, - NARC_POKETOOL_POKEGRA_POKE_SHADOW = 142, - NARC_FIELDDATA_ENCOUNTDATA_P_ENC_DATA = 143, - NARC_POKETOOL_POKEGRA_POKE_SHADOW_OFX = 144, - NARC_POKETOOL_SHINZUKAN = 145, + NARC_DATA_UG_TRAP = 50, + NARC_GRAPHIC_TRAINER_CASE = 51, + NARC_DATA_UG_FOSSIL = 52, + NARC_GRAPHIC_NTAG_GRA = 53, + NARC_DATA_TRADELIST = 54, + NARC_DATA_UG_PARTS = 55, + NARC_GRAPHIC_OPENING = 56, + NARC_POKETOOL_TRAINER_TRDATA = 57, + NARC_POKETOOL_TRAINER_TRPOKE = 58, + NARC_POKETOOL_TRMSG_TRTBL = 59, + NARC_POKETOOL_TRGRA_TRFGRA = 60, + NARC_PARTICLEDATA_PARTICLEDATA = 61, + NARC_GRAPHIC_SHOP_GRA = 62, + NARC_WAZAEFFECT_WE_SUB = 63, + NARC_DATA_UG_ANIM = 64, + NARC_DATA_WEATHER_SYS = 65, + NARC_GRAPHIC_MENU_GRA = 66, + NARC_FIELDDATA_LAND_DATA_LAND_DATA_RELEASE = 67, + NARC_ITEMTOOL_ITEMDATA_NUTS_DATA = 68, + NARC_RESOURCE_ENG_ZUKAN_ZUKAN = 69, + NARC_POKETOOL_POKEFOOT_POKEFOOT = 70, + NARC_FIELDDATA_AREADATA_AREA_BUILD_MODEL_AREABM_TEXSET = 71, + NARC_BATTLE_GRAPHIC_B_PLIST_GRA = 72, + NARC_GRAPHIC_CONFIG_GRA = 73, + NARC_GRAPHIC_UNIONROOM = 74, + NARC_APPLICATION_ZUKANLIST_ZKN_DATA_ZUKAN_DATA = 75, + NARC_GRAPHIC_PMSI = 76, + NARC_BATTLE_GRAPHIC_B_BAG_GRA = 77, + NARC_GRAPHIC_OEKAKI = 78, + NARC_GRAPHIC_MAIL_GRA = 79, + NARC_GRAPHIC_F_NOTE_GRA = 80, + NARC_DATA_MMODEL_MMODEL = 81, + NARC_GRAPHIC_EV_POKESELECT = 82, + NARC_GRAPHIC_PORU_GRA = 83, + NARC_GRAPHIC_TOUCH_SUBWINDOW = 84, + NARC_GRAPHIC_FLD_COMACT = 85, + NARC_GRAPHIC_RECORD = 86, + NARC_GRAPHIC_PORUDEMO = 87, + NARC_GRAPHIC_PORUACT = 88, + NARC_DATA_WIFINOTE = 89, + NARC_CONTEST_DATA_CONTEST_DATA = 90, + NARC_APPLICATION_CUSTOM_BALL_DATA_CB_DATA = 91, + NARC_DATA_WIFIP2PMATCH = 92, + NARC_GRAPHIC_DEMO_TRADE = 93, + NARC_POKEANIME_POKE_ANM = 94, + NARC_GRAPHIC_MYSIGN = 95, + NARC_FIELDDATA_MM_LIST_MOVE_MODEL_LIST = 96, + NARC_DATA_FIELD_CUTIN = 97, + NARC_DATA_DEMO_CLIMAX = 98, + NARC_WAZAEFFECT_EFFECTDATA_BALL_PARTICLE = 99, + NARC_WAZAEFFECT_PT_DEBUG_DEBUG_PARTICLE = 100, + NARC_GRAPHIC_DENDOU_PC = 101, + NARC_APPLICATION_WIFI_EARTH_WIFI_EARTH_PLACE = 102, + NARC_BATTLE_TR_AI_TR_AI_SEQ = 103, + NARC_GRAPHIC_WORLDTRADE = 104, + NARC_GRAPHIC_DENDOU_DEMO = 105, + NARC_ARC_ENCDATA_EX = 106, + NARC_DATA_MMODEL_FLDEFF = 107, + NARC_BATTLE_GRAPHIC_VS_DEMO_GRA = 108, + NARC_POKETOOL_POKEZUKAN = 109, + NARC_ARC_BM_ANIME = 110, + NARC_ARC_BM_ANIME_LIST = 111, + NARC_GRAPHIC_FIELD_ENCOUNTEFFECT = 112, + NARC_GRAPHIC_WAZA_OSHIE_GRA = 113, + NARC_POKETOOL_POKEANM_POKEANM = 114, + NARC_FIELDDATA_POKEMON_TRADE_FLD_TRADE = 115, + NARC_GRAPHIC_MYSTERY = 116, + NARC_POKETOOL_POKEGRA_OTHERPOKE = 117, + NARC_DEMO_EGG_DATA_EGG_DATA = 118, + NARC_DEMO_EGG_DATA_PARTICLE_EGG_DEMO_PARTICLE = 119, + NARC_ARC_SHIP_DEMO = 120, + NARC_POKETOOL_POKEGRA_HEIGHT_O = 121, + NARC_GRAPHIC_NUTMIXER = 122, + NARC_GRAPHIC_BTOWER = 123, + NARC_DEMO_SHINKA_DATA_PARTICLE_SHINKA_DEMO_PARTICLE = 124, + NARC_DEMO_INTRO_INTRO = 125, + NARC_ARC_TV = 126, + NARC_GRAPHIC_ENDING = 127, + NARC_DEMO_TITLE_OP_DEMO = 128, + NARC_APPLICATION_WIFI_EARTH_WIFI_EARTH = 129, + NARC_GRAPHIC_RANKING = 130, + NARC_ARC_PPARK = 131, + NARC_DEMO_SYOUJYOU_SYOUJYOU = 132, + NARC_DATA_SLOT = 133, + NARC_BATTLE_B_TOWER_BTDTR = 134, + NARC_BATTLE_B_TOWER_BTDPM = 135, + NARC_DEMO_INTRO_INTRO_TV = 136, + NARC_POKETOOL_TRMSG_TRTBLOFS = 137, + NARC_POKETOOL_POKEGRA_POKE_YOFS = 138, + NARC_APPLICATION_ZUKANLIST_ZKN_DATA_ZUKAN_ENC_DIAMOND = 139, + NARC_APPLICATION_ZUKANLIST_ZKN_DATA_ZUKAN_ENC_PEARL = 140, + NARC_GRAPHIC_HIDEN_EFFECT = 141, + NARC_POKETOOL_POKEGRA_POKE_SHADOW = 142, + NARC_FIELDDATA_ENCOUNTDATA_P_ENC_DATA = 143, + NARC_POKETOOL_POKEGRA_POKE_SHADOW_OFX = 144, + NARC_POKETOOL_SHINZUKAN = 145, } NarcId; void ReadFromNarcMemberByPathAndId(void *dest, const char *path, s32 file_idx, u32 offset, u32 size); diff --git a/include/heap.h b/include/heap.h index debc074b9..263073cfa 100644 --- a/include/heap.h +++ b/include/heap.h @@ -17,12 +17,12 @@ typedef enum HeapID { HEAP_ID_POKETCH_MAIN = 7, HEAP_ID_POKETCH_APP, HEAP_ID_FIELD = 11, - HEAP_ID_15 = 15, - HEAP_ID_32 = 32, - HEAP_ID_49 = 49, - HEAP_ID_76 = 76, + HEAP_ID_15 = 15, + HEAP_ID_32 = 32, + HEAP_ID_49 = 49, + HEAP_ID_76 = 76, HEAP_ID_77, - HEAP_ID_INTRO = 82, + HEAP_ID_INTRO = 82, HEAP_ID_INTRO_TV = 83, } HeapID; diff --git a/include/itemtool.h b/include/itemtool.h index e4128fe7b..909d6db63 100644 --- a/include/itemtool.h +++ b/include/itemtool.h @@ -21,39 +21,39 @@ typedef struct ItemSlot { } ItemSlot; struct ItemPartyUseParam { - u8 slp_heal : 1; - u8 psn_heal : 1; - u8 brn_heal : 1; - u8 frz_heal : 1; - u8 prz_heal : 1; - u8 cfs_heal : 1; - u8 inf_heal : 1; - u8 guard_spec : 1; - u8 revive : 1; - u8 revive_all : 1; - u8 level_up : 1; - u8 evolve : 1; - u8 atk_stages : 4; - u8 def_stages : 4; - u8 spatk_stages : 4; - u8 spdef_stages : 4; - u8 speed_stages : 4; - u8 accuracy_stages : 4; - u8 critrate_stages : 2; - u8 pp_up : 1; - u8 pp_max : 1; - u8 pp_restore : 1; - u8 pp_restore_all : 1; - u8 hp_restore : 1; - u8 hp_ev_up : 1; - u8 atk_ev_up : 1; - u8 def_ev_up : 1; - u8 speed_ev_up : 1; - u8 spatk_ev_up : 1; - u8 spdef_ev_up : 1; - u8 friendship_mod_lo : 1; + u8 slp_heal : 1; + u8 psn_heal : 1; + u8 brn_heal : 1; + u8 frz_heal : 1; + u8 prz_heal : 1; + u8 cfs_heal : 1; + u8 inf_heal : 1; + u8 guard_spec : 1; + u8 revive : 1; + u8 revive_all : 1; + u8 level_up : 1; + u8 evolve : 1; + u8 atk_stages : 4; + u8 def_stages : 4; + u8 spatk_stages : 4; + u8 spdef_stages : 4; + u8 speed_stages : 4; + u8 accuracy_stages : 4; + u8 critrate_stages : 2; + u8 pp_up : 1; + u8 pp_max : 1; + u8 pp_restore : 1; + u8 pp_restore_all : 1; + u8 hp_restore : 1; + u8 hp_ev_up : 1; + u8 atk_ev_up : 1; + u8 def_ev_up : 1; + u8 speed_ev_up : 1; + u8 spatk_ev_up : 1; + u8 spdef_ev_up : 1; + u8 friendship_mod_lo : 1; u8 friendship_mod_med : 1; - u8 friendship_mod_hi : 1; + u8 friendship_mod_hi : 1; s8 hp_ev_up_param; s8 atk_ev_up_param; s8 def_ev_up_param; @@ -77,10 +77,10 @@ struct ItemData { u8 unk6; u8 naturalGiftPower; u16 naturalGiftType : 5; - u16 prevent_toss : 1; - u16 selectable : 1; - u16 pocket : 4; - u16 unk8_B : 5; + u16 prevent_toss : 1; + u16 selectable : 1; + u16 pocket : 4; + u16 unk8_B : 5; u8 unkA; u8 unkB; u8 partyUse; diff --git a/include/list_menu.h b/include/list_menu.h index 747b7b531..da53d1c7e 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -30,26 +30,26 @@ struct ListMenuTemplate { /*0x14*/ u8 header_X; /*0x15*/ u8 item_X; /*0x16*/ u8 cursor_X; - /*0x17*/ u8 upText_Y : 4; - u8 cursorPal : 4; - /*0x18*/ u8 fillValue : 4; - u8 cursorShadowPal : 4; + /*0x17*/ u8 upText_Y : 4; + u8 cursorPal : 4; + /*0x18*/ u8 fillValue : 4; + u8 cursorShadowPal : 4; /*0x1A*/ u16 lettersSpacing : 3; - u16 itemVerticalPadding : 4; - u16 scrollMultiple : 2; - u16 fontId : 6; - u16 cursorKind : 1; + u16 itemVerticalPadding : 4; + u16 scrollMultiple : 2; + u16 fontId : 6; + u16 cursorKind : 1; /*0x1C*/ u32 unk_1C; }; struct ListMenu { /*0x00*/ struct ListMenuTemplate template; // ListMenuOverride from gen 3 - /*0x20*/ u8 cursorPal : 4; - u8 fillValue : 4; + /*0x20*/ u8 cursorPal : 4; + u8 fillValue : 4; /*0x21*/ u8 cursorShadowPal : 4; - u8 unk_21_4 : 4; - /*0x22*/ u8 lettersSpacing : 6; + u8 unk_21_4 : 4; + /*0x22*/ u8 lettersSpacing : 6; /*0x23*/ u8 unk_23; /*0x24*/ u8 fontId : 7; u8 overrideEnabled : 1; diff --git a/include/map_header.h b/include/map_header.h index 926e135e3..67a77cf64 100644 --- a/include/map_header.h +++ b/include/map_header.h @@ -18,11 +18,11 @@ struct MapHeader { u8 weather_type; u8 camera_type; u8 map_type; - u8 battle_bg : 4; - u8 is_bike_allowed : 1; - u8 is_running_allowed : 1; // unused + u8 battle_bg : 4; + u8 is_bike_allowed : 1; + u8 is_running_allowed : 1; // unused u8 is_escape_rope_allowed : 1; - u8 is_fly_allowed : 1; + u8 is_fly_allowed : 1; }; u8 MapHeader_GetAreaDataBank(u32 mapno); diff --git a/include/map_object.h b/include/map_object.h index e2a510a37..a545bdd69 100644 --- a/include/map_object.h +++ b/include/map_object.h @@ -122,38 +122,38 @@ struct ObjectEvent { }; typedef enum MapObjectFlagBits { - MAPOBJECTFLAG_ACTIVE = (1 << 0), + MAPOBJECTFLAG_ACTIVE = (1 << 0), MAPOBJECTFLAG_SINGLE_MOVEMENT = (1 << 1), - MAPOBJECTFLAG_UNK2 = (1 << 2), - MAPOBJECTFLAG_UNK3 = (1 << 3), - MAPOBJECTFLAG_UNK4 = (1 << 4), - MAPOBJECTFLAG_UNK5 = (1 << 5), + MAPOBJECTFLAG_UNK2 = (1 << 2), + MAPOBJECTFLAG_UNK3 = (1 << 3), + MAPOBJECTFLAG_UNK4 = (1 << 4), + MAPOBJECTFLAG_UNK5 = (1 << 5), MAPOBJECTFLAG_MOVEMENT_PAUSED = (1 << 6), - MAPOBJECTFLAG_UNK7 = (1 << 7), - MAPOBJECTFLAG_UNK8 = (1 << 8), - MAPOBJECTFLAG_VISIBLE = (1 << 9), - MAPOBJECTFLAG_KEEP = (1 << 10), - MAPOBJECTFLAG_UNK11 = (1 << 11), - MAPOBJECTFLAG_UNK12 = (1 << 12), - MAPOBJECTFLAG_UNK13 = (1 << 13), - MAPOBJECTFLAG_UNK14 = (1 << 14), - MAPOBJECTFLAG_UNK15 = (1 << 15), - MAPOBJECTFLAG_UNK16 = (1 << 16), - MAPOBJECTFLAG_UNK17 = (1 << 17), - MAPOBJECTFLAG_UNK18 = (1 << 18), - MAPOBJECTFLAG_UNK19 = (1 << 19), - MAPOBJECTFLAG_UNK20 = (1 << 20), - MAPOBJECTFLAG_UNK21 = (1 << 21), - MAPOBJECTFLAG_UNK22 = (1 << 22), - MAPOBJECTFLAG_IGNORE_HEIGHTS = (1 << 23), - MAPOBJECTFLAG_UNK24 = (1 << 24), - MAPOBJECTFLAG_UNK25 = (1 << 25), - MAPOBJECTFLAG_UNK26 = (1 << 26), - MAPOBJECTFLAG_UNK27 = (1 << 27), - MAPOBJECTFLAG_UNK28 = (1 << 28), - MAPOBJECTFLAG_UNK29 = (1 << 29), - MAPOBJECTFLAG_UNK30 = (1 << 30), - MAPOBJECTFLAG_UNK31 = (1 << 31), + MAPOBJECTFLAG_UNK7 = (1 << 7), + MAPOBJECTFLAG_UNK8 = (1 << 8), + MAPOBJECTFLAG_VISIBLE = (1 << 9), + MAPOBJECTFLAG_KEEP = (1 << 10), + MAPOBJECTFLAG_UNK11 = (1 << 11), + MAPOBJECTFLAG_UNK12 = (1 << 12), + MAPOBJECTFLAG_UNK13 = (1 << 13), + MAPOBJECTFLAG_UNK14 = (1 << 14), + MAPOBJECTFLAG_UNK15 = (1 << 15), + MAPOBJECTFLAG_UNK16 = (1 << 16), + MAPOBJECTFLAG_UNK17 = (1 << 17), + MAPOBJECTFLAG_UNK18 = (1 << 18), + MAPOBJECTFLAG_UNK19 = (1 << 19), + MAPOBJECTFLAG_UNK20 = (1 << 20), + MAPOBJECTFLAG_UNK21 = (1 << 21), + MAPOBJECTFLAG_UNK22 = (1 << 22), + MAPOBJECTFLAG_IGNORE_HEIGHTS = (1 << 23), + MAPOBJECTFLAG_UNK24 = (1 << 24), + MAPOBJECTFLAG_UNK25 = (1 << 25), + MAPOBJECTFLAG_UNK26 = (1 << 26), + MAPOBJECTFLAG_UNK27 = (1 << 27), + MAPOBJECTFLAG_UNK28 = (1 << 28), + MAPOBJECTFLAG_UNK29 = (1 << 29), + MAPOBJECTFLAG_UNK30 = (1 << 30), + MAPOBJECTFLAG_UNK31 = (1 << 31), } MapObjectFlagBits; // this may be the same as above, I don't know diff --git a/include/options.h b/include/options.h index f3a8b85a9..b26636285 100644 --- a/include/options.h +++ b/include/options.h @@ -6,12 +6,12 @@ struct SaveData; typedef struct Options { - u16 textSpeed : 4; + u16 textSpeed : 4; u16 soundMethod : 2; u16 battleStyle : 1; u16 battleScene : 1; - u16 buttonMode : 2; - u16 frame : 5; + u16 buttonMode : 2; + u16 frame : 5; } Options; struct Options *Options_New(HeapID heapId); diff --git a/include/palette.h b/include/palette.h index 160496df0..22d2474f0 100644 --- a/include/palette.h +++ b/include/palette.h @@ -7,25 +7,25 @@ #include "unk_0200CA44.h" struct PlttData { - u16 r : 5; // red - u16 g : 5; // green - u16 b : 5; // blue + u16 r : 5; // red + u16 g : 5; // green + u16 b : 5; // blue u16 unused_15 : 1; }; struct PaletteFadeControl { u16 selectedPalettes; - u16 delay : 6; - u16 y : 5; + u16 delay : 6; + u16 y : 5; u16 targetY : 5; u16 blendColor : 15; - u16 yDec : 1; + u16 yDec : 1; - u16 deltaY : 4; + u16 deltaY : 4; u16 delayCounter : 6; - u16 unk06_a : 6; + u16 unk06_a : 6; }; struct Palette { @@ -38,11 +38,11 @@ struct Palette { struct PaletteData { struct Palette pltt[14]; - u16 unk118_0 : 2; + u16 unk118_0 : 2; u16 activeFadePalettes : 14; - u16 unk11a_0 : 14; - u16 unk11a_e : 1; - u16 unk11a_f : 1; + u16 unk11a_0 : 14; + u16 unk11a_e : 1; + u16 unk11a_f : 1; u8 unk11c; u8 unk11d; u16 unk11e; diff --git a/include/player_data.h b/include/player_data.h index 54a2992ad..b846015e4 100644 --- a/include/player_data.h +++ b/include/player_data.h @@ -10,7 +10,7 @@ struct SaveData; #define MAX_MONEY 999999 typedef enum PlayerGender { - PLAYER_GENDER_MALE = 0, + PLAYER_GENDER_MALE = 0, PLAYER_GENDER_FEMALE = 1 } PlayerGender; @@ -24,8 +24,8 @@ typedef struct PlayerProfile { /* 0x1B */ u8 avatar; /* 0x1C */ u8 version; /* 0x1D */ u8 gameCleared : 1; - u8 nationalDex : 1; - u8 field_1D_pad : 6; + u8 nationalDex : 1; + u8 field_1D_pad : 6; /* 0x1E */ u8 padding_1E[2]; } PlayerProfile; diff --git a/include/pokemon.h b/include/pokemon.h index d9d499da8..d2ccf5d0c 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -34,13 +34,13 @@ struct BaseStats { /* 0x06 */ u8 types[2]; /* 0x08 */ u8 catchRate; /* 0x09 */ u8 expYield; - /* 0x0A */ u16 hp_yield : 2; - u16 atk_yield : 2; - u16 def_yield : 2; - u16 speed_yield : 2; + /* 0x0A */ u16 hp_yield : 2; + u16 atk_yield : 2; + u16 def_yield : 2; + u16 speed_yield : 2; /* 0x0B */ u16 spatk_yield : 2; - u16 spdef_yield : 2; - u16 padding_B_4 : 4; + u16 spdef_yield : 2; + u16 padding_B_4 : 4; /* 0x0C */ u16 item1; /* 0x0E */ u16 item2; /* 0x10 */ u8 genderRatio; @@ -51,7 +51,7 @@ struct BaseStats { /* 0x16 */ u8 abilities[2]; /* 0x18 */ u8 greatMarshRate; /* 0x19 */ u8 color : 7; - u8 flip : 1; + u8 flip : 1; u8 padding_1A[2]; /* 0x1C */ u32 unk1C; /* 0x20 */ u32 unk20; @@ -121,7 +121,7 @@ typedef struct { /* 0x1A */ u8 pokerus; /* 0x1B */ u8 pokeball; /* 0x1C */ u8 metLevel : 7; - u8 metGender : 1; + u8 metGender : 1; /* 0x1D */ u8 encounterType; /* 0x1E */ u16 HGSS_Pokeball; } PokemonDataBlockD; @@ -136,10 +136,10 @@ typedef union { typedef struct BoxPokemon { /* 0x000 */ u32 pid; /* 0x004 */ u16 party_lock : 1; - u16 box_lock : 1; - u16 checksum_fail : 1; - u16 Unused : 13; // Might be used for validity checks - /* 0x006 */ u16 checksum; // Stored checksum of pokemon + u16 box_lock : 1; + u16 checksum_fail : 1; + u16 Unused : 13; // Might be used for validity checks + /* 0x006 */ u16 checksum; // Stored checksum of pokemon /* 0x008 */ PokemonDataBlock substructs[4]; } BoxPokemon; diff --git a/include/poketch.h b/include/poketch.h index 835016869..21d2738d7 100644 --- a/include/poketch.h +++ b/include/poketch.h @@ -7,7 +7,7 @@ #define DOT_ARTIST_SIZE (480 / 4) // 2bpp typedef enum PoketchApp { - FIRST_POKETCH_APP_ID = 0, + FIRST_POKETCH_APP_ID = 0, POKETCH_DIGITAL_WATCH = FIRST_POKETCH_APP_ID, POKETCH_CALCULATOR, POKETCH_MEMO_PAD, @@ -37,10 +37,10 @@ typedef enum PoketchApp { } PoketchApp; typedef struct Poketch { - u8 isGiven : 1; // set by completing the coupon sidequest in Jubilife - u8 pedometerActive : 1; // set when you receive the Pedometer + u8 isGiven : 1; // set by completing the coupon sidequest in Jubilife + u8 pedometerActive : 1; // set when you receive the Pedometer u8 dotArtistEnabled : 1; // set when you access dotArtist for the first time - u8 color : 3; // set by Color Changer + u8 color : 3; // set by Color Changer // Green, Yellow, Orange, Red, Purple, Blue, Turquoise, White u8 padding_00_6 : 2; // silence warnings s8 numApps; @@ -48,9 +48,9 @@ typedef struct Poketch { u8 unlockedApps[32]; // should be 25, one for each app u8 filler_23[1]; // silence warnings u32 stepCounter; // increments while pedometerActive is 1 - u16 alarmActive : 1; - u16 alarmHour : 5; - u16 alarmMinute : 6; + u16 alarmActive : 1; + u16 alarmHour : 5; + u16 alarmMinute : 6; u16 padding_28_C : 4; // silence warnings u8 dotArtistGrid[DOT_ARTIST_SIZE]; u8 filler_A2[1]; // silence warnings diff --git a/include/render_text.h b/include/render_text.h index 30e1029da..02aa3bcb4 100644 --- a/include/render_text.h +++ b/include/render_text.h @@ -7,25 +7,25 @@ typedef struct { - u8 canABSpeedUpPrint : 1; + u8 canABSpeedUpPrint : 1; u8 useAlternateDownArrow : 1; - u8 autoScroll : 1; - u8 forceMidTextSpeed : 1; - u8 unk0_4 : 1; - u8 unk0_5 : 1; - u8 unk0_6 : 1; - u8 unk0_7 : 1; + u8 autoScroll : 1; + u8 forceMidTextSpeed : 1; + u8 unk0_4 : 1; + u8 unk0_5 : 1; + u8 unk0_6 : 1; + u8 unk0_7 : 1; u8 unk1; } TextFlags; struct TextPrinterSubStruct { - u8 glyphId : 4; // 0x14 + u8 glyphId : 4; // 0x14 u8 hasPrintBeenSpedUp : 1; - u8 unk : 3; - u8 downArrowDelay : 5; - u8 downArrowYPosIdx : 2; - u8 hasGlyphIdBeenSet : 1; - u8 autoScrollDelay : 8; + u8 unk : 3; + u8 downArrowDelay : 5; + u8 downArrowYPosIdx : 2; + u8 hasGlyphIdBeenSet : 1; + u8 autoScrollDelay : 8; }; u32 RenderText(struct TextPrinter *printer); diff --git a/include/sections.h b/include/sections.h index 967a7749f..93e122e9a 100644 --- a/include/sections.h +++ b/include/sections.h @@ -1,9 +1,9 @@ #ifndef GUARD_SECTIONS_H #define GUARD_SECTIONS_H -#pragma define_section ITCM ".itcm" \ +#pragma define_section ITCM ".itcm" \ ".itcm.bss" abs32 RWX -#pragma define_section DTCM ".dtcm" \ +#pragma define_section DTCM ".dtcm" \ ".dtcm.bss" abs32 RWX #pragma define_section VERSION ".version" abs32 RWX #pragma define_section PARENT ".parent" abs32 RWX diff --git a/include/text.h b/include/text.h index 212ba070d..340ac9b4f 100644 --- a/include/text.h +++ b/include/text.h @@ -46,7 +46,7 @@ struct TextPrinter { u8 active; // 23 u8 state; // 0x24 u8 textSpeedBottom : 7; // 25 - u8 textSpeedTop : 1; + u8 textSpeedTop : 1; u8 delayCounter; // 26 u8 scrollDistance; // 27 u8 minLetterSpacing; // 0x28 diff --git a/include/unk_02006D98.h b/include/unk_02006D98.h index 6b39b11ab..a54f3beba 100644 --- a/include/unk_02006D98.h +++ b/include/unk_02006D98.h @@ -63,22 +63,22 @@ struct UnkStruct_02006D98_2 { u8 unk4A; u8 unk4B; u32 unk4C; - u32 unk50_0 : 5; - u32 unk50_5 : 5; - u32 unk50_a : 5; - u32 unk50_f : 5; + u32 unk50_0 : 5; + u32 unk50_5 : 5; + u32 unk50_a : 5; + u32 unk50_f : 5; u32 unk50_14 : 5; u32 unk50_19 : 5; u32 unk50_1E : 2; - u32 unk54_0 : 1; - u32 unk54_1 : 1; - u32 unk54_2 : 5; - u32 unk54_7 : 2; - u32 unk54_9 : 1; - u32 unk54_A : 1; - u32 unk54_B : 1; - u32 unk54_C : 1; - u32 unk54_D : 4; + u32 unk54_0 : 1; + u32 unk54_1 : 1; + u32 unk54_2 : 5; + u32 unk54_7 : 2; + u32 unk54_9 : 1; + u32 unk54_A : 1; + u32 unk54_B : 1; + u32 unk54_C : 1; + u32 unk54_D : 4; u8 unk58; u8 unk59; u8 unk5A; diff --git a/include/unk_0202A1E0.h b/include/unk_0202A1E0.h index ec4858c13..bd1e674ed 100644 --- a/include/unk_0202A1E0.h +++ b/include/unk_0202A1E0.h @@ -30,9 +30,9 @@ typedef enum { struct SaveStruct23_Substruct1 { /* 0x000 */ u8 flag0 : 1; - u8 flag1 : 1; - u8 u_0_2 : 3; - u8 u_0_5 : 3; + u8 flag1 : 1; + u8 u_0_2 : 3; + u8 u_0_5 : 3; /* 0x001 */ u8 u_1; /* 0x002 */ u8 u_2; /* 0x003 */ u8 u_3; @@ -54,11 +54,11 @@ struct FrontierData { struct { /* 0x008 */ u16 flag0 : 1; - u16 flag1 : 1; - u16 flag2 : 1; - u16 flag3 : 1; - u16 flag4 : 1; - u16 filler_1 : 11; + u16 flag1 : 1; + u16 flag2 : 1; + u16 flag3 : 1; + u16 flag4 : 1; + u16 filler_1 : 11; }; /* 0x008 */ u16 flags; }; @@ -78,8 +78,8 @@ struct SaveStruct23_Substruct4_Substruct1 { /* 0x0A8 */ u8 u_A8[16]; /* 0x0B8 */ u8 filler_1[16]; /* 0x0C8 */ u8 u_C8_0 : 1; - u8 u_C8_1 : 1; - u8 filler_2 : 6; + u8 u_C8_1 : 1; + u8 filler_2 : 6; /* 0x0C8 */ u8 u_C9; /* 0x0CA */ u16 u_CA[4]; /* 0x0D2 */ u16 u_D2[4]; diff --git a/include/unk_020377F0.h b/include/unk_020377F0.h index ff4016d5e..eaddc66ab 100644 --- a/include/unk_020377F0.h +++ b/include/unk_020377F0.h @@ -35,7 +35,7 @@ enum NamingScreenType { NAMINGSCREEN_POKEMON, NAMINGSCREEN_BOX, NAMINGSCREEN_RIVAL, - NAMINGSCREEN_GROUP = 5, + NAMINGSCREEN_GROUP = 5, NAMINGSCREEN_SHAYMIN_ROCK = 6, }; diff --git a/include/unk_0205FA2C.h b/include/unk_0205FA2C.h index c0cd8e915..01ae50776 100644 --- a/include/unk_0205FA2C.h +++ b/include/unk_0205FA2C.h @@ -29,7 +29,7 @@ struct UnkPlayerStruct1_0205FA2C { u8 unk23; u32 unk24[2]; u8 unk2c[6]; - u8 unk32 : 4; + u8 unk32 : 4; u8 unk322 : 4; u8 unk33; u32 unk34[3];