Jump to content

problems with lifting STATES.BAM cycle limits via PVRZ format


Recommended Posts

As I've discussed with Mike1072, it would be a neat thing to do something about STATES.BAM mod incompatibilities. For those not aware STATES.BAM is a file responsible for showing graphic icons for states in character screen/portraits and it's related to STATDESC.2DA (responsible for showing messages).

Currently expanding STATES.BAM is not very popular for several reasons:
- there is no easy way to dynamically add new graphic files into existing BAM via weidu,
- there can be only one mod in installation that adds new icons via pre-made STATES.BAM - otherwise mod installed later will overwrite older file,
- there is limited amount of free icon slots due to BAM v1 limitation (255 cycles)

Divine Remix is very popular mod that comes with pre-made STATES.BAM, so rest of the modders are pretty much screwed when it comes to adding new state icons. So, what can be done to bypass this limitation, at least on EE games?
1. Converting STATES.BAM v1 to v2 (pvrz based) format which lifts limit for amount of cycles (which means we can add unlimited amount of new icons) and isn't limited to 256 colors.
2. Creating weidu function that will automatically expand STATES.BAM with provided images.

I'm not good enough to write a code for on the fly BAM editing, but Mike1072 mentioned that it's a lot simpler to do with PVRZ format, so maybe someone will be interested in this task.

Ok, enough with this long explanation, time to ask proper question :p I've converted STATES.BAM to v2 format and successfully added several new icons for my mod exceeding the original 255 cycles limitation. But for some reason the "level up" icon doesn't show up after doing so and I don't know why this is a case. I've kept the level up icon at the same cycle as it was originally placed, also tried to add it in the last cycle - in both cases this icon doesn't show up. Anyone know why or how to fix it? (edit: see below post)

I've attached pre-made PVRZ based STATES.BAM to this post. Here is code for PVRZ installation:

COPY ~test/STATES.bam~ ~override~
    LPF ~UPDATE_PVRZ_INDICES~ RET original_base_index new_base_index END
ACTION_IF original_base_index >= 0 AND new_base_index >= 0 BEGIN
    LAF ~INSTALL_PVRZ~ INT_VAR original_base_index new_base_index STR_VAR source_file = ~test/mos9000.pvrz~ END
    WARN ~Couldn't install PVRZ files~

Please let me know if you can figure out why this file doesn't work as expected for level up icon.


Link to comment

You can probably rule out PVRZ-based BAMs for now, because the Enhanced Editions are very inconsistent about where you can use the BAM V2 format. Apparently GUI-related BAMs, worldmap icons and possibly map background animations are allowed to be BAM V2. It doesn't work for (item, spell, ...) icons and visual effect however. I've just tested it with your STATES.BAM, which doesn't appear to work as well. No state icons are shown on portrait image. Icons on Record Screen do work though. Chances are that the next batch of EE patches may add full BAM V2 support, but I wouldn't count on it.

If Beamdog actually adds full BAM V2 support someday, then appending PVRZ-based BAMs shouldn't be too difficult as long as the icons to add are already PVRZ-encoded. However, you'll need some basic understanding of the underlying BC1/BC3 texture compression technique (aka DXT1/DXT5) to create WeiDU functions for it.

Link to comment

You are right, indeed. Silly me, level up icon doesn't show up on portrait because none of icons shows up on portrait after conversion - only on Record Screen. That's really unfortunate considering EE games has only few free cycle slots left - I've already exceeded the maximum amount, so can't even provide pre-made BAM v1 file with my mod. I think I will link to this topic on "Feature request" section of Beamdog forums. Hopefully someone will do something about it. Considering that one of The Divine Remix authors works for Beamdog I think they are aware why this is important thing to be implemented.


edit: topic created: https://forums.beamdog.com/discussion/44361/states-bam-v2-pvrz-support-for-portrait-icons?new=1

Thanks for help, argent77.

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...