mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-08-02 15:29:00 +00:00
More bug fixes -- raycaster now working except for some weird textures.
This commit is contained in:
parent
654db6fd80
commit
b8d146ca73
@ -941,23 +941,7 @@ disk_queueLoad: !zone
|
|||||||
lda (pTmp),y ; get resource num
|
lda (pTmp),y ; get resource num
|
||||||
cmp resNum ; is it the number we're looking for
|
cmp resNum ; is it the number we're looking for
|
||||||
bne .bump3 ; no, skip this resource
|
bne .bump3 ; no, skip this resource
|
||||||
iny ; Yay! We found the one we want.
|
; Yay! We found the one we want.
|
||||||
lda (pTmp),y ; grab the length in bytes
|
|
||||||
tax
|
|
||||||
iny
|
|
||||||
lda (pTmp),y ; hi byte too
|
|
||||||
bpl + ; if uncompressed, treat as normal
|
|
||||||
iny ; otherwise, advance to get uncomp size
|
|
||||||
lda (pTmp),y
|
|
||||||
tax
|
|
||||||
iny
|
|
||||||
lda (pTmp),y
|
|
||||||
dey
|
|
||||||
dey
|
|
||||||
+ stx reqLen ; save for later
|
|
||||||
sta reqLen+1
|
|
||||||
dey ; back to start of record
|
|
||||||
dey
|
|
||||||
dey
|
dey
|
||||||
lda (pTmp),y ; Get the resource type back
|
lda (pTmp),y ; Get the resource type back
|
||||||
ora #$80 ; special mark to say, "We want to load this segment"
|
ora #$80 ; special mark to say, "We want to load this segment"
|
||||||
@ -965,6 +949,20 @@ disk_queueLoad: !zone
|
|||||||
beq +
|
beq +
|
||||||
ora #$40 ; record that the eventual disk read should go to aux mem
|
ora #$40 ; record that the eventual disk read should go to aux mem
|
||||||
+ sta (pTmp),y ; save modified type byte with the flags added to it
|
+ sta (pTmp),y ; save modified type byte with the flags added to it
|
||||||
|
iny ; advance past resource type now that we're done with it
|
||||||
|
iny ; skip over resource num
|
||||||
|
lda (pTmp),y ; grab the length in bytes
|
||||||
|
tax ; stash away
|
||||||
|
iny
|
||||||
|
lda (pTmp),y ; hi byte too
|
||||||
|
bpl + ; if uncompressed, treat as normal
|
||||||
|
iny ; otherwise, advance to get uncomp size
|
||||||
|
lda (pTmp),y ; lo byte
|
||||||
|
tax
|
||||||
|
iny
|
||||||
|
lda (pTmp),y ; and hi byte
|
||||||
|
+ stx reqLen ; save the uncompressed length
|
||||||
|
sta reqLen+1 ; both bytes
|
||||||
jsr shared_alloc ; reserve memory for this resource (main or aux as appropriate)
|
jsr shared_alloc ; reserve memory for this resource (main or aux as appropriate)
|
||||||
stx tmp ; save lo part of addr temporarily
|
stx tmp ; save lo part of addr temporarily
|
||||||
ldx segNum ; get the segment number back
|
ldx segNum ; get the segment number back
|
||||||
@ -976,7 +974,7 @@ disk_queueLoad: !zone
|
|||||||
ldx tmp ; get back lo part of addr
|
ldx tmp ; get back lo part of addr
|
||||||
rts ; success! all done.
|
rts ; success! all done.
|
||||||
.bump3: iny ; skip resource number
|
.bump3: iny ; skip resource number
|
||||||
iny
|
iny ; skip lo byte of length
|
||||||
lda (pTmp),y ; get hi byte of length.
|
lda (pTmp),y ; get hi byte of length.
|
||||||
bpl + ; if hi bit clear, it's not compressed
|
bpl + ; if hi bit clear, it's not compressed
|
||||||
iny ; skip uncompressed size too
|
iny ; skip uncompressed size too
|
||||||
@ -1171,6 +1169,11 @@ readToBuf: !zone
|
|||||||
ldx #0
|
ldx #0
|
||||||
+ stx readLen
|
+ stx readLen
|
||||||
sta readLen+1 ; save number of pages
|
sta readLen+1 ; save number of pages
|
||||||
|
!if DEBUG {
|
||||||
|
+prStr : !text "Read to buf, len=",0
|
||||||
|
+prWord readLen
|
||||||
|
+crout
|
||||||
|
}
|
||||||
jsr readToMain ; now read
|
jsr readToMain ; now read
|
||||||
lda reqLen ; decrement reqLen by the amount we read
|
lda reqLen ; decrement reqLen by the amount we read
|
||||||
sec
|
sec
|
||||||
@ -1247,6 +1250,7 @@ lz4Decompress: !zone
|
|||||||
+ sta ucLen ; record resulting length (lo byte)
|
+ sta ucLen ; record resulting length (lo byte)
|
||||||
.goLit:
|
.goLit:
|
||||||
!if DEBUG_DECOMP { jsr .debug2 }
|
!if DEBUG_DECOMP { jsr .debug2 }
|
||||||
|
+
|
||||||
.auxWr1 sta setAuxWr ; this gets self-modified depending on if target is in main or aux mem
|
.auxWr1 sta setAuxWr ; this gets self-modified depending on if target is in main or aux mem
|
||||||
.litCopy: ; loop to copy the literals
|
.litCopy: ; loop to copy the literals
|
||||||
+LOAD_YSRC ; grab a literal source byte
|
+LOAD_YSRC ; grab a literal source byte
|
||||||
@ -1260,20 +1264,26 @@ lz4Decompress: !zone
|
|||||||
bne + ; non-zero, done
|
bne + ; non-zero, done
|
||||||
jsr .nextDstPage ; zero, need to go to next page
|
jsr .nextDstPage ; zero, need to go to next page
|
||||||
+ dec ucLen ; count bytes
|
+ dec ucLen ; count bytes
|
||||||
bne .litCopy ; if non-zero, loop again
|
bne + ; low count = 0?
|
||||||
dec ucLen+1 ; low-byte of count is zero. Decrement hi-byte
|
lda ucLen+1 ; hi count = 0?
|
||||||
bpl .litCopy ; If non-negative, loop again. NOTE: This would fail if we had blocks >= 32K
|
beq .endChk ; both zero - end of loop
|
||||||
inc ucLen+1 ; to ensure it's zero for the next len decode
|
+ lda ucLen ; did low byte wrap around?
|
||||||
sta clrAuxWr ; back to writing main mem
|
cmp #$FF
|
||||||
|
bne .litCopy ; no, go again
|
||||||
|
dec ucLen+1 ; yes, decrement hi byte
|
||||||
|
jmp .litCopy ; and go again
|
||||||
|
.endChk sta clrAuxWr ; back to writing main mem
|
||||||
.endChk1:
|
.endChk1:
|
||||||
cpx #11 ; end check - self-modified earlier
|
cpx #11 ; end check - self-modified earlier
|
||||||
bcc .decodeMatch ; if less, keep going
|
bcc .decodeMatch ; if less, keep going
|
||||||
.endChk2:
|
.endChk2:
|
||||||
lda #0 ; have we finished all pages?
|
lda #0 ; have we finished all pages?
|
||||||
bne .decodeMatch ; no, keep going
|
bne .decodeMatch ; no, keep going
|
||||||
|
bit isCompressed
|
||||||
|
bpl + ; if not compressed, no extra work at end
|
||||||
pla ; toss unused match length
|
pla ; toss unused match length
|
||||||
!if DO_COMP_CHECKSUMS { jsr .verifyCksum }
|
!if DO_COMP_CHECKSUMS { jsr .verifyCksum }
|
||||||
rts ; all done!
|
+ rts ; all done!
|
||||||
; Now that we've finished with the literals, decode the match section
|
; Now that we've finished with the literals, decode the match section
|
||||||
.decodeMatch:
|
.decodeMatch:
|
||||||
+LOAD_YSRC ; grab first byte of match offset
|
+LOAD_YSRC ; grab first byte of match offset
|
||||||
|
@ -13,7 +13,7 @@ start:
|
|||||||
|
|
||||||
; Conditional assembly flags
|
; Conditional assembly flags
|
||||||
DOUBLE_BUFFER = 1 ; whether to double-buffer
|
DOUBLE_BUFFER = 1 ; whether to double-buffer
|
||||||
DEBUG = 0 ; turn on verbose logging
|
DEBUG = 0 ; 1=some logging, 2=lots of logging
|
||||||
|
|
||||||
; Shared constants, zero page, buffer locations, etc.
|
; Shared constants, zero page, buffer locations, etc.
|
||||||
!source "render.i"
|
!source "render.i"
|
||||||
@ -924,7 +924,10 @@ initMem: !zone
|
|||||||
jsr displayMODE
|
jsr displayMODE
|
||||||
; Set to normal (non-inverse) text
|
; Set to normal (non-inverse) text
|
||||||
lda #pNORMAL
|
lda #pNORMAL
|
||||||
jsr drawMODE
|
jmp drawMODE
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------
|
||||||
|
setExpansionCaller:
|
||||||
; Copy the expansion caller to low stack.
|
; Copy the expansion caller to low stack.
|
||||||
ldx #.callEnd - .callIt - 1
|
ldx #.callEnd - .callIt - 1
|
||||||
- lda .callIt,x
|
- lda .callIt,x
|
||||||
@ -1342,6 +1345,7 @@ main: !zone
|
|||||||
jsr makeClrBlit
|
jsr makeClrBlit
|
||||||
jsr makeDecodeTbls
|
jsr makeDecodeTbls
|
||||||
jsr makeLines
|
jsr makeLines
|
||||||
|
jsr setExpansionCaller
|
||||||
jsr graphInit
|
jsr graphInit
|
||||||
bit clrMixed
|
bit clrMixed
|
||||||
; Display the name of the map in the upper left box.
|
; Display the name of the map in the upper left box.
|
||||||
|
Loading…
Reference in New Issue
Block a user