mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-25 09:29:30 +00:00
Getting 3D back into shape.
This commit is contained in:
parent
64870ea6a8
commit
375cac1459
|
@ -148,6 +148,9 @@ end
|
|||
asm setColor // params: slot (0=sky/1=ground), color (0-15)
|
||||
jmp $6015
|
||||
end
|
||||
asm render // no params
|
||||
jmp $6018
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Simply retrieve the X register. Used to double-check that we're not leaking PLASMA eval
|
||||
|
@ -697,6 +700,7 @@ end
|
|||
def moveForward()
|
||||
byte val
|
||||
val = advance()
|
||||
printf1("advance returned %d\n", val)
|
||||
if val > 0 and textDrawn
|
||||
clearWindow()
|
||||
textDrawn = FALSE
|
||||
|
@ -724,12 +728,16 @@ end
|
|||
// Turn left (3D mode)
|
||||
def rotateLeft()
|
||||
adjustDir(-1)
|
||||
render()
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Rotate to the right (3D mode)
|
||||
def rotateRight()
|
||||
adjustDir(1)
|
||||
puts("About to call render.\n")
|
||||
render()
|
||||
puts("Back from render.\n")
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -788,17 +796,17 @@ def teleport()
|
|||
if ^$25 < 23; ^$25 = 23; fin
|
||||
getPos(@x, @y)
|
||||
printf4("\nCurrent: 3D=%d Map=%d X=%d Y=%d ", mapIs3D, mapNum, x, y)
|
||||
printf1(" Dir=%d\n", getDir())
|
||||
printf1("Dir=%d\n", getDir())
|
||||
|
||||
puts("New 3D: ")
|
||||
puts("3D : ")
|
||||
mapIs3D = parseDec(readStr())
|
||||
puts("New Map: ")
|
||||
puts("Map: ")
|
||||
mapNum = parseDec(readStr())
|
||||
puts("New X: ")
|
||||
puts("X : ")
|
||||
x = parseDec(readStr())
|
||||
puts("New Y: ")
|
||||
puts("Y : ")
|
||||
y = parseDec(readStr())
|
||||
puts("New Dir: ")
|
||||
puts("Dir: ")
|
||||
dir = parseDec(readStr())
|
||||
|
||||
^$c052
|
||||
|
@ -809,6 +817,7 @@ end
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def oldTeleport(x, y, dir)
|
||||
printf3("Old teleport: x=%d y=%d dir=%d\n", x, y, dir)
|
||||
puts("Doing nothing for now.\n")
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -19,6 +19,7 @@ start:
|
|||
jmp pl_setDir ; params: dir (0-15); return: nothing
|
||||
jmp pl_advance ; params: none; return: 0 if same, 1 if new map tile, 2 if new and scripted
|
||||
jmp pl_setColor ; params: slot (0=sky/1=ground), color (0-15); return: nothing
|
||||
jmp pl_render ; params: none
|
||||
|
||||
; Conditional assembly flags
|
||||
DOUBLE_BUFFER = 1 ; whether to double-buffer
|
||||
|
@ -1689,7 +1690,7 @@ pl_advance: !zone
|
|||
lda playerX+1
|
||||
pha
|
||||
adc walkDirs+1,x
|
||||
sta playerX
|
||||
sta playerX+1
|
||||
|
||||
lda playerY
|
||||
pha
|
||||
|
@ -1700,6 +1701,7 @@ pl_advance: !zone
|
|||
pha
|
||||
clc
|
||||
adc walkDirs+3,x
|
||||
sta playerY+1
|
||||
|
||||
; Check if the new position is blocked
|
||||
jsr calcMapOrigin
|
||||
|
@ -1715,6 +1717,7 @@ pl_advance: !zone
|
|||
and #2 ; tile flag 2 is for obstructions
|
||||
beq .ok
|
||||
; Blocked! Restore old position.
|
||||
+prStr : !text "Blocked.", 0
|
||||
pla
|
||||
sta playerY+1
|
||||
pla
|
||||
|
@ -1742,10 +1745,10 @@ pl_advance: !zone
|
|||
; It is a new position. Is script hint set?
|
||||
ldy playerX+1
|
||||
lda (pMap),y
|
||||
ldy #1
|
||||
ldy #1 ; ret val 1 = new blk but no script
|
||||
and #$20 ; map flag $20 is the script hint
|
||||
beq .done ; if not scripted, return one
|
||||
iny ; else return 2
|
||||
iny ; else return 2 = new blk and a script
|
||||
.done pla
|
||||
tax ; restore PLASMA eval stk pos
|
||||
dex ; make room for return value
|
||||
|
@ -1756,6 +1759,22 @@ pl_advance: !zone
|
|||
bit setLcRW+lcBank2 ; switch PLASMA runtime back in
|
||||
rts ; and return to PLASMA
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; Render at the current position and direction.
|
||||
; Params: none
|
||||
; Return: none
|
||||
pl_render: !zone
|
||||
txa
|
||||
pha ; save PLASMA eval stk pos
|
||||
bit setROM ; switch out PLASMA while we work
|
||||
jsr renderFrame
|
||||
pla
|
||||
tax ; restore PLASMA eval stk pos
|
||||
jsr prbyte
|
||||
jsr crout
|
||||
bit setLcRW+lcBank2 ; switch PLASMA runtime back in
|
||||
rts ; and return to PLASMA
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; Cast all the rays from the current player coord
|
||||
castAllRays: !zone
|
||||
|
@ -1946,6 +1965,7 @@ pl_setPos: !zone {
|
|||
lda #$80
|
||||
sta playerY
|
||||
sta playerX
|
||||
inx ; 2 params - 1 ret = +1
|
||||
rts
|
||||
}
|
||||
|
||||
|
@ -1955,6 +1975,7 @@ pl_setPos: !zone {
|
|||
; Returns: Nothing
|
||||
pl_getDir: !zone {
|
||||
lda playerDir
|
||||
dex
|
||||
sta evalStkL,x
|
||||
lda #0
|
||||
sta evalStkH,x
|
||||
|
@ -1969,6 +1990,7 @@ pl_setDir: !zone {
|
|||
lda evalStkL,x
|
||||
and #15
|
||||
sta playerDir
|
||||
dex ; 0 param - 1 ret = -1
|
||||
rts
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ next_zp = $AA
|
|||
JMP pl_setDir ; params: dir (0-15); return: nothing
|
||||
JMP pl_advance ; params: none; return: 0 if same, 1 if new map tile, 2 if new and scripted
|
||||
JMP pl_setColor ; params: slot (0=sky/1=ground), color (0-15); return: nothing
|
||||
jmp pl_render ; params: none
|
||||
|
||||
; Debug support -- must come after jump vectors, since it's not just macros.
|
||||
!source "../include/debug.i"
|
||||
|
@ -1167,7 +1168,8 @@ pl_setPos:
|
|||
BIT setLcRW+lcBank2 ; switch PLASMA runtime back in
|
||||
PLA ; restore PLASMA's eval stk pos
|
||||
TAX
|
||||
INX ; toss 1 slot (params=2, ret=1, diff=1)
|
||||
INX ; toss 1 slot (params=2, ret=0, diff=2)
|
||||
INX
|
||||
RTS
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
|
@ -1343,6 +1345,20 @@ pl_advance: !zone {
|
|||
RTS
|
||||
}
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; >> pl_render
|
||||
; Params: none; return: none
|
||||
; Draw at the current position.
|
||||
pl_render: !zone {
|
||||
STX PLASMA_X ; save PLASMA eval stk pos
|
||||
BIT setROM ; switch out PLASMA while we work
|
||||
|
||||
JSR DRAW
|
||||
|
||||
BIT setLcRW+lcBank2 ; switch PLASMA runtime back in
|
||||
RTS
|
||||
}
|
||||
|
||||
tblHGRl
|
||||
!byte $00,$80,$00,$80,$00,$80,$00,$80
|
||||
!byte $28,$A8,$28,$A8,$28,$A8,$28,$A8
|
||||
|
|
Loading…
Reference in New Issue
Block a user