mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-08-15 21:27:22 +00:00
Little changes: use portrait names instead of numbers in generated code; a little cleanup of interrupts; improve comments.
This commit is contained in:
@@ -266,6 +266,7 @@ class A2PackPartitions
|
|||||||
// Locate the data for the Apple II (as opposed to C64 etc.)
|
// Locate the data for the Apple II (as opposed to C64 etc.)
|
||||||
def dataEl = imgEl.displayData?.find { it.@platform == "AppleII" }
|
def dataEl = imgEl.displayData?.find { it.@platform == "AppleII" }
|
||||||
assert dataEl : "image '${imgEl.@name}' missing AppleII platform data"
|
assert dataEl : "image '${imgEl.@name}' missing AppleII platform data"
|
||||||
|
//println "Packing frame image '${imgEl.@name}'."
|
||||||
|
|
||||||
// Parse out the hex data on each line and add it to a buffer.
|
// Parse out the hex data on each line and add it to a buffer.
|
||||||
def hexStr = dataEl.text()
|
def hexStr = dataEl.text()
|
||||||
@@ -284,10 +285,10 @@ class A2PackPartitions
|
|||||||
|
|
||||||
dstPos += 40
|
dstPos += 40
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put the results into the buffer
|
// Put the results into the buffer
|
||||||
def outBuf = ByteBuffer.allocate(7680)
|
def outBuf = ByteBuffer.allocate(dstPos)
|
||||||
outBuf.put(arr)
|
outBuf.put(arr, 0, dstPos)
|
||||||
|
|
||||||
// All done. Return the buffer.
|
// All done. Return the buffer.
|
||||||
return outBuf
|
return outBuf
|
||||||
@@ -804,6 +805,7 @@ class A2PackPartitions
|
|||||||
out.position(0)
|
out.position(0)
|
||||||
out.put((byte)(before+1))
|
out.put((byte)(before+1))
|
||||||
out.position(endPos)
|
out.position(endPos)
|
||||||
|
//println "$name: ${out.position()} bytes."
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
portraits[name] = [num:num, buf:buf]
|
portraits[name] = [num:num, buf:buf]
|
||||||
@@ -1774,7 +1776,7 @@ class A2PackPartitions
|
|||||||
allItemFuncs(dataIn.global.sheets.sheet)
|
allItemFuncs(dataIn.global.sheets.sheet)
|
||||||
allPlayerFuncs(dataIn.global.sheets.sheet)
|
allPlayerFuncs(dataIn.global.sheets.sheet)
|
||||||
|
|
||||||
// Pack each map This uses the image and tile maps filled earlier.
|
// Pack each map. This uses the image and tile maps filled earlier.
|
||||||
println "Packing maps."
|
println "Packing maps."
|
||||||
new File("build/3dMemUsage.txt").withWriter { w ->
|
new File("build/3dMemUsage.txt").withWriter { w ->
|
||||||
memUsageFile = w
|
memUsageFile = w
|
||||||
@@ -1878,7 +1880,7 @@ class A2PackPartitions
|
|||||||
return String.format("\$%X", ((nDice << 12) | (dieSize << 8) | add))
|
return String.format("\$%X", ((nDice << 12) | (dieSize << 8) | add))
|
||||||
}
|
}
|
||||||
|
|
||||||
def genEnemy(out, row, portraitNames)
|
def genEnemy(out, row)
|
||||||
{
|
{
|
||||||
def name = row.@name
|
def name = row.@name
|
||||||
withContext(name)
|
withContext(name)
|
||||||
@@ -1886,11 +1888,11 @@ class A2PackPartitions
|
|||||||
out.println("def _NEn_${humanNameToSymbol(name, false)}()")
|
out.println("def _NEn_${humanNameToSymbol(name, false)}()")
|
||||||
|
|
||||||
def image1 = row.@image1
|
def image1 = row.@image1
|
||||||
if (!portraitNames.contains(humanNameToSymbol(image1, false)))
|
if (!portraits.containsKey(image1))
|
||||||
throw new Exception("Image '$image1' not found")
|
throw new Exception("Image '$image1' not found")
|
||||||
|
|
||||||
def image2 = row.@image2
|
def image2 = row.@image2
|
||||||
if (image2.size() > 0 && !portraitNames.contains(humanNameToSymbol(image2, false)))
|
if (image2.size() > 0 && !portraits.containsKey(image2))
|
||||||
throw new Exception("Image '$image2' not found")
|
throw new Exception("Image '$image2' not found")
|
||||||
|
|
||||||
def hitPoints = row.@"hit-points"; assert hitPoints
|
def hitPoints = row.@"hit-points"; assert hitPoints
|
||||||
@@ -1926,7 +1928,7 @@ class A2PackPartitions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def genAllEnemies(sheet, portraitNames)
|
def genAllEnemies(sheet)
|
||||||
{
|
{
|
||||||
assert sheet : "Missing 'enemies' sheet"
|
assert sheet : "Missing 'enemies' sheet"
|
||||||
|
|
||||||
@@ -1987,7 +1989,7 @@ end
|
|||||||
|
|
||||||
// Now output a function for each enemy
|
// Now output a function for each enemy
|
||||||
sheet.rows.row.each { row ->
|
sheet.rows.row.each { row ->
|
||||||
genEnemy(out, row, portraitNames)
|
genEnemy(out, row)
|
||||||
}
|
}
|
||||||
out.println()
|
out.println()
|
||||||
|
|
||||||
@@ -2460,10 +2462,9 @@ end
|
|||||||
// the PLASMA compiler expects to see.
|
// the PLASMA compiler expects to see.
|
||||||
def oldSep = System.getProperty("line.separator")
|
def oldSep = System.getProperty("line.separator")
|
||||||
System.setProperty("line.separator", "\n")
|
System.setProperty("line.separator", "\n")
|
||||||
|
|
||||||
// Translate image names to constants
|
// Translate image names to constants and symbol names
|
||||||
new File("build/src/plasma").mkdirs()
|
new File("build/src/plasma").mkdirs()
|
||||||
def portraitNames = [] as Set
|
|
||||||
new File("build/src/plasma/gen_images.plh.new").withWriter { out ->
|
new File("build/src/plasma/gen_images.plh.new").withWriter { out ->
|
||||||
def portraitNum = 0
|
def portraitNum = 0
|
||||||
dataIn.image.sort{it.@name.toLowerCase()}.each { image ->
|
dataIn.image.sort{it.@name.toLowerCase()}.each { image ->
|
||||||
@@ -2481,7 +2482,7 @@ end
|
|||||||
if (animFrameNum <= 1) {
|
if (animFrameNum <= 1) {
|
||||||
++portraitNum
|
++portraitNum
|
||||||
out.println "const PO${humanNameToSymbol(name, false)} = $portraitNum"
|
out.println "const PO${humanNameToSymbol(name, false)} = $portraitNum"
|
||||||
portraitNames << humanNameToSymbol(name, false)
|
portraits[name] = [] // placeholder during dataGen phase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2503,7 +2504,7 @@ end
|
|||||||
replaceIfDiff("build/src/plasma/gen_globalScripts.pla")
|
replaceIfDiff("build/src/plasma/gen_globalScripts.pla")
|
||||||
|
|
||||||
// Translate enemies, weapons, etc. to code
|
// Translate enemies, weapons, etc. to code
|
||||||
genAllEnemies(dataIn.global.sheets.sheet.find { it?.@name.equalsIgnoreCase("enemies") }, portraitNames)
|
genAllEnemies(dataIn.global.sheets.sheet.find { it?.@name.equalsIgnoreCase("enemies") })
|
||||||
genAllItems(dataIn.global.sheets.sheet)
|
genAllItems(dataIn.global.sheets.sheet)
|
||||||
genAllPlayers(dataIn.global.sheets.sheet)
|
genAllPlayers(dataIn.global.sheets.sheet)
|
||||||
|
|
||||||
@@ -3229,12 +3230,11 @@ end
|
|||||||
def packSetPortrait(blk)
|
def packSetPortrait(blk)
|
||||||
{
|
{
|
||||||
def portraitName = getSingle(blk.field, 'NAME').text()
|
def portraitName = getSingle(blk.field, 'NAME').text()
|
||||||
def portrait = portraits[portraitName]
|
if (!portraits.containsKey(portraitName)) {
|
||||||
if (!portrait) {
|
|
||||||
printWarning "portrait '$portraitName' not found; skipping set_portrait."
|
printWarning "portrait '$portraitName' not found; skipping set_portrait."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
outIndented("setPortrait(${portrait.num})\n")
|
outIndented("setPortrait(PO${humanNameToSymbol(portraitName, false)})\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
def packClrPortrait(blk)
|
def packClrPortrait(blk)
|
||||||
|
@@ -127,9 +127,9 @@ relocate:
|
|||||||
inx
|
inx
|
||||||
stx $D000
|
stx $D000
|
||||||
cpx $D000
|
cpx $D000
|
||||||
bne .noaux
|
|
||||||
sta clrAuxZP
|
sta clrAuxZP
|
||||||
cli
|
cli
|
||||||
|
bne .noaux
|
||||||
dex
|
dex
|
||||||
cpx $D000
|
cpx $D000
|
||||||
beq .gotaux
|
beq .gotaux
|
||||||
@@ -144,9 +144,9 @@ relocate:
|
|||||||
.st sta $D000,y
|
.st sta $D000,y
|
||||||
iny
|
iny
|
||||||
bne .bylup
|
bne .bylup
|
||||||
cli
|
|
||||||
inx ; all pages until we hit $00
|
inx ; all pages until we hit $00
|
||||||
bne .pglup
|
bne .pglup
|
||||||
|
cli
|
||||||
sta clrAuxZP ; ...back to main LC
|
sta clrAuxZP ; ...back to main LC
|
||||||
; patch into the main ProDOS MLI entry point
|
; patch into the main ProDOS MLI entry point
|
||||||
ldx #$4C ; jmp
|
ldx #$4C ; jmp
|
||||||
@@ -381,11 +381,10 @@ init: !zone
|
|||||||
sty glibBase+1
|
sty glibBase+1
|
||||||
lda #LOCK_MEMORY ; lock it in forever
|
lda #LOCK_MEMORY ; lock it in forever
|
||||||
jsr main_dispatch
|
jsr main_dispatch
|
||||||
ldx #1 ; keep open for efficiency's sake
|
lda #FINISH_LOAD ; and load it
|
||||||
lda #FINISH_LOAD
|
|
||||||
jsr main_dispatch
|
jsr main_dispatch
|
||||||
ldx #$10 ; initial eval stack index
|
ldx #$10 ; set initial PLASMA eval stack index
|
||||||
.gomod: jmp $1111 ; jump to module for further bootstrapping
|
.gomod: jmp $1111 ; jump to module to start the game
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; Vectors and debug support code - these go in low memory at $800
|
; Vectors and debug support code - these go in low memory at $800
|
||||||
|
Reference in New Issue
Block a user