From f3326786259f4e53c06b7565369add7605bea8ba Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Tue, 18 Nov 2025 21:17:31 +0100 Subject: 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`. --- engine/overworld/cut.asm | 6 +++--- engine/overworld/dust_smoke.asm | 4 ++-- engine/overworld/ledges.asm | 2 +- engine/overworld/player_animations.asm | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 93902b51..368941d5 100644 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -100,13 +100,13 @@ InitCutAnimOAM: call LoadCutGrassAnimationTilePattern call WriteCutOrBoulderDustAnimationOAMBlock ld hl, wShadowOAMSprite36Attributes - ld de, 4 - ld a, $30 + ld de, OBJ_SIZE + ld a, OAM_XFLIP | OAM_PAL1 ld c, e .loop ld [hl], a add hl, de - xor $60 + xor OAM_YFLIP | OAM_XFLIP dec c jr nz, .loop ret diff --git a/engine/overworld/dust_smoke.asm b/engine/overworld/dust_smoke.asm index 96dd364a..85b89cdc 100644 --- a/engine/overworld/dust_smoke.asm +++ b/engine/overworld/dust_smoke.asm @@ -70,7 +70,7 @@ LoadSmokeTileFourTimes:: push hl call LoadSmokeTile pop hl - ld bc, 1 tiles + ld bc, TILE_SIZE add hl, bc pop bc dec c @@ -79,7 +79,7 @@ LoadSmokeTileFourTimes:: LoadSmokeTile: ld de, SSAnneSmokePuffTile - lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / $10 + lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / TILE_SIZE jp CopyVideoData SSAnneSmokePuffTile: diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index db8b9e97..69403042 100644 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -59,7 +59,7 @@ INCLUDE "data/tilesets/ledge_tiles.asm" LoadHoppingShadowOAM: ld hl, vChars1 tile $7f ld de, LedgeHoppingShadow - lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8 + lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / TILE_1BPP_SIZE call CopyVideoDataDouble ld a, $9 lb bc, $54, $48 ; b, c = y, x coordinates of shadow diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index c163b27e..4ed1f49f 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -209,13 +209,13 @@ LeaveMapThroughHoleAnim: ld [wShadowOAMSprite02TileID], a ld a, [wShadowOAMSprite01TileID] ld [wShadowOAMSprite03TileID], a - ld a, $a0 + ld a, SCREEN_HEIGHT_PX + OAM_Y_OFS ld [wShadowOAMSprite00YCoord], a ld [wShadowOAMSprite01YCoord], a ld c, 2 call DelayFrames ; hide upper half of player's sprite - ld a, $a0 + ld a, SCREEN_HEIGHT_PX + OAM_Y_OFS ld [wShadowOAMSprite02YCoord], a ld [wShadowOAMSprite03YCoord], a call GBFadeOutToWhite @@ -423,7 +423,7 @@ FishingAnim: ld a, [wSpritePlayerStateData1ImageIndex] ; (image index is locked to standing images) cp SPRITE_FACING_UP jr nz, .skipHidingFishingRod - ld a, $a0 + ld a, SCREEN_HEIGHT_PX + OAM_Y_OFS ld [wShadowOAMSprite39YCoord], a .skipHidingFishingRod -- cgit v1.3.1-sl0p