From be76ee56a89e72c0b87a605321bb1670e86f8220 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 25 Mar 2018 18:24:14 +0200 Subject: [PATCH] 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"