aboutsummaryrefslogtreecommitdiffstats
path: root/engine/menus
diff options
context:
space:
mode:
authorNarishma-gb <194818981+Narishma-gb@users.noreply.github.com>2025-11-18 21:17:31 +0100
committerGitHub <noreply@github.com>2025-11-18 15:17:31 -0500
commitf3326786259f4e53c06b7565369add7605bea8ba (patch)
tree1e09025ed19a6403fa74c408aa195662178cc0ca /engine/menus
parentAdd `_vc` patch targets to `.PHONY` (diff)
downloadpokeyellow-f3326786259f4e53c06b7565369add7605bea8ba.tar.gz
pokeyellow-f3326786259f4e53c06b7565369add7605bea8ba.tar.xz
pokeyellow-f3326786259f4e53c06b7565369add7605bea8ba.zip
Use more hardware and graphics constants (#532)
- Use `OBJ_SIZE` and `TILE_SIZE` from hardware.inc. - `SPRITESTATEDATA1_LENGTH`, `NUM_SPRITESTATEDATA_STRUCTS` and `TILE_1BPP_SIZE` are used in some places. - Highlight an oversight in `OakSpeech` where several direct MBC bank switches are requested. - Remove redundant comments in home/overworld.asm. - Add unreferenced `FillBgMap` function to avoid a byte of dead code. - Some constants added in wram.asm. - Correctly separate the commented code in `SaveMainData`.
Diffstat (limited to 'engine/menus')
-rw-r--r--engine/menus/display_text_id_init.asm7
-rw-r--r--engine/menus/naming_screen.asm2
-rw-r--r--engine/menus/save.asm4
-rw-r--r--engine/menus/start_sub_menus.asm10
4 files changed, 12 insertions, 11 deletions
diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm
index f8bd6512..7ffdf7c3 100644
--- a/engine/menus/display_text_id_init.asm
+++ b/engine/menus/display_text_id_init.asm
@@ -43,8 +43,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
@@ -56,7 +56,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 fda482e3..9c0cd0a8 100644
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -327,7 +327,7 @@ LoadEDTile:
ld de, ED_Tile
ld hl, vFont tile $70
; BUG: BANK("Home") should be BANK(ED_Tile), although it coincidentally works as-is
- lb bc, BANK("Home"), (ED_TileEnd - ED_Tile) / $8
+ lb bc, BANK("Home"), (ED_TileEnd - ED_Tile) / TILE_1BPP_SIZE
jp CopyVideoDataDouble
ED_Tile:
diff --git a/engine/menus/save.asm b/engine/menus/save.asm
index 9dfdd949..3fab0d01 100644
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -225,15 +225,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 8ba05b3f..c27e58a9 100644
--- a/engine/menus/start_sub_menus.asm
+++ b/engine/menus/start_sub_menus.asm
@@ -511,7 +511,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 FarCopyData2
@@ -677,13 +677,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