Foxi4 wrote:The Shape parameter has been deprecated, it's automatically computed from Size (aka, no need to use it in the function).
char _Sprite[50];
char _Pal[50];
void FAT_BasicCreateSprite(u8 Screen, u8 SpriteNum, u8 PaletteNum, char FileName[39], u8 Shape, u8 Size, int X, int Y) {
strcpy(_Sprite, FileName);
strcat(_Sprite, "_Sprite.bin");
strcpy(_Pal, FileName);
strcat(_Pal, "_Pal.bin");
FAT_LoadPal(PaletteNum, Screen, _Pal);
FAT_LoadSprite(SpriteNum, _Sprite);
PA_WaitForVBL();
FAT_CreateSprite(Screen, SpriteNum, PaletteNum, Shape, Size, X, Y);
}void FAT_BasicCreateSprite(u8 Screen, u8 SpriteNum, u8 PaletteNum, char FileName[39], u8 Shape, u8 Size, int X, int Y) {
strcpy(_Sprite, FileName);
strcat(_Sprite, "_Sprite.bin");
strcpy(_Pal, FileName);
strcat(_Pal, "_Pal.bin");
FAT_LoadPal(PaletteNum, Screen, _Pal);
FAT_UnloadSprite(SpriteNum);
//While Slot is being wiped... (may take more than one V-Blank afterall with bigger sprites)
while(SpriteCustom[SpriteNum]!=NULL){
PA_WaitForVBL();
}
//While FAT_LoadSprite is in progress...
while(FAT_LoadSprite(SpriteNum, _Sprite)){
PA_WaitForVBL();
}
//If loading was infact successful...
if(SpriteCustom[SpriteNum]!=NULL){
FAT_CreateSprite(Screen, SpriteNum, PaletteNum, Shape, Size, X, Y);
}
}
char _Sprite[50];
char _Pal[50];
void FAT_BasicCreateSprite(u8 Screen, u8 SpriteNum, u8 PaletteNum, char FileName[39], u8 Shape, u8 Size, int X, int Y) {
strcpy(_Sprite, FileName);
strcat(_Sprite, "_Sprite.bin");
strcpy(_Pal, FileName);
strcat(_Pal, "_Pal.bin");
FAT_LoadPal(PaletteNum, Screen, _Pal);
FAT_UnloadSprite(SpriteNum);
while(SpriteCustom[SpriteNum] != NULL) { // I LOVE the word NULL! It just sounds so cool!
PA_WaitForVBL();
}
FAT_LoadSprite(SpriteNum, _Sprite);
FAT_CreateSprite(Screen, SpriteNum, PaletteNum, Shape, Size, X, Y);
}
//Zombase specific code:
#define CreateObject(Object, FileName)\
FAT_BasicCreateSprite(1, Object.N, Object.P, FileName, OBJ_SIZE_32X32, Object.X>>8, Object.Y>>8);
...
More stuff here.
Return to Tutorials & Examples
Users browsing this forum: No registered users and 1 guest