diff options
author | dannye <corrnondacqb@yahoo.com> | 2016-01-12 18:45:02 -0600 |
---|---|---|
committer | dannye <corrnondacqb@yahoo.com> | 2016-01-12 18:45:02 -0600 |
commit | 5914540ba780d7936fd6624d6fde2d67a9f7a773 (patch) | |
tree | a1ce27018f39d98f49d89468df426d0291e18560 /home/vcopy.asm | |
parent | ccf4fe54a8e444aaf966fac7b38bc9452c494222 (diff) | |
parent | 8a5a7d8e68538b727e0c166488265f395603366e (diff) |
Merge branch 'master' of https://github.com/pret/pokered into rgbgfxrgbgfx
Diffstat (limited to 'home/vcopy.asm')
-rw-r--r-- | home/vcopy.asm | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/home/vcopy.asm b/home/vcopy.asm index 02caef29..69773cfe 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -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 |