#4122 - Ninj4D4n - Wed Mar 19, 2003 8:41 pm
Hey all, i've been playing with backgrounds for a few days and keep finding this wierd occurance that seems to be giving me most of the trouble.
Here's my function
[code]
void Intro(void)
{
SetMode(MODE_1 | OBJ_ENABLE | OBJ_MAP_1D);
Bg FlashBG, AtariBG;
//////////////////////////////////
//setup data
u16 loop;
//load palette
for(loop = 0; loop < 256; loop++)
BGPalette[loop] = tilesPalette[loop];
u16* tempData = (u16*)CharBaseBlock(0);
//load tile set; charbase block 0
for(loop = 0; loop < tiles_WIDTH * tiles_HEIGHT /2; loop++)
tempData[loop] = tilesData[loop];
//load maps
u16* tempLoad;
u16* tempMap;
//rot bg
tempMap = (u16*)ScreenBaseBlock(28);
tempLoad = (u16*)clouds;
for(loop = 0; loop < 32*32/2; loop++)
tempMap[loop] = tempLoad[loop];
AtariBG.number = 2;
AtariBG.charBaseBlock = 0; //tiles in 0
AtariBG.screenBaseBlock = 28; //AtariBG in 28 (above)
AtariBG.colorMode = BG_COLOR_256;
AtariBG.size = ROTBG_SIZE_256x256;
AtariBG.mosaic = 0;
AtariBG.x_scroll = 0;
AtariBG.y_scroll = 0;
EnableBackground(&AtariBG);
}
[/code]
as you can see, it just loads all the data necessary to setup background 2. This works fine. The bug is if i switch the decleration:
Bg FlashBG, AtariBG;
to
Bg AtariBG, FlashBG;
Nothing is displayed. Total black screen.
I'm currently using the files i found at the pern project so my struct Bg is:
[code]
//structure for a background
typedef struct Bg
{
u16* tileData;
u16* mapData;
u8 mosaic;
u8 colorMode;
u8 number;
u16 size;
u8 charBaseBlock;
u8 screenBaseBlock;
u8 wraparound;
s16 x_scroll,y_scroll;
s32 DX,DY;
s16 PA,PB,PC,PD;
}Bg;
[/code]
So.... any ideas? Also, if i don't declare FlashBG before AtariBG i also get black.
--Ninj4D4n
Here's my function
[code]
void Intro(void)
{
SetMode(MODE_1 | OBJ_ENABLE | OBJ_MAP_1D);
Bg FlashBG, AtariBG;
//////////////////////////////////
//setup data
u16 loop;
//load palette
for(loop = 0; loop < 256; loop++)
BGPalette[loop] = tilesPalette[loop];
u16* tempData = (u16*)CharBaseBlock(0);
//load tile set; charbase block 0
for(loop = 0; loop < tiles_WIDTH * tiles_HEIGHT /2; loop++)
tempData[loop] = tilesData[loop];
//load maps
u16* tempLoad;
u16* tempMap;
//rot bg
tempMap = (u16*)ScreenBaseBlock(28);
tempLoad = (u16*)clouds;
for(loop = 0; loop < 32*32/2; loop++)
tempMap[loop] = tempLoad[loop];
AtariBG.number = 2;
AtariBG.charBaseBlock = 0; //tiles in 0
AtariBG.screenBaseBlock = 28; //AtariBG in 28 (above)
AtariBG.colorMode = BG_COLOR_256;
AtariBG.size = ROTBG_SIZE_256x256;
AtariBG.mosaic = 0;
AtariBG.x_scroll = 0;
AtariBG.y_scroll = 0;
EnableBackground(&AtariBG);
}
[/code]
as you can see, it just loads all the data necessary to setup background 2. This works fine. The bug is if i switch the decleration:
Bg FlashBG, AtariBG;
to
Bg AtariBG, FlashBG;
Nothing is displayed. Total black screen.
I'm currently using the files i found at the pern project so my struct Bg is:
[code]
//structure for a background
typedef struct Bg
{
u16* tileData;
u16* mapData;
u8 mosaic;
u8 colorMode;
u8 number;
u16 size;
u8 charBaseBlock;
u8 screenBaseBlock;
u8 wraparound;
s16 x_scroll,y_scroll;
s32 DX,DY;
s16 PA,PB,PC,PD;
}Bg;
[/code]
So.... any ideas? Also, if i don't declare FlashBG before AtariBG i also get black.
--Ninj4D4n