mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-26 00:29:30 +00:00
More fleshing out of global function calling.
This commit is contained in:
parent
4d414bd6ce
commit
9d849736e2
|
@ -1925,7 +1925,17 @@ class A2PackPartitions
|
|||
}
|
||||
}
|
||||
}
|
||||
return buf.toString()
|
||||
def result = buf.toString()
|
||||
if (result.length() > 18)
|
||||
{
|
||||
// PLASMA's compiler has a silent limit on the number of significant
|
||||
// characters in a symbol. To make the symbol short enough but still
|
||||
// significant, calculate a digest and replace the excess characters
|
||||
// with part of it.
|
||||
def bigHash = Integer.toString(result.hashCode(), 36)
|
||||
result = result.substring(0, 13) + "_" + bigHash.substring(bigHash.length() - 4)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
def parseDice(str)
|
||||
|
@ -2802,8 +2812,9 @@ end
|
|||
out << "include \"../plasma/gamelib.plh\"\n"
|
||||
out << "include \"../plasma/globalDefs.plh\"\n"
|
||||
out << "include \"../plasma/playtype.plh\"\n"
|
||||
out << "include \"../plasma/gen_images.plh\"\n\n"
|
||||
out << "include \"../plasma/gen_items.plh\"\n\n"
|
||||
out << "include \"../plasma/gen_images.plh\"\n"
|
||||
out << "include \"../plasma/gen_items.plh\"\n"
|
||||
out << "include \"../plasma/gen_modules.plh\"\n"
|
||||
out << "include \"../plasma/gen_players.plh\"\n\n"
|
||||
out << "word global\n"
|
||||
}
|
||||
|
@ -2996,6 +3007,8 @@ end
|
|||
packChangeFlag(blk); break
|
||||
case 'interaction_pause':
|
||||
packPause(blk); break
|
||||
case ~/^Globalignore_.*$/:
|
||||
packGlobalCall(blk); break
|
||||
default:
|
||||
printWarning "don't know how to pack block of type '${blk.@type}'"
|
||||
}
|
||||
|
@ -3139,6 +3152,19 @@ end
|
|||
time = 32767
|
||||
outIndented("pause($time)\n")
|
||||
}
|
||||
|
||||
def packGlobalCall(blk)
|
||||
{
|
||||
def m = blk.@type =~ /^Globalignore_(.*)$/
|
||||
def funcName = m ? m.group(1) : null
|
||||
assert funcName
|
||||
println "Global call: name='$funcName'"
|
||||
def varName = "m_${humanNameToSymbol(funcName, false)}"
|
||||
variables << varName
|
||||
outIndented("$varName = loadGlobalFunc(MODULE_GEN_GS_${humanNameToSymbol(funcName, true)})\n")
|
||||
outIndented("$varName()(\"hello\")\n")
|
||||
outIndented("unloadGlobalFunc($varName)\n")
|
||||
}
|
||||
|
||||
def packGetStat(blk)
|
||||
{
|
||||
|
|
4
Platform/Apple/virtual/bm
Executable file
4
Platform/Apple/virtual/bm
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd /Users/mhaye/plat/PackPartitions && rm -f dist/PackPartitions.jar && ant jar
|
||||
cd /Users/mhaye/virtual && ./m
|
4
Platform/Apple/virtual/bmg
Executable file
4
Platform/Apple/virtual/bmg
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd /Users/mhaye/plat/PackPartitions && rm -f dist/PackPartitions.jar && ant jar
|
||||
cd /Users/mhaye/virtual && ./mg
|
|
@ -29,6 +29,7 @@ import gamelib
|
|||
predef setGameFlag, getGameFlag, scriptSetAvatar, parseDecWithDefault, readStr
|
||||
predef addPlayerToParty, removePlayerFromParty, partyHasPlayer, loadFrameImg, loadMainFrameImg
|
||||
predef scriptSwapTile, setIntimateMode, fontCmd, setIntimateMode
|
||||
predef loadGlobalFunc, unloadGlobalFunc
|
||||
|
||||
/////////// Shared string constants //////////////
|
||||
|
||||
|
|
|
@ -1934,6 +1934,21 @@ def returnFromEngine()
|
|||
fin
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export def loadGlobalFunc(moduleNum)
|
||||
word ptr
|
||||
flipToPage1()
|
||||
mmgr(START_LOAD, 1) // code is in partition 1
|
||||
ptr = mmgr(QUEUE_LOAD, moduleNum<<8 | RES_TYPE_MODULE)
|
||||
mmgr(FINISH_LOAD, 0)
|
||||
return ptr
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export def unloadGlobalFunc(pModule)
|
||||
mmgr(FREE_MEMORY, pModule)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load the Party engine and show data for the given player
|
||||
def showPlayerSheet(num)
|
||||
|
|
Loading…
Reference in New Issue
Block a user