ref: 0c746447e709a9bcbfc57985abb463cc1eacc9a2
parent: 5145d69506ddcd93f63b45fa9688e59b5f49549e
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat Jul 28 21:09:12 EDT 2018
Improve wTrainerHUDTiles usage
--- a/engine/battle/trainer_huds.asm
+++ b/engine/battle/trainer_huds.asm
@@ -101,7 +101,7 @@
DrawPlayerHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
- ld bc, 4
+ ld bc, .tiles_end - .tiles
call CopyBytes
hlcoord 18, 10
ld de, -1 ; start on right
@@ -112,11 +112,12 @@
db $77 ; bottom right
db $6f ; bottom left
db $76 ; bottom side
+.tiles_end
DrawPlayerPartyIconHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
- ld bc, 4
+ ld bc, .tiles_end - .tiles
call CopyBytes
hlcoord 18, 10
ld de, -1 ; start on right
@@ -127,11 +128,12 @@
db $5c ; bottom right
db $6f ; bottom left
db $76 ; bottom side
+.tiles_end
DrawEnemyHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
- ld bc, 4
+ ld bc, .tiles_end - .tiles
call CopyBytes
hlcoord 1, 2
ld de, 1 ; start on left
@@ -152,23 +154,24 @@
db $74 ; bottom left
db $78 ; bottom right
db $76 ; bottom side
+.tiles_end
PlaceHUDBorderTiles:
- ld a, [wTrainerHUDTiles]
+ ld a, [wTrainerHUDTiles+0]
ld [hl], a
ld bc, SCREEN_WIDTH
add hl, bc
- ld a, [wStartFlypoint]
+ ld a, [wTrainerHUDTiles+1]
ld [hl], a
- ld b, $8
+ ld b, 8
.loop
add hl, de
- ld a, [wMovementBuffer]
+ ld a, [wTrainerHUDTiles+3]
ld [hl], a
dec b
jr nz, .loop
add hl, de
- ld a, [wEndFlypoint]
+ ld a, [wTrainerHUDTiles+2]
ld [hl], a
ret
@@ -181,7 +184,7 @@
ld a, 10 * 8
ld [hli], a
ld [hl], 8 * 8
- ld a, $8
+ ld a, 8
ld [wPlaceBallsDirection], a
ld hl, wVirtualOAMSprite00
call LoadTrainerHudOAM
--- a/wram.asm
+++ b/wram.asm
@@ -1701,7 +1701,7 @@
; trainer HUD data
ds 1
wPlaceBallsDirection:: db
-wTrainerHUDTiles:: db
+wTrainerHUDTiles:: ds 4
NEXTU ; d002
; mobile participant nicknames