aboutsummaryrefslogtreecommitdiffstats
path: root/engine/menus
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2026-01-17 22:38:33 -0600
committerdannye <33dannye@gmail.com>2026-01-17 22:38:33 -0600
commitbc2354dd6626ce28bb9561547ed2107cfa56c18e (patch)
tree5902d4c3389253c76b7c3351e0d7dfecb551c28d /engine/menus
parentIdentify characters in `_OakSpeechText2B` and `Printer_GetMonStats.IDNo` (#144) (diff)
parentUse macros for `WildMonEncounterSlotChances` (#562) (diff)
downloadpokeyellow-bc2354dd6626ce28bb9561547ed2107cfa56c18e.tar.gz
pokeyellow-bc2354dd6626ce28bb9561547ed2107cfa56c18e.tar.xz
pokeyellow-bc2354dd6626ce28bb9561547ed2107cfa56c18e.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine/menus')
-rw-r--r--engine/menus/display_text_id_init.asm7
-rw-r--r--engine/menus/naming_screen.asm40
-rw-r--r--engine/menus/party_menu.asm2
-rw-r--r--engine/menus/pokedex.asm6
-rw-r--r--engine/menus/save.asm4
-rw-r--r--engine/menus/start_sub_menus.asm30
-rw-r--r--engine/menus/swap_items.asm2
-rw-r--r--engine/menus/text_box.asm2
8 files changed, 48 insertions, 45 deletions
diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm
index ca828006..1dda338d 100644
--- a/engine/menus/display_text_id_init.asm
+++ b/engine/menus/display_text_id_init.asm
@@ -40,8 +40,8 @@ DisplayTextIDInit::
; this is done because when you talk to an NPC, they turn to look your way
; the original direction they were facing must be restored after the dialogue is over
ld hl, wSprite01StateData1FacingDirection
- ld c, $0f
- ld de, $10
+ ld c, NUM_SPRITESTATEDATA_STRUCTS - 1
+ ld de, SPRITESTATEDATA1_LENGTH
.spriteFacingDirectionCopyLoop
ld a, [hl] ; x#SPRITESTATEDATA1_FACINGDIRECTION
inc h
@@ -53,7 +53,8 @@ DisplayTextIDInit::
; loop to force all the sprites in the middle of animation to stand still
; (so that they don't like they're frozen mid-step during the dialogue)
ld hl, wSpritePlayerStateData1ImageIndex
- ld de, $10
+ ld de, SPRITESTATEDATA1_LENGTH
+ ASSERT NUM_SPRITESTATEDATA_STRUCTS == SPRITESTATEDATA1_LENGTH
ld c, e
.spriteStandStillLoop
ld a, [hl]
diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm
index 38da8afe..5b4b2415 100644
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -239,11 +239,11 @@ DisplayNamingScreen:
cp NAME_MON_SCREEN
jr nc, .checkMonNameLength
ld a, [wNamingScreenNameLength]
- cp $7 ; max length of player/rival names
+ cp PLAYER_NAME_LENGTH - 1
jr .checkNameLength
.checkMonNameLength
ld a, [wNamingScreenNameLength]
- cp $a ; max length of pokemon nicknames
+ cp NAME_LENGTH - 1
.checkNameLength
jr c, .addLetter
ret
@@ -394,12 +394,13 @@ PrintNicknameAndUnderscores:
hlcoord 10, 3
ld a, [wNamingScreenType]
cp NAME_MON_SCREEN
- jr nc, .pokemon1
- ld b, 7 ; player or rival max name length
- jr .playerOrRival1
-.pokemon1
- ld b, 10 ; pokemon max name length
-.playerOrRival1
+ jr nc, .pokemon
+; player or rival
+ ld b, PLAYER_NAME_LENGTH - 1
+ jr .gotUnderscoreCount
+.pokemon
+ ld b, NAME_LENGTH - 1
+.gotUnderscoreCount
ld a, $76 ; underscore tile id
.placeUnderscoreLoop
ld [hli], a
@@ -409,13 +410,15 @@ PrintNicknameAndUnderscores:
cp NAME_MON_SCREEN
ld a, [wNamingScreenNameLength]
jr nc, .pokemon2
- cp 7 ; player or rival max name length
- jr .playerOrRival2
+; player or rival
+ cp PLAYER_NAME_LENGTH - 1
+ jr .checkEmptySpaces
.pokemon2
- cp 10 ; pokemon max name length
-.playerOrRival2
- jr nz, .emptySpacesRemaining
- ; when all spaces are filled, force the cursor onto the ED tile
+ cp NAME_LENGTH - 1
+.checkEmptySpaces
+ jr nz, .placeRaisedUnderscore ; jump if empty spaces remain
+ ; when all spaces are filled, force the cursor onto the ED tile,
+ ; and keep the last underscore raised
call EraseMenuCursor
ld a, $11 ; "ED" x coord
ld [wTopMenuItemX], a
@@ -423,11 +426,10 @@ PrintNicknameAndUnderscores:
ld [wCurrentMenuItem], a
ld a, [wNamingScreenType]
cp NAME_MON_SCREEN
- ld a, 9 ; keep the last underscore raised
- jr nc, .pokemon3
- ld a, 6 ; keep the last underscore raised
-.pokemon3
-.emptySpacesRemaining
+ ld a, NAME_LENGTH - 2
+ jr nc, .placeRaisedUnderscore
+ ld a, PLAYER_NAME_LENGTH - 2
+.placeRaisedUnderscore
ld c, a
ld b, $0
hlcoord 10, 3
diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm
index d994c15f..24d2aa13 100644
--- a/engine/menus/party_menu.asm
+++ b/engine/menus/party_menu.asm
@@ -110,7 +110,7 @@ RedrawPartyMenu_::
pop hl
pop de
inc de
- ld bc, 2 * 20
+ ld bc, 2 * SCREEN_WIDTH
add hl, bc
pop bc
inc c
diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm
index 48c5ab01..dcf55820 100644
--- a/engine/menus/pokedex.asm
+++ b/engine/menus/pokedex.asm
@@ -118,7 +118,7 @@ ELSE
jr z, .chosePrint
ENDC
vc_patch_end
-.choseQuit
+; chose Quit
ld b, 1
.exitSideMenu
pop af
@@ -484,8 +484,8 @@ HeightWeightText:
db "HT ?′??″"
next "WT ???lb@"
-; XXX does anything point to this?
-PokeText:
+; leftover from JPN Pokedex, where species have the suffix "Pokemon"
+PokeText: ; unreferenced
db "#@"
; horizontal line that divides the pokedex text description from the rest of the data
diff --git a/engine/menus/save.asm b/engine/menus/save.asm
index 768b6e8b..bc427936 100644
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -214,15 +214,15 @@ SaveMainData:
ld de, sSpriteData
ld bc, wSpriteDataEnd - wSpriteDataStart
call CopyData
- ld hl, wBoxDataStart
; this part is redundant, SaveCurrentBoxData is always called next
+ ld hl, wBoxDataStart
ld de, sCurBoxData
ld bc, wBoxDataEnd - wBoxDataStart
call CopyData
+
ldh a, [hTileAnimations]
ld [sTileAnimations], a
-
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call CalcCheckSum
diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm
index 7e801068..dfbb0f13 100644
--- a/engine/menus/start_sub_menus.asm
+++ b/engine/menus/start_sub_menus.asm
@@ -253,7 +253,7 @@ StartMenu_Pokemon::
.softboiled
ld hl, wPartyMon1MaxHP
ld a, [wWhichPokemon]
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [hli]
ldh [hDividend], a
@@ -263,7 +263,7 @@ StartMenu_Pokemon::
ldh [hDivisor], a
ld b, 2 ; number of bytes
call Divide
- ld bc, wPartyMon1HP - wPartyMon1MaxHP
+ ld bc, MON_HP - MON_MAXHP
add hl, bc
ld a, [hld]
ld b, a
@@ -357,7 +357,7 @@ StartMenu_Item::
ld a, [wCurItem]
cp BICYCLE
jp z, .useOrTossItem
-.notBicycle1
+; not Bicycle
ld a, USE_TOSS_MENU_TEMPLATE
ld [wTextBoxID], a
call DisplayTextBoxID
@@ -387,14 +387,14 @@ StartMenu_Item::
call CopyToStringBuffer
ld a, [wCurItem]
cp BICYCLE
- jr nz, .notBicycle2
+ jr nz, .notBicycle
ld a, [wStatusFlags6]
bit BIT_ALWAYS_ON_BIKE, a
jr z, .useItem_closeMenu
ld hl, CannotGetOffHereText
call PrintText
jp ItemMenuLoop
-.notBicycle2
+.notBicycle
ld a, [wCurrentMenuItem]
and a
jr nz, .tossItem
@@ -529,7 +529,7 @@ DrawTrainerInfo:
ld de, 13 tiles
add hl, de ; hl = colon tile pattern
ld de, vChars1 tile $56
- ld bc, 1 tiles
+ ld bc, TILE_SIZE
ld a, BANK(TextBoxGraphics)
push bc
call FarCopyData
@@ -695,13 +695,13 @@ SwitchPartyMon_ClearGfx:
dec c
jr nz, .clearMonBGLoop
pop af
- ld hl, wShadowOAM
- ld bc, $10
+ ld hl, wShadowOAMSprite00YCoord
+ ld bc, OBJ_SIZE * 4
call AddNTimes
- ld de, $4
+ ld de, OBJ_SIZE
ld c, e
.clearMonOAMLoop
- ld [hl], $a0
+ ld [hl], SCREEN_HEIGHT_PX + OAM_Y_OFS
add hl, de
dec c
jr nz, .clearMonOAMLoop
@@ -761,24 +761,24 @@ SwitchPartyMon_InitVarOrSwapData:
ldh a, [hSwapTemp]
ld [de], a
ld hl, wPartyMons
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wCurrentMenuItem]
call AddNTimes
push hl
ld de, wSwitchPartyMonTempBuffer
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
call CopyData
ld hl, wPartyMons
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wMenuItemToSwap]
call AddNTimes
pop de
push hl
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
call CopyData
pop de
ld hl, wSwitchPartyMonTempBuffer
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
call CopyData
ld hl, wPartyMonOT
ld a, [wCurrentMenuItem]
diff --git a/engine/menus/swap_items.asm b/engine/menus/swap_items.asm
index 2d506ce2..dc54b645 100644
--- a/engine/menus/swap_items.asm
+++ b/engine/menus/swap_items.asm
@@ -76,7 +76,7 @@ HandleItemListSwapping::
ld a, [hli]
cp b
jr z, .swapSameItemType
-.swapDifferentItems
+; swap different items
ldh [hSwapItemID], a ; save second item ID
ld a, [hld]
ldh [hSwapItemQuantity], a ; save second item quantity
diff --git a/engine/menus/text_box.asm b/engine/menus/text_box.asm
index a9d5b4c9..d3144386 100644
--- a/engine/menus/text_box.asm
+++ b/engine/menus/text_box.asm
@@ -481,7 +481,7 @@ PokemonMenuEntries:
GetMonFieldMoves:
ld a, [wWhichPokemon]
ld hl, wPartyMon1Moves
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld d, h
ld e, l