mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-12-27 10:29:40 +00:00
Andrew's shiny new font engine is working!
This commit is contained in:
parent
0077d9ea05
commit
edc1e7d410
@ -1859,9 +1859,7 @@ class PackPartitions
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process the map name
|
// Process the map name
|
||||||
def shortName = mapName.replaceAll(/[\s-]*[23][dD][-0-9]*$/, '').take(12)
|
def shortName = mapName.replaceAll(/[\s-]*[23][dD][-0-9]*$/, '').take(16)
|
||||||
def extra = (12 - shortName.length()) >> 1
|
|
||||||
shortName = (" " * extra) + shortName
|
|
||||||
|
|
||||||
// Code to register the table and map name
|
// Code to register the table and map name
|
||||||
emitAuxString(shortName)
|
emitAuxString(shortName)
|
||||||
|
@ -62,7 +62,7 @@ Kbd_Rd = $C000 ;read keyboard
|
|||||||
Kbd_Clr = $C010 ;clear keyboard strobe
|
Kbd_Clr = $C010 ;clear keyboard strobe
|
||||||
|
|
||||||
;Set the address of the font
|
;Set the address of the font
|
||||||
SetFont JMP SetFont ;API call address
|
SetFont JMP DoSetFont ;API call address
|
||||||
|
|
||||||
;Set the window boundaries (byte-oriented bounds)
|
;Set the window boundaries (byte-oriented bounds)
|
||||||
SetWindow JMP SetWnd ;API call address
|
SetWindow JMP SetWnd ;API call address
|
||||||
@ -70,14 +70,12 @@ SetWindow JMP SetWnd ;API call address
|
|||||||
;Clear the window
|
;Clear the window
|
||||||
ClearWindow JMP ClrHome ;API call address
|
ClearWindow JMP ClrHome ;API call address
|
||||||
|
|
||||||
|
;Display a character, including interpreting special codes
|
||||||
|
DisplayChar JMP DoPlAsc
|
||||||
|
|
||||||
;Display a string, with proper word wrapping
|
;Display a string, with proper word wrapping
|
||||||
DisplayStr JMP DoParse ; API call address
|
DisplayStr JMP DoParse ; API call address
|
||||||
|
|
||||||
;When using ASCii character values, the values must be
|
|
||||||
;tested for control codes before they can be plotted
|
|
||||||
;using the plot character routine.
|
|
||||||
PlotAsc JMP TestChr ;API call address
|
|
||||||
|
|
||||||
;If you know which of the {0..110} bitmapped characters
|
;If you know which of the {0..110} bitmapped characters
|
||||||
;you want plotted, you can bypass testing for control
|
;you want plotted, you can bypass testing for control
|
||||||
;codes, making this a faster way to plot.
|
;codes, making this a faster way to plot.
|
||||||
@ -99,15 +97,15 @@ GetAsc JMP Get_Chr ;API call address
|
|||||||
GetStr JMP In_Str
|
GetStr JMP In_Str
|
||||||
|
|
||||||
Font0 !word 0 ;address of font
|
Font0 !word 0 ;address of font
|
||||||
CharRate !byte $80 ;plot rate {0..FF} 0=fastest
|
CharRate !byte 0 ;plot rate {0..FF} 0=fastest
|
||||||
WaitStat !byte 0 ;Wait State {0,1,2,3,4,5,6,7}
|
WaitStat !byte 0 ;Wait State {0,1,2,3,4,5,6,7}
|
||||||
NoPlt_Flg !byte 0 ;flag: NO PLOT - only get width
|
NoPlt_Flg !byte 0 ;flag: NO PLOT - only get width
|
||||||
InvTx_Flg !byte 0 ;flag: Inverse (black on white) text
|
InvTx_Flg !byte 0 ;flag: Inverse (black on white) text
|
||||||
MskTx_Flg !byte 0 ;flag: mask HGR before plotting text
|
MskTx_Flg !byte 0 ;flag: mask HGR before plotting text
|
||||||
UndTx_Flg !byte 0 ;flag: Underline text
|
UndTx_Flg !byte 0 ;flag: Underline text
|
||||||
CtrJs_Flg !byte 0 ;flag: center justify
|
CtrJs_Flg !byte 0 ;flag: center justify
|
||||||
BkgColor !byte $80 ;color byte {0,80=blk,FF=wht,etc}
|
BkgColor !byte 0 ;color byte {0,80=blk,FF=wht,etc}
|
||||||
FrgColor !byte $FF ;color byte
|
FrgColor !byte $7F ;color byte
|
||||||
CursColL !byte 0 ;Lo-byte of 16-bit horz X-pos value
|
CursColL !byte 0 ;Lo-byte of 16-bit horz X-pos value
|
||||||
CursColH !byte 0 ;Hi-byte X-position {0..279}
|
CursColH !byte 0 ;Hi-byte X-position {0..279}
|
||||||
CursRow !byte 0 ;vertical Y-position {0..191}
|
CursRow !byte 0 ;vertical Y-position {0..191}
|
||||||
@ -509,18 +507,17 @@ SW_RT = 0
|
|||||||
SW_LT = 1
|
SW_LT = 1
|
||||||
SW_BTM = 2
|
SW_BTM = 2
|
||||||
SW_TOP = 3
|
SW_TOP = 3
|
||||||
SetWnd LDA evalStkL+SW_TOP,X ;get top coord (in units of 8-pixel lins)
|
SetWnd LDA evalStkL+SW_TOP,X ;get top coord
|
||||||
ASL ;multiply by 8
|
|
||||||
ASL
|
|
||||||
ASL
|
|
||||||
STA CursY ;save the top Y coord
|
STA CursY ;save the top Y coord
|
||||||
STA TpMrgn ;also as the margin
|
STA CursRow ;also as current cursor vertical pos
|
||||||
LDA evalStkL+SW_BTM,X ;get bottom coord (again in 8-pixel lines)
|
SEC
|
||||||
ASL
|
SBC #1 ;adjust by 1
|
||||||
ASL ;multiply by 8
|
STA TpMrgn ; for scrolling margin
|
||||||
ASL
|
LDA evalStkL+SW_BTM,X ;get bottom coord
|
||||||
STA CursYb ;save the bottom Y coord
|
STA CursYb ;save the bottom Y coord
|
||||||
STA BtMrgn ;also as the margin
|
SEC
|
||||||
|
SBC #1 ;adjust by 1
|
||||||
|
STA BtMrgn ; for scrolling margin
|
||||||
LDA evalStkL+SW_LT,X ;lo byte of left X
|
LDA evalStkL+SW_LT,X ;lo byte of left X
|
||||||
STA CursXl
|
STA CursXl
|
||||||
LDA evalStkH+SW_LT,X ;hi byte of left X
|
LDA evalStkH+SW_LT,X ;hi byte of left X
|
||||||
@ -638,8 +635,7 @@ ClrColr LDA BkgColor
|
|||||||
ClrSlp3 JSR GetBasX ;to get the base address
|
ClrSlp3 JSR GetBasX ;to get the base address
|
||||||
LDY LfMrgn
|
LDY LfMrgn
|
||||||
LDA ClrFlip
|
LDA ClrFlip
|
||||||
ClrSlp4 EOR #$7F
|
ClrSlp4 STA (GBasL),Y
|
||||||
STA (GBasL),Y
|
|
||||||
INY
|
INY
|
||||||
CPY RtMrgn
|
CPY RtMrgn
|
||||||
BNE ClrSlp4
|
BNE ClrSlp4
|
||||||
@ -677,13 +673,14 @@ Pa_Lp1 STY Pa_iSv
|
|||||||
CPY Pa_Len ;reached end of string?
|
CPY Pa_Len ;reached end of string?
|
||||||
BCC Pa_Go
|
BCC Pa_Go
|
||||||
BEQ Pa_Go
|
BEQ Pa_Go
|
||||||
JMP ParsDn
|
JMP Pa_Spc
|
||||||
Pa_Go ORA #$80 ;set hi bit in case
|
Pa_Go ORA #$80 ;set hi bit for consistent tests
|
||||||
|
STA AscChar
|
||||||
CMP #$8D
|
CMP #$8D
|
||||||
BEQ Pa_Spc
|
BEQ Pa_Spc
|
||||||
LDX #1
|
LDX #1
|
||||||
STX NoPlt_Flg ;set NO PLOT flag
|
STX NoPlt_Flg ;set NO PLOT flag
|
||||||
JSR PlotAsc ;do plot routine to strip off Ctrl
|
JSR TestChr ;do plot routine to strip off Ctrl
|
||||||
LDX #0 ;codes & get char width
|
LDX #0 ;codes & get char width
|
||||||
STX NoPlt_Flg ;clear NO PLOT flag
|
STX NoPlt_Flg ;clear NO PLOT flag
|
||||||
LDA ChrWdth
|
LDA ChrWdth
|
||||||
@ -700,9 +697,12 @@ Pa_Tskp LDA AscChar
|
|||||||
LDY Pa_iSv
|
LDY Pa_iSv
|
||||||
INY
|
INY
|
||||||
JMP Pa_Lp1
|
JMP Pa_Lp1
|
||||||
Pa_ToFr LDA #$8D
|
Pa_ToFr LDY Pa_iSv ;if word too big
|
||||||
|
CPY Pa_iBgn ; for one line
|
||||||
|
BEQ Pa_Spc ; then split the word
|
||||||
|
LDA #$8D
|
||||||
STA AscChar
|
STA AscChar
|
||||||
JSR PlotAsc
|
JSR TestChr
|
||||||
LDY #0
|
LDY #0
|
||||||
STY TtlWdth
|
STY TtlWdth
|
||||||
LDY Pa_iBgn
|
LDY Pa_iBgn
|
||||||
@ -716,21 +716,24 @@ Pa_Spc LDY Pa_iSv
|
|||||||
Pa_Lp2 STY Pa_iSv
|
Pa_Lp2 STY Pa_iSv
|
||||||
LDA (PrsAdrL),Y ;Get the character
|
LDA (PrsAdrL),Y ;Get the character
|
||||||
STA AscChar ;**add code
|
STA AscChar ;**add code
|
||||||
JSR PlotAsc ;if space & at left then don't plot
|
JSR TestChr ;if space & at left then don't plot
|
||||||
LDY Pa_iSv
|
LDY Pa_iSv
|
||||||
INY
|
INY
|
||||||
CPY Pa_iEnd
|
CPY Pa_iEnd
|
||||||
BEQ Pa_Dn2
|
|
||||||
BNE Pa_Lp2
|
BNE Pa_Lp2
|
||||||
Pa_Dn2 STY Pa_iSv
|
Pa_Dn2 STY Pa_iSv
|
||||||
LDA TtlWdth
|
CPY Pa_Len ;end of the message?
|
||||||
|
BCC Pa_Dn2b
|
||||||
|
BEQ Pa_Dn2b
|
||||||
|
JMP ParsDn ;if so, stop here
|
||||||
|
Pa_Dn2b LDA TtlWdth
|
||||||
CMP LinWdth
|
CMP LinWdth
|
||||||
BPL Pa_Dn3
|
BPL Pa_Dn3
|
||||||
LDA (PrsAdrL),Y ;Get the character
|
LDA (PrsAdrL),Y ;Get the character
|
||||||
CMP #$8D
|
CMP #$8D
|
||||||
BEQ Pa_Dn3
|
BEQ Pa_Dn3
|
||||||
STA AscChar
|
STA AscChar
|
||||||
JSR PlotAsc
|
JSR TestChr
|
||||||
JMP Pa_Dn4
|
JMP Pa_Dn4
|
||||||
Pa_Dn3 LDY Pa_iSv
|
Pa_Dn3 LDY Pa_iSv
|
||||||
INY
|
INY
|
||||||
@ -739,9 +742,7 @@ Pa_Dn3 LDY Pa_iSv
|
|||||||
Pa_Dn4 LDY Pa_iSv
|
Pa_Dn4 LDY Pa_iSv
|
||||||
INY
|
INY
|
||||||
JMP Pa_Lp0
|
JMP Pa_Lp0
|
||||||
ParsDn LDY #7
|
ParsDn RTS
|
||||||
STY CursXrl
|
|
||||||
RTS
|
|
||||||
;
|
;
|
||||||
LinWdth !byte 112 ;max line width
|
LinWdth !byte 112 ;max line width
|
||||||
TtlWdth !byte $00 ;total word width
|
TtlWdth !byte $00 ;total word width
|
||||||
@ -1149,8 +1150,8 @@ ChBufr !fill 40,0 ;input buffer ($200 not used)
|
|||||||
CwBufr !fill 40,0 ;Char Width Buffer
|
CwBufr !fill 40,0 ;Char Width Buffer
|
||||||
|
|
||||||
;Test for Control Keys when using ASCII characters
|
;Test for Control Keys when using ASCII characters
|
||||||
TestChr STA AscChar ;store the ASCII character
|
DoPlAsc STA AscChar ;store the ASCII character
|
||||||
LDX #0
|
TestChr LDX #0
|
||||||
STX ChrWdth
|
STX ChrWdth
|
||||||
AND #$7F ;strip off HiBit
|
AND #$7F ;strip off HiBit
|
||||||
TAX ;save it
|
TAX ;save it
|
||||||
@ -1362,7 +1363,8 @@ TCl_20 CMP #$0E ;Ctrl-N normal txt mode
|
|||||||
STA MskTx_Flg
|
STA MskTx_Flg
|
||||||
STA UndTx_Flg
|
STA UndTx_Flg
|
||||||
STA CtrJs_Flg
|
STA CtrJs_Flg
|
||||||
LDA #$80
|
STA CharRate
|
||||||
|
LDA #0
|
||||||
STA BkgColor
|
STA BkgColor
|
||||||
TCl_XX RTS
|
TCl_XX RTS
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
fontEngine = $E000
|
fontEngine = $E000
|
||||||
|
|
||||||
SetFont = fontEngine
|
SetFont = fontEngine
|
||||||
SetWindow = SetFont+3
|
SetWindow = SetFont+3
|
||||||
ClearWindow = SetWindow+3
|
ClearWindow = SetWindow+3
|
||||||
DisplayStr = ClearWindow+3
|
DisplayChar = ClearWindow+3
|
||||||
|
DisplayStr = DisplayChar+3
|
||||||
|
@ -503,6 +503,16 @@ asm clearWindow
|
|||||||
jmp ClearWindow
|
jmp ClearWindow
|
||||||
end
|
end
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Display a character using the font engine.
|
||||||
|
// Params: ch
|
||||||
|
asm displayChar
|
||||||
|
+asmPlasm 1
|
||||||
|
bit setLcRW+lcBank2
|
||||||
|
bit setLcRW+lcBank2
|
||||||
|
jmp DisplayChar
|
||||||
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Display a string using the font engine.
|
// Display a string using the font engine.
|
||||||
// Params: pStr
|
// Params: pStr
|
||||||
@ -702,28 +712,29 @@ end
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Window for the map name bar
|
// Window for the map name bar
|
||||||
def setWindow1()
|
def setWindow1()
|
||||||
setWindow(1, 2, 5, 17)
|
setWindow(8, 18, 35, 119)
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Window for the large upper right bar
|
// Window for the large upper right bar
|
||||||
def setWindow2()
|
def setWindow2()
|
||||||
setWindow(3, 17, 22, 37)
|
setWindow(24, 136, 154, 266)
|
||||||
|
displayChar('N'-$40) // Set normal mode - clear all special modes
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Window for the mid-size lower right bar
|
// Window for the mid-size lower right bar
|
||||||
def setWindow3()
|
def setWindow3()
|
||||||
setWindow(18, 23, 22, 37)
|
setWindow(144, 184, 154, 266)
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Window for the map area (used for clearing it)
|
// Window for the map area (used for clearing it)
|
||||||
def setMapWindow()
|
def setMapWindow()
|
||||||
if mapIs3D
|
if mapIs3D
|
||||||
setWindow(3, 19, 2, 19)
|
setWindow(24, 152, 14, 140)
|
||||||
else
|
else
|
||||||
setWindow(3, 21, 2, 19)
|
setWindow(24, 168, 14, 140)
|
||||||
fin
|
fin
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -731,11 +742,14 @@ end
|
|||||||
// Show some faked-up data for player characters
|
// Show some faked-up data for player characters
|
||||||
def fakeChars()
|
def fakeChars()
|
||||||
setWindow3()
|
setWindow3()
|
||||||
displayStr("Name Lif Gun")
|
displayChar('L'-$40)
|
||||||
displayStr("-------- --- ---")
|
displayStr("Name Life Gun\n")
|
||||||
displayStr("Blak Bart 12 4 ")
|
displayChar('L'-$40)
|
||||||
displayStr("Wyld Bill 8 2 ")
|
displayStr("Black Bart 12 4\n")
|
||||||
displayStr("LucyLwls 9 6")
|
displayStr("Wyld Bill 8 2\n")
|
||||||
|
displayStr("Lucy Lawless ")
|
||||||
|
displayChar('U'-$40)
|
||||||
|
displayStr("9 6")
|
||||||
setWindow2()
|
setWindow2()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -925,7 +939,9 @@ def setMap(is3D, num, x, y, dir)
|
|||||||
else
|
else
|
||||||
flipToPage1()
|
flipToPage1()
|
||||||
setWindow1(); clearWindow()
|
setWindow1(); clearWindow()
|
||||||
|
displayChar('Y'-$40) // center mode
|
||||||
displayStr("Traveling...")
|
displayStr("Traveling...")
|
||||||
|
displayChar('N'-$40) // normal mode
|
||||||
setMapWindow(); clearWindow()
|
setMapWindow(); clearWindow()
|
||||||
setWindow2(); clearWindow()
|
setWindow2(); clearWindow()
|
||||||
mapIs3D = is3D
|
mapIs3D = is3D
|
||||||
@ -1039,7 +1055,9 @@ def setScriptInfo(mapName, trigTbl)
|
|||||||
// Display map name
|
// Display map name
|
||||||
setWindow1()
|
setWindow1()
|
||||||
clearWindow()
|
clearWindow()
|
||||||
|
displayChar('Y'-$40) // center mode
|
||||||
displayStr(mapName)
|
displayStr(mapName)
|
||||||
|
displayChar('N'-$40) // normal mode
|
||||||
|
|
||||||
// Back to the main text window.
|
// Back to the main text window.
|
||||||
setWindow2()
|
setWindow2()
|
||||||
|
Loading…
Reference in New Issue
Block a user