XML:TXMB: Difference between revisions
Paradox-01 (talk | contribs) m (ignore this) |
Script 10k (talk | contribs) (automatically loaded TXMB) |
||
Line 144: | Line 144: | ||
return splitSizes; | return splitSizes; | ||
}</code> | }</code> | ||
===automatically loaded TXMB=== | |||
There are three TXMB that are automatically loaded (if they exist) by the engine on specific events: | |||
* TXMBintro_splash_screen | |||
** loaded at a savepoint load | |||
* TXMBwin_splash_screen | |||
** loaded when win (bsl function) is called | |||
* TXMBfail_splash_screen | |||
** loaded when lose (bsl function) is called | |||
Those files are level specific. If they are not provided the engine skips them. | |||
{{XML}} | {{XML}} |
Revision as of 21:15, 15 August 2019
TXMB : Texture Map Big | ||
---|---|---|
XML
TRSC << Other file types >> AITR |
general information
640x480 made of ... _0 - 256x256 _1 - 256x256 _2 - 128x256 _3 - 256x224 _4 - 256x224 _5 - 128x224 +-----+-----+---+ | _0 | _1 |_2 | | | | | | | | | +---------------+ | _3 | _4 |_5 | | | | | +---------------+ |
1024x768 made of ... _0 - 256x256 _1 - 256x256 _2 - 256x256 _3 - 256x256 _4 - 256x256 _5 - 256x256 _6 - 256x256 _7 - 256x256 _8 - 256x256 _9 - 256x256 _10 - 256x256 _11 - 256x256 +-----+-----+-----+-----+ | _0 | _1 | _2 | _3 | | | | | | +-----------------+-----+ | _4 | _5 | _6 | _7 | | | | | | +-----------------+-----+ | _8 | _9 | _10 | _11 | | | | | | +-----------------+-----+ |
- The xml code on this page is compatible with onisplit v0.9.61.0
- TXMB files are splash screens which we see at level start, and at end (one for losing the level and one for winning).
- A TXMB file hold links to TXMPs which then together make a big picture.
This is needed because the current max resolution for a single TXMP on PC is 512x512 and on Mac 1024x1024. (9 April 2012) - The number of columns and rows (TXMPs) is computed at runtime.
Probably the engine checks the horizontal dimension of the TXMPs until the desired x size is reached and then starts a new row.
So it should be possible to create also other TXMB resolutions and TXMP constellations. - They are called by BSL command "splash_screen image_name".
They can be called whenever we like to. The game will be paused then.
Example TXMB -- TXMBwin_splash_screen.xml (from level1_Final/NoGlobal)
<?xml version="1.0" encoding="utf-8"?> <Oni> <TXMB id="0"> <Width>640</Width> <Height>480</Height> <Textures> <Link>TXMPlevel01_win_0</Link> <Link>TXMPlevel01_win_1</Link> <Link>TXMPlevel01_win_2</Link> <Link>TXMPlevel01_win_3</Link> <Link>TXMPlevel01_win_4</Link> <Link>TXMPlevel01_win_5</Link> </Textures> </TXMB> </Oni>
Example TXMP -- TXMPlevel01_win_0.xml (from level1_Final/NoGlobal)
<?xml version="1.0" encoding="utf-8"?> <Oni> <Texture> <Flags>DisableUWrap DisableVWrap</Flags> <Format>BGR555</Format> <Image>TXMPlevel01_win_0.tga</Image> </Texture> </Oni>
Creating a TXMB:
You can use Vago to create TXMB and respectively their TXMP with the "background image wizard".
In Vago click "Tools" menu -> "Background Image Wizard". Follow the instructions.
Alternatively you can create the files manually using the following process.
Example on creating a 640x480 TXMB:
- The actual work is to split the image into six smaller.
- Here's a method for Photoshop -- .tif should also work with any other layer supporting grafic programm.
- The six-part colored layer should be a help when the program cannot load a selection.
- Let's drag'n'drop our image into this TXMB barebone (.psd / .tif) and bring it into center position.
- Now we can right-click, load a selection, crop and save it as "..._N" (whereas N is a number from 0 to 5).
- Let's redo crop, load another selection, save this piece, and so on.
Algorithm to split images to fit in TXMB:
The following algorithm seems to work correctly and generate resolutions that are the same used in Vanilla oni. The algorithm is currently used in Vago for TXMB creation. It works as follow:
Try to fit 256x256 images in the TXMB until it's possible. When you aren't able to add any more 256x256 images you add the remaining resolution left to complete the TXMB.
Example image 640x480:
256x256 | 256x256 | 128x256 * 256x224 ** | 256x224 ** | 128x224* **
*where we add 128 which is the remaining resolution, we couldn't have added another 256 width resolution because it would overflow the TXMB 640 width
**where we add 224 which is the remaining resolution, we couldn't have added another 256 width resolution because it would overflow the TXMB 480 height
Algorithm pseudo code:
function getSplitSizes(int sideSize){
vector splitSizes;
int remainingSize = sideSize;
int regularSize = 256;
while (remainingSize > 0){
if(remainingSize - regularSize < 0){
splitSizes.add(remainingSize);
remainingSize = 0;
}
else{
splitSizes.add(regularSize);
remainingSize = remainingSize - regularSize;
}
}
return splitSizes;
}
automatically loaded TXMB
There are three TXMB that are automatically loaded (if they exist) by the engine on specific events:
- TXMBintro_splash_screen
- loaded at a savepoint load
- TXMBwin_splash_screen
- loaded when win (bsl function) is called
- TXMBfail_splash_screen
- loaded when lose (bsl function) is called
Those files are level specific. If they are not provided the engine skips them.