You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#11
Re: Multiple BMP to BGMap/charset converter
Posted on: 2013/9/15 1:24
PVB Elite
Joined 2008/12/28
Slovenia
618 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (9 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
It's because the array in which BGMaps are generated is not initialized before generating each one. Should all cells be initialized to 0? That would only give you a blank BGMap if character 0 was blank though.
Top

#12
Re: Multiple BMP to BGMap/charset converter
Posted on: 2013/9/15 13:31
PVB Elite
Joined 2011/7/1
Germany
1094 Posts
CoderContributorTop10 PosterLong Time User (7 Years) App CoderPVBCC 2013 Entry
Quote:

HorvatM wrote:
It's because the array in which BGMaps are generated is not initialized before generating each one. Should all cells be initialized to 0? That would only give you a blank BGMap if character 0 was blank though.


I guess that would work most of the time. Alternatively, you could search for the blank char and use it to initialize the maps.

When I worked on Fishbone I had quite some trouble organizing maps and chars I created. The basic problem is that after all of the tools always assume there will only be one charset (or 4). However, I often reused certain sprites forcing me to have them multiple times on different maps.

Do you think it would be possible, when converting a batch of images, to specify an offset for the chars? The charset itself would stay the same but the maps would reference to the respective chars + offset. That way someone could have multiple charsets and bgmaps.

I don't need this right now though. It's just something I remembered when I looked at your tool.
Top

#13
Re: Multiple BMP to BGMap/charset converter
Posted on: 2013/9/15 15:32
PVB Elite
Joined 2008/12/28
Slovenia
618 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (9 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
Quote:

thunderstruck wrote:
When I worked on Fishbone I had quite some trouble organizing maps and chars I created. The basic problem is that after all of the tools always assume there will only be one charset (or 4). However, I often reused certain sprites forcing me to have them multiple times on different maps.

Do you think it would be possible, when converting a batch of images, to specify an offset for the chars? The charset itself would stay the same but the maps would reference to the respective chars + offset. That way someone could have multiple charsets and bgmaps.


I did just that in Advanced Pasta Cooking Simulator (I should release the source code for it some day - BTW, you should play with it a bit because there's a cool "easter egg" in it). The program doesn't have any option to do this, but you can easily do the same thing with efficient charsets. That's how I did it (with efficient BGMaps as well, but you don't have to):


// Pointer to VIP character memory
#define vbCharmem ((u16*)0x78000)

// Character indexes for LoadEfficientBGMap and LoadEfficientCharset
#define vbkCharseg0Index 0
#define vbkCharseg1Index 512
#define vbkCharseg2Index 1024
#define vbkCharseg3Index 1536

void LoadEfficientBGMap (
  const 
u16Srcunsigned int BGMapunsigned int CharIndexBase
)
{
  
// Loads an efficiently stored VBIMGC-produced BGMap and optionally adjusts
  // the character indexes of its cells.

  
unsigned int X;
  
unsigned int Y;
  
unsigned int Width;
  
unsigned int Height;
  
unsigned int Index;

  
Width Src[0] & 0x00FF;
  
Height Src[0] >> 8;

  
Index 1;
  for(
0HeightY++)
    for(
0WidthX++)
      
BGMM[BGMap 0x1000 64 X] = Src[Index++] + CharIndexBase;
}

unsigned int LoadEfficientCharset (const u16Srcunsigned int CharIndex)
{
  
// Loads an efficiently stored VBIMGC-produced charset and returns the
  // index of the character immediately following it in the VIP's character
  // memory.

  
unsigned int i;
  
unsigned int Length;

  
CharIndex *= 8;  // Convert to row index

  
Length Src[0] * 8;
  for(
1<= Lengthi++)
    
vbCharmem[CharIndex++] = Src[i];

  return 
CharIndex 8;
}

void Init ()
{
  
unsigned int CharIndex;

  
// Font for vbTextOut
  
LoadEfficientCharset(kChr_FontvbkCharseg3Index 32);

  
// Sprites
  
LoadEfficientBGMap(kBGM_SpritesLRkBGMISpritesvbkCharseg1Index);
  
CharIndex LoadEfficientCharset(kChr_SpritesvbkCharseg1Index);

  
// Door
  
LoadEfficientBGMap(kBGM_DoorLRkBGMIDoorCharIndex);
  
CharIndex LoadEfficientCharset(kChr_DoorCharIndex);

  
// Stove view
  
LoadEfficientBGMap(kBGM_StoveViewLkBGMIStoveLCharIndex);
  
LoadEfficientBGMap(kBGM_StoveViewRkBGMIStoveRCharIndex);
  
CharIndex LoadEfficientCharset(kChr_StoveViewCharIndex);

  
// Counter view
  
LoadEfficientBGMap(kBGM_CounterViewLkBGMICounterLCharIndex);
  
LoadEfficientBGMap(kBGM_CounterViewRkBGMICounterRCharIndex);
  
CharIndex LoadEfficientCharset(kChr_CounterViewCharIndex);

  
// Fridge
  
LoadEfficientBGMap(kBGM_FridgeLRkBGMIFridgeCharIndex);
  
CharIndex LoadEfficientCharset(kChr_FridgeCharIndex);

  
// Outside view
  
LoadEfficientBGMap(kBGM_OutsideViewLRkBGMIOutsideCharIndex);
  
CharIndex LoadEfficientCharset(kChr_OutsideViewCharIndex);

  
// Clouds
  
LoadEfficientBGMap(kBGM_CloudsLRkBGMICloudsCharIndex);
  
CharIndex LoadEfficientCharset(kChr_CloudsCharIndex);

  
// (...)
}
Top

#14
Re: Multiple BMP to BGMap/charset converter
Posted on: 2013/9/15 19:19
PVB Elite
Joined 2011/7/1
Germany
1094 Posts
CoderContributorTop10 PosterLong Time User (7 Years) App CoderPVBCC 2013 Entry
cool, thanks for that code. Another thing I was wondering: Vide is reducing the number of chars by setting the flip value in the bgmaps. Meaning, if two chars are the same but flipped it will save the char only once and set the values in the bgmaps. Are you doing that as well? From looking at the resulting charset it doesn't look like it but my testsprite might not be a 100% accurate.
Top

#15
Re: Multiple BMP to BGMap/charset converter
Posted on: 2013/9/15 19:34
PVB Elite
Joined 2008/12/28
Slovenia
618 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (9 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
Not yet, but I will.
Top

#16
Re: Multiple BMP to BGMap/charset converter
Posted on: 2014/4/4 13:43
PVB Elite
Joined 2008/12/28
Slovenia
618 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (9 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
I'm finally releasing version 1.1. This is the version RunnerPack and I used for Deathchase, and some (all?) of the graphics can't be converted with version 1.

Changes:

- Now also supports 32-bit BMPs.
- You can convert BMPs to charsets "one to one" without generating BGMaps (useful for fonts).
- The number of new unique characters for each BGMap generated is reported, along with a total at the end of the conversion.
- If an exact color match isn't found, the closest one is used (thanks to RunnerPack).
- The BGMap buffer is now cleared before converting each BMP (reported by thunderstruck).
- The program now checks for the 2048-character limit before adding a new character.
- Updated the LoadEfficientCharset and LoadEfficientBGMap functions in the readme with those from Deathchase.

Attach file:


zip vbimgc.zip Size: 23.25 KB; Hits: 156
Top

#17
Re: Multiple BMP to BGMap/charset converter
Posted on: 2014/4/4 15:28
PVB Elite
Joined 2011/7/1
Germany
1094 Posts
CoderContributorTop10 PosterLong Time User (7 Years) App CoderPVBCC 2013 Entry
Cool stuff. I used version 1 for quite some time. I had to program my own in the end because I needed the char flip feature. Any plans on putting that in?
Top

#18
Re: Multiple BMP to BGMap/charset converter
Posted on: 2014/4/4 16:44
PVB Elite
Joined 2008/12/28
Slovenia
618 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (9 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
I actually implemented that, but it sometimes produced incorrect results. I decided to release it without this feature anyway because it's already been more than a year since the first version.
Top

#19
Re: Multiple BMP to BGMap/charset converter
Posted on: 2014/9/14 0:24
Virtual Freak
Joined 2014/8/31
USA
73 Posts
Long Time User (4 Years)
Is a Unix or source release possible for those who do not use Windows? I've been batting this around, but at least for my project, it may be beneficial to include the raw assets, and have the build system convert them to tilemaps as a "preprocessing" step before compilation, but I'm not sure.
Top

#20
Re: Multiple BMP to BGMap/charset converter
Posted on: 2014/9/19 21:25
PVB Elite
Joined 2008/12/28
Slovenia
618 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (9 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
Quote:

cr1901 wrote:
Is a Unix or source release possible for those who do not use Windows?


What OS do you use?

Quote:

I've been batting this around, but at least for my project, it may be beneficial to include the raw assets, and have the build system convert them to tilemaps as a "preprocessing" step before compilation, but I'm not sure.


I'm open to suggestions. In particular, if you mean the listing file idea discussed a few posts ago, suggestions would be really welcome, because I'm not entirely sure myself how it should be implemented.
Top

 Top   Previous Topic   Next Topic


Register To Post