HomeForumsWhat's newResources 
 
 
Loading assets between levels?
NightCheese - May 20, 2020
 NightCheese May 20, 2020
Hi all,

I was wondering if anyone has any tips for loading assets (sprites and tiles) between levels?

I currently have my sprites in a BIN file created by BGCON and I load the texture list with "slInitSystem(TV_320x240, tex_LEVEL1, 1)".

Would I just do this to load the texture list for level 2?
Code:
  
slTVOff();
slInitSystem(TV_320x240, tex_LEVEL2, 1);

Or is there a more elegant way of doing it that doesn't require me to have a static texture list?

Also, does anyone know of a tool with similar functionality as BGCON, but doesn't require me to run it in DOSBox?

Thanks!

 NightCheese Oct 6, 2020
Sorry to bump my own thread, but I wondered if anyone had any thoughts on this?

Thank you!

P.S. Thanks to you all for keeping the Saturn alive

 XL2 Oct 6, 2020

NightCheese said:

You can just replace the data in your texture def directly by updating the size, source, etc.
I wrote an image converter a while back, mostly for 4 bpp sprites, which is almost the only thing I personaly use, you should be able to find it somewhere in the forums.
It also supports 8 bpp sprites, but I never added support for 16 bpp

 NightCheese Oct 7, 2020
Thanks for the reply, XL2!

Sorry, but maybe I don't understand? If I was to replace the data in my texture def, how would the new textures get loaded? I'm currently loading the textures with "slInitSystem(TV_320x240, tex_LEVEL1, 1)" that lives in "void init_GFX()" which only gets called when the game boots.

I'm very new to Saturn development, so an example would be excellent if you have one?

I have found your image converter. Thank you very much

 XL2 Oct 7, 2020

NightCheese said:

The image converter topic also had a demo if I remember right, you can simply change the data directly in tex_level1 by keeping track of how many textures you have and what you want to replace.
Say you have 40 "permanent" textures, you just need to replace stuff in tex_level1[40] when you change level.
That includes DMA to VRAM and updating the size and adresses in tex_level1.

 NightCheese Oct 7, 2020
Thank you! I think that makes sense. I’ll have a play around and will let you know how I get on.

 XL2 Oct 8, 2020

NightCheese said:

You can see an example here how to load new textures within SGL :