From baa0dc5a963a79843b37888bcfe1d2dfe833ade9 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 13 Mar 2018 13:07:16 +0100 Subject: [PATCH 01/16] Organize the engine/ directory This is an informed attempt at reorganizing the engine/ directory by creating categorized subdirectories, in order to make it easier to navigate and find things. The directories created are as follows: * engine/game: Contains all "minigames", things like the unown puzzle and slot machine. * engine/gfx: Contains all handling of graphics. From loading palettes to playing animations. * engine/link: Contains all multiplayer functionality. * engine/menu: Contains all generic/misc. menus and menu code. Other, more specialized menus are in their own subdirectories (pokedex, pokegear, party menu, etc). * engine/overworld: Contains all handling of the overworld. From loading and connecting maps to wild encounters and the scripting engine. * engine/pokegear: In the same vein as engine/pokedex, except it could use some more splitting up. * engine/pokemon: Contains everything related to manipulating pokemon data. From the pokemon storage system to evolution and mail. * engine/printer: Contains everything related to printing things as well as the printer communication. * engine/title: Contains intro sequences, title screens and credits. --- Makefile | 4 +- engine/{ => events}/diploma.asm | 0 engine/{ => game}/card_flip.asm | 0 engine/{ => game}/dummy_game.asm | 0 engine/{ => game}/slot_machine.asm | 0 engine/{ => game}/unown_puzzle.asm | 0 engine/{ => gfx}/cgb_layouts.asm | 0 engine/{ => gfx}/color.asm | 4 +- engine/{ => gfx}/crystal_layouts.asm | 2 +- engine/{ => gfx}/evolution_animation.asm | 0 engine/{ => gfx}/gbc_only.asm | 0 engine/{ => gfx}/load_font.asm | 0 engine/{ => gfx}/load_pics.asm | 0 engine/{ => gfx}/map_palettes.asm | 0 engine/{ => gfx}/mapgroup_roofs.asm | 0 engine/{ => gfx}/mon_icons.asm | 0 engine/{ => gfx}/pic_animation.asm | 0 engine/{ => gfx}/player_gfx.asm | 0 engine/{ => gfx}/sgb_layouts.asm | 0 engine/{ => gfx}/sprite_anims.asm | 0 engine/{ => gfx}/sprites.asm | 2 +- engine/{ => gfx}/tileset_anims.asm | 0 engine/{ => gfx}/tileset_palettes.asm | 0 engine/{ => gfx}/timeofdaypals.asm | 0 engine/{ => gfx}/trade_animation.asm | 0 engine/{ => link}/link.asm | 2 +- engine/{ => link}/link_2.asm | 0 engine/{ => link}/link_trade.asm | 0 engine/{ => link}/mystery_gift.asm | 0 engine/{ => link}/mystery_gift_2.asm | 0 engine/{ => link}/time_capsule.asm | 0 engine/{ => link}/time_capsule_2.asm | 0 engine/{ => menu}/buy_sell_toss.asm | 0 engine/{ => menu}/clock_reset.asm | 0 .../{ => menu}/delete_save_change_clock.asm | 0 engine/{ => menu}/main_menu.asm | 0 engine/{ => menu}/mart.asm | 0 engine/{ => menu}/menu.asm | 0 engine/{ => menu}/menu_2.asm | 0 engine/{ => menu}/mon_menu.asm | 0 engine/{ => menu}/naming_screen.asm | 0 engine/{ => menu}/options_menu.asm | 0 engine/{ => menu}/pack.asm | 0 engine/{ => menu}/scrolling_menu.asm | 0 engine/{ => menu}/start_menu.asm | 0 engine/{ => menu}/switch_items.asm | 0 engine/{ => menu}/timeset.asm | 0 engine/{ => menu}/tmhm.asm | 0 engine/{ => menu}/trainer_card.asm | 0 engine/{ => overworld}/decorations.asm | 0 engine/{ => overworld}/events.asm | 4 +- engine/{ => overworld}/events_2.asm | 0 engine/{ => overworld}/init_map.asm | 0 engine/{ => overworld}/landmarks.asm | 0 engine/{ => overworld}/map_object_action.asm | 0 engine/{ => overworld}/map_objects.asm | 4 +- engine/{ => overworld}/map_objects_2.asm | 0 engine/{ => overworld}/map_setup.asm | 0 engine/{ => overworld}/movement.asm | 0 engine/{ => overworld}/npc_movement.asm | 0 engine/{ => overworld}/overworld.asm | 0 engine/{ => overworld}/player_movement.asm | 0 engine/{ => overworld}/player_object.asm | 0 engine/{ => overworld}/player_step.asm | 0 engine/{ => overworld}/scripting.asm | 0 engine/{ => overworld}/select_menu.asm | 0 engine/{ => overworld}/spawn_points.asm | 0 engine/{ => overworld}/tile_events.asm | 0 engine/{ => overworld}/time.asm | 0 engine/{ => overworld}/variables.asm | 0 engine/{ => overworld}/warp_connection.asm | 0 engine/{ => overworld}/wildmons.asm | 0 engine/{ => pokegear}/pokegear.asm | 0 engine/{ => pokegear}/radio.asm | 0 engine/{ => pokemon}/billspc.asm | 0 engine/{ => pokemon}/billspctop.asm | 0 engine/{ => pokemon}/breeding.asm | 0 engine/{ => pokemon}/caught_data.asm | 0 engine/{ => pokemon}/european_mail.asm | 0 engine/{ => pokemon}/evolve.asm | 0 engine/{ => pokemon}/experience.asm | 0 engine/{ => pokemon}/health.asm | 0 engine/{ => pokemon}/learn.asm | 0 engine/{ => pokemon}/mail.asm | 0 engine/{ => pokemon}/mail_2.asm | 0 engine/{ => pokemon}/mon_stats.asm | 0 engine/{ => pokemon}/move_mon.asm | 0 engine/{ => pokemon}/move_mon_wo_mail.asm | 0 engine/{ => pokemon}/party_menu.asm | 0 engine/{ => pokemon}/search.asm | 0 engine/{ => pokemon}/search2.asm | 0 engine/{ => pokemon}/stats_screen.asm | 0 engine/{ => pokemon}/tempmon.asm | 0 engine/{tmhm2.asm => pokemon/tmhm.asm} | 0 engine/{ => pokemon}/types.asm | 0 engine/{ => printer}/print_party.asm | 0 engine/{ => printer}/printer.asm | 2 +- engine/{ => printer}/printer_serial.asm | 0 engine/{ => routines}/math.asm | 0 engine/{ => routines}/printnum.asm | 0 engine/{ => title}/credits.asm | 0 engine/{ => title}/crystal_intro.asm | 0 engine/{ => title}/init_hof_credits.asm | 0 engine/{ => title}/title.asm | 0 engine/{ => title}/unused_title.asm | 0 main.asm | 184 +++++++++--------- 106 files changed, 104 insertions(+), 104 deletions(-) rename engine/{ => events}/diploma.asm (100%) rename engine/{ => game}/card_flip.asm (100%) rename engine/{ => game}/dummy_game.asm (100%) rename engine/{ => game}/slot_machine.asm (100%) rename engine/{ => game}/unown_puzzle.asm (100%) rename engine/{ => gfx}/cgb_layouts.asm (100%) rename engine/{ => gfx}/color.asm (99%) rename engine/{ => gfx}/crystal_layouts.asm (99%) rename engine/{ => gfx}/evolution_animation.asm (100%) rename engine/{ => gfx}/gbc_only.asm (100%) rename engine/{ => gfx}/load_font.asm (100%) rename engine/{ => gfx}/load_pics.asm (100%) rename engine/{ => gfx}/map_palettes.asm (100%) rename engine/{ => gfx}/mapgroup_roofs.asm (100%) rename engine/{ => gfx}/mon_icons.asm (100%) rename engine/{ => gfx}/pic_animation.asm (100%) rename engine/{ => gfx}/player_gfx.asm (100%) rename engine/{ => gfx}/sgb_layouts.asm (100%) rename engine/{ => gfx}/sprite_anims.asm (100%) rename engine/{ => gfx}/sprites.asm (99%) rename engine/{ => gfx}/tileset_anims.asm (100%) rename engine/{ => gfx}/tileset_palettes.asm (100%) rename engine/{ => gfx}/timeofdaypals.asm (100%) rename engine/{ => gfx}/trade_animation.asm (100%) rename engine/{ => link}/link.asm (99%) rename engine/{ => link}/link_2.asm (100%) rename engine/{ => link}/link_trade.asm (100%) rename engine/{ => link}/mystery_gift.asm (100%) rename engine/{ => link}/mystery_gift_2.asm (100%) rename engine/{ => link}/time_capsule.asm (100%) rename engine/{ => link}/time_capsule_2.asm (100%) rename engine/{ => menu}/buy_sell_toss.asm (100%) rename engine/{ => menu}/clock_reset.asm (100%) rename engine/{ => menu}/delete_save_change_clock.asm (100%) rename engine/{ => menu}/main_menu.asm (100%) rename engine/{ => menu}/mart.asm (100%) rename engine/{ => menu}/menu.asm (100%) rename engine/{ => menu}/menu_2.asm (100%) rename engine/{ => menu}/mon_menu.asm (100%) rename engine/{ => menu}/naming_screen.asm (100%) rename engine/{ => menu}/options_menu.asm (100%) rename engine/{ => menu}/pack.asm (100%) rename engine/{ => menu}/scrolling_menu.asm (100%) rename engine/{ => menu}/start_menu.asm (100%) rename engine/{ => menu}/switch_items.asm (100%) rename engine/{ => menu}/timeset.asm (100%) rename engine/{ => menu}/tmhm.asm (100%) rename engine/{ => menu}/trainer_card.asm (100%) rename engine/{ => overworld}/decorations.asm (100%) rename engine/{ => overworld}/events.asm (99%) rename engine/{ => overworld}/events_2.asm (100%) rename engine/{ => overworld}/init_map.asm (100%) rename engine/{ => overworld}/landmarks.asm (100%) rename engine/{ => overworld}/map_object_action.asm (100%) rename engine/{ => overworld}/map_objects.asm (99%) rename engine/{ => overworld}/map_objects_2.asm (100%) rename engine/{ => overworld}/map_setup.asm (100%) rename engine/{ => overworld}/movement.asm (100%) rename engine/{ => overworld}/npc_movement.asm (100%) rename engine/{ => overworld}/overworld.asm (100%) rename engine/{ => overworld}/player_movement.asm (100%) rename engine/{ => overworld}/player_object.asm (100%) rename engine/{ => overworld}/player_step.asm (100%) rename engine/{ => overworld}/scripting.asm (100%) rename engine/{ => overworld}/select_menu.asm (100%) rename engine/{ => overworld}/spawn_points.asm (100%) rename engine/{ => overworld}/tile_events.asm (100%) rename engine/{ => overworld}/time.asm (100%) rename engine/{ => overworld}/variables.asm (100%) rename engine/{ => overworld}/warp_connection.asm (100%) rename engine/{ => overworld}/wildmons.asm (100%) rename engine/{ => pokegear}/pokegear.asm (100%) rename engine/{ => pokegear}/radio.asm (100%) rename engine/{ => pokemon}/billspc.asm (100%) rename engine/{ => pokemon}/billspctop.asm (100%) rename engine/{ => pokemon}/breeding.asm (100%) rename engine/{ => pokemon}/caught_data.asm (100%) rename engine/{ => pokemon}/european_mail.asm (100%) rename engine/{ => pokemon}/evolve.asm (100%) rename engine/{ => pokemon}/experience.asm (100%) rename engine/{ => pokemon}/health.asm (100%) rename engine/{ => pokemon}/learn.asm (100%) rename engine/{ => pokemon}/mail.asm (100%) rename engine/{ => pokemon}/mail_2.asm (100%) rename engine/{ => pokemon}/mon_stats.asm (100%) rename engine/{ => pokemon}/move_mon.asm (100%) rename engine/{ => pokemon}/move_mon_wo_mail.asm (100%) rename engine/{ => pokemon}/party_menu.asm (100%) rename engine/{ => pokemon}/search.asm (100%) rename engine/{ => pokemon}/search2.asm (100%) rename engine/{ => pokemon}/stats_screen.asm (100%) rename engine/{ => pokemon}/tempmon.asm (100%) rename engine/{tmhm2.asm => pokemon/tmhm.asm} (100%) rename engine/{ => pokemon}/types.asm (100%) rename engine/{ => printer}/print_party.asm (100%) rename engine/{ => printer}/printer.asm (99%) rename engine/{ => printer}/printer_serial.asm (100%) rename engine/{ => routines}/math.asm (100%) rename engine/{ => routines}/printnum.asm (100%) rename engine/{ => title}/credits.asm (100%) rename engine/{ => title}/crystal_intro.asm (100%) rename engine/{ => title}/init_hof_credits.asm (100%) rename engine/{ => title}/title.asm (100%) rename engine/{ => title}/unused_title.asm (100%) diff --git a/Makefile b/Makefile index 4a63a9128..cb2c366d0 100644 --- a/Makefile +++ b/Makefile @@ -21,8 +21,8 @@ data/maps/map_data.o \ data/pokemon/dex_entries.o \ data/pokemon/egg_moves.o \ data/pokemon/evos_attacks.o \ -engine/credits.o \ -engine/events.o \ +engine/title/credits.o \ +engine/overworld/events.o \ gfx/pics.o \ gfx/sprites.o \ lib/mobile/main.o diff --git a/engine/diploma.asm b/engine/events/diploma.asm similarity index 100% rename from engine/diploma.asm rename to engine/events/diploma.asm diff --git a/engine/card_flip.asm b/engine/game/card_flip.asm similarity index 100% rename from engine/card_flip.asm rename to engine/game/card_flip.asm diff --git a/engine/dummy_game.asm b/engine/game/dummy_game.asm similarity index 100% rename from engine/dummy_game.asm rename to engine/game/dummy_game.asm diff --git a/engine/slot_machine.asm b/engine/game/slot_machine.asm similarity index 100% rename from engine/slot_machine.asm rename to engine/game/slot_machine.asm diff --git a/engine/unown_puzzle.asm b/engine/game/unown_puzzle.asm similarity index 100% rename from engine/unown_puzzle.asm rename to engine/game/unown_puzzle.asm diff --git a/engine/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm similarity index 100% rename from engine/cgb_layouts.asm rename to engine/gfx/cgb_layouts.asm diff --git a/engine/color.asm b/engine/gfx/color.asm similarity index 99% rename from engine/color.asm rename to engine/gfx/color.asm index b0bc653b0..6cf896ff4 100644 --- a/engine/color.asm +++ b/engine/gfx/color.asm @@ -1,4 +1,4 @@ -INCLUDE "engine/sgb_layouts.asm" +INCLUDE "engine/gfx/sgb_layouts.asm" SHINY_ATK_BIT EQU 5 SHINY_DEF_VAL EQU 10 @@ -445,7 +445,7 @@ LoadMailPalettes: .MailPals: INCLUDE "gfx/mail/mail.pal" -INCLUDE "engine/cgb_layouts.asm" +INCLUDE "engine/gfx/cgb_layouts.asm" Unreferenced_Function95f0: ld hl, .Palette diff --git a/engine/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm similarity index 99% rename from engine/crystal_layouts.asm rename to engine/gfx/crystal_layouts.asm index d6b193e9d..0133916e5 100755 --- a/engine/crystal_layouts.asm +++ b/engine/gfx/crystal_layouts.asm @@ -203,7 +203,7 @@ Function49496: ; 49496 ret ; 494ac -INCLUDE "engine/tileset_palettes.asm" +INCLUDE "engine/gfx/tileset_palettes.asm" MG_Mobile_Layout02: ; 49706 ld hl, .Palette_49732 diff --git a/engine/evolution_animation.asm b/engine/gfx/evolution_animation.asm similarity index 100% rename from engine/evolution_animation.asm rename to engine/gfx/evolution_animation.asm diff --git a/engine/gbc_only.asm b/engine/gfx/gbc_only.asm similarity index 100% rename from engine/gbc_only.asm rename to engine/gfx/gbc_only.asm diff --git a/engine/load_font.asm b/engine/gfx/load_font.asm similarity index 100% rename from engine/load_font.asm rename to engine/gfx/load_font.asm diff --git a/engine/load_pics.asm b/engine/gfx/load_pics.asm similarity index 100% rename from engine/load_pics.asm rename to engine/gfx/load_pics.asm diff --git a/engine/map_palettes.asm b/engine/gfx/map_palettes.asm similarity index 100% rename from engine/map_palettes.asm rename to engine/gfx/map_palettes.asm diff --git a/engine/mapgroup_roofs.asm b/engine/gfx/mapgroup_roofs.asm similarity index 100% rename from engine/mapgroup_roofs.asm rename to engine/gfx/mapgroup_roofs.asm diff --git a/engine/mon_icons.asm b/engine/gfx/mon_icons.asm similarity index 100% rename from engine/mon_icons.asm rename to engine/gfx/mon_icons.asm diff --git a/engine/pic_animation.asm b/engine/gfx/pic_animation.asm similarity index 100% rename from engine/pic_animation.asm rename to engine/gfx/pic_animation.asm diff --git a/engine/player_gfx.asm b/engine/gfx/player_gfx.asm similarity index 100% rename from engine/player_gfx.asm rename to engine/gfx/player_gfx.asm diff --git a/engine/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm similarity index 100% rename from engine/sgb_layouts.asm rename to engine/gfx/sgb_layouts.asm diff --git a/engine/sprite_anims.asm b/engine/gfx/sprite_anims.asm similarity index 100% rename from engine/sprite_anims.asm rename to engine/gfx/sprite_anims.asm diff --git a/engine/sprites.asm b/engine/gfx/sprites.asm similarity index 99% rename from engine/sprites.asm rename to engine/gfx/sprites.asm index 99d1d2ae4..63666c624 100755 --- a/engine/sprites.asm +++ b/engine/gfx/sprites.asm @@ -552,7 +552,7 @@ Unreferenced_BrokenGetStdGraphics: ; 8d1ac INCLUDE "data/sprite_anims/sequences.asm" -INCLUDE "engine/sprite_anims.asm" +INCLUDE "engine/gfx/sprite_anims.asm" INCLUDE "data/sprite_anims/framesets.asm" diff --git a/engine/tileset_anims.asm b/engine/gfx/tileset_anims.asm similarity index 100% rename from engine/tileset_anims.asm rename to engine/gfx/tileset_anims.asm diff --git a/engine/tileset_palettes.asm b/engine/gfx/tileset_palettes.asm similarity index 100% rename from engine/tileset_palettes.asm rename to engine/gfx/tileset_palettes.asm diff --git a/engine/timeofdaypals.asm b/engine/gfx/timeofdaypals.asm similarity index 100% rename from engine/timeofdaypals.asm rename to engine/gfx/timeofdaypals.asm diff --git a/engine/trade_animation.asm b/engine/gfx/trade_animation.asm similarity index 100% rename from engine/trade_animation.asm rename to engine/gfx/trade_animation.asm diff --git a/engine/link.asm b/engine/link/link.asm similarity index 99% rename from engine/link.asm rename to engine/link/link.asm index c693e6919..86af41c01 100755 --- a/engine/link.asm +++ b/engine/link/link.asm @@ -2029,7 +2029,7 @@ Unreferenced_Function28f09: ; 28f09 ret ; 28f24 -INCLUDE "engine/trade_animation.asm" +INCLUDE "engine/gfx/trade_animation.asm" CheckTimeCapsuleCompatibility: ; 29bfb ; Checks to see if your party is compatible with the Gen 1 games. diff --git a/engine/link_2.asm b/engine/link/link_2.asm similarity index 100% rename from engine/link_2.asm rename to engine/link/link_2.asm diff --git a/engine/link_trade.asm b/engine/link/link_trade.asm similarity index 100% rename from engine/link_trade.asm rename to engine/link/link_trade.asm diff --git a/engine/mystery_gift.asm b/engine/link/mystery_gift.asm similarity index 100% rename from engine/mystery_gift.asm rename to engine/link/mystery_gift.asm diff --git a/engine/mystery_gift_2.asm b/engine/link/mystery_gift_2.asm similarity index 100% rename from engine/mystery_gift_2.asm rename to engine/link/mystery_gift_2.asm diff --git a/engine/time_capsule.asm b/engine/link/time_capsule.asm similarity index 100% rename from engine/time_capsule.asm rename to engine/link/time_capsule.asm diff --git a/engine/time_capsule_2.asm b/engine/link/time_capsule_2.asm similarity index 100% rename from engine/time_capsule_2.asm rename to engine/link/time_capsule_2.asm diff --git a/engine/buy_sell_toss.asm b/engine/menu/buy_sell_toss.asm similarity index 100% rename from engine/buy_sell_toss.asm rename to engine/menu/buy_sell_toss.asm diff --git a/engine/clock_reset.asm b/engine/menu/clock_reset.asm similarity index 100% rename from engine/clock_reset.asm rename to engine/menu/clock_reset.asm diff --git a/engine/delete_save_change_clock.asm b/engine/menu/delete_save_change_clock.asm similarity index 100% rename from engine/delete_save_change_clock.asm rename to engine/menu/delete_save_change_clock.asm diff --git a/engine/main_menu.asm b/engine/menu/main_menu.asm similarity index 100% rename from engine/main_menu.asm rename to engine/menu/main_menu.asm diff --git a/engine/mart.asm b/engine/menu/mart.asm similarity index 100% rename from engine/mart.asm rename to engine/menu/mart.asm diff --git a/engine/menu.asm b/engine/menu/menu.asm similarity index 100% rename from engine/menu.asm rename to engine/menu/menu.asm diff --git a/engine/menu_2.asm b/engine/menu/menu_2.asm similarity index 100% rename from engine/menu_2.asm rename to engine/menu/menu_2.asm diff --git a/engine/mon_menu.asm b/engine/menu/mon_menu.asm similarity index 100% rename from engine/mon_menu.asm rename to engine/menu/mon_menu.asm diff --git a/engine/naming_screen.asm b/engine/menu/naming_screen.asm similarity index 100% rename from engine/naming_screen.asm rename to engine/menu/naming_screen.asm diff --git a/engine/options_menu.asm b/engine/menu/options_menu.asm similarity index 100% rename from engine/options_menu.asm rename to engine/menu/options_menu.asm diff --git a/engine/pack.asm b/engine/menu/pack.asm similarity index 100% rename from engine/pack.asm rename to engine/menu/pack.asm diff --git a/engine/scrolling_menu.asm b/engine/menu/scrolling_menu.asm similarity index 100% rename from engine/scrolling_menu.asm rename to engine/menu/scrolling_menu.asm diff --git a/engine/start_menu.asm b/engine/menu/start_menu.asm similarity index 100% rename from engine/start_menu.asm rename to engine/menu/start_menu.asm diff --git a/engine/switch_items.asm b/engine/menu/switch_items.asm similarity index 100% rename from engine/switch_items.asm rename to engine/menu/switch_items.asm diff --git a/engine/timeset.asm b/engine/menu/timeset.asm similarity index 100% rename from engine/timeset.asm rename to engine/menu/timeset.asm diff --git a/engine/tmhm.asm b/engine/menu/tmhm.asm similarity index 100% rename from engine/tmhm.asm rename to engine/menu/tmhm.asm diff --git a/engine/trainer_card.asm b/engine/menu/trainer_card.asm similarity index 100% rename from engine/trainer_card.asm rename to engine/menu/trainer_card.asm diff --git a/engine/decorations.asm b/engine/overworld/decorations.asm similarity index 100% rename from engine/decorations.asm rename to engine/overworld/decorations.asm diff --git a/engine/events.asm b/engine/overworld/events.asm similarity index 99% rename from engine/events.asm rename to engine/overworld/events.asm index 35a54138b..cc2c8c574 100644 --- a/engine/events.asm +++ b/engine/overworld/events.asm @@ -1106,6 +1106,6 @@ ChangeDirectionScript: ; 9 end ; 96c56 -INCLUDE "engine/scripting.asm" +INCLUDE "engine/overworld/scripting.asm" -INCLUDE "engine/events_2.asm" +INCLUDE "engine/overworld/events_2.asm" diff --git a/engine/events_2.asm b/engine/overworld/events_2.asm similarity index 100% rename from engine/events_2.asm rename to engine/overworld/events_2.asm diff --git a/engine/init_map.asm b/engine/overworld/init_map.asm similarity index 100% rename from engine/init_map.asm rename to engine/overworld/init_map.asm diff --git a/engine/landmarks.asm b/engine/overworld/landmarks.asm similarity index 100% rename from engine/landmarks.asm rename to engine/overworld/landmarks.asm diff --git a/engine/map_object_action.asm b/engine/overworld/map_object_action.asm similarity index 100% rename from engine/map_object_action.asm rename to engine/overworld/map_object_action.asm diff --git a/engine/map_objects.asm b/engine/overworld/map_objects.asm similarity index 99% rename from engine/map_objects.asm rename to engine/overworld/map_objects.asm index 78d9062ef..8d6f4082f 100644 --- a/engine/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -185,7 +185,7 @@ _HandleObjectAction ret ; 445f -INCLUDE "engine/map_object_action.asm" +INCLUDE "engine/overworld/map_object_action.asm" CopyNextCoordsTileToStandingCoordsTile: ; 4600 ld hl, OBJECT_NEXT_MAP_X @@ -1990,7 +1990,7 @@ DoMovementFunction: ; 506b ret ; 5075 -INCLUDE "engine/movement.asm" +INCLUDE "engine/overworld/movement.asm" ; 54b8 ApplyMovementToFollower: ; 54b8 diff --git a/engine/map_objects_2.asm b/engine/overworld/map_objects_2.asm similarity index 100% rename from engine/map_objects_2.asm rename to engine/overworld/map_objects_2.asm diff --git a/engine/map_setup.asm b/engine/overworld/map_setup.asm similarity index 100% rename from engine/map_setup.asm rename to engine/overworld/map_setup.asm diff --git a/engine/movement.asm b/engine/overworld/movement.asm similarity index 100% rename from engine/movement.asm rename to engine/overworld/movement.asm diff --git a/engine/npc_movement.asm b/engine/overworld/npc_movement.asm similarity index 100% rename from engine/npc_movement.asm rename to engine/overworld/npc_movement.asm diff --git a/engine/overworld.asm b/engine/overworld/overworld.asm similarity index 100% rename from engine/overworld.asm rename to engine/overworld/overworld.asm diff --git a/engine/player_movement.asm b/engine/overworld/player_movement.asm similarity index 100% rename from engine/player_movement.asm rename to engine/overworld/player_movement.asm diff --git a/engine/player_object.asm b/engine/overworld/player_object.asm similarity index 100% rename from engine/player_object.asm rename to engine/overworld/player_object.asm diff --git a/engine/player_step.asm b/engine/overworld/player_step.asm similarity index 100% rename from engine/player_step.asm rename to engine/overworld/player_step.asm diff --git a/engine/scripting.asm b/engine/overworld/scripting.asm similarity index 100% rename from engine/scripting.asm rename to engine/overworld/scripting.asm diff --git a/engine/select_menu.asm b/engine/overworld/select_menu.asm similarity index 100% rename from engine/select_menu.asm rename to engine/overworld/select_menu.asm diff --git a/engine/spawn_points.asm b/engine/overworld/spawn_points.asm similarity index 100% rename from engine/spawn_points.asm rename to engine/overworld/spawn_points.asm diff --git a/engine/tile_events.asm b/engine/overworld/tile_events.asm similarity index 100% rename from engine/tile_events.asm rename to engine/overworld/tile_events.asm diff --git a/engine/time.asm b/engine/overworld/time.asm similarity index 100% rename from engine/time.asm rename to engine/overworld/time.asm diff --git a/engine/variables.asm b/engine/overworld/variables.asm similarity index 100% rename from engine/variables.asm rename to engine/overworld/variables.asm diff --git a/engine/warp_connection.asm b/engine/overworld/warp_connection.asm similarity index 100% rename from engine/warp_connection.asm rename to engine/overworld/warp_connection.asm diff --git a/engine/wildmons.asm b/engine/overworld/wildmons.asm similarity index 100% rename from engine/wildmons.asm rename to engine/overworld/wildmons.asm diff --git a/engine/pokegear.asm b/engine/pokegear/pokegear.asm similarity index 100% rename from engine/pokegear.asm rename to engine/pokegear/pokegear.asm diff --git a/engine/radio.asm b/engine/pokegear/radio.asm similarity index 100% rename from engine/radio.asm rename to engine/pokegear/radio.asm diff --git a/engine/billspc.asm b/engine/pokemon/billspc.asm similarity index 100% rename from engine/billspc.asm rename to engine/pokemon/billspc.asm diff --git a/engine/billspctop.asm b/engine/pokemon/billspctop.asm similarity index 100% rename from engine/billspctop.asm rename to engine/pokemon/billspctop.asm diff --git a/engine/breeding.asm b/engine/pokemon/breeding.asm similarity index 100% rename from engine/breeding.asm rename to engine/pokemon/breeding.asm diff --git a/engine/caught_data.asm b/engine/pokemon/caught_data.asm similarity index 100% rename from engine/caught_data.asm rename to engine/pokemon/caught_data.asm diff --git a/engine/european_mail.asm b/engine/pokemon/european_mail.asm similarity index 100% rename from engine/european_mail.asm rename to engine/pokemon/european_mail.asm diff --git a/engine/evolve.asm b/engine/pokemon/evolve.asm similarity index 100% rename from engine/evolve.asm rename to engine/pokemon/evolve.asm diff --git a/engine/experience.asm b/engine/pokemon/experience.asm similarity index 100% rename from engine/experience.asm rename to engine/pokemon/experience.asm diff --git a/engine/health.asm b/engine/pokemon/health.asm similarity index 100% rename from engine/health.asm rename to engine/pokemon/health.asm diff --git a/engine/learn.asm b/engine/pokemon/learn.asm similarity index 100% rename from engine/learn.asm rename to engine/pokemon/learn.asm diff --git a/engine/mail.asm b/engine/pokemon/mail.asm similarity index 100% rename from engine/mail.asm rename to engine/pokemon/mail.asm diff --git a/engine/mail_2.asm b/engine/pokemon/mail_2.asm similarity index 100% rename from engine/mail_2.asm rename to engine/pokemon/mail_2.asm diff --git a/engine/mon_stats.asm b/engine/pokemon/mon_stats.asm similarity index 100% rename from engine/mon_stats.asm rename to engine/pokemon/mon_stats.asm diff --git a/engine/move_mon.asm b/engine/pokemon/move_mon.asm similarity index 100% rename from engine/move_mon.asm rename to engine/pokemon/move_mon.asm diff --git a/engine/move_mon_wo_mail.asm b/engine/pokemon/move_mon_wo_mail.asm similarity index 100% rename from engine/move_mon_wo_mail.asm rename to engine/pokemon/move_mon_wo_mail.asm diff --git a/engine/party_menu.asm b/engine/pokemon/party_menu.asm similarity index 100% rename from engine/party_menu.asm rename to engine/pokemon/party_menu.asm diff --git a/engine/search.asm b/engine/pokemon/search.asm similarity index 100% rename from engine/search.asm rename to engine/pokemon/search.asm diff --git a/engine/search2.asm b/engine/pokemon/search2.asm similarity index 100% rename from engine/search2.asm rename to engine/pokemon/search2.asm diff --git a/engine/stats_screen.asm b/engine/pokemon/stats_screen.asm similarity index 100% rename from engine/stats_screen.asm rename to engine/pokemon/stats_screen.asm diff --git a/engine/tempmon.asm b/engine/pokemon/tempmon.asm similarity index 100% rename from engine/tempmon.asm rename to engine/pokemon/tempmon.asm diff --git a/engine/tmhm2.asm b/engine/pokemon/tmhm.asm similarity index 100% rename from engine/tmhm2.asm rename to engine/pokemon/tmhm.asm diff --git a/engine/types.asm b/engine/pokemon/types.asm similarity index 100% rename from engine/types.asm rename to engine/pokemon/types.asm diff --git a/engine/print_party.asm b/engine/printer/print_party.asm similarity index 100% rename from engine/print_party.asm rename to engine/printer/print_party.asm diff --git a/engine/printer.asm b/engine/printer/printer.asm similarity index 99% rename from engine/printer.asm rename to engine/printer/printer.asm index b9e55ef2a..0264b4f7a 100755 --- a/engine/printer.asm +++ b/engine/printer/printer.asm @@ -1,4 +1,4 @@ -INCLUDE "engine/printer_serial.asm" +INCLUDE "engine/printer/printer_serial.asm" SendScreenToPrinter: ; 843f0 .loop diff --git a/engine/printer_serial.asm b/engine/printer/printer_serial.asm similarity index 100% rename from engine/printer_serial.asm rename to engine/printer/printer_serial.asm diff --git a/engine/math.asm b/engine/routines/math.asm similarity index 100% rename from engine/math.asm rename to engine/routines/math.asm diff --git a/engine/printnum.asm b/engine/routines/printnum.asm similarity index 100% rename from engine/printnum.asm rename to engine/routines/printnum.asm diff --git a/engine/credits.asm b/engine/title/credits.asm similarity index 100% rename from engine/credits.asm rename to engine/title/credits.asm diff --git a/engine/crystal_intro.asm b/engine/title/crystal_intro.asm similarity index 100% rename from engine/crystal_intro.asm rename to engine/title/crystal_intro.asm diff --git a/engine/init_hof_credits.asm b/engine/title/init_hof_credits.asm similarity index 100% rename from engine/init_hof_credits.asm rename to engine/title/init_hof_credits.asm diff --git a/engine/title.asm b/engine/title/title.asm similarity index 100% rename from engine/title.asm rename to engine/title/title.asm diff --git a/engine/unused_title.asm b/engine/title/unused_title.asm similarity index 100% rename from engine/unused_title.asm rename to engine/title/unused_title.asm diff --git a/main.asm b/main.asm index 64be1ded4..af4b61b75 100644 --- a/main.asm +++ b/main.asm @@ -5,38 +5,38 @@ SECTION "bank1", ROMX INCLUDE "engine/routines/placewaitingtext.asm" INCLUDE "engine/routines/loadpushoam.asm" -INCLUDE "engine/map_objects.asm" +INCLUDE "engine/overworld/map_objects.asm" INCLUDE "engine/intro_menu.asm" -INCLUDE "engine/init_map.asm" -INCLUDE "engine/learn.asm" +INCLUDE "engine/overworld/init_map.asm" +INCLUDE "engine/pokemon/learn.asm" INCLUDE "engine/routines/checknickerrors.asm" -INCLUDE "engine/math.asm" +INCLUDE "engine/routines/math.asm" INCLUDE "data/items/attributes.asm" -INCLUDE "engine/npc_movement.asm" +INCLUDE "engine/overworld/npc_movement.asm" INCLUDE "engine/events/happiness_egg.asm" INCLUDE "engine/events/specials_2.asm" SECTION "bank2", ROMX -INCLUDE "engine/player_object.asm" +INCLUDE "engine/overworld/player_object.asm" INCLUDE "engine/routines/sine.asm" INCLUDE "engine/predef.asm" -INCLUDE "engine/color.asm" +INCLUDE "engine/gfx/color.asm" SECTION "bank3", ROMX INCLUDE "engine/routines/checktime.asm" INCLUDE "engine/events/specials.asm" -INCLUDE "engine/printnum.asm" -INCLUDE "engine/health.asm" +INCLUDE "engine/routines/printnum.asm" +INCLUDE "engine/pokemon/health.asm" INCLUDE "engine/events/overworld.asm" INCLUDE "engine/items.asm" -INCLUDE "engine/player_step.asm" +INCLUDE "engine/overworld/player_step.asm" INCLUDE "engine/battle/anim_hp_bar.asm" -INCLUDE "engine/move_mon.asm" -INCLUDE "engine/billspctop.asm" +INCLUDE "engine/pokemon/move_mon.asm" +INCLUDE "engine/pokemon/billspctop.asm" INCLUDE "engine/routines/getbreedmonlevelgrowth.asm" INCLUDE "engine/events/bug_contest/caught_mon.asm" INCLUDE "engine/item_effects.asm" @@ -46,17 +46,17 @@ INCLUDE "engine/routines/knowsmove.asm" SECTION "bank4", ROMX -INCLUDE "engine/pack.asm" -INCLUDE "engine/time.asm" -INCLUDE "engine/tmhm.asm" -INCLUDE "engine/naming_screen.asm" +INCLUDE "engine/menu/pack.asm" +INCLUDE "engine/overworld/time.asm" +INCLUDE "engine/menu/tmhm.asm" +INCLUDE "engine/menu/naming_screen.asm" INCLUDE "engine/events/misc_scripts.asm" INCLUDE "engine/events/heal_machine_anim.asm" INCLUDE "engine/events/whiteout.asm" INCLUDE "engine/events/forced_movement.asm" INCLUDE "engine/events/itemfinder.asm" -INCLUDE "engine/start_menu.asm" -INCLUDE "engine/select_menu.asm" +INCLUDE "engine/menu/start_menu.asm" +INCLUDE "engine/overworld/select_menu.asm" INCLUDE "engine/events/elevator.asm" INCLUDE "engine/events/bug_contest/contest.asm" INCLUDE "engine/events/misc_scripts_2.asm" @@ -71,49 +71,49 @@ INCLUDE "engine/routines/getsquareroot.asm" SECTION "bank5", ROMX INCLUDE "engine/rtc.asm" -INCLUDE "engine/overworld.asm" -INCLUDE "engine/tile_events.asm" +INCLUDE "engine/overworld/overworld.asm" +INCLUDE "engine/overworld/tile_events.asm" INCLUDE "engine/save.asm" -INCLUDE "engine/spawn_points.asm" -INCLUDE "engine/map_setup.asm" +INCLUDE "engine/overworld/spawn_points.asm" +INCLUDE "engine/overworld/map_setup.asm" INCLUDE "engine/events/pokecenter_pc.asm" -INCLUDE "engine/mart.asm" +INCLUDE "engine/menu/mart.asm" INCLUDE "engine/money.asm" INCLUDE "data/items/marts.asm" INCLUDE "engine/events/mom.asm" INCLUDE "engine/events/daycare.asm" INCLUDE "engine/events/print_unown.asm" INCLUDE "engine/events/print_photo.asm" -INCLUDE "engine/breeding.asm" +INCLUDE "engine/pokemon/breeding.asm" INCLUDE "gfx/tilesets.asm" SECTION "Roofs", ROMX -INCLUDE "engine/mapgroup_roofs.asm" +INCLUDE "engine/gfx/mapgroup_roofs.asm" SECTION "Clock Reset", ROMX -INCLUDE "engine/clock_reset.asm" +INCLUDE "engine/menu/clock_reset.asm" SECTION "bank9", ROMX INCLUDE "data/text_buffers.asm" -INCLUDE "engine/menu.asm" +INCLUDE "engine/menu/menu.asm" INCLUDE "engine/routines/updateitemdescription.asm" INCLUDE "engine/events/pokepic.asm" -INCLUDE "engine/map_objects_2.asm" -INCLUDE "engine/scrolling_menu.asm" -INCLUDE "engine/switch_items.asm" -INCLUDE "engine/menu_2.asm" -INCLUDE "engine/mon_menu.asm" +INCLUDE "engine/overworld/map_objects_2.asm" +INCLUDE "engine/menu/scrolling_menu.asm" +INCLUDE "engine/menu/switch_items.asm" +INCLUDE "engine/menu/menu_2.asm" +INCLUDE "engine/menu/mon_menu.asm" INCLUDE "engine/battle/menu.asm" -INCLUDE "engine/buy_sell_toss.asm" -INCLUDE "engine/trainer_card.asm" +INCLUDE "engine/menu/buy_sell_toss.asm" +INCLUDE "engine/menu/trainer_card.asm" INCLUDE "engine/events/prof_oaks_pc.asm" -INCLUDE "engine/decorations.asm" +INCLUDE "engine/overworld/decorations.asm" INCLUDE "engine/routines/leveluphappinessmod.asm" INCLUDE "engine/battle/read_trainer_dvs.asm" INCLUDE "data/trainers/dvs.asm" @@ -126,8 +126,8 @@ INCLUDE "engine/events/kurt_selectquantity_interpretjoypad.asm" SECTION "bankA", ROMX -INCLUDE "engine/link.asm" -INCLUDE "engine/wildmons.asm" +INCLUDE "engine/link/link.asm" +INCLUDE "engine/overworld/wildmons.asm" INCLUDE "engine/battle/link_result.asm" ChrisBackpic: ; 2ba1a @@ -143,8 +143,8 @@ INCLUDE "engine/battle/trainer_huds.asm" INCLUDE "data/trainers/class_names.asm" INCLUDE "engine/battle/ai/redundant.asm" INCLUDE "engine/events/move_deleter.asm" -INCLUDE "engine/mystery_gift_2.asm" -INCLUDE "engine/tmhm2.asm" +INCLUDE "engine/link/mystery_gift_2.asm" +INCLUDE "engine/pokemon/tmhm.asm" INCLUDE "data/moves/descriptions.asm" INCLUDE "engine/events/pokerus/pokerus.asm" INCLUDE "engine/battle/start_battle.asm" @@ -177,7 +177,7 @@ SECTION "bank10", ROMX INCLUDE "engine/pokedex/pokedex.asm" INCLUDE "data/moves/moves.asm" -INCLUDE "engine/evolve.asm" +INCLUDE "engine/pokemon/evolve.asm" SECTION "bank11", ROMX @@ -186,7 +186,7 @@ INCLUDE "engine/events/fruit_trees.asm" INCLUDE "engine/battle/ai/move.asm" INCLUDE "engine/pokedex/pokedex_2.asm" INCLUDE "data/pokemon/dex_entry_pointers.asm" -INCLUDE "engine/mail.asm" +INCLUDE "engine/pokemon/mail.asm" SECTION "Crystal Features 1", ROMX @@ -194,18 +194,18 @@ SECTION "Crystal Features 1", ROMX INCLUDE "engine/init_gender.asm" INCLUDE "engine/routines/drawkrispackgfx.asm" INCLUDE "engine/events/move_tutor.asm" -INCLUDE "engine/crystal_layouts.asm" +INCLUDE "engine/gfx/crystal_layouts.asm" INCLUDE "engine/events/celebi.asm" -INCLUDE "engine/main_menu.asm" +INCLUDE "engine/menu/main_menu.asm" INCLUDE "mobile/mobile_menu.asm" -INCLUDE "engine/search.asm" +INCLUDE "engine/pokemon/search.asm" INCLUDE "mobile/mobile_12_2.asm" INCLUDE "engine/events/buena_menu.asm" SECTION "bank13", ROMX -INCLUDE "engine/map_palettes.asm" +INCLUDE "engine/gfx/map_palettes.asm" INCLUDE "gfx/tileset_palette_maps.asm" INCLUDE "data/collision_permissions.asm" INCLUDE "engine/routines/emptyallsrambanks.asm" @@ -221,45 +221,45 @@ INCBIN "gfx/new_game/shrink1.2bpp.lz" Shrink2Pic: ; 4d2d9 INCBIN "gfx/new_game/shrink2.2bpp.lz" -INCLUDE "engine/link_2.asm" -INCLUDE "engine/delete_save_change_clock.asm" +INCLUDE "engine/link/link_2.asm" +INCLUDE "engine/menu/delete_save_change_clock.asm" INCLUDE "data/tilesets.asm" INCLUDE "engine/routines/flagpredef.asm" INCLUDE "engine/routines/trademonfrontpic.asm" INCLUDE "engine/events/pokerus/check_pokerus.asm" INCLUDE "engine/events/lucky_number.asm" -INCLUDE "engine/caught_data.asm" -INCLUDE "engine/search2.asm" -INCLUDE "engine/stats_screen.asm" +INCLUDE "engine/pokemon/caught_data.asm" +INCLUDE "engine/pokemon/search2.asm" +INCLUDE "engine/pokemon/stats_screen.asm" INCLUDE "engine/events/catch_tutorial.asm" -INCLUDE "engine/evolution_animation.asm" -INCLUDE "engine/init_hof_credits.asm" +INCLUDE "engine/gfx/evolution_animation.asm" +INCLUDE "engine/title/init_hof_credits.asm" INCLUDE "engine/events/battle_tower/get_trainer_class.asm" INCLUDE "engine/battle/sliding_intro.asm" INCLUDE "mobile/print_opp_message.asm" INCLUDE "engine/battle/checkbattlescene.asm" -INCLUDE "engine/gbc_only.asm" +INCLUDE "engine/gfx/gbc_only.asm" INCLUDE "engine/events/poke_seer.asm" SECTION "bank14", ROMX -INCLUDE "engine/party_menu.asm" +INCLUDE "engine/pokemon/party_menu.asm" INCLUDE "engine/events/poisonstep.asm" INCLUDE "engine/events/sweet_scent.asm" INCLUDE "engine/events/squirtbottle.asm" INCLUDE "engine/events/card_key.asm" INCLUDE "engine/events/basement_key.asm" INCLUDE "engine/events/sacred_ash.asm" -INCLUDE "engine/tempmon.asm" -INCLUDE "engine/types.asm" +INCLUDE "engine/pokemon/tempmon.asm" +INCLUDE "engine/pokemon/types.asm" INCLUDE "engine/routines/unreferenced_getgen1trainerclassname.asm" -INCLUDE "engine/mon_stats.asm" +INCLUDE "engine/pokemon/mon_stats.asm" INCLUDE "engine/routines/initlist.asm" -INCLUDE "engine/experience.asm" +INCLUDE "engine/pokemon/experience.asm" INCLUDE "engine/routines/switchpartymons.asm" -INCLUDE "engine/load_pics.asm" -INCLUDE "engine/move_mon_wo_mail.asm" +INCLUDE "engine/gfx/load_pics.asm" +INCLUDE "engine/pokemon/move_mon_wo_mail.asm" INCLUDE "data/pokemon/base_stats.asm" INCLUDE "data/pokemon/names.asm" INCLUDE "data/unused_53d84.asm" @@ -276,16 +276,16 @@ INCLUDE "data/phone/text/extra.asm" SECTION "bank20", ROMX -INCLUDE "engine/player_movement.asm" +INCLUDE "engine/overworld/player_movement.asm" INCLUDE "engine/engine_flags.asm" -INCLUDE "engine/variables.asm" +INCLUDE "engine/overworld/variables.asm" INCLUDE "data/text/battle.asm" INCLUDE "engine/debug.asm" SECTION "bank21", ROMX -INCLUDE "engine/printer.asm" +INCLUDE "engine/printer/printer.asm" INCLUDE "gfx/battle_anims.asm" INCLUDE "engine/events/halloffame.asm" @@ -293,7 +293,7 @@ INCLUDE "engine/events/halloffame.asm" SECTION "Crystal Features 2", ROMX INCLUDE "engine/events/kurt.asm" -INCLUDE "engine/player_gfx.asm" +INCLUDE "engine/gfx/player_gfx.asm" INCLUDE "mobile/mobile_22.asm" INCLUDE "engine/events/unown_walls.asm" INCLUDE "engine/events/buena.asm" @@ -304,22 +304,22 @@ INCLUDE "mobile/mobile_22_2.asm" SECTION "bank23", ROMX -INCLUDE "engine/timeofdaypals.asm" +INCLUDE "engine/gfx/timeofdaypals.asm" INCLUDE "engine/battle/battle_transition.asm" INCLUDE "engine/events/field_moves.asm" INCLUDE "engine/events/magnet_train.asm" INCLUDE "engine/battle/battlestart_copytilemapatonce.asm" -INCLUDE "engine/sprites.asm" -INCLUDE "engine/mon_icons.asm" +INCLUDE "engine/gfx/sprites.asm" +INCLUDE "engine/gfx/mon_icons.asm" SECTION "bank24", ROMX INCLUDE "engine/phone/phone.asm" -INCLUDE "engine/timeset.asm" -INCLUDE "engine/pokegear.asm" +INCLUDE "engine/menu/timeset.asm" +INCLUDE "engine/pokegear/pokegear.asm" INCLUDE "engine/events/fish.asm" -INCLUDE "engine/slot_machine.asm" +INCLUDE "engine/game/slot_machine.asm" SECTION "Phone Engine", ROMX @@ -356,8 +356,8 @@ INCLUDE "engine/events/map_name_sign.asm" INCLUDE "engine/events/checkforhiddenitems.asm" INCLUDE "engine/events/treemons.asm" INCLUDE "engine/events/loadfishinggfx.asm" -INCLUDE "engine/radio.asm" -INCLUDE "engine/mail_2.asm" +INCLUDE "engine/pokegear/radio.asm" +INCLUDE "engine/pokemon/mail_2.asm" SECTION "bank2F", ROMX @@ -393,7 +393,7 @@ INCLUDE "data/battle_anims/object_gfx.asm" SECTION "Pic Animations 1", ROMX -INCLUDE "engine/pic_animation.asm" +INCLUDE "engine/gfx/pic_animation.asm" INCLUDE "gfx/pokemon/anim_pointers.asm" INCLUDE "gfx/pokemon/anims.asm" INCLUDE "gfx/pokemon/idle_pointers.asm" @@ -430,10 +430,10 @@ INCLUDE "gfx/pokemon/unown_frames.asm" SECTION "bank38", ROMX INCLUDE "engine/events/print_unown_2.asm" -INCLUDE "engine/card_flip.asm" -INCLUDE "engine/unown_puzzle.asm" -INCLUDE "engine/dummy_game.asm" -INCLUDE "engine/billspc.asm" +INCLUDE "engine/game/card_flip.asm" +INCLUDE "engine/game/unown_puzzle.asm" +INCLUDE "engine/game/dummy_game.asm" +INCLUDE "engine/pokemon/billspc.asm" SECTION "bank39", ROMX @@ -441,18 +441,18 @@ SECTION "bank39", ROMX CopyrightGFX:: ; e4000 INCBIN "gfx/splash/copyright.2bpp" -INCLUDE "engine/options_menu.asm" -INCLUDE "engine/crystal_intro.asm" +INCLUDE "engine/menu/options_menu.asm" +INCLUDE "engine/title/crystal_intro.asm" SECTION "bank3E", ROMX -INCLUDE "engine/load_font.asm" -INCLUDE "engine/time_capsule.asm" +INCLUDE "engine/gfx/load_font.asm" +INCLUDE "engine/link/time_capsule.asm" INCLUDE "engine/events/name_rater.asm" INCLUDE "engine/routines/playslowcry.asm" INCLUDE "engine/pokedex/newpokedexentry.asm" -INCLUDE "engine/time_capsule_2.asm" +INCLUDE "engine/link/time_capsule_2.asm" INCLUDE "engine/pokedex/unown_dex.asm" INCLUDE "engine/events/magikarp.asm" INCLUDE "engine/battle/hidden_power.asm" @@ -461,7 +461,7 @@ INCLUDE "engine/battle/misc.asm" SECTION "bank3F", ROMX -INCLUDE "engine/tileset_anims.asm" +INCLUDE "engine/gfx/tileset_anims.asm" INCLUDE "engine/events/npc_trade.asm" INCLUDE "engine/events/mom_phone.asm" @@ -473,8 +473,8 @@ SECTION "bank41", ROMX INCLUDE "engine/dma_transfer.asm" INCLUDE "gfx/emotes.asm" -INCLUDE "engine/warp_connection.asm" -INCLUDE "engine/mystery_gift.asm" +INCLUDE "engine/overworld/warp_connection.asm" +INCLUDE "engine/link/mystery_gift.asm" INCLUDE "engine/battle/used_move_text.asm" INCLUDE "mobile/mobile_41.asm" INCLUDE "engine/routines/loadoverworldfont.asm" @@ -493,8 +493,8 @@ INCBIN "gfx/intro/logo.2bpp.lz" SECTION "Title", ROMX -INCLUDE "engine/unused_title.asm" -INCLUDE "engine/title.asm" +INCLUDE "engine/title/unused_title.asm" +INCLUDE "engine/title/title.asm" INCLUDE "mobile/mobile_45.asm" @@ -511,7 +511,7 @@ INCLUDE "engine/events/battle_tower/trainer_text.asm" SECTION "bank5B", ROMX INCLUDE "mobile/mobile_5b.asm" -INCLUDE "engine/link_trade.asm" +INCLUDE "engine/link/link_trade.asm" SECTION "Mobile 5C", ROMX @@ -569,7 +569,7 @@ INCLUDE "data/items/names.asm" INCLUDE "engine/routines/printitemdescription.asm" INCLUDE "data/items/descriptions.asm" INCLUDE "data/moves/names.asm" -INCLUDE "engine/landmarks.asm" +INCLUDE "engine/overworld/landmarks.asm" SECTION "bank77", ROMX @@ -577,13 +577,13 @@ SECTION "bank77", ROMX UnownFont: ; 1dc000 INCBIN "gfx/font/unown_font.2bpp" -INCLUDE "engine/print_party.asm" +INCLUDE "engine/printer/print_party.asm" SECTION "bank77_2", ROMX INCLUDE "engine/routines/printhoursmins.asm" -INCLUDE "engine/diploma.asm" +INCLUDE "engine/events/diploma.asm" INCLUDE "engine/pokedex/pokedex_3.asm" INCLUDE "engine/events/catch_tutorial_input.asm" INCLUDE "engine/routines/townmap_convertlinebreakcharacters.asm" @@ -591,7 +591,7 @@ INCLUDE "engine/routines/townmap_convertlinebreakcharacters.asm" PokegearGFX: ; 1de2e4 INCBIN "gfx/pokegear/pokegear.2bpp.lz" -INCLUDE "engine/european_mail.asm" +INCLUDE "engine/pokemon/european_mail.asm" SECTION "Battle Tower Text", ROMX From 97c511cd2f271252cbc9e9746668081422231ca5 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 14 Mar 2018 13:28:36 +0100 Subject: [PATCH 02/16] Organize the engine/ directory, take 2 Renamed `game` to `games` and `menu` to `menus`. Moved some functions from `engine/routines/` to their fitting subdirectories. Made two new subdirectories: * engine/rtc: Contains all RTC-related things. Menus, hardware, misc functions. * engine/items: Contains all item-related things. Pack, item effects, other item handlers. --- engine/{game => games}/card_flip.asm | 0 engine/{game => games}/dummy_game.asm | 0 engine/{game => games}/slot_machine.asm | 0 engine/{game => games}/unown_puzzle.asm | 0 engine/{routines => gfx}/drawkrispackgfx.asm | 0 .../{routines => gfx}/loadoverworldfont.asm | 0 engine/{routines => gfx}/placegraphic.asm | 0 engine/{routines => gfx}/trademonfrontpic.asm | 0 engine/{menu => items}/buy_sell_toss.asm | 0 engine/{ => items}/item_effects.asm | 0 engine/{ => items}/items.asm | 0 engine/{menu => items}/mart.asm | 0 engine/{menu => items}/pack.asm | 0 .../printitemdescription.asm | 0 engine/{menu => items}/switch_items.asm | 0 engine/{menu => items}/tmhm.asm | 0 .../updateitemdescription.asm | 0 engine/{menu => menus}/main_menu.asm | 0 engine/{menu => menus}/menu.asm | 0 engine/{menu => menus}/menu_2.asm | 0 engine/{menu => menus}/naming_screen.asm | 0 engine/{menu => menus}/options_menu.asm | 0 engine/{menu => menus}/scrolling_menu.asm | 0 engine/{menu => menus}/start_menu.asm | 0 engine/{menu => menus}/trainer_card.asm | 0 .../{routines => overworld}/loadmappart.asm | 0 .../getbreedmonlevelgrowth.asm | 0 engine/{routines => pokemon}/knowsmove.asm | 0 .../leveluphappinessmod.asm | 0 engine/{menu => pokemon}/mon_menu.asm | 0 .../{routines => pokemon}/switchpartymons.asm | 0 engine/{menu => rtc}/clock_reset.asm | 0 .../delete_save_change_clock.asm | 0 engine/{routines => rtc}/printhoursmins.asm | 0 engine/{ => rtc}/rtc.asm | 0 engine/{menu => rtc}/timeset.asm | 0 main.asm | 72 +++++++++---------- 37 files changed, 36 insertions(+), 36 deletions(-) rename engine/{game => games}/card_flip.asm (100%) rename engine/{game => games}/dummy_game.asm (100%) rename engine/{game => games}/slot_machine.asm (100%) rename engine/{game => games}/unown_puzzle.asm (100%) rename engine/{routines => gfx}/drawkrispackgfx.asm (100%) rename engine/{routines => gfx}/loadoverworldfont.asm (100%) rename engine/{routines => gfx}/placegraphic.asm (100%) rename engine/{routines => gfx}/trademonfrontpic.asm (100%) rename engine/{menu => items}/buy_sell_toss.asm (100%) rename engine/{ => items}/item_effects.asm (100%) rename engine/{ => items}/items.asm (100%) rename engine/{menu => items}/mart.asm (100%) rename engine/{menu => items}/pack.asm (100%) rename engine/{routines => items}/printitemdescription.asm (100%) rename engine/{menu => items}/switch_items.asm (100%) rename engine/{menu => items}/tmhm.asm (100%) rename engine/{routines => items}/updateitemdescription.asm (100%) rename engine/{menu => menus}/main_menu.asm (100%) rename engine/{menu => menus}/menu.asm (100%) rename engine/{menu => menus}/menu_2.asm (100%) rename engine/{menu => menus}/naming_screen.asm (100%) rename engine/{menu => menus}/options_menu.asm (100%) rename engine/{menu => menus}/scrolling_menu.asm (100%) rename engine/{menu => menus}/start_menu.asm (100%) rename engine/{menu => menus}/trainer_card.asm (100%) rename engine/{routines => overworld}/loadmappart.asm (100%) rename engine/{routines => pokemon}/getbreedmonlevelgrowth.asm (100%) rename engine/{routines => pokemon}/knowsmove.asm (100%) rename engine/{routines => pokemon}/leveluphappinessmod.asm (100%) rename engine/{menu => pokemon}/mon_menu.asm (100%) rename engine/{routines => pokemon}/switchpartymons.asm (100%) rename engine/{menu => rtc}/clock_reset.asm (100%) rename engine/{menu => rtc}/delete_save_change_clock.asm (100%) rename engine/{routines => rtc}/printhoursmins.asm (100%) rename engine/{ => rtc}/rtc.asm (100%) rename engine/{menu => rtc}/timeset.asm (100%) diff --git a/engine/game/card_flip.asm b/engine/games/card_flip.asm similarity index 100% rename from engine/game/card_flip.asm rename to engine/games/card_flip.asm diff --git a/engine/game/dummy_game.asm b/engine/games/dummy_game.asm similarity index 100% rename from engine/game/dummy_game.asm rename to engine/games/dummy_game.asm diff --git a/engine/game/slot_machine.asm b/engine/games/slot_machine.asm similarity index 100% rename from engine/game/slot_machine.asm rename to engine/games/slot_machine.asm diff --git a/engine/game/unown_puzzle.asm b/engine/games/unown_puzzle.asm similarity index 100% rename from engine/game/unown_puzzle.asm rename to engine/games/unown_puzzle.asm diff --git a/engine/routines/drawkrispackgfx.asm b/engine/gfx/drawkrispackgfx.asm similarity index 100% rename from engine/routines/drawkrispackgfx.asm rename to engine/gfx/drawkrispackgfx.asm diff --git a/engine/routines/loadoverworldfont.asm b/engine/gfx/loadoverworldfont.asm similarity index 100% rename from engine/routines/loadoverworldfont.asm rename to engine/gfx/loadoverworldfont.asm diff --git a/engine/routines/placegraphic.asm b/engine/gfx/placegraphic.asm similarity index 100% rename from engine/routines/placegraphic.asm rename to engine/gfx/placegraphic.asm diff --git a/engine/routines/trademonfrontpic.asm b/engine/gfx/trademonfrontpic.asm similarity index 100% rename from engine/routines/trademonfrontpic.asm rename to engine/gfx/trademonfrontpic.asm diff --git a/engine/menu/buy_sell_toss.asm b/engine/items/buy_sell_toss.asm similarity index 100% rename from engine/menu/buy_sell_toss.asm rename to engine/items/buy_sell_toss.asm diff --git a/engine/item_effects.asm b/engine/items/item_effects.asm similarity index 100% rename from engine/item_effects.asm rename to engine/items/item_effects.asm diff --git a/engine/items.asm b/engine/items/items.asm similarity index 100% rename from engine/items.asm rename to engine/items/items.asm diff --git a/engine/menu/mart.asm b/engine/items/mart.asm similarity index 100% rename from engine/menu/mart.asm rename to engine/items/mart.asm diff --git a/engine/menu/pack.asm b/engine/items/pack.asm similarity index 100% rename from engine/menu/pack.asm rename to engine/items/pack.asm diff --git a/engine/routines/printitemdescription.asm b/engine/items/printitemdescription.asm similarity index 100% rename from engine/routines/printitemdescription.asm rename to engine/items/printitemdescription.asm diff --git a/engine/menu/switch_items.asm b/engine/items/switch_items.asm similarity index 100% rename from engine/menu/switch_items.asm rename to engine/items/switch_items.asm diff --git a/engine/menu/tmhm.asm b/engine/items/tmhm.asm similarity index 100% rename from engine/menu/tmhm.asm rename to engine/items/tmhm.asm diff --git a/engine/routines/updateitemdescription.asm b/engine/items/updateitemdescription.asm similarity index 100% rename from engine/routines/updateitemdescription.asm rename to engine/items/updateitemdescription.asm diff --git a/engine/menu/main_menu.asm b/engine/menus/main_menu.asm similarity index 100% rename from engine/menu/main_menu.asm rename to engine/menus/main_menu.asm diff --git a/engine/menu/menu.asm b/engine/menus/menu.asm similarity index 100% rename from engine/menu/menu.asm rename to engine/menus/menu.asm diff --git a/engine/menu/menu_2.asm b/engine/menus/menu_2.asm similarity index 100% rename from engine/menu/menu_2.asm rename to engine/menus/menu_2.asm diff --git a/engine/menu/naming_screen.asm b/engine/menus/naming_screen.asm similarity index 100% rename from engine/menu/naming_screen.asm rename to engine/menus/naming_screen.asm diff --git a/engine/menu/options_menu.asm b/engine/menus/options_menu.asm similarity index 100% rename from engine/menu/options_menu.asm rename to engine/menus/options_menu.asm diff --git a/engine/menu/scrolling_menu.asm b/engine/menus/scrolling_menu.asm similarity index 100% rename from engine/menu/scrolling_menu.asm rename to engine/menus/scrolling_menu.asm diff --git a/engine/menu/start_menu.asm b/engine/menus/start_menu.asm similarity index 100% rename from engine/menu/start_menu.asm rename to engine/menus/start_menu.asm diff --git a/engine/menu/trainer_card.asm b/engine/menus/trainer_card.asm similarity index 100% rename from engine/menu/trainer_card.asm rename to engine/menus/trainer_card.asm diff --git a/engine/routines/loadmappart.asm b/engine/overworld/loadmappart.asm similarity index 100% rename from engine/routines/loadmappart.asm rename to engine/overworld/loadmappart.asm diff --git a/engine/routines/getbreedmonlevelgrowth.asm b/engine/pokemon/getbreedmonlevelgrowth.asm similarity index 100% rename from engine/routines/getbreedmonlevelgrowth.asm rename to engine/pokemon/getbreedmonlevelgrowth.asm diff --git a/engine/routines/knowsmove.asm b/engine/pokemon/knowsmove.asm similarity index 100% rename from engine/routines/knowsmove.asm rename to engine/pokemon/knowsmove.asm diff --git a/engine/routines/leveluphappinessmod.asm b/engine/pokemon/leveluphappinessmod.asm similarity index 100% rename from engine/routines/leveluphappinessmod.asm rename to engine/pokemon/leveluphappinessmod.asm diff --git a/engine/menu/mon_menu.asm b/engine/pokemon/mon_menu.asm similarity index 100% rename from engine/menu/mon_menu.asm rename to engine/pokemon/mon_menu.asm diff --git a/engine/routines/switchpartymons.asm b/engine/pokemon/switchpartymons.asm similarity index 100% rename from engine/routines/switchpartymons.asm rename to engine/pokemon/switchpartymons.asm diff --git a/engine/menu/clock_reset.asm b/engine/rtc/clock_reset.asm similarity index 100% rename from engine/menu/clock_reset.asm rename to engine/rtc/clock_reset.asm diff --git a/engine/menu/delete_save_change_clock.asm b/engine/rtc/delete_save_change_clock.asm similarity index 100% rename from engine/menu/delete_save_change_clock.asm rename to engine/rtc/delete_save_change_clock.asm diff --git a/engine/routines/printhoursmins.asm b/engine/rtc/printhoursmins.asm similarity index 100% rename from engine/routines/printhoursmins.asm rename to engine/rtc/printhoursmins.asm diff --git a/engine/rtc.asm b/engine/rtc/rtc.asm similarity index 100% rename from engine/rtc.asm rename to engine/rtc/rtc.asm diff --git a/engine/menu/timeset.asm b/engine/rtc/timeset.asm similarity index 100% rename from engine/menu/timeset.asm rename to engine/rtc/timeset.asm diff --git a/main.asm b/main.asm index af4b61b75..6a5102545 100644 --- a/main.asm +++ b/main.asm @@ -32,30 +32,30 @@ INCLUDE "engine/events/specials.asm" INCLUDE "engine/routines/printnum.asm" INCLUDE "engine/pokemon/health.asm" INCLUDE "engine/events/overworld.asm" -INCLUDE "engine/items.asm" +INCLUDE "engine/items/items.asm" INCLUDE "engine/overworld/player_step.asm" INCLUDE "engine/battle/anim_hp_bar.asm" INCLUDE "engine/pokemon/move_mon.asm" INCLUDE "engine/pokemon/billspctop.asm" -INCLUDE "engine/routines/getbreedmonlevelgrowth.asm" +INCLUDE "engine/pokemon/getbreedmonlevelgrowth.asm" INCLUDE "engine/events/bug_contest/caught_mon.asm" -INCLUDE "engine/item_effects.asm" +INCLUDE "engine/items/item_effects.asm" INCLUDE "engine/battle_anims/getpokeballwobble.asm" -INCLUDE "engine/routines/knowsmove.asm" +INCLUDE "engine/pokemon/knowsmove.asm" SECTION "bank4", ROMX -INCLUDE "engine/menu/pack.asm" +INCLUDE "engine/items/pack.asm" INCLUDE "engine/overworld/time.asm" -INCLUDE "engine/menu/tmhm.asm" -INCLUDE "engine/menu/naming_screen.asm" +INCLUDE "engine/items/tmhm.asm" +INCLUDE "engine/menus/naming_screen.asm" INCLUDE "engine/events/misc_scripts.asm" INCLUDE "engine/events/heal_machine_anim.asm" INCLUDE "engine/events/whiteout.asm" INCLUDE "engine/events/forced_movement.asm" INCLUDE "engine/events/itemfinder.asm" -INCLUDE "engine/menu/start_menu.asm" +INCLUDE "engine/menus/start_menu.asm" INCLUDE "engine/overworld/select_menu.asm" INCLUDE "engine/events/elevator.asm" INCLUDE "engine/events/bug_contest/contest.asm" @@ -70,14 +70,14 @@ INCLUDE "engine/routines/getsquareroot.asm" SECTION "bank5", ROMX -INCLUDE "engine/rtc.asm" +INCLUDE "engine/rtc/rtc.asm" INCLUDE "engine/overworld/overworld.asm" INCLUDE "engine/overworld/tile_events.asm" INCLUDE "engine/save.asm" INCLUDE "engine/overworld/spawn_points.asm" INCLUDE "engine/overworld/map_setup.asm" INCLUDE "engine/events/pokecenter_pc.asm" -INCLUDE "engine/menu/mart.asm" +INCLUDE "engine/items/mart.asm" INCLUDE "engine/money.asm" INCLUDE "data/items/marts.asm" INCLUDE "engine/events/mom.asm" @@ -95,26 +95,26 @@ INCLUDE "engine/gfx/mapgroup_roofs.asm" SECTION "Clock Reset", ROMX -INCLUDE "engine/menu/clock_reset.asm" +INCLUDE "engine/rtc/clock_reset.asm" SECTION "bank9", ROMX INCLUDE "data/text_buffers.asm" -INCLUDE "engine/menu/menu.asm" -INCLUDE "engine/routines/updateitemdescription.asm" +INCLUDE "engine/menus/menu.asm" +INCLUDE "engine/items/updateitemdescription.asm" INCLUDE "engine/events/pokepic.asm" INCLUDE "engine/overworld/map_objects_2.asm" -INCLUDE "engine/menu/scrolling_menu.asm" -INCLUDE "engine/menu/switch_items.asm" -INCLUDE "engine/menu/menu_2.asm" -INCLUDE "engine/menu/mon_menu.asm" +INCLUDE "engine/menus/scrolling_menu.asm" +INCLUDE "engine/items/switch_items.asm" +INCLUDE "engine/menus/menu_2.asm" +INCLUDE "engine/pokemon/mon_menu.asm" INCLUDE "engine/battle/menu.asm" -INCLUDE "engine/menu/buy_sell_toss.asm" -INCLUDE "engine/menu/trainer_card.asm" +INCLUDE "engine/items/buy_sell_toss.asm" +INCLUDE "engine/menus/trainer_card.asm" INCLUDE "engine/events/prof_oaks_pc.asm" INCLUDE "engine/overworld/decorations.asm" -INCLUDE "engine/routines/leveluphappinessmod.asm" +INCLUDE "engine/pokemon/leveluphappinessmod.asm" INCLUDE "engine/battle/read_trainer_dvs.asm" INCLUDE "data/trainers/dvs.asm" INCLUDE "engine/battle/returntobattle_useball.asm" @@ -148,7 +148,7 @@ INCLUDE "engine/pokemon/tmhm.asm" INCLUDE "data/moves/descriptions.asm" INCLUDE "engine/events/pokerus/pokerus.asm" INCLUDE "engine/battle/start_battle.asm" -INCLUDE "engine/routines/placegraphic.asm" +INCLUDE "engine/gfx/placegraphic.asm" SECTION "Effect Commands", ROMX @@ -192,11 +192,11 @@ INCLUDE "engine/pokemon/mail.asm" SECTION "Crystal Features 1", ROMX INCLUDE "engine/init_gender.asm" -INCLUDE "engine/routines/drawkrispackgfx.asm" +INCLUDE "engine/gfx/drawkrispackgfx.asm" INCLUDE "engine/events/move_tutor.asm" INCLUDE "engine/gfx/crystal_layouts.asm" INCLUDE "engine/events/celebi.asm" -INCLUDE "engine/menu/main_menu.asm" +INCLUDE "engine/menus/main_menu.asm" INCLUDE "mobile/mobile_menu.asm" INCLUDE "engine/pokemon/search.asm" INCLUDE "mobile/mobile_12_2.asm" @@ -212,7 +212,7 @@ INCLUDE "engine/routines/emptyallsrambanks.asm" INCLUDE "engine/routines/savemenu_copytilemapatonce.asm" INCLUDE "engine/routines/checksave.asm" INCLUDE "data/maps/scenes.asm" -INCLUDE "engine/routines/loadmappart.asm" +INCLUDE "engine/overworld/loadmappart.asm" INCLUDE "engine/routines/phonering_copytilemapatonce.asm" Shrink1Pic: ; 4d249 @@ -222,10 +222,10 @@ Shrink2Pic: ; 4d2d9 INCBIN "gfx/new_game/shrink2.2bpp.lz" INCLUDE "engine/link/link_2.asm" -INCLUDE "engine/menu/delete_save_change_clock.asm" +INCLUDE "engine/rtc/delete_save_change_clock.asm" INCLUDE "data/tilesets.asm" INCLUDE "engine/routines/flagpredef.asm" -INCLUDE "engine/routines/trademonfrontpic.asm" +INCLUDE "engine/gfx/trademonfrontpic.asm" INCLUDE "engine/events/pokerus/check_pokerus.asm" INCLUDE "engine/events/lucky_number.asm" INCLUDE "engine/pokemon/caught_data.asm" @@ -257,7 +257,7 @@ INCLUDE "engine/routines/unreferenced_getgen1trainerclassname.asm" INCLUDE "engine/pokemon/mon_stats.asm" INCLUDE "engine/routines/initlist.asm" INCLUDE "engine/pokemon/experience.asm" -INCLUDE "engine/routines/switchpartymons.asm" +INCLUDE "engine/pokemon/switchpartymons.asm" INCLUDE "engine/gfx/load_pics.asm" INCLUDE "engine/pokemon/move_mon_wo_mail.asm" INCLUDE "data/pokemon/base_stats.asm" @@ -316,10 +316,10 @@ INCLUDE "engine/gfx/mon_icons.asm" SECTION "bank24", ROMX INCLUDE "engine/phone/phone.asm" -INCLUDE "engine/menu/timeset.asm" +INCLUDE "engine/rtc/timeset.asm" INCLUDE "engine/pokegear/pokegear.asm" INCLUDE "engine/events/fish.asm" -INCLUDE "engine/game/slot_machine.asm" +INCLUDE "engine/games/slot_machine.asm" SECTION "Phone Engine", ROMX @@ -430,9 +430,9 @@ INCLUDE "gfx/pokemon/unown_frames.asm" SECTION "bank38", ROMX INCLUDE "engine/events/print_unown_2.asm" -INCLUDE "engine/game/card_flip.asm" -INCLUDE "engine/game/unown_puzzle.asm" -INCLUDE "engine/game/dummy_game.asm" +INCLUDE "engine/games/card_flip.asm" +INCLUDE "engine/games/unown_puzzle.asm" +INCLUDE "engine/games/dummy_game.asm" INCLUDE "engine/pokemon/billspc.asm" @@ -441,7 +441,7 @@ SECTION "bank39", ROMX CopyrightGFX:: ; e4000 INCBIN "gfx/splash/copyright.2bpp" -INCLUDE "engine/menu/options_menu.asm" +INCLUDE "engine/menus/options_menu.asm" INCLUDE "engine/title/crystal_intro.asm" @@ -477,7 +477,7 @@ INCLUDE "engine/overworld/warp_connection.asm" INCLUDE "engine/link/mystery_gift.asm" INCLUDE "engine/battle/used_move_text.asm" INCLUDE "mobile/mobile_41.asm" -INCLUDE "engine/routines/loadoverworldfont.asm" +INCLUDE "engine/gfx/loadoverworldfont.asm" SECTION "Mobile 42", ROMX @@ -566,7 +566,7 @@ INCLUDE "data/phone/text/trainers.asm" SECTION "Miscellaneous Text", ROMX INCLUDE "data/items/names.asm" -INCLUDE "engine/routines/printitemdescription.asm" +INCLUDE "engine/items/printitemdescription.asm" INCLUDE "data/items/descriptions.asm" INCLUDE "data/moves/names.asm" INCLUDE "engine/overworld/landmarks.asm" @@ -582,7 +582,7 @@ INCLUDE "engine/printer/print_party.asm" SECTION "bank77_2", ROMX -INCLUDE "engine/routines/printhoursmins.asm" +INCLUDE "engine/rtc/printhoursmins.asm" INCLUDE "engine/events/diploma.asm" INCLUDE "engine/pokedex/pokedex_3.asm" INCLUDE "engine/events/catch_tutorial_input.asm" From 60e21a86638cad5fd25133cda1c545461304d902 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 14 Mar 2018 13:38:36 +0100 Subject: [PATCH 03/16] Move init_gender and intro_menu to menus They are actually some kind of menus, and as such make sense there. --- engine/{ => menus}/init_gender.asm | 0 engine/{ => menus}/intro_menu.asm | 0 main.asm | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename engine/{ => menus}/init_gender.asm (100%) rename engine/{ => menus}/intro_menu.asm (100%) diff --git a/engine/init_gender.asm b/engine/menus/init_gender.asm similarity index 100% rename from engine/init_gender.asm rename to engine/menus/init_gender.asm diff --git a/engine/intro_menu.asm b/engine/menus/intro_menu.asm similarity index 100% rename from engine/intro_menu.asm rename to engine/menus/intro_menu.asm diff --git a/main.asm b/main.asm index 6a5102545..7c5610e5f 100644 --- a/main.asm +++ b/main.asm @@ -6,7 +6,7 @@ SECTION "bank1", ROMX INCLUDE "engine/routines/placewaitingtext.asm" INCLUDE "engine/routines/loadpushoam.asm" INCLUDE "engine/overworld/map_objects.asm" -INCLUDE "engine/intro_menu.asm" +INCLUDE "engine/menus/intro_menu.asm" INCLUDE "engine/overworld/init_map.asm" INCLUDE "engine/pokemon/learn.asm" INCLUDE "engine/routines/checknickerrors.asm" @@ -191,7 +191,7 @@ INCLUDE "engine/pokemon/mail.asm" SECTION "Crystal Features 1", ROMX -INCLUDE "engine/init_gender.asm" +INCLUDE "engine/menus/init_gender.asm" INCLUDE "engine/gfx/drawkrispackgfx.asm" INCLUDE "engine/events/move_tutor.asm" INCLUDE "engine/gfx/crystal_layouts.asm" From 0d9241889fc8a2f047b9fd6db25e55de1e721877 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 25 Mar 2018 16:18:33 +0200 Subject: [PATCH 04/16] Organize the engine/ directory, take 3 Renamed `title` to `movies`. Moved some functions from `engine/routines/` to their fitting directories, and cleaned up the base `engine/` directory. Moved `engine/pokemon/tmhm.asm` back to `engine/items/`. Made a new subdirectory: * engine/tilesets: Contains all map-related graphics routines. --- Makefile | 2 +- engine/{routines => events}/checksave.asm | 0 engine/{routines => events}/checktime.asm | 0 engine/{ => events}/engine_flags.asm | 0 engine/{ => events}/money.asm | 0 engine/{routines => events}/playslowcry.asm | 0 engine/gfx/crystal_layouts.asm | 2 +- engine/{ => gfx}/dma_transfer.asm | 0 engine/{routines => gfx}/loadpushoam.asm | 0 engine/items/tmhm.asm | 596 +++++++++++++++++- engine/items/tmhm2.asm | 49 ++ engine/link/link.asm | 2 +- .../{routines => link}/placewaitingtext.asm | 0 engine/{ => menus}/debug.asm | 0 engine/{ => menus}/save.asm | 0 .../savemenu_copytilemapatonce.asm | 0 engine/{title => movie}/credits.asm | 0 engine/{title => movie}/crystal_intro.asm | 0 engine/{gfx => movie}/evolution_animation.asm | 0 engine/{gfx => movie}/gbc_only.asm | 0 engine/{title => movie}/init_hof_credits.asm | 0 engine/{title => movie}/title.asm | 0 engine/{gfx => movie}/trade_animation.asm | 0 engine/{title => movie}/unused_title.asm | 0 .../phonering_copytilemapatonce.asm | 0 .../townmap_convertlinebreakcharacters.asm | 0 .../{routines => pokemon}/checknickerrors.asm | 0 .../correcterrorsinplayerparty.asm | 0 engine/pokemon/tmhm.asm | 589 ----------------- engine/{ => routines}/predef.asm | 0 engine/{gfx => tilesets}/map_palettes.asm | 0 engine/{gfx => tilesets}/mapgroup_roofs.asm | 0 engine/{gfx => tilesets}/tileset_anims.asm | 0 engine/{gfx => tilesets}/tileset_palettes.asm | 0 engine/{gfx => tilesets}/timeofdaypals.asm | 0 main.asm | 56 +- 36 files changed, 648 insertions(+), 648 deletions(-) rename engine/{routines => events}/checksave.asm (100%) rename engine/{routines => events}/checktime.asm (100%) rename engine/{ => events}/engine_flags.asm (100%) rename engine/{ => events}/money.asm (100%) rename engine/{routines => events}/playslowcry.asm (100%) rename engine/{ => gfx}/dma_transfer.asm (100%) rename engine/{routines => gfx}/loadpushoam.asm (100%) create mode 100755 engine/items/tmhm2.asm rename engine/{routines => link}/placewaitingtext.asm (100%) rename engine/{ => menus}/debug.asm (100%) rename engine/{ => menus}/save.asm (100%) rename engine/{routines => menus}/savemenu_copytilemapatonce.asm (100%) rename engine/{title => movie}/credits.asm (100%) rename engine/{title => movie}/crystal_intro.asm (100%) rename engine/{gfx => movie}/evolution_animation.asm (100%) rename engine/{gfx => movie}/gbc_only.asm (100%) rename engine/{title => movie}/init_hof_credits.asm (100%) rename engine/{title => movie}/title.asm (100%) rename engine/{gfx => movie}/trade_animation.asm (100%) rename engine/{title => movie}/unused_title.asm (100%) rename engine/{routines => phone}/phonering_copytilemapatonce.asm (100%) rename engine/{routines => pokegear}/townmap_convertlinebreakcharacters.asm (100%) rename engine/{routines => pokemon}/checknickerrors.asm (100%) rename engine/{routines => pokemon}/correcterrorsinplayerparty.asm (100%) delete mode 100755 engine/pokemon/tmhm.asm rename engine/{ => routines}/predef.asm (100%) rename engine/{gfx => tilesets}/map_palettes.asm (100%) rename engine/{gfx => tilesets}/mapgroup_roofs.asm (100%) rename engine/{gfx => tilesets}/tileset_anims.asm (100%) rename engine/{gfx => tilesets}/tileset_palettes.asm (100%) rename engine/{gfx => tilesets}/timeofdaypals.asm (100%) diff --git a/Makefile b/Makefile index cb2c366d0..14235ff3b 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ data/maps/map_data.o \ data/pokemon/dex_entries.o \ data/pokemon/egg_moves.o \ data/pokemon/evos_attacks.o \ -engine/title/credits.o \ +engine/movie/credits.o \ engine/overworld/events.o \ gfx/pics.o \ gfx/sprites.o \ diff --git a/engine/routines/checksave.asm b/engine/events/checksave.asm similarity index 100% rename from engine/routines/checksave.asm rename to engine/events/checksave.asm diff --git a/engine/routines/checktime.asm b/engine/events/checktime.asm similarity index 100% rename from engine/routines/checktime.asm rename to engine/events/checktime.asm diff --git a/engine/engine_flags.asm b/engine/events/engine_flags.asm similarity index 100% rename from engine/engine_flags.asm rename to engine/events/engine_flags.asm diff --git a/engine/money.asm b/engine/events/money.asm similarity index 100% rename from engine/money.asm rename to engine/events/money.asm diff --git a/engine/routines/playslowcry.asm b/engine/events/playslowcry.asm similarity index 100% rename from engine/routines/playslowcry.asm rename to engine/events/playslowcry.asm diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm index 0133916e5..71e2e4f56 100755 --- a/engine/gfx/crystal_layouts.asm +++ b/engine/gfx/crystal_layouts.asm @@ -203,7 +203,7 @@ Function49496: ; 49496 ret ; 494ac -INCLUDE "engine/gfx/tileset_palettes.asm" +INCLUDE "engine/tilesets/tileset_palettes.asm" MG_Mobile_Layout02: ; 49706 ld hl, .Palette_49732 diff --git a/engine/dma_transfer.asm b/engine/gfx/dma_transfer.asm similarity index 100% rename from engine/dma_transfer.asm rename to engine/gfx/dma_transfer.asm diff --git a/engine/routines/loadpushoam.asm b/engine/gfx/loadpushoam.asm similarity index 100% rename from engine/routines/loadpushoam.asm rename to engine/gfx/loadpushoam.asm diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index 9db3dc291..442f73cfa 100755 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -1,49 +1,589 @@ -CanLearnTMHMMove: ; 11639 - ld a, [wCurPartySpecies] - ld [wCurSpecies], a - call GetBaseData - ld hl, wBaseTMHM - push hl +TMHMPocket: ; 2c76f (b:476f) + ld a, $1 + ld [hInMenu], a + call TMHM_PocketLoop + ld a, $0 + ld [hInMenu], a + ret nc + call PlaceHollowCursor + call WaitBGMap + ld a, [wCurItem] + dec a + ld [wCurItemQuantity], a + ld hl, wTMsHMs + ld c, a + ld b, 0 + add hl, bc + ld a, [hl] + ld [wItemQuantityBuffer], a + call .ConvertItemToTMHMNumber + scf + ret - ld a, [wPutativeTMHMMove] +.ConvertItemToTMHMNumber: ; 2c798 (b:4798) + ld a, [wCurItem] + ld c, a + callfar GetNumberedTMHM + ld a, c + ld [wCurItem], a + ret + +ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7) + ld a, [wCurItem] + ld c, a + callfar GetTMHMNumber + ld a, c + ld [wCurTMHM], a + ret + +GetTMHMItemMove: ; 2c7b6 (b:47b6) + call ConvertCurItemIntoCurTMHM + predef GetTMHMMove + ret + +AskTeachTMHM: ; 2c7bf (b:47bf) + ld hl, wOptions + ld a, [hl] + push af + res NO_TEXT_SCROLL, [hl] + ld a, [wCurItem] + cp TM01 + jr c, .NotTMHM + call GetTMHMItemMove + ld a, [wCurTMHM] + ld [wPutativeTMHMMove], a + call GetMoveName + call CopyName1 + ld hl, Text_BootedTM ; Booted up a TM + ld a, [wCurItem] + cp HM01 + jr c, .TM + ld hl, Text_BootedHM ; Booted up an HM +.TM: + call PrintText + ld hl, Text_ItContained + call PrintText + call YesNoBox +.NotTMHM: + pop bc + ld a, b + ld [wOptions], a + ret + +ChooseMonToLearnTMHM: ; 2c7fb + ld hl, wStringBuffer2 + ld de, wTMHMMoveNameBackup + ld bc, 12 + call CopyBytes + call ClearBGPalettes +ChooseMonToLearnTMHM_NoRefresh: ; 2c80a + farcall LoadPartyMenuGFX + farcall InitPartyMenuWithCancel + farcall InitPartyMenuGFX + ld a, PARTYMENUACTION_TEACH_TMHM + ld [wPartyMenuActionText], a +.loopback + farcall WritePartyMenuTilemap + farcall PrintPartyMenuText + call WaitBGMap + call SetPalettes + call DelayFrame + farcall PartyMenuSelect + push af + ld a, [wCurPartySpecies] + cp EGG + pop bc ; now contains the former contents of af + jr z, .egg + push bc + ld hl, wTMHMMoveNameBackup + ld de, wStringBuffer2 + ld bc, 12 + call CopyBytes + pop af ; now contains the original contents of af + ret + +.egg + push hl + push de + push bc + push af + ld de, SFX_WRONG + call PlaySFX + call WaitSFX + pop af + pop bc + pop de + pop hl + jr .loopback +; 2c867 + +TeachTMHM: ; 2c867 + predef CanLearnTMHMMove + + push bc + ld a, [wCurPartyMon] + ld hl, wPartyMonNicknames + call GetNick + pop bc + + ld a, c + and a + jr nz, .compatible + push de + ld de, SFX_WRONG + call PlaySFX + pop de + ld hl, Text_TMHMNotCompatible + call PrintText + jr .nope + +.compatible + callfar KnowsMove + jr c, .nope + + predef LearnMove + ld a, b + and a + jr z, .nope + + farcall StubbedTrainerRankings_TMsHMsTaught + ld a, [wCurItem] + call IsHM + ret c + + ld c, HAPPINESS_LEARNMOVE + callfar ChangeHappiness + call ConsumeTM + jr .learned_move + +.nope + and a + ret + +.unused + ld a, 2 + ld [wItemEffectSucceeded], a +.learned_move + scf + ret +; 2c8bf (b:48bf) + +Text_BootedTM: ; 0x2c8bf + ; Booted up a TM. + text_jump UnknownText_0x1c0373 + db "@" +; 0x2c8c4 + +Text_BootedHM: ; 0x2c8c4 + ; Booted up an HM. + text_jump UnknownText_0x1c0384 + db "@" +; 0x2c8c9 + +Text_ItContained: ; 0x2c8c9 + ; It contained @ . Teach @ to a #MON? + text_jump UnknownText_0x1c0396 + db "@" +; 0x2c8ce + +Text_TMHMNotCompatible: ; 0x2c8ce + ; is not compatible with @ . It can't learn @ . + text_jump UnknownText_0x1c03c2 + db "@" +; 0x2c8d3 + +TMHM_PocketLoop: ; 2c8d3 (b:48d3) + xor a + ld [hBGMapMode], a + call TMHM_DisplayPocketItems + ld a, 2 + ld [w2DMenuCursorInitY], a + ld a, 7 + ld [w2DMenuCursorInitX], a + ld a, 1 + ld [w2DMenuNumCols], a + ld a, 5 + sub d + inc a + cp 6 + jr nz, .okay + dec a +.okay + ld [w2DMenuNumRows], a + ld a, $c + ld [w2DMenuFlags1], a + xor a + ld [w2DMenuFlags2], a + ld a, $20 + ld [w2DMenuCursorOffsets], a + ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN | D_LEFT | D_RIGHT + ld [wMenuJoypadFilter], a + ld a, [wTMHMPocketCursor] + inc a + ld [wMenuCursorY], a + ld a, $1 + ld [wMenuCursorX], a + jr TMHM_ShowTMMoveDescription + +TMHM_JoypadLoop: ; 2c915 (b:4915) + call TMHM_DisplayPocketItems + call StaticMenuJoypad + ld b, a + ld a, [wMenuCursorY] + dec a + ld [wTMHMPocketCursor], a + xor a + ld [hBGMapMode], a + ld a, [w2DMenuFlags2] + bit 7, a + jp nz, TMHM_ScrollPocket + ld a, b + ld [wMenuJoypad], a + bit A_BUTTON_F, a + jp nz, TMHM_ChooseTMorHM + bit B_BUTTON_F, a + jp nz, TMHM_ExitPack + bit D_RIGHT_F, a + jp nz, TMHM_ExitPocket + bit D_LEFT_F, a + jp nz, TMHM_ExitPocket +TMHM_ShowTMMoveDescription: ; 2c946 (b:4946) + call TMHM_CheckHoveringOverCancel + jp nc, TMHM_ExitPocket + hlcoord 0, 12 + ld b, 4 + ld c, SCREEN_WIDTH - 2 + call TextBox + ld a, [wCurItem] + cp NUM_TMS + NUM_HMS + 1 + jr nc, TMHM_JoypadLoop + ld [wd265], a + predef GetTMHMMove + ld a, [wd265] + ld [wCurSpecies], a + hlcoord 1, 14 + call PrintMoveDesc + jp TMHM_JoypadLoop + +TMHM_ChooseTMorHM: ; 2c974 (b:4974) + call TMHM_PlaySFX_ReadText2 + call CountTMsHMs ; This stores the count to wd265. + ld a, [wMenuCursorY] + dec a + ld b, a + ld a, [wTMHMPocketScrollPosition] + add b + ld b, a + ld a, [wd265] + cp b + jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL +TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a) + call TMHM_GetCurrentPocketPosition + ld a, [wMenuCursorY] ld b, a - ld c, 0 - ld hl, TMHMMoves .loop + inc c + ld a, c + cp NUM_TMS + NUM_HMS + 1 + jr nc, .okay ld a, [hli] and a - jr z, .end - cp b - jr z, .asm_11659 - inc c - jr .loop + jr z, .loop + dec b + jr nz, .loop + ld a, c +.okay + ld [wCurItem], a + cp -1 + ret -.asm_11659 - pop hl - ld b, CHECK_FLAG +TMHM_ExitPack: ; 2c9a5 (b:49a5) + call TMHM_PlaySFX_ReadText2 +_TMHM_ExitPack: ; 2c9a8 (b:49a8) + ld a, $2 + ld [wMenuJoypad], a + and a + ret + +TMHM_ExitPocket: ; 2c9af (b:49af) + and a + ret + +TMHM_ScrollPocket: ; 2c9b1 (b:49b1) + ld a, b + bit 7, a + jr nz, .skip + ld hl, wTMHMPocketScrollPosition + ld a, [hl] + and a + jp z, TMHM_JoypadLoop + dec [hl] + call TMHM_DisplayPocketItems + jp TMHM_ShowTMMoveDescription + +.skip + call TMHM_GetCurrentPocketPosition + ld b, 5 +.loop + inc c + ld a, c + cp NUM_TMS + NUM_HMS + 1 + jp nc, TMHM_JoypadLoop + ld a, [hli] + and a + jr z, .loop + dec b + jr nz, .loop + ld hl, wTMHMPocketScrollPosition + inc [hl] + call TMHM_DisplayPocketItems + jp TMHM_ShowTMMoveDescription + +TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2) + ld a, [wBattleType] + cp BATTLETYPE_TUTORIAL + jp z, Tutorial_TMHMPocket + + hlcoord 5, 2 + lb bc, 10, 15 + ld a, " " + call ClearBox + call TMHM_GetCurrentPocketPosition + ld d, $5 +.loop2 + inc c + ld a, c + cp NUM_TMS + NUM_HMS + 1 + jr nc, .NotTMHM + ld a, [hli] + and a + jr z, .loop2 + ld b, a + ld a, c + ld [wd265], a + push hl push de - ld d, 0 - predef SmallFarFlagAction + push bc + call TMHMPocket_GetCurrentLineCoord + push hl + ld a, [wd265] + cp NUM_TMS + 1 + jr nc, .HM + ld de, wd265 + lb bc, PRINTNUM_LEADINGZEROS | 1, 2 + call PrintNum + jr .okay + +.HM: + push af + sub NUM_TMS + ld [wd265], a + ld [hl], "H" + inc hl + ld de, wd265 + lb bc, PRINTNUM_RIGHTALIGN | 1, 2 + call PrintNum + pop af + ld [wd265], a +.okay + predef GetTMHMMove + ld a, [wd265] + ld [wPutativeTMHMMove], a + call GetMoveName + pop hl + ld bc, 3 + add hl, bc + push hl + call PlaceString + pop hl + pop bc + ld a, c + push bc + cp NUM_TMS + 1 + jr nc, .hm2 + ld bc, SCREEN_WIDTH + 9 + add hl, bc + ld [hl], "×" + inc hl + ld a, "0" ; why are we doing this? + pop bc + push bc + ld a, b + ld [wd265], a + ld de, wd265 + lb bc, 1, 2 + call PrintNum +.hm2 + pop bc + pop de + pop hl + dec d + jr nz, .loop2 + jr .done + +.NotTMHM: + call TMHMPocket_GetCurrentLineCoord + inc hl + inc hl + inc hl + push de + ld de, TMHM_String_Cancel + call PlaceString + pop de +.done + ret + +TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86) + hlcoord 5, 0 + ld bc, 2 * SCREEN_WIDTH + ld a, 6 + sub d + ld e, a + ; AddNTimes +.loop + add hl, bc + dec e + jr nz, .loop + ret +; 2ca95 (b:4a95) + +Unreferenced_Function2ca95: ; 2ca95 + pop hl + ld bc, 3 + add hl, bc + predef GetTMHMMove + ld a, [wd265] + ld [wPutativeTMHMMove], a + call GetMoveName + push hl + call PlaceString + pop hl + ret +; 2caae + +TMHM_String_Cancel: ; 2caae + db "CANCEL@" +; 2cab5 + +TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5) + ld hl, wTMsHMs + ld a, [wTMHMPocketScrollPosition] + ld b, a + inc b + ld c, 0 +.loop + inc c + ld a, [hli] + and a + jr z, .loop + dec b + jr nz, .loop + dec hl + dec c + ret + +Tutorial_TMHMPocket: ; 2caca (b:4aca) + hlcoord 9, 3 + push de + ld de, TMHM_String_Cancel + call PlaceString pop de ret -.end - pop hl - ld c, 0 +TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6) + push de + ld de, SFX_READ_TEXT_2 + call PlaySFX + pop de ret -; 1166a +; 2cadf (b:4adf) -GetTMHMMove: ; 1166a +Unreferenced_Function2cadf: ; 2cadf + call ConvertCurItemIntoCurTMHM + call .CheckHaveRoomForTMHM + ld hl, .NoRoomText + jr nc, .print + ld hl, .ReceivedText +.print + jp PrintText +; 2caf0 + +.NoRoomText: ; 0x2caf0 + ; You have no room for any more @ S. + text_jump UnknownText_0x1c03fa + db "@" +; 0x2caf5 + +.ReceivedText: ; 0x2caf5 + ; You received @ ! + text_jump UnknownText_0x1c0421 + db "@" +; 0x2cafa + +.CheckHaveRoomForTMHM: ; 2cafa ld a, [wd265] dec a - ld hl, TMHMMoves + ld hl, wTMsHMs ld b, 0 ld c, a add hl, bc ld a, [hl] + inc a + cp NUM_TMS * 2 + ret nc + ld [hl], a + ret +; 2cb0c + +ConsumeTM: ; 2cb0c (b:4b0c) + call ConvertCurItemIntoCurTMHM + ld a, [wd265] + dec a + ld hl, wTMsHMs + ld b, 0 + ld c, a + add hl, bc + ld a, [hl] + and a + ret z + dec a + ld [hl], a + ret nz + ld a, [wTMHMPocketScrollPosition] + and a + ret z + dec a + ld [wTMHMPocketScrollPosition], a + ret + +CountTMsHMs: ; 2cb2a (b:4b2a) + ld b, 0 + ld c, NUM_TMS + NUM_HMS + ld hl, wTMsHMs +.loop + ld a, [hli] + and a + jr z, .skip + inc b +.skip + dec c + jr nz, .loop + ld a, b ld [wd265], a ret -; 1167a - -INCLUDE "data/moves/tmhm_moves.asm" +PrintMoveDesc: ; 2cb3e + push hl + ld hl, MoveDescriptions + ld a, [wCurSpecies] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld e, a + ld d, [hl] + pop hl + jp PlaceString +; 2cb52 diff --git a/engine/items/tmhm2.asm b/engine/items/tmhm2.asm new file mode 100755 index 000000000..9db3dc291 --- /dev/null +++ b/engine/items/tmhm2.asm @@ -0,0 +1,49 @@ +CanLearnTMHMMove: ; 11639 + ld a, [wCurPartySpecies] + ld [wCurSpecies], a + call GetBaseData + ld hl, wBaseTMHM + push hl + + ld a, [wPutativeTMHMMove] + ld b, a + ld c, 0 + ld hl, TMHMMoves +.loop + ld a, [hli] + and a + jr z, .end + cp b + jr z, .asm_11659 + inc c + jr .loop + +.asm_11659 + pop hl + ld b, CHECK_FLAG + push de + ld d, 0 + predef SmallFarFlagAction + pop de + ret + +.end + pop hl + ld c, 0 + ret +; 1166a + +GetTMHMMove: ; 1166a + ld a, [wd265] + dec a + ld hl, TMHMMoves + ld b, 0 + ld c, a + add hl, bc + ld a, [hl] + ld [wd265], a + ret +; 1167a + + +INCLUDE "data/moves/tmhm_moves.asm" diff --git a/engine/link/link.asm b/engine/link/link.asm index 86af41c01..f6f37619f 100755 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -2029,7 +2029,7 @@ Unreferenced_Function28f09: ; 28f09 ret ; 28f24 -INCLUDE "engine/gfx/trade_animation.asm" +INCLUDE "engine/movie/trade_animation.asm" CheckTimeCapsuleCompatibility: ; 29bfb ; Checks to see if your party is compatible with the Gen 1 games. diff --git a/engine/routines/placewaitingtext.asm b/engine/link/placewaitingtext.asm similarity index 100% rename from engine/routines/placewaitingtext.asm rename to engine/link/placewaitingtext.asm diff --git a/engine/debug.asm b/engine/menus/debug.asm similarity index 100% rename from engine/debug.asm rename to engine/menus/debug.asm diff --git a/engine/save.asm b/engine/menus/save.asm similarity index 100% rename from engine/save.asm rename to engine/menus/save.asm diff --git a/engine/routines/savemenu_copytilemapatonce.asm b/engine/menus/savemenu_copytilemapatonce.asm similarity index 100% rename from engine/routines/savemenu_copytilemapatonce.asm rename to engine/menus/savemenu_copytilemapatonce.asm diff --git a/engine/title/credits.asm b/engine/movie/credits.asm similarity index 100% rename from engine/title/credits.asm rename to engine/movie/credits.asm diff --git a/engine/title/crystal_intro.asm b/engine/movie/crystal_intro.asm similarity index 100% rename from engine/title/crystal_intro.asm rename to engine/movie/crystal_intro.asm diff --git a/engine/gfx/evolution_animation.asm b/engine/movie/evolution_animation.asm similarity index 100% rename from engine/gfx/evolution_animation.asm rename to engine/movie/evolution_animation.asm diff --git a/engine/gfx/gbc_only.asm b/engine/movie/gbc_only.asm similarity index 100% rename from engine/gfx/gbc_only.asm rename to engine/movie/gbc_only.asm diff --git a/engine/title/init_hof_credits.asm b/engine/movie/init_hof_credits.asm similarity index 100% rename from engine/title/init_hof_credits.asm rename to engine/movie/init_hof_credits.asm diff --git a/engine/title/title.asm b/engine/movie/title.asm similarity index 100% rename from engine/title/title.asm rename to engine/movie/title.asm diff --git a/engine/gfx/trade_animation.asm b/engine/movie/trade_animation.asm similarity index 100% rename from engine/gfx/trade_animation.asm rename to engine/movie/trade_animation.asm diff --git a/engine/title/unused_title.asm b/engine/movie/unused_title.asm similarity index 100% rename from engine/title/unused_title.asm rename to engine/movie/unused_title.asm diff --git a/engine/routines/phonering_copytilemapatonce.asm b/engine/phone/phonering_copytilemapatonce.asm similarity index 100% rename from engine/routines/phonering_copytilemapatonce.asm rename to engine/phone/phonering_copytilemapatonce.asm diff --git a/engine/routines/townmap_convertlinebreakcharacters.asm b/engine/pokegear/townmap_convertlinebreakcharacters.asm similarity index 100% rename from engine/routines/townmap_convertlinebreakcharacters.asm rename to engine/pokegear/townmap_convertlinebreakcharacters.asm diff --git a/engine/routines/checknickerrors.asm b/engine/pokemon/checknickerrors.asm similarity index 100% rename from engine/routines/checknickerrors.asm rename to engine/pokemon/checknickerrors.asm diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/pokemon/correcterrorsinplayerparty.asm similarity index 100% rename from engine/routines/correcterrorsinplayerparty.asm rename to engine/pokemon/correcterrorsinplayerparty.asm diff --git a/engine/pokemon/tmhm.asm b/engine/pokemon/tmhm.asm deleted file mode 100755 index 442f73cfa..000000000 --- a/engine/pokemon/tmhm.asm +++ /dev/null @@ -1,589 +0,0 @@ -TMHMPocket: ; 2c76f (b:476f) - ld a, $1 - ld [hInMenu], a - call TMHM_PocketLoop - ld a, $0 - ld [hInMenu], a - ret nc - call PlaceHollowCursor - call WaitBGMap - ld a, [wCurItem] - dec a - ld [wCurItemQuantity], a - ld hl, wTMsHMs - ld c, a - ld b, 0 - add hl, bc - ld a, [hl] - ld [wItemQuantityBuffer], a - call .ConvertItemToTMHMNumber - scf - ret - -.ConvertItemToTMHMNumber: ; 2c798 (b:4798) - ld a, [wCurItem] - ld c, a - callfar GetNumberedTMHM - ld a, c - ld [wCurItem], a - ret - -ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7) - ld a, [wCurItem] - ld c, a - callfar GetTMHMNumber - ld a, c - ld [wCurTMHM], a - ret - -GetTMHMItemMove: ; 2c7b6 (b:47b6) - call ConvertCurItemIntoCurTMHM - predef GetTMHMMove - ret - -AskTeachTMHM: ; 2c7bf (b:47bf) - ld hl, wOptions - ld a, [hl] - push af - res NO_TEXT_SCROLL, [hl] - ld a, [wCurItem] - cp TM01 - jr c, .NotTMHM - call GetTMHMItemMove - ld a, [wCurTMHM] - ld [wPutativeTMHMMove], a - call GetMoveName - call CopyName1 - ld hl, Text_BootedTM ; Booted up a TM - ld a, [wCurItem] - cp HM01 - jr c, .TM - ld hl, Text_BootedHM ; Booted up an HM -.TM: - call PrintText - ld hl, Text_ItContained - call PrintText - call YesNoBox -.NotTMHM: - pop bc - ld a, b - ld [wOptions], a - ret - -ChooseMonToLearnTMHM: ; 2c7fb - ld hl, wStringBuffer2 - ld de, wTMHMMoveNameBackup - ld bc, 12 - call CopyBytes - call ClearBGPalettes -ChooseMonToLearnTMHM_NoRefresh: ; 2c80a - farcall LoadPartyMenuGFX - farcall InitPartyMenuWithCancel - farcall InitPartyMenuGFX - ld a, PARTYMENUACTION_TEACH_TMHM - ld [wPartyMenuActionText], a -.loopback - farcall WritePartyMenuTilemap - farcall PrintPartyMenuText - call WaitBGMap - call SetPalettes - call DelayFrame - farcall PartyMenuSelect - push af - ld a, [wCurPartySpecies] - cp EGG - pop bc ; now contains the former contents of af - jr z, .egg - push bc - ld hl, wTMHMMoveNameBackup - ld de, wStringBuffer2 - ld bc, 12 - call CopyBytes - pop af ; now contains the original contents of af - ret - -.egg - push hl - push de - push bc - push af - ld de, SFX_WRONG - call PlaySFX - call WaitSFX - pop af - pop bc - pop de - pop hl - jr .loopback -; 2c867 - -TeachTMHM: ; 2c867 - predef CanLearnTMHMMove - - push bc - ld a, [wCurPartyMon] - ld hl, wPartyMonNicknames - call GetNick - pop bc - - ld a, c - and a - jr nz, .compatible - push de - ld de, SFX_WRONG - call PlaySFX - pop de - ld hl, Text_TMHMNotCompatible - call PrintText - jr .nope - -.compatible - callfar KnowsMove - jr c, .nope - - predef LearnMove - ld a, b - and a - jr z, .nope - - farcall StubbedTrainerRankings_TMsHMsTaught - ld a, [wCurItem] - call IsHM - ret c - - ld c, HAPPINESS_LEARNMOVE - callfar ChangeHappiness - call ConsumeTM - jr .learned_move - -.nope - and a - ret - -.unused - ld a, 2 - ld [wItemEffectSucceeded], a -.learned_move - scf - ret -; 2c8bf (b:48bf) - -Text_BootedTM: ; 0x2c8bf - ; Booted up a TM. - text_jump UnknownText_0x1c0373 - db "@" -; 0x2c8c4 - -Text_BootedHM: ; 0x2c8c4 - ; Booted up an HM. - text_jump UnknownText_0x1c0384 - db "@" -; 0x2c8c9 - -Text_ItContained: ; 0x2c8c9 - ; It contained @ . Teach @ to a #MON? - text_jump UnknownText_0x1c0396 - db "@" -; 0x2c8ce - -Text_TMHMNotCompatible: ; 0x2c8ce - ; is not compatible with @ . It can't learn @ . - text_jump UnknownText_0x1c03c2 - db "@" -; 0x2c8d3 - -TMHM_PocketLoop: ; 2c8d3 (b:48d3) - xor a - ld [hBGMapMode], a - call TMHM_DisplayPocketItems - ld a, 2 - ld [w2DMenuCursorInitY], a - ld a, 7 - ld [w2DMenuCursorInitX], a - ld a, 1 - ld [w2DMenuNumCols], a - ld a, 5 - sub d - inc a - cp 6 - jr nz, .okay - dec a -.okay - ld [w2DMenuNumRows], a - ld a, $c - ld [w2DMenuFlags1], a - xor a - ld [w2DMenuFlags2], a - ld a, $20 - ld [w2DMenuCursorOffsets], a - ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN | D_LEFT | D_RIGHT - ld [wMenuJoypadFilter], a - ld a, [wTMHMPocketCursor] - inc a - ld [wMenuCursorY], a - ld a, $1 - ld [wMenuCursorX], a - jr TMHM_ShowTMMoveDescription - -TMHM_JoypadLoop: ; 2c915 (b:4915) - call TMHM_DisplayPocketItems - call StaticMenuJoypad - ld b, a - ld a, [wMenuCursorY] - dec a - ld [wTMHMPocketCursor], a - xor a - ld [hBGMapMode], a - ld a, [w2DMenuFlags2] - bit 7, a - jp nz, TMHM_ScrollPocket - ld a, b - ld [wMenuJoypad], a - bit A_BUTTON_F, a - jp nz, TMHM_ChooseTMorHM - bit B_BUTTON_F, a - jp nz, TMHM_ExitPack - bit D_RIGHT_F, a - jp nz, TMHM_ExitPocket - bit D_LEFT_F, a - jp nz, TMHM_ExitPocket -TMHM_ShowTMMoveDescription: ; 2c946 (b:4946) - call TMHM_CheckHoveringOverCancel - jp nc, TMHM_ExitPocket - hlcoord 0, 12 - ld b, 4 - ld c, SCREEN_WIDTH - 2 - call TextBox - ld a, [wCurItem] - cp NUM_TMS + NUM_HMS + 1 - jr nc, TMHM_JoypadLoop - ld [wd265], a - predef GetTMHMMove - ld a, [wd265] - ld [wCurSpecies], a - hlcoord 1, 14 - call PrintMoveDesc - jp TMHM_JoypadLoop - -TMHM_ChooseTMorHM: ; 2c974 (b:4974) - call TMHM_PlaySFX_ReadText2 - call CountTMsHMs ; This stores the count to wd265. - ld a, [wMenuCursorY] - dec a - ld b, a - ld a, [wTMHMPocketScrollPosition] - add b - ld b, a - ld a, [wd265] - cp b - jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL -TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a) - call TMHM_GetCurrentPocketPosition - ld a, [wMenuCursorY] - ld b, a -.loop - inc c - ld a, c - cp NUM_TMS + NUM_HMS + 1 - jr nc, .okay - ld a, [hli] - and a - jr z, .loop - dec b - jr nz, .loop - ld a, c -.okay - ld [wCurItem], a - cp -1 - ret - -TMHM_ExitPack: ; 2c9a5 (b:49a5) - call TMHM_PlaySFX_ReadText2 -_TMHM_ExitPack: ; 2c9a8 (b:49a8) - ld a, $2 - ld [wMenuJoypad], a - and a - ret - -TMHM_ExitPocket: ; 2c9af (b:49af) - and a - ret - -TMHM_ScrollPocket: ; 2c9b1 (b:49b1) - ld a, b - bit 7, a - jr nz, .skip - ld hl, wTMHMPocketScrollPosition - ld a, [hl] - and a - jp z, TMHM_JoypadLoop - dec [hl] - call TMHM_DisplayPocketItems - jp TMHM_ShowTMMoveDescription - -.skip - call TMHM_GetCurrentPocketPosition - ld b, 5 -.loop - inc c - ld a, c - cp NUM_TMS + NUM_HMS + 1 - jp nc, TMHM_JoypadLoop - ld a, [hli] - and a - jr z, .loop - dec b - jr nz, .loop - ld hl, wTMHMPocketScrollPosition - inc [hl] - call TMHM_DisplayPocketItems - jp TMHM_ShowTMMoveDescription - -TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2) - ld a, [wBattleType] - cp BATTLETYPE_TUTORIAL - jp z, Tutorial_TMHMPocket - - hlcoord 5, 2 - lb bc, 10, 15 - ld a, " " - call ClearBox - call TMHM_GetCurrentPocketPosition - ld d, $5 -.loop2 - inc c - ld a, c - cp NUM_TMS + NUM_HMS + 1 - jr nc, .NotTMHM - ld a, [hli] - and a - jr z, .loop2 - ld b, a - ld a, c - ld [wd265], a - push hl - push de - push bc - call TMHMPocket_GetCurrentLineCoord - push hl - ld a, [wd265] - cp NUM_TMS + 1 - jr nc, .HM - ld de, wd265 - lb bc, PRINTNUM_LEADINGZEROS | 1, 2 - call PrintNum - jr .okay - -.HM: - push af - sub NUM_TMS - ld [wd265], a - ld [hl], "H" - inc hl - ld de, wd265 - lb bc, PRINTNUM_RIGHTALIGN | 1, 2 - call PrintNum - pop af - ld [wd265], a -.okay - predef GetTMHMMove - ld a, [wd265] - ld [wPutativeTMHMMove], a - call GetMoveName - pop hl - ld bc, 3 - add hl, bc - push hl - call PlaceString - pop hl - pop bc - ld a, c - push bc - cp NUM_TMS + 1 - jr nc, .hm2 - ld bc, SCREEN_WIDTH + 9 - add hl, bc - ld [hl], "×" - inc hl - ld a, "0" ; why are we doing this? - pop bc - push bc - ld a, b - ld [wd265], a - ld de, wd265 - lb bc, 1, 2 - call PrintNum -.hm2 - pop bc - pop de - pop hl - dec d - jr nz, .loop2 - jr .done - -.NotTMHM: - call TMHMPocket_GetCurrentLineCoord - inc hl - inc hl - inc hl - push de - ld de, TMHM_String_Cancel - call PlaceString - pop de -.done - ret - -TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86) - hlcoord 5, 0 - ld bc, 2 * SCREEN_WIDTH - ld a, 6 - sub d - ld e, a - ; AddNTimes -.loop - add hl, bc - dec e - jr nz, .loop - ret -; 2ca95 (b:4a95) - -Unreferenced_Function2ca95: ; 2ca95 - pop hl - ld bc, 3 - add hl, bc - predef GetTMHMMove - ld a, [wd265] - ld [wPutativeTMHMMove], a - call GetMoveName - push hl - call PlaceString - pop hl - ret -; 2caae - -TMHM_String_Cancel: ; 2caae - db "CANCEL@" -; 2cab5 - -TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5) - ld hl, wTMsHMs - ld a, [wTMHMPocketScrollPosition] - ld b, a - inc b - ld c, 0 -.loop - inc c - ld a, [hli] - and a - jr z, .loop - dec b - jr nz, .loop - dec hl - dec c - ret - -Tutorial_TMHMPocket: ; 2caca (b:4aca) - hlcoord 9, 3 - push de - ld de, TMHM_String_Cancel - call PlaceString - pop de - ret - -TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6) - push de - ld de, SFX_READ_TEXT_2 - call PlaySFX - pop de - ret -; 2cadf (b:4adf) - -Unreferenced_Function2cadf: ; 2cadf - call ConvertCurItemIntoCurTMHM - call .CheckHaveRoomForTMHM - ld hl, .NoRoomText - jr nc, .print - ld hl, .ReceivedText -.print - jp PrintText -; 2caf0 - -.NoRoomText: ; 0x2caf0 - ; You have no room for any more @ S. - text_jump UnknownText_0x1c03fa - db "@" -; 0x2caf5 - -.ReceivedText: ; 0x2caf5 - ; You received @ ! - text_jump UnknownText_0x1c0421 - db "@" -; 0x2cafa - -.CheckHaveRoomForTMHM: ; 2cafa - ld a, [wd265] - dec a - ld hl, wTMsHMs - ld b, 0 - ld c, a - add hl, bc - ld a, [hl] - inc a - cp NUM_TMS * 2 - ret nc - ld [hl], a - ret -; 2cb0c - -ConsumeTM: ; 2cb0c (b:4b0c) - call ConvertCurItemIntoCurTMHM - ld a, [wd265] - dec a - ld hl, wTMsHMs - ld b, 0 - ld c, a - add hl, bc - ld a, [hl] - and a - ret z - dec a - ld [hl], a - ret nz - ld a, [wTMHMPocketScrollPosition] - and a - ret z - dec a - ld [wTMHMPocketScrollPosition], a - ret - -CountTMsHMs: ; 2cb2a (b:4b2a) - ld b, 0 - ld c, NUM_TMS + NUM_HMS - ld hl, wTMsHMs -.loop - ld a, [hli] - and a - jr z, .skip - inc b -.skip - dec c - jr nz, .loop - ld a, b - ld [wd265], a - ret - -PrintMoveDesc: ; 2cb3e - push hl - ld hl, MoveDescriptions - ld a, [wCurSpecies] - dec a - ld c, a - ld b, 0 - add hl, bc - add hl, bc - ld a, [hli] - ld e, a - ld d, [hl] - pop hl - jp PlaceString -; 2cb52 diff --git a/engine/predef.asm b/engine/routines/predef.asm similarity index 100% rename from engine/predef.asm rename to engine/routines/predef.asm diff --git a/engine/gfx/map_palettes.asm b/engine/tilesets/map_palettes.asm similarity index 100% rename from engine/gfx/map_palettes.asm rename to engine/tilesets/map_palettes.asm diff --git a/engine/gfx/mapgroup_roofs.asm b/engine/tilesets/mapgroup_roofs.asm similarity index 100% rename from engine/gfx/mapgroup_roofs.asm rename to engine/tilesets/mapgroup_roofs.asm diff --git a/engine/gfx/tileset_anims.asm b/engine/tilesets/tileset_anims.asm similarity index 100% rename from engine/gfx/tileset_anims.asm rename to engine/tilesets/tileset_anims.asm diff --git a/engine/gfx/tileset_palettes.asm b/engine/tilesets/tileset_palettes.asm similarity index 100% rename from engine/gfx/tileset_palettes.asm rename to engine/tilesets/tileset_palettes.asm diff --git a/engine/gfx/timeofdaypals.asm b/engine/tilesets/timeofdaypals.asm similarity index 100% rename from engine/gfx/timeofdaypals.asm rename to engine/tilesets/timeofdaypals.asm diff --git a/main.asm b/main.asm index 7c5610e5f..4980beee4 100644 --- a/main.asm +++ b/main.asm @@ -3,13 +3,13 @@ INCLUDE "constants.asm" SECTION "bank1", ROMX -INCLUDE "engine/routines/placewaitingtext.asm" -INCLUDE "engine/routines/loadpushoam.asm" +INCLUDE "engine/link/placewaitingtext.asm" +INCLUDE "engine/gfx/loadpushoam.asm" INCLUDE "engine/overworld/map_objects.asm" INCLUDE "engine/menus/intro_menu.asm" INCLUDE "engine/overworld/init_map.asm" INCLUDE "engine/pokemon/learn.asm" -INCLUDE "engine/routines/checknickerrors.asm" +INCLUDE "engine/pokemon/checknickerrors.asm" INCLUDE "engine/routines/math.asm" INCLUDE "data/items/attributes.asm" INCLUDE "engine/overworld/npc_movement.asm" @@ -21,13 +21,13 @@ SECTION "bank2", ROMX INCLUDE "engine/overworld/player_object.asm" INCLUDE "engine/routines/sine.asm" -INCLUDE "engine/predef.asm" +INCLUDE "engine/routines/predef.asm" INCLUDE "engine/gfx/color.asm" SECTION "bank3", ROMX -INCLUDE "engine/routines/checktime.asm" +INCLUDE "engine/events/checktime.asm" INCLUDE "engine/events/specials.asm" INCLUDE "engine/routines/printnum.asm" INCLUDE "engine/pokemon/health.asm" @@ -48,7 +48,7 @@ SECTION "bank4", ROMX INCLUDE "engine/items/pack.asm" INCLUDE "engine/overworld/time.asm" -INCLUDE "engine/items/tmhm.asm" +INCLUDE "engine/items/tmhm2.asm" INCLUDE "engine/menus/naming_screen.asm" INCLUDE "engine/events/misc_scripts.asm" INCLUDE "engine/events/heal_machine_anim.asm" @@ -64,7 +64,7 @@ INCLUDE "engine/events/std_collision.asm" INCLUDE "engine/events/bug_contest/judging.asm" INCLUDE "engine/events/pokerus/apply_pokerus_tick.asm" INCLUDE "engine/events/bug_contest/contest_2.asm" -INCLUDE "engine/routines/correcterrorsinplayerparty.asm" +INCLUDE "engine/pokemon/correcterrorsinplayerparty.asm" INCLUDE "engine/routines/getsquareroot.asm" @@ -73,12 +73,12 @@ SECTION "bank5", ROMX INCLUDE "engine/rtc/rtc.asm" INCLUDE "engine/overworld/overworld.asm" INCLUDE "engine/overworld/tile_events.asm" -INCLUDE "engine/save.asm" +INCLUDE "engine/menus/save.asm" INCLUDE "engine/overworld/spawn_points.asm" INCLUDE "engine/overworld/map_setup.asm" INCLUDE "engine/events/pokecenter_pc.asm" INCLUDE "engine/items/mart.asm" -INCLUDE "engine/money.asm" +INCLUDE "engine/events/money.asm" INCLUDE "data/items/marts.asm" INCLUDE "engine/events/mom.asm" INCLUDE "engine/events/daycare.asm" @@ -90,7 +90,7 @@ INCLUDE "gfx/tilesets.asm" SECTION "Roofs", ROMX -INCLUDE "engine/gfx/mapgroup_roofs.asm" +INCLUDE "engine/tilesets/mapgroup_roofs.asm" SECTION "Clock Reset", ROMX @@ -144,7 +144,7 @@ INCLUDE "data/trainers/class_names.asm" INCLUDE "engine/battle/ai/redundant.asm" INCLUDE "engine/events/move_deleter.asm" INCLUDE "engine/link/mystery_gift_2.asm" -INCLUDE "engine/pokemon/tmhm.asm" +INCLUDE "engine/items/tmhm.asm" INCLUDE "data/moves/descriptions.asm" INCLUDE "engine/events/pokerus/pokerus.asm" INCLUDE "engine/battle/start_battle.asm" @@ -205,15 +205,15 @@ INCLUDE "engine/events/buena_menu.asm" SECTION "bank13", ROMX -INCLUDE "engine/gfx/map_palettes.asm" +INCLUDE "engine/tilesets/map_palettes.asm" INCLUDE "gfx/tileset_palette_maps.asm" INCLUDE "data/collision_permissions.asm" INCLUDE "engine/routines/emptyallsrambanks.asm" -INCLUDE "engine/routines/savemenu_copytilemapatonce.asm" -INCLUDE "engine/routines/checksave.asm" +INCLUDE "engine/menus/savemenu_copytilemapatonce.asm" +INCLUDE "engine/events/checksave.asm" INCLUDE "data/maps/scenes.asm" INCLUDE "engine/overworld/loadmappart.asm" -INCLUDE "engine/routines/phonering_copytilemapatonce.asm" +INCLUDE "engine/phone/phonering_copytilemapatonce.asm" Shrink1Pic: ; 4d249 INCBIN "gfx/new_game/shrink1.2bpp.lz" @@ -232,13 +232,13 @@ INCLUDE "engine/pokemon/caught_data.asm" INCLUDE "engine/pokemon/search2.asm" INCLUDE "engine/pokemon/stats_screen.asm" INCLUDE "engine/events/catch_tutorial.asm" -INCLUDE "engine/gfx/evolution_animation.asm" -INCLUDE "engine/title/init_hof_credits.asm" +INCLUDE "engine/movie/evolution_animation.asm" +INCLUDE "engine/movie/init_hof_credits.asm" INCLUDE "engine/events/battle_tower/get_trainer_class.asm" INCLUDE "engine/battle/sliding_intro.asm" INCLUDE "mobile/print_opp_message.asm" INCLUDE "engine/battle/checkbattlescene.asm" -INCLUDE "engine/gfx/gbc_only.asm" +INCLUDE "engine/movie/gbc_only.asm" INCLUDE "engine/events/poke_seer.asm" @@ -277,10 +277,10 @@ INCLUDE "data/phone/text/extra.asm" SECTION "bank20", ROMX INCLUDE "engine/overworld/player_movement.asm" -INCLUDE "engine/engine_flags.asm" +INCLUDE "engine/events/engine_flags.asm" INCLUDE "engine/overworld/variables.asm" INCLUDE "data/text/battle.asm" -INCLUDE "engine/debug.asm" +INCLUDE "engine/menus/debug.asm" SECTION "bank21", ROMX @@ -304,7 +304,7 @@ INCLUDE "mobile/mobile_22_2.asm" SECTION "bank23", ROMX -INCLUDE "engine/gfx/timeofdaypals.asm" +INCLUDE "engine/tilesets/timeofdaypals.asm" INCLUDE "engine/battle/battle_transition.asm" INCLUDE "engine/events/field_moves.asm" INCLUDE "engine/events/magnet_train.asm" @@ -442,7 +442,7 @@ CopyrightGFX:: ; e4000 INCBIN "gfx/splash/copyright.2bpp" INCLUDE "engine/menus/options_menu.asm" -INCLUDE "engine/title/crystal_intro.asm" +INCLUDE "engine/movie/crystal_intro.asm" SECTION "bank3E", ROMX @@ -450,7 +450,7 @@ SECTION "bank3E", ROMX INCLUDE "engine/gfx/load_font.asm" INCLUDE "engine/link/time_capsule.asm" INCLUDE "engine/events/name_rater.asm" -INCLUDE "engine/routines/playslowcry.asm" +INCLUDE "engine/events/playslowcry.asm" INCLUDE "engine/pokedex/newpokedexentry.asm" INCLUDE "engine/link/time_capsule_2.asm" INCLUDE "engine/pokedex/unown_dex.asm" @@ -461,7 +461,7 @@ INCLUDE "engine/battle/misc.asm" SECTION "bank3F", ROMX -INCLUDE "engine/gfx/tileset_anims.asm" +INCLUDE "engine/tilesets/tileset_anims.asm" INCLUDE "engine/events/npc_trade.asm" INCLUDE "engine/events/mom_phone.asm" @@ -471,7 +471,7 @@ INCLUDE "mobile/mobile_40.asm" SECTION "bank41", ROMX -INCLUDE "engine/dma_transfer.asm" +INCLUDE "engine/gfx/dma_transfer.asm" INCLUDE "gfx/emotes.asm" INCLUDE "engine/overworld/warp_connection.asm" INCLUDE "engine/link/mystery_gift.asm" @@ -493,8 +493,8 @@ INCBIN "gfx/intro/logo.2bpp.lz" SECTION "Title", ROMX -INCLUDE "engine/title/unused_title.asm" -INCLUDE "engine/title/title.asm" +INCLUDE "engine/movie/unused_title.asm" +INCLUDE "engine/movie/title.asm" INCLUDE "mobile/mobile_45.asm" @@ -586,7 +586,7 @@ INCLUDE "engine/rtc/printhoursmins.asm" INCLUDE "engine/events/diploma.asm" INCLUDE "engine/pokedex/pokedex_3.asm" INCLUDE "engine/events/catch_tutorial_input.asm" -INCLUDE "engine/routines/townmap_convertlinebreakcharacters.asm" +INCLUDE "engine/pokegear/townmap_convertlinebreakcharacters.asm" PokegearGFX: ; 1de2e4 INCBIN "gfx/pokegear/pokegear.2bpp.lz" From be76ee56a89e72c0b87a605321bb1670e86f8220 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 25 Mar 2018 18:24:14 +0200 Subject: [PATCH 05/16] Organize the engine/ directory, director's cut Cleaned up `engine/routines`, in favor of moving files into more appropriate directories. predef-related routines are now in top-level `engine`. `rtc/delete_save_change_clock.asm` has been split into both `menus/delete_save.asm` and `rtc/reset_password.asm`. Made a new subdirectory: * engine/math: Contains all generic math-related routines. --- .../unreferenced_getgen1trainerclassname.asm | 0 engine/{routines => }/flagpredef.asm | 0 engine/{routines => link}/initlist.asm | 0 engine/{routines => math}/getsquareroot.asm | 0 engine/{routines => math}/math.asm | 0 engine/{routines => math}/printnum.asm | 0 engine/{routines => math}/sine.asm | 0 engine/menus/delete_save.asm | 36 ++++++++++++++++++ .../{routines => menus}/emptyallsrambanks.asm | 0 engine/{routines => }/predef.asm | 0 ...ve_change_clock.asm => reset_password.asm} | 37 ------------------- .../{clock_reset.asm => restart_clock.asm} | 9 ++--- main.asm | 23 ++++++------ 13 files changed, 52 insertions(+), 53 deletions(-) rename engine/{routines => battle}/unreferenced_getgen1trainerclassname.asm (100%) rename engine/{routines => }/flagpredef.asm (100%) rename engine/{routines => link}/initlist.asm (100%) rename engine/{routines => math}/getsquareroot.asm (100%) rename engine/{routines => math}/math.asm (100%) rename engine/{routines => math}/printnum.asm (100%) rename engine/{routines => math}/sine.asm (100%) create mode 100644 engine/menus/delete_save.asm rename engine/{routines => menus}/emptyallsrambanks.asm (100%) rename engine/{routines => }/predef.asm (100%) rename engine/rtc/{delete_save_change_clock.asm => reset_password.asm} (84%) rename engine/rtc/{clock_reset.asm => restart_clock.asm} (95%) diff --git a/engine/routines/unreferenced_getgen1trainerclassname.asm b/engine/battle/unreferenced_getgen1trainerclassname.asm similarity index 100% rename from engine/routines/unreferenced_getgen1trainerclassname.asm rename to engine/battle/unreferenced_getgen1trainerclassname.asm diff --git a/engine/routines/flagpredef.asm b/engine/flagpredef.asm similarity index 100% rename from engine/routines/flagpredef.asm rename to engine/flagpredef.asm diff --git a/engine/routines/initlist.asm b/engine/link/initlist.asm similarity index 100% rename from engine/routines/initlist.asm rename to engine/link/initlist.asm diff --git a/engine/routines/getsquareroot.asm b/engine/math/getsquareroot.asm similarity index 100% rename from engine/routines/getsquareroot.asm rename to engine/math/getsquareroot.asm diff --git a/engine/routines/math.asm b/engine/math/math.asm similarity index 100% rename from engine/routines/math.asm rename to engine/math/math.asm diff --git a/engine/routines/printnum.asm b/engine/math/printnum.asm similarity index 100% rename from engine/routines/printnum.asm rename to engine/math/printnum.asm diff --git a/engine/routines/sine.asm b/engine/math/sine.asm similarity index 100% rename from engine/routines/sine.asm rename to engine/math/sine.asm diff --git a/engine/menus/delete_save.asm b/engine/menus/delete_save.asm new file mode 100644 index 000000000..a86faf06a --- /dev/null +++ b/engine/menus/delete_save.asm @@ -0,0 +1,36 @@ +_DeleteSaveData: ; 4d54c + farcall BlankScreen + ld b, SCGB_DIPLOMA + call GetSGBLayout + call LoadStandardFont + call LoadFontsExtra + ld de, MUSIC_MAIN_MENU + call PlayMusic + ld hl, .Text_ClearAllSaveData + call PrintText + ld hl, .NoYesMenuHeader + call CopyMenuHeader + call VerticalMenu + ret c + ld a, [wMenuCursorY] + cp $1 + ret z + farcall EmptyAllSRAMBanks + ret + +.Text_ClearAllSaveData: ; 0x4d580 + ; Clear all save data? + text_jump UnknownText_0x1c564a + db "@" + +.NoYesMenuHeader: ; 0x4d585 + db 0 ; flags + menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 + dw .MenuData + db 1 ; default option + +.MenuData: ; 0x4d58d + db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags + db 2 ; items + db "NO@" + db "YES@" diff --git a/engine/routines/emptyallsrambanks.asm b/engine/menus/emptyallsrambanks.asm similarity index 100% rename from engine/routines/emptyallsrambanks.asm rename to engine/menus/emptyallsrambanks.asm diff --git a/engine/routines/predef.asm b/engine/predef.asm similarity index 100% rename from engine/routines/predef.asm rename to engine/predef.asm diff --git a/engine/rtc/delete_save_change_clock.asm b/engine/rtc/reset_password.asm similarity index 84% rename from engine/rtc/delete_save_change_clock.asm rename to engine/rtc/reset_password.asm index 431dc6034..fd5007ba7 100755 --- a/engine/rtc/delete_save_change_clock.asm +++ b/engine/rtc/reset_password.asm @@ -257,40 +257,3 @@ ClockResetPassword: ; 4d41e dec c jr nz, .ComponentFromString ret - -_DeleteSaveData: ; 4d54c - farcall BlankScreen - ld b, SCGB_DIPLOMA - call GetSGBLayout - call LoadStandardFont - call LoadFontsExtra - ld de, MUSIC_MAIN_MENU - call PlayMusic - ld hl, .Text_ClearAllSaveData - call PrintText - ld hl, .NoYesMenuHeader - call CopyMenuHeader - call VerticalMenu - ret c - ld a, [wMenuCursorY] - cp $1 - ret z - farcall EmptyAllSRAMBanks - ret - -.Text_ClearAllSaveData: ; 0x4d580 - ; Clear all save data? - text_jump UnknownText_0x1c564a - db "@" - -.NoYesMenuHeader: ; 0x4d585 - db 0 ; flags - menu_coords 14, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1 - dw .MenuData - db 1 ; default option - -.MenuData: ; 0x4d58d - db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags - db 2 ; items - db "NO@" - db "YES@" diff --git a/engine/rtc/clock_reset.asm b/engine/rtc/restart_clock.asm similarity index 95% rename from engine/rtc/clock_reset.asm rename to engine/rtc/restart_clock.asm index c05129349..5fbac80dd 100755 --- a/engine/rtc/clock_reset.asm +++ b/engine/rtc/restart_clock.asm @@ -1,5 +1,4 @@ - -ResetClock_GetWraparoundTime: ; 20000 (8:4000) +RestartClock_GetWraparoundTime: ; 20000 (8:4000) push hl dec a ld e, a @@ -152,7 +151,7 @@ RestartClock: ; 20021 (8:4021) .pressed_up ld a, [wBuffer1] - call ResetClock_GetWraparoundTime + call RestartClock_GetWraparoundTime ld a, [de] inc a ld [de], a @@ -164,7 +163,7 @@ RestartClock: ; 20021 (8:4021) .pressed_down ld a, [wBuffer1] - call ResetClock_GetWraparoundTime + call RestartClock_GetWraparoundTime ld a, [de] dec a ld [de], a @@ -230,7 +229,7 @@ RestartClock: ; 20021 (8:4021) .PlaceChars: ; 20168 (8:4168) push de - call ResetClock_GetWraparoundTime + call RestartClock_GetWraparoundTime ld a, [wBuffer3] dec a ld b, a diff --git a/main.asm b/main.asm index 4980beee4..2420bd414 100644 --- a/main.asm +++ b/main.asm @@ -10,7 +10,7 @@ INCLUDE "engine/menus/intro_menu.asm" INCLUDE "engine/overworld/init_map.asm" INCLUDE "engine/pokemon/learn.asm" INCLUDE "engine/pokemon/checknickerrors.asm" -INCLUDE "engine/routines/math.asm" +INCLUDE "engine/math/math.asm" INCLUDE "data/items/attributes.asm" INCLUDE "engine/overworld/npc_movement.asm" INCLUDE "engine/events/happiness_egg.asm" @@ -20,8 +20,8 @@ INCLUDE "engine/events/specials_2.asm" SECTION "bank2", ROMX INCLUDE "engine/overworld/player_object.asm" -INCLUDE "engine/routines/sine.asm" -INCLUDE "engine/routines/predef.asm" +INCLUDE "engine/math/sine.asm" +INCLUDE "engine/predef.asm" INCLUDE "engine/gfx/color.asm" @@ -29,7 +29,7 @@ SECTION "bank3", ROMX INCLUDE "engine/events/checktime.asm" INCLUDE "engine/events/specials.asm" -INCLUDE "engine/routines/printnum.asm" +INCLUDE "engine/math/printnum.asm" INCLUDE "engine/pokemon/health.asm" INCLUDE "engine/events/overworld.asm" INCLUDE "engine/items/items.asm" @@ -65,7 +65,7 @@ INCLUDE "engine/events/bug_contest/judging.asm" INCLUDE "engine/events/pokerus/apply_pokerus_tick.asm" INCLUDE "engine/events/bug_contest/contest_2.asm" INCLUDE "engine/pokemon/correcterrorsinplayerparty.asm" -INCLUDE "engine/routines/getsquareroot.asm" +INCLUDE "engine/math/getsquareroot.asm" SECTION "bank5", ROMX @@ -95,7 +95,7 @@ INCLUDE "engine/tilesets/mapgroup_roofs.asm" SECTION "Clock Reset", ROMX -INCLUDE "engine/rtc/clock_reset.asm" +INCLUDE "engine/rtc/restart_clock.asm" SECTION "bank9", ROMX @@ -208,7 +208,7 @@ SECTION "bank13", ROMX INCLUDE "engine/tilesets/map_palettes.asm" INCLUDE "gfx/tileset_palette_maps.asm" INCLUDE "data/collision_permissions.asm" -INCLUDE "engine/routines/emptyallsrambanks.asm" +INCLUDE "engine/menus/emptyallsrambanks.asm" INCLUDE "engine/menus/savemenu_copytilemapatonce.asm" INCLUDE "engine/events/checksave.asm" INCLUDE "data/maps/scenes.asm" @@ -222,9 +222,10 @@ Shrink2Pic: ; 4d2d9 INCBIN "gfx/new_game/shrink2.2bpp.lz" INCLUDE "engine/link/link_2.asm" -INCLUDE "engine/rtc/delete_save_change_clock.asm" +INCLUDE "engine/rtc/reset_password.asm" +INCLUDE "engine/menus/delete_save.asm" INCLUDE "data/tilesets.asm" -INCLUDE "engine/routines/flagpredef.asm" +INCLUDE "engine/flagpredef.asm" INCLUDE "engine/gfx/trademonfrontpic.asm" INCLUDE "engine/events/pokerus/check_pokerus.asm" INCLUDE "engine/events/lucky_number.asm" @@ -253,9 +254,9 @@ INCLUDE "engine/events/basement_key.asm" INCLUDE "engine/events/sacred_ash.asm" INCLUDE "engine/pokemon/tempmon.asm" INCLUDE "engine/pokemon/types.asm" -INCLUDE "engine/routines/unreferenced_getgen1trainerclassname.asm" +INCLUDE "engine/battle/unreferenced_getgen1trainerclassname.asm" INCLUDE "engine/pokemon/mon_stats.asm" -INCLUDE "engine/routines/initlist.asm" +INCLUDE "engine/link/initlist.asm" INCLUDE "engine/pokemon/experience.asm" INCLUDE "engine/pokemon/switchpartymons.asm" INCLUDE "engine/gfx/load_pics.asm" From 05ba221eb53472d9c617d96a6aaed9c2e87e2ad7 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 25 Mar 2018 19:14:26 +0200 Subject: [PATCH 06/16] =?UTF-8?q?`flagpredef.asm`=20=E2=86=92=20`smallflag?= =?UTF-8?q?.asm`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/{flagpredef.asm => smallflag.asm} | 0 main.asm | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename engine/{flagpredef.asm => smallflag.asm} (100%) diff --git a/engine/flagpredef.asm b/engine/smallflag.asm similarity index 100% rename from engine/flagpredef.asm rename to engine/smallflag.asm diff --git a/main.asm b/main.asm index 2420bd414..82e00596b 100644 --- a/main.asm +++ b/main.asm @@ -225,7 +225,7 @@ INCLUDE "engine/link/link_2.asm" INCLUDE "engine/rtc/reset_password.asm" INCLUDE "engine/menus/delete_save.asm" INCLUDE "data/tilesets.asm" -INCLUDE "engine/flagpredef.asm" +INCLUDE "engine/smallflag.asm" INCLUDE "engine/gfx/trademonfrontpic.asm" INCLUDE "engine/events/pokerus/check_pokerus.asm" INCLUDE "engine/events/lucky_number.asm" From 91a768b24343ffabbe5ab4084451d1e3ecbc306b Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 1 Apr 2018 17:01:51 +0200 Subject: [PATCH 07/16] Update file paths in constants/ and docs/ --- constants/audio_constants.asm | 2 +- constants/deco_constants.asm | 16 +++++++-------- constants/engine_flags.asm | 2 +- constants/gfx_constants.asm | 2 +- constants/item_constants.asm | 2 +- constants/item_data_constants.asm | 6 +++--- constants/map_data_constants.asm | 2 +- constants/map_object_constants.asm | 8 ++++---- constants/map_setup_constants.asm | 2 +- constants/menu_constants.asm | 4 ++-- constants/radio_constants.asm | 10 ++++----- constants/scgb_constants.asm | 4 ++-- constants/script_constants.asm | 12 +++++------ constants/sprite_anim_constants.asm | 2 +- constants/sprite_constants.asm | 2 +- constants/text_constants.asm | 2 +- docs/bugs_and_glitches.md | 32 ++++++++++++++--------------- docs/design_flaws.md | 18 ++++++++-------- docs/event_commands.md | 2 +- docs/movement_commands.md | 2 +- 20 files changed, 66 insertions(+), 66 deletions(-) diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index 7aa0895a3..288caad91 100755 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -17,7 +17,7 @@ const CC ; d (used for pitchoffset) ; channel -; ChannelPointers indexes (see engine/audio.asm) +; ChannelPointers indexes (see audio/engine.asm) const_def const CHAN1 ; 0 const CHAN2 ; 1 diff --git a/constants/deco_constants.asm b/constants/deco_constants.asm index 3b0230965..f385e7cd7 100644 --- a/constants/deco_constants.asm +++ b/constants/deco_constants.asm @@ -35,7 +35,7 @@ const_value = 1 const YELLOW_CARPET const GREEN_CARPET -; DoDecorationAction2.DecoActions indexes (see engine/decorations.asm) +; DoDecorationAction2.DecoActions indexes (see engine/overworld/decorations.asm) const_value = 1 const SET_UP_BED const PUT_AWAY_BED @@ -64,41 +64,41 @@ ENDM ; - DecorationIDs (see data/decorations/decorations.asm) const_value = 1 __enum__ = 0 -; FindOwnedBeds.beds values (see engine/decorations.asm) +; FindOwnedBeds.beds values (see engine/overworld/decorations.asm) const BEDS deco FEATHERY_BED deco PINK_BED deco POLKADOT_BED deco PIKACHU_BED -; FindOwnedCarpets.carpets values (see engine/decorations.asm) +; FindOwnedCarpets.carpets values (see engine/overworld/decorations.asm) const CARPETS deco RED_CARPET deco BLUE_CARPET deco YELLOW_CARPET deco GREEN_CARPET -; FindOwnedPlants.plants values (see engine/decorations.asm) +; FindOwnedPlants.plants values (see engine/overworld/decorations.asm) const PLANTS deco MAGNAPLANT deco TROPICPLANT deco JUMBOPLANT -; FindOwnedPosters.posters values (see engine/decorations.asm) +; FindOwnedPosters.posters values (see engine/overworld/decorations.asm) const POSTERS deco TOWN_MAP deco PIKACHU_POSTER deco CLEFAIRY_POSTER deco JIGGLYPUFF_POSTER -; FindOwnedConsoles.consoles values (see engine/decorations.asm) +; FindOwnedConsoles.consoles values (see engine/overworld/decorations.asm) const CONSOLES deco FAMICOM deco SNES deco N64 deco VIRTUAL_BOY -; FindOwnedBigDolls.big_dolls values (see engine/decorations.asm) +; FindOwnedBigDolls.big_dolls values (see engine/overworld/decorations.asm) const BIG_DOLLS deco BIG_SNORLAX_DOLL deco BIG_ONIX_DOLL deco BIG_LAPRAS_DOLL -; FindOwnedOrnaments.ornaments values (see engine/decorations.asm) +; FindOwnedOrnaments.ornaments values (see engine/overworld/decorations.asm) const DOLLS deco PIKACHU_DOLL deco SURF_PIKACHU_DOLL diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index 9b2eaaeaf..518edf806 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -1,4 +1,4 @@ -; EngineFlags indexes (see engine/engine_flasg.asm) +; EngineFlags indexes (see engine/engine_flags.asm) const_def ; wPokegearFlags const ENGINE_RADIO_CARD diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index d0f8b2b62..515045306 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -41,7 +41,7 @@ SPRITEOAMSTRUCT_LENGTH EQU const_value NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wVirtualOAM -; PokeAnims indexes (see engine/pic_animation.asm) +; PokeAnims indexes (see engine/gfx/pic_animation.asm) const_def const ANIM_MON_SLOW const ANIM_MON_NORMAL diff --git a/constants/item_constants.asm b/constants/item_constants.asm index 426f28bd0..ec5f5f211 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -3,7 +3,7 @@ ; - ItemNames (see data/items/names.asm) ; - ItemDescriptions (see data/items/descriptions.asm) ; - ItemAttributes (see data/items/attributes.asm) -; - ItemEffects (see engine/item_effects.asm) +; - ItemEffects (see engine/items/item_effects.asm) const_def const NO_ITEM ; 00 const MASTER_BALL ; 01 diff --git a/constants/item_data_constants.asm b/constants/item_data_constants.asm index 1af3c47ac..055e24656 100644 --- a/constants/item_data_constants.asm +++ b/constants/item_data_constants.asm @@ -17,8 +17,8 @@ ITEMATTR_STRUCT_LENGTH EQU const_value const TM_HM ; 4 ; item menu types -; UseItem.dw indexes (see engine/pack.asm) -; UseRegisteredItem.SwitchTo indexes (see engine/select_menu.asm) +; UseItem.dw indexes (see engine/items/pack.asm) +; UseRegisteredItem.SwitchTo indexes (see engine/overworld/select_menu.asm) ITEMMENU_NOUSE EQU 0 ITEMMENU_CURRENT EQU 4 ITEMMENU_PARTY EQU 5 @@ -130,7 +130,7 @@ MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct const HELD_FOCUS_BAND -; mart types (see engine/mart.asm) +; mart types (see engine/items/mart.asm) const_def const MARTTYPE_STANDARD const MARTTYPE_BITTER diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 0178e22b1..9a160a2fa 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -103,6 +103,6 @@ const_value = -1 NUM_SPAWNS EQU const_value -; outdoor sprite limits (see engine/overworld.asm) +; outdoor sprite limits (see engine/overworld/overworld.asm) MAX_OUTDOOR_SPRITES EQU 23 SPRITE_GFX_LIST_CAPACITY EQU $20 diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index b752b66e8..73685d4ec 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -121,7 +121,7 @@ MAPOBJECT_SCREEN_WIDTH EQU 12 NUM_SPRITEMOVEDATA EQU const_value SPRITEMOVEDATA_FIELDS EQU 6 -; MapObjectMovementPattern.Pointers indexes (see engine/map_objects.asm) +; MapObjectMovementPattern.Pointers indexes (see engine/overworld/map_objects.asm) const_def const SPRITEMOVEFN_00 ; 00 const SPRITEMOVEFN_RANDOM_WALK_Y ; 01 @@ -152,7 +152,7 @@ SPRITEMOVEDATA_FIELDS EQU 6 const SPRITEMOVEFN_BOULDERDUST ; 1a const SPRITEMOVEFN_GRASS ; 1b -; StepTypesJumptable indexes (see engine/map_objects.asm) +; StepTypesJumptable indexes (see engine/overworld/map_objects.asm) const_def const STEP_TYPE_00 ; 00 const STEP_TYPE_SLEEP ; 01 @@ -181,7 +181,7 @@ SPRITEMOVEDATA_FIELDS EQU 6 const STEP_TYPE_18 ; 18 const STEP_TYPE_SKYFALL_TOP ; 19 -; ObjectActionPairPointers indexes (see engine/map_object_action.asm) +; ObjectActionPairPointers indexes (see engine/overworld/map_object_action.asm) const_def const OBJECT_ACTION_00 ; 00 const OBJECT_ACTION_STAND ; 01 @@ -237,7 +237,7 @@ SPRITEMOVEDATA_FIELDS EQU 6 const FACING_GRASS_2 ; 1f -; DoPlayerMovement.DoStep arguments (see engine/player_movement.asm) +; DoPlayerMovement.DoStep arguments (see engine/overworld/player_movement.asm) const_def const STEP_SLOW ; 0 const STEP_WALK ; 1 diff --git a/constants/map_setup_constants.asm b/constants/map_setup_constants.asm index 9c6164169..426cbb298 100644 --- a/constants/map_setup_constants.asm +++ b/constants/map_setup_constants.asm @@ -14,7 +14,7 @@ const MAPSETUP_BADWARP ; fb const MAPSETUP_FLY ; fc -; MapSetupCommands indexes (see engine/map_setup.asm) +; MapSetupCommands indexes (see engine/overworld/map_setup.asm) ; Names taken from Condensation water's scripting compendium ; https://hax.iimarck.us/files/scriptingcodes_eng.htm const_def diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index f1ca20ae5..46c65474d 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -34,7 +34,7 @@ ; MonMenuOptions indexes (see data/mon_menu.asm) -; used by PokemonActionSubmenu (see engine/start_menu.asm) +; used by PokemonActionSubmenu (see engine/menus/start_menu.asm) const_def 1 ; moves const MONMENUITEM_CUT ; 1 @@ -83,7 +83,7 @@ HMENURETURN_ASM EQU %11111111 const PARTYMENUACTION_GIVE_MON_FEMALE ; unused const PARTYMENUACTION_GIVE_ITEM const PARTYMENUACTION_MOBILE ; mobile -; PrintPartyMenuActionText arguments (see engine/party_menu.asm) +; PrintPartyMenuActionText arguments (see engine/pokemon/party_menu.asm) const_def $f0 const PARTYMENUTEXT_HEAL_PSN const PARTYMENUTEXT_HEAL_BRN diff --git a/constants/radio_constants.asm b/constants/radio_constants.asm index 8903ef005..537b3289e 100644 --- a/constants/radio_constants.asm +++ b/constants/radio_constants.asm @@ -1,8 +1,8 @@ ; radio channel ids ; indexes for: ; - RadioChannelSongs (see data/radio/channel_music.asm) -; - PlayRadioShow/RadioJumptable (see engine/radio.asm) -; - RadioChannels (see engine/radio.asm) +; - PlayRadioShow/RadioJumptable (see engine/pokegear/radio.asm) +; - RadioChannels (see engine/pokegear/radio.asm) const_def const OAKS_POKEMON_TALK ; 00 const POKEDEX_SHOW ; 01 @@ -94,7 +94,7 @@ const POKEDEX_SHOW_7 ; 56 const POKEDEX_SHOW_8 ; 57 -; PlayRadio.StationPointers indexes (see engine/pokegear.asm) +; PlayRadio.StationPointers indexes (see engine/pokegear/pokegear.asm) const_def const MAPRADIO_POKEMON_CHANNEL const MAPRADIO_OAKS_POKEMON_TALK @@ -106,7 +106,7 @@ const MAPRADIO_LETS_ALL_SING const MAPRADIO_ROCKET -; These tables in engine/radio.asm are all sized to a power of 2 +; These tables in engine/pokegear/radio.asm are all sized to a power of 2 ; so there's no need for a rejection sampling loop NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives @@ -117,7 +117,7 @@ NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives NUM_PASSWORD_CATEGORIES EQU 11 NUM_PASSWORDS_PER_CATEGORY EQU 3 -; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/radio.asm) +; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/pokegear/radio.asm) const_def const BUENA_MON const BUENA_ITEM diff --git a/constants/scgb_constants.asm b/constants/scgb_constants.asm index e31a2139f..e7d987113 100755 --- a/constants/scgb_constants.asm +++ b/constants/scgb_constants.asm @@ -1,4 +1,4 @@ -; GetSGBLayout arguments (see engine/cgb_layouts.asm and engine/sgb_layouts.asm) +; GetSGBLayout arguments (see engine/gfx/cgb_layouts.asm and engine/gfx/sgb_layouts.asm) const_def const SCGB_BATTLE_GRAYSCALE const SCGB_BATTLE_COLORS @@ -36,7 +36,7 @@ SCGB_PARTY_MENU_HP_PALS EQU -4 SCGB_RAM EQU -1 ; PredefPals indexes (see gfx/sgb/predef.pal) -; GetPredefPal arguments (see engine/color.asm) +; GetPredefPal arguments (see engine/gfx/color.asm) const_def const PREDEFPAL_00 const PREDEFPAL_PALLET diff --git a/constants/script_constants.asm b/constants/script_constants.asm index dd086e6b3..e1feaaed9 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -38,7 +38,7 @@ NUM_MEM_BUFFERS EQU const_value ; writecode/checkcode arguments -; _GetVarAction.VarActionTable indexes (see engine/variables.asm) +; _GetVarAction.VarActionTable indexes (see engine/overworld/variables.asm) const_def const VAR_STRINGBUFFER2 ; 00 const VAR_PARTYCOUNT ; 01 @@ -75,7 +75,7 @@ RETVAR_ADDR_DE EQU (1 << 6) RETVAR_EXECUTE EQU (2 << 6) -; PlayerEventScriptPointers indexes (see engine/events.asm) +; PlayerEventScriptPointers indexes (see engine/overworld/events.asm) const_def -1 const PLAYEREVENT_MAPSCRIPT const PLAYEREVENT_NONE @@ -92,7 +92,7 @@ NUM_PLAYER_EVENTS EQU const_value ; bg_event types -; TryBGEvent arguments (see engine/events.asm) +; TryBGEvent arguments (see engine/overworld/events.asm) const_def const BGEVENT_READ const BGEVENT_UP @@ -105,7 +105,7 @@ NUM_PLAYER_EVENTS EQU const_value const BGEVENT_COPY ; object_event types -; TryObjectEvent arguments (see engine/events.asm) +; TryObjectEvent arguments (see engine/overworld/events.asm) const_def const OBJECTTYPE_SCRIPT const OBJECTTYPE_ITEMBALL @@ -203,7 +203,7 @@ EMOTE_MEM EQU -1 NUM_FRUIT_TREES EQU const_value + -1 ; describedecoration arguments -; DescribeDecoration.JumpTable indexes (see engine/decorations.asm) +; DescribeDecoration.JumpTable indexes (see engine/overworld/decorations.asm) const_def const DECODESC_POSTER ; 0 const DECODESC_LEFT_DOLL ; 1 @@ -259,7 +259,7 @@ NUM_FRUIT_TREES EQU const_value + -1 const HEALMACHINE_HALL_OF_FAME ; 2 ; UnownPuzzle writebyte arguments -; LoadUnownPuzzlePiecesGFX.LZPointers indexes (see engine/unown_puzzle.asm) +; LoadUnownPuzzlePiecesGFX.LZPointers indexes (see engine/games/unown_puzzle.asm) const_def const UNOWNPUZZLE_KABUTO ; 0 const UNOWNPUZZLE_OMANYTE ; 1 diff --git a/constants/sprite_anim_constants.asm b/constants/sprite_anim_constants.asm index 8be0f312a..0fbc4d849 100644 --- a/constants/sprite_anim_constants.asm +++ b/constants/sprite_anim_constants.asm @@ -67,7 +67,7 @@ NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs const SPRITE_ANIM_INDEX_INTRO_SUICUNE_AWAY ; 2b const SPRITE_ANIM_INDEX_CELEBI ; 2c -; DoAnimFrame.Jumptable indexes (see engine/sprite_anims.asm) +; DoAnimFrame.Jumptable indexes (see engine/gfx/sprite_anims.asm) const_def const SPRITE_ANIM_SEQ_NULL ; 00 const SPRITE_ANIM_SEQ_PARTY_MON ; 01 diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index c23a3b246..0e63cce52 100644 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -144,7 +144,7 @@ SPRITE_POKEMON EQU const_value const SPRITE_LUGIA ; a1 const SPRITE_HO_OH ; a2 -; special GetMonSprite values (see engine/overworld.asm) +; special GetMonSprite values (see engine/overworld/overworld.asm) const_def $e0 const SPRITE_DAY_CARE_MON_1 ; e0 const SPRITE_DAY_CARE_MON_2 ; e1 diff --git a/constants/text_constants.asm b/constants/text_constants.asm index a64039f64..5a9a35931 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -36,7 +36,7 @@ TEXTBOX_INNERY EQU TEXTBOX_Y + 2 const PRINTNUM_RIGHTALIGN_F ; 6 const PRINTNUM_LEADINGZEROS_F ; 7 -; PrintNum arguments (see engine/printnum.asm) +; PrintNum arguments (see engine/math/printnum.asm) PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F PRINTNUM_RIGHTALIGN EQU 1 << PRINTNUM_RIGHTALIGN_F PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 0212ed6fc..c24876873 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -490,7 +490,7 @@ This is a bug with `LongAnim_UpdateVariables` in [engine/battle/anim_hp_bar.asm] ([Video](https://www.youtube.com/watch?v=9KyNVIZxJvI)) -This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engine/anim_hp_bar.asm): +This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm): ```asm ld b, 0 @@ -519,7 +519,7 @@ This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engi This can bring Pokémon straight from level 1 to 100 by gaining just a few experience points. -This is a bug with `CalcExpAtLevel` in [engine/experience.asm](/engine/experience.asm): +This is a bug with `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm): ```asm CalcExpAtLevel: ; 50e47 @@ -589,7 +589,7 @@ Text_StringBuffer2ExpPoints:: ## BRN/PSN/PAR do not affect catch rate -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm ; This routine is buggy. It was intended that SLP and FRZ provide a higher @@ -923,7 +923,7 @@ This is a bug with `_HallOfFamePC.DisplayMonAndStrings` in [engine/events/hallof ([Video](https://www.youtube.com/watch?v=ojq3xqfRF6I)) -This is a bug with `Slots_PayoutAnim` in [engine/slot_machine.asm](/engine/slot_machine.asm): +This is a bug with `Slots_PayoutAnim` in [engine/games/slot_machine.asm](/engine/games/slot_machine.asm): ```asm .okay @@ -973,7 +973,7 @@ This is a bug with `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine ## No bump noise if standing on tile `$3E` -This is a bug with `DoPlayerMovement.CheckWarp` in [engine/player_movement.asm](/engine/player_movement.asm): +This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_movement.asm](/engine/overworld/player_movement.asm): ```asm ; Bug: Since no case is made for STANDING here, it will check @@ -1108,7 +1108,7 @@ In [home/map.asm](/home/map.asm): This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius. -In [engine/npc_movement.asm](/engine/npc_movement.asm): +In [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm): ```asm ld hl, OBJECT_FLAGS1 @@ -1126,7 +1126,7 @@ In [engine/npc_movement.asm](/engine/npc_movement.asm): This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh with only traded legendary beasts. -In [engine/search.asm](/engine/search.asm): +In [engine/pokemon/search.asm](/engine/pokemon/search.asm): ```asm ; check OT @@ -1157,7 +1157,7 @@ endr This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch. -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm ld hl, wEnemySubStatus5 @@ -1229,7 +1229,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef ([Video](https://www.youtube.com/watch?v=v1ErZdLCIyU)) -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm .room_in_party @@ -1254,7 +1254,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef ## `HELD_CATCH_CHANCE` has no effect -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm ; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway. @@ -1281,7 +1281,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef ## Only the first three `EvosAttacks` evolution entries can have Stone compatibility reported correctly -This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/party_menu.asm](/engine/party_menu.asm): +This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): ```asm .DetermineCompatibility: ; 50268 @@ -1304,7 +1304,7 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i ## `EVOLVE_STAT` can break Stone compatibility reporting -This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/party_menu.asm](/engine/party_menu.asm): +This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): ```asm .loop2 @@ -1337,7 +1337,7 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i ## `ScriptCall` can overflow `wScriptStack` and crash -In [engine/scripting.asm](/engine/scripting.asm): +In [engine/overworld/scripting.asm](/engine/overworld/scripting.asm): ```asm ScriptCall: @@ -1377,7 +1377,7 @@ ScriptCall: ## `LoadSpriteGFX` does not limit the capacity of `UsedSprites` -In [engine/overworld.asm](/engine/overworld.asm): +In [engine/overworld/overworld.asm](/engine/overworld/overworld.asm): ```asm LoadSpriteGFX: ; 14306 @@ -1414,7 +1414,7 @@ LoadSpriteGFX: ; 14306 ## `ChooseWildEncounter` doesn't really validate the wild Pokémon species -In [engine/wildmons.asm](/engine/wildmons.asm): +In [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm): ```asm ChooseWildEncounter: ; 2a14f @@ -1452,7 +1452,7 @@ ValidateTempWildMonSpecies: ; 2a4a0 ## `TryObjectEvent` arbitrary code execution -In [engine/events.asm](/engine/events.asm): +In [engine/overworld/events.asm](/engine/overworld/events.asm): ```asm ; Bug: If IsInArray returns nc, data at bc will be executed as code. diff --git a/docs/design_flaws.md b/docs/design_flaws.md index 20b70cac1..e4a81123b 100644 --- a/docs/design_flaws.md +++ b/docs/design_flaws.md @@ -25,7 +25,7 @@ dba_pic: MACRO ; dbw bank, address ENDM ``` -The offset is translated into a correct bank by `FixPicBank` in [engine/load_pics.asm](/engine/load_pics.asm): +The offset is translated into a correct bank by `FixPicBank` in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm): ```asm FixPicBank: ; 511c5 @@ -107,7 +107,7 @@ ROMX $49 "Pics 2" ``` -Two routines in [engine/load_pics.asm](/engine/load_pics.asm) make this assumption; `GetFrontpicPointer`: +Two routines in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm) make this assumption; `GetFrontpicPointer`: ```asm ld a, [wCurPartySpecies] @@ -295,7 +295,7 @@ Modify `Pokedex_LoadAnyFootprint`: NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC ``` -`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items.asm](/engine/items.asm) have to compensate for this: +`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](/engine/items/items.asm) have to compensate for this: ```asm GetTMHMNumber:: ; d407 @@ -338,7 +338,7 @@ GetNumberedTMHM: ; d417 Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data. -Modify engine/items.asm: +Modify engine/items/items.asm: ```asm GetTMHMNumber:: ; d407 @@ -399,7 +399,7 @@ GetDexEntryPointer: ; 44333 db BANK(PokedexEntries4) ``` -`GetPokedexEntryBank` in [engine/item_effects.asm](/engine/item_effects.asm): +`GetPokedexEntryBank` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm GetPokedexEntryBank: @@ -425,7 +425,7 @@ GetPokedexEntryBank: db BANK(PokedexEntries4) ``` -And `PokedexShow_GetDexEntryBank` in [engine/radio.asm](/engine/radio.asm): +And `PokedexShow_GetDexEntryBank` in [engine/pokegear/radio.asm](/engine/pokegear/radio.asm): ```asm PokedexShow_GetDexEntryBank: @@ -457,7 +457,7 @@ PokedexShow_GetDexEntryBank: ## Identical sine wave code and data is repeated five times -`_Sine` in [engine/routines/sine.asm](/engine/routines/sine.asm): +`_Sine` in [engine/math/sine.asm](/engine/math/sine.asm): ```asm _Sine:: ; 84d9 @@ -466,7 +466,7 @@ _Sine:: ; 84d9 calc_sine_wave ``` -`Sprites_Cosine` and `Sprites_Sine` in [engine/sprites.asm](/engine/sprites.asm): +`Sprites_Cosine` and `Sprites_Sine` in [engine/gfx/sprites.asm](/engine/gfx/sprites.asm): ```asm Sprites_Cosine: ; 8e72a @@ -583,7 +583,7 @@ ENDM ## `GetForestTreeFrame` works, but it's still bad -In [engine/tileset_anims.asm](/engine/tileset_anims.asm): +In [engine/tilesets/tileset_anims.asm](/engine/tilesets/tileset_anims.asm): ```asm GetForestTreeFrame: ; fc54c diff --git a/docs/event_commands.md b/docs/event_commands.md index bb6d4def4..5eaf1d778 100644 --- a/docs/event_commands.md +++ b/docs/event_commands.md @@ -1,6 +1,6 @@ # Event Commands -Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/scripting.asm:ScriptCommandTable](/engine/scripting.asm). +Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/overworld/scripting.asm:ScriptCommandTable](/engine/overworld/scripting.asm). Until this document is filled out, the [G/S Scripting Compendium](https://hax.iimarckus.org/files/scriptingcodes_eng.htm) has descriptions for most of these commands. It was written for G/S binary hacking and not Crystal assembly hacking, so it's not 100% accurate for pokecrystal. diff --git a/docs/movement_commands.md b/docs/movement_commands.md index 10792c88b..794dd8a98 100644 --- a/docs/movement_commands.md +++ b/docs/movement_commands.md @@ -1,6 +1,6 @@ # Movement Commands -Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engine/movement.asm:MovementPointers](/engine/movement.asm). +Defined in [macros/scripts/movement.asm](/macros/scripts/movement.asm) and [engine/overworld/movement.asm:MovementPointers](/engine/overworld/movement.asm). ## `$00`−`$03`: turn_head direction From 81fff9bb80af3db0ee381c824261b8963e1cc221 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 1 Apr 2018 17:03:11 +0200 Subject: [PATCH 08/16] Fix file permissions I have no idea why this was a thing (do people store this repo on FAT32 flash drives or something?), but quite a bit of files had a permission of 755. This isn't really a problem, but it's inconsistent and weird. --- constants/audio_constants.asm | 0 constants/battle_tower_constants.asm | 0 constants/cry_constants.asm | 0 constants/printer_constants.asm | 0 constants/scgb_constants.asm | 0 data/battle_anims/framesets.asm | 0 data/battle_anims/oam.asm | 0 data/battle_anims/object_gfx.asm | 0 data/battle_anims/objects.asm | 0 data/battle_tower/unknown.asm | 0 data/sprite_anims/framesets.asm | 0 data/sprites/map_objects.asm | 0 data/trainers/class_names.asm | 0 data/unused_53d84.asm | 0 engine/battle/ai/move.asm | 0 engine/battle/ai/redundant.asm | 0 engine/battle/ai/switch.asm | 0 engine/battle/anim_hp_bar.asm | 0 engine/battle/link_result.asm | 0 engine/battle/menu.asm | 0 engine/battle/move_effects/attract.asm | 0 engine/battle/move_effects/present.asm | 0 engine/battle/move_effects/transform.asm | 0 engine/battle/read_trainer_party.asm | 0 engine/battle/sliding_intro.asm | 0 engine/battle/trainer_huds.asm | 0 engine/battle/used_move_text.asm | 0 engine/battle_anims/core.asm | 0 engine/battle_anims/functions.asm | 0 engine/battle_anims/getpokeballwobble.asm | 0 engine/battle_anims/helpers.asm | 0 engine/events/basement_key.asm | 0 engine/events/battle_tower/battle_tower.asm | 0 engine/events/battle_tower/trainer_text.asm | 0 engine/events/bug_contest/contest_2.asm | 0 engine/events/bug_contest/judging.asm | 0 engine/events/card_key.asm | 0 engine/events/celebi.asm | 0 engine/events/daycare.asm | 0 engine/events/elevator.asm | 0 engine/events/field_moves.asm | 0 engine/events/forced_movement.asm | 0 engine/events/halloffame.asm | 0 engine/events/happiness_egg.asm | 0 engine/events/heal_machine_anim.asm | 0 engine/events/itemfinder.asm | 0 engine/events/magnet_train.asm | 0 engine/events/misc_scripts.asm | 0 engine/events/mom_phone.asm | 0 engine/events/money.asm | 0 engine/events/npc_trade.asm | 0 engine/events/overworld.asm | 0 engine/events/poisonstep.asm | 0 engine/events/pokecenter_pc.asm | 0 engine/events/pokepic.asm | 0 engine/events/print_photo.asm | 0 engine/events/prof_oaks_pc.asm | 0 engine/events/sacred_ash.asm | 0 engine/events/specials_2.asm | 0 engine/events/squirtbottle.asm | 0 engine/events/sweet_scent.asm | 0 engine/events/treemons.asm | 0 engine/events/whiteout.asm | 0 engine/games/card_flip.asm | 0 engine/games/dummy_game.asm | 0 engine/games/slot_machine.asm | 0 engine/games/unown_puzzle.asm | 0 engine/gfx/crystal_layouts.asm | 0 engine/gfx/dma_transfer.asm | 0 engine/gfx/load_pics.asm | 0 engine/gfx/mon_icons.asm | 0 engine/gfx/sprite_anims.asm | 0 engine/gfx/sprites.asm | 0 engine/items/buy_sell_toss.asm | 0 engine/items/items.asm | 0 engine/items/mart.asm | 0 engine/items/switch_items.asm | 0 engine/items/tmhm.asm | 0 engine/items/tmhm2.asm | 0 engine/link/link.asm | 0 engine/link/link_trade.asm | 0 engine/link/mystery_gift.asm | 0 engine/link/mystery_gift_2.asm | 0 engine/link/time_capsule.asm | 0 engine/math/math.asm | 0 engine/math/printnum.asm | 0 engine/math/sine.asm | 0 engine/menus/debug.asm | 0 engine/menus/init_gender.asm | 0 engine/menus/intro_menu.asm | 0 engine/menus/main_menu.asm | 0 engine/menus/menu.asm | 0 engine/menus/naming_screen.asm | 0 engine/menus/options_menu.asm | 0 engine/menus/scrolling_menu.asm | 0 engine/menus/start_menu.asm | 0 engine/menus/trainer_card.asm | 0 engine/movie/crystal_intro.asm | 0 engine/movie/evolution_animation.asm | 0 engine/movie/trade_animation.asm | 0 engine/overworld/decorations.asm | 0 engine/overworld/map_object_action.asm | 0 engine/overworld/npc_movement.asm | 0 engine/overworld/overworld.asm | 0 engine/overworld/player_movement.asm | 0 engine/overworld/player_object.asm | 0 engine/overworld/player_step.asm | 0 engine/overworld/select_menu.asm | 0 engine/overworld/tile_events.asm | 0 engine/overworld/time.asm | 0 engine/overworld/variables.asm | 0 engine/overworld/warp_connection.asm | 0 engine/overworld/wildmons.asm | 0 engine/pokedex/unown_dex.asm | 0 engine/pokegear/pokegear.asm | 0 engine/pokemon/billspc.asm | 0 engine/pokemon/billspctop.asm | 0 engine/pokemon/breeding.asm | 0 engine/pokemon/evolve.asm | 0 engine/pokemon/health.asm | 0 engine/pokemon/learn.asm | 0 engine/pokemon/mail.asm | 0 engine/pokemon/mail_2.asm | 0 engine/pokemon/mon_menu.asm | 0 engine/pokemon/move_mon.asm | 0 engine/pokemon/move_mon_wo_mail.asm | 0 engine/pokemon/search.asm | 0 engine/pokemon/search2.asm | 0 engine/pokemon/stats_screen.asm | 0 engine/printer/print_party.asm | 0 engine/printer/printer.asm | 0 engine/printer/printer_serial.asm | 0 engine/rtc/reset_password.asm | 0 engine/rtc/restart_clock.asm | 0 engine/rtc/rtc.asm | 0 engine/rtc/timeset.asm | 0 gfx/battle_anims/beam.png | Bin gfx/battle_anims/lightning.png | Bin gfx/battle_anims/misc.png | Bin gfx/battle_anims/noise.png | Bin gfx/battle_anims/objects.png | Bin gfx/battle_anims/poison.png | Bin gfx/battle_anims/pokeball.png | Bin gfx/battle_anims/rocks.png | Bin gfx/battle_anims/sand.png | Bin gfx/font.asm | 0 gfx/frames/space.png | Bin gfx/mail/cloud.png | Bin gfx/mail/dragonite.png | Bin gfx/mail/flower_mail_border.png | Bin gfx/mail/large_note.png | Bin gfx/mail/litebluemail_border.png | Bin gfx/mail/morph_mail_corner.png | Bin gfx/mail/surf_mail_border.png | Bin gfx/mobile/electro_ball_nonmatching.png | Bin gfx/mobile/mobile_splash.png | Bin gfx/splash/logo1.png | Bin gfx/splash/logo2.png | Bin gfx/trade/ball.png | Bin gfx/unknown/16c903.pal | 0 macros/wram.asm | 0 mobile/fixed_words.asm | 0 mobile/mobile_12.asm | 0 mobile/mobile_12_2.asm | 0 mobile/mobile_41.asm | 0 mobile/mobile_45_sprite_engine.asm | 0 mobile/mobile_46.asm | 0 mobile/mobile_5b.asm | 0 mobile/mobile_5c.asm | 0 mobile/mobile_menu.asm | 0 tools/toc.py | 0 171 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 constants/audio_constants.asm mode change 100755 => 100644 constants/battle_tower_constants.asm mode change 100755 => 100644 constants/cry_constants.asm mode change 100755 => 100644 constants/printer_constants.asm mode change 100755 => 100644 constants/scgb_constants.asm mode change 100755 => 100644 data/battle_anims/framesets.asm mode change 100755 => 100644 data/battle_anims/oam.asm mode change 100755 => 100644 data/battle_anims/object_gfx.asm mode change 100755 => 100644 data/battle_anims/objects.asm mode change 100755 => 100644 data/battle_tower/unknown.asm mode change 100755 => 100644 data/sprite_anims/framesets.asm mode change 100755 => 100644 data/sprites/map_objects.asm mode change 100755 => 100644 data/trainers/class_names.asm mode change 100755 => 100644 data/unused_53d84.asm mode change 100755 => 100644 engine/battle/ai/move.asm mode change 100755 => 100644 engine/battle/ai/redundant.asm mode change 100755 => 100644 engine/battle/ai/switch.asm mode change 100755 => 100644 engine/battle/anim_hp_bar.asm mode change 100755 => 100644 engine/battle/link_result.asm mode change 100755 => 100644 engine/battle/menu.asm mode change 100755 => 100644 engine/battle/move_effects/attract.asm mode change 100755 => 100644 engine/battle/move_effects/present.asm mode change 100755 => 100644 engine/battle/move_effects/transform.asm mode change 100755 => 100644 engine/battle/read_trainer_party.asm mode change 100755 => 100644 engine/battle/sliding_intro.asm mode change 100755 => 100644 engine/battle/trainer_huds.asm mode change 100755 => 100644 engine/battle/used_move_text.asm mode change 100755 => 100644 engine/battle_anims/core.asm mode change 100755 => 100644 engine/battle_anims/functions.asm mode change 100755 => 100644 engine/battle_anims/getpokeballwobble.asm mode change 100755 => 100644 engine/battle_anims/helpers.asm mode change 100755 => 100644 engine/events/basement_key.asm mode change 100755 => 100644 engine/events/battle_tower/battle_tower.asm mode change 100755 => 100644 engine/events/battle_tower/trainer_text.asm mode change 100755 => 100644 engine/events/bug_contest/contest_2.asm mode change 100755 => 100644 engine/events/bug_contest/judging.asm mode change 100755 => 100644 engine/events/card_key.asm mode change 100755 => 100644 engine/events/celebi.asm mode change 100755 => 100644 engine/events/daycare.asm mode change 100755 => 100644 engine/events/elevator.asm mode change 100755 => 100644 engine/events/field_moves.asm mode change 100755 => 100644 engine/events/forced_movement.asm mode change 100755 => 100644 engine/events/halloffame.asm mode change 100755 => 100644 engine/events/happiness_egg.asm mode change 100755 => 100644 engine/events/heal_machine_anim.asm mode change 100755 => 100644 engine/events/itemfinder.asm mode change 100755 => 100644 engine/events/magnet_train.asm mode change 100755 => 100644 engine/events/misc_scripts.asm mode change 100755 => 100644 engine/events/mom_phone.asm mode change 100755 => 100644 engine/events/money.asm mode change 100755 => 100644 engine/events/npc_trade.asm mode change 100755 => 100644 engine/events/overworld.asm mode change 100755 => 100644 engine/events/poisonstep.asm mode change 100755 => 100644 engine/events/pokecenter_pc.asm mode change 100755 => 100644 engine/events/pokepic.asm mode change 100755 => 100644 engine/events/print_photo.asm mode change 100755 => 100644 engine/events/prof_oaks_pc.asm mode change 100755 => 100644 engine/events/sacred_ash.asm mode change 100755 => 100644 engine/events/specials_2.asm mode change 100755 => 100644 engine/events/squirtbottle.asm mode change 100755 => 100644 engine/events/sweet_scent.asm mode change 100755 => 100644 engine/events/treemons.asm mode change 100755 => 100644 engine/events/whiteout.asm mode change 100755 => 100644 engine/games/card_flip.asm mode change 100755 => 100644 engine/games/dummy_game.asm mode change 100755 => 100644 engine/games/slot_machine.asm mode change 100755 => 100644 engine/games/unown_puzzle.asm mode change 100755 => 100644 engine/gfx/crystal_layouts.asm mode change 100755 => 100644 engine/gfx/dma_transfer.asm mode change 100755 => 100644 engine/gfx/load_pics.asm mode change 100755 => 100644 engine/gfx/mon_icons.asm mode change 100755 => 100644 engine/gfx/sprite_anims.asm mode change 100755 => 100644 engine/gfx/sprites.asm mode change 100755 => 100644 engine/items/buy_sell_toss.asm mode change 100755 => 100644 engine/items/items.asm mode change 100755 => 100644 engine/items/mart.asm mode change 100755 => 100644 engine/items/switch_items.asm mode change 100755 => 100644 engine/items/tmhm.asm mode change 100755 => 100644 engine/items/tmhm2.asm mode change 100755 => 100644 engine/link/link.asm mode change 100755 => 100644 engine/link/link_trade.asm mode change 100755 => 100644 engine/link/mystery_gift.asm mode change 100755 => 100644 engine/link/mystery_gift_2.asm mode change 100755 => 100644 engine/link/time_capsule.asm mode change 100755 => 100644 engine/math/math.asm mode change 100755 => 100644 engine/math/printnum.asm mode change 100755 => 100644 engine/math/sine.asm mode change 100755 => 100644 engine/menus/debug.asm mode change 100755 => 100644 engine/menus/init_gender.asm mode change 100755 => 100644 engine/menus/intro_menu.asm mode change 100755 => 100644 engine/menus/main_menu.asm mode change 100755 => 100644 engine/menus/menu.asm mode change 100755 => 100644 engine/menus/naming_screen.asm mode change 100755 => 100644 engine/menus/options_menu.asm mode change 100755 => 100644 engine/menus/scrolling_menu.asm mode change 100755 => 100644 engine/menus/start_menu.asm mode change 100755 => 100644 engine/menus/trainer_card.asm mode change 100755 => 100644 engine/movie/crystal_intro.asm mode change 100755 => 100644 engine/movie/evolution_animation.asm mode change 100755 => 100644 engine/movie/trade_animation.asm mode change 100755 => 100644 engine/overworld/decorations.asm mode change 100755 => 100644 engine/overworld/map_object_action.asm mode change 100755 => 100644 engine/overworld/npc_movement.asm mode change 100755 => 100644 engine/overworld/overworld.asm mode change 100755 => 100644 engine/overworld/player_movement.asm mode change 100755 => 100644 engine/overworld/player_object.asm mode change 100755 => 100644 engine/overworld/player_step.asm mode change 100755 => 100644 engine/overworld/select_menu.asm mode change 100755 => 100644 engine/overworld/tile_events.asm mode change 100755 => 100644 engine/overworld/time.asm mode change 100755 => 100644 engine/overworld/variables.asm mode change 100755 => 100644 engine/overworld/warp_connection.asm mode change 100755 => 100644 engine/overworld/wildmons.asm mode change 100755 => 100644 engine/pokedex/unown_dex.asm mode change 100755 => 100644 engine/pokegear/pokegear.asm mode change 100755 => 100644 engine/pokemon/billspc.asm mode change 100755 => 100644 engine/pokemon/billspctop.asm mode change 100755 => 100644 engine/pokemon/breeding.asm mode change 100755 => 100644 engine/pokemon/evolve.asm mode change 100755 => 100644 engine/pokemon/health.asm mode change 100755 => 100644 engine/pokemon/learn.asm mode change 100755 => 100644 engine/pokemon/mail.asm mode change 100755 => 100644 engine/pokemon/mail_2.asm mode change 100755 => 100644 engine/pokemon/mon_menu.asm mode change 100755 => 100644 engine/pokemon/move_mon.asm mode change 100755 => 100644 engine/pokemon/move_mon_wo_mail.asm mode change 100755 => 100644 engine/pokemon/search.asm mode change 100755 => 100644 engine/pokemon/search2.asm mode change 100755 => 100644 engine/pokemon/stats_screen.asm mode change 100755 => 100644 engine/printer/print_party.asm mode change 100755 => 100644 engine/printer/printer.asm mode change 100755 => 100644 engine/printer/printer_serial.asm mode change 100755 => 100644 engine/rtc/reset_password.asm mode change 100755 => 100644 engine/rtc/restart_clock.asm mode change 100755 => 100644 engine/rtc/rtc.asm mode change 100755 => 100644 engine/rtc/timeset.asm mode change 100755 => 100644 gfx/battle_anims/beam.png mode change 100755 => 100644 gfx/battle_anims/lightning.png mode change 100755 => 100644 gfx/battle_anims/misc.png mode change 100755 => 100644 gfx/battle_anims/noise.png mode change 100755 => 100644 gfx/battle_anims/objects.png mode change 100755 => 100644 gfx/battle_anims/poison.png mode change 100755 => 100644 gfx/battle_anims/pokeball.png mode change 100755 => 100644 gfx/battle_anims/rocks.png mode change 100755 => 100644 gfx/battle_anims/sand.png mode change 100755 => 100644 gfx/font.asm mode change 100755 => 100644 gfx/frames/space.png mode change 100755 => 100644 gfx/mail/cloud.png mode change 100755 => 100644 gfx/mail/dragonite.png mode change 100755 => 100644 gfx/mail/flower_mail_border.png mode change 100755 => 100644 gfx/mail/large_note.png mode change 100755 => 100644 gfx/mail/litebluemail_border.png mode change 100755 => 100644 gfx/mail/morph_mail_corner.png mode change 100755 => 100644 gfx/mail/surf_mail_border.png mode change 100755 => 100644 gfx/mobile/electro_ball_nonmatching.png mode change 100755 => 100644 gfx/mobile/mobile_splash.png mode change 100755 => 100644 gfx/splash/logo1.png mode change 100755 => 100644 gfx/splash/logo2.png mode change 100755 => 100644 gfx/trade/ball.png mode change 100755 => 100644 gfx/unknown/16c903.pal mode change 100755 => 100644 macros/wram.asm mode change 100755 => 100644 mobile/fixed_words.asm mode change 100755 => 100644 mobile/mobile_12.asm mode change 100755 => 100644 mobile/mobile_12_2.asm mode change 100755 => 100644 mobile/mobile_41.asm mode change 100755 => 100644 mobile/mobile_45_sprite_engine.asm mode change 100755 => 100644 mobile/mobile_46.asm mode change 100755 => 100644 mobile/mobile_5b.asm mode change 100755 => 100644 mobile/mobile_5c.asm mode change 100755 => 100644 mobile/mobile_menu.asm mode change 100644 => 100755 tools/toc.py diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm old mode 100755 new mode 100644 diff --git a/constants/battle_tower_constants.asm b/constants/battle_tower_constants.asm old mode 100755 new mode 100644 diff --git a/constants/cry_constants.asm b/constants/cry_constants.asm old mode 100755 new mode 100644 diff --git a/constants/printer_constants.asm b/constants/printer_constants.asm old mode 100755 new mode 100644 diff --git a/constants/scgb_constants.asm b/constants/scgb_constants.asm old mode 100755 new mode 100644 diff --git a/data/battle_anims/framesets.asm b/data/battle_anims/framesets.asm old mode 100755 new mode 100644 diff --git a/data/battle_anims/oam.asm b/data/battle_anims/oam.asm old mode 100755 new mode 100644 diff --git a/data/battle_anims/object_gfx.asm b/data/battle_anims/object_gfx.asm old mode 100755 new mode 100644 diff --git a/data/battle_anims/objects.asm b/data/battle_anims/objects.asm old mode 100755 new mode 100644 diff --git a/data/battle_tower/unknown.asm b/data/battle_tower/unknown.asm old mode 100755 new mode 100644 diff --git a/data/sprite_anims/framesets.asm b/data/sprite_anims/framesets.asm old mode 100755 new mode 100644 diff --git a/data/sprites/map_objects.asm b/data/sprites/map_objects.asm old mode 100755 new mode 100644 diff --git a/data/trainers/class_names.asm b/data/trainers/class_names.asm old mode 100755 new mode 100644 diff --git a/data/unused_53d84.asm b/data/unused_53d84.asm old mode 100755 new mode 100644 diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm old mode 100755 new mode 100644 diff --git a/engine/battle/ai/redundant.asm b/engine/battle/ai/redundant.asm old mode 100755 new mode 100644 diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm old mode 100755 new mode 100644 diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm old mode 100755 new mode 100644 diff --git a/engine/battle/link_result.asm b/engine/battle/link_result.asm old mode 100755 new mode 100644 diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm old mode 100755 new mode 100644 diff --git a/engine/battle/move_effects/attract.asm b/engine/battle/move_effects/attract.asm old mode 100755 new mode 100644 diff --git a/engine/battle/move_effects/present.asm b/engine/battle/move_effects/present.asm old mode 100755 new mode 100644 diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm old mode 100755 new mode 100644 diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm old mode 100755 new mode 100644 diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm old mode 100755 new mode 100644 diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm old mode 100755 new mode 100644 diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm old mode 100755 new mode 100644 diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm old mode 100755 new mode 100644 diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm old mode 100755 new mode 100644 diff --git a/engine/battle_anims/getpokeballwobble.asm b/engine/battle_anims/getpokeballwobble.asm old mode 100755 new mode 100644 diff --git a/engine/battle_anims/helpers.asm b/engine/battle_anims/helpers.asm old mode 100755 new mode 100644 diff --git a/engine/events/basement_key.asm b/engine/events/basement_key.asm old mode 100755 new mode 100644 diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm old mode 100755 new mode 100644 diff --git a/engine/events/battle_tower/trainer_text.asm b/engine/events/battle_tower/trainer_text.asm old mode 100755 new mode 100644 diff --git a/engine/events/bug_contest/contest_2.asm b/engine/events/bug_contest/contest_2.asm old mode 100755 new mode 100644 diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm old mode 100755 new mode 100644 diff --git a/engine/events/card_key.asm b/engine/events/card_key.asm old mode 100755 new mode 100644 diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm old mode 100755 new mode 100644 diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm old mode 100755 new mode 100644 diff --git a/engine/events/elevator.asm b/engine/events/elevator.asm old mode 100755 new mode 100644 diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm old mode 100755 new mode 100644 diff --git a/engine/events/forced_movement.asm b/engine/events/forced_movement.asm old mode 100755 new mode 100644 diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm old mode 100755 new mode 100644 diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm old mode 100755 new mode 100644 diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm old mode 100755 new mode 100644 diff --git a/engine/events/itemfinder.asm b/engine/events/itemfinder.asm old mode 100755 new mode 100644 diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm old mode 100755 new mode 100644 diff --git a/engine/events/misc_scripts.asm b/engine/events/misc_scripts.asm old mode 100755 new mode 100644 diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm old mode 100755 new mode 100644 diff --git a/engine/events/money.asm b/engine/events/money.asm old mode 100755 new mode 100644 diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm old mode 100755 new mode 100644 diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm old mode 100755 new mode 100644 diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm old mode 100755 new mode 100644 diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm old mode 100755 new mode 100644 diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm old mode 100755 new mode 100644 diff --git a/engine/events/print_photo.asm b/engine/events/print_photo.asm old mode 100755 new mode 100644 diff --git a/engine/events/prof_oaks_pc.asm b/engine/events/prof_oaks_pc.asm old mode 100755 new mode 100644 diff --git a/engine/events/sacred_ash.asm b/engine/events/sacred_ash.asm old mode 100755 new mode 100644 diff --git a/engine/events/specials_2.asm b/engine/events/specials_2.asm old mode 100755 new mode 100644 diff --git a/engine/events/squirtbottle.asm b/engine/events/squirtbottle.asm old mode 100755 new mode 100644 diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm old mode 100755 new mode 100644 diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm old mode 100755 new mode 100644 diff --git a/engine/events/whiteout.asm b/engine/events/whiteout.asm old mode 100755 new mode 100644 diff --git a/engine/games/card_flip.asm b/engine/games/card_flip.asm old mode 100755 new mode 100644 diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm old mode 100755 new mode 100644 diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm old mode 100755 new mode 100644 diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm old mode 100755 new mode 100644 diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm old mode 100755 new mode 100644 diff --git a/engine/gfx/dma_transfer.asm b/engine/gfx/dma_transfer.asm old mode 100755 new mode 100644 diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm old mode 100755 new mode 100644 diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm old mode 100755 new mode 100644 diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm old mode 100755 new mode 100644 diff --git a/engine/gfx/sprites.asm b/engine/gfx/sprites.asm old mode 100755 new mode 100644 diff --git a/engine/items/buy_sell_toss.asm b/engine/items/buy_sell_toss.asm old mode 100755 new mode 100644 diff --git a/engine/items/items.asm b/engine/items/items.asm old mode 100755 new mode 100644 diff --git a/engine/items/mart.asm b/engine/items/mart.asm old mode 100755 new mode 100644 diff --git a/engine/items/switch_items.asm b/engine/items/switch_items.asm old mode 100755 new mode 100644 diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm old mode 100755 new mode 100644 diff --git a/engine/items/tmhm2.asm b/engine/items/tmhm2.asm old mode 100755 new mode 100644 diff --git a/engine/link/link.asm b/engine/link/link.asm old mode 100755 new mode 100644 diff --git a/engine/link/link_trade.asm b/engine/link/link_trade.asm old mode 100755 new mode 100644 diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm old mode 100755 new mode 100644 diff --git a/engine/link/mystery_gift_2.asm b/engine/link/mystery_gift_2.asm old mode 100755 new mode 100644 diff --git a/engine/link/time_capsule.asm b/engine/link/time_capsule.asm old mode 100755 new mode 100644 diff --git a/engine/math/math.asm b/engine/math/math.asm old mode 100755 new mode 100644 diff --git a/engine/math/printnum.asm b/engine/math/printnum.asm old mode 100755 new mode 100644 diff --git a/engine/math/sine.asm b/engine/math/sine.asm old mode 100755 new mode 100644 diff --git a/engine/menus/debug.asm b/engine/menus/debug.asm old mode 100755 new mode 100644 diff --git a/engine/menus/init_gender.asm b/engine/menus/init_gender.asm old mode 100755 new mode 100644 diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm old mode 100755 new mode 100644 diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm old mode 100755 new mode 100644 diff --git a/engine/menus/menu.asm b/engine/menus/menu.asm old mode 100755 new mode 100644 diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm old mode 100755 new mode 100644 diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm old mode 100755 new mode 100644 diff --git a/engine/menus/scrolling_menu.asm b/engine/menus/scrolling_menu.asm old mode 100755 new mode 100644 diff --git a/engine/menus/start_menu.asm b/engine/menus/start_menu.asm old mode 100755 new mode 100644 diff --git a/engine/menus/trainer_card.asm b/engine/menus/trainer_card.asm old mode 100755 new mode 100644 diff --git a/engine/movie/crystal_intro.asm b/engine/movie/crystal_intro.asm old mode 100755 new mode 100644 diff --git a/engine/movie/evolution_animation.asm b/engine/movie/evolution_animation.asm old mode 100755 new mode 100644 diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/overworld.asm b/engine/overworld/overworld.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/player_object.asm b/engine/overworld/player_object.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/player_step.asm b/engine/overworld/player_step.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/select_menu.asm b/engine/overworld/select_menu.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/tile_events.asm b/engine/overworld/tile_events.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/variables.asm b/engine/overworld/variables.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/warp_connection.asm b/engine/overworld/warp_connection.asm old mode 100755 new mode 100644 diff --git a/engine/overworld/wildmons.asm b/engine/overworld/wildmons.asm old mode 100755 new mode 100644 diff --git a/engine/pokedex/unown_dex.asm b/engine/pokedex/unown_dex.asm old mode 100755 new mode 100644 diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/billspc.asm b/engine/pokemon/billspc.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/billspctop.asm b/engine/pokemon/billspctop.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/evolve.asm b/engine/pokemon/evolve.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/health.asm b/engine/pokemon/health.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/learn.asm b/engine/pokemon/learn.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/mail.asm b/engine/pokemon/mail.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/move_mon_wo_mail.asm b/engine/pokemon/move_mon_wo_mail.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/search.asm b/engine/pokemon/search.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/search2.asm b/engine/pokemon/search2.asm old mode 100755 new mode 100644 diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm old mode 100755 new mode 100644 diff --git a/engine/printer/print_party.asm b/engine/printer/print_party.asm old mode 100755 new mode 100644 diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm old mode 100755 new mode 100644 diff --git a/engine/printer/printer_serial.asm b/engine/printer/printer_serial.asm old mode 100755 new mode 100644 diff --git a/engine/rtc/reset_password.asm b/engine/rtc/reset_password.asm old mode 100755 new mode 100644 diff --git a/engine/rtc/restart_clock.asm b/engine/rtc/restart_clock.asm old mode 100755 new mode 100644 diff --git a/engine/rtc/rtc.asm b/engine/rtc/rtc.asm old mode 100755 new mode 100644 diff --git a/engine/rtc/timeset.asm b/engine/rtc/timeset.asm old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/beam.png b/gfx/battle_anims/beam.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/lightning.png b/gfx/battle_anims/lightning.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/misc.png b/gfx/battle_anims/misc.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/noise.png b/gfx/battle_anims/noise.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/objects.png b/gfx/battle_anims/objects.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/poison.png b/gfx/battle_anims/poison.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/pokeball.png b/gfx/battle_anims/pokeball.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/rocks.png b/gfx/battle_anims/rocks.png old mode 100755 new mode 100644 diff --git a/gfx/battle_anims/sand.png b/gfx/battle_anims/sand.png old mode 100755 new mode 100644 diff --git a/gfx/font.asm b/gfx/font.asm old mode 100755 new mode 100644 diff --git a/gfx/frames/space.png b/gfx/frames/space.png old mode 100755 new mode 100644 diff --git a/gfx/mail/cloud.png b/gfx/mail/cloud.png old mode 100755 new mode 100644 diff --git a/gfx/mail/dragonite.png b/gfx/mail/dragonite.png old mode 100755 new mode 100644 diff --git a/gfx/mail/flower_mail_border.png b/gfx/mail/flower_mail_border.png old mode 100755 new mode 100644 diff --git a/gfx/mail/large_note.png b/gfx/mail/large_note.png old mode 100755 new mode 100644 diff --git a/gfx/mail/litebluemail_border.png b/gfx/mail/litebluemail_border.png old mode 100755 new mode 100644 diff --git a/gfx/mail/morph_mail_corner.png b/gfx/mail/morph_mail_corner.png old mode 100755 new mode 100644 diff --git a/gfx/mail/surf_mail_border.png b/gfx/mail/surf_mail_border.png old mode 100755 new mode 100644 diff --git a/gfx/mobile/electro_ball_nonmatching.png b/gfx/mobile/electro_ball_nonmatching.png old mode 100755 new mode 100644 diff --git a/gfx/mobile/mobile_splash.png b/gfx/mobile/mobile_splash.png old mode 100755 new mode 100644 diff --git a/gfx/splash/logo1.png b/gfx/splash/logo1.png old mode 100755 new mode 100644 diff --git a/gfx/splash/logo2.png b/gfx/splash/logo2.png old mode 100755 new mode 100644 diff --git a/gfx/trade/ball.png b/gfx/trade/ball.png old mode 100755 new mode 100644 diff --git a/gfx/unknown/16c903.pal b/gfx/unknown/16c903.pal old mode 100755 new mode 100644 diff --git a/macros/wram.asm b/macros/wram.asm old mode 100755 new mode 100644 diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_12.asm b/mobile/mobile_12.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_12_2.asm b/mobile/mobile_12_2.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_41.asm b/mobile/mobile_41.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_45_sprite_engine.asm b/mobile/mobile_45_sprite_engine.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_5b.asm b/mobile/mobile_5b.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_5c.asm b/mobile/mobile_5c.asm old mode 100755 new mode 100644 diff --git a/mobile/mobile_menu.asm b/mobile/mobile_menu.asm old mode 100755 new mode 100644 diff --git a/tools/toc.py b/tools/toc.py old mode 100644 new mode 100755 From d3cc861d334c8b773c1b6c662ed9924c43cef009 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 4 Apr 2018 22:26:07 +0200 Subject: [PATCH 09/16] Fix snake_case filenames Renamed a bunch of files, most of them one-off functions, to better fit the general snake_case naming scheme. Also renamed some awfully long filenames. --- ...battlescene.asm => check_battle_scene.asm} | 0 ...sumehelditem.asm => consume_held_item.asm} | 0 ...ebattlehuds.asm => update_battle_huds.asm} | 0 ...pokeballwobble.asm => pokeball_wobble.asm} | 0 .../{loadfishinggfx.asm => fishing_gfx.asm} | 0 engine/events/haircut.asm | 82 ++++++++++++++++++ .../{playslowcry.asm => play_slow_cry.asm} | 0 engine/events/{specials_2.asm => shuckle.asm} | 83 ------------------- ...rworldfont.asm => load_overworld_font.asm} | 0 .../{loadpushoam.asm => load_push_oam.asm} | 0 .../{placegraphic.asm => place_graphic.asm} | 0 ...emonfrontpic.asm => trademon_frontpic.asm} | 0 .../pack_kris.asm} | 0 ...ription.asm => print_item_description.asm} | 0 ...iption.asm => update_item_description.asm} | 0 engine/link/{initlist.asm => init_list.asm} | 0 ...waitingtext.asm => place_waiting_text.asm} | 0 ...{getsquareroot.asm => get_square_root.asm} | 0 engine/math/{printnum.asm => print_num.asm} | 0 .../{emptyallsrambanks.asm => empty_sram.asm} | 0 .../{loadmappart.asm => load_map_part.asm} | 0 ...pokedexentry.asm => new_pokedex_entry.asm} | 0 engine/pokemon/{billspc.asm => bills_pc.asm} | 0 .../{billspctop.asm => bills_pc_top.asm} | 0 ...elgrowth.asm => breedmon_level_growth.asm} | 0 ...cknickerrors.asm => check_nick_errors.asm} | 0 ...ayerparty.asm => correct_party_errors.asm} | 2 +- .../pokemon/{knowsmove.asm => knows_move.asm} | 0 ...appinessmod.asm => level_up_happiness.asm} | 0 ...rinthoursmins.asm => print_hours_mins.asm} | 0 .../{timeofdaypals.asm => timeofday_pals.asm} | 0 main.asm | 61 +++++++------- 32 files changed, 114 insertions(+), 114 deletions(-) rename engine/battle/{checkbattlescene.asm => check_battle_scene.asm} (100%) rename engine/battle/{consumehelditem.asm => consume_held_item.asm} (100%) rename engine/battle/{updatebattlehuds.asm => update_battle_huds.asm} (100%) rename engine/battle_anims/{getpokeballwobble.asm => pokeball_wobble.asm} (100%) rename engine/events/{loadfishinggfx.asm => fishing_gfx.asm} (100%) create mode 100644 engine/events/haircut.asm rename engine/events/{playslowcry.asm => play_slow_cry.asm} (100%) rename engine/events/{specials_2.asm => shuckle.asm} (58%) rename engine/gfx/{loadoverworldfont.asm => load_overworld_font.asm} (100%) rename engine/gfx/{loadpushoam.asm => load_push_oam.asm} (100%) rename engine/gfx/{placegraphic.asm => place_graphic.asm} (100%) rename engine/gfx/{trademonfrontpic.asm => trademon_frontpic.asm} (100%) rename engine/{gfx/drawkrispackgfx.asm => items/pack_kris.asm} (100%) rename engine/items/{printitemdescription.asm => print_item_description.asm} (100%) rename engine/items/{updateitemdescription.asm => update_item_description.asm} (100%) rename engine/link/{initlist.asm => init_list.asm} (100%) rename engine/link/{placewaitingtext.asm => place_waiting_text.asm} (100%) rename engine/math/{getsquareroot.asm => get_square_root.asm} (100%) rename engine/math/{printnum.asm => print_num.asm} (100%) rename engine/menus/{emptyallsrambanks.asm => empty_sram.asm} (100%) rename engine/overworld/{loadmappart.asm => load_map_part.asm} (100%) rename engine/pokedex/{newpokedexentry.asm => new_pokedex_entry.asm} (100%) rename engine/pokemon/{billspc.asm => bills_pc.asm} (100%) rename engine/pokemon/{billspctop.asm => bills_pc_top.asm} (100%) rename engine/pokemon/{getbreedmonlevelgrowth.asm => breedmon_level_growth.asm} (100%) rename engine/pokemon/{checknickerrors.asm => check_nick_errors.asm} (100%) rename engine/pokemon/{correcterrorsinplayerparty.asm => correct_party_errors.asm} (98%) rename engine/pokemon/{knowsmove.asm => knows_move.asm} (100%) rename engine/pokemon/{leveluphappinessmod.asm => level_up_happiness.asm} (100%) rename engine/rtc/{printhoursmins.asm => print_hours_mins.asm} (100%) rename engine/tilesets/{timeofdaypals.asm => timeofday_pals.asm} (100%) diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/check_battle_scene.asm similarity index 100% rename from engine/battle/checkbattlescene.asm rename to engine/battle/check_battle_scene.asm diff --git a/engine/battle/consumehelditem.asm b/engine/battle/consume_held_item.asm similarity index 100% rename from engine/battle/consumehelditem.asm rename to engine/battle/consume_held_item.asm diff --git a/engine/battle/updatebattlehuds.asm b/engine/battle/update_battle_huds.asm similarity index 100% rename from engine/battle/updatebattlehuds.asm rename to engine/battle/update_battle_huds.asm diff --git a/engine/battle_anims/getpokeballwobble.asm b/engine/battle_anims/pokeball_wobble.asm similarity index 100% rename from engine/battle_anims/getpokeballwobble.asm rename to engine/battle_anims/pokeball_wobble.asm diff --git a/engine/events/loadfishinggfx.asm b/engine/events/fishing_gfx.asm similarity index 100% rename from engine/events/loadfishinggfx.asm rename to engine/events/fishing_gfx.asm diff --git a/engine/events/haircut.asm b/engine/events/haircut.asm new file mode 100644 index 000000000..0e4400235 --- /dev/null +++ b/engine/events/haircut.asm @@ -0,0 +1,82 @@ +BillsGrandfather: ; 73f7 + farcall SelectMonFromParty + jr c, .cancel + ld a, [wCurPartySpecies] + ld [wScriptVar], a + ld [wNamedObjectIndexBuffer], a + call GetPokemonName + jp CopyPokemonName_Buffer1_Buffer3 + +.cancel + xor a + ld [wScriptVar], a + ret + +YoungerHaircutBrother: ; 7413 + ld hl, HappinessData_YoungerHaircutBrother + jr HaircutOrGrooming + +OlderHaircutBrother: ; 7418 + ld hl, HappinessData_OlderHaircutBrother + jr HaircutOrGrooming + +DaisysGrooming: ; 741d + ld hl, HappinessData_DaisysGrooming + ; fallthrough + +HaircutOrGrooming: ; 7420 + push hl + farcall SelectMonFromParty + pop hl + jr c, .nope + ld a, [wCurPartySpecies] + cp EGG + jr z, .egg + push hl + call GetCurNick + call CopyPokemonName_Buffer1_Buffer3 + pop hl + call Random +; Bug: Subtracting $ff from $ff fails to set c. +; This can result in overflow into the next data array. +; In the case of getting a grooming from Daisy, we bleed +; into CopyPokemonName_Buffer1_Buffer3, which passes +; $d0 to ChangeHappiness and returns $73 to the script. +; The end result is that there is a 0.4% chance your +; Pokemon's happiness will not change at all. +.loop + sub [hl] + jr c, .ok + inc hl + inc hl + inc hl + jr .loop + +.ok + inc hl + ld a, [hli] + ld [wScriptVar], a + ld c, [hl] + call ChangeHappiness + ret + +.nope + xor a + ld [wScriptVar], a + ret + +.egg + ld a, 1 + ld [wScriptVar], a + ret + +INCLUDE "data/events/happiness_probabilities.asm" + +CopyPokemonName_Buffer1_Buffer3: ; 746e + ld hl, wStringBuffer1 + ld de, wStringBuffer3 + ld bc, MON_NAME_LENGTH + jp CopyBytes + +DummyPredef1: ; 747a + ret diff --git a/engine/events/playslowcry.asm b/engine/events/play_slow_cry.asm similarity index 100% rename from engine/events/playslowcry.asm rename to engine/events/play_slow_cry.asm diff --git a/engine/events/specials_2.asm b/engine/events/shuckle.asm similarity index 58% rename from engine/events/specials_2.asm rename to engine/events/shuckle.asm index 9a83b982b..99fcd7924 100644 --- a/engine/events/specials_2.asm +++ b/engine/events/shuckle.asm @@ -140,86 +140,3 @@ ReturnShuckle: ; 737e ld a, SHUCKIE_FAINTED ld [wScriptVar], a ret - -BillsGrandfather: ; 73f7 - farcall SelectMonFromParty - jr c, .cancel - ld a, [wCurPartySpecies] - ld [wScriptVar], a - ld [wNamedObjectIndexBuffer], a - call GetPokemonName - jp CopyPokemonName_Buffer1_Buffer3 - -.cancel - xor a - ld [wScriptVar], a - ret - -YoungerHaircutBrother: ; 7413 - ld hl, HappinessData_YoungerHaircutBrother - jr HaircutOrGrooming - -OlderHaircutBrother: ; 7418 - ld hl, HappinessData_OlderHaircutBrother - jr HaircutOrGrooming - -DaisysGrooming: ; 741d - ld hl, HappinessData_DaisysGrooming - ; fallthrough - -HaircutOrGrooming: ; 7420 - push hl - farcall SelectMonFromParty - pop hl - jr c, .nope - ld a, [wCurPartySpecies] - cp EGG - jr z, .egg - push hl - call GetCurNick - call CopyPokemonName_Buffer1_Buffer3 - pop hl - call Random -; Bug: Subtracting $ff from $ff fails to set c. -; This can result in overflow into the next data array. -; In the case of getting a grooming from Daisy, we bleed -; into CopyPokemonName_Buffer1_Buffer3, which passes -; $d0 to ChangeHappiness and returns $73 to the script. -; The end result is that there is a 0.4% chance your -; Pokemon's happiness will not change at all. -.loop - sub [hl] - jr c, .ok - inc hl - inc hl - inc hl - jr .loop - -.ok - inc hl - ld a, [hli] - ld [wScriptVar], a - ld c, [hl] - call ChangeHappiness - ret - -.nope - xor a - ld [wScriptVar], a - ret - -.egg - ld a, 1 - ld [wScriptVar], a - ret - -INCLUDE "data/events/happiness_probabilities.asm" - -CopyPokemonName_Buffer1_Buffer3: ; 746e - ld hl, wStringBuffer1 - ld de, wStringBuffer3 - ld bc, MON_NAME_LENGTH - jp CopyBytes - -DummyPredef1: ; 747a - ret diff --git a/engine/gfx/loadoverworldfont.asm b/engine/gfx/load_overworld_font.asm similarity index 100% rename from engine/gfx/loadoverworldfont.asm rename to engine/gfx/load_overworld_font.asm diff --git a/engine/gfx/loadpushoam.asm b/engine/gfx/load_push_oam.asm similarity index 100% rename from engine/gfx/loadpushoam.asm rename to engine/gfx/load_push_oam.asm diff --git a/engine/gfx/placegraphic.asm b/engine/gfx/place_graphic.asm similarity index 100% rename from engine/gfx/placegraphic.asm rename to engine/gfx/place_graphic.asm diff --git a/engine/gfx/trademonfrontpic.asm b/engine/gfx/trademon_frontpic.asm similarity index 100% rename from engine/gfx/trademonfrontpic.asm rename to engine/gfx/trademon_frontpic.asm diff --git a/engine/gfx/drawkrispackgfx.asm b/engine/items/pack_kris.asm similarity index 100% rename from engine/gfx/drawkrispackgfx.asm rename to engine/items/pack_kris.asm diff --git a/engine/items/printitemdescription.asm b/engine/items/print_item_description.asm similarity index 100% rename from engine/items/printitemdescription.asm rename to engine/items/print_item_description.asm diff --git a/engine/items/updateitemdescription.asm b/engine/items/update_item_description.asm similarity index 100% rename from engine/items/updateitemdescription.asm rename to engine/items/update_item_description.asm diff --git a/engine/link/initlist.asm b/engine/link/init_list.asm similarity index 100% rename from engine/link/initlist.asm rename to engine/link/init_list.asm diff --git a/engine/link/placewaitingtext.asm b/engine/link/place_waiting_text.asm similarity index 100% rename from engine/link/placewaitingtext.asm rename to engine/link/place_waiting_text.asm diff --git a/engine/math/getsquareroot.asm b/engine/math/get_square_root.asm similarity index 100% rename from engine/math/getsquareroot.asm rename to engine/math/get_square_root.asm diff --git a/engine/math/printnum.asm b/engine/math/print_num.asm similarity index 100% rename from engine/math/printnum.asm rename to engine/math/print_num.asm diff --git a/engine/menus/emptyallsrambanks.asm b/engine/menus/empty_sram.asm similarity index 100% rename from engine/menus/emptyallsrambanks.asm rename to engine/menus/empty_sram.asm diff --git a/engine/overworld/loadmappart.asm b/engine/overworld/load_map_part.asm similarity index 100% rename from engine/overworld/loadmappart.asm rename to engine/overworld/load_map_part.asm diff --git a/engine/pokedex/newpokedexentry.asm b/engine/pokedex/new_pokedex_entry.asm similarity index 100% rename from engine/pokedex/newpokedexentry.asm rename to engine/pokedex/new_pokedex_entry.asm diff --git a/engine/pokemon/billspc.asm b/engine/pokemon/bills_pc.asm similarity index 100% rename from engine/pokemon/billspc.asm rename to engine/pokemon/bills_pc.asm diff --git a/engine/pokemon/billspctop.asm b/engine/pokemon/bills_pc_top.asm similarity index 100% rename from engine/pokemon/billspctop.asm rename to engine/pokemon/bills_pc_top.asm diff --git a/engine/pokemon/getbreedmonlevelgrowth.asm b/engine/pokemon/breedmon_level_growth.asm similarity index 100% rename from engine/pokemon/getbreedmonlevelgrowth.asm rename to engine/pokemon/breedmon_level_growth.asm diff --git a/engine/pokemon/checknickerrors.asm b/engine/pokemon/check_nick_errors.asm similarity index 100% rename from engine/pokemon/checknickerrors.asm rename to engine/pokemon/check_nick_errors.asm diff --git a/engine/pokemon/correcterrorsinplayerparty.asm b/engine/pokemon/correct_party_errors.asm similarity index 98% rename from engine/pokemon/correcterrorsinplayerparty.asm rename to engine/pokemon/correct_party_errors.asm index e815aa4c8..cf60115ee 100644 --- a/engine/pokemon/correcterrorsinplayerparty.asm +++ b/engine/pokemon/correct_party_errors.asm @@ -1,4 +1,4 @@ -Unreferenced_CorrectErrorsInPlayerParty: +Unreferenced_CorrectPartyErrors: ld hl, wPartyCount ld a, [hl] and a diff --git a/engine/pokemon/knowsmove.asm b/engine/pokemon/knows_move.asm similarity index 100% rename from engine/pokemon/knowsmove.asm rename to engine/pokemon/knows_move.asm diff --git a/engine/pokemon/leveluphappinessmod.asm b/engine/pokemon/level_up_happiness.asm similarity index 100% rename from engine/pokemon/leveluphappinessmod.asm rename to engine/pokemon/level_up_happiness.asm diff --git a/engine/rtc/printhoursmins.asm b/engine/rtc/print_hours_mins.asm similarity index 100% rename from engine/rtc/printhoursmins.asm rename to engine/rtc/print_hours_mins.asm diff --git a/engine/tilesets/timeofdaypals.asm b/engine/tilesets/timeofday_pals.asm similarity index 100% rename from engine/tilesets/timeofdaypals.asm rename to engine/tilesets/timeofday_pals.asm diff --git a/main.asm b/main.asm index 82e00596b..fac1b8f3f 100644 --- a/main.asm +++ b/main.asm @@ -3,18 +3,19 @@ INCLUDE "constants.asm" SECTION "bank1", ROMX -INCLUDE "engine/link/placewaitingtext.asm" -INCLUDE "engine/gfx/loadpushoam.asm" +INCLUDE "engine/link/place_waiting_text.asm" +INCLUDE "engine/gfx/load_push_oam.asm" INCLUDE "engine/overworld/map_objects.asm" INCLUDE "engine/menus/intro_menu.asm" INCLUDE "engine/overworld/init_map.asm" INCLUDE "engine/pokemon/learn.asm" -INCLUDE "engine/pokemon/checknickerrors.asm" +INCLUDE "engine/pokemon/check_nick_errors.asm" INCLUDE "engine/math/math.asm" INCLUDE "data/items/attributes.asm" INCLUDE "engine/overworld/npc_movement.asm" INCLUDE "engine/events/happiness_egg.asm" -INCLUDE "engine/events/specials_2.asm" +INCLUDE "engine/events/shuckle.asm" +INCLUDE "engine/events/haircut.asm" SECTION "bank2", ROMX @@ -29,19 +30,19 @@ SECTION "bank3", ROMX INCLUDE "engine/events/checktime.asm" INCLUDE "engine/events/specials.asm" -INCLUDE "engine/math/printnum.asm" +INCLUDE "engine/math/print_num.asm" INCLUDE "engine/pokemon/health.asm" INCLUDE "engine/events/overworld.asm" INCLUDE "engine/items/items.asm" INCLUDE "engine/overworld/player_step.asm" INCLUDE "engine/battle/anim_hp_bar.asm" INCLUDE "engine/pokemon/move_mon.asm" -INCLUDE "engine/pokemon/billspctop.asm" -INCLUDE "engine/pokemon/getbreedmonlevelgrowth.asm" +INCLUDE "engine/pokemon/bills_pc_top.asm" +INCLUDE "engine/pokemon/breedmon_level_growth.asm" INCLUDE "engine/events/bug_contest/caught_mon.asm" INCLUDE "engine/items/item_effects.asm" -INCLUDE "engine/battle_anims/getpokeballwobble.asm" -INCLUDE "engine/pokemon/knowsmove.asm" +INCLUDE "engine/battle_anims/pokeball_wobble.asm" +INCLUDE "engine/pokemon/knows_move.asm" SECTION "bank4", ROMX @@ -64,8 +65,8 @@ INCLUDE "engine/events/std_collision.asm" INCLUDE "engine/events/bug_contest/judging.asm" INCLUDE "engine/events/pokerus/apply_pokerus_tick.asm" INCLUDE "engine/events/bug_contest/contest_2.asm" -INCLUDE "engine/pokemon/correcterrorsinplayerparty.asm" -INCLUDE "engine/math/getsquareroot.asm" +INCLUDE "engine/pokemon/correct_party_errors.asm" +INCLUDE "engine/math/get_square_root.asm" SECTION "bank5", ROMX @@ -102,7 +103,7 @@ SECTION "bank9", ROMX INCLUDE "data/text_buffers.asm" INCLUDE "engine/menus/menu.asm" -INCLUDE "engine/items/updateitemdescription.asm" +INCLUDE "engine/items/update_item_description.asm" INCLUDE "engine/events/pokepic.asm" INCLUDE "engine/overworld/map_objects_2.asm" INCLUDE "engine/menus/scrolling_menu.asm" @@ -114,11 +115,11 @@ INCLUDE "engine/items/buy_sell_toss.asm" INCLUDE "engine/menus/trainer_card.asm" INCLUDE "engine/events/prof_oaks_pc.asm" INCLUDE "engine/overworld/decorations.asm" -INCLUDE "engine/pokemon/leveluphappinessmod.asm" +INCLUDE "engine/pokemon/level_up_happiness.asm" INCLUDE "engine/battle/read_trainer_dvs.asm" INCLUDE "data/trainers/dvs.asm" INCLUDE "engine/battle/returntobattle_useball.asm" -INCLUDE "engine/battle/consumehelditem.asm" +INCLUDE "engine/battle/consume_held_item.asm" INCLUDE "data/moves/effects_pointers.asm" INCLUDE "data/moves/effects.asm" INCLUDE "engine/events/kurt_selectquantity_interpretjoypad.asm" @@ -148,7 +149,7 @@ INCLUDE "engine/items/tmhm.asm" INCLUDE "data/moves/descriptions.asm" INCLUDE "engine/events/pokerus/pokerus.asm" INCLUDE "engine/battle/start_battle.asm" -INCLUDE "engine/gfx/placegraphic.asm" +INCLUDE "engine/gfx/place_graphic.asm" SECTION "Effect Commands", ROMX @@ -192,7 +193,7 @@ INCLUDE "engine/pokemon/mail.asm" SECTION "Crystal Features 1", ROMX INCLUDE "engine/menus/init_gender.asm" -INCLUDE "engine/gfx/drawkrispackgfx.asm" +INCLUDE "engine/items/pack_kris.asm" INCLUDE "engine/events/move_tutor.asm" INCLUDE "engine/gfx/crystal_layouts.asm" INCLUDE "engine/events/celebi.asm" @@ -208,11 +209,11 @@ SECTION "bank13", ROMX INCLUDE "engine/tilesets/map_palettes.asm" INCLUDE "gfx/tileset_palette_maps.asm" INCLUDE "data/collision_permissions.asm" -INCLUDE "engine/menus/emptyallsrambanks.asm" +INCLUDE "engine/menus/empty_sram.asm" INCLUDE "engine/menus/savemenu_copytilemapatonce.asm" INCLUDE "engine/events/checksave.asm" INCLUDE "data/maps/scenes.asm" -INCLUDE "engine/overworld/loadmappart.asm" +INCLUDE "engine/overworld/load_map_part.asm" INCLUDE "engine/phone/phonering_copytilemapatonce.asm" Shrink1Pic: ; 4d249 @@ -226,7 +227,7 @@ INCLUDE "engine/rtc/reset_password.asm" INCLUDE "engine/menus/delete_save.asm" INCLUDE "data/tilesets.asm" INCLUDE "engine/smallflag.asm" -INCLUDE "engine/gfx/trademonfrontpic.asm" +INCLUDE "engine/gfx/trademon_frontpic.asm" INCLUDE "engine/events/pokerus/check_pokerus.asm" INCLUDE "engine/events/lucky_number.asm" INCLUDE "engine/pokemon/caught_data.asm" @@ -238,7 +239,7 @@ INCLUDE "engine/movie/init_hof_credits.asm" INCLUDE "engine/events/battle_tower/get_trainer_class.asm" INCLUDE "engine/battle/sliding_intro.asm" INCLUDE "mobile/print_opp_message.asm" -INCLUDE "engine/battle/checkbattlescene.asm" +INCLUDE "engine/battle/check_battle_scene.asm" INCLUDE "engine/movie/gbc_only.asm" INCLUDE "engine/events/poke_seer.asm" @@ -256,7 +257,7 @@ INCLUDE "engine/pokemon/tempmon.asm" INCLUDE "engine/pokemon/types.asm" INCLUDE "engine/battle/unreferenced_getgen1trainerclassname.asm" INCLUDE "engine/pokemon/mon_stats.asm" -INCLUDE "engine/link/initlist.asm" +INCLUDE "engine/link/init_list.asm" INCLUDE "engine/pokemon/experience.asm" INCLUDE "engine/pokemon/switchpartymons.asm" INCLUDE "engine/gfx/load_pics.asm" @@ -305,7 +306,7 @@ INCLUDE "mobile/mobile_22_2.asm" SECTION "bank23", ROMX -INCLUDE "engine/tilesets/timeofdaypals.asm" +INCLUDE "engine/tilesets/timeofday_pals.asm" INCLUDE "engine/battle/battle_transition.asm" INCLUDE "engine/events/field_moves.asm" INCLUDE "engine/events/magnet_train.asm" @@ -356,7 +357,7 @@ SECTION "bank2E", ROMX INCLUDE "engine/events/map_name_sign.asm" INCLUDE "engine/events/checkforhiddenitems.asm" INCLUDE "engine/events/treemons.asm" -INCLUDE "engine/events/loadfishinggfx.asm" +INCLUDE "engine/events/fishing_gfx.asm" INCLUDE "engine/pokegear/radio.asm" INCLUDE "engine/pokemon/mail_2.asm" @@ -434,7 +435,7 @@ INCLUDE "engine/events/print_unown_2.asm" INCLUDE "engine/games/card_flip.asm" INCLUDE "engine/games/unown_puzzle.asm" INCLUDE "engine/games/dummy_game.asm" -INCLUDE "engine/pokemon/billspc.asm" +INCLUDE "engine/pokemon/bills_pc.asm" SECTION "bank39", ROMX @@ -451,8 +452,8 @@ SECTION "bank3E", ROMX INCLUDE "engine/gfx/load_font.asm" INCLUDE "engine/link/time_capsule.asm" INCLUDE "engine/events/name_rater.asm" -INCLUDE "engine/events/playslowcry.asm" -INCLUDE "engine/pokedex/newpokedexentry.asm" +INCLUDE "engine/events/play_slow_cry.asm" +INCLUDE "engine/pokedex/new_pokedex_entry.asm" INCLUDE "engine/link/time_capsule_2.asm" INCLUDE "engine/pokedex/unown_dex.asm" INCLUDE "engine/events/magikarp.asm" @@ -478,7 +479,7 @@ INCLUDE "engine/overworld/warp_connection.asm" INCLUDE "engine/link/mystery_gift.asm" INCLUDE "engine/battle/used_move_text.asm" INCLUDE "mobile/mobile_41.asm" -INCLUDE "engine/gfx/loadoverworldfont.asm" +INCLUDE "engine/gfx/load_overworld_font.asm" SECTION "Mobile 42", ROMX @@ -527,7 +528,7 @@ INCLUDE "data/phone/text/extra2.asm" SECTION "UpdateBattleHUDs", ROMX -INCLUDE "engine/battle/updatebattlehuds.asm" +INCLUDE "engine/battle/update_battle_huds.asm" SECTION "Mobile 5E", ROMX @@ -567,7 +568,7 @@ INCLUDE "data/phone/text/trainers.asm" SECTION "Miscellaneous Text", ROMX INCLUDE "data/items/names.asm" -INCLUDE "engine/items/printitemdescription.asm" +INCLUDE "engine/items/print_item_description.asm" INCLUDE "data/items/descriptions.asm" INCLUDE "data/moves/names.asm" INCLUDE "engine/overworld/landmarks.asm" @@ -583,7 +584,7 @@ INCLUDE "engine/printer/print_party.asm" SECTION "bank77_2", ROMX -INCLUDE "engine/rtc/printhoursmins.asm" +INCLUDE "engine/rtc/print_hours_mins.asm" INCLUDE "engine/events/diploma.asm" INCLUDE "engine/pokedex/pokedex_3.asm" INCLUDE "engine/events/catch_tutorial_input.asm" From e1da37e03303b1a6dd6531d8a044339f337731a1 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 4 Apr 2018 22:35:47 +0200 Subject: [PATCH 10/16] Comment SapHealth Also fixed some Beat Up inconsistencies to make it more readable. --- engine/battle/effect_commands.asm | 27 +++++++++++++++++++------- engine/battle/move_effects/beat_up.asm | 22 ++++++++++++++++----- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 376624e44..9e304df72 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -4136,6 +4136,7 @@ BattleCommand_EatDream: ; 36008 SapHealth: ; 36011 + ; Divide damage by 2, store it in hDividend ld hl, wCurDamage ld a, [hli] srl a @@ -4145,10 +4146,11 @@ SapHealth: ; 36011 rr a ld [hDividend + 1], a or b - jr nz, .ok1 - ld a, $1 + jr nz, .at_least_one + ld a, 1 ld [hDividend + 1], a -.ok1 +.at_least_one + ld hl, wBattleMonHP ld de, wBattleMonMaxHP ld a, [hBattleTurn] @@ -4157,12 +4159,16 @@ SapHealth: ; 36011 ld hl, wEnemyMonHP ld de, wEnemyMonMaxHP .battlemonhp + + ; Store current HP in little endian wBuffer3/4 ld bc, wBuffer4 ld a, [hli] ld [bc], a ld a, [hl] dec bc ld [bc], a + + ; Store max HP in little endian wBuffer1/2 ld a, [de] dec bc ld [bc], a @@ -4170,6 +4176,8 @@ SapHealth: ; 36011 ld a, [de] dec bc ld [bc], a + + ; Add hDividend to current HP and copy it to little endian wBuffer5/6 ld a, [hDividend + 1] ld b, [hl] add b @@ -4180,7 +4188,9 @@ SapHealth: ; 36011 adc b ld [hli], a ld [wBuffer6], a - jr c, .okay2 + jr c, .max_hp + + ; Substract current HP from max HP (to see if we have more than max HP) ld a, [hld] ld b, a ld a, [de] @@ -4191,8 +4201,10 @@ SapHealth: ; 36011 ld a, [de] inc de sbc b - jr nc, .okay3 -.okay2 + jr nc, .finish + +.max_hp + ; Load max HP into current HP and copy it to little endian wBuffer5/6 ld a, [de] ld [hld], a ld [wBuffer5], a @@ -4201,7 +4213,8 @@ SapHealth: ; 36011 ld [hli], a ld [wBuffer6], a inc de -.okay3 + +.finish ld a, [hBattleTurn] and a hlcoord 10, 9 diff --git a/engine/battle/move_effects/beat_up.asm b/engine/battle/move_effects/beat_up.asm index 18e350504..2f326e362 100644 --- a/engine/battle/move_effects/beat_up.asm +++ b/engine/battle/move_effects/beat_up.asm @@ -5,9 +5,11 @@ BattleCommand_BeatUp: ; 35461 ld a, [hBattleTurn] and a jp nz, .enemy_beats_up + ld a, [wPlayerSubStatus3] bit SUBSTATUS_IN_LOOP, a jr nz, .next_mon + ld c, 20 call DelayFrames xor a @@ -51,11 +53,13 @@ BattleCommand_BeatUp: ; 35461 ld [wBeatUpHitAtLeastOnce], a ld hl, BeatUpAttackText call StdBattleTextBox + ld a, [wEnemyMonSpecies] ld [wCurSpecies], a call GetBaseData ld a, [wBaseDefense] ld c, a + push bc ld a, MON_SPECIES call GetBeatupMonLocation @@ -65,12 +69,14 @@ BattleCommand_BeatUp: ; 35461 ld a, [wBaseAttack] pop bc ld b, a + push bc ld a, MON_LEVEL call GetBeatupMonLocation ld a, [hl] ld e, a pop bc + ld a, [wPlayerMoveStructPower] ld d, a ret @@ -78,21 +84,22 @@ BattleCommand_BeatUp: ; 35461 .enemy_beats_up ld a, [wEnemySubStatus3] bit SUBSTATUS_IN_LOOP, a - jr nz, .not_first_enemy_beatup + jr nz, .enemy_next_mon xor a ld [wEnemyRolloutCount], a ld [wd002], a ld [wBeatUpHitAtLeastOnce], a - jr .enemy_continue + jr .enemy_got_mon -.not_first_enemy_beatup +.enemy_next_mon ld a, [wEnemyRolloutCount] ld b, a ld a, [wOTPartyCount] sub b ld [wd002], a -.enemy_continue + +.enemy_got_mon ld a, [wBattleMode] dec a jr z, .wild @@ -122,19 +129,20 @@ BattleCommand_BeatUp: ; 35461 call AddNTimes ld de, wStringBuffer1 call CopyBytes + .got_enemy_nick ld a, MON_HP call GetBeatupMonLocation ld a, [hli] or [hl] jp z, .beatup_fail + ld a, [wd002] ld b, a ld a, [wCurOTMon] cp b ld hl, wEnemyMonStatus jr z, .active_enemy - ld a, MON_STATUS call GetBeatupMonLocation .active_enemy @@ -157,11 +165,13 @@ BattleCommand_BeatUp: ; 35461 .finish_beatup ld hl, BeatUpAttackText call StdBattleTextBox + ld a, [wBattleMonSpecies] ld [wCurSpecies], a call GetBaseData ld a, [wBaseDefense] ld c, a + push bc ld a, MON_SPECIES call GetBeatupMonLocation @@ -171,12 +181,14 @@ BattleCommand_BeatUp: ; 35461 ld a, [wBaseAttack] pop bc ld b, a + push bc ld a, MON_LEVEL call GetBeatupMonLocation ld a, [hl] ld e, a pop bc + ld a, [wEnemyMoveStructPower] ld d, a ret From 682ca7e93c635b21b7ac3db709ba6296c53fa080 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Thu, 29 Mar 2018 10:57:55 +0200 Subject: [PATCH 11/16] Label bidefailtext This "unknown" battle command is actually used to give the proper fail message to bide. --- data/battle/effect_command_pointers.asm | 2 +- data/moves/effects.asm | 2 +- engine/battle/effect_commands.asm | 2 +- macros/scripts/battle_commands.asm | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/battle/effect_command_pointers.asm b/data/battle/effect_command_pointers.asm index b3eeea273..ae780dca6 100644 --- a/data/battle/effect_command_pointers.asm +++ b/data/battle/effect_command_pointers.asm @@ -168,7 +168,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand_RageDamage ; 3527b dw BattleCommand_ResetTypeMatchup ; 34833 dw BattleCommand_AllStatsUp ; 36500 - dw BattleCommanda5 ; 35165 + dw BattleCommand_BideFailText ; 35165 dw BattleCommand_RaiseSubNoAnim ; 365af dw BattleCommand_LowerSubNoAnim ; 365c3 dw BattleCommanda8 ; 355b5 diff --git a/data/moves/effects.asm b/data/moves/effects.asm index c56ff2560..0a52319fb 100644 --- a/data/moves/effects.asm +++ b/data/moves/effects.asm @@ -797,7 +797,7 @@ Bide: resettypematchup checkhit hittarget - effect0xa5 + bidefailtext checkfaint checkdestinybond buildopponentrage diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 9e304df72..9433c33b4 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -2437,7 +2437,7 @@ FailText_CheckOpponentProtect: ; 35157 ; 35165 -BattleCommanda5: ; 35165 +BattleCommand_BideFailText: ; 35165 ld a, [wAttackMissed] and a ret z diff --git a/macros/scripts/battle_commands.asm b/macros/scripts/battle_commands.asm index 33d7dc611..7802d0329 100644 --- a/macros/scripts/battle_commands.asm +++ b/macros/scripts/battle_commands.asm @@ -169,7 +169,7 @@ ENDM command ragedamage ; a2 command resettypematchup ; a3 command allstatsup ; a4 - command effect0xa5 ; a5 + command bidefailtext ; a5 command raisesubnoanim ; a6 command lowersubnoanim ; a7 command effect0xa8 ; a8 From c1e3d17769aa3088556dcd1142944541f7f6fd0e Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 3 Apr 2018 01:05:44 +0200 Subject: [PATCH 12/16] `endloop` loops back to critical itself The comments seemed to specify that `endloop` loops back to the command before `critical` and executes that, which simply isn't true. It loops back to `critical` itself, and executes `critical`, before continuing on with the remaining commands. --- engine/battle/effect_commands.asm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 9433c33b4..16b3cea9a 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -5651,7 +5651,7 @@ CheckPlayerHasMonToSwitchTo: ; 36994 BattleCommand_EndLoop: ; 369b6 ; endloop -; Loop back to the command before 'critical'. +; Loop back to 'critical'. ld de, wPlayerRolloutCount ld bc, wPlayerDamageTaken @@ -5766,7 +5766,6 @@ BattleCommand_EndLoop: ; 369b6 ld [bc], a ret -; Loop back to the command before 'critical'. .loop_back_to_critical ld a, [wBattleScriptBufferAddress + 1] ld h, a From 800f9489145dc7c82edb3fa86fc24a5ff7411533 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 3 Apr 2018 12:00:24 +0200 Subject: [PATCH 13/16] Label BattleCommand_BeatUpFailText --- data/battle/effect_command_pointers.asm | 2 +- data/moves/effects.asm | 2 +- engine/battle/effect_commands.asm | 2 +- engine/battle/move_effects/beat_up.asm | 4 +++- macros/scripts/battle_commands.asm | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/data/battle/effect_command_pointers.asm b/data/battle/effect_command_pointers.asm index ae780dca6..a57e08be7 100644 --- a/data/battle/effect_command_pointers.asm +++ b/data/battle/effect_command_pointers.asm @@ -171,7 +171,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand_BideFailText ; 35165 dw BattleCommand_RaiseSubNoAnim ; 365af dw BattleCommand_LowerSubNoAnim ; 365c3 - dw BattleCommanda8 ; 355b5 + dw BattleCommand_BeatUpFailText ; 355b5 dw BattleCommand_ClearMissDamage ; 355d5 - a9 dw BattleCommand_MoveDelay ; 37e80 dw BattleCommand_HitTarget ; 34f57 diff --git a/data/moves/effects.asm b/data/moves/effects.asm index 0a52319fb..a262babe2 100644 --- a/data/moves/effects.asm +++ b/data/moves/effects.asm @@ -2056,7 +2056,7 @@ BeatUp: checkdestinybond buildopponentrage endloop - effect0xa8 + beatupfailtext raisesub kingsrock endmove diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 16b3cea9a..b9a7382c0 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -5714,7 +5714,7 @@ BattleCommand_EndLoop: ; 369b6 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr res SUBSTATUS_IN_LOOP, [hl] - call BattleCommanda8 + call BattleCommand_BeatUpFailText jp EndMoveEffect .not_triple_kick diff --git a/engine/battle/move_effects/beat_up.asm b/engine/battle/move_effects/beat_up.asm index 2f326e362..8ea308d90 100644 --- a/engine/battle/move_effects/beat_up.asm +++ b/engine/battle/move_effects/beat_up.asm @@ -203,7 +203,9 @@ BattleCommand_BeatUp: ; 35461 ; 355b5 -BattleCommanda8: ; 355b5 +BattleCommand_BeatUpFailText: ; 355b5 +; beatupfailtext + ld a, [wBeatUpHitAtLeastOnce] and a ret nz diff --git a/macros/scripts/battle_commands.asm b/macros/scripts/battle_commands.asm index 7802d0329..db446d9ff 100644 --- a/macros/scripts/battle_commands.asm +++ b/macros/scripts/battle_commands.asm @@ -172,7 +172,7 @@ ENDM command bidefailtext ; a5 command raisesubnoanim ; a6 command lowersubnoanim ; a7 - command effect0xa8 ; a8 + command beatupfailtext ; a8 command clearmissdamage ; a9 command movedelay ; aa command hittarget ; ab From 2958188fc6d1ea8d9a5c2d4f0d5a4e3d6ca8faaa Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 3 Apr 2018 13:15:18 +0200 Subject: [PATCH 14/16] Document more Beat Up-related bugs Two bugs related to not raising the substitute when it should, one bug related to not running king's rock when it should, and the other related to running king's rock when it shouldn't. Fun. --- docs/bugs_and_glitches.md | 78 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 0212ed6fc..1e63839a9 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -15,6 +15,8 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th - [A Pokémon that fainted from Pursuit will have its old status condition when revived](#a-pokémon-that-fainted-from-pursuit-will-have-its-old-status-condition-when-revived) - [Lock-On and Mind Reader don't always bypass Fly and Dig](#lock-on-and-mind-reader-dont-always-bypass-fly-and-dig) - [Beat Up can desynchronize link battles](#beat-up-can-desynchronize-link-battles) +- [Beat Up may fail to raise substitute](#beat-up-may-fail-to-raise-substitute) +- [Beat Up may trigger King's Rock even if it failed](#beat-up-may-trigger-kings-rock-even-if-it-failed) - [Present damage is incorrect in link battles](#present-damage-is-incorrect-in-link-battles) - ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pokémon-is-badly-poisoned) - [AI makes a false assumption about `CheckTypeMatchup`](#ai-makes-a-false-assumption-about-checktypematchup) @@ -339,6 +341,82 @@ This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up **Fix:** Change `cp [hl]` to `cp c`. +## Beat Up may fail to raise substitute + +*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* +(Only the fixes denoted with "breaking" will actually break compatibility, the others just affect what's shown on the screen with the patched game) + +This is a bug in `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that prevents the rest of the move's effect from being executed if the player or enemy only has one mon in their party while using Beat Up. + +It prevents the substitute from being raised and the King's Rock from working. + +```asm +.only_one_beatup + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarAddr + res SUBSTATUS_IN_LOOP, [hl] + call BattleCommand_BeatUpFailText + jp EndMoveEffect +``` + +**Fix (breaking):** Replace the last two lines with `ret`. +**Fix (cosmetics):** Call `BattleCommand_RaiseSub` before the `jp`. + +There's a similar oversight in `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that will prevent the substitute from being raised if Beat Up is protected against. + +```asm + cp EFFECT_MULTI_HIT + jr z, .multihit + cp EFFECT_DOUBLE_HIT + jr z, .multihit + cp EFFECT_POISON_MULTI_HIT + jr z, .multihit + jp EndMoveEffect + +.multihit + call BattleCommand_RaiseSub + jp EndMoveEffect +``` + +**Fix:** Check for `EFFECT_BEAT_UP` as well. + + +## Beat Up may trigger King's Rock even if it failed + +*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* + +This is a bug in how `wAttackMissed` is never set by BeatUp, even when none of the 'mon have been able to attack (due to being fainted or having a status effect), the King's Rock may activate. + +This bug can be fixed in a plethora of ways, but the most straight-forward would be in `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm), as that's always ran before the king's rock effect. + +```asm +BattleCommand_BeatUpFailText: ; 355b5 +; beatupfailtext + + ld a, [wBeatUpHitAtLeastOnce] + and a + ret nz + + jp PrintButItFailed +``` + +**Fix:** + +```asm +BattleCommand_BeatUpFailText: ; 355b5 +; beatupfailtext + + ld a, [wBeatUpHitAtLeastOnce] + and a + ret nz + + inc a + ld [wAttackMissed], a + + jp PrintButItFailed +``` + + ## Present damage is incorrect in link battles *Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* From d4025863cf56466b79827bace6d6b3e48ffd05e9 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 4 Apr 2018 23:27:40 +0200 Subject: [PATCH 15/16] Rename some battle commands `hittarget` was misleading, as it doesn't actually "hit" the target, it only plays the animation. As such, I've renamed it to `moveanim`. `checkfaint` has nothing to do with checking if the user or target has fainted, instead, it applies wCurDamage onto the target's HP, hitting the substitute if applicable. I've renamed the command to `applydamage` and all of its subfunctions accordingly. --- data/battle/effect_command_pointers.asm | 6 +- data/moves/effects.asm | 248 ++++++++++----------- engine/battle/effect_commands.asm | 120 +++++----- engine/battle/move_effects/false_swipe.asm | 6 + macros/scripts/battle_commands.asm | 6 +- 5 files changed, 198 insertions(+), 188 deletions(-) diff --git a/data/battle/effect_command_pointers.asm b/data/battle/effect_command_pointers.asm index a57e08be7..f18e3c230 100644 --- a/data/battle/effect_command_pointers.asm +++ b/data/battle/effect_command_pointers.asm @@ -14,10 +14,10 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand_DamageVariation ; 34cfd dw BattleCommand_CheckHit ; 34d32 dw BattleCommand_LowerSub ; 34eee - dw BattleCommand_HitTargetNoSub ; 34f60 + dw BattleCommand_MoveAnimNoSub ; 34f60 dw BattleCommand_RaiseSub ; 35004 dw BattleCommand_FailureText ; 35023 - dw BattleCommand_CheckFaint ; 3505e + dw BattleCommand_ApplyDamage ; 3505e dw BattleCommand_CriticalText ; 35175 dw BattleCommand_SuperEffectiveText ; 351ad dw BattleCommand_CheckDestinyBond ; 351c0 @@ -174,7 +174,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand_BeatUpFailText ; 355b5 dw BattleCommand_ClearMissDamage ; 355d5 - a9 dw BattleCommand_MoveDelay ; 37e80 - dw BattleCommand_HitTarget ; 34f57 + dw BattleCommand_MoveAnim ; 34f57 dw BattleCommand_TriStatusChance ; 3658f dw BattleCommand_SuperEffectiveLoopText ; 351a5 dw BattleCommand_StartLoop ; 35197 diff --git a/data/moves/effects.asm b/data/moves/effects.asm index a262babe2..eeb02b3a1 100644 --- a/data/moves/effects.asm +++ b/data/moves/effects.asm @@ -10,9 +10,9 @@ NormalHit: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -40,9 +40,9 @@ PoisonHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -60,9 +60,9 @@ LeechHit: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext draintarget @@ -82,9 +82,9 @@ BurnHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -103,9 +103,9 @@ FreezeHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -124,9 +124,9 @@ ParalyzeHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -145,9 +145,9 @@ Selfdestruct: damagevariation checkhit selfdestruct - hittargetnosub + moveanimnosub failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -165,9 +165,9 @@ DreamEater: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext eatdream @@ -544,9 +544,9 @@ AttackDownHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -566,9 +566,9 @@ DefenseDownHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -589,9 +589,9 @@ SpeedDownHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -611,9 +611,9 @@ SpecialAttackDownHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -633,9 +633,9 @@ SpecialDefenseDownHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -655,9 +655,9 @@ AccuracyDownHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -677,9 +677,9 @@ EvasionDownHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -699,9 +699,9 @@ DefenseUpHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -721,9 +721,9 @@ AttackUpHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -743,9 +743,9 @@ AllUpHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -763,9 +763,9 @@ PayDay: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext payday @@ -796,9 +796,9 @@ Bide: unleashenergy resettypematchup checkhit - hittarget + moveanim bidefailtext - checkfaint + applydamage checkdestinybond buildopponentrage kingsrock @@ -817,9 +817,9 @@ Rampage: stab damagevariation clearmissdamage - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -848,9 +848,9 @@ MultiHit: stab damagevariation clearmissdamage - hittargetnosub + moveanimnosub failuretext - checkfaint + applydamage criticaltext cleartext supereffectivelooptext @@ -875,9 +875,9 @@ PoisonMultiHit: stab damagevariation clearmissdamage - hittargetnosub + moveanimnosub failuretext - checkfaint + applydamage criticaltext cleartext supereffectivelooptext @@ -900,9 +900,9 @@ FlinchHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -916,9 +916,9 @@ OHKOHit: doturn stab ohko - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -935,9 +935,9 @@ RecoilHit: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext recoil @@ -980,9 +980,9 @@ ConfuseHit: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1022,9 +1022,9 @@ TriAttack: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1066,9 +1066,9 @@ SkyAttack: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1094,9 +1094,9 @@ HyperBeam: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext rechargenextturn @@ -1115,10 +1115,10 @@ Rage: checkhit ragedamage damagevariation - hittarget + moveanim failuretext rage - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1176,9 +1176,9 @@ RazorWind: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1198,10 +1198,10 @@ Fly: stab damagevariation checkhit - hittargetnosub + moveanimnosub raisesub failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1220,9 +1220,9 @@ TrapTarget: stab damagevariation clearmissdamage - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1239,9 +1239,9 @@ StaticDamage: constantdamage checkhit resettypematchup - hittarget + moveanim failuretext - checkfaint + applydamage checkdestinybond buildopponentrage kingsrock @@ -1254,9 +1254,9 @@ Reversal: constantdamage stab checkhit - hittarget + moveanim failuretext - checkfaint + applydamage supereffectivetext checkdestinybond buildopponentrage @@ -1268,9 +1268,9 @@ Counter: usedmovetext doturn counter - hittarget + moveanim failuretext - checkfaint + applydamage checkdestinybond buildopponentrage kingsrock @@ -1304,9 +1304,9 @@ Snore: checkhit effectchance snore - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1378,9 +1378,9 @@ FalseSwipe: damagevariation falseswipe checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1409,9 +1409,9 @@ TripleKick: stab damagevariation clearmissdamage - hittargetnosub + moveanimnosub failuretext - checkfaint + applydamage criticaltext cleartext supereffectivelooptext @@ -1434,9 +1434,9 @@ Thief: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext thief @@ -1470,9 +1470,9 @@ FlameWheel: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext defrost @@ -1543,9 +1543,9 @@ Rollout: checkhit rolloutpower damagevariation - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1582,9 +1582,9 @@ FuryCutter: checkhit furycutter damagevariation - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1611,9 +1611,9 @@ Return: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1634,7 +1634,7 @@ Present: damagevariation clearmissdamage failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1653,9 +1653,9 @@ Frustration: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1681,9 +1681,9 @@ SacredFire: damagevariation checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext defrost @@ -1704,9 +1704,9 @@ Magnitude: damagevariation checkhit doubleundergrounddamage - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1732,9 +1732,9 @@ Pursuit: damagevariation pursuit checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1752,9 +1752,9 @@ RapidSpin: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext clearhazards @@ -1794,9 +1794,9 @@ HiddenPower: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1824,7 +1824,7 @@ FakeOut: doturn checkhit fakeout - hittarget + moveanim failuretext endmove @@ -1847,9 +1847,9 @@ MirrorCoat: usedmovetext doturn mirrorcoat - hittarget + moveanim failuretext - checkfaint + applydamage checkdestinybond buildopponentrage kingsrock @@ -1867,9 +1867,9 @@ SkullBash: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1892,9 +1892,9 @@ Twister: doubleflyingdamage checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1914,9 +1914,9 @@ Earthquake: doubleundergrounddamage checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1933,9 +1933,9 @@ FutureSight: futuresight damagevariation ; skip here if last turn checkhit - hittargetnosub + moveanimnosub failuretext - checkfaint + applydamage checkdestinybond buildopponentrage endmove @@ -1951,9 +1951,9 @@ Gust: damagevariation doubleflyingdamage checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1972,9 +1972,9 @@ Stomp: doubleminimizedamage checkhit effectchance - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -1995,9 +1995,9 @@ Solarbeam: stab damagevariation checkhit - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -2017,9 +2017,9 @@ Thunder: effectchance stab damagevariation - hittarget + moveanim failuretext - checkfaint + applydamage criticaltext supereffectivetext checkdestinybond @@ -2047,9 +2047,9 @@ BeatUp: damagecalc damagevariation clearmissdamage - hittargetnosub + moveanimnosub failuretext - checkfaint + applydamage criticaltext cleartext supereffectivetext diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index b9a7382c0..ea6c22dda 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -556,8 +556,8 @@ CheckEnemyTurn: ; 3421f and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND call z, PlayFXAnimID - ld c, $1 - call EnemyHurtItself + ld c, TRUE + call DoEnemyDamage call BattleCommand_RaiseSub call CantMove jp EndTurn @@ -676,8 +676,8 @@ HitConfusion: ; 343a5 call CallBattleCore ld a, $1 ld [hBGMapMode], a - ld c, $1 - call PlayerHurtItself + ld c, TRUE + call DoPlayerDamage jp BattleCommand_RaiseSub ; 343db @@ -2081,16 +2081,16 @@ BattleCommand_LowerSub: ; 34eee ; 34f57 -BattleCommand_HitTarget: ; 34f57 -; hittarget +BattleCommand_MoveAnim: ; 34f57 +; moveanim call BattleCommand_LowerSub - call BattleCommand_HitTargetNoSub + call BattleCommand_MoveAnimNoSub jp BattleCommand_RaiseSub ; 34f60 -BattleCommand_HitTargetNoSub: ; 34f60 +BattleCommand_MoveAnimNoSub: ; 34f60 ld a, [wAttackMissed] and a jp nz, BattleCommand_MoveDelay @@ -2274,65 +2274,68 @@ BattleCommand_FailureText: ; 35023 ; 3505e -BattleCommand_CheckFaint: ; 3505e -; checkfaint +BattleCommand_ApplyDamage: ; 3505e +; applydamage ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_ENDURE, a - jr z, .not_enduring - call BattleCommand_FalseSwipe - ld b, $0 - jr nc, .okay - ld b, $1 - jr .okay + jr z, .focus_band -.not_enduring + call BattleCommand_FalseSwipe + ld b, 0 + jr nc, .damage + ld b, 1 + jr .damage + +.focus_band call GetOpponentItem ld a, b cp HELD_FOCUS_BAND - ld b, $0 - jr nz, .okay + ld b, 0 + jr nz, .damage + call BattleRandom cp c - jr nc, .okay + jr nc, .damage call BattleCommand_FalseSwipe - ld b, $0 - jr nc, .okay - ld b, $2 -.okay + ld b, 0 + jr nc, .damage + ld b, 2 + +.damage push bc - call .check_sub - ld c, $0 + call .update_damage_taken + ld c, FALSE ld a, [hBattleTurn] and a jr nz, .damage_player - call EnemyHurtItself + call DoEnemyDamage jr .done_damage .damage_player - call PlayerHurtItself + call DoPlayerDamage .done_damage pop bc ld a, b and a ret z + dec a - jr nz, .not_enduring2 + jr nz, .focus_band_text ld hl, EnduredText jp StdBattleTextBox -.not_enduring2 +.focus_band_text call GetOpponentItem ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName - ld hl, HungOnText jp StdBattleTextBox -.check_sub +.update_damage_taken ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a @@ -2341,10 +2344,10 @@ BattleCommand_CheckFaint: ; 3505e ld de, wPlayerDamageTaken + 1 ld a, [hBattleTurn] and a - jr nz, .damage_taken + jr nz, .got_damage_taken ld de, wEnemyDamageTaken + 1 -.damage_taken +.got_damage_taken ld a, [wCurDamage + 1] ld b, a ld a, [de] @@ -2418,11 +2421,11 @@ GetFailureResultText: ; 350e4 ld a, $1 ld [wKickCounter], a call LoadMoveAnim - ld c, $1 + ld c, TRUE ld a, [hBattleTurn] and a - jp nz, EnemyHurtItself - jp PlayerHurtItself + jp nz, DoEnemyDamage + jp DoPlayerDamage FailText_CheckOpponentProtect: ; 35157 ld a, BATTLE_VARS_SUBSTATUS1_OPP @@ -3620,15 +3623,13 @@ PlayFXAnimID: ; 35d08 ld c, 3 call DelayFrames - callfar PlayBattleAnim - ret ; 35d1c -EnemyHurtItself: ; 35d1c +DoEnemyDamage: ; 35d1c ld hl, wCurDamage ld a, [hli] ld b, a @@ -3638,13 +3639,14 @@ EnemyHurtItself: ; 35d1c ld a, c and a - jr nz, .mimic_sub_check - + jr nz, .ignore_substitute ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a - jp nz, SelfInflictDamageToSubstitute + jp nz, DoSubstituteDamage -.mimic_sub_check +.ignore_substitute + ; Substract wCurDamage from wEnemyMonHP. + ; store original HP in little endian wBuffer3/4 ld a, [hld] ld b, a ld a, [wEnemyMonHP + 1] @@ -3657,19 +3659,18 @@ EnemyHurtItself: ; 35d1c ld [wBuffer4], a sbc b ld [wEnemyMonHP], a - jr nc, .mimic_faint + jr nc, .no_underflow ld a, [wBuffer4] ld [hli], a ld a, [wBuffer3] ld [hl], a - xor a ld hl, wEnemyMonHP ld [hli], a ld [hl], a -.mimic_faint +.no_underflow ld hl, wEnemyMonMaxHP ld a, [hli] ld [wBuffer2], a @@ -3680,6 +3681,7 @@ EnemyHurtItself: ; 35d1c ld [wBuffer6], a ld a, [hl] ld [wBuffer5], a + hlcoord 2, 2 xor a ld [wWhichHPBar], a @@ -3690,7 +3692,7 @@ EnemyHurtItself: ; 35d1c ; 35d7e -PlayerHurtItself: ; 35d7e +DoPlayerDamage: ; 35d7e ld hl, wCurDamage ld a, [hli] ld b, a @@ -3700,12 +3702,15 @@ PlayerHurtItself: ; 35d7e ld a, c and a - jr nz, .mimic_sub_check - + jr nz, .ignore_substitute ld a, [wPlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a - jp nz, SelfInflictDamageToSubstitute -.mimic_sub_check + jp nz, DoSubstituteDamage + +.ignore_substitute + ; Substract wCurDamage from wBattleMonHP. + ; store original HP in little endian wBuffer3/4 + ; store new HP in little endian wBuffer5/6 ld a, [hld] ld b, a ld a, [wBattleMonHP + 1] @@ -3719,14 +3724,13 @@ PlayerHurtItself: ; 35d7e sbc b ld [wBattleMonHP], a ld [wBuffer6], a - jr nc, .mimic_faint + jr nc, .no_underflow ld a, [wBuffer4] ld [hli], a ld a, [wBuffer3] ld [hl], a xor a - ld hl, wBattleMonHP ld [hli], a ld [hl], a @@ -3734,14 +3738,15 @@ PlayerHurtItself: ; 35d7e ld [hli], a ld [hl], a -.mimic_faint +.no_underflow ld hl, wBattleMonMaxHP ld a, [hli] ld [wBuffer2], a ld a, [hl] ld [wBuffer1], a + hlcoord 10, 9 - ld a, $1 + ld a, 1 ld [wWhichHPBar], a predef AnimateHPBar .did_no_damage @@ -3750,8 +3755,7 @@ PlayerHurtItself: ; 35d7e ; 35de0 -SelfInflictDamageToSubstitute: ; 35de0 - +DoSubstituteDamage: ; 35de0 ld hl, SubTookDamageText call StdBattleTextBox diff --git a/engine/battle/move_effects/false_swipe.asm b/engine/battle/move_effects/false_swipe.asm index e93b627ec..f00de91e7 100644 --- a/engine/battle/move_effects/false_swipe.asm +++ b/engine/battle/move_effects/false_swipe.asm @@ -1,6 +1,8 @@ BattleCommand_FalseSwipe: ; 35c94 ; falseswipe +; Makes sure wCurDamage < MonHP + ld hl, wEnemyMonHP ld a, [hBattleTurn] and a @@ -15,12 +17,14 @@ BattleCommand_FalseSwipe: ; 35c94 pop de pop hl jr c, .done + ld a, [hli] ld [de], a inc de ld a, [hl] dec a ld [de], a + inc a jr nz, .okay dec de @@ -28,11 +32,13 @@ BattleCommand_FalseSwipe: ; 35c94 dec a ld [de], a .okay + ld a, [wCriticalHit] cp 2 jr nz, .carry xor a ld [wCriticalHit], a + .carry scf ret diff --git a/macros/scripts/battle_commands.asm b/macros/scripts/battle_commands.asm index db446d9ff..48e034bdf 100644 --- a/macros/scripts/battle_commands.asm +++ b/macros/scripts/battle_commands.asm @@ -15,10 +15,10 @@ ENDM command damagevariation ; 08 command checkhit ; 09 command lowersub ; 0a - command hittargetnosub ; 0b + command moveanimnosub ; 0b command raisesub ; 0c command failuretext ; 0d - command checkfaint ; 0e + command applydamage ; 0e command criticaltext ; 0f command supereffectivetext ; 10 command checkdestinybond ; 11 @@ -175,7 +175,7 @@ ENDM command beatupfailtext ; a8 command clearmissdamage ; a9 command movedelay ; aa - command hittarget ; ab + command moveanim ; ab command tristatuschance ; ac command supereffectivelooptext ; ad command startloop ; ae From 38107209a6ad431b399cc36405c0af8b5babf5ef Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 4 Apr 2018 23:44:24 +0200 Subject: [PATCH 16/16] Update docs and comments to reflect renames --- constants/text_constants.asm | 2 +- docs/battle_anim_commands.md | 2 +- docs/bugs_and_glitches.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/constants/text_constants.asm b/constants/text_constants.asm index 5a9a35931..ee5589561 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -36,7 +36,7 @@ TEXTBOX_INNERY EQU TEXTBOX_Y + 2 const PRINTNUM_RIGHTALIGN_F ; 6 const PRINTNUM_LEADINGZEROS_F ; 7 -; PrintNum arguments (see engine/math/printnum.asm) +; PrintNum arguments (see engine/math/print_num.asm) PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F PRINTNUM_RIGHTALIGN EQU 1 << PRINTNUM_RIGHTALIGN_F PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F diff --git a/docs/battle_anim_commands.md b/docs/battle_anim_commands.md index bd40e8a6d..86763b24a 100644 --- a/docs/battle_anim_commands.md +++ b/docs/battle_anim_commands.md @@ -88,7 +88,7 @@ Temporarily creates sprites from the top row of the player backpic, so that the ## `$DB`: `anim_checkpokeball` -Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/getpokeballwobble.asm). +Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/pokeball_wobble.asm). ## `$DC`: `anim_transform` diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index c24876873..2c7f83e25 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -713,7 +713,7 @@ This is a bug with `ItemAttributes` in [data/items/attributes.asm](/data/items/a ## Daisy's grooming doesn't always increase happiness -This is a bug with `HaircutOrGrooming` in [engine/events/specials_2.asm](/engine/events/specials_2.asm): +This is a bug with `HaircutOrGrooming` in [engine/events/haircut.asm](/engine/events/haircut.asm): ```asm ; Bug: Subtracting $ff from $ff fails to set c.