add border constant and clear up misnomer

This commit is contained in:
YamaArashi 2015-08-14 02:46:12 -07:00
parent 599a6aeaaf
commit b6ac1018c2
11 changed files with 103 additions and 87 deletions

View file

@ -33,23 +33,26 @@ ClearBgMap:: ; 1cf0 (0:1cf0)
jr nz,.loop
ret
; When the player takes a step, a row or column of 2x2 tile blocks at the edge
; of the screen toward which they moved is exposed and has to be redrawn.
; This function does the redrawing.
RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
ld a,[H_SCREENEDGEREDRAW]
RedrawRowOrColumn:: ; 1d01 (0:1d01)
; This function redraws a BG row of height 2 or a BG column of width 2.
; One of its main uses is redrawing the row or column that will be exposed upon
; scrolling the BG when the player takes a step. Redrawing only the exposed
; row or column is more efficient than redrawing the entire screen.
; However, this function is also called repeatedly to redraw the whole screen
; when necessary. It is also used in trade animation and elevator code.
ld a,[hRedrawRowOrColumnMode]
and a
ret z
ld b,a
xor a
ld [H_SCREENEDGEREDRAW],a
ld [hRedrawRowOrColumnMode],a
dec b
jr nz,.redrawRow
.redrawColumn
ld hl,wScreenEdgeTiles
ld a,[H_SCREENEDGEREDRAWADDR]
ld hl,wRedrawRowOrColumnSrcTiles
ld a,[hRedrawRowOrColumnDest]
ld e,a
ld a,[H_SCREENEDGEREDRAWADDR + 1]
ld a,[hRedrawRowOrColumnDest + 1]
ld d,a
ld c,SCREEN_HEIGHT
.loop1
@ -58,7 +61,7 @@ RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
inc de
ld a,[hli]
ld [de],a
ld a,31
ld a,BG_MAP_WIDTH - 1
add e
ld e,a
jr nc,.noCarry
@ -72,23 +75,24 @@ RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
dec c
jr nz,.loop1
xor a
ld [H_SCREENEDGEREDRAW],a
ld [hRedrawRowOrColumnMode],a
ret
.redrawRow
ld hl,wScreenEdgeTiles
ld a,[H_SCREENEDGEREDRAWADDR]
ld hl,wRedrawRowOrColumnSrcTiles
ld a,[hRedrawRowOrColumnDest]
ld e,a
ld a,[H_SCREENEDGEREDRAWADDR + 1]
ld a,[hRedrawRowOrColumnDest + 1]
ld d,a
push de
call .drawHalf ; draw upper half
call .DrawHalf ; draw upper half
pop de
ld a,32 ; width of VRAM background map
ld a,BG_MAP_WIDTH ; width of VRAM background map
add e
ld e,a
; draw lower half
.drawHalf
ld c,10
; fall through and draw lower half
.DrawHalf
ld c,SCREEN_WIDTH / 2
.loop2
ld a,[hli]
ld [de],a
@ -113,7 +117,7 @@ RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
; background per V-blank. It cycles through which third it draws.
; This transfer is turned off when walking around the map, but is turned
; on when talking to sprites, battling, using menus, etc. This is because
; the above function, RedrawExposedScreenEdge, is used when walking to
; the above function, RedrawRowOrColumn, is used when walking to
; improve efficiency.
AutoBgMapTransfer:: ; 1d57 (0:1d57)
ld a,[H_AUTOBGTRANSFERENABLED]
@ -302,12 +306,11 @@ VBlankCopyDouble::
VBlankCopy::
; Copy [H_VBCOPYSIZE] 2bpp tiles
; Copy [H_VBCOPYSIZE] 2bpp tiles (or 16 * [H_VBCOPYSIZE] tile map entries)
; from H_VBCOPYSRC to H_VBCOPYDEST.
; Source and destination addresses
; are updated, so transfer can
; continue in subsequent calls.
; Source and destination addresses are updated,
; so transfer can continue in subsequent calls.
ld a, [H_VBCOPYSIZE]
and a