diff options
| author | Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> | 2025-11-18 21:17:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-18 15:17:31 -0500 |
| commit | f3326786259f4e53c06b7565369add7605bea8ba (patch) | |
| tree | 1e09025ed19a6403fa74c408aa195662178cc0ca /engine/battle | |
| parent | Add `_vc` patch targets to `.PHONY` (diff) | |
| download | pokeyellow-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/battle')
| -rw-r--r-- | engine/battle/animations.asm | 18 | ||||
| -rw-r--r-- | engine/battle/battle_transitions.asm | 6 | ||||
| -rw-r--r-- | engine/battle/core.asm | 12 | ||||
| -rw-r--r-- | engine/battle/draw_hud_pokeball_gfx.asm | 2 | ||||
| -rw-r--r-- | engine/battle/effects.asm | 2 |
5 files changed, 20 insertions, 20 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 40b2047b..711ebda4 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -928,7 +928,7 @@ BallMoveDistances2: DoGrowlSpecialEffects: ld hl, wShadowOAM ld de, wShadowOAMSprite04 - ld bc, $10 + ld bc, OBJ_SIZE * 4 call CopyData ; copy the musical note graphic ld a, [wSubAnimCounter] dec a @@ -1308,7 +1308,7 @@ AdjustOAMBlockXPos: ld h, d AdjustOAMBlockXPos2: - ld de, 4 + ld de, OBJ_SIZE .loop ld a, [wCoordAdjustmentAmount] ld b, a @@ -1318,7 +1318,7 @@ AdjustOAMBlockXPos2: jr c, .skipPuttingEntryOffScreen ; put off-screen if X >= 168 dec hl - ld a, 160 + ld a, SCREEN_HEIGHT_PX + OAM_Y_OFS ld [hli], a .skipPuttingEntryOffScreen ld [hl], a @@ -1332,7 +1332,7 @@ AdjustOAMBlockYPos: ld h, d AdjustOAMBlockYPos2: - ld de, 4 + ld de, OBJ_SIZE .loop ld a, [wCoordAdjustmentAmount] ld b, a @@ -1670,7 +1670,7 @@ _AnimationShootBallsUpward: dec a ld [wNumShootingBalls], a .next - ld de, 4 + ld de, OBJ_SIZE add hl, de ; next OAM entry dec b jr nz, .innerLoop @@ -1723,10 +1723,10 @@ AnimationMinimizeMon: ld hl, wTempPic push hl xor a - ld bc, 7 * 7 * $10 + ld bc, (7 * 7) tiles call FillMemory pop hl - ld de, 7 * 3 * $10 + 4 * $10 + 4 + ld de, (7 * 3 + 4) tiles + TILE_SIZE / 4 add hl, de ld de, MinimizedMonSprite ld c, MinimizedMonSpriteEnd - MinimizedMonSprite @@ -1971,7 +1971,7 @@ AnimationSubstitute: jp AnimationShowMonPic CopyMonsterSpriteData: - ld bc, 1 tiles + ld bc, TILE_SIZE ld a, BANK(MonsterSprite) jp FarCopyData2 @@ -2379,7 +2379,7 @@ FallingObjects_UpdateOAMEntry: inc a cp 112 jr c, .next - ld a, 160 ; if Y >= 112, put it off-screen + ld a, SCREEN_HEIGHT_PX + OAM_Y_OFS ; if Y >= 112, put it off-screen .next ld [hli], a ; Y ld a, [wFallingObjectMovementByte] diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index fe731c5d..3670cddc 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -14,7 +14,7 @@ BattleTransition: ldh a, [hSpriteIndex] ; enemy trainer sprite index (0 if wild battle) ld c, a ld b, 0 - ld de, $10 + ld de, SPRITESTATEDATA1_LENGTH .loop1 ld a, [hl] cp $ff @@ -35,13 +35,13 @@ BattleTransition: jr z, .skip2 ; skip clearing the block if the enemy trainer is using it push hl push bc - ld bc, $10 + ld bc, OBJ_SIZE * 4 xor a call FillMemory pop bc pop hl .skip2 - ld de, $10 + ld de, OBJ_SIZE * 4 add hl, de dec c jr nz, .loop2 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 87abf2e8..0916176c 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -106,8 +106,8 @@ SlidePlayerAndEnemySilhouettesOnScreen: SlidePlayerHeadLeft: push bc ld hl, wShadowOAMSprite00XCoord - ld c, $15 ; number of OAM entries - ld de, $4 ; size of OAM entry + ld c, 7 * 3 ; number of OAM entries + ld de, OBJ_SIZE .loop dec [hl] ; decrement X dec [hl] ; decrement X @@ -6655,11 +6655,11 @@ LoadHudTilePatterns: .lcdEnabled ld de, BattleHudTiles1 ld hl, vChars2 tile $6d - lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / $8 + lb bc, BANK(BattleHudTiles1), (BattleHudTiles1End - BattleHudTiles1) / TILE_1BPP_SIZE call CopyVideoDataDouble ld de, BattleHudTiles2 ld hl, vChars2 tile $73 - lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / $8 + lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / TILE_1BPP_SIZE jp CopyVideoDataDouble PrintEmptyString: @@ -7040,14 +7040,14 @@ LoadMonBackPic: ld b, 7 ld c, 8 call ClearScreenArea - ld hl, wMonHBackSprite - wMonHeader + ld hl, wMonHBackSprite - wMonHeader call UncompressMonSprite predef ScaleSpriteByTwo ld de, vBackPic call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite ld hl, vSprites ld de, vBackPic - ld c, (2 * SPRITEBUFFERSIZE) / 16 ; count of 16-byte chunks to be copied + ld c, (2 * SPRITEBUFFERSIZE) / TILE_SIZE ; count of 16-byte chunks to be copied ldh a, [hLoadedROMBank] ld b, a jp CopyVideoData diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 34bff58d..983e7cdf 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -13,7 +13,7 @@ DrawEnemyPokeballs: LoadPartyPokeballGfx: ld de, PokeballTileGraphics ld hl, vSprites tile $31 - lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10 + lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / TILE_SIZE jp CopyVideoData SetupOwnPartyPokeballs: diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 413c34d9..e107853c 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -686,7 +686,7 @@ UpdateLoweredStatDone: .ApplyBadgeBoostsAndStatusPenalties ldh a, [hWhoseTurn] and a - call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat, + call nz, ApplyBadgeStatBoosts ; whenever the opponent uses a stat-down move, badge boosts get reapplied again to every stat, ; even to those not affected by the stat-down move (will be boosted further) ld hl, MonsStatsFellText call PrintText |
