Suggestion: Custom bitmap sheets

Hello there,
I'd love to be able to create hud icons for my weapon costumes but the problem we currently have with mods that alter existing bitmap sheets is that they aren't compatible with one another. On my quest to create a weapon mod that reaches DLC quality I put some thought into this issue.

Through experimenting, I think I now understand how the game handles weapon icons: First, it takes a bitmap sheet (e.g. ui_bms_store_weapon_costumes.cvbm_pc), separates it into several bitmaps in a way specified in the corresponding *.xtbl (e.g. ui_bms_store_weapon_costumes.xtbl) and loads them into some sort of a bitmap pool. For every weapon costume the game fishes two bitmaps out again - one for the icon displayed in your on-foot-inventory and one for the icon displayed in shops (which is kind of confusing since those two icons are exactly the same). The two bitmaps in question have to follow a naming convention: the bitmap loaded for the store icon has to be named just like the other one but with an extra "_c".
Let's say I have an items_inventory.xtbl like this:
Code:
<root>
<Table>
    <Inventory_Item>
        <Name>baseball_skateboard</Name>
        ...
        <Bitmap>ui_hud_inv_s_melee_skateboard</Bitmap>
        ...
        </Inventory_Item>
    </Table>
</root>
SR IV will now scan its bitmap pool for the two bitmaps called ui_hud_inv_s_melee_skateboard and ui_hud_inv_s_melee_skateboard_c. But how do we get those two icons in there? That's where it's getting interesting.

I propose the mod parsing code to look for custom bitmap sheets. For example, the algorithm could scan modded packfiles for *.cvbm_pc/*.gvbm_pc files with names starting with something like "mod_bms_" and load them in in case there's an *.xtbl named the same way. This *.xtbl would then contain information on how to separate the bitmap sheet into several bitmaps.

For example, let's assume the contents of my mod packfile looked like this:
mod_bms_skateboard.cvbm_pc
mod_bms_skateboard.gvbm_pc
mod_bms_skateboard.xtbl
items_inventory.xtbl

Mod_bms_skateboard.cvbm_pc and mod_bms_skateboard.gvbm_pc would contain a bitmap sheet containing several weapon icons. The items_inventory.xtbl would look like the one above and mod_bms_skateboard.xtbl would look like this:
Code:
<root>
<Table>
    <BitmapSheets>
        <Name>mod_bms_skateboard</Name>
        <Images>
            <Properties>
                <Name>ui_hud_inv_s_melee_skateboard</Name>
                <StartX>0</StartX>
                <StartY>0</StartY>
                <ImageWidth>200</ImageWidth>
                <ImageHeight>200</ImageHeight>
                </Properties>
            <Properties>
                <Name>ui_hud_inv_s_melee_skateboard_c</Name>
                <StartX>0</StartX>
                <StartY>0</StartY>
                <ImageWidth>200</ImageWidth>
                <ImageHeight>200</ImageHeight>
                </Properties>

             ...


        </Images>
    </BitmapSheets>
</Table>
</root>

This way modders could easily load new ui elements into the bitmap pool without experiencing any incompatibilities.

I hope this proposal was somewhat understandable. Don't hesitate to ask questions if something is unclear. Thanks for reading!
 
Anyone else reading this, please note that this is how you request something. I know exactly what he's trying to do with lots of information about how things work now and how he would like them to work. This really makes it easy for me to spend 10 minutes looking into it instead of 2 hours. Please try to do this for your reports as well.

Now on to the actual question. Yes, the existing stuff seems to use bitmap sheets. For a weapon costume it does append _c to the name in lua before making the request...I assume to get a unique asset? I'm not sure why...I see that the icon for the hud can be a texture, so you could do that now with a an always loaded peg with a texture named that inside. The store stuff does require a bitmap sheet though. Our options there are to either switch it to allow either(looks...complicated) or support loading an arbitrary number of bitmap sheets. I'd probably go the bitmap sheet way, but it's hard to say until I talk to some interface guys and/or just try it.

I'm interested to see how dlc did bitmap sheets. I don't see any dlc code in here.
 
Looks like "// for DLC, the icons are on the AL sheet, so pretend this is a non-streaming weapon". So I guess we shipped with the dlc icons in the main game? Anyway, shouldn't be too tough to make bitmap sheets work for modding.
 
I guess we shipped with the dlc icons in the main game?
Kind of. You just kept patching old bitmap sheets as new dlc was released. All icons for (streaming weapon) dlc costumes that weren't available on day one can be found in
ui_bms_store_weapon_costumes.str2_pc, located in the patch_uncompressed packfile. I attached the extracted bitmap and its .xtbl for you.

Non-streaming weapon costumes work differently. I think those use only one bitmap for both the inventory and weapon stores.
 

Attachments

  • ui_bms_store_weapon_costumes.xtbl
    13.6 KB · Views: 448
  • ui_bms_store_weapon_costumes.png
    ui_bms_store_weapon_costumes.png
    370.9 KB · Views: 502
Last edited:
This is a little more complicated than I thought. It looks like some systems are doing some bad things with the id's from the bitmap sheet system and passing them down through lua. I'm talking with the interface guys about how all this works so I can get it right.
 
The store stuff does require a bitmap sheet though.
Huh, that's what I thought. Well, I just proved me wrong.
2015-04-01_00001.jpg 2015-04-01_00002.jpg 2015-04-01_00003.jpg
However, I had to do some hacky stuff to get this result. It involved some nasty hex editing and using tools in a way they weren't meant to be used. Having bitmap sheets could definitely speed up this process, but since we're apparently able to get weapon icons working anyway, I'd say they have less priority now. Anyways, thank you very much for helping me so far!
The working mod is attached below.
 

Attachments

  • skateboard_mod+icons.vpp_pc
    2.5 MB · Views: 470
Last edited:
Huh, that's what I thought. Well, I just proved me wrong.
View attachment 9579 View attachment 9580 View attachment 9581
Anyways, I had to do some hacky stuff to get this result. It involved some nasty hex editing and using tools in a way they weren't meant to be used. Having bitmap sheets could definitely speed up this process, but since we're apparently able to get weapon icons working anyway, I'd say they have less priority now. Anyways, thank you very much for helping me so far!
The working mod is attached below.
If you managed to get that working, it'd be good to share how :)
 
Back
Top