diff --git a/constants.asm b/constants.asm index e480cca4..02cd49f3 100644 --- a/constants.asm +++ b/constants.asm @@ -66,3 +66,4 @@ INCLUDE "constants/start_menu_constants.asm" INCLUDE "constants/minigame_constants.asm" INCLUDE "constants/flypoint_constants.asm" INCLUDE "constants/spawnpoint_constants.asm" +INCLUDE "constants/player_constants.asm" diff --git a/constants/player_constants.asm b/constants/player_constants.asm new file mode 100644 index 00000000..496b1cee --- /dev/null +++ b/constants/player_constants.asm @@ -0,0 +1,25 @@ +DEF NUM_PLAYER_NAMES EQU 3 + +IF DEF(_GOLD) +DEF PLAYERNAME1 EQUS "ゴールド" +DEF PLAYERNAME2 EQUS "サトシ" +DEF PLAYERNAME3 EQUS "ジャック" + +DEF RIVALNAME1 EQUS "シルバー" +DEF RIVALNAME2 EQUS "シゲル" +DEF RIVALNAME3 EQUS "ジョン" +ENDC + +IF DEF(_SILVER) +DEF PLAYERNAME1 EQUS "シルバー" +DEF PLAYERNAME2 EQUS "シゲル" +DEF PLAYERNAME3 EQUS "ジョン" + +DEF RIVALNAME1 EQUS "ゴールド" +DEF RIVALNAME2 EQUS "サトシ" +DEF RIVALNAME3 EQUS "ジャック" +ENDC + +DEF MOMNAME1 EQUS "おかあさん" +DEF MOMNAME2 EQUS "ママ" +DEF MOMNAME3 EQUS "かあちゃん" diff --git a/constants/tileset_constants.asm b/constants/tileset_constants.asm index acf5ac8e..780d6774 100644 --- a/constants/tileset_constants.asm +++ b/constants/tileset_constants.asm @@ -1,30 +1,34 @@ -; Tilesets indexes +; Tilesets indexes (see data/tilesets.asm) const_def - const TILESET_SILENT_HILL - const TILESET_OLD_CITY - const TILESET_WEST - const TILESET_HIGH_TECH - const TILESET_BIRDON - const TILESET_FONT - const TILESET_NORTH - const TILESET_KANTO - const TILESET_SOUTH - const TILESET_HOUSE - const TILESET_LAB - const TILESET_TRADITIONAL_HOUSE - const TILESET_POKECENTER - const TILESET_MART - const TILESET_AQUARIUM - const TILESET_TOWER - const TILESET_DEPT_STORE - const TILESET_GATE - const TILESET_RADIO_TOWER - const TILESET_ROCKET_HOUSE - const TILESET_GYM - const TILESET_OFFICE - const TILESET_RUINS_OF_ALPH - const TILESET_CAVE - const TILESET_POWER_PLANT - const TILESET_SHIP - const TILESET_SHIP_PORT - const TILESET_FOREST + const TILESET_SILENT_HILL ; 00 + const TILESET_OLD_CITY ; 01 + const TILESET_WEST ; 02 + const TILESET_HIGH_TECH ; 03 + const TILESET_BIRDON ; 04 + const TILESET_FONT ; 05 + const TILESET_NORTH ; 06 + const TILESET_KANTO ; 07 + const TILESET_SOUTH ; 08 + const TILESET_HOUSE ; 09 + const TILESET_LAB ; 0a + const TILESET_TRADITIONAL_HOUSE ; 0b + const TILESET_POKECENTER ; 0c + const TILESET_MART ; 0d + const TILESET_AQUARIUM ; 0e + const TILESET_TOWER ; 0f + const TILESET_DEPT_STORE ; 10 + const TILESET_GATE ; 11 + const TILESET_RADIO_TOWER ; 12 + const TILESET_ROCKET_HOUSE ; 13 + const TILESET_GYM ; 14 + const TILESET_OFFICE ; 15 + const TILESET_RUINS_OF_ALPH ; 16 + const TILESET_CAVE ; 17 + const TILESET_POWER_PLANT ; 18 + const TILESET_SHIP ; 19 + const TILESET_SHIP_PORT ; 1a + const TILESET_FOREST ; 1b +DEF NUM_TILESETS EQU const_value + +; wTileset struct size +DEF TILESET_LENGTH EQU 11 diff --git a/data/mom_names.asm b/data/mom_names.asm new file mode 100644 index 00000000..416d6939 --- /dev/null +++ b/data/mom_names.asm @@ -0,0 +1,22 @@ +INCLUDE "constants.asm" + +SECTION "data/mom_names.asm", ROMX + +MomNameMenuHeader: + db MENU_BACKUP_TILES ; flags + menu_coords 0, 0, 10, 11 + dw .Names + db 1 ; initial selection + +.Names: + db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B + db NUM_PLAYER_NAMES + 1 ; items + db "じぶんで きめる@" + + list_start PLAYER_NAME_LENGTH - 1 +FOR n, 1, NUM_PLAYER_NAMES + 1 + li #MOMNAME{d:n} +ENDR + assert_list_length NUM_PLAYER_NAMES + db 3 ; x offset for the title string + db "なまえこうほ@" diff --git a/data/player_names.asm b/data/player_names.asm new file mode 100644 index 00000000..1fdc641b --- /dev/null +++ b/data/player_names.asm @@ -0,0 +1,22 @@ +INCLUDE "constants.asm" + +SECTION "data/player_names.asm", ROMX + +PlayerNameMenuHeader: + db MENU_BACKUP_TILES ; flags + menu_coords 0, 0, 10, 11 + dw .Names + db 1 ; initial selection + +.Names: + db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B + db NUM_PLAYER_NAMES + 1 ; items + db "じぶんできめる@" + + list_start PLAYER_NAME_LENGTH - 1 +FOR n, 1, NUM_PLAYER_NAMES + 1 + li #PLAYERNAME{d:n} +ENDR + assert_list_length NUM_PLAYER_NAMES + db 3 ; x offset for the title string + db "なまえこうほ@" diff --git a/data/predef_pointers.inc b/data/predef_pointers.inc index 9b7069b6..2ca7f437 100644 --- a/data/predef_pointers.inc +++ b/data/predef_pointers.inc @@ -98,4 +98,4 @@ GiveItemPredef:: add_predef AnimationSubstitute ; dummied out add_predef FightDebugMenu add_predef LoadItemData - dbw $ff, InexplicablyEmptyFunction ; 56 + dbw $ff, DummyEndPredef ; 56 diff --git a/data/rival_names.asm b/data/rival_names.asm new file mode 100644 index 00000000..2581d4cd --- /dev/null +++ b/data/rival_names.asm @@ -0,0 +1,22 @@ +INCLUDE "constants.asm" + +SECTION "data/rival_names.asm", ROMX + +RivalNameMenuHeader: + db MENU_BACKUP_TILES ; flags + menu_coords 0, 0, 10, 11 + dw .Names + db 1 ; initial selection + +.Names: + db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B + db NUM_PLAYER_NAMES + 1 ; items + db "じぶんできめる@" + + list_start PLAYER_NAME_LENGTH - 1 +FOR n, 1, NUM_PLAYER_NAMES + 1 + li #RIVALNAME{d:n} +ENDR + assert_list_length NUM_PLAYER_NAMES + db 3 ; x offset for the title string + db "なまえこうほ@" diff --git a/data/tileset_headers.asm b/data/tilesets.asm similarity index 92% rename from data/tileset_headers.asm rename to data/tilesets.asm index 91f07d0c..3d14b2ea 100644 --- a/data/tileset_headers.asm +++ b/data/tilesets.asm @@ -1,6 +1,6 @@ INCLUDE "constants.asm" -SECTION "data/tileset_headers.asm", ROMX +SECTION "data/tilesets.asm", ROMX MACRO tileset db BANK(\1_GFX) ; shared bank @@ -11,6 +11,7 @@ ENDM Tilesets: ; name, animation set + table_width TILESET_LENGTH tileset SilentHill, TilesetGenericAnim tileset OldCity, TilesetWaterAnim tileset West, TilesetFlowerAnim @@ -39,3 +40,4 @@ Tilesets: tileset Ship, TilesetNoAnim tileset ShipPort, TilesetNoAnim tileset Forest, TilesetGenericAnim + assert_table_length NUM_TILESETS diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index 652dcab1..d36a5eaa 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -7,7 +7,7 @@ CanLearnTMHMMove: ; then checks the corresponding flag in wCurPartySpecies's learnset. ; Sets register c to 1 if TM/HM is in learnset OR if debug is enabled. ld a, [wDebugFlags] - ld c, 01 + ld c, 1 bit DEBUG_FIELD_F, a ret nz diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm index 52455e42..b2379690 100644 --- a/engine/menu/start_menu.asm +++ b/engine/menu/start_menu.asm @@ -288,9 +288,9 @@ KeyItemsPocketHeader: BackpackMenuHeader: db MENU_BACKUP_TILES ; flags - menu_coords 03, 03, $11, $0A + menu_coords 3, 3, $11, $0A dw .BackpackData - db 01 + db 1 ; default option .BackpackData db $A1 @@ -343,7 +343,7 @@ DrawBackpack: call ClearTileMap callfar LoadBackpackGraphics hlcoord 2, 2 - ld b, 08 + ld b, 8 ld c, $0F call DrawTextBox ret @@ -577,7 +577,7 @@ DebugSelectedItemMenu: db MENU_BACKUP_TILES menu_coords $0D, $0A, $13, $10 dw .DebugSelectedItemMenuText - db 01 + db 1 ; default option .DebugSelectedItemMenuText db (STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING) @@ -590,7 +590,7 @@ SelectedItemMenu: db MENU_BACKUP_TILES menu_coords $0E, $0A, $13, $0E dw .SelectedItemMenuText - db 01 + db 1 ; default option .SelectedItemMenuText db (STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING) @@ -924,7 +924,7 @@ PartyPromptExit: nop nop nop - ld hl, 0000 + ld hl, 0 call Call_ExitMenu call WaitBGMap call UpdateTimePals @@ -1310,9 +1310,9 @@ PartyMailMenu: .MailMenu db MENU_BACKUP_TILES - menu_coords 04, 04, $0E, $0B + menu_coords 4, 4, 14, 11 dw .MailMenuStrings - db 01 + db 1 ; default option .MailMenuStrings diff --git a/engine/menu/text_entry.asm b/engine/menu/text_entry.asm index 6286a401..8be0ba74 100644 --- a/engine/menu/text_entry.asm +++ b/engine/menu/text_entry.asm @@ -1094,7 +1094,7 @@ ComposeMail_AnimateCursor: inc [hl] jr .UpdatePositionOffset .skip3 - ld [hl], 00 + ld [hl], 0 jr .UpdatePositionOffset .upJump ld hl, SPRITEANIMSTRUCT_VAR2 diff --git a/engine/movie/oak_speech.asm b/engine/movie/oak_speech.asm index ed1a0b39..318a7a43 100644 --- a/engine/movie/oak_speech.asm +++ b/engine/movie/oak_speech.asm @@ -528,28 +528,7 @@ ChoosePlayerNameEndText: line " と いうんだな!" prompt -PlayerNameMenuHeader: - db MENU_BACKUP_TILES ; flags - menu_coords 00, 00, 10, 11 - dw PlayerNameMenuData - db 01 ; initial selection - -PlayerNameMenuData: - db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B - db 04 ; items - db "じぶんできめる@" -if DEF(_GOLD) - db "ゴールド@" - db "サトシ@" - db "ジャック@" -endc -if DEF(_SILVER) - db "シルバー@" - db "シゲル@" - db "ジョン@" -endc - db 3 ; x offset for the title string - db "なまえこうほ@" +SECTION "engine/movie/oak_speech.asm@ChooseRivalName", ROMX ChooseRivalName:: call PanPortraitRight @@ -588,28 +567,7 @@ ChooseRivalNameEndText: line " という なまえだ" prompt -RivalNameMenuHeader: - db MENU_BACKUP_TILES ; flags - menu_coords 00, 00, 10, 11 - dw RivalNameMenuData - db 01 ; initial selection - -RivalNameMenuData: - db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B - db 04 ; items - db "じぶんできめる@" -if DEF(_GOLD) - db "シルバー@" - db "シゲル@" - db "ジョン@" -endc -if DEF(_SILVER) - db "ゴールド@" - db "サトシ@" - db "ジャック@" -endc - db 3 - db "なまえこうほ@" +SECTION "engine/movie/oak_speech.asm@MomNamePrompt", ROMX MomNamePrompt:: ld hl, MomNameMenuHeader @@ -638,21 +596,7 @@ MomNamePrompt:: .escape ret -MomNameMenuHeader: - db MENU_BACKUP_TILES ; flags - menu_coords 00, 00, 10, 11 - dw .MomNameMenuData - db 01 ; initial selection - -.MomNameMenuData: - db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B - db 04 ; items - db "じぶんで きめる@" - db "おかあさん@" - db "ママ@" - db "かあちゃん@" - db 3 - db "なまえこうほ@" +SECTION "engine/movie/oak_speech.asm@NamingWindow", ROMX NamingWindow:: ; loads the menu header put into hl diff --git a/home/misc_3c43.asm b/home/battle.asm similarity index 66% rename from home/misc_3c43.asm rename to home/battle.asm index a9e32e95..4ac16fa5 100644 --- a/home/misc_3c43.asm +++ b/home/battle.asm @@ -1,6 +1,6 @@ INCLUDE "constants.asm" -SECTION "home/misc_3c43.asm", ROM0 +SECTION "home/battle.asm", ROM0 GetPartyParamLocation:: ; Get the location of parameter a from wCurPartyMon in hl @@ -15,18 +15,7 @@ GetPartyParamLocation:: pop bc ret -DoItemEffect:: - farjp _DoItemEffect - -CheckTossableItem:: - push hl - push de - push bc - callfar _CheckTossableItem - pop bc - pop de - pop hl - ret +SECTION "home/battle.asm@GetBattleAnimPointer", ROM0 GetBattleAnimPointer:: ld a, BANK(BattleAnimations) @@ -74,18 +63,3 @@ GetBattleAnimByte:: ld a, [wBattleAnimByte] ret - -InitSpriteAnimStruct:: - ld [wSpriteAnimAddrBackup], a - ldh a, [hROMBank] - push af - ld a, BANK(_InitSpriteAnimStruct) - call Bankswitch - ld a, [wSpriteAnimAddrBackup] - call _InitSpriteAnimStruct - pop af - call Bankswitch - ret - -ReinitSpriteAnimFrame:: ; stubbed - ret diff --git a/home/items.asm b/home/item.asm similarity index 64% rename from home/items.asm rename to home/item.asm index c31d3b0b..b750c209 100644 --- a/home/items.asm +++ b/home/item.asm @@ -1,7 +1,21 @@ INCLUDE "constants.asm" +SECTION "home/item.asm", ROM0 -SECTION "home/items.asm@TossItem", ROM0 +DoItemEffect:: + farjp _DoItemEffect + +CheckTossableItem:: + push hl + push de + push bc + callfar _CheckTossableItem + pop bc + pop de + pop hl + ret + +SECTION "home/item.asm@TossItem", ROM0 TossItem: ldh a, [hROMBank] @@ -42,8 +56,7 @@ ReceiveItem:: pop bc ret - -SECTION "home/items.asm@GiveItem", ROM0 +SECTION "home/item.asm@GiveItem", ROM0 GiveItem:: ; Give player quantity c of item b, @@ -61,3 +74,21 @@ GiveItem:: call CopyStringToStringBuffer2 scf ret + +GiveMonToPlayer:: +; Give to the player Pokemon of species b at level c. + ld a, b + ld [wCurPartySpecies], a + ld a, c + ld [wCurPartyLevel], a + xor a + ld [wMonType], a + farjp Function1130a + +SECTION "home/item.asm@Call_GetItemAmount", ROM0 + +Call_GetItemAmount:: + predef GetItemAmount + ld a, b + and a + ret diff --git a/home/load_options.asm b/home/load_options.asm new file mode 100644 index 00000000..2f7c85e0 --- /dev/null +++ b/home/load_options.asm @@ -0,0 +1,24 @@ +INCLUDE "constants.asm" + +SECTION "home/load_options.asm", ROM0 + +; Init the options with values of $00 because EmptyAllSRAMBanks sets them to $FF, and that's no good! +; Final game gets around this by filling the entirety of SRAM banks with $00, which this demo probably should've done. +InitOptions:: + ld a, BANK(sOptions) + call OpenSRAM + ld hl, sOptions + ld bc, 7 + xor a + call ByteFill + call CloseSRAM + ret + +LoadSGBBorderOptions:: + ld a, BANK(sOptions) + call OpenSRAM + ld a, [sOptions] + and SGB_BORDER + ld [wOptions], a + call CloseSRAM + ret diff --git a/home/map.asm b/home/map.asm index fa5e2664..62e7a3f5 100644 --- a/home/map.asm +++ b/home/map.asm @@ -2,6 +2,11 @@ INCLUDE "constants.asm" SECTION "home/map.asm", ROM0 +UnfreezeEverything:: + call UnfreezeAllObjects + call UnfreezePlayer + ret + ; Runs a map script indexed by wMapScriptNumber RunMapScript:: push hl @@ -243,7 +248,7 @@ GetWorldMapLocation:: ld a, b ret -EmptyFunction2252:: +DummyMapFunction:: ret LoadMap:: @@ -260,24 +265,24 @@ LoadMap:: ret .jumptable + dw MapSetup_NewGame dw MapSetup_Continue - dw MapSetup_22af ; TODO - dw MapSetup_Reload - dw MapSetup_22de ; TODO - dw MapSetup_22de ; TODO + dw MapSetup_Fight + dw MapSetup_FallingWarp + dw MapSetup_FallingWarp dw MapSetup_Warp dw MapSetup_Connection - dw MapSetup_2275 ; TODO + dw MapSetup_Link -MapSetup_2275:: +MapSetup_Link:: ldh a, [hROMBank] push af - call MapSetup_22af ; TODO + call MapSetup_Continue pop af call Bankswitch ret -MapSetup_Reload:: +MapSetup_Fight:: call DisableLCD call DisableAudio call VolumeOff @@ -296,7 +301,7 @@ MapSetup_Reload:: call FadeIn ret -MapSetup_22af:: +MapSetup_Continue:: call DisableLCD call DisableAudio call VolumeOff @@ -315,10 +320,10 @@ MapSetup_22af:: call FadeIn ret -MapSetup_22de:: +MapSetup_FallingWarp:: callfar OverworldFadeOut -MapSetup_Continue:: +MapSetup_NewGame:: call DisableLCD call DisableAudio call VolumeOff @@ -339,14 +344,14 @@ MapSetup_Continue:: ld b, 9 ; TODO: constantify this call GetSGBLayout call LoadWildMonData - call Function242c ; TODO + call SetPlayerFacingDown call FadeIn ret MapSetup_Warp:: callfar OverworldFadeOut call DisableLCD - call Function27C7 ; TODO + call WarpEnvironmentCheck ld a, [wNextWarp] ld [wWarpNumber], a ld a, [wNextMapGroup] @@ -457,11 +462,12 @@ CheckExitTiles:: ret z cp (COLL_CARPET | COLLFLAG_ENCOUNTER) ret z -Function242c:: + +SetPlayerFacingDown:: ld a, $0 ld [wPlayerFacing], a ld a, $0 - ld d, $0 + ld d, DOWN call SetObjectFacing ret @@ -922,7 +928,7 @@ ClearObjectStructs:: jr nz, .clear_cmd_queue ret -ReadWord:: ; TODO: is this used? +Unreferenced_ReadWord:: ld e, [hl] inc hl ld d, [hl] @@ -1004,7 +1010,7 @@ RestoreFacingAfterWarp:: call GetCoordOfUpperLeftCorner ret -Function275e:: ; TODO: is this used? +.unreferenced_pass inc hl inc hl inc hl @@ -1066,11 +1072,11 @@ GetCoordOfUpperLeftCorner:: ld [wMetatileNextX], a ret -Function27C7:: ; TODO +WarpEnvironmentCheck:: call GetMapEnvironment - cp 2 + cp ROUTE jr z, .interior - cp 1 + cp TOWN jr z, .interior ret .interior @@ -1079,12 +1085,12 @@ Function27C7:: ; TODO ld a, [wNextMapNumber] ld c, a call GetAnyMapEnvironment - cp 3 + cp INDOOR jr z, .exterior - cp 4 - jr z, .exterior - cp 6 + cp CAVE jr z, .exterior + cp GATE + jr z, .exterior ; BUG: ENVIRONMENT_5, and DUNGEON are missing. ret .exterior diff --git a/home/map_objects.asm b/home/map_objects.asm index 58be175c..855049f4 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -20,13 +20,13 @@ GetMapObjectAttrPtr:: add hl, de ret -Unreferenced_Function15d1:: +Unreferenced_SelectMapObject:: ldh [hMapObjectIndex], a call GetMapObject call OpenDebugMenu ret -Unreferenced_Function15da:: +Unreferenced_UnselectMapObject:: ldh [hMapObjectIndex], a callfar UnmaskObject ldh a, [hMapObjectIndex] diff --git a/home/math.asm b/home/math.asm index 040af51a..4f87df01 100644 --- a/home/math.asm +++ b/home/math.asm @@ -19,3 +19,14 @@ Divide:: pop de pop hl ret + +SECTION "home/math.asm@SubtractAbsolute", ROM0 + +SubtractAbsolute:: ; unreferenced +; Return |a - b|, sign in carry. + sub b + ret nc + cpl + add 1 + scf + ret diff --git a/home/menu.asm b/home/menu.asm index d4ad0bd6..7ea20a7a 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -277,19 +277,18 @@ GetMenuIndexSet:: ld [wMenuDataItems], a ret -; Unreferenced? -Function1ee9:: +Unreferenced_RestoreItemMenuTileBackup: call MenuBoxCoord2Tile call GetMenuBoxDims ld a, [wMenuDataItems] add a cp b - jr nc, .asm_1ef9 + jr nc, .col ld b, a dec c ret -.asm_1ef9: +.col: ld a, b srl a dec a diff --git a/home/misc_32c8.asm b/home/pokedex_flags.asm similarity index 65% rename from home/misc_32c8.asm rename to home/pokedex_flags.asm index 770fe86a..ab5013b5 100644 --- a/home/misc_32c8.asm +++ b/home/pokedex_flags.asm @@ -1,39 +1,6 @@ INCLUDE "constants.asm" -SECTION "home/misc_32c8.asm@Unknown 32c8", ROM0 - -Call_GetItemAmount:: - predef GetItemAmount - ld a, b - and a - ret - -GetTerminatingString:: - ld hl, .EmptyString - ret - -.EmptyString: - db "@" - -SubtractSigned:: - sub b - ret nc - cpl - add $1 - scf - ret - -SECTION "home/misc_32c8.asm@Unknown 3686", ROM0 - -GiveMonToPlayer:: -; Give to the player Pokemon of species b at level c. - ld a, b - ld [wCurPartySpecies], a - ld a, c - ld [wCurPartyLevel], a - xor a - ld [wMonType], a - farjp Function1130a +SECTION "home/pokedex_flags.asm", ROM0 WaitPressedAny:: ; Waits for one of the buttons in d to be pressed. diff --git a/home/sound_test.asm b/home/sound_test.asm new file mode 100644 index 00000000..44a94fba --- /dev/null +++ b/home/sound_test.asm @@ -0,0 +1,13 @@ +INCLUDE "constants.asm" + +SECTION "home/sound_test.asm", ROM0 + +DebugMenuSoundTest:: + ldh a, [hROMBank] + push af + ld a, BANK(_DebugMenuSoundTest) + call Bankswitch + call _DebugMenuSoundTest + pop af + call Bankswitch + jp DebugMenu diff --git a/home/sprite_anims.asm b/home/sprite_anims.asm new file mode 100644 index 00000000..852efc22 --- /dev/null +++ b/home/sprite_anims.asm @@ -0,0 +1,18 @@ +INCLUDE "constants.asm" + +SECTION "home/sprite_anims.asm", ROM0 + +InitSpriteAnimStruct:: + ld [wSpriteAnimAddrBackup], a + ldh a, [hROMBank] + push af + ld a, BANK(_InitSpriteAnimStruct) + call Bankswitch + ld a, [wSpriteAnimAddrBackup] + call _InitSpriteAnimStruct + pop af + call Bankswitch + ret + +ReinitSpriteAnimFrame:: ; stubbed + ret diff --git a/home/talk_to_npc.asm b/home/talk_to_npc.asm index c7bbf68c..cc474595 100644 --- a/home/talk_to_npc.asm +++ b/home/talk_to_npc.asm @@ -194,12 +194,12 @@ PrepareTextbox:: call ClearWindowData ldh a, [hROMBank] push af - ld a, 01 + ld a, BANK(ReanchorBGMap_NoOAMUpdate) call Bankswitch call ReanchorBGMap_NoOAMUpdate hlcoord 0, 12 ;in the tilemap in WRAM - ld b, 04 - ld c, $12 + ld b, 4 + ld c, 18 call DrawTextBox call WaitBGMap call LoadFonts_NoOAMUpdate diff --git a/home/text.asm b/home/text.asm index 178a1f1f..0dd130e6 100644 --- a/home/text.asm +++ b/home/text.asm @@ -9,18 +9,18 @@ ClearBox:: FillBoxWithByte:: ld de, SCREEN_WIDTH -.asm_0e1d: +.row: push hl push bc -.asm_0e1f: +.col: ld [hli], a dec c - jr nz, .asm_0e1f + jr nz, .col pop bc pop hl add hl, de dec b - jr nz, .asm_0e1d + jr nz, .row ret ClearTileMap:: @@ -125,22 +125,22 @@ endc ENDM cp '' - jr nz, .asm_0eaa + jr nz, .not_next pop hl ld bc, 2 * SCREEN_WIDTH add hl, bc push hl jp NextChar -.asm_0eaa: +.not_next: cp '' - jr nz, .asm_0eb6 + jr nz, .not_line pop hl hlcoord 1, 16 push hl jp NextChar -.asm_0eb6: +.not_line: dict '', NullChar dict '', _ContTextNoPause dict '<_CONT>', _ContText @@ -258,19 +258,21 @@ GaCharacter:: print_name GaCharacterTExt PlaceMoveTargetsName:: ldh a, [hBattleTurn] - xor $1 - jr asm_0fbb + xor 1 + jr PlaceBattlersName PlaceMoveUsersName:: ldh a, [hBattleTurn] -asm_0fbb: + ; fallthrough + +PlaceBattlersName: push de and a - jr nz, .asm_0fc4 + jr nz, .enemy ld de, wBattleMonNickname jr PlaceCommandCharacter -.asm_0fc4: +.enemy: ld de, EnemyText call PlaceString ld h, b @@ -728,3 +730,12 @@ TextCommands:: dw Text_PlaySound dw Text_PlaySound dw Text_PlaySound + +SECTION "home/text.asm@GetTerminatingString", ROM0 + +GetTerminatingString:: + ld hl, .EmptyString + ret + +.EmptyString: + db "@" diff --git a/home/tileset.asm b/home/tileset.asm index 6b9f6e75..c28c1749 100644 --- a/home/tileset.asm +++ b/home/tileset.asm @@ -442,3 +442,10 @@ LoadTilesetGFX_LCDOff:: call LoadTilesetGFX call EnableLCD ret + +DummyEndPredef:: +; Unused function at the end of PredefPointers. +rept 16 + nop +endr + ret diff --git a/home/unknown.asm b/home/unknown.asm deleted file mode 100644 index 62e033e8..00000000 --- a/home/unknown.asm +++ /dev/null @@ -1,61 +0,0 @@ -INCLUDE "constants.asm" - - -SECTION "home/unknown.asm@Empty function", ROM0 - -InexplicablyEmptyFunction:: -rept 16 - nop -endr - ret - - -; TODO: -; 1. Figure out what these are. Might be related to RTC, like ClearRTCStatus and the ilk. -; 2. Give them proper names. -; 3. Move them to their own file(s). - -SECTION "home/unknown.asm@Unknown functions", ROM0 - -; Init the options with values of $00 because EmptyAllSRAMBanks sets them to $FF, and that's no good! -; Final game gets around this by filling the entirety of SRAM banks with $00, which this demo probably should've done. -InitOptions:: - ld a, BANK(sOptions) - call OpenSRAM - ld hl, sOptions ; TODO: label this. - ld bc, 7 - xor a - call ByteFill - call CloseSRAM - ret - -LoadSGBBorderOptions:: - ld a, BANK(sOptions) - call OpenSRAM - ld a, [sOptions] - and SGB_BORDER - ld [wOptions], a - call CloseSRAM - ret - - -SECTION "home/unknown.asm@Unknown_20f8", ROM0 - -UnfreezeEverything:: - call UnfreezeAllObjects - call UnfreezePlayer - ret - - -SECTION "home/unknown.asm@Debug menu sound test call", ROM0 - -DebugMenuSoundTest:: - ldh a, [hROMBank] - push af - ld a, BANK(_DebugMenuSoundTest) - call Bankswitch - call _DebugMenuSoundTest - - pop af - call Bankswitch - jp DebugMenu diff --git a/layout.link b/layout.link index 091bec7e..cfca5b81 100644 --- a/layout.link +++ b/layout.link @@ -40,7 +40,7 @@ ROM0 "home/serial.asm" "home/interrupts.asm@Joypad dummy interrupt" "home/joypad.asm" - "home/unknown.asm@Debug menu sound test call" + "home/sound_test.asm" "home/pic.asm" "home/copy2.asm" "home/text.asm" @@ -50,22 +50,22 @@ ROM0 "home/menu_window.asm" "home/menu.asm" "home/window.asm" - "home/unknown.asm@Unknown functions" + "home/load_options.asm" "home/toolgear.asm" - "home/unknown.asm@Unknown_20f8" "home/map.asm" "home/overworld.asm@Startmenu and Select Button Check" "home/tileset.asm" - "home/unknown.asm@Empty function" "home/farcall.asm" "home/predef.asm" "home/talk_to_npc.asm" "home/trainers.asm" - "home/items.asm@TossItem" + "home/item.asm@TossItem" "home/random.asm" "home/sram.asm" "home/bankswitch.asm" - "home/misc_32c8.asm@Unknown 32c8" + "home/item.asm@Call_GetItemAmount" + "home/text.asm@GetTerminatingString" + "home/math.asm@SubtractAbsolute" "home/clear_sprites.asm" "home/copy.asm" "home/math.asm" @@ -77,8 +77,8 @@ ROM0 "home/overworld.asm@QueueScript" "home/tables.asm" "home/tilemap.asm" - "home/items.asm@GiveItem" - "home/misc_32c8.asm@Unknown 3686" + "home/item.asm@GiveItem" + "home/pokedex_flags.asm" "home/names.asm@Names" "home/scrolling_menu.asm" "home/std_scripts.asm" @@ -88,7 +88,10 @@ ROM0 "home/names.asm@GetNick" "home/print_bcd.asm" "home/pokemon.asm@3AED" - "home/misc_3c43.asm" + "home/battle.asm" + "home/item.asm" + "home/battle.asm@GetBattleAnimPointer" + "home/sprite_anims.asm" "home/audio.asm" "garbage.asm@Home Garbage" @@ -101,6 +104,12 @@ ROMX $01 "engine/overworld/map_objects.asm" "engine/menu/main_menu.asm" "engine/movie/oak_speech.asm" + "data/player_names.asm" + "engine/movie/oak_speech.asm@ChooseRivalName" + "data/rival_names.asm" + "engine/movie/oak_speech.asm@MomNamePrompt" + "data/mom_names.asm" + "engine/movie/oak_speech.asm@NamingWindow" "engine/movie/title.asm@Title screen" "engine/predef.asm" "engine/overworld/init_map.asm" @@ -141,7 +150,7 @@ ROMX $03 "engine/overworld/player_movement.asm@Rest of Player Movement" "engine/overworld/spawn_points.asm" "data/maps/spawn_points.asm" - "data/tileset_headers.asm" + "data/tilesets.asm" "home/trainers.asm@Bank 03" "engine/items/inventory.asm@Inventory" "engine/smallflag.asm" diff --git a/ram/wram.asm b/ram/wram.asm index 44654c83..a9d51238 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1780,7 +1780,7 @@ wTilesetBlocksAddress:: dw wTilesetTilesAddress:: dw wTilesetCollisionAddress:: dw wTilesetAnim:: dw - ds 2 ; TODO + ds 2 ; unused wTilesetEnd:: wGameData2End:: diff --git a/scripts/SilentHill.asm b/scripts/SilentHill.asm index 7708e2e2..b05252c4 100644 --- a/scripts/SilentHill.asm +++ b/scripts/SilentHill.asm @@ -9,20 +9,20 @@ SilentHill_ScriptLoader:: ret SilentHillNPCIDs1: - db 0 - db 2 - db 3 + db $00 + db $02 + db $03 db $FF SilentHillNPCIDs2: - db 2 - db 3 + db $02 + db $03 db $FF SilentHillNPCIDs3: - db 1 - db 2 - db 3 + db $01 + db $02 + db $03 db $FF SilentHillScriptPointers1: @@ -62,9 +62,9 @@ SilentHillScript1: ret nz ld hl, wJoypadFlags set 4, [hl] - ld a, 02 + ld a, 2 call FreezeAllOtherObjects - ld a, 02 + ld a, 2 ld hl, SilentHillMovement1 call LoadMovementDataPointer ld hl, wOverworldFlags @@ -94,14 +94,14 @@ SilentHillScript2: call OpenTextbox ld hl, wJoypadFlags set 4, [hl] - ld a, 2 + ld a, $02 ld hl, SilentHillMovement2 call LoadMovementDataPointer ld hl, wOverworldFlags set 7, [hl] ld a, MAPSTATUS_EVENT_RUNNING call SetMapStatus - ld a, 2 + ld a, $02 ld [wMapScriptNumber], a ret @@ -148,7 +148,7 @@ SilentHillScript4: .jump2 ld hl, SilentHillMovement4 .skip - ld a, 03 + ld a, $03 call LoadMovementDataPointer ld hl, wOverworldFlags set 7, [hl] @@ -407,13 +407,13 @@ SilentHillTextRival1: MomNameMenuHeaderUnused: db MENU_BACKUP_TILES ; flags - menu_coords 00, 00, 10, 11 + menu_coords 0, 0, 10, 11 dw .MomNameMenuDataUnused - db 01 ; initial selection + db 1 ; initial selection .MomNameMenuDataUnused: db STATICMENU_CURSOR - db 04 ; items + db 4 ; items db "じぶんで きめる@" db "おかあさん @" db "ママ@" diff --git a/scripts/SilentHillLabBack.asm b/scripts/SilentHillLabBack.asm index fc1b5c9a..91572a48 100644 --- a/scripts/SilentHillLabBack.asm +++ b/scripts/SilentHillLabBack.asm @@ -25,13 +25,13 @@ SilentHillLabBackScriptPointers: dw SilentHillLabBackNPCIDs1 SilentHillLabBackNPCIDs1: - db 00, 01, 02, 03, 04, $FF + db $00, $01, $02, $03, $04, $FF SilentHillLabBackNPCIDs2: - db 00, 01, 04, $FF + db $00, $01, $04, $FF SilentHillLabBackNPCIDs3: - db 00, 01, 02, $FF + db $00, $01, $02, $FF SilentHillLabBackNPCIDs4: - db 00, 01, 03, $FF + db $00, $01, $03, $FF SilentHillLabBack_TextPointers:: dw SilentHillLabBackText1