mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-07-04 09:29:28 +00:00
Fix edge detection in II raycaster.
This commit is contained in:
parent
c8d8c22478
commit
bbac1ea183
@ -440,7 +440,7 @@ class PackPartitions
|
|||||||
buf.put((byte)0)
|
buf.put((byte)0)
|
||||||
|
|
||||||
// Sentinel row of $FF at start of map
|
// Sentinel row of $FF at start of map
|
||||||
(0..width).each { buf.put((byte)0xFF) }
|
(0..<width).each { buf.put((byte)0xFF) }
|
||||||
|
|
||||||
// After the header comes the raw data
|
// After the header comes the raw data
|
||||||
rows.each { row ->
|
rows.each { row ->
|
||||||
@ -451,7 +451,7 @@ class PackPartitions
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sentinel row of $FF at end of map
|
// Sentinel row of $FF at end of map
|
||||||
(0..width).each { buf.put((byte)0xFF) }
|
(0..<width).each { buf.put((byte)0xFF) }
|
||||||
|
|
||||||
if (javascriptOut)
|
if (javascriptOut)
|
||||||
dumpJsMap(rows, texMap)
|
dumpJsMap(rows, texMap)
|
||||||
|
@ -405,6 +405,8 @@ castRay: !zone
|
|||||||
!if DEBUG >= 2 { jsr .debugFinal }
|
!if DEBUG >= 2 { jsr .debugFinal }
|
||||||
rts
|
rts
|
||||||
.hitSprite:
|
.hitSprite:
|
||||||
|
cmp #$FF ; check for special mark at edges of map
|
||||||
|
beq .hitEdge
|
||||||
; We found a sprite cell on the map. We only want to process this sprite once,
|
; We found a sprite cell on the map. We only want to process this sprite once,
|
||||||
; so check if we've already done it.
|
; so check if we've already done it.
|
||||||
and #$40
|
and #$40
|
||||||
@ -446,6 +448,16 @@ castRay: !zone
|
|||||||
.spriteDone:
|
.spriteDone:
|
||||||
jmp .DDA_step ; trace this ray some more
|
jmp .DDA_step ; trace this ray some more
|
||||||
|
|
||||||
|
; special case: hit edge of map
|
||||||
|
.hitEdge:
|
||||||
|
ldy #0 ; height
|
||||||
|
lda #1 ; depth
|
||||||
|
sty txNum ; texture number
|
||||||
|
jsr saveLink ; allocate a link and save those
|
||||||
|
lda #0 ; column number
|
||||||
|
sta txColBuf,x ; save that too
|
||||||
|
rts ; all done
|
||||||
|
|
||||||
; wall calculation: X=dir1, Y=dir2, A=dir2step
|
; wall calculation: X=dir1, Y=dir2, A=dir2step
|
||||||
.wallCalc:
|
.wallCalc:
|
||||||
pha ; save step
|
pha ; save step
|
||||||
@ -1161,16 +1173,17 @@ nextLine: !zone
|
|||||||
.done: stx pLine+1
|
.done: stx pLine+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Draw a ray that was traversed by calcRay
|
; Draw a ray that was traversed by castRay
|
||||||
drawRay: !zone
|
drawRay: !zone
|
||||||
ldy screenCol
|
ldy screenCol
|
||||||
ldx firstLink,y
|
ldx firstLink,y
|
||||||
.lup: lda txNumBuf,x
|
.lup: lda heightBuf,x
|
||||||
|
beq .skip
|
||||||
|
sta lineCt
|
||||||
|
lda txNumBuf,x
|
||||||
sta txNum
|
sta txNum
|
||||||
lda txColBuf,x
|
lda txColBuf,x
|
||||||
sta txColumn
|
sta txColumn
|
||||||
lda heightBuf,x
|
|
||||||
sta lineCt
|
|
||||||
lda linkBuf,x ; get link to next stacked data to draw
|
lda linkBuf,x ; get link to next stacked data to draw
|
||||||
pha ; save link for later
|
pha ; save link for later
|
||||||
; Make a pointer to the selected texture
|
; Make a pointer to the selected texture
|
||||||
@ -1191,7 +1204,7 @@ drawRay: !zone
|
|||||||
pla ; retrieve link to next in stack
|
pla ; retrieve link to next in stack
|
||||||
tax ; put in X for indexing
|
tax ; put in X for indexing
|
||||||
bne .lup ; if non-zero, we have more to draw
|
bne .lup ; if non-zero, we have more to draw
|
||||||
rts ; next link was zero - we're done with this ray
|
.skip rts ; next link was zero - we're done with this ray
|
||||||
|
|
||||||
; Template for blitting code [ref BigBlue3_70]
|
; Template for blitting code [ref BigBlue3_70]
|
||||||
blitTemplate: !zone ; comments show byte offset
|
blitTemplate: !zone ; comments show byte offset
|
||||||
@ -1574,8 +1587,8 @@ setPlayerPos: !zone
|
|||||||
sta playerX+1
|
sta playerX+1
|
||||||
lda #$80
|
lda #$80
|
||||||
sta playerX
|
sta playerX
|
||||||
; Y=2.5
|
; Y=3.5
|
||||||
lda #2
|
lda #3
|
||||||
sta playerY+1
|
sta playerY+1
|
||||||
lda #$80
|
lda #$80
|
||||||
sta playerY
|
sta playerY
|
||||||
|
Loading…
Reference in New Issue
Block a user