1

grrrrr!!rageragerageragemadmadmadrageragevtffvtffvtff

d'où ça vien cte saloperie????
g utilisé le bckg dans le tuto d'exor, avec les mêmes routines, et ça donne cette merde!!!
alors ke les sprites marchent très bien!!
fuck!
gbafucked01.gif

ça peut venir d'où à votre avis?
si je mets le fichier contenant le sprite avant l'include du background, ça foire le sprite ET le background, si je le mets après, le sprite passe bien, mais pas le background sad

bon, je mets ma source, comme ça o moins...

vaaala:


#include "c:devkitadvincludegba.h"
#include "c:devkitadvincludegbaIO.h"

#include "c:devkitadvdatabkg.h"
#include "c:devkitadvdatabulle03_00.h"	// 64x32pixels
#include "c:devkitadvdatabulle02_00.h"	// 32x32pixels
#include "c:devkitadvdatabulle01_00.h"	// 16x16pixels
#include "c:devkitadvdatabulle00_00.h"	// 8x8pixels
#include "c:devkitadvdataOAM_Pal.h"	// 256 couleurs
#include "c:devkitadvdatabkg_pal.h"

OAMstruct OAM_Buffer[128];

typedef struct _BALLSstruct
{
 s16  x;
 s16  y;
 s16  xadd;
 s16  yadd;
 u16  weightcoeff;
} BALLSstruct;


BALLSstruct BALLS[3];

u16 SPRITE_INDEX[256];


u16 counter;
u16 size;
u32 offset;

void vsync(void)
{
  asm("
	ldr r0,=0x04000006
scanline_wait:
	ldrh r1,[r0]
	cmp r1,#160
	bne scanline_wait
	")
}

// Copy cnt Data to scr from dst (by DMA3 method)
void DMA3_Copy(u32 src, u32 dst, u32 cnt)
{
  REG_DM3SAD = src;
  REG_DM3DAD = dst;
  REG_DM3CNT = cnt;
}

// Copy OAM_Buffer dans les vrai OAM.
void OAM_Copy(void)
{
	int i;
	for(i=0; i<128; i++)
	{
		OAM[i].A0 = OAM_Buffer[i].A0;
		OAM[i].A1 = OAM_Buffer[i].A1;
		OAM[i].A2 = OAM_Buffer[i].A2;
		OAM[i].A3 = OAM_Buffer[i].A3;
	}
}

void Initialisation(void)
{
	counter = 1;
	size = 0;
	offset = 8*8;

	SPRITE_INDEX[0] = 1;
}


//Point d'entré...
int main(void)
{
	int x,y,gravity,i;
	x=0;
	y=0;

	gravity=1;
	
	REG_DISPCNT = MODE_1 | OBJ_ENABLE | OBJ_MAP_1D | BG0_ENABLE;
	BKG0CNT = BKG_COLOR_MODE_256 | BKG_CHR_BLOCK_1;

	// Load Palette
	

	Initialisation();

	// Load Palette
	DMA3_Copy((u32)&OAM_Pal, (u32)OBJPAL, ENABLE_TRANSFER | TRANSFER_SIZE_16 | 256/2);
// On peut pas envoyer des 32bits (surement a cause du bus qui doit etre en 16bit)

	// Load bulle03_00
	size = 64*32;
	DMA3_Copy((u32)&bulle03_00, (u32)OBJCHR + offset, ENABLE_TRANSFER | TRANSFER_SIZE_32 | (size/4));
	offset += size;
	SPRITE_INDEX[counter] = SPRITE_INDEX[counter - 1] + size/64;
	counter++;

	// Load bulle02_00
	size = 32*32;
	DMA3_Copy((u32)&bulle02_00, (u32)OBJCHR + offset, ENABLE_TRANSFER | TRANSFER_SIZE_32 | (size/4));
	offset += size;
	SPRITE_INDEX[counter] = SPRITE_INDEX[counter - 1] + size/64;
	counter++;

	// Load bulle01_00
	size = 16*16;
	DMA3_Copy((u32)&bulle01_00, (u32)OBJCHR + offset, ENABLE_TRANSFER | TRANSFER_SIZE_32 | (size/4));
	offset += size;
	SPRITE_INDEX[counter] = SPRITE_INDEX[counter - 1] + size/64;
	counter++;

	// Load bulle00_00
	size = 8*8;
	DMA3_Copy((u32)&bulle00_00, (u32)OBJCHR + offset, ENABLE_TRANSFER | TRANSFER_SIZE_32 | (size/4));
	offset += size;
	SPRITE_INDEX[counter] = SPRITE_INDEX[counter - 1] + size/64;
	counter++;


	// Initialise le sprite pour que le HW le reconnaisse et l'affiche
	// boule 64x32
	OAM_Buffer[0].A0 = S_01 | COLOR_DEPTH_256 | (0 & Y_MASK);	// Y
	OAM_Buffer[0].A1 = S_11 | (0 & X_MASK);	// X
	OAM_Buffer[0].A2 = SPRITE_INDEX[0] << 1;	// Tiles de depart
	OAM_Buffer[0].A3 = 0;		// Rot/Scaling
	BALLS[0].x=0;
	BALLS[0].y=0;
	BALLS[0].xadd=4<<4;
	BALLS[0].yadd=0;
	BALLS[0].weightcoeff=4;


	// boule 32x32
	OAM_Buffer[1].A0 = S_00 | COLOR_DEPTH_256 | (0 & Y_MASK);	// Y
	OAM_Buffer[1].A1 = S_10 | (0 & X_MASK);	// X
	OAM_Buffer[1].A2 = SPRITE_INDEX[1] << 1;	// Tiles de depart
	OAM_Buffer[1].A3 = 0;		// Rot/Scaling
	BALLS[1].x=0;
	BALLS[1].y=0;
	BALLS[1].xadd=3<<4;
	BALLS[1].yadd=0;
	BALLS[1].weightcoeff=3;

	// boule 16x16
	OAM_Buffer[2].A0 = S_00 | COLOR_DEPTH_256 | (0 & Y_MASK);	// Y
	OAM_Buffer[2].A1 = S_01 | (0 & X_MASK);	// X
	OAM_Buffer[2].A2 = SPRITE_INDEX[2] << 1;	// Tiles de depart
	OAM_Buffer[2].A3 = 0;		// Rot/Scaling
	BALLS[2].x=0;
	BALLS[2].y=0;
	BALLS[2].xadd=5<<4;
	BALLS[2].yadd=0;
	BALLS[2].weightcoeff=2;

	// boule 8x8
	OAM_Buffer[3].A0 = S_00 | COLOR_DEPTH_256 | (0 & Y_MASK);	// Y
	OAM_Buffer[3].A1 = S_00 | (0 & X_MASK);	// X
	OAM_Buffer[3].A2 = SPRITE_INDEX[3] << 1;	// Tiles de depart
	OAM_Buffer[3].A3 = 0;	// Rot/Scaling
	BALLS[3].x=0;
	BALLS[3].y=0;
	BALLS[3].xadd=6<<4;
	BALLS[3].yadd=0;
	BALLS[3].weightcoeff=1;

	DMA3_Copy( (u32)&background_pal, (u32)BKGPAL, ENABLE_TRANSFER | TRANSFER_SIZE_16 | 256/2);

	//Load data
	DMA3_Copy( (u32)&background, (u32)BKGCHR, ENABLE_TRANSFER | TRANSFER_SIZE_32 | (240*160/4));

	// On reordonne les tiles	30*8 = 240 et 20*8 = 160 (Taille ecran)
	for(y=0; y<20; y++)
		   for(x=0; x<30; x++)
		   {
				BKGTILES[y*32+x] = y * 30 + x;
// on saute a chaque fois les 16pixels invisible (la GBA resonne avec un ecran de 256x256)
		   }

	x=0;
	y=0;
	
	while(1)
	{
		vsync();
		OAM_Copy();

		OAM_Buffer[0].A0 = S_01 | COLOR_DEPTH_256 | (BALLS[0].y & Y_MASK);	// Y
		OAM_Buffer[0].A1 = S_11 | (BALLS[0].x & X_MASK);	// X
		OAM_Buffer[0].A2 = SPRITE_INDEX[0] << 1;	// Tiles de depart
		OAM_Buffer[0].A3 = 0;

		OAM_Buffer[1].A0 = S_00 | COLOR_DEPTH_256 | (BALLS[1].y & Y_MASK);	// Y
		OAM_Buffer[1].A1 = S_10 | (BALLS[1].x & X_MASK);	// X
		OAM_Buffer[1].A2 = SPRITE_INDEX[1] << 1;	// Tiles de depart
		OAM_Buffer[1].A3 = 0;

		OAM_Buffer[2].A0 = S_00 | COLOR_DEPTH_256 | (BALLS[2].y & Y_MASK);	// Y
		OAM_Buffer[2].A1 = S_01 | (BALLS[2].x & X_MASK);	// X
		OAM_Buffer[2].A2 = SPRITE_INDEX[2] << 1;	// Tiles de depart
		OAM_Buffer[2].A3 = 0;

		OAM_Buffer[3].A0 = S_00 | COLOR_DEPTH_256 | (BALLS[3].y & Y_MASK);	// Y
		OAM_Buffer[3].A1 = S_00 | (BALLS[3].x & X_MASK);	// X
		OAM_Buffer[3].A2 = SPRITE_INDEX[3] << 1;	// Tiles de depart
		OAM_Buffer[3].A3 = 0;

		for(i=0;i<4;i++)
		{

			BALLS[i].yadd+=gravity;
			BALLS[i].x+=BALLS[i].xadd>>4;
			BALLS[i].y+=BALLS[i].yadd;

			if(BALLS[i].x>240-32+i*8+4-i)
			{
				BALLS[i].x=240-32+i*8+4-i;
				BALLS[i].xadd=-BALLS[i].xadd;
			}
			else if(BALLS[i].x<0)
			{
				BALLS[i].x=0;
				BALLS[i].xadd=-BALLS[i].xadd;
			}

			if(BALLS[i].y>160-32+i*8+4-i)
			{
				BALLS[i].y=160-32+i*8+4-i;
				BALLS[i].yadd=-BALLS[i].yadd;
				BALLS[i].yadd=BALLS[i].yadd+BALLS[i].weightcoeff;
				if(BALLS[i].xadd<0){
					BALLS[i].xadd+=1;
				}
				else if(BALLS[i].xadd>0)
				{
					BALLS[i].xadd-=1;
				}
			}
			else if(BALLS[i].y<0){
				BALLS[i].y=0;
				BALLS[i].yadd=-BALLS[i].yadd;
			}
		}
	}
}

[edit]Edité par sBibi le 22-12-2001 à 15:00:57[/edit]
[edit]Edité par sBibi le 22-12-2001 à 15:07:15[/edit]
In many respects the Yoshi is like a beautiful woman. A man can come so enamoured that he bestows on her all his time, his energy and his fortune.
- Fred whipple, 1960

*** Ne sous-estimez pas la puissance de la Marmotte ***
© Marmotte Team : LaMarmotte, sBibi, Vark & Sabrina

2

bon, je sais, c pas optimisé, mais je m'en fous!
je veux ke ça marche d'abord!! ouiiiinn !!!

(remarquez qu'on voit les sprites des balles dans le background, affichées avec la palette du bckg... dc je me disais ke ça venait ptet du background, mais g essayé avec d'autres, et ça fé pareil... sad)

ça vien pas de la palette, les couleurs sont bonnes...
par contre, il faut peut-être faire qquechose à ce nivo:

DMA3_Copy( (u32)&background, (u32)BKGCHR, ENABLE_TRANSFER | TRANSFER_SIZE_32 | (240*160/4));

et mettre (u32)BKGCHR-qquechose
j'en sais rien...

qqun voit d'où ça peut venir?
je me suis planté où??
In many respects the Yoshi is like a beautiful woman. A man can come so enamoured that he bestows on her all his time, his energy and his fortune.
- Fred whipple, 1960

*** Ne sous-estimez pas la puissance de la Marmotte ***
© Marmotte Team : LaMarmotte, sBibi, Vark & Sabrina

3

ué agnahr nous avais dis qu'il y avais des trucs a corriger
"I read the game.dll assembly more easily than you read the joke on the back of your box of Cocoa Pebbles, and have spent the past 2 1/2 years navigating it." ©

4

bah ué, mais c koi le truc à corriger? grin
In many respects the Yoshi is like a beautiful woman. A man can come so enamoured that he bestows on her all his time, his energy and his fortune.
- Fred whipple, 1960

*** Ne sous-estimez pas la puissance de la Marmotte ***
© Marmotte Team : LaMarmotte, sBibi, Vark & Sabrina

5

fodrait que je lise le pernprojetc pour trouver l'error
"I read the game.dll assembly more easily than you read the joke on the back of your box of Cocoa Pebbles, and have spent the past 2 1/2 years navigating it." ©