mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-20 05:29:09 +00:00
Now displays map name centered at top of window.
This commit is contained in:
parent
ce5a45c920
commit
99827b9785
@ -291,10 +291,15 @@ class PackPartitions
|
||||
row.each { pix -> print pix }
|
||||
println ""
|
||||
}
|
||||
}
|
||||
|
||||
def writeString(buf, str)
|
||||
{
|
||||
str.each { buf.put((byte)it) }
|
||||
buf.put((byte)0);
|
||||
}
|
||||
|
||||
|
||||
def write2DMap(buf, rows)
|
||||
def write2DMap(buf, mapName, rows)
|
||||
{
|
||||
def width = rows[0].size()
|
||||
def height = rows.size()
|
||||
@ -322,6 +327,9 @@ class PackPartitions
|
||||
buf.put((byte)width)
|
||||
buf.put((byte)height)
|
||||
|
||||
// Followed by name
|
||||
writeString(buf, mapName.replaceFirst(/ ?-? ?2D/, ""))
|
||||
|
||||
// Followed by the list of tiles
|
||||
tileList.each { buf.put((byte)it) }
|
||||
buf.put((byte)0)
|
||||
@ -334,7 +342,7 @@ class PackPartitions
|
||||
}
|
||||
}
|
||||
|
||||
def write3DMap(buf, rows) // [ref BigBlue1_50]
|
||||
def write3DMap(buf, mapName, rows) // [ref BigBlue1_50]
|
||||
{
|
||||
def width = rows[0].size()
|
||||
def height = rows.size()
|
||||
@ -366,6 +374,9 @@ class PackPartitions
|
||||
buf.put((byte)width)
|
||||
buf.put((byte)height)
|
||||
|
||||
// Followed by name
|
||||
writeString(buf, mapName.replaceFirst(/ ?-? ?3D/, ""))
|
||||
|
||||
// Followed by the list of textures
|
||||
texList.each { buf.put((byte)it) }
|
||||
buf.put((byte)0)
|
||||
@ -445,7 +456,7 @@ class PackPartitions
|
||||
//println "Packing 2D map #$num named '$name'."
|
||||
def rows = parseMap(mapEl, tileEls)
|
||||
def buf = ByteBuffer.allocate(50000)
|
||||
write2DMap(buf, rows)
|
||||
write2DMap(buf, name, rows)
|
||||
maps2D[name] = [num:num, buf:buf]
|
||||
}
|
||||
|
||||
@ -456,7 +467,7 @@ class PackPartitions
|
||||
//println "Packing 3D map #$num named '$name'."
|
||||
def rows = parseMap(mapEl, tileEls)
|
||||
def buf = ByteBuffer.allocate(50000)
|
||||
write3DMap(buf, rows)
|
||||
write3DMap(buf, name, rows)
|
||||
maps3D[name] = [num:num, buf:buf]
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,8 @@ mapHeader: !word 0 ; map with header first
|
||||
mapBase: !word 0 ; first byte after the header
|
||||
mapRayOrigin: !word 0
|
||||
mapNum: !byte 1
|
||||
mapName: !word 0 ; pointer to map name
|
||||
mapNameLen: !byte 0 ; length of map name
|
||||
|
||||
; Sky / ground colors
|
||||
skyGndTbl1: !byte $20 ; hi-bit black
|
||||
@ -955,7 +957,17 @@ loadTextures: !zone
|
||||
sta mapWidth ; and save it
|
||||
jsr .get ; get map height
|
||||
sta mapHeight ; and save it
|
||||
lda #0
|
||||
lda .get+1 ; current pointer is the map name
|
||||
sta mapName ; save it
|
||||
lda .get+2
|
||||
sta mapName+1
|
||||
lda #$FF ; pre-decrement, since the zero is going to be counted
|
||||
sta mapNameLen
|
||||
.skip: jsr .get ; skip over the map name
|
||||
inc mapNameLen
|
||||
cmp #0
|
||||
bne .skip ; until end-of-string is reached (zero byte)
|
||||
lda #0 ; now comes the list of textures.
|
||||
sta txNum
|
||||
.lup: jsr .get ; get texture resource number
|
||||
tay ; to Y for mem manager
|
||||
@ -1267,17 +1279,34 @@ main: !zone
|
||||
jsr makeLines
|
||||
jsr graphInit
|
||||
bit clrMixed
|
||||
; Write some test text
|
||||
ldx #24
|
||||
ldy #2
|
||||
; Display the name of the map in the upper left box.
|
||||
lda mapNameLen ; prepare to calculate half the length
|
||||
lsr
|
||||
eor #$FF ; negate
|
||||
clc
|
||||
adc #8 ; to center the string
|
||||
sta tmp
|
||||
lda #14 ; calculate remainder after string
|
||||
sec
|
||||
sbc tmp
|
||||
sbc mapNameLen
|
||||
sta tmp+1
|
||||
ldx #4 ; start of window
|
||||
ldy #1
|
||||
jsr tabXY
|
||||
jsr printSCSTR
|
||||
!raw "Bonjour tout",0
|
||||
ldx #24
|
||||
ldy #3
|
||||
jsr tabXY
|
||||
jsr printSCSTR
|
||||
!raw "le monde.",0
|
||||
.slup1 dec tmp ; spaces to put at start of name
|
||||
bmi .done1
|
||||
lda #$20
|
||||
jsr printCHAR
|
||||
jmp .slup1
|
||||
.done1 ldy mapName ; now display the name itself
|
||||
ldx mapName+1
|
||||
jsr printCSTR
|
||||
.slup2 dec tmp+1 ; spaces after the name
|
||||
bmi .nextFrame
|
||||
lda #$20
|
||||
jsr printCHAR
|
||||
jmp .slup2
|
||||
; Render the frame and flip it onto the screen
|
||||
.nextFrame:
|
||||
jsr renderFrame
|
||||
|
Loading…
x
Reference in New Issue
Block a user