mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-31 12:30:01 +00:00
Added a new 'promptAnyKey' block to save space and time.
This commit is contained in:
parent
cda4387507
commit
a2425e0751
@ -124,6 +124,7 @@
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_getanykey"></block>
|
||||
<block type="text_promptanykey"></block>
|
||||
<!--<block type="text_mode"></block>-->
|
||||
<!--<block type="text_scroll"></block>-->
|
||||
<block type="text"></block>
|
||||
|
@ -535,18 +535,30 @@ if (typeof Mythos === "undefined") {
|
||||
this.setTooltip('Get a key from the keyboard (and discard it)');
|
||||
}
|
||||
};
|
||||
Blockly.Blocks['text_mode'] = {
|
||||
Blockly.Blocks['text_getanykey'] = {
|
||||
init: function () {
|
||||
this.setHelpUrl(Mythos.helpUrl);
|
||||
this.setColour(54);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
var textModes = new Blockly.FieldDropdown([['Normal', 0], ['Inverse', 1]]);
|
||||
this.appendDummyInput()
|
||||
.appendField("Text Mode")
|
||||
.appendField(textModes, "MODE");
|
||||
.appendField("Get any key");
|
||||
this.setOutput(false);
|
||||
this.setTooltip('Print text and leave cursor at end of last printed character');
|
||||
this.setTooltip('Get a key from the keyboard (and discard it)');
|
||||
}
|
||||
};
|
||||
Blockly.Blocks['text_promptanykey'] = {
|
||||
init: function () {
|
||||
this.setHelpUrl(Mythos.helpUrl);
|
||||
this.setColour(54);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.appendDummyInput()
|
||||
.appendField("Prompt for key")
|
||||
.appendField(new Blockly.FieldDropdown([["with", "1"], ["without", "0"]]), "CLEAR")
|
||||
.appendField("clear");
|
||||
this.setOutput(false);
|
||||
this.setTooltip('Prompt "(press any key)", wait for key, optionally clear window after');
|
||||
}
|
||||
};
|
||||
Blockly.Blocks['text_clear_window'] = {
|
||||
|
@ -1830,7 +1830,7 @@ class A2PackPartitions
|
||||
|
||||
/** Iterate an array of maps, adding them one at a time until we get to one
|
||||
* that won't fit. The maps list is modified to remove all that were accepted.
|
||||
* Returns [chunks, spaceRemaining]
|
||||
* Returns [chunks, spaceUsed, spaceRemaining]
|
||||
*/
|
||||
def fillDisk(int partNum, int availBlks, ArrayList<String> maps, Set<String> toDupe)
|
||||
{
|
||||
@ -1904,7 +1904,7 @@ class A2PackPartitions
|
||||
}
|
||||
reportWriter.println String.format(" %-22s: %6.1fK", "unused", (availBlks*512 - spaceUsed) / 1024.0)
|
||||
reportWriter.println "Total: 140K"
|
||||
return [outChunks, spaceUsed]
|
||||
return [outChunks, spaceUsed, availBlks*512 - spaceUsed]
|
||||
}
|
||||
|
||||
def recordChunks(typeName, nameToData) {
|
||||
@ -2029,7 +2029,10 @@ class A2PackPartitions
|
||||
def mapsToDupe = allMaps.grep{ it.name != "<root>" && it.order < 0 }.collect{ it.name }.toSet()
|
||||
def mapsTodo = allMaps.collect { it.name }
|
||||
def partChunks = []
|
||||
def totalFloppySpace = 0
|
||||
def totalUnused = 0
|
||||
for (int partNum=1; partNum<=MAX_DISKS && !mapsTodo.isEmpty(); partNum++) {
|
||||
totalFloppySpace += (FLOPPY_SIZE * 512)
|
||||
int availBlks = FLOPPY_SIZE - DOS_OVERHEAD
|
||||
availBlks -= AC_KLUDGE // AppleCommander currently unable to allocate last block
|
||||
if (partNum == 1) {
|
||||
@ -2042,10 +2045,13 @@ class A2PackPartitions
|
||||
availBlks -= calcSaveGameBlks()
|
||||
}
|
||||
|
||||
def (chunks, spaceUsed) = fillDisk(partNum, availBlks, mapsTodo, mapsToDupe)
|
||||
def (chunks, spaceUsed, spaceUnused) = fillDisk(partNum, availBlks, mapsTodo, mapsToDupe)
|
||||
partChunks << [partNum:partNum, chunks:chunks, spaceUsed:spaceUsed]
|
||||
totalUnused += spaceUnused
|
||||
}
|
||||
assert allMaps.isEmpty : "All data must fit within $MAX_DISKS disks."
|
||||
reportWriter.println String.format("\nTotal space on floppies: %6.1fK", totalFloppySpace / 1024.0)
|
||||
reportWriter.println String.format("Total unused on floppies: %6.1fK", totalUnused / 1024.0)
|
||||
|
||||
// If any stories, add them in a special final chunk.
|
||||
if (stories.size() > 0) {
|
||||
@ -4717,6 +4723,8 @@ end
|
||||
packClearWindow(blk); break
|
||||
case 'text_getanykey':
|
||||
packGetAnyKey(blk); break
|
||||
case 'text_promptanykey':
|
||||
packPromptAnyKey(blk); break
|
||||
case 'controls_if':
|
||||
packIfStmt(blk); break
|
||||
case 'flow_repeat':
|
||||
@ -4853,7 +4861,7 @@ end
|
||||
outIndented("if isFloppyVer\n")
|
||||
++indent
|
||||
outTextBlock(blk.value[1].block, false)
|
||||
outIndented("promptAnyKeyAndClear()\n")
|
||||
outIndented("promptAnyKey(TRUE)\n") // TRUE = clear after
|
||||
--indent
|
||||
|
||||
// On 800k or hard drive builds, follow the intro with the full (long) text
|
||||
@ -4889,6 +4897,13 @@ end
|
||||
outIndented("getUpperKey()\n")
|
||||
}
|
||||
|
||||
def packPromptAnyKey(blk)
|
||||
{
|
||||
def clrFlg = getSingle(blk.field, 'CLEAR').text()
|
||||
assert clrFlg == "0" || clrFlg == "1"
|
||||
outIndented("promptAnyKey($clrFlg)\n")
|
||||
}
|
||||
|
||||
def packVarSet(blk)
|
||||
{
|
||||
def name = "v_" + humanNameToSymbol(getSingle(blk.field, 'VAR'), false)
|
||||
|
@ -92,7 +92,7 @@ import gamelib
|
||||
predef printf3(fmt, arg1, arg2, arg3)#0
|
||||
predef printHex(num)#0
|
||||
predef printMem()#1
|
||||
predef promptAnyKeyAndClear()#0
|
||||
predef promptAnyKey(clearAfter)#0
|
||||
predef puts(str)#0
|
||||
predef queue_setMap(is3D, num, x, y, dir)#0
|
||||
predef queue_teleport(x, y, dir)#0
|
||||
|
@ -2218,10 +2218,10 @@ def _scriptDisplayStr(str)#0
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export def promptAnyKeyAndClear()#0
|
||||
export def promptAnyKey(clearAfter)#0
|
||||
scriptDisplayStr("\n(press any key)")
|
||||
getUpperKey
|
||||
clearWindow
|
||||
if clearAfter; clearWindow; fin
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user