Avoid ending screens on disk 1 - this saves a lot of space overall due to increased shared portraits. Allow diskLimit=8 to mean 'no limit' (zero also works). Fix problems with stat getting. Fix extra UI frame image when switching full screens.

This commit is contained in:
Martin Haye 2021-09-03 08:46:24 -07:00
parent dd62fd88dd
commit 02ec4842ba
4 changed files with 26 additions and 5 deletions

View File

@ -1970,7 +1970,7 @@ class A2PackPartitions
tmp.put((byte)(combinedVersion.length()))
combinedVersion.getBytes().each { b -> tmp.put((byte)b) }
// Then output 2D maps, 3d maps, and portraits
// Then output 2D maps, 3d maps, portraits, and full screen images
tmp.put((byte) maps2D.size())
maps2D.each { k, v ->
tmp.put((byte) calcDiskBits(chunkDisks[["map2D", k].toString()]))
@ -1986,6 +1986,11 @@ class A2PackPartitions
tmp.put((byte) calcDiskBits(chunkDisks[["portrait", k.toLowerCase()].toString()]))
}
tmp.put((byte) frames.size())
frames.each { k, v ->
tmp.put((byte) calcDiskBits(chunkDisks[["frame", k.toLowerCase()].toString()]))
}
// Stick on the partition number of the stories (used by non-floppy builds)
tmp.put((byte) 1)
tmp.put((byte) (1<<(storyPartition-1)))
@ -2909,6 +2914,8 @@ class A2PackPartitions
assert field.size() == 1
assert field[0].@name == "NUM"
diskLimit = field[0].text().toInteger()
if (diskLimit >= 8) // Seth likes to set it to 8 to mean no limit
diskLimit = 0
}
}
}
@ -3148,7 +3155,8 @@ class A2PackPartitions
addEntireToCache("frames", frames, hash)
}
frames.each { k,v ->
addResourceDep("map", "<root>", "frame", k)
if (k.toLowerCase() =~ /frame|title/)
addResourceDep("map", "<root>", "frame", k)
}
hash = calcImagesHash(textureImgs)

View File

@ -255,6 +255,9 @@ def _startup()#1
// Record the disk limit
diskLimit = callGlobalFunc(GS_DISK_LIMIT, 0, 0, 0)
if diskLimit >= 8 // Seth likes to set it to 8 to mean "no limit"
diskLimit = 0
fin
// All done.
return 0

View File

@ -1771,6 +1771,11 @@ export def loadFrameImg(img)#0
if frameLoaded == img; return; fin
// Free prev img and/or portrait (if any)
if curFullscreenImg
// must clear img directly, to avoid loading main frame img only to replace it
auxMmgr(FREE_MEMORY, curFullscreenImg)
curFullscreenImg = NULL
fin
clearPortrait()
// Make room in aux mem by throwing out textures
@ -1778,7 +1783,7 @@ export def loadFrameImg(img)#0
// Load the image data into aux mem
if img
auxMmgr(START_LOAD, 1) // partition 1 is where full screen images live
auxMmgr(START_LOAD, lookupResourcePart(4, img))
if img == 1
auxMmgr(SET_MEM_TARGET, $4000) // well above where expander loads at startup
fin
@ -3505,9 +3510,11 @@ export def getStat(player, statName)#1
is streqi(statName, @S_AIMING); return player->b_aiming
is streqi(statName, @S_HAND_TO_HAND); return player->b_handToHand
is streqi(statName, @S_DODGING); return player->b_dodging
is streqi(statName, @S_XP); return player=>w_curXP
is streqi(statName, @S_GOLD); return global=>w_gold
is streqi(statName, @S_TIME); return global->b_hour
is streqi(statName, @S_SP); return player->b_skillPoints
is streqi(statName, @S_PACK_SIZE); return player->b_packSize
is streqi(statName, @S_BANK_BAL); return global=>w_bankBal
wend
pSkill = scanForNamedObj(player=>p_skills, statName)
if pSkill; return pSkill=>w_modValue; fin
@ -3591,9 +3598,12 @@ export def setStat(player, statName, val)#0
is streqi(statName, @S_AIMING); player->b_aiming = clampByte(val); break
is streqi(statName, @S_HAND_TO_HAND); player->b_handToHand = clampByte(val); break
is streqi(statName, @S_DODGING); player->b_dodging = clampByte(val); break
is streqi(statName, @S_GOLD); global=>w_gold = max(0, val); needShowParty = TRUE; break
is streqi(statName, @S_TIME); setHour(val); break;
is streqi(statName, @S_XP); addXP(player, val - player=>w_curXP); needShowParty = TRUE; break
is streqi(statName, @S_SP); player->b_skillPoints = clampByte(max(0, val)); needShowParty = TRUE; break
is streqi(statName, @S_PACK_SIZE); player->b_packSize = clampByte(max(player->b_packSize, val)); break
is streqi(statName, @S_BANK_BAL); global=>w_bankBal = val; break
otherwise
pSkill = scanForNamedObj(player=>p_skills, statName)
if pSkill

View File

@ -86,7 +86,7 @@ end
def loadStory(storyNum)#0
byte storyPart
word pAuxText, pEnd, pSrc, pDst, len
storyPart = lookupResourcePart(4, 1) // special section just to record the partition
storyPart = lookupResourcePart(5, 1) // special section just to record the partition of stories
if !storyPart; fatal("lkupFail2"); fin
auxMmgr(START_LOAD, storyPart)
pAuxText = auxMmgr(QUEUE_LOAD, storyNum<<8 | RES_TYPE_STORY)