From 40cb64431501f3702c67a9b8bc0b3e4d18c4f28c Mon Sep 17 00:00:00 2001 From: andwhyisit Date: Sun, 3 Mar 2024 22:19:04 +1000 Subject: [PATCH] More naming screen stuff and rgbds 0.7 support. --- Makefile | 2 +- game/src/common/constants.asm | 4 +- game/src/common/hardware.inc | 118 ++++++++-------- game/src/common/joypad.inc | 20 +-- game/src/gfx/attribmap.asm | 4 +- game/src/gfx/fades.asm | 2 +- game/src/gfx/tilemap.asm | 4 +- game/src/gfx/tilesets.asm | 8 +- game/src/nameentry/core.asm | 1 + game/src/saveclock/integrity.asm | 2 +- game/src/version/kabuto/attribmap_table.asm | 22 +-- game/src/version/kabuto/name_entry.asm | 6 +- game/src/version/kabuto/tilemap_table.asm | 26 ++-- game/src/version/kuwagata/attribmap_table.asm | 22 +-- game/src/version/kuwagata/name_entry.asm | 6 +- game/src/version/kuwagata/tilemap_table.asm | 26 ++-- game/src/version/nameentry_entry.asm | 131 +++++++++++++++++- game/src/version/nameentry_entry_core.asm | 24 ++-- .../version/nameentry_medal_naming_core.asm | 6 +- .../version/nameentry_player_naming_core.asm | 6 +- scripts/dialogbin2asm.py | 2 +- 21 files changed, 286 insertions(+), 156 deletions(-) diff --git a/Makefile b/Makefile index c91de7a..298d86e 100644 --- a/Makefile +++ b/Makefile @@ -167,7 +167,7 @@ $(DIALOG_INT)/%.$(DIALOG_TYPE): $(DIALOG_TEXT)/$$(word 1, $$(subst _, ,$$*)).$(C # build/pointer_constants.asm from scripts/res/ptrs.tbl $(BUILD)/pointer_constants.asm: $(SCRIPT_RES)/ptrs.tbl | $(BUILD) - awk -F "=0x" '{ print "c"$$1 " EQU " "$$"$$2 > "$@" }' $< + awk -F "=0x" '{ print "DEF c"$$1 " EQU " "$$"$$2 > "$@" }' $< # build/tilesets/*.2bpp from source png $(TILESET_OUT)/%.$(TSET_SRC_TYPE): $(TILESET_GFX)/%.$(RAW_TSET_SRC_TYPE) | $(TILESET_OUT) diff --git a/game/src/common/constants.asm b/game/src/common/constants.asm index cb961dd..30f6c1b 100644 --- a/game/src/common/constants.asm +++ b/game/src/common/constants.asm @@ -9,5 +9,5 @@ INCLUDE "game/src/common/joypad.inc" ; H = FF00 to FFFF (HRAM and I/O, basically any address ldh works with) ; M = for symbolising values -H_PushOAM EQU $ff80 -H_VBlankCompleted EQU $ff92 +DEF H_PushOAM EQU $ff80 +DEF H_VBlankCompleted EQU $ff92 diff --git a/game/src/common/hardware.inc b/game/src/common/hardware.inc index 0175717..2fb9ffc 100644 --- a/game/src/common/hardware.inc +++ b/game/src/common/hardware.inc @@ -1,60 +1,60 @@ -H_RegJoyp EQU $ff00 -H_RegSB EQU $ff01 -H_RegSC EQU $ff02 -H_RegDIV EQU $ff04 -H_RegTIMA EQU $ff05 -H_RegTMA EQU $ff06 -H_RegTAC EQU $ff07 -H_RegIF EQU $ff0f -H_RegNR10 EQU $ff10 -H_RegNR11 EQU $ff11 -H_RegNR12 EQU $ff12 -H_RegNR13 EQU $ff13 -H_RegNR14 EQU $ff14 -H_RegNR21 EQU $ff16 -H_RegNR22 EQU $ff17 -H_RegNR23 EQU $ff18 -H_RegNR24 EQU $ff19 -H_RegNR30 EQU $ff1a -H_RegNR31 EQU $ff1b -H_RegNR32 EQU $ff1c -H_RegNR33 EQU $ff1d -H_RegNR34 EQU $ff1e -H_RegNR41 EQU $ff20 -H_RegNR42 EQU $ff21 -H_RegNR43 EQU $ff22 -H_RegNR44 EQU $ff23 -H_RegNR50 EQU $ff24 -H_RegNR51 EQU $ff25 -H_RegNR52 EQU $ff26 -H_RegLCDC EQU $ff40 -H_LCDStat EQU $ff41 -H_RegSCY EQU $ff42 -H_RegSCX EQU $ff43 -H_RegLY EQU $ff44 -H_RegLYC EQU $ff45 -H_RegDMA EQU $ff46 -H_RegBGP EQU $ff47 -H_RegOBP0 EQU $ff48 -H_RegOBP1 EQU $ff49 -H_RegWY EQU $ff4a -H_RegWX EQU $ff4b -H_RegKEY1 EQU $ff4d -H_RegVBK EQU $ff4f -H_RegHDMA1 EQU $ff51 -H_RegHDMA2 EQU $ff52 -H_RegHDMA3 EQU $ff53 -H_RegHDMA4 EQU $ff54 -H_RegHDMA5 EQU $ff55 -H_RegRP EQU $ff56 -H_RegBGPI EQU $ff68 -H_RegBGPD EQU $ff69 -H_RegOBPI EQU $ff6a -H_RegOBPD EQU $ff6b -H_RegSVBK EQU $ff70 -H_RegIE EQU $ffff +DEF H_RegJoyp EQU $ff00 +DEF H_RegSB EQU $ff01 +DEF H_RegSC EQU $ff02 +DEF H_RegDIV EQU $ff04 +DEF H_RegTIMA EQU $ff05 +DEF H_RegTMA EQU $ff06 +DEF H_RegTAC EQU $ff07 +DEF H_RegIF EQU $ff0f +DEF H_RegNR10 EQU $ff10 +DEF H_RegNR11 EQU $ff11 +DEF H_RegNR12 EQU $ff12 +DEF H_RegNR13 EQU $ff13 +DEF H_RegNR14 EQU $ff14 +DEF H_RegNR21 EQU $ff16 +DEF H_RegNR22 EQU $ff17 +DEF H_RegNR23 EQU $ff18 +DEF H_RegNR24 EQU $ff19 +DEF H_RegNR30 EQU $ff1a +DEF H_RegNR31 EQU $ff1b +DEF H_RegNR32 EQU $ff1c +DEF H_RegNR33 EQU $ff1d +DEF H_RegNR34 EQU $ff1e +DEF H_RegNR41 EQU $ff20 +DEF H_RegNR42 EQU $ff21 +DEF H_RegNR43 EQU $ff22 +DEF H_RegNR44 EQU $ff23 +DEF H_RegNR50 EQU $ff24 +DEF H_RegNR51 EQU $ff25 +DEF H_RegNR52 EQU $ff26 +DEF H_RegLCDC EQU $ff40 +DEF H_LCDStat EQU $ff41 +DEF H_RegSCY EQU $ff42 +DEF H_RegSCX EQU $ff43 +DEF H_RegLY EQU $ff44 +DEF H_RegLYC EQU $ff45 +DEF H_RegDMA EQU $ff46 +DEF H_RegBGP EQU $ff47 +DEF H_RegOBP0 EQU $ff48 +DEF H_RegOBP1 EQU $ff49 +DEF H_RegWY EQU $ff4a +DEF H_RegWX EQU $ff4b +DEF H_RegKEY1 EQU $ff4d +DEF H_RegVBK EQU $ff4f +DEF H_RegHDMA1 EQU $ff51 +DEF H_RegHDMA2 EQU $ff52 +DEF H_RegHDMA3 EQU $ff53 +DEF H_RegHDMA4 EQU $ff54 +DEF H_RegHDMA5 EQU $ff55 +DEF H_RegRP EQU $ff56 +DEF H_RegBGPI EQU $ff68 +DEF H_RegBGPD EQU $ff69 +DEF H_RegOBPI EQU $ff6a +DEF H_RegOBPD EQU $ff6b +DEF H_RegSVBK EQU $ff70 +DEF H_RegIE EQU $ffff -X_MBC5SRAMEnable EQU $0000 -X_MBC5ROMBankLow EQU $2000 -X_MBC5ROMBankHigh EQU $3000 -X_MBC5SRAMBank EQU $4000 +DEF X_MBC5SRAMEnable EQU $0000 +DEF X_MBC5ROMBankLow EQU $2000 +DEF X_MBC5ROMBankHigh EQU $3000 +DEF X_MBC5SRAMBank EQU $4000 diff --git a/game/src/common/joypad.inc b/game/src/common/joypad.inc index 024ce63..755a314 100644 --- a/game/src/common/joypad.inc +++ b/game/src/common/joypad.inc @@ -1,11 +1,11 @@ -H_JPInputHeldDown EQU $ff8c -H_JPInputChanged EQU $ff8d +DEF H_JPInputHeldDown EQU $ff8c +DEF H_JPInputChanged EQU $ff8d -M_JPInputA EQU $1 -M_JPInputB EQU $2 -M_JPInputSelect EQU $4 -M_JPInputStart EQU $8 -M_JPInputRight EQU $10 -M_JPInputLeft EQU $20 -M_JPInputUp EQU $40 -M_JPInputDown EQU $80 +DEF M_JPInputA EQU $1 +DEF M_JPInputB EQU $2 +DEF M_JPInputSelect EQU $4 +DEF M_JPInputStart EQU $8 +DEF M_JPInputRight EQU $10 +DEF M_JPInputLeft EQU $20 +DEF M_JPInputUp EQU $40 +DEF M_JPInputDown EQU $80 diff --git a/game/src/gfx/attribmap.asm b/game/src/gfx/attribmap.asm index bff75c3..6c76d91 100644 --- a/game/src/gfx/attribmap.asm +++ b/game/src/gfx/attribmap.asm @@ -1,7 +1,7 @@ INCLUDE "game/src/common/constants.asm" -W_AttribmapWritingBaseLocationIndex EQU $C4E0 ; 0 for $9800, 1 for $9C00, I suck at naming things. -W_AttribmapPointerTableIndex EQU $C4E1 +DEF W_AttribmapWritingBaseLocationIndex EQU $C4E0 ; 0 for $9800, 1 for $9C00, I suck at naming things. +DEF W_AttribmapPointerTableIndex EQU $C4E1 SECTION "Attribmap Loading Variables 1", WRAM0[$C499] W_DecompressAttribmapCurrentValue:: ds 1 diff --git a/game/src/gfx/fades.asm b/game/src/gfx/fades.asm index 8ee08ff..d7f4f1c 100644 --- a/game/src/gfx/fades.asm +++ b/game/src/gfx/fades.asm @@ -8,7 +8,7 @@ SECTION "Fade Variables 2", WRAM0[$C47B] W_PaletteAnimStepController:: ds 1 W_PaletteAnimRunning:: ds 1 -W_FadePaletteForUnpacking EQU $C4EE ; This address is overutilised, so EQU is better. +DEF W_FadePaletteForUnpacking EQU $C4EE ; This address is overutilised, so EQU is better. SECTION "CGB Fade Palette Staging", WRAMX[$DB40], BANK[$3] W_FadeStagingOldBGPaletteIndexes:: ds $10 diff --git a/game/src/gfx/tilemap.asm b/game/src/gfx/tilemap.asm index 10334a2..e88a158 100644 --- a/game/src/gfx/tilemap.asm +++ b/game/src/gfx/tilemap.asm @@ -1,7 +1,7 @@ INCLUDE "game/src/common/constants.asm" -W_TilemapWritingBaseLocationIndex EQU $C4E0 ; 0 for $9800, 1 for $9C00, I suck at naming things. -W_TilemapPointerTableIndex EQU $C4E1 +DEF W_TilemapWritingBaseLocationIndex EQU $C4E0 ; 0 for $9800, 1 for $9C00, I suck at naming things. +DEF W_TilemapPointerTableIndex EQU $C4E1 SECTION "Load Tilemaps", ROM0[$072B] DecompressTilemapWTF:: diff --git a/game/src/gfx/tilesets.asm b/game/src/gfx/tilesets.asm index 421cd6e..78441b2 100644 --- a/game/src/gfx/tilesets.asm +++ b/game/src/gfx/tilesets.asm @@ -16,10 +16,10 @@ W_TilesetScript_NumTiles:: ds 1 SECTION "Tileset Variables 4", WRAM0[$C4DD] W_TilesetScript_Bank:: ds 1 -W_TilesetScript_PointerIndex EQU $C4E0 ; This address is overutilised, so EQU is better. -W_MaliasSourceBank EQU $C4EE ; This address is overutilised, so EQU is better. -W_TilesetScript_TilesetPointerIndex EQU $C4EE ; This address is overutilised, so EQU is better. -W_MaliasDestinationAddress EQU $C4F0 ; This address is overutilised, so EQU is better. +DEF W_TilesetScript_PointerIndex EQU $C4E0 ; This address is overutilised, so EQU is better. +DEF W_MaliasSourceBank EQU $C4EE ; This address is overutilised, so EQU is better. +DEF W_TilesetScript_TilesetPointerIndex EQU $C4EE ; This address is overutilised, so EQU is better. +DEF W_MaliasDestinationAddress EQU $C4F0 ; This address is overutilised, so EQU is better. SECTION "Load Malias-Compressed Tilesets", ROM0[$0A85] LoadMaliasGraphics:: diff --git a/game/src/nameentry/core.asm b/game/src/nameentry/core.asm index 9cea8de..33b2042 100644 --- a/game/src/nameentry/core.asm +++ b/game/src/nameentry/core.asm @@ -11,5 +11,6 @@ W_NamingScreenExitIndicator:: ds 1 SECTION "Naming Screen Variables 4", WRAM0[$C760] W_NamingScreenSubSubSubStateIndex:: ds 1 +W_NamingScreenTypeIndex:: ds 1 ; Look in version folders for the actual code. diff --git a/game/src/saveclock/integrity.asm b/game/src/saveclock/integrity.asm index abfce47..de66920 100644 --- a/game/src/saveclock/integrity.asm +++ b/game/src/saveclock/integrity.asm @@ -4,7 +4,7 @@ SECTION "Save Validation Variables", WRAM0[$C4D3] W_SaveChecksumToCompare:: ds 2 W_SaveValidationResults:: ds 1 -S_SaveChecksum EQU $BFFE +DEF S_SaveChecksum EQU $BFFE SECTION "Save Integrity Functions", ROMX[$40E7], BANK[$15] WriteSaveHeaderAndChecksum:: diff --git a/game/src/version/kabuto/attribmap_table.asm b/game/src/version/kabuto/attribmap_table.asm index 9816a1a..66ca84d 100644 --- a/game/src/version/kabuto/attribmap_table.asm +++ b/game/src/version/kabuto/attribmap_table.asm @@ -1,12 +1,12 @@ -cAttribmap07_06_GAMEVERSION EQUS "\"./build/attribmaps/0706_kabuto.map\"" -cAttribmap07_65_GAMEVERSION EQUS "\"./build/attribmaps/0765_kabuto.map\"" -cAttribmap07_66_GAMEVERSION EQUS "\"./build/attribmaps/0766_kabuto.map\"" -cAttribmap07_67_GAMEVERSION EQUS "\"./build/attribmaps/0767_kabuto.map\"" -cAttribmap07_68_GAMEVERSION EQUS "\"./build/attribmaps/0768_kabuto.map\"" -cAttribmap07_69_GAMEVERSION EQUS "\"./build/attribmaps/0769_kabuto.map\"" -cAttribmap07_6A_GAMEVERSION EQUS "\"./build/attribmaps/076A_kabuto.map\"" -cAttribmap07_6B_GAMEVERSION EQUS "\"./build/attribmaps/076B_kabuto.map\"" -cAttribmap07_6C_GAMEVERSION EQUS "\"./build/attribmaps/076C_kabuto.map\"" -cBANK_7_GAMEVERSION EQU $24 -cADDR_7_GAMEVERSION EQU $6146 +DEF cAttribmap07_06_GAMEVERSION EQUS "\"./build/attribmaps/0706_kabuto.map\"" +DEF cAttribmap07_65_GAMEVERSION EQUS "\"./build/attribmaps/0765_kabuto.map\"" +DEF cAttribmap07_66_GAMEVERSION EQUS "\"./build/attribmaps/0766_kabuto.map\"" +DEF cAttribmap07_67_GAMEVERSION EQUS "\"./build/attribmaps/0767_kabuto.map\"" +DEF cAttribmap07_68_GAMEVERSION EQUS "\"./build/attribmaps/0768_kabuto.map\"" +DEF cAttribmap07_69_GAMEVERSION EQUS "\"./build/attribmaps/0769_kabuto.map\"" +DEF cAttribmap07_6A_GAMEVERSION EQUS "\"./build/attribmaps/076A_kabuto.map\"" +DEF cAttribmap07_6B_GAMEVERSION EQUS "\"./build/attribmaps/076B_kabuto.map\"" +DEF cAttribmap07_6C_GAMEVERSION EQUS "\"./build/attribmaps/076C_kabuto.map\"" +DEF cBANK_7_GAMEVERSION EQU $24 +DEF cADDR_7_GAMEVERSION EQU $6146 INCLUDE "./game/src/version/attribmap_table.asm" diff --git a/game/src/version/kabuto/name_entry.asm b/game/src/version/kabuto/name_entry.asm index 993d068..274af82 100644 --- a/game/src/version/kabuto/name_entry.asm +++ b/game/src/version/kabuto/name_entry.asm @@ -1,10 +1,10 @@ INCLUDE "game/src/common/constants.asm" INCLUDE "game/src/common/macros.asm" -W_NamingEntryCurrentPage EQU $C48C -W_NamingScreenCursorPositionIndex EQU $C48D +DEF W_NamingEntryCurrentPage EQU $C48C +DEF W_NamingScreenCursorPositionIndex EQU $C48D -cNSOFFSET EQU 0 +DEF cNSOFFSET EQU 0 INCLUDE "./game/src/version/nameentry_core.asm" INCLUDE "./game/src/version/nameentry_player_naming_core.asm" INCLUDE "./game/src/version/nameentry_medal_naming_core.asm" diff --git a/game/src/version/kabuto/tilemap_table.asm b/game/src/version/kabuto/tilemap_table.asm index 4276161..1b53c62 100644 --- a/game/src/version/kabuto/tilemap_table.asm +++ b/game/src/version/kabuto/tilemap_table.asm @@ -1,14 +1,14 @@ -cTilemap01_27_GAMEVERSION EQUS "\"./build/tilemaps/0127_kabuto.map\"" -cTilemap06_06_GAMEVERSION EQUS "\"./build/tilemaps/0606_kabuto.map\"" -cTilemap06_64_GAMEVERSION EQUS "\"./build/tilemaps/0664_kabuto.map\"" -cTilemap06_65_GAMEVERSION EQUS "\"./build/tilemaps/0665_kabuto.map\"" -cTilemap06_66_GAMEVERSION EQUS "\"./build/tilemaps/0666_kabuto.map\"" -cTilemap06_67_GAMEVERSION EQUS "\"./build/tilemaps/0667_kabuto.map\"" -cTilemap06_68_GAMEVERSION EQUS "\"./build/tilemaps/0668_kabuto.map\"" -cTilemap06_69_GAMEVERSION EQUS "\"./build/tilemaps/0669_kabuto.map\"" -cTilemap06_6A_GAMEVERSION EQUS "\"./build/tilemaps/066A_kabuto.map\"" -cTilemap06_6B_GAMEVERSION EQUS "\"./build/tilemaps/066B_kabuto.map\"" -cTilemap06_6C_GAMEVERSION EQUS "\"./build/tilemaps/066C_kabuto.map\"" -cBANK_6_GAMEVERSION EQU $24 -cADDR_6_GAMEVERSION EQU $4B01 +DEF cTilemap01_27_GAMEVERSION EQUS "\"./build/tilemaps/0127_kabuto.map\"" +DEF cTilemap06_06_GAMEVERSION EQUS "\"./build/tilemaps/0606_kabuto.map\"" +DEF cTilemap06_64_GAMEVERSION EQUS "\"./build/tilemaps/0664_kabuto.map\"" +DEF cTilemap06_65_GAMEVERSION EQUS "\"./build/tilemaps/0665_kabuto.map\"" +DEF cTilemap06_66_GAMEVERSION EQUS "\"./build/tilemaps/0666_kabuto.map\"" +DEF cTilemap06_67_GAMEVERSION EQUS "\"./build/tilemaps/0667_kabuto.map\"" +DEF cTilemap06_68_GAMEVERSION EQUS "\"./build/tilemaps/0668_kabuto.map\"" +DEF cTilemap06_69_GAMEVERSION EQUS "\"./build/tilemaps/0669_kabuto.map\"" +DEF cTilemap06_6A_GAMEVERSION EQUS "\"./build/tilemaps/066A_kabuto.map\"" +DEF cTilemap06_6B_GAMEVERSION EQUS "\"./build/tilemaps/066B_kabuto.map\"" +DEF cTilemap06_6C_GAMEVERSION EQUS "\"./build/tilemaps/066C_kabuto.map\"" +DEF cBANK_6_GAMEVERSION EQU $24 +DEF cADDR_6_GAMEVERSION EQU $4B01 INCLUDE "./game/src/version/tilemap_table.asm" diff --git a/game/src/version/kuwagata/attribmap_table.asm b/game/src/version/kuwagata/attribmap_table.asm index b4f4259..529562e 100644 --- a/game/src/version/kuwagata/attribmap_table.asm +++ b/game/src/version/kuwagata/attribmap_table.asm @@ -1,12 +1,12 @@ -cAttribmap07_06_GAMEVERSION EQUS "\"./build/attribmaps/0706_kuwagata.map\"" -cAttribmap07_65_GAMEVERSION EQUS "\"./build/attribmaps/0765_kuwagata.map\"" -cAttribmap07_66_GAMEVERSION EQUS "\"./build/attribmaps/0766_kuwagata.map\"" -cAttribmap07_67_GAMEVERSION EQUS "\"./build/attribmaps/0767_kuwagata.map\"" -cAttribmap07_68_GAMEVERSION EQUS "\"./build/attribmaps/0768_kuwagata.map\"" -cAttribmap07_69_GAMEVERSION EQUS "\"./build/attribmaps/0769_kuwagata.map\"" -cAttribmap07_6A_GAMEVERSION EQUS "\"./build/attribmaps/076A_kuwagata.map\"" -cAttribmap07_6B_GAMEVERSION EQUS "\"./build/attribmaps/076B_kuwagata.map\"" -cAttribmap07_6C_GAMEVERSION EQUS "\"./build/attribmaps/076C_kuwagata.map\"" -cBANK_7_GAMEVERSION EQU $24 -cADDR_7_GAMEVERSION EQU $611E +DEF cAttribmap07_06_GAMEVERSION EQUS "\"./build/attribmaps/0706_kuwagata.map\"" +DEF cAttribmap07_65_GAMEVERSION EQUS "\"./build/attribmaps/0765_kuwagata.map\"" +DEF cAttribmap07_66_GAMEVERSION EQUS "\"./build/attribmaps/0766_kuwagata.map\"" +DEF cAttribmap07_67_GAMEVERSION EQUS "\"./build/attribmaps/0767_kuwagata.map\"" +DEF cAttribmap07_68_GAMEVERSION EQUS "\"./build/attribmaps/0768_kuwagata.map\"" +DEF cAttribmap07_69_GAMEVERSION EQUS "\"./build/attribmaps/0769_kuwagata.map\"" +DEF cAttribmap07_6A_GAMEVERSION EQUS "\"./build/attribmaps/076A_kuwagata.map\"" +DEF cAttribmap07_6B_GAMEVERSION EQUS "\"./build/attribmaps/076B_kuwagata.map\"" +DEF cAttribmap07_6C_GAMEVERSION EQUS "\"./build/attribmaps/076C_kuwagata.map\"" +DEF cBANK_7_GAMEVERSION EQU $24 +DEF cADDR_7_GAMEVERSION EQU $611E INCLUDE "./game/src/version/attribmap_table.asm" diff --git a/game/src/version/kuwagata/name_entry.asm b/game/src/version/kuwagata/name_entry.asm index d3e81f0..b083a67 100644 --- a/game/src/version/kuwagata/name_entry.asm +++ b/game/src/version/kuwagata/name_entry.asm @@ -1,10 +1,10 @@ INCLUDE "game/src/common/constants.asm" INCLUDE "game/src/common/macros.asm" -W_NamingEntryCurrentPage EQU $C48C -W_NamingScreenCursorPositionIndex EQU $C48D +DEF W_NamingEntryCurrentPage EQU $C48C +DEF W_NamingScreenCursorPositionIndex EQU $C48D -cNSOFFSET EQU 5 +DEF cNSOFFSET EQU 5 INCLUDE "./game/src/version/nameentry_core.asm" INCLUDE "./game/src/version/nameentry_player_naming_core.asm" INCLUDE "./game/src/version/nameentry_medal_naming_core.asm" diff --git a/game/src/version/kuwagata/tilemap_table.asm b/game/src/version/kuwagata/tilemap_table.asm index 401156e..f4c7da9 100644 --- a/game/src/version/kuwagata/tilemap_table.asm +++ b/game/src/version/kuwagata/tilemap_table.asm @@ -1,14 +1,14 @@ -cTilemap01_27_GAMEVERSION EQUS "\"./build/tilemaps/0127_kuwagata.map\"" -cTilemap06_06_GAMEVERSION EQUS "\"./build/tilemaps/0606_kuwagata.map\"" -cTilemap06_64_GAMEVERSION EQUS "\"./build/tilemaps/0664_kuwagata.map\"" -cTilemap06_65_GAMEVERSION EQUS "\"./build/tilemaps/0665_kuwagata.map\"" -cTilemap06_66_GAMEVERSION EQUS "\"./build/tilemaps/0666_kuwagata.map\"" -cTilemap06_67_GAMEVERSION EQUS "\"./build/tilemaps/0667_kuwagata.map\"" -cTilemap06_68_GAMEVERSION EQUS "\"./build/tilemaps/0668_kuwagata.map\"" -cTilemap06_69_GAMEVERSION EQUS "\"./build/tilemaps/0669_kuwagata.map\"" -cTilemap06_6A_GAMEVERSION EQUS "\"./build/tilemaps/066A_kuwagata.map\"" -cTilemap06_6B_GAMEVERSION EQUS "\"./build/tilemaps/066B_kuwagata.map\"" -cTilemap06_6C_GAMEVERSION EQUS "\"./build/tilemaps/066C_kuwagata.map\"" -cBANK_6_GAMEVERSION EQU $24 -cADDR_6_GAMEVERSION EQU $4AC8 +DEF cTilemap01_27_GAMEVERSION EQUS "\"./build/tilemaps/0127_kuwagata.map\"" +DEF cTilemap06_06_GAMEVERSION EQUS "\"./build/tilemaps/0606_kuwagata.map\"" +DEF cTilemap06_64_GAMEVERSION EQUS "\"./build/tilemaps/0664_kuwagata.map\"" +DEF cTilemap06_65_GAMEVERSION EQUS "\"./build/tilemaps/0665_kuwagata.map\"" +DEF cTilemap06_66_GAMEVERSION EQUS "\"./build/tilemaps/0666_kuwagata.map\"" +DEF cTilemap06_67_GAMEVERSION EQUS "\"./build/tilemaps/0667_kuwagata.map\"" +DEF cTilemap06_68_GAMEVERSION EQUS "\"./build/tilemaps/0668_kuwagata.map\"" +DEF cTilemap06_69_GAMEVERSION EQUS "\"./build/tilemaps/0669_kuwagata.map\"" +DEF cTilemap06_6A_GAMEVERSION EQUS "\"./build/tilemaps/066A_kuwagata.map\"" +DEF cTilemap06_6B_GAMEVERSION EQUS "\"./build/tilemaps/066B_kuwagata.map\"" +DEF cTilemap06_6C_GAMEVERSION EQUS "\"./build/tilemaps/066C_kuwagata.map\"" +DEF cBANK_6_GAMEVERSION EQU $24 +DEF cADDR_6_GAMEVERSION EQU $4AC8 INCLUDE "./game/src/version/tilemap_table.asm" diff --git a/game/src/version/nameentry_entry.asm b/game/src/version/nameentry_entry.asm index 6cbe618..922f8cb 100644 --- a/game/src/version/nameentry_entry.asm +++ b/game/src/version/nameentry_entry.asm @@ -410,7 +410,66 @@ NamingEntryMapCurrentPage:: .pageAttribmaps db $B0, $B1, $B2 -SECTION "Naming Screen Entry Functions 2", ROMX[$6065+cNSOFFSET], BANK[$03] +GetNameEntryFirstCharacterTileAddress:: + push bc + ld a, [W_NamingScreenTypeIndex] + ld hl, .table + rst $30 + pop bc + ret + +.table + dw $982B + dw $982A + +RenderNameEntryTextInputUnderlines:: +; Draws dashes for input. + ld a, [W_NamingScreenTypeIndex] + ld hl, .table + ld d, 0 + ld e, a + add hl, de + ld b, [hl] + ld c, 2 + ld e, $23 + ld a, 1 + cbcall DecompressTilemap0 + call GetNameEntryFirstCharacterTileAddress + ld de, $20 + add hl, de + ld a, [W_NamingScreenEnteredTextLength] + ld b, 0 + ld c, a + add hl, bc + ld d, 0 + ld a, [W_NamingScreenEnteredTextLength] + cp 8 + jp nz, .nameEntryNotFull + push hl + ld hl, .boundaryTileTable + ld a, [W_NamingScreenTypeIndex] + ld d, 0 + ld e, a + add hl, de + ld d, [hl] + pop hl + +.nameEntryNotFull + ld a, d + di + push af + rst $20 + pop af + ld [hli], a + ei + ret + +.table +db $B,$A + +.boundaryTileTable +db $F1,0 + PositionNameEntryBottomRowCursor:: ld a, [W_NamingEntryBottomRowSelection] ld hl, .table @@ -431,3 +490,73 @@ PositionNameEntryBottomRowCursor:: db $08, $87 db $40, $88 db $70, $88 + +NameEntryAdvanceToNextPage:: + ld a, 4 + call ScheduleSoundEffect + ld a, [W_NamingEntryCurrentPage] + inc a + cp 3 + jr nz, .dontLoopToStart + xor a + +.dontLoopToStart + ld [W_NamingEntryCurrentPage], a + call NamingEntryMapCurrentPage + +; The third page is only 3 rows instead of 5, so we need to shift the cursor upwards if it is on rows 4 or 5. + ld a, [W_NamingEntryCurrentPage] + cp 2 + ret nz + ld a, [W_NamingScreenSubSubSubStateIndex] + cp $11 + ret z + cp $12 + ret z + +.repositionCursorLoop + ld a, [W_NamingScreenCursorPositionIndex] + cp $2D + ret c + ld a, [W_NamingScreenCursorPositionIndex] + sub $F + ld [W_NamingScreenCursorPositionIndex], a + call $6179+cNSOFFSET + ld a, 1 + ld [W_OAM_SpritesReady], a + jr .repositionCursorLoop + +NameEntryDoBackspace:: + ld a, [W_NamingScreenEnteredTextLength] + cp 8 + jp nz, .skipCursorRestore + ld a, 1 + ld [$C1E0], a + +.skipCursorRestore + ld a, [W_NamingScreenEnteredTextLength] + dec a + ld [W_NamingScreenEnteredTextLength], a + ld hl, W_NamingScreenEnteredTextBuffer + ld b, 0 + ld c, a + add hl, bc + ld [hl], 0 + ld b, 0 + ld c, a + call GetNameEntryFirstCharacterTileAddress + add hl, bc + xor a + di + push af + rst $20 + pop af + ld [hli], a + ei + ld a, [$C1E3] + sub 8 + ld [$C1E3], a + ld a, 1 + ld [W_OAM_SpritesReady], a + call RenderNameEntryTextInputUnderlines + ret diff --git a/game/src/version/nameentry_entry_core.asm b/game/src/version/nameentry_entry_core.asm index ce271df..32611aa 100644 --- a/game/src/version/nameentry_entry_core.asm +++ b/game/src/version/nameentry_entry_core.asm @@ -34,7 +34,7 @@ NamingEntryInputHandlerState:: cbcallindex 9 ld de, $C220 cbcallindex 9 - ld a, [$C761] + ld a, [W_NamingScreenTypeIndex] or a jr nz, .noWalkingAnimation ld de, $C200 @@ -194,7 +194,7 @@ NamingEntryInputHandlerState:: ret NamingEntrySwitchCaseState:: - call $6087+cNSOFFSET + call NameEntryAdvanceToNextPage ld a, 1 ld [W_NamingScreenSubSubSubStateIndex], a ret @@ -243,7 +243,7 @@ NamingEntryInputCharacterState:: add hl, bc ld a, [$C4EE] ld [hl], a - call $600D+cNSOFFSET + call GetNameEntryFirstCharacterTileAddress ld a, [W_NamingScreenEnteredTextLength] ld b, 0 ld c, a @@ -263,7 +263,7 @@ NamingEntryInputCharacterState:: ld [$C1E3], a ld a, 1 ld [W_OAM_SpritesReady], a - call $601B+cNSOFFSET + call RenderNameEntryTextInputUnderlines jp .exit .dakuten @@ -303,7 +303,7 @@ NamingEntryInputCharacterState:: dec a ld b, 0 ld c, a - call $600D+cNSOFFSET + call GetNameEntryFirstCharacterTileAddress add hl, bc ld a, [$C4EE] di @@ -362,7 +362,7 @@ NamingEntryInputCharacterState:: dec a ld b, 0 ld c, a - call $600D+cNSOFFSET + call GetNameEntryFirstCharacterTileAddress add hl, bc ld a, [$C4EE] di @@ -414,7 +414,7 @@ NamingEntryBackspaceState:: ld a, [W_NamingScreenEnteredTextLength] or a jp z, .exit - call $60C2+cNSOFFSET + call NameEntryDoBackspace .exit ld a, 1 @@ -468,7 +468,7 @@ NamingEntrySubmitNameState:: NamingEntryBottomRowInputHandlerState:: ld de, $C1E0 cbcallindex 9 - ld a, [$C761] + ld a, [W_NamingScreenTypeIndex] or a jr nz, .noWalkingAnimation ld de, $C200 @@ -566,7 +566,7 @@ NamingEntryBottomRowInputHandlerState:: ret NamingEntrySwitchCaseFromBottomRowState:: - call $6087+cNSOFFSET + call NameEntryAdvanceToNextPage ld a, $10 ld [W_NamingScreenSubSubSubStateIndex], a ret @@ -590,7 +590,7 @@ NamingEntryDirectSelectionFromBottomRowState:: dw .submitName .switchCase - call $6087+cNSOFFSET + call NameEntryAdvanceToNextPage ld a, $10 ld [W_NamingScreenSubSubSubStateIndex], a ret @@ -601,7 +601,7 @@ NamingEntryDirectSelectionFromBottomRowState:: ld a, [W_NamingScreenEnteredTextLength] or a jp z, .backspaceExit - call $60C2+cNSOFFSET + call NameEntryDoBackspace .backspaceExit ld a, $10 @@ -617,7 +617,7 @@ NamingEntryBackspaceFromBottomRowState:: ld a, [W_NamingScreenEnteredTextLength] or a jp z, .exit - call $60C2+cNSOFFSET + call NameEntryDoBackspace .exit ld a, $10 diff --git a/game/src/version/nameentry_medal_naming_core.asm b/game/src/version/nameentry_medal_naming_core.asm index d1f7ffd..4137f69 100644 --- a/game/src/version/nameentry_medal_naming_core.asm +++ b/game/src/version/nameentry_medal_naming_core.asm @@ -83,7 +83,7 @@ MedalNamingScreenInitState:: pop af ld [$C762], a ld a, 1 - ld [$C761], a + ld [W_NamingScreenTypeIndex], a call $699D+cNSOFFSET call $697C+cNSOFFSET call $699D+cNSOFFSET @@ -132,7 +132,7 @@ MedalNamingScreenMapScreenAndPrepareSpritesState:: ld e, $22 ld a, 1 cbcall DecompressTilemap0 - call $601B+cNSOFFSET + call RenderNameEntryTextInputUnderlines ld a, [$C762] ld [W_ListItemIndexForBuffering], a ld b, $B @@ -144,7 +144,7 @@ MedalNamingScreenMapScreenAndPrepareSpritesState:: ld bc, W_ListItemBufferArea ld a, 5 call PutStringFixedLength - call $600D+cNSOFFSET + call GetNameEntryFirstCharacterTileAddress push hl ld hl, W_NamingScreenEnteredTextBuffer pop de diff --git a/game/src/version/nameentry_player_naming_core.asm b/game/src/version/nameentry_player_naming_core.asm index cd054ef..e90d67f 100644 --- a/game/src/version/nameentry_player_naming_core.asm +++ b/game/src/version/nameentry_player_naming_core.asm @@ -62,7 +62,7 @@ PlayerNamingScreenInitState:: ld a, 3 ; Initial Name Length ld [W_NamingScreenEnteredTextLength], a xor a - ld [$C761], a + ld [W_NamingScreenTypeIndex], a jp IncNamingScreenSubSubStateIndex PlayerNamingScreenPrepareFadeOutFromOverworldState:: @@ -145,8 +145,8 @@ PlayerNamingScreenMapScreenAndPrepareSpritesState:: ld e, $21 ld a, 1 cbcall DecompressTilemap0 - call $601B+cNSOFFSET - call $600D+cNSOFFSET + call RenderNameEntryTextInputUnderlines + call GetNameEntryFirstCharacterTileAddress ld a, $02 ; 'イ' di push af diff --git a/scripts/dialogbin2asm.py b/scripts/dialogbin2asm.py index e8857bf..6266620 100755 --- a/scripts/dialogbin2asm.py +++ b/scripts/dialogbin2asm.py @@ -51,4 +51,4 @@ with open(output_file, 'w') as output: for k in bin_files: - output.write(f'c{k} EQUS "\\"{bin_files[k]}\\""\n') \ No newline at end of file + output.write(f'DEF c{k} EQUS "\\"{bin_files[k]}\\""\n') \ No newline at end of file