Changed swapTile to copyTile, since that's how we effectively use it in the game, and makes for a consistent outcome every time.

This commit is contained in:
Martin Haye 2018-03-07 08:49:21 -08:00
parent 4391114680
commit 07c810e294
6 changed files with 15 additions and 22 deletions

View File

@ -939,14 +939,14 @@ if (typeof Mythos === "undefined") {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.appendDummyInput()
.appendField("Swap tile from X/Y")
.appendField("Copy tile from X/Y")
.appendField(new Blockly.FieldTextInput(""), "FROM_X")
.appendField(new Blockly.FieldTextInput(""), "FROM_Y")
.appendField("to X/Y")
.appendField(new Blockly.FieldTextInput(""), "TO_X")
.appendField(new Blockly.FieldTextInput(""), "TO_Y");
this.setOutput(false);
this.setTooltip('Swap the map tile between two locations');
this.setTooltip('Copy a map tile from one spot to another (overwriting the latter)');
}
};
Blockly.Blocks['graphics_clr_portrait'] = {

View File

@ -3824,7 +3824,7 @@ end
case 'graphics_set_avatar':
packSetAvatar(blk); break
case 'graphics_swap_tile':
packSwapTile(blk); break
packCopyTile(blk); break
case 'graphics_intimate_mode':
packIntimateMode(blk); break
case 'variables_set':
@ -4394,7 +4394,7 @@ end
outIndented("scriptSetAvatar(${avatars[tileName.toLowerCase()]})\n")
}
def packSwapTile(blk)
def packCopyTile(blk)
{
assert blk.field.size() == 4
assert blk.field[0].@name == 'FROM_X'
@ -4405,7 +4405,7 @@ end
def fromY = blk.field[1].text().toInteger()
def toX = blk.field[2].text().toInteger()
def toY = blk.field[3].text().toInteger()
outIndented("scriptSwapTile($fromX, $fromY, $toX, $toY)\n")
outIndented("scriptCopyTile($fromX, $fromY, $toX, $toY)\n")
}
def packIntimateMode(blk)

View File

@ -104,10 +104,10 @@ import gamelib
predef roomInPack(p_player)#1
predef scanForNamedObj(p_obj, name)#1
predef scriptCombat(mapCode)#1
predef scriptCopyTile(fromX, fromY, toX, toY)#0
predef scriptDisplayStr(str)#0
predef scriptEvent(event, param)#0
predef scriptSetAvatar(avatarTileNum)#0
predef scriptSwapTile(fromX, fromY, toX, toY)#0
predef select(p, sel, num)#1
predef setCmd(key, func)#0
predef setCursor(x, y)#0

View File

@ -297,7 +297,7 @@ asm setAvatar(tileNum)#0 // tile number (in the global tileset)
+asmPlasmNoRet 1
jmp $6021
end
asm swapTile(fromX, fromY, toX, toY)#0
asm copyTile(fromX, fromY, toX, toY)#0
+asmPlasmNoRet 4
jmp $6024
end
@ -2731,9 +2731,9 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Called by scripts to swap a map tile. We set a flag noting we need to re-render, then use an
// assembly routine to do the work.
export def scriptSwapTile(fromX, fromY, toX, toY)#0
export def scriptCopyTile(fromX, fromY, toX, toY)#0
needRender = TRUE
swapTile(fromX, fromY, toX, toY)
copyTile(fromX, fromY, toX, toY)
end
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -40,7 +40,7 @@ NOTFLG_SPRITE = $FF-$80
jmp pl_texControl ; params: 0=unload textures, 1=load textures
jmp pl_getScripts ; params: none
jmp pl_setAvatar ; params: A=tile number
jmp pl_swapTile ; params: fromX, fromY, toX, toY
jmp pl_copyTile ; params: fromX, fromY, toX, toY
; Conditional assembly flags
DEBUG = 0 ; 1=some logging, 2=lots of logging
@ -1872,11 +1872,11 @@ pl_advance: !zone
rts
;-------------------------------------------------------------------------------
; Swap tiles at two positions.
; Copy a tile (destructively) from one position to another
; Params: fromX, fromY, toX, toY
; 3 2 1 0
; Return: none
pl_swapTile: !zone
pl_copyTile: !zone
; Grab stuff from the PLASMA eval stack
lda evalStkL+3,x ; fromX
sta tmp
@ -1907,19 +1907,12 @@ pl_swapTile: !zone
lda (pMap,x) ; grab fromTile
sta tmp+1
lda (pTmp),y ; grab toTile
sta tmp
eor tmp+1 ; grab all bits from fromTile
and #FLG_AUTOMAP ; except automap mark
eor tmp+1
sta (pTmp),y ; save toTile
lda tmp+1
eor tmp ; grab all bits from toTile
and #FLG_AUTOMAP ; except automap mark
eor tmp
sta (pMap,x) ; save fromTile
rts ; all done
;-------------------------------------------------------------------------------

View File

@ -119,7 +119,7 @@ next_zp = $AD
JMP pl_texControl ; params: 1=load, 0=unload
JMP pl_getScripts ; params: none
JMP pl_setAvatarTile ; params: A=tile number
JMP pl_swapTile ; params: fromX, fromY, toX, toY
JMP pl_copyTile ; params: fromX, fromY, toX, toY
;----------------------------------------------------------------------
; >> START LOADING MAP SECTIONS
@ -1201,10 +1201,10 @@ pl_setColor:
rts
;----------------------------------------------------------------------
; >> pl_swapTile
; >> pl_copyTile
; Not yet implemented for 2D mode, because very complex due to map
; segmenting.
pl_swapTile:
pl_copyTile:
+prChr 'T'
brk