Fix avatar establishment on game start.

This commit is contained in:
Martin Haye 2016-07-28 09:46:38 -07:00
parent 036fef041a
commit b848882090
3 changed files with 5 additions and 6 deletions

View File

@ -789,10 +789,10 @@ class A2PackPartitions
def numberAvatars(dataIn) def numberAvatars(dataIn)
{ {
def nFound = 0 def nFound = 0
dataIn.tile.each { tile -> dataIn.tile.sort{it.@name.toLowerCase()}.each { tile ->
def name = tile.@name def name = tile.@name
if (name.toLowerCase().contains("avatar")) if (name.toLowerCase().contains("avatar"))
avatars[name.toLowerCase().trim().replaceAll(/\s*-\s*[23][dD]\s*/, "")] = ++nFound avatars[name.toLowerCase().trim().replaceAll(/\s*-\s*[23][dD]\s*/, "")] = nFound++
} }
assert nFound >= 1 : "Need at least one 'Avatar' tile." assert nFound >= 1 : "Need at least one 'Avatar' tile."
} }
@ -808,7 +808,7 @@ class A2PackPartitions
def buf = ByteBuffer.allocate(50000) def buf = ByteBuffer.allocate(50000)
// Add each special tile to the set // Add each special tile to the set
dataIn.tile.each { tile -> dataIn.tile.sort{it.@name.toLowerCase()}.each { tile ->
def name = tile.@name def name = tile.@name
def id = tile.@id def id = tile.@id
def data = tiles[id] def data = tiles[id]

View File

@ -263,6 +263,7 @@ def newGame()
word playersModule, globalScriptsModule word playersModule, globalScriptsModule
initHeap(0) // initially empty heap initHeap(0) // initially empty heap
global = getGlobals() global = getGlobals()
global->b_curAvatar = 0
playersModule = mmgr(QUEUE_LOAD, MODULE_GEN_PLAYERS<<8 | RES_TYPE_MODULE) playersModule = mmgr(QUEUE_LOAD, MODULE_GEN_PLAYERS<<8 | RES_TYPE_MODULE)
globalScriptsModule = mmgr(QUEUE_LOAD, MODULE_GEN_GLOBAL_SCRIPTS<<8 | RES_TYPE_MODULE) globalScriptsModule = mmgr(QUEUE_LOAD, MODULE_GEN_GLOBAL_SCRIPTS<<8 | RES_TYPE_MODULE)
mmgr(FINISH_LOAD, LEAVE_OPEN) mmgr(FINISH_LOAD, LEAVE_OPEN)

View File

@ -45,7 +45,6 @@ include "diskops.plh"
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Data structures // Data structures
word fooStart
include "playtype.pla" include "playtype.pla"
word global // the global heap object, from which all live objects must be reachable word global // the global heap object, from which all live objects must be reachable
@ -1284,7 +1283,7 @@ end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
export def scriptSetAvatar(avatarTileNum) export def scriptSetAvatar(avatarTileNum)
global->b_curAvatar = avatarTileNum global->b_curAvatar = avatarTileNum
setAvatar(avatarTileNum) if renderLoaded; setAvatar(avatarTileNum); fin
end end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
@ -2468,7 +2467,6 @@ def startGame(ask)
mapIs3D = q_mapIs3D mapIs3D = q_mapIs3D
mapNum = q_mapNum mapNum = q_mapNum
q_mapNum = 0 q_mapNum = 0
global->b_curAvatar = 0
allowZoneInit = TRUE allowZoneInit = TRUE
initMap(q_x, q_y, q_dir) initMap(q_x, q_y, q_dir)
allowZoneInit = FALSE allowZoneInit = FALSE