gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Tiled background is corrupting itself!!! :((

#91788 - spinal_cord - Sun Jul 09, 2006 4:43 pm

Can someone explain why my background keeps corrupting itself (random tiles are being changed). I'm sure i'm not doing something stupid, but can someone have alook and tell me whats going on?
I'm using PaLib, I hope that isn't a proble in itself.

source.zip

This is realy bugging me, it worked fine yesturday and I dont know aht i've done to it. :(
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#91797 - silent_code - Sun Jul 09, 2006 7:14 pm

did you try a fully clean build? rebuild the whole thing and check if the problem is solved. there's a small chance it will.

good luck

#91798 - wintermute - Sun Jul 09, 2006 7:57 pm

Hint 1:

Do not #include .c files

Hint 2:

make sure your arrays are aligned properly
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#91807 - mastertop101 - Sun Jul 09, 2006 8:54 pm

Quote:
Hint 1:

Do not #include .c files

huh.. first, that's not the problem, and you must load a .c file to load tiled bg (with palib)

And make sure your program isn't trying to load your background many times in a row (in a sort of infinite loop..)

#91808 - spinal_cord - Sun Jul 09, 2006 8:55 pm

make sure my what are what? what does aligning arrays do? I never needed to do that with gba (not that I did much at all).

I'm fairly sure im only loading the background only once.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#91812 - tepples - Sun Jul 09, 2006 9:51 pm

mastertop101 wrote:
Quote:
Do not #include .c files

huh.. first, that's not the problem, and you must load a .c file to load tiled bg (with palib)

Then compile the .c file separately, and bring it in at link time.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#91814 - chatterbug89 - Sun Jul 09, 2006 10:06 pm

I seriously think what the above people are talking about isn't related to your problem.

Anyways, I had a similar problem....I don't know if this is a bug in PALib or ...just how it works...but, it seems that in some case, loading a background once a previouse background was loaded on the same screen and priority causes weird tile problems...reloading the tiles right after loading another background by using something like PA_LoadBgTiles(1, 2, bla_Tiles); (look in the docs to see the excact function you need..not sure off hand and am too lazy to look) seems to prevent the problem. So, if you just reload the tiles after loading a new background, that should do the trick.

EDIT: By the way, you'd probaly have better luck with getting answeres about palib on their own forums. There doesn't seem to be many people using PAlib here...also....i'm starting to dislike PAlib after using it and it doesn't realy go torwards my programing goals beign so high level either. It's good for simple projects I guess..but, it's anoyign not knowing excactly what's going on sometimes...it's sometimes more trouble than it's worth to make it do what you want. My current project may be my only PAlib project that i do.

#91822 - spinal_cord - Sun Jul 09, 2006 11:26 pm

Palib forum isnt usually very helpful for anything. but I wiull give your suggestion a shot tomorrow. thankyou for the potentially useful advice.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#91830 - mastertop101 - Mon Jul 10, 2006 1:58 am

Oh.. nice splash screen ;) and well, im not even sure what background problem you're talking about.. the little squares that you can pass through maybe ?

#91841 - chatterbug89 - Mon Jul 10, 2006 3:12 am

When he said nice splash i was curiouse and looked at the code again to see if you did anything special..guess you diden't, but ..just thought i'd say...instead of this...

Code:

int st=0;
while(st==0)
{
   PA_WaitForVBL();
   if(Pad.Newpress.Start){st=1;}



Try this.

Code:

while(!Pad.Newpress.Start)
   PA_WaitForVBL();

#91872 - spinal_cord - Mon Jul 10, 2006 9:33 am

mastertop101 - yes, the littls squares that you can pass through, they arn't actually on the map data.

I have fixed the problem, it seemed that assigning a value to enemy_grid[] was causing the random screen junk, I changed it slightly and now everything works again.

chatterbug89 - thanks for the tip.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage