binopan adjustments, get actor head size from the sprite

This commit is contained in:
minjaesong
2024-01-12 16:32:03 +09:00
parent a2f61a2be7
commit 3d71b5c619
6 changed files with 81 additions and 30 deletions

View File

@@ -80,19 +80,19 @@ object AssembleSheetPixmap {
return null
}
fun getMugshotFromAssetsDir(properties: ADProperties): TextureRegion? {
// TODO assemble from HAIR_FORE (optional), HAIR (optional) then HEAD (mandatory)
fun getMugshotFromAssetsDir(properties: ADProperties): Pair<Pixmap?, TextureRegion?> {
// assemble from HAIR_FORE (optional), HAIR (optional) then HEAD (mandatory)
val getter = getAssetsDirFileGetter(properties)
val headPixmap = getPartPixmap(getter, "HEAD")
val hairPixmap = getPartPixmap(getter, "HAIR")
val hair2Pixmap = getPartPixmap(getter, "HAIR_FORE")
if (headPixmap == null) throw FileNotFoundException("Bodyparts file of HEAD is not found!")
return composeMugshot(properties, headPixmap, hairPixmap, hair2Pixmap)
if (headPixmap == null) return null to null//throw FileNotFoundException("Bodyparts file of HEAD is not found!")
return headPixmap to composeMugshot(properties, headPixmap, hairPixmap, hair2Pixmap)
}
fun getMugshotFromVirtualDisk(disk: SimpleFileSystem, entrynum: Long, properties: ADProperties): TextureRegion? {
// TODO assemble from HAIR_FORE (optional), HAIR (optional) then HEAD (mandatory)
fun getMugshotFromVirtualDisk(disk: SimpleFileSystem, entrynum: Long, properties: ADProperties): Pair<Pixmap?, TextureRegion?> {
// assemble from HAIR_FORE (optional), HAIR (optional) then HEAD (mandatory)
val bodypartMapping = Properties()
bodypartMapping.load(ByteArray64Reader(disk.getFile(entrynum)!!.bytes, Common.CHARSET))
val getter = getVirtualDiskFileGetter(bodypartMapping, disk)
@@ -100,8 +100,8 @@ object AssembleSheetPixmap {
val hairPixmap = getPartPixmap(getter, "HAIR")
val hair2Pixmap = getPartPixmap(getter, "HAIR_FORE")
if (headPixmap == null) throw FileNotFoundException("Bodyparts file of HEAD is not found!")
return composeMugshot(properties, headPixmap, hairPixmap, hair2Pixmap)
if (headPixmap == null) return null to null//throw FileNotFoundException("Bodyparts file of HEAD is not found!")
return headPixmap to composeMugshot(properties, headPixmap, hairPixmap, hair2Pixmap)
}
private fun composeMugshot(properties: ADProperties, head: Pixmap, hair: Pixmap?, hair2: Pixmap?): TextureRegion {
@@ -125,7 +125,7 @@ object AssembleSheetPixmap {
val tr = TextureRegion(Texture(canvas))
canvas.dispose()
head.dispose()
// head.dispose()
hair?.dispose()
hair2?.dispose()