mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-26 00:29:30 +00:00
String management: break up long strings into plasma-size chunks; clear string pool after each.
This commit is contained in:
parent
1bd54841e6
commit
6ed1518520
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -22,6 +22,7 @@ mg
|
|||
# Don't check in data specific to any particular game
|
||||
/Platform/Apple/virtual/data/images/*.bin
|
||||
/Platform/Apple/virtual/data/fonts/*.bin
|
||||
/Platform/Apple/virtual/data/world/*.bin
|
||||
/Platform/Apple/virtual/data/world/*.xml
|
||||
/Platform/Apple/virtual/data/world/*.cache
|
||||
/Platform/Apple/virtual/data/world/*.tsv
|
||||
|
|
|
@ -2336,9 +2336,19 @@ class PackPartitions
|
|||
return
|
||||
}
|
||||
def text = getSingle(getSingle(getSingle(blk.value, 'VALUE').block, null, 'text').field, 'TEXT').text()
|
||||
outIndented("${blk.@type == 'text_print' ? 'scriptDisplayStr' : 'scriptDisplayStrNL'}(")
|
||||
emitString(text)
|
||||
out << ")\n"
|
||||
|
||||
// Break up long strings into shorter chunks for PLASMA
|
||||
def chunks = text.findAll(/.{253}|.*/)
|
||||
chunks.eachWithIndex { chunk, idx ->
|
||||
if (chunk.length() > 0) {
|
||||
outIndented((idx == chunks.size()-1 && blk.@type == 'text_println') ? \
|
||||
'scriptDisplayStrNL(' : 'scriptDisplayStr(')
|
||||
emitString(chunk)
|
||||
out << ")\n"
|
||||
// Workaround for strings filling up the frame stack
|
||||
outIndented("tossStrings()\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def packClearWindow(blk)
|
||||
|
|
|
@ -107,7 +107,7 @@ const strcmpi = gameLibVecs + 3*46
|
|||
const addEncounterZone = gameLibVecs + 3*47
|
||||
const fatal = gameLibVecs + 3*48
|
||||
const pause = gameLibVecs + 3*49
|
||||
const FUNCN50 = gameLibVecs + 3*50
|
||||
const tossStrings = gameLibVecs + 3*50
|
||||
const FUNCN51 = gameLibVecs + 3*51
|
||||
const FUNCN52 = gameLibVecs + 3*52
|
||||
const FUNCN53 = gameLibVecs + 3*53
|
||||
|
|
|
@ -108,7 +108,7 @@ predef _countList, _countListFiltered, _randomFromListFiltered, _addToList, _bee
|
|||
predef _showParty, _mmgr, _setWindow1, _setWindow2, _setWindow3
|
||||
predef _reboot, _brk, _encodeDice, _rollDice
|
||||
predef _setPlural, _makeEnemy, _getStringResponse, _strcmpi, _addEncounterZone, _fatal
|
||||
predef _pause
|
||||
predef _pause, _tossStrings
|
||||
|
||||
word gameLib_addrs = @_setScriptInfo, @_scriptDisplayStr, @_scriptDisplayStrNL, @_getYN
|
||||
word = @_queue_setMap, @_setSky, @_setGround, @_queue_teleport, @_setPortrait, @_clearPortrait
|
||||
|
@ -122,7 +122,7 @@ word = @_countList, @_countListFiltered, @_randomFromListFiltered, @_addToList,
|
|||
word = @_showParty, @_mmgr, @_setWindow1, @_setWindow2, @_setWindow3
|
||||
word = @_reboot, @_brk, @_encodeDice, @_rollDice
|
||||
word = @_setPlural, @_makeEnemy, @_getStringResponse, @_strcmpi, @_addEncounterZone, @_fatal
|
||||
word = @_pause
|
||||
word = @_pause, @_tossStrings
|
||||
|
||||
word = 0 // end of library functions
|
||||
|
||||
|
@ -158,6 +158,18 @@ magic = $2227 ; there are 2048 magic values that work; this one caught my
|
|||
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Temporary hack: after scriptDisplayStr is called, generated code calls this to clear the PLASMA
|
||||
// string pool. That way, many long strings can be used in a single function.
|
||||
asm _tossStrings
|
||||
lda framePtr
|
||||
sta outerFramePtr
|
||||
lda framePtr+1
|
||||
sta outerFramePtr+1
|
||||
dex
|
||||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API to call rendering engine (same API for raycaster and tile engine)
|
||||
asm initDisplay // params: mapNum, pMapData, x, y, dir
|
||||
|
@ -1551,6 +1563,7 @@ def _scriptDisplayStr(str)
|
|||
textDrawn = TRUE
|
||||
flipToPage1()
|
||||
displayStr(str)
|
||||
tossStrings()
|
||||
end
|
||||
|
||||
def _scriptDisplayStrNL(str)
|
||||
|
|
Loading…
Reference in New Issue
Block a user