From 26bf61e06fb4c29e9a297d88dbe42942ba0c96b9 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 2 Sep 2017 00:21:11 +0200 Subject: [PATCH] start decompiling sprite.s --- asm/berry_blender.s | 4 +- asm/berry_tag_screen.s | 2 +- asm/cable_car.s | 4 +- asm/clear_save_data_screen.s | 2 +- asm/contest.s | 2 +- asm/contest_link_80F57C4.s | 2 +- asm/contest_painting.s | 2 +- asm/credits.s | 6 +- asm/diploma.s | 2 +- asm/easy_chat.s | 2 +- asm/egg_hatch.s | 2 +- asm/evolution_scene.s | 6 +- asm/field_region_map.s | 2 +- asm/hall_of_fame.s | 2 +- asm/intro.s | 10 +- asm/link.s | 20 +- asm/mail.s | 2 +- asm/main_menu.s | 6 +- asm/mystery_event_menu.s | 2 +- asm/naming_screen.s | 2 +- asm/option_menu.s | 2 +- asm/pokeblock_feed.s | 4 +- asm/pokedex.s | 6 +- asm/pokedex_area_screen.s | 2 +- asm/region_map.s | 2 +- asm/reset_rtc_screen.s | 2 +- asm/reshow_battle_screen.s | 2 +- asm/rom4.s | 2 +- asm/rom6.s | 6 +- asm/rom_8034C54.s | 10 +- asm/rom_80C6FA0.s | 2 +- asm/rom_813C5BC.s | 2 +- asm/rom_8158B30.s | 8 +- asm/rom_8184DA4.s | 16 +- asm/rom_81BAD84.s | 26 +- asm/roulette.s | 4 +- asm/save_failed_screen.s | 2 +- asm/shop.s | 2 +- asm/slot_machine.s | 2 +- asm/sprite.s | 508 ----------------------------------- asm/start_menu.s | 2 +- asm/starter_choose.s | 2 +- asm/title_screen.s | 2 +- asm/trade.s | 6 +- asm/trainer_card.s | 10 +- asm/wallclock.s | 2 +- src/sprite.c | 236 ++++++++++++++++ src/text.c | 109 ++++---- sym_ewram.txt | 9 +- 49 files changed, 395 insertions(+), 675 deletions(-) diff --git a/asm/berry_blender.s b/asm/berry_blender.s index 0aa9f2ab1..a39182e88 100644 --- a/asm/berry_blender.s +++ b/asm/berry_blender.s @@ -412,7 +412,7 @@ _0807FB08: movs r0, 0 movs r1, 0 bl SetGpuReg - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0 bl SetVBlankCallback @@ -1596,7 +1596,7 @@ sub_8080588: @ 8080588 movs r0, 0 movs r1, 0 bl SetGpuReg - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks ldr r0, =sub_807F764 diff --git a/asm/berry_tag_screen.s b/asm/berry_tag_screen.s index 0886dd6c3..f9aee3455 100644 --- a/asm/berry_tag_screen.s +++ b/asm/berry_tag_screen.s @@ -130,7 +130,7 @@ _08177D2C: b _08177DDA .pool _08177D40: - bl ResetAllObjectData + bl ResetSpriteData b _08177DDC _08177D46: bl ResetObjectPaletteAllocator diff --git a/asm/cable_car.s b/asm/cable_car.s index 244b660f5..48ed673bf 100644 --- a/asm/cable_car.s +++ b/asm/cable_car.s @@ -165,7 +165,7 @@ _0814FD4E: b _08150224 .pool _0814FDD8: - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetObjectPaletteAllocator bl ResetPaletteFade @@ -664,7 +664,7 @@ _08150298: cmp r4, 0x13 bls _08150298 bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetPaletteFade movs r0, 0 bl UnsetBgTilemapBuffer diff --git a/asm/clear_save_data_screen.s b/asm/clear_save_data_screen.s index 118c6f4f7..35daffe4c 100644 --- a/asm/clear_save_data_screen.s +++ b/asm/clear_save_data_screen.s @@ -272,7 +272,7 @@ _0817AEEC: cmp r1, r2 bls _0817AEEC bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_085F06C0 diff --git a/asm/contest.s b/asm/contest.s index 25512089c..e665208f0 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -570,7 +570,7 @@ _080D7B4E: movs r1, 0x80 orrs r0, r1 strb r0, [r2, 0x8] - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 7d9d2bf23..31fb693b2 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -346,7 +346,7 @@ sub_80F5B00: @ 80F5B00 bl sub_80F57C4 bl dp12_8087EA4 bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetObjectPaletteAllocator bl sub_80F591C diff --git a/asm/contest_painting.s b/asm/contest_painting.s index 41f1cb44d..dc5b2308f 100644 --- a/asm/contest_painting.s +++ b/asm/contest_painting.s @@ -155,7 +155,7 @@ _0812FEE2: orrs r0, r7 str r0, [r1, 0x8] ldr r0, [r1, 0x8] - bl ResetAllObjectData + bl ResetSpriteData b _0812FF36 .pool _0812FF14: diff --git a/asm/credits.s b/asm/credits.s index 6197ce790..06f9007d4 100644 --- a/asm/credits.s +++ b/asm/credits.s @@ -485,7 +485,7 @@ sub_81758E4: @ 81758E4 cmp r7, 0x1 beq _081759F0 _08175906: - bl ResetAllObjectData + bl ResetSpriteData bl dp13_810BB8C bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C @@ -719,7 +719,7 @@ sub_8175B1C: @ 8175B1C movs r0, 0 movs r2, 0 bl sub_8176D1C - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0x1 negs r0, r0 @@ -2642,7 +2642,7 @@ _08176AD6: movs r0, 0x52 movs r1, 0 bl SetGpuReg - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0x1 strb r0, [r6] diff --git a/asm/diploma.s b/asm/diploma.s index 933b5cf9d..d205921d4 100644 --- a/asm/diploma.s +++ b/asm/diploma.s @@ -93,7 +93,7 @@ sub_8177888: @ 8177888 ldr r0, [r1, 0x8] bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetPaletteFade bl ResetObjectPaletteAllocator ldr r0, =gUnknown_085E7088 diff --git a/asm/easy_chat.s b/asm/easy_chat.s index bcf72cb60..09f956503 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -292,7 +292,7 @@ _0811A454: _0811A468: movs r0, 0 bl SetVBlankCallback - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetPaletteFade b _0811A4C0 diff --git a/asm/egg_hatch.s b/asm/egg_hatch.s index f7291f895..e4a29b9b0 100644 --- a/asm/egg_hatch.s +++ b/asm/egg_hatch.s @@ -599,7 +599,7 @@ _080717EC: bl DeactivateAllTextPrinters bl ResetPaletteFade bl ResetObjectPaletteAllocator - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl remove_some_task bl m4aSoundVSyncOn diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index e51edcaa0..c356a5544 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -191,7 +191,7 @@ evolution_cutscene: @ 813DA8C strb r0, [r1] bl c2_berry_program_update_menu bl sub_8035AA4 - bl ResetAllObjectData + bl ResetSpriteData bl remove_some_task bl ResetTasks bl ResetObjectPaletteAllocator @@ -484,7 +484,7 @@ sub_813DD7C: @ 813DD7C strb r0, [r1] bl c2_berry_program_update_menu bl sub_8035AA4 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C movs r0, 0x4 @@ -624,7 +624,7 @@ _0813DFE0: bl SetHBlankCallback movs r0, 0 bl SetVBlankCallback - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C movs r0, 0x4 diff --git a/asm/field_region_map.s b/asm/field_region_map.s index 2da113ebd..c9bc3d19d 100644 --- a/asm/field_region_map.s +++ b/asm/field_region_map.s @@ -59,7 +59,7 @@ sub_81701C4: @ 81701C4 movs r0, 0x1E movs r1, 0 bl SetGpuReg - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0 bl ResetBgsAndClearDma3BusyFlags diff --git a/asm/hall_of_fame.s b/asm/hall_of_fame.s index 76f9ced0f..f963aafdf 100644 --- a/asm/hall_of_fame.s +++ b/asm/hall_of_fame.s @@ -2977,7 +2977,7 @@ sub_8174F70: @ 8174F70 push {lr} bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl reset_temp_tile_data_buffers bl dp13_810BB8C bl ResetObjectPaletteAllocator diff --git a/asm/intro.s b/asm/intro.s index 893072053..4a0332162 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -186,7 +186,7 @@ _0816CCF4: bl load_copyright_graphics bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0x1 negs r0, r0 @@ -934,7 +934,7 @@ task_intro_6: @ 816D48C bl intro_reset_and_hide_bgs movs r0, 0 bl SetVBlankCallback - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =gUnknown_0203BD24 movs r1, 0 @@ -1806,7 +1806,7 @@ task_intro_10: @ 816DBAC movs r2, 0 movs r3, 0 bl sub_816F2A8 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0x1 negs r0, r0 @@ -1940,7 +1940,7 @@ task_intro_13: @ 816DD28 cmp r0, 0 bne _0816DD94 bl intro_reset_and_hide_bgs - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C movs r0, 0x8 @@ -2570,7 +2570,7 @@ task_intro_19: @ 816E2A0 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl ResetAllObjectData + bl ResetSpriteData ldr r0, =gUnknown_08D89224 movs r1, 0xC0 lsls r1, 19 diff --git a/asm/link.s b/asm/link.s index fd3b6c451..179d619f2 100644 --- a/asm/link.s +++ b/asm/link.s @@ -200,7 +200,7 @@ sub_80094EC: @ 80094EC sub_8009570: @ 8009570 push {r4,lr} sub sp, 0x4 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks ldr r0, =sub_80096BC @@ -3352,7 +3352,7 @@ c2_800ACD4: @ 800AF30 movs r1, 0xE0 lsls r1, 9 bl InitHeap - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetPaletteFadeControl movs r0, 0 @@ -16598,7 +16598,7 @@ sub_8011AE8: @ 8011AE8 thumb_func_start sub_8011AFC sub_8011AFC: @ 8011AFC push {r4,lr} - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks bl ResetPaletteFade @@ -28634,7 +28634,7 @@ _08018482: movs r0, 0 bl SetVBlankCallback bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks bl remove_some_task @@ -32618,7 +32618,7 @@ sub_801A43C: @ 801A43C bl InitWindows bl DeactivateAllTextPrinters bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl remove_some_task bl m4aSoundVSyncOn @@ -33628,7 +33628,7 @@ _0801AD4C: movs r0, 0x4 bl AllocZeroed str r0, [r4] - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks movs r0, 0 @@ -39768,7 +39768,7 @@ _0801DE74: b _0801DF04 _0801DE7A: bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl sub_801F4D0 b _0801DEBC @@ -46018,7 +46018,7 @@ _080210BE: .pool _080210E4: bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator b _080212FC _080210F2: @@ -53101,7 +53101,7 @@ _08024A16: sub_8024A1C: @ 8024A1C push {lr} bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator pop {r0} bx r0 @@ -65202,7 +65202,7 @@ _0802ACC8: _0802ACE0: movs r0, 0 bl SetVBlankCallback - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =sub_802BD84 movs r1, 0x5 diff --git a/asm/mail.s b/asm/mail.s index 72d6ae962..6280b00ed 100644 --- a/asm/mail.s +++ b/asm/mail.s @@ -227,7 +227,7 @@ _0812168E: bl ResetTasks b _081219D4 _08121694: - bl ResetAllObjectData + bl ResetSpriteData b _081219D4 _0812169A: bl ResetObjectPaletteAllocator diff --git a/asm/main_menu.s b/asm/main_menu.s index 40d4f967c..6afdd2917 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -129,7 +129,7 @@ InitMainMenu: @ 802F6F4 bl LoadPalette bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator cmp r4, 0 beq _0802F7EC @@ -1930,7 +1930,7 @@ task_new_game_prof_birch_speech_1: @ 80307B0 movs r2, 0x10 bl LoadPalette bl remove_some_task - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl dp13_810BB8C adds r0, r4, 0 @@ -3709,7 +3709,7 @@ new_game_prof_birch_speech_part2_start: @ 8031678 ldr r0, =0x0000ffc4 strh r0, [r4, 0x10] bl remove_some_task - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl dp13_810BB8C adds r0, r5, 0 diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s index dc08e6609..5e64918ed 100644 --- a/asm/mystery_event_menu.s +++ b/asm/mystery_event_menu.s @@ -36,7 +36,7 @@ _08178968: sub_8178974: @ 8178974 push {r4,lr} sub sp, 0x8 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks ldr r0, =sub_8178944 diff --git a/asm/naming_screen.s b/asm/naming_screen.s index 5e5304ff3..da6bcc04a 100644 --- a/asm/naming_screen.s +++ b/asm/naming_screen.s @@ -104,7 +104,7 @@ _080E2E58: bl ResetPaletteFade b _080E2E86 _080E2E5E: - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator b _080E2E86 _080E2E68: diff --git a/asm/option_menu.s b/asm/option_menu.s index a7bdf5771..78b4028fa 100644 --- a/asm/option_menu.s +++ b/asm/option_menu.s @@ -212,7 +212,7 @@ _080BA69C: bl ResetPaletteFade bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData ldr r1, =gMain movs r0, 0x87 lsls r0, 3 diff --git a/asm/pokeblock_feed.s b/asm/pokeblock_feed.s index f4d773ced..2f0abf868 100644 --- a/asm/pokeblock_feed.s +++ b/asm/pokeblock_feed.s @@ -84,7 +84,7 @@ _08179C20: b _08179D30 .pool _08179C34: - bl ResetAllObjectData + bl ResetSpriteData ldr r1, =gMain movs r2, 0x87 lsls r2, 3 @@ -781,7 +781,7 @@ sub_817A2C0: @ 817A2C0 ands r0, r1 cmp r0, 0 bne _0817A304 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =gMPlay_BGM ldr r1, =0x0000ffff diff --git a/asm/pokedex.s b/asm/pokedex.s index 79286c11e..8ce994a73 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -381,7 +381,7 @@ _080BB582: _080BB5FC: bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetPaletteFade bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C @@ -2136,7 +2136,7 @@ _080BC682: b _080BC838 .pool _080BC6CC: - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C movs r0, 0x8 @@ -9937,7 +9937,7 @@ _080C0A60: bne _080C0A7E movs r0, 0 bl ClearGpuRegBits - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C movs r0, 0x8 diff --git a/asm/pokedex_area_screen.s b/asm/pokedex_area_screen.s index 8a7f4ba4a..cb6c2dc6b 100644 --- a/asm/pokedex_area_screen.s +++ b/asm/pokedex_area_screen.s @@ -1287,7 +1287,7 @@ _0813D45C: .4byte _0813D544 .4byte _0813D56C _0813D48C: - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0x3 bl HideBg diff --git a/asm/region_map.s b/asm/region_map.s index 942afd04f..e18529cd5 100644 --- a/asm/region_map.s +++ b/asm/region_map.s @@ -3378,7 +3378,7 @@ _081246E4: .pool _08124754: bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl FreeSpriteTileRanges bl ResetObjectPaletteAllocator b _0812489C diff --git a/asm/reset_rtc_screen.s b/asm/reset_rtc_screen.s index a27e1f2a9..0cacd5bbd 100644 --- a/asm/reset_rtc_screen.s +++ b/asm/reset_rtc_screen.s @@ -889,7 +889,7 @@ _0809EFCA: bl LoadOamFromSprites bl remove_some_task bl dp12_8087EA4 - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetPaletteFade bl sub_809F048 diff --git a/asm/reshow_battle_screen.s b/asm/reshow_battle_screen.s index 2d1ea21ca..81a07ff43 100644 --- a/asm/reshow_battle_screen.s +++ b/asm/reshow_battle_screen.s @@ -131,7 +131,7 @@ _080A9444: bl sub_8035AA4 b _080A95D2 _080A944A: - bl ResetAllObjectData + bl ResetSpriteData b _080A95D2 _080A9450: bl ResetObjectPaletteAllocator diff --git a/asm/rom4.s b/asm/rom4.s index 8f1875206..3b6d39cbb 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -4292,7 +4292,7 @@ sub_8086988: @ 8086988 push {r4,lr} adds r4, r0, 0 bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetPaletteFade bl dp12_8087EA4 bl dp13_810BB8C diff --git a/asm/rom6.s b/asm/rom6.s index 289f5901b..57e0d3c71 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -681,7 +681,7 @@ _08135A0E: b _08135BA6 .pool _08135A30: - bl ResetAllObjectData + bl ResetSpriteData b _08135B9E _08135A36: ldr r0, =gUnknown_0203AB50 @@ -1994,7 +1994,7 @@ _0813655A: adds r1, r4, 0 bl sub_81AE6C8 bl sub_8136418 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, [r6] movs r1, 0x80 @@ -3503,7 +3503,7 @@ c2_change_map: @ 8137200 ldr r0, [r1, 0x8] bl ResetPaletteFade bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData ldr r3, =0x04000208 ldrh r2, [r3] strh r4, [r3] diff --git a/asm/rom_8034C54.s b/asm/rom_8034C54.s index 64acedc98..e7c308ca9 100644 --- a/asm/rom_8034C54.s +++ b/asm/rom_8034C54.s @@ -1275,7 +1275,7 @@ sub_80355F8: @ 80355F8 thumb_func_start sub_8035608 sub_8035608: @ 8035608 push {lr} - bl ResetAllObjectData + bl ResetSpriteData ldr r0, =gUnknown_0831AC88 movs r1, 0 movs r2, 0 @@ -3240,7 +3240,7 @@ _080368BE: _080368FE: bl c2_berry_program_update_menu bl sub_8035AA4 - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl sub_8036154 bl ResetObjectPaletteAllocator @@ -7445,7 +7445,7 @@ _08038E1A: movs r2, 0x40 bl LoadCompressedPalette bl sub_803570C - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl sub_8036154 movs r0, 0x4A @@ -7923,7 +7923,7 @@ _080392FE: adds r4, 0x1 cmp r4, 0x1 ble _080392FE - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C @@ -16426,7 +16426,7 @@ sub_803DE40: @ 803DE40 ands r0, r1 cmp r0, 0 bne _0803DE86 - bl ResetAllObjectData + bl ResetSpriteData ldr r0, =gUnknown_03005D54 ldrb r0, [r0] cmp r0, 0 diff --git a/asm/rom_80C6FA0.s b/asm/rom_80C6FA0.s index 140d82852..19580a2f0 100644 --- a/asm/rom_80C6FA0.s +++ b/asm/rom_80C6FA0.s @@ -1850,7 +1850,7 @@ sub_80C7E98: @ 80C7E98 push {r4,lr} sub sp, 0x4 bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl FreeSpriteTileRanges bl ResetObjectPaletteAllocator bl ClearDma3Requests diff --git a/asm/rom_813C5BC.s b/asm/rom_813C5BC.s index 480a421c9..7abb66627 100644 --- a/asm/rom_813C5BC.s +++ b/asm/rom_813C5BC.s @@ -281,7 +281,7 @@ sub_813C80C: @ 813C80C push {lr} bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetPaletteFade bl ResetObjectPaletteAllocator pop {r0} diff --git a/asm/rom_8158B30.s b/asm/rom_8158B30.s index af3f67692..aa9b8c9ec 100644 --- a/asm/rom_8158B30.s +++ b/asm/rom_8158B30.s @@ -15155,7 +15155,7 @@ _08160688: thumb_func_start sub_81606A0 sub_81606A0: @ 81606A0 push {r4-r6,lr} - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks bl clear_scheduled_bg_copies_to_vram @@ -15209,7 +15209,7 @@ sub_81606A0: @ 81606A0 thumb_func_start sub_8160740 sub_8160740: @ 8160740 push {r4,r5,lr} - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks bl clear_scheduled_bg_copies_to_vram @@ -16000,7 +16000,7 @@ sub_8160EA0: @ 8160EA0 bl Free movs r0, 0 str r0, [r4] - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator pop {r4} pop {r0} @@ -26005,7 +26005,7 @@ _081663E8: b _0816653C .pool _0816640C: - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator b _0816653C _08166416: diff --git a/asm/rom_8184DA4.s b/asm/rom_8184DA4.s index 760753619..0e2ce0c7a 100644 --- a/asm/rom_8184DA4.s +++ b/asm/rom_8184DA4.s @@ -21261,7 +21261,7 @@ _08190508: movs r1, 0x3F bl SetGpuReg bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C movs r0, 0x4 @@ -28491,7 +28491,7 @@ _0819431C: movs r1, 0x3F bl SetGpuReg bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gTasks mov r3, r8 @@ -40888,7 +40888,7 @@ _0819A5C0: .pool _0819A69C: bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetObjectPaletteAllocator ldr r0, =gUnknown_08DC0754 @@ -47344,7 +47344,7 @@ _0819DCD4: .pool _0819DDA8: bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetObjectPaletteAllocator bl dp13_810BB8C @@ -72397,7 +72397,7 @@ _081AAE56: b _081AB01A .pool _081AAE78: - bl ResetAllObjectData + bl ResetSpriteData b _081AB012 _081AAE7E: movs r0, 0x87 @@ -73639,7 +73639,7 @@ _081AB984: bl SetMainCallback2 _081AB98A: bl sub_81AB824 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl free_bag_item_list_buffers adds r0, r5, 0 @@ -82414,7 +82414,7 @@ _081B02B2: b _081B048C .pool _081B02D4: - bl ResetAllObjectData + bl ResetSpriteData b _081B0484 _081B02DA: bl ResetObjectPaletteAllocator @@ -84392,7 +84392,7 @@ _081B1338: ldr r0, [r4] bl SetMainCallback2 _081B133E: - bl ResetAllObjectData + bl ResetSpriteData bl sub_81B06F4 adds r0, r5, 0 bl DestroyTask diff --git a/asm/rom_81BAD84.s b/asm/rom_81BAD84.s index 094a3fa71..c5df9bced 100644 --- a/asm/rom_81BAD84.s +++ b/asm/rom_81BAD84.s @@ -7979,7 +7979,7 @@ sub_81BF384: @ 81BF384 bl m4aSoundVSyncOff movs r0, 0 bl SetVBlankCallback - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl remove_some_task movs r0, 0 @@ -8869,7 +8869,7 @@ _081BFBBC: b _081BFDE4 .pool _081BFBD0: - bl ResetAllObjectData + bl ResetSpriteData ldr r1, =gMain movs r0, 0x87 lsls r0, 3 @@ -9824,7 +9824,7 @@ sub_81C0484: @ 81C0484 ldrb r0, [r0] strb r0, [r1] bl sub_81C4898 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl sub_80A369C ldr r0, =gMPlay_BGM @@ -18627,7 +18627,7 @@ _081C50FA: b _081C51A0 .pool _081C510C: - bl ResetAllObjectData + bl ResetSpriteData b _081C51A2 _081C5112: bl sub_81221AC @@ -19859,7 +19859,7 @@ _081C5B94: bl SetMainCallback2 _081C5B9E: bl sub_81C56CC - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl FreeAllWindowBuffers ldr r0, =gUnknown_0203CF2C @@ -22520,7 +22520,7 @@ _081C72F0: movs r0, 0x1 strh r0, [r1, 0x8] bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator movs r0, 0 bl SetVBlankCallback @@ -23019,7 +23019,7 @@ sub_81C76C4: @ 81C76C4 adds r4, r0, 0 cmp r4, 0 beq _081C76F4 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =sub_81C7764 movs r1, 0x1 @@ -53538,7 +53538,7 @@ sub_81D6774: @ 81D6774 bl remove_some_task bl ResetObjectPaletteAllocator bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks movs r0, 0 movs r1, 0xF0 @@ -53595,7 +53595,7 @@ sub_81D6800: @ 81D6800 ands r0, r1 cmp r0, 0 bne _081D6830 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r4, =gUnknown_0203CF60 ldr r0, [r4] @@ -55265,7 +55265,7 @@ sub_81D7600: @ 81D7600 movs r0, 0 bl SetVBlankCallback bl remove_some_task - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator strh r4, [r5] adds r0, r7, 0 @@ -56629,7 +56629,7 @@ sub_81D8164: @ 81D8164 bne _081D8192 movs r0, 0 bl SetVBlankCallback - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =gTasks lsls r1, r4, 2 @@ -57191,7 +57191,7 @@ sub_81D8684: @ 81D8684 bl SetVBlankCallback movs r0, 0 bl SetHBlankCallback - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =gTasks lsls r1, r4, 2 @@ -58291,7 +58291,7 @@ sub_81D9034: @ 81D9034 movs r0, 0 bl SetVBlankCallback bl sub_81D6904 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldrb r0, [r4, 0x4] bl DestroyTask diff --git a/asm/roulette.s b/asm/roulette.s index 4c246b9cd..900c8bb1a 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -442,7 +442,7 @@ _08140630: .pool _08140650: bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl reset_temp_tile_data_buffers b _081407F8 @@ -3271,7 +3271,7 @@ sub_8141E7C: @ 8141E7C bl SetGpuReg bl ResetObjectPaletteAllocator bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl sub_8140418 ldr r1, =gUnknown_03005DAC ldr r0, =sub_80AF168 diff --git a/asm/save_failed_screen.s b/asm/save_failed_screen.s index e250a938c..2c23435d4 100644 --- a/asm/save_failed_screen.s +++ b/asm/save_failed_screen.s @@ -226,7 +226,7 @@ _08178FF8: adds r2, r5, 0 bl SetWindowAttribute bl DeactivateAllTextPrinters - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetPaletteFade ldr r0, =gUnknown_085B0A00 diff --git a/asm/shop.s b/asm/shop.s index b7e24d7b7..5d6c9aa01 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -452,7 +452,7 @@ _080DFE20: bl reset_temp_tile_data_buffers bl ResetObjectPaletteAllocator bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl clear_scheduled_bg_copies_to_vram ldr r4, =gUnknown_02039F70 diff --git a/asm/slot_machine.s b/asm/slot_machine.s index 9d1c355b8..e05d5d9d7 100644 --- a/asm/slot_machine.s +++ b/asm/slot_machine.s @@ -569,7 +569,7 @@ _0812A934: sub_812A9AC: @ 812A9AC push {lr} bl ResetPaletteFade - bl ResetAllObjectData + bl ResetSpriteData ldr r1, =gOamLimit movs r0, 0x80 strb r0, [r1] diff --git a/asm/sprite.s b/asm/sprite.s index 88e97f1ca..278c0ed17 100644 --- a/asm/sprite.s +++ b/asm/sprite.s @@ -5,514 +5,6 @@ .text - thumb_func_start ResetAllObjectData -@ void ResetAllObjectData() -ResetAllObjectData: @ 8006974 - push {r4,lr} - movs r0, 0 - movs r1, 0x80 - bl ResetOamRange - bl ResetAllSprites - bl ClearSpriteCopyRequests - bl ResetAffineAnimData - bl FreeSpriteTileRanges - ldr r1, =gOamLimit - movs r0, 0x40 - strb r0, [r1] - ldr r0, =gReservedSpriteTileCount - movs r4, 0 - strh r4, [r0] - movs r0, 0 - bl AllocSpriteTiles - ldr r0, =gSpriteCoordOffsetX - strh r4, [r0] - ldr r0, =gSpriteCoordOffsetY - strh r4, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ResetAllObjectData - - thumb_func_start AnimateSprites -@ void AnimateSprites() -AnimateSprites: @ 80069C0 - push {r4-r7,lr} - movs r6, 0 - movs r7, 0x1 -_080069C6: - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - adds r5, r4, 0 - adds r5, 0x3E - ldrb r1, [r5] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _080069F6 - ldr r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - ldrb r1, [r5] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _080069F6 - adds r0, r4, 0 - bl AnimateSprite -_080069F6: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3F - bls _080069C6 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end AnimateSprites - - thumb_func_start BuildOamBuffer -@ void BuildOamBuffer() -BuildOamBuffer: @ 8006A0C - push {r4,r5,lr} - bl UpdateOamCoords - bl BuildSpritePriorities - bl SortSprites - ldr r5, =gMain - ldr r0, =0x00000439 - adds r5, r0 - ldrb r0, [r5] - lsls r4, r0, 31 - lsrs r4, 31 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r5] - bl AddSpritesToOamBuffer - bl CopyMatricesToOamBuffer - movs r2, 0x1 - ldrb r1, [r5] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - orrs r4, r0 - strb r4, [r5] - ldr r0, =gShouldProcessSpriteCopyRequests - strb r2, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end BuildOamBuffer - - thumb_func_start UpdateOamCoords -@ void UpdateOamCoords() -UpdateOamCoords: @ 8006A58 - push {r4-r7,lr} - movs r4, 0 - ldr r7, =gSprites - ldr r0, =0x000001ff - adds r5, r0, 0 - ldr r6, =0xfffffe00 -_08006A64: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r3, r0, r7 - adds r0, r3, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x5 - ands r0, r1 - cmp r0, 0x1 - bne _08006B0A - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08006AD8 - movs r2, 0x20 - ldrsh r1, [r3, r2] - movs r2, 0x24 - ldrsh r0, [r3, r2] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r1, r0 - ldr r0, =gSpriteCoordOffsetX - movs r2, 0 - ldrsh r0, [r0, r2] - adds r1, r0 - ands r1, r5 - ldrh r2, [r3, 0x2] - adds r0, r6, 0 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x2] - ldrh r1, [r3, 0x26] - ldrh r0, [r3, 0x22] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x29 - ldrb r0, [r0] - ldr r2, =gSpriteCoordOffsetY - adds r0, r1 - ldrb r2, [r2] - adds r0, r2 - b _08006B08 - .pool -_08006AD8: - movs r2, 0x20 - ldrsh r1, [r3, r2] - movs r2, 0x24 - ldrsh r0, [r3, r2] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x28 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r1, r0 - ands r1, r5 - ldrh r2, [r3, 0x2] - adds r0, r6, 0 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x2] - ldrh r1, [r3, 0x26] - ldrh r0, [r3, 0x22] - adds r1, r0 - adds r0, r3, 0 - adds r0, 0x29 - ldrb r0, [r0] - adds r0, r1 -_08006B08: - strb r0, [r3] -_08006B0A: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3F - bls _08006A64 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end UpdateOamCoords - - thumb_func_start BuildSpritePriorities -@ void BuildSpritePriorities() -BuildSpritePriorities: @ 8006B1C - push {r4,lr} - movs r2, 0 - ldr r4, =gSprites - ldr r3, =gSpritePriorities -_08006B24: - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r4 - adds r1, r0, 0 - adds r1, 0x43 - ldrb r1, [r1] - ldrb r0, [r0, 0x5] - lsls r0, 28 - lsrs r0, 30 - lsls r0, 8 - orrs r1, r0 - lsls r0, r2, 1 - adds r0, r3 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x3F - bls _08006B24 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end BuildSpritePriorities - - thumb_func_start SortSprites -@ void SortSprites() -SortSprites: @ 8006B5C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r0, 0x1 - mov r12, r0 - ldr r1, =gSpriteOrder - mov r10, r1 - ldr r3, =0xffffff00 - mov r9, r3 - ldr r6, =0xc0000300 - mov r8, r6 -_08006B78: - mov r5, r12 - mov r0, r12 - subs r0, 0x1 - add r0, r10 - ldrb r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r7, =gSprites - adds r3, r0, r7 - mov r0, r12 - add r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r7 - lsls r2, 1 - ldr r0, =gSpritePriorities - adds r2, r0 - ldrh r2, [r2] - str r2, [sp] - lsls r1, 1 - adds r1, r0 - ldrh r6, [r1] - ldrb r1, [r3] - ldrb r2, [r4] - adds r0, r1, 0 - cmp r0, 0x9F - ble _08006BBA - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006BBA: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x9F - ble _08006BC8 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006BC8: - ldr r0, [r3] - mov r7, r8 - ands r0, r7 - cmp r0, r8 - bne _08006BEC - ldrb r0, [r3, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006BDE - cmp r0, 0x2 - bne _08006BEC -_08006BDE: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006BEC - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006BEC: - ldr r0, [r4] - mov r3, r8 - ands r0, r3 - cmp r0, r8 - bne _08006C10 - ldrb r0, [r4, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006C02 - cmp r0, 0x2 - bne _08006C10 -_08006C02: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006C10 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006C10: - movs r7, 0x1 - add r12, r7 - cmp r5, 0 - beq _08006CF6 - ldr r0, [sp] - cmp r0, r6 - bhi _08006C38 - cmp r0, r6 - bne _08006CF6 - b _08006CEE - .pool -_08006C38: - mov r1, r10 - adds r3, r5, r1 - ldrb r4, [r3] - subs r2, r5, 0x1 - adds r1, r2, r1 - ldrb r0, [r1] - strb r0, [r3] - strb r4, [r1] - lsls r2, 24 - lsrs r5, r2, 24 - subs r0, r5, 0x1 - add r0, r10 - ldrb r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r6, =gSprites - adds r3, r0, r6 - mov r7, r10 - adds r0, r5, r7 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r0, r6 - lsls r2, 1 - ldr r0, =gSpritePriorities - adds r2, r0 - ldrh r2, [r2] - str r2, [sp] - lsls r1, 1 - adds r1, r0 - ldrh r6, [r1] - ldrb r1, [r3] - ldrb r2, [r4] - adds r0, r1, 0 - cmp r0, 0x9F - ble _08006C8A - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006C8A: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x9F - ble _08006C98 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006C98: - ldr r0, [r3] - mov r7, r8 - ands r0, r7 - cmp r0, r8 - bne _08006CBC - ldrb r0, [r3, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006CAE - cmp r0, 0x2 - bne _08006CBC -_08006CAE: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006CBC - add r0, r9 - lsls r0, 16 - lsrs r1, r0, 16 -_08006CBC: - ldr r0, [r4] - mov r3, r8 - ands r0, r3 - cmp r0, r8 - bne _08006CE0 - ldrb r0, [r4, 0x1] - lsrs r0, 6 - cmp r0, 0 - beq _08006CD2 - cmp r0, 0x2 - bne _08006CE0 -_08006CD2: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x80 - ble _08006CE0 - add r0, r9 - lsls r0, 16 - lsrs r2, r0, 16 -_08006CE0: - cmp r5, 0 - beq _08006CF6 - ldr r7, [sp] - cmp r7, r6 - bhi _08006C38 - cmp r7, r6 - bne _08006CF6 -_08006CEE: - lsls r1, 16 - lsls r0, r2, 16 - cmp r1, r0 - blt _08006C38 -_08006CF6: - mov r1, r12 - lsls r0, r1, 24 - lsrs r0, 24 - mov r12, r0 - cmp r0, 0x3F - bhi _08006D04 - b _08006B78 -_08006D04: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end SortSprites - - thumb_func_start CopyMatricesToOamBuffer -@ void CopyMatricesToOamBuffer() -CopyMatricesToOamBuffer: @ 8006D1C - push {r4-r6,lr} - movs r4, 0 - ldr r5, =gMain - ldr r6, =gOamMatrices -_08006D24: - lsls r2, r4, 2 - lsls r1, r4, 5 - adds r1, r5 - lsls r3, r4, 3 - adds r3, r6 - ldrh r0, [r3] - strh r0, [r1, 0x3E] - adds r0, r2, 0x1 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r3, 0x2] - strh r1, [r0, 0x3E] - adds r0, r2, 0x2 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r3, 0x4] - strh r1, [r0, 0x3E] - adds r2, 0x3 - lsls r2, 3 - adds r2, r5 - ldrh r0, [r3, 0x6] - strh r0, [r2, 0x3E] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1F - bls _08006D24 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end CopyMatricesToOamBuffer - thumb_func_start AddSpritesToOamBuffer @ void AddSpritesToOamBuffer() AddSpritesToOamBuffer: @ 8006D68 diff --git a/asm/start_menu.s b/asm/start_menu.s index 059d23ef8..298ebced5 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -1938,7 +1938,7 @@ _080A045A: b _080A04FC .pool _080A0490: - bl ResetAllObjectData + bl ResetSpriteData bl ResetTasks bl ResetPaletteFade bl dp12_8087EA4 diff --git a/asm/starter_choose.s b/asm/starter_choose.s index 20430db5c..1841a8acc 100644 --- a/asm/starter_choose.s +++ b/asm/starter_choose.s @@ -147,7 +147,7 @@ set_256color_bg_bg0: @ 8133F0C bl clear_scheduled_bg_copies_to_vram bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetPaletteFade bl ResetObjectPaletteAllocator bl dp13_810BB8C diff --git a/asm/title_screen.s b/asm/title_screen.s index 38e5848b8..f8bc69e97 100644 --- a/asm/title_screen.s +++ b/asm/title_screen.s @@ -616,7 +616,7 @@ _080AA8C4: bl LZ77UnCompVram bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r1, =gUnknown_0300301C movs r0, 0x9 diff --git a/asm/trade.s b/asm/trade.s index b084ff084..8892f1b8a 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -175,7 +175,7 @@ sub_8077294: @ 8077294 sub_80772A4: @ 80772A4 push {r4,r5,lr} sub sp, 0xC - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetTasks bl ResetPaletteFade @@ -7272,7 +7272,7 @@ _0807AEC0: str r0, [r4] bl init_uns_table_pokemon_copy bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =sub_807AC24 bl SetVBlankCallback @@ -7731,7 +7731,7 @@ _0807B2D0: str r0, [r4] bl init_uns_table_pokemon_copy bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator ldr r0, =sub_807AC24 bl SetVBlankCallback diff --git a/asm/trainer_card.s b/asm/trainer_card.s index 6a1ed00f1..345ed8beb 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -727,7 +727,7 @@ _080C2D36: b _080C2DCC .pool _080C2D50: - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetPaletteFade ldr r1, =gMain @@ -5320,7 +5320,7 @@ _080C54EE: b _080C56F4 _080C54F4: bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetPaletteFade bl reset_temp_tile_data_buffers @@ -5603,7 +5603,7 @@ _080C57A6: _080C57AC: bl sub_80C50D0 bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator b _080C57E4 _080C57BE: @@ -7196,7 +7196,7 @@ _080C6520: bl sub_80C50D0 b _080C6694 _080C6526: - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator bl ResetPaletteFade bl reset_temp_tile_data_buffers @@ -7434,7 +7434,7 @@ _080C676A: .pool _080C6774: bl sub_80C50D0 - bl ResetAllObjectData + bl ResetSpriteData bl ResetObjectPaletteAllocator b _080C67A4 _080C6782: diff --git a/asm/wallclock.s b/asm/wallclock.s index c2ffaeed7..816954e2f 100644 --- a/asm/wallclock.s +++ b/asm/wallclock.s @@ -178,7 +178,7 @@ _08134906: bl clear_scheduled_bg_copies_to_vram bl remove_some_task bl ResetTasks - bl ResetAllObjectData + bl ResetSpriteData bl ResetPaletteFade bl ResetObjectPaletteAllocator ldr r0, =gUnknown_085B2208 diff --git a/src/sprite.c b/src/sprite.c index 3b73363ac..245dc2660 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -1,5 +1,6 @@ #include "global.h" #include "sprite.h" +#include "main.h" #define OAM_MATRIX_COUNT 32 @@ -10,6 +11,56 @@ struct SpriteCopyRequest u16 size; }; +// this file's functions +void UpdateOamCoords(void); +void BuildSpritePriorities(void); +void SortSprites(void); +void CopyMatricesToOamBuffer(void); +void AddSpritesToOamBuffer(void); +u8 CreateSpriteAt(u8 index, const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority); +void ClearSpriteCopyRequests(void); +void ResetOamMatrices(void); +void ResetSprite(struct Sprite *sprite); +s16 AllocSpriteTiles(u16 tileCount); +void RequestSpriteFrameImageCopy(u16 index, u16 tileNum, const struct SpriteFrameImage *images); +void ResetAllSprites(void); +void BeginAnim(struct Sprite *sprite); +void ContinueAnim(struct Sprite *sprite); +void AnimCmd_frame(struct Sprite *sprite); +void AnimCmd_end(struct Sprite *sprite); +void AnimCmd_jump(struct Sprite *sprite); +void AnimCmd_loop(struct Sprite *sprite); +void BeginAnimLoop(struct Sprite *sprite); +void ContinueAnimLoop(struct Sprite *sprite); +void JumpToTopOfAnimLoop(struct Sprite *sprite); +void BeginAffineAnim(struct Sprite *sprite); +void ContinueAffineAnim(struct Sprite *sprite); +void AffineAnimDelay(u8 matrixNum, struct Sprite *sprite); +void AffineAnimCmd_loop(u8 matrixNum, struct Sprite *sprite); +void BeginAffineAnimLoop(u8 matrixNum, struct Sprite *sprite); +void ContinueAffineAnimLoop(u8 matrixNum, struct Sprite *sprite); +void JumpToTopOfAffineAnimLoop(u8 matrixNum, struct Sprite *sprite); +void AffineAnimCmd_jump(u8 matrixNum, struct Sprite *sprite); +void AffineAnimCmd_end(u8 matrixNum, struct Sprite *sprite); +void AffineAnimCmd_frame(u8 matrixNum, struct Sprite *sprite); +void CopyOamMatrix(u8 destMatrixIndex, struct OamMatrix *srcMatrix); +u8 GetSpriteMatrixNum(struct Sprite *sprite); +void SetSpriteOamFlipBits(struct Sprite *sprite, u8 hFlip, u8 vFlip); +void AffineAnimStateRestartAnim(u8 matrixNum); +void AffineAnimStateStartAnim(u8 matrixNum, u8 animNum); +void AffineAnimStateReset(u8 matrixNum); +void ApplyAffineAnimFrameAbsolute(u8 matrixNum, struct AffineAnimFrameCmd *frameCmd); +void DecrementAnimDelayCounter(struct Sprite *sprite); +bool8 DecrementAffineAnimDelayCounter(struct Sprite *sprite, u8 matrixNum); +void ApplyAffineAnimFrameRelativeAndUpdateMatrix(u8 matrixNum, struct AffineAnimFrameCmd *frameCmd); +s16 ConvertScaleParam(s16 scale); +void GetAffineAnimFrame(u8 matrixNum, struct Sprite *sprite, struct AffineAnimFrameCmd *frameCmd); +void ApplyAffineAnimFrame(u8 matrixNum, struct AffineAnimFrameCmd *frameCmd); +void ResetAffineAnimData(void); +u8 IndexOfSpriteTileTag(u16 tag); +void AllocSpriteTileRange(u16 tag, u16 start, u16 count); +void DoLoadSpritePalette(const u16 *src, u16 paletteOffset); + EWRAM_DATA struct Sprite gSprites[MAX_SPRITES + 1] = {0}; EWRAM_DATA u16 gSpritePriorities[MAX_SPRITES] = {0}; EWRAM_DATA u8 gSpriteOrder[MAX_SPRITES] = {0}; @@ -23,3 +74,188 @@ EWRAM_DATA s16 gSpriteCoordOffsetX = 0; EWRAM_DATA s16 gSpriteCoordOffsetY = 0; EWRAM_DATA struct OamMatrix gOamMatrices[OAM_MATRIX_COUNT] = {0}; EWRAM_DATA bool8 gAffineAnimsDisabled = 0; + +void ResetSpriteData(void) +{ + ResetOamRange(0, 128); + ResetAllSprites(); + ClearSpriteCopyRequests(); + ResetAffineAnimData(); + FreeSpriteTileRanges(); + gOamLimit = 64; + gReservedSpriteTileCount = 0; + AllocSpriteTiles(0); + gSpriteCoordOffsetX = 0; + gSpriteCoordOffsetY = 0; +} + +void AnimateSprites(void) +{ + u8 i; + for (i = 0; i < MAX_SPRITES; i++) + { + struct Sprite *sprite = &gSprites[i]; + + if (sprite->inUse) + { + sprite->callback(sprite); + + if (sprite->inUse) + AnimateSprite(sprite); + } + } +} + +void BuildOamBuffer(void) +{ + u8 temp; + UpdateOamCoords(); + BuildSpritePriorities(); + SortSprites(); + temp = gMain.oamLoadDisabled; + gMain.oamLoadDisabled = TRUE; + AddSpritesToOamBuffer(); + CopyMatricesToOamBuffer(); + gMain.oamLoadDisabled = temp; + gShouldProcessSpriteCopyRequests = TRUE; +} + +void UpdateOamCoords(void) +{ + u8 i; + for (i = 0; i < MAX_SPRITES; i++) + { + struct Sprite *sprite = &gSprites[i]; + if (sprite->inUse && !sprite->invisible) + { + if (sprite->coordOffsetEnabled) + { + sprite->oam.x = sprite->pos1.x + sprite->pos2.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX; + sprite->oam.y = sprite->pos1.y + sprite->pos2.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY; + } + else + { + sprite->oam.x = sprite->pos1.x + sprite->pos2.x + sprite->centerToCornerVecX; + sprite->oam.y = sprite->pos1.y + sprite->pos2.y + sprite->centerToCornerVecY; + } + } + } +} + +void BuildSpritePriorities(void) +{ + u16 i; + for (i = 0; i < MAX_SPRITES; i++) + { + struct Sprite *sprite = &gSprites[i]; + u16 priority = sprite->subpriority | (sprite->oam.priority << 8); + gSpritePriorities[i] = priority; + } +} + +void SortSprites(void) +{ + u8 i; + for (i = 1; i < MAX_SPRITES; i++) + { + u8 j = i; + struct Sprite *sprite1 = &gSprites[gSpriteOrder[i - 1]]; + struct Sprite *sprite2 = &gSprites[gSpriteOrder[i]]; + u16 sprite1Priority = gSpritePriorities[gSpriteOrder[i - 1]]; + u16 sprite2Priority = gSpritePriorities[gSpriteOrder[i]]; + s16 sprite1Y = sprite1->oam.y; + s16 sprite2Y = sprite2->oam.y; + + if (sprite1Y >= DISPLAY_HEIGHT) + sprite1Y = sprite1Y - 256; + + if (sprite2Y >= DISPLAY_HEIGHT) + sprite2Y = sprite2Y - 256; + + if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite1->oam.size == 3) + { + u32 shape = sprite1->oam.shape; + if (shape == ST_OAM_SQUARE || shape == 2) + { + if (sprite1Y > 128) + sprite1Y = sprite1Y - 256; + } + } + + if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite2->oam.size == 3) + { + u32 shape = sprite2->oam.shape; + if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) + { + if (sprite2Y > 128) + sprite2Y = sprite2Y - 256; + } + } + + while (j > 0 + && ((sprite1Priority > sprite2Priority) + || (sprite1Priority == sprite2Priority && sprite1Y < sprite2Y))) + { + u8 temp = gSpriteOrder[j]; + gSpriteOrder[j] = gSpriteOrder[j - 1]; + gSpriteOrder[j - 1] = temp; + + // UB: If j equals 1, then j-- makes j equal 0. + // Then, gSpriteOrder[-1] gets accessed below. + // Although this doesn't result in a bug in the ROM, + // the behavior is undefined. + j--; + + sprite1 = &gSprites[gSpriteOrder[j - 1]]; + sprite2 = &gSprites[gSpriteOrder[j]]; + sprite1Priority = gSpritePriorities[gSpriteOrder[j - 1]]; + sprite2Priority = gSpritePriorities[gSpriteOrder[j]]; + sprite1Y = sprite1->oam.y; + sprite2Y = sprite2->oam.y; + + if (sprite1Y >= DISPLAY_HEIGHT) + sprite1Y = sprite1Y - 256; + + if (sprite2Y >= DISPLAY_HEIGHT) + sprite2Y = sprite2Y - 256; + + if (sprite1->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite1->oam.size == 3) + { + u32 shape = sprite1->oam.shape; + if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) + { + if (sprite1Y > 128) + sprite1Y = sprite1Y - 256; + } + } + + if (sprite2->oam.affineMode == ST_OAM_AFFINE_DOUBLE + && sprite2->oam.size == 3) + { + u32 shape = sprite2->oam.shape; + if (shape == ST_OAM_SQUARE || shape == ST_OAM_V_RECTANGLE) + { + if (sprite2Y > 128) + sprite2Y = sprite2Y - 256; + } + } + } + } +} + +void CopyMatricesToOamBuffer(void) +{ + u8 i; + for (i = 0; i < OAM_MATRIX_COUNT; i++) + { + u32 base = 4 * i; + gMain.oamBuffer[base + 0].affineParam = gOamMatrices[i].a; + gMain.oamBuffer[base + 1].affineParam = gOamMatrices[i].b; + gMain.oamBuffer[base + 2].affineParam = gOamMatrices[i].c; + gMain.oamBuffer[base + 3].affineParam = gOamMatrices[i].d; + } +} + diff --git a/src/text.c b/src/text.c index 6981b9370..a984e9a54 100644 --- a/src/text.c +++ b/src/text.c @@ -15,9 +15,8 @@ extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese); extern void audio_play(u16 songNum); extern u8* sub_81AFC74(u8 a1); -extern struct Window gWindows[20]; -EWRAM_DATA struct TextPrinter gTempTextPrinter = {}; -EWRAM_DATA struct TextPrinter gTextPrinters[NUM_TEXT_PRINTERS] = {}; +EWRAM_DATA struct TextPrinter gTempTextPrinter = {0}; +EWRAM_DATA struct TextPrinter gTextPrinters[NUM_TEXT_PRINTERS] = {0}; static u16 gFontHalfRowLookupTable[0x51]; static u16 gLastTextBgColor; @@ -177,18 +176,18 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca if (!gFonts) return FALSE; - + gTempTextPrinter.sub_union.sub.active = 1; gTempTextPrinter.state = 0; gTempTextPrinter.text_speed = speed; gTempTextPrinter.delayCounter = 0; gTempTextPrinter.scrollDistance = 0; - + for (i = 0; i < 7; ++i) { gTempTextPrinter.sub_union.sub_fields[i] = 0; } - + gTempTextPrinter.subPrinter = *textSubPrinter; gTempTextPrinter.callback = callback; gTempTextPrinter.minLetterSpacing = 0; @@ -208,7 +207,7 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca if ((u32)RenderFont(&gTempTextPrinter) == 1) break; } - + if (speed != 0xFF) CopyWindowToVram(gTempTextPrinter.subPrinter.windowId, 2); gTextPrinters[textSubPrinter->windowId].sub_union.sub.active = 0; @@ -266,11 +265,11 @@ u32 RenderFont(struct TextPrinter *textPrinter) void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) { u16* current = gFontHalfRowLookupTable; - + gLastTextBgColor = bgColor; gLastTextFgColor = fgColor; gLastTextShadowColor = shadowColor; - + *(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor; *(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor; *(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor; @@ -857,7 +856,7 @@ void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor) void DecompressGlyphTile(const u16 *src, u16 *dest) { u32 temp; - + temp = src[0]; *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]; temp = src[1]; @@ -1773,10 +1772,10 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width) pixels_data.pixels = window->tileData; pixels_data.width = window->window.width << 3; pixels_data.height = window->window.height << 3; - + gUnk = gUnknown_03002F90; glyphHeight = &gUnk[0x81]; - + FillBitmapRect4Bit( &pixels_data, textPrinter->subPrinter.currentX, @@ -1790,7 +1789,7 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width) u16 Font0Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 0; @@ -1802,7 +1801,7 @@ u16 Font0Func(struct TextPrinter *textPrinter) u16 Font1Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 1; @@ -1814,7 +1813,7 @@ u16 Font1Func(struct TextPrinter *textPrinter) u16 Font2Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 2; @@ -1826,7 +1825,7 @@ u16 Font2Func(struct TextPrinter *textPrinter) u16 Font3Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 3; @@ -1838,7 +1837,7 @@ u16 Font3Func(struct TextPrinter *textPrinter) u16 Font4Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 4; @@ -1850,7 +1849,7 @@ u16 Font4Func(struct TextPrinter *textPrinter) u16 Font5Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 5; @@ -1862,7 +1861,7 @@ u16 Font5Func(struct TextPrinter *textPrinter) u16 Font7Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 7; @@ -1874,7 +1873,7 @@ u16 Font7Func(struct TextPrinter *textPrinter) u16 Font8Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->field_1_top == 0) { textPrinter->sub_union.sub.font_type = 8; @@ -1886,7 +1885,7 @@ u16 Font8Func(struct TextPrinter *textPrinter) void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (gTextFlags.flag_2 == 1) subStruct->frames_visible_counter = 0; else @@ -1916,7 +1915,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) textPrinter->subPrinter.currentY, 0x8, 0x10); - + switch (gTextFlags.flag_1) { case 0: @@ -1927,7 +1926,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) arrowTiles = gDarkDownArrowTiles; break; } - + BlitBitmapRectToWindow( textPrinter->subPrinter.windowId, arrowTiles, @@ -1940,7 +1939,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) 0x8, 0x10); CopyWindowToVram(textPrinter->subPrinter.windowId, 0x2); - + subStruct->field_1 = 0x8; subStruct->field_1_upmid = (*(u32*)subStruct << 17 >> 30) + 1; } @@ -1962,7 +1961,7 @@ void TextPrinterClearDownArrow(struct TextPrinter *textPrinter) bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; - + if (subStruct->frames_visible_counter == 49) { return TRUE; @@ -2014,7 +2013,7 @@ bool8 TextPrinterWait(struct TextPrinter *textPrinter) void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex) { const u8 *arrowTiles; - + if (*counter != 0) { --*counter; @@ -2034,7 +2033,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c arrowTiles = gDarkDownArrowTiles; break; } - + BlitBitmapRectToWindow( windowId, arrowTiles, @@ -2800,7 +2799,7 @@ u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing) line = 0; strLocal = str; strPos = 0; - + do { temp = strLocal[strPos++]; @@ -2861,26 +2860,26 @@ u32 GetStringWidthFixedWidthFont(u8 *str, u8 fontId, u8 letterSpacing) break; } } while (temp != 0xFF); - + for (width = 0, strPos = 0; strPos < 8; ++strPos) { if (width < lineWidths[strPos]) width = lineWidths[strPos]; } - + return (u8)(GetFontAttribute(fontId, 0) + letterSpacing) * width; } u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32) { u32 i; - + for (i = 0; i < 9; ++i) { if (glyphId == gGlyphWidthFuncs[i].font_id) return gGlyphWidthFuncs[i].func; } - + return 0; } @@ -2898,20 +2897,20 @@ s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing) isJapanese = 0; minGlyphWidth = 0; - + func = GetFontWidthFunc(fontId); if (func == NULL) return 0; - + if (letterSpacing == -1) localLetterSpacing = GetFontAttribute(fontId, 2); else localLetterSpacing = letterSpacing; - + width = 0; lineWidth = 0; bufferPointer = 0; - + while (*str != 0xFF) { switch (*str) @@ -3016,7 +3015,7 @@ s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing) glyphWidth = func(*++str | 0x100, isJapanese); else glyphWidth = GetKeypadIconWidth(*++str); - + if (minGlyphWidth > 0) { if (glyphWidth < minGlyphWidth) @@ -3051,7 +3050,7 @@ s32 GetStringWidth(u8 fontId, u8 *str, s16 letterSpacing) } ++str; } - + if (lineWidth > width) return lineWidth; return width; @@ -3069,15 +3068,15 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) u8 bgColor; SaveTextColors(&colorBackup[0], &colorBackup[1], &colorBackup[2]); - + fgColor = 1; bgColor = 0; shadowColor = 3; - + GenerateFontHalfRowLookupTable(1, 0, 3); strLocal = str; strPos = 0; - + do { temp = strLocal[strPos++]; @@ -3154,7 +3153,7 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) DecompressGlyphFont1(temp, 1); break; } - + CpuCopy32(gUnknown_03002F90, pixels, 0x20); CpuCopy32(gUnknown_03002F90 + 0x40, pixels + 0x20, 0x20); pixels += 0x40; @@ -3162,7 +3161,7 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) } } while (temp != 0xFF); - + RestoreTextColors(&colorBackup[0], &colorBackup[1], &colorBackup[2]); return 1; } @@ -3257,7 +3256,7 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) { glyphs = gFont0LatinGlyphs + (0x20 * glyphId); gUnknown_03002F90[0x80] = gFont0LatinGlyphWidths[glyphId]; - + if (gUnknown_03002F90[0x80] <= 8) { DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); @@ -3270,7 +3269,7 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); } - + gUnknown_03002F90[0x81] = 13; } } @@ -3286,7 +3285,7 @@ u32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese) void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese) { const u16* glyphs; - + if (isJapanese == TRUE) { int eff; @@ -3300,7 +3299,7 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese) { glyphs = gFont7LatinGlyphs + (0x20 * glyphId); gUnknown_03002F90[0x80] = gFont7LatinGlyphWidths[glyphId]; - + if (gUnknown_03002F90[0x80] <= 8) { DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); @@ -3313,7 +3312,7 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); } - + gUnknown_03002F90[0x81] = 15; } } @@ -3342,7 +3341,7 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese) { glyphs = gFont8LatinGlyphs + (0x20 * glyphId); gUnknown_03002F90[0x80] = gFont8LatinGlyphWidths[glyphId]; - + if (gUnknown_03002F90[0x80] <= 8) { DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); @@ -3355,7 +3354,7 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); } - + gUnknown_03002F90[0x81] = 12; } } @@ -3386,7 +3385,7 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) { glyphs = gFont2LatinGlyphs + (0x20 * glyphId); gUnknown_03002F90[0x80] = gFont2LatinGlyphWidths[glyphId]; - + if (gUnknown_03002F90[0x80] <= 8) { DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); @@ -3399,7 +3398,7 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); } - + gUnknown_03002F90[0x81] = 14; } } @@ -3415,7 +3414,7 @@ u32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese) void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) { const u16* glyphs; - + if (isJapanese == TRUE) { int eff; @@ -3429,7 +3428,7 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) { glyphs = gFont1LatinGlyphs + (0x20 * glyphId); gUnknown_03002F90[0x80] = gFont1LatinGlyphWidths[glyphId]; - + if (gUnknown_03002F90[0x80] <= 8) { DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); @@ -3442,7 +3441,7 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90 + 0x40)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90 + 0x60)); } - + gUnknown_03002F90[0x81] = 15; } } diff --git a/sym_ewram.txt b/sym_ewram.txt index e799a9c82..a49f9e9a1 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -2,14 +2,7 @@ gTrainerId: @ 2020000 .space 0x4 .include "src/window.o" - .align 2 - -gTempTextPrinter: @ 202018C - .space 0x24 - -gTextPrinters: @ 20201B0 - .space 0x480 - + .include "src/text.o" .include "src/sprite.o" .align 2