mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-13 03:30:28 +00:00
Simplified section math.
This commit is contained in:
parent
aa1c662d04
commit
dc194d44f7
@ -81,6 +81,11 @@ const playerY = $60
|
||||
const backBuf = $6A
|
||||
const frontBuf = $6B
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Tile engine variables
|
||||
const relX = $50
|
||||
const relY = $51
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Font engine variables
|
||||
const wndleft = $70 // left edge of the window
|
||||
@ -333,6 +338,21 @@ asm renderFrame
|
||||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Deal with crossing into a new map section
|
||||
// Params: none
|
||||
asm checkCrossing
|
||||
txa
|
||||
pha
|
||||
bit setROM
|
||||
jsr $6006
|
||||
pla
|
||||
tax
|
||||
dex ; don't-care return value
|
||||
bit setLcRW+lcBank2
|
||||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Is the player's current position a physical obstruction?
|
||||
// Params: none
|
||||
@ -847,6 +867,29 @@ def strafeLeft()
|
||||
adjustDir(4)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def move2D(ox, oy)
|
||||
*relX = ox + *relX
|
||||
*relY = oy + *relY
|
||||
checkCrossing()
|
||||
end
|
||||
|
||||
def moveNorth()
|
||||
move2D(0, -1)
|
||||
end
|
||||
|
||||
def moveEast()
|
||||
move2D(1, 0)
|
||||
end
|
||||
|
||||
def moveSouth()
|
||||
move2D(0, 1)
|
||||
end
|
||||
|
||||
def moveWest()
|
||||
move2D(-1, 0)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Switch to a new map (2D or 3D)
|
||||
def setMap(is3D, num)
|
||||
@ -998,7 +1041,11 @@ end
|
||||
def initCmds2D()
|
||||
resetCmds()
|
||||
|
||||
//initCmd('W', @moveForward)
|
||||
initCmd('W', @moveNorth)
|
||||
initCmd('D', @moveEast)
|
||||
initCmd('S', @moveSouth)
|
||||
initCmd('X', @moveSouth)
|
||||
initCmd('A', @moveWest)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -80,6 +80,7 @@ TILE_SOURCE = $6D ; Location of tile data
|
||||
; Vectors used to call in from the outside.
|
||||
jmp INIT
|
||||
jmp DRAW
|
||||
jmp CROSS
|
||||
|
||||
; Debug support -- must come after jump vectors, since it's not just macros.
|
||||
!source "../include/debug.i"
|
||||
@ -221,6 +222,27 @@ LOAD_ALL_TILES
|
||||
JSR LOAD_ALL_TILES
|
||||
}
|
||||
|
||||
; >> CHECK CROSSINGS
|
||||
!zone
|
||||
CROSS
|
||||
LDA REL_Y
|
||||
CMP #VIEWPORT_VERT_PAD-1
|
||||
BPL .10
|
||||
JSR CROSS_NORTH
|
||||
.10 LDA REL_Y
|
||||
CMP #VIEWPORT_VERT_PAD+SECTION_HEIGHT
|
||||
BMI .20
|
||||
JSR CROSS_SOUTH
|
||||
.20 LDA REL_X
|
||||
CMP #VIEWPORT_HORZ_PAD-1
|
||||
BPL .30
|
||||
JSR CROSS_WEST
|
||||
.30 LDA REL_X
|
||||
CMP #VIEWPORT_HORZ_PAD+SECTION_WIDTH
|
||||
BMI .40
|
||||
JSR CROSS_EAST
|
||||
.40 RTS
|
||||
|
||||
; >> CROSS NORTH BOUNDARY (Load next section to the north)
|
||||
!zone
|
||||
CROSS_NORTH
|
||||
|
Loading…
x
Reference in New Issue
Block a user