mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-16 18:30:50 +12:00
add border constant and clear up misnomer
This commit is contained in:
parent
599a6aeaaf
commit
b6ac1018c2
|
@ -1,3 +1,7 @@
|
||||||
|
; width of east/west connections
|
||||||
|
; height of north/south connections
|
||||||
|
MAP_BORDER EQU 3
|
||||||
|
|
||||||
; connection directions
|
; connection directions
|
||||||
EAST EQU 1
|
EAST EQU 1
|
||||||
WEST EQU 2
|
WEST EQU 2
|
||||||
|
|
|
@ -25,13 +25,14 @@ D_LEFT EQU %00100000
|
||||||
D_UP EQU %01000000
|
D_UP EQU %01000000
|
||||||
D_DOWN EQU %10000000
|
D_DOWN EQU %10000000
|
||||||
|
|
||||||
PIXELS_PER_TILE EQU 8
|
|
||||||
|
|
||||||
SCREEN_WIDTH EQU 20
|
SCREEN_WIDTH EQU 20
|
||||||
SCREEN_HEIGHT EQU 18
|
SCREEN_HEIGHT EQU 18
|
||||||
|
|
||||||
SCREEN_WIDTH_PIXELS EQU SCREEN_WIDTH * PIXELS_PER_TILE
|
SCREEN_WIDTH_PIXELS EQU SCREEN_WIDTH * 8
|
||||||
SCREEN_HEIGHT_PIXELS EQU SCREEN_HEIGHT * PIXELS_PER_TILE
|
SCREEN_HEIGHT_PIXELS EQU SCREEN_HEIGHT * 8
|
||||||
|
|
||||||
|
BG_MAP_WIDTH EQU 32
|
||||||
|
BG_MAP_HEIGHT EQU 32
|
||||||
|
|
||||||
NPC_MOVEMENT_DOWN EQU $00
|
NPC_MOVEMENT_DOWN EQU $00
|
||||||
NPC_MOVEMENT_UP EQU $40
|
NPC_MOVEMENT_UP EQU $40
|
||||||
|
|
|
@ -552,14 +552,14 @@ Trade_CopyCableTilesOffScreen: ; 414ae (10:54ae)
|
||||||
; continues when the screen is scrolled.
|
; continues when the screen is scrolled.
|
||||||
push hl
|
push hl
|
||||||
coord hl, 0, 4
|
coord hl, 0, 4
|
||||||
call CopyToScreenEdgeTiles
|
call CopyToRedrawRowOrColumnSrcTiles
|
||||||
pop hl
|
pop hl
|
||||||
ld a, h
|
ld a, h
|
||||||
ld [H_SCREENEDGEREDRAWADDR + 1], a
|
ld [hRedrawRowOrColumnDest + 1], a
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [H_SCREENEDGEREDRAWADDR], a
|
ld [hRedrawRowOrColumnDest], a
|
||||||
ld a, REDRAWROW
|
ld a, REDRAW_ROW
|
||||||
ld [H_SCREENEDGEREDRAW], a
|
ld [hRedrawRowOrColumnMode], a
|
||||||
ld c, 10
|
ld c, 10
|
||||||
jp DelayFrames
|
jp DelayFrames
|
||||||
|
|
||||||
|
|
|
@ -555,10 +555,10 @@ CheckMapConnections:: ; 07ba (0:07ba)
|
||||||
jr z,.savePointer1
|
jr z,.savePointer1
|
||||||
.pointerAdjustmentLoop1
|
.pointerAdjustmentLoop1
|
||||||
ld a,[wWestConnectedMapWidth] ; width of connected map
|
ld a,[wWestConnectedMapWidth] ; width of connected map
|
||||||
add a,$06
|
add a,MAP_BORDER * 2
|
||||||
ld e,a
|
ld e,a
|
||||||
ld d,$00
|
ld d,0
|
||||||
ld b,$00
|
ld b,0
|
||||||
add hl,de
|
add hl,de
|
||||||
dec c
|
dec c
|
||||||
jr nz,.pointerAdjustmentLoop1
|
jr nz,.pointerAdjustmentLoop1
|
||||||
|
@ -591,10 +591,10 @@ CheckMapConnections:: ; 07ba (0:07ba)
|
||||||
jr z,.savePointer2
|
jr z,.savePointer2
|
||||||
.pointerAdjustmentLoop2
|
.pointerAdjustmentLoop2
|
||||||
ld a,[wEastConnectedMapWidth]
|
ld a,[wEastConnectedMapWidth]
|
||||||
add a,$06
|
add a,MAP_BORDER * 2
|
||||||
ld e,a
|
ld e,a
|
||||||
ld d,$00
|
ld d,0
|
||||||
ld b,$00
|
ld b,0
|
||||||
add hl,de
|
add hl,de
|
||||||
dec c
|
dec c
|
||||||
jr nz,.pointerAdjustmentLoop2
|
jr nz,.pointerAdjustmentLoop2
|
||||||
|
@ -883,15 +883,15 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
|
||||||
ld hl,wOverworldMap
|
ld hl,wOverworldMap
|
||||||
ld a,[W_CURMAPWIDTH]
|
ld a,[W_CURMAPWIDTH]
|
||||||
ld [hMapWidth],a
|
ld [hMapWidth],a
|
||||||
add a,$06 ; border (east and west)
|
add a,MAP_BORDER * 2 ; east and west
|
||||||
ld [hMapStride],a ; map width + border
|
ld [hMapStride],a ; map width + border
|
||||||
ld b,$00
|
ld b,0
|
||||||
ld c,a
|
ld c,a
|
||||||
; make space for north border (next 3 lines)
|
; make space for north border (next 3 lines)
|
||||||
add hl,bc
|
add hl,bc
|
||||||
add hl,bc
|
add hl,bc
|
||||||
add hl,bc
|
add hl,bc
|
||||||
ld c,$03
|
ld c,MAP_BORDER
|
||||||
add hl,bc ; this puts us past the (west) border
|
add hl,bc ; this puts us past the (west) border
|
||||||
ld a,[W_MAPDATAPTR] ; tile map pointer
|
ld a,[W_MAPDATAPTR] ; tile map pointer
|
||||||
ld e,a
|
ld e,a
|
||||||
|
@ -995,7 +995,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)
|
LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)
|
||||||
ld c,$03
|
ld c,MAP_BORDER
|
||||||
.loop
|
.loop
|
||||||
push de
|
push de
|
||||||
push hl
|
push hl
|
||||||
|
@ -1016,7 +1016,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)
|
||||||
inc h
|
inc h
|
||||||
.noCarry1
|
.noCarry1
|
||||||
ld a,[W_CURMAPWIDTH]
|
ld a,[W_CURMAPWIDTH]
|
||||||
add a,$06
|
add a,MAP_BORDER * 2
|
||||||
add e
|
add e
|
||||||
ld e,a
|
ld e,a
|
||||||
jr nc,.noCarry2
|
jr nc,.noCarry2
|
||||||
|
@ -1029,7 +1029,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)
|
||||||
LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)
|
LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
ld c,$03
|
ld c,MAP_BORDER
|
||||||
.innerLoop
|
.innerLoop
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
ld [de],a
|
ld [de],a
|
||||||
|
@ -1045,7 +1045,7 @@ LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)
|
||||||
inc h
|
inc h
|
||||||
.noCarry1
|
.noCarry1
|
||||||
ld a,[W_CURMAPWIDTH]
|
ld a,[W_CURMAPWIDTH]
|
||||||
add a,$06
|
add a,MAP_BORDER * 2
|
||||||
add e
|
add e
|
||||||
ld e,a
|
ld e,a
|
||||||
jr nc,.noCarry2
|
jr nc,.noCarry2
|
||||||
|
@ -1387,7 +1387,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa)
|
||||||
; update tile block map pointer to next row's address
|
; update tile block map pointer to next row's address
|
||||||
pop de
|
pop de
|
||||||
ld a,[W_CURMAPWIDTH]
|
ld a,[W_CURMAPWIDTH]
|
||||||
add a,$06
|
add a,MAP_BORDER * 2
|
||||||
add e
|
add e
|
||||||
ld e,a
|
ld e,a
|
||||||
jr nc,.noCarry
|
jr nc,.noCarry
|
||||||
|
@ -1418,7 +1418,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa)
|
||||||
ld bc,$0002
|
ld bc,$0002
|
||||||
add hl,bc
|
add hl,bc
|
||||||
.copyToVisibleAreaBuffer
|
.copyToVisibleAreaBuffer
|
||||||
coord de, 0, 0 ; base address for the tiles that are directly transfered to VRAM during V-blank
|
coord de, 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank
|
||||||
ld b, SCREEN_HEIGHT
|
ld b, SCREEN_HEIGHT
|
||||||
.rowLoop2
|
.rowLoop2
|
||||||
ld c, SCREEN_WIDTH
|
ld c, SCREEN_WIDTH
|
||||||
|
@ -1662,7 +1662,7 @@ MoveTileBlockMapPointerWest:: ; 0e6f (0:0e6f)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79)
|
MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79)
|
||||||
add a,$06
|
add a,MAP_BORDER * 2
|
||||||
ld b,a
|
ld b,a
|
||||||
ld a,[de]
|
ld a,[de]
|
||||||
add b
|
add b
|
||||||
|
@ -1675,7 +1675,7 @@ MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85)
|
MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85)
|
||||||
add a,$06
|
add a,MAP_BORDER * 2
|
||||||
ld b,a
|
ld b,a
|
||||||
ld a,[de]
|
ld a,[de]
|
||||||
sub b
|
sub b
|
||||||
|
@ -1692,17 +1692,17 @@ MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85)
|
||||||
|
|
||||||
ScheduleNorthRowRedraw:: ; 0e91 (0:0e91)
|
ScheduleNorthRowRedraw:: ; 0e91 (0:0e91)
|
||||||
coord hl, 0, 0
|
coord hl, 0, 0
|
||||||
call CopyToScreenEdgeTiles
|
call CopyToRedrawRowOrColumnSrcTiles
|
||||||
ld a,[wMapViewVRAMPointer]
|
ld a,[wMapViewVRAMPointer]
|
||||||
ld [H_SCREENEDGEREDRAWADDR],a
|
ld [hRedrawRowOrColumnDest],a
|
||||||
ld a,[wMapViewVRAMPointer + 1]
|
ld a,[wMapViewVRAMPointer + 1]
|
||||||
ld [H_SCREENEDGEREDRAWADDR + 1],a
|
ld [hRedrawRowOrColumnDest + 1],a
|
||||||
ld a,REDRAWROW
|
ld a,REDRAW_ROW
|
||||||
ld [H_SCREENEDGEREDRAW],a
|
ld [hRedrawRowOrColumnMode],a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
CopyToScreenEdgeTiles:: ; 0ea6 (0:0ea6)
|
CopyToRedrawRowOrColumnSrcTiles:: ; 0ea6 (0:0ea6)
|
||||||
ld de,wScreenEdgeTiles
|
ld de,wRedrawRowOrColumnSrcTiles
|
||||||
ld c,2 * SCREEN_WIDTH
|
ld c,2 * SCREEN_WIDTH
|
||||||
.loop
|
.loop
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
|
@ -1714,7 +1714,7 @@ CopyToScreenEdgeTiles:: ; 0ea6 (0:0ea6)
|
||||||
|
|
||||||
ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2)
|
ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2)
|
||||||
coord hl, 0, 16
|
coord hl, 0, 16
|
||||||
call CopyToScreenEdgeTiles
|
call CopyToRedrawRowOrColumnSrcTiles
|
||||||
ld a,[wMapViewVRAMPointer]
|
ld a,[wMapViewVRAMPointer]
|
||||||
ld l,a
|
ld l,a
|
||||||
ld a,[wMapViewVRAMPointer + 1]
|
ld a,[wMapViewVRAMPointer + 1]
|
||||||
|
@ -1724,11 +1724,11 @@ ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2)
|
||||||
ld a,h
|
ld a,h
|
||||||
and a,$03
|
and a,$03
|
||||||
or a,$98
|
or a,$98
|
||||||
ld [H_SCREENEDGEREDRAWADDR + 1],a
|
ld [hRedrawRowOrColumnDest + 1],a
|
||||||
ld a,l
|
ld a,l
|
||||||
ld [H_SCREENEDGEREDRAWADDR],a
|
ld [hRedrawRowOrColumnDest],a
|
||||||
ld a,REDRAWROW
|
ld a,REDRAW_ROW
|
||||||
ld [H_SCREENEDGEREDRAW],a
|
ld [hRedrawRowOrColumnMode],a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3)
|
ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3)
|
||||||
|
@ -1742,15 +1742,15 @@ ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3)
|
||||||
add a,18
|
add a,18
|
||||||
and a,$1f
|
and a,$1f
|
||||||
or b
|
or b
|
||||||
ld [H_SCREENEDGEREDRAWADDR],a
|
ld [hRedrawRowOrColumnDest],a
|
||||||
ld a,[wMapViewVRAMPointer + 1]
|
ld a,[wMapViewVRAMPointer + 1]
|
||||||
ld [H_SCREENEDGEREDRAWADDR + 1],a
|
ld [hRedrawRowOrColumnDest + 1],a
|
||||||
ld a,REDRAWCOL
|
ld a,REDRAW_COL
|
||||||
ld [H_SCREENEDGEREDRAW],a
|
ld [hRedrawRowOrColumnMode],a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2)
|
ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2)
|
||||||
ld de,wScreenEdgeTiles
|
ld de,wRedrawRowOrColumnSrcTiles
|
||||||
ld c,SCREEN_HEIGHT
|
ld c,SCREEN_HEIGHT
|
||||||
.loop
|
.loop
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
|
@ -1773,11 +1773,11 @@ ScheduleWestColumnRedraw:: ; 0f08 (0:0f08)
|
||||||
coord hl, 0, 0
|
coord hl, 0, 0
|
||||||
call ScheduleColumnRedrawHelper
|
call ScheduleColumnRedrawHelper
|
||||||
ld a,[wMapViewVRAMPointer]
|
ld a,[wMapViewVRAMPointer]
|
||||||
ld [H_SCREENEDGEREDRAWADDR],a
|
ld [hRedrawRowOrColumnDest],a
|
||||||
ld a,[wMapViewVRAMPointer + 1]
|
ld a,[wMapViewVRAMPointer + 1]
|
||||||
ld [H_SCREENEDGEREDRAWADDR + 1],a
|
ld [hRedrawRowOrColumnDest + 1],a
|
||||||
ld a,REDRAWCOL
|
ld a,REDRAW_COL
|
||||||
ld [H_SCREENEDGEREDRAW],a
|
ld [hRedrawRowOrColumnMode],a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; function to write the tiles that make up a tile block to memory
|
; function to write the tiles that make up a tile block to memory
|
||||||
|
|
|
@ -22,7 +22,7 @@ VBlank::
|
||||||
|
|
||||||
call AutoBgMapTransfer
|
call AutoBgMapTransfer
|
||||||
call VBlankCopyBgMap
|
call VBlankCopyBgMap
|
||||||
call RedrawExposedScreenEdge
|
call RedrawRowOrColumn
|
||||||
call VBlankCopy
|
call VBlankCopy
|
||||||
call VBlankCopyDouble
|
call VBlankCopyDouble
|
||||||
call UpdateMovingBgTiles
|
call UpdateMovingBgTiles
|
||||||
|
|
|
@ -33,23 +33,26 @@ ClearBgMap:: ; 1cf0 (0:1cf0)
|
||||||
jr nz,.loop
|
jr nz,.loop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; When the player takes a step, a row or column of 2x2 tile blocks at the edge
|
RedrawRowOrColumn:: ; 1d01 (0:1d01)
|
||||||
; of the screen toward which they moved is exposed and has to be redrawn.
|
; This function redraws a BG row of height 2 or a BG column of width 2.
|
||||||
; This function does the redrawing.
|
; One of its main uses is redrawing the row or column that will be exposed upon
|
||||||
RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
|
; scrolling the BG when the player takes a step. Redrawing only the exposed
|
||||||
ld a,[H_SCREENEDGEREDRAW]
|
; 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
|
and a
|
||||||
ret z
|
ret z
|
||||||
ld b,a
|
ld b,a
|
||||||
xor a
|
xor a
|
||||||
ld [H_SCREENEDGEREDRAW],a
|
ld [hRedrawRowOrColumnMode],a
|
||||||
dec b
|
dec b
|
||||||
jr nz,.redrawRow
|
jr nz,.redrawRow
|
||||||
.redrawColumn
|
.redrawColumn
|
||||||
ld hl,wScreenEdgeTiles
|
ld hl,wRedrawRowOrColumnSrcTiles
|
||||||
ld a,[H_SCREENEDGEREDRAWADDR]
|
ld a,[hRedrawRowOrColumnDest]
|
||||||
ld e,a
|
ld e,a
|
||||||
ld a,[H_SCREENEDGEREDRAWADDR + 1]
|
ld a,[hRedrawRowOrColumnDest + 1]
|
||||||
ld d,a
|
ld d,a
|
||||||
ld c,SCREEN_HEIGHT
|
ld c,SCREEN_HEIGHT
|
||||||
.loop1
|
.loop1
|
||||||
|
@ -58,7 +61,7 @@ RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
|
||||||
inc de
|
inc de
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
ld [de],a
|
ld [de],a
|
||||||
ld a,31
|
ld a,BG_MAP_WIDTH - 1
|
||||||
add e
|
add e
|
||||||
ld e,a
|
ld e,a
|
||||||
jr nc,.noCarry
|
jr nc,.noCarry
|
||||||
|
@ -72,23 +75,24 @@ RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
|
||||||
dec c
|
dec c
|
||||||
jr nz,.loop1
|
jr nz,.loop1
|
||||||
xor a
|
xor a
|
||||||
ld [H_SCREENEDGEREDRAW],a
|
ld [hRedrawRowOrColumnMode],a
|
||||||
ret
|
ret
|
||||||
.redrawRow
|
.redrawRow
|
||||||
ld hl,wScreenEdgeTiles
|
ld hl,wRedrawRowOrColumnSrcTiles
|
||||||
ld a,[H_SCREENEDGEREDRAWADDR]
|
ld a,[hRedrawRowOrColumnDest]
|
||||||
ld e,a
|
ld e,a
|
||||||
ld a,[H_SCREENEDGEREDRAWADDR + 1]
|
ld a,[hRedrawRowOrColumnDest + 1]
|
||||||
ld d,a
|
ld d,a
|
||||||
push de
|
push de
|
||||||
call .drawHalf ; draw upper half
|
call .DrawHalf ; draw upper half
|
||||||
pop de
|
pop de
|
||||||
ld a,32 ; width of VRAM background map
|
ld a,BG_MAP_WIDTH ; width of VRAM background map
|
||||||
add e
|
add e
|
||||||
ld e,a
|
ld e,a
|
||||||
; draw lower half
|
; fall through and draw lower half
|
||||||
.drawHalf
|
|
||||||
ld c,10
|
.DrawHalf
|
||||||
|
ld c,SCREEN_WIDTH / 2
|
||||||
.loop2
|
.loop2
|
||||||
ld a,[hli]
|
ld a,[hli]
|
||||||
ld [de],a
|
ld [de],a
|
||||||
|
@ -113,7 +117,7 @@ RedrawExposedScreenEdge:: ; 1d01 (0:1d01)
|
||||||
; background per V-blank. It cycles through which third it draws.
|
; background per V-blank. It cycles through which third it draws.
|
||||||
; This transfer is turned off when walking around the map, but is turned
|
; 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
|
; 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.
|
; improve efficiency.
|
||||||
AutoBgMapTransfer:: ; 1d57 (0:1d57)
|
AutoBgMapTransfer:: ; 1d57 (0:1d57)
|
||||||
ld a,[H_AUTOBGTRANSFERENABLED]
|
ld a,[H_AUTOBGTRANSFERENABLED]
|
||||||
|
@ -302,12 +306,11 @@ VBlankCopyDouble::
|
||||||
|
|
||||||
|
|
||||||
VBlankCopy::
|
VBlankCopy::
|
||||||
; Copy [H_VBCOPYSIZE] 2bpp tiles
|
; Copy [H_VBCOPYSIZE] 2bpp tiles (or 16 * [H_VBCOPYSIZE] tile map entries)
|
||||||
; from H_VBCOPYSRC to H_VBCOPYDEST.
|
; from H_VBCOPYSRC to H_VBCOPYDEST.
|
||||||
|
|
||||||
; Source and destination addresses
|
; Source and destination addresses are updated,
|
||||||
; are updated, so transfer can
|
; so transfer can continue in subsequent calls.
|
||||||
; continue in subsequent calls.
|
|
||||||
|
|
||||||
ld a, [H_VBCOPYSIZE]
|
ld a, [H_VBCOPYSIZE]
|
||||||
and a
|
and a
|
||||||
|
|
8
hram.asm
8
hram.asm
|
@ -242,12 +242,12 @@ H_VBCOPYDOUBLEDEST EQU $FFCE
|
||||||
; 00 = no redraw
|
; 00 = no redraw
|
||||||
; 01 = redraw column
|
; 01 = redraw column
|
||||||
; 02 = redraw row
|
; 02 = redraw row
|
||||||
H_SCREENEDGEREDRAW EQU $FFD0
|
hRedrawRowOrColumnMode EQU $FFD0
|
||||||
|
|
||||||
REDRAWCOL EQU 1
|
REDRAW_COL EQU 1
|
||||||
REDRAWROW EQU 2
|
REDRAW_ROW EQU 2
|
||||||
|
|
||||||
H_SCREENEDGEREDRAWADDR EQU $FFD1
|
hRedrawRowOrColumnDest EQU $FFD1
|
||||||
|
|
||||||
hRandomAdd EQU $FFD3
|
hRandomAdd EQU $FFD3
|
||||||
hRandomSub EQU $FFD4
|
hRandomSub EQU $FFD4
|
||||||
|
|
|
@ -104,6 +104,14 @@ dwCoord: MACRO
|
||||||
dw wTileMap + 20 * \2 + \1
|
dw wTileMap + 20 * \2 + \1
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
;\1 = r
|
||||||
|
;\2 = X
|
||||||
|
;\3 = Y
|
||||||
|
;\4 = map width
|
||||||
|
overworldMapCoord: MACRO
|
||||||
|
ld \1, wOverworldMap + ((\2) + 3) + (((\3) + 3) * ((\4) + (3 * 2)))
|
||||||
|
ENDM
|
||||||
|
|
||||||
;\1 = Map Width
|
;\1 = Map Width
|
||||||
;\2 = Rows above (Y-blocks)
|
;\2 = Rows above (Y-blocks)
|
||||||
;\3 = X movement (X-blocks)
|
;\3 = X movement (X-blocks)
|
||||||
|
|
10
main.asm
10
main.asm
|
@ -3184,7 +3184,7 @@ RedrawMapView: ; eedc (3:6edc)
|
||||||
add hl, de
|
add hl, de
|
||||||
dec a
|
dec a
|
||||||
jr nz, .calcWRAMAddrLoop
|
jr nz, .calcWRAMAddrLoop
|
||||||
call CopyToScreenEdgeTiles
|
call CopyToRedrawRowOrColumnSrcTiles
|
||||||
pop hl
|
pop hl
|
||||||
ld de, $20
|
ld de, $20
|
||||||
ld a, [$ffbe]
|
ld a, [$ffbe]
|
||||||
|
@ -3196,11 +3196,11 @@ RedrawMapView: ; eedc (3:6edc)
|
||||||
or $98
|
or $98
|
||||||
dec c
|
dec c
|
||||||
jr nz, .calcVRAMAddrLoop
|
jr nz, .calcVRAMAddrLoop
|
||||||
ld [H_SCREENEDGEREDRAWADDR + 1], a
|
ld [hRedrawRowOrColumnDest + 1], a
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [H_SCREENEDGEREDRAWADDR], a
|
ld [hRedrawRowOrColumnDest], a
|
||||||
ld a, REDRAWROW
|
ld a, REDRAW_ROW
|
||||||
ld [H_SCREENEDGEREDRAW], a
|
ld [hRedrawRowOrColumnMode], a
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
ld hl, $ffbe
|
ld hl, $ffbe
|
||||||
inc [hl]
|
inc [hl]
|
||||||
|
|
|
@ -181,12 +181,12 @@ VermilionDock_1dc7c: ; 1dc7c (7:5c7c)
|
||||||
VermilionDock_EraseSSAnne: ; 1dc94 (7:5c94)
|
VermilionDock_EraseSSAnne: ; 1dc94 (7:5c94)
|
||||||
; Fill the area the S.S. Anne occupies in BG map 0 with water tiles.
|
; Fill the area the S.S. Anne occupies in BG map 0 with water tiles.
|
||||||
ld hl, wVermilionDockTileMapBuffer
|
ld hl, wVermilionDockTileMapBuffer
|
||||||
ld bc, (5 * 32) + SCREEN_WIDTH
|
ld bc, (5 * BG_MAP_WIDTH) + SCREEN_WIDTH
|
||||||
ld a, $14 ; water tile
|
ld a, $14 ; water tile
|
||||||
call FillMemory
|
call FillMemory
|
||||||
ld hl, vBGMap0 + 10 * 32
|
ld hl, vBGMap0 + 10 * BG_MAP_WIDTH
|
||||||
ld de, wVermilionDockTileMapBuffer
|
ld de, wVermilionDockTileMapBuffer
|
||||||
ld bc, (6 * 32) / 16
|
ld bc, (6 * BG_MAP_WIDTH) / 16
|
||||||
call CopyVideoData
|
call CopyVideoData
|
||||||
|
|
||||||
; Replace the blocks of the lower half of the ship with water blocks. This
|
; Replace the blocks of the lower half of the ship with water blocks. This
|
||||||
|
@ -194,7 +194,7 @@ VermilionDock_EraseSSAnne: ; 1dc94 (7:5c94)
|
||||||
; the blocks is unnecessary because the blocks the ship occupies are south of
|
; the blocks is unnecessary because the blocks the ship occupies are south of
|
||||||
; the player and won't be redrawn when the player automatically walks north and
|
; the player and won't be redrawn when the player automatically walks north and
|
||||||
; exits the map. This code could be removed without affecting anything.
|
; exits the map. This code could be removed without affecting anything.
|
||||||
ld hl, wOverworldMap + (5 + 3) + (2 + 3) * (VERMILION_DOCK_WIDTH + 6) ; (5, 2)
|
overworldMapCoord hl, 5, 2, VERMILION_DOCK_WIDTH
|
||||||
ld a, $d ; water block
|
ld a, $d ; water block
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
|
|
4
wram.asm
4
wram.asm
|
@ -287,8 +287,8 @@ wTempPic::
|
||||||
wOverworldMap:: ; c6e8
|
wOverworldMap:: ; c6e8
|
||||||
ds 1300
|
ds 1300
|
||||||
|
|
||||||
wScreenEdgeTiles:: ; cbfc
|
wRedrawRowOrColumnSrcTiles:: ; cbfc
|
||||||
; the tiles of the row or column to be redrawn by RedrawExposedScreenEdge
|
; the tiles of the row or column to be redrawn by RedrawRowOrColumn
|
||||||
ds 20 * 2
|
ds 20 * 2
|
||||||
|
|
||||||
; coordinates of the position of the cursor for the top menu item (id 0)
|
; coordinates of the position of the cursor for the top menu item (id 0)
|
||||||
|
|
Loading…
Reference in a new issue