mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-12-26 04:32:05 +00:00
Can now navigate using the plasma main loop.
This commit is contained in:
parent
ca45c71605
commit
6ca538f33f
@ -229,6 +229,23 @@ asm renderFrame
|
||||
rts
|
||||
end
|
||||
|
||||
asm isBlocked
|
||||
txa
|
||||
pha
|
||||
bit setROM
|
||||
jsr $6006
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
dex
|
||||
tya
|
||||
sta evalStkL,x
|
||||
lda #0
|
||||
sta evalStkH,x
|
||||
bit setLcRW+lcBank2
|
||||
rts
|
||||
end
|
||||
|
||||
asm goMon
|
||||
bit setROM
|
||||
jmp $FF69
|
||||
@ -246,20 +263,42 @@ end
|
||||
def moveForward()
|
||||
*playerX = *playerX + walkDirs[^playerDir * 2]
|
||||
*playerY = *playerY + walkDirs[^playerDir * 2 + 1]
|
||||
if isBlocked()
|
||||
moveBackward()
|
||||
fin
|
||||
end
|
||||
|
||||
def adjustDir(n)
|
||||
^playerDir = (^playerDir + n) & $F
|
||||
end
|
||||
|
||||
def moveBackward()
|
||||
^playerDir = (^playerDir + 8) & $F
|
||||
adjustDir(8)
|
||||
moveForward()
|
||||
^playerDir = (^playerDir + 8) & $F
|
||||
adjustDir(8)
|
||||
if isBlocked()
|
||||
moveForward()
|
||||
fin
|
||||
end
|
||||
|
||||
def rotateLeft()
|
||||
^playerDir = (^playerDir - 1) & $F
|
||||
adjustDir(-1)
|
||||
end
|
||||
|
||||
def rotateRight()
|
||||
^playerDir = (^playerDir + 1) & $F
|
||||
adjustDir(1)
|
||||
end
|
||||
|
||||
def strafeRight()
|
||||
adjustDir(4)
|
||||
moveForward()
|
||||
adjustDir(-4)
|
||||
end
|
||||
|
||||
def strafeLeft()
|
||||
adjustDir(-4)
|
||||
moveForward()
|
||||
adjustDir(4)
|
||||
end
|
||||
|
||||
def kbdLoop()
|
||||
@ -334,11 +373,17 @@ initCmd('W', @moveForward)
|
||||
initCmd('A', @rotateLeft)
|
||||
initCmd('D', @rotateRight)
|
||||
initCmd('S', @moveBackward)
|
||||
initCmd('X', @moveBackward)
|
||||
initCmd('Z', @strafeLeft)
|
||||
initCmd('C', @strafeRight)
|
||||
|
||||
initCmd('I', @moveForward)
|
||||
initCmd('J', @rotateLeft)
|
||||
initCmd('L', @rotateRight)
|
||||
initCmd('K', @moveBackward)
|
||||
initCmd(',', @moveBackward)
|
||||
initCmd('M', @strafeLeft)
|
||||
initCmd('.', @strafeRight)
|
||||
|
||||
; Draw the first frame
|
||||
renderFrame()
|
||||
|
@ -11,6 +11,7 @@ start:
|
||||
; code is at the very end. We jump to it now.
|
||||
jmp initMap
|
||||
jmp renderFrame
|
||||
jmp getMapCell
|
||||
|
||||
; Conditional assembly flags
|
||||
DOUBLE_BUFFER = 1 ; whether to double-buffer
|
||||
@ -3225,26 +3226,6 @@ firstLink: !fill NUM_COLS
|
||||
mapSpriteL !fill MAX_SPRITES
|
||||
mapSpriteH !fill MAX_SPRITES
|
||||
|
||||
; Movement amounts when walking at each angle
|
||||
; Each entry consists of an X bump and a Y bump, in 8.8 fixed point
|
||||
walkDirs:
|
||||
!word $0040, $0000
|
||||
!word $003B, $0018
|
||||
!word $002D, $002D
|
||||
!word $0018, $003B
|
||||
!word $0000, $0040
|
||||
!word $FFE8, $003B
|
||||
!word $FFD3, $002D
|
||||
!word $FFC5, $0018
|
||||
!word $FFC0, $0000
|
||||
!word $FFC5, $FFE8
|
||||
!word $FFD3, $FFD3
|
||||
!word $FFE8, $FFC5
|
||||
!word $0000, $FFC0
|
||||
!word $0018, $FFC5
|
||||
!word $002D, $FFD3
|
||||
!word $003B, $FFE8
|
||||
|
||||
; Sin of each angle, in log8.8 format plus the high bit being the sign (0x8000 = negative)
|
||||
sinTbl !word $0000, $8699, $877F, $87E1, $8800, $87E1, $877F, $8699
|
||||
!word $8195, $0699, $077F, $07E1, $0800, $07E1, $077F, $0699
|
||||
|
Loading…
Reference in New Issue
Block a user