players loads their sprites now

This commit is contained in:
minjaesong
2021-10-13 16:18:27 +09:00
parent f28fabb8b5
commit 03a854ca58
11 changed files with 46 additions and 21 deletions

View File

@@ -135,13 +135,13 @@ object ReadActor {
if (actor is Pocketed)
actor.inventory.actor = actor
if (actor is ActorWithBody && actor is HasAssembledSprite) {
if (actor is ActorWithBody && actor is IngamePlayer) {
val animFile = disk.getFile(-2L)
val animFileGlow = disk.getFile(-3L)
val bodypartsFile = disk.getFile(-1025)
actor.sprite = SpriteAnimation(actor)
if (animFileGlow != null) actor.spriteGlow = SpriteAnimation(actor)
val bodypartsFile = disk.getFile(-1025)
if (bodypartsFile != null)
actor.reassembleSprite(
@@ -159,6 +159,13 @@ object ReadActor {
if (animFileGlow == null) null else ADProperties(ByteArray64Reader(animFileGlow.bytes, Common.CHARSET))
)
}
else if (actor is ActorWithBody && actor is HasAssembledSprite) {
if (actor.animDesc != null) actor.sprite = SpriteAnimation(actor)
if (actor.animDescGlow != null) actor.spriteGlow = SpriteAnimation(actor)
actor.reassembleSprite(actor.sprite, actor.animDesc, actor.spriteGlow, actor.animDescGlow)
}
return actor
}

View File

@@ -140,6 +140,8 @@ object LoadSavegame {
val newIngame = TerrarumIngame(App.batch)
val player = ReadActor.invoke(playerDisk, ByteArray64Reader(playerDisk.getFile(-1L)!!.bytes, Common.CHARSET)) as IngamePlayer
printdbg(this, "Player localhash: ${player.localHashStr}, hasSprite: ${player.sprite != null}")
val currentWorldId = player.worldCurrentlyPlaying
val worldDisk = worldDisk0 ?: App.savegameWorlds[currentWorldId]!!
val world = ReadWorld(ByteArray64Reader(worldDisk.getFile(-1L)!!.bytes, Common.CHARSET))