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 > Interesting Bug

#104872 - TheWopr - Tue Oct 03, 2006 6:57 pm

I have a program that one of its first tasks is to draw a blue background on the main screen in MODE_5_2D. I accomplish this by doing,

Code:
void Game::drawBackground() {               //Draws Background, a fullscreen of blue
   for(int i = 0; i < 256 * 256; i++)
      BG_GFX[i] = RGB15(0,0,31) | BIT(15);
}

My game runs ok on an emulator (no$gba) using this but not on hardware. While trying to find a solution to this I stumbled upon this bug. Whenever I change my color to anything other than 0,0,31 it succesfully draws the background but it doesn't run the game, it freezes.

Code:
void Game::drawBackground() {               //Draws Background, a fullscreen of blue
   for(int i = 0; i < 256 * 256; i++)
      BG_GFX[i] = RGB15(0,31,31) | BIT(15);
}


I've attached all my source, and if anyone could possibly try to test it on hardware too that would be great because it doesn't work for me but maybe someone else might be able to get it right.

http://rapidshare.de/files/35372125/TheWoprProject.zip.html


Last edited by TheWopr on Tue Oct 03, 2006 9:10 pm; edited 1 time in total

#104879 - Cearn - Tue Oct 03, 2006 7:59 pm

The game doesn't freeze, the players just don't move. You may have drawn the background in another color, but in Game::checkCollisions() you're testing against RGB(0,0,31), which means you collide immediately. simple solution would be to have a BG_COLOR #define that you check, rather than literals everywhere.