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 u16* Src, unsigned int BGMap, unsigned 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(Y = 0; Y < Height; Y++)
for(X = 0; X < Width; X++)
BGMM[BGMap * 0x1000 + Y * 64 + X] = Src[Index++] + CharIndexBase;
}
unsigned int LoadEfficientCharset (const u16* Src, unsigned 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(i = 1; i <= Length; i++)
vbCharmem[CharIndex++] = Src[i];
return CharIndex / 8;
}
void Init ()
{
unsigned int CharIndex;
// Font for vbTextOut
LoadEfficientCharset(kChr_Font, vbkCharseg3Index + 32);
// Sprites
LoadEfficientBGMap(kBGM_SpritesLR, kBGMISprites, vbkCharseg1Index);
CharIndex = LoadEfficientCharset(kChr_Sprites, vbkCharseg1Index);
// Door
LoadEfficientBGMap(kBGM_DoorLR, kBGMIDoor, CharIndex);
CharIndex = LoadEfficientCharset(kChr_Door, CharIndex);
// Stove view
LoadEfficientBGMap(kBGM_StoveViewL, kBGMIStoveL, CharIndex);
LoadEfficientBGMap(kBGM_StoveViewR, kBGMIStoveR, CharIndex);
CharIndex = LoadEfficientCharset(kChr_StoveView, CharIndex);
// Counter view
LoadEfficientBGMap(kBGM_CounterViewL, kBGMICounterL, CharIndex);
LoadEfficientBGMap(kBGM_CounterViewR, kBGMICounterR, CharIndex);
CharIndex = LoadEfficientCharset(kChr_CounterView, CharIndex);
// Fridge
LoadEfficientBGMap(kBGM_FridgeLR, kBGMIFridge, CharIndex);
CharIndex = LoadEfficientCharset(kChr_Fridge, CharIndex);
// Outside view
LoadEfficientBGMap(kBGM_OutsideViewLR, kBGMIOutside, CharIndex);
CharIndex = LoadEfficientCharset(kChr_OutsideView, CharIndex);
// Clouds
LoadEfficientBGMap(kBGM_CloudsLR, kBGMIClouds, CharIndex);
CharIndex = LoadEfficientCharset(kChr_Clouds, CharIndex);
// (...)
}