Ejemplo n.º 1
0
void Sprite::Initialize(sSpriteEntry * pSpriteEntry, 
						uint16 * pSpriteGfxMemory
						)
{
	_spriteGfxMemory = pSpriteGfxMemory;

	_spriteEntry = pSpriteEntry;

	_vram_address = _next_address;
	
	_spriteEntry->attribute[0] = ATTR0_DISABLED | ATTR0_SQUARE | ATTR0_COLOR_256 | _x;
	_spriteEntry->attribute[2] = _vram_address; // 128*id;

	// ANZAHL TILES
	if (_size == ATTR1_SIZE_32) {
		_spriteSize = 1024;
		_numTiles = 32;
		_height = 32;
		_width = 32;
		_spriteEntry->attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_32 | _x;
	}
	else if (_size == ATTR1_SIZE_16) {
		_spriteSize = 256;
		_numTiles = 8;
		_height = 16;
		_width = 16;
		_spriteEntry->attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_16 | _x;
	}
	else if (_size == ATTR1_SIZE_8) {
		_spriteSize = 64;
		_numTiles = 2;
		_height = 8;
		_width = 8;
		_spriteEntry->attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_8 | _x;
	}
	else { // = ATTR1_SIZE_64
		_spriteSize = 4096; 
		_numTiles = 128; 
		_height = 64;
		_width = 64;
		_spriteEntry->attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_64 | _x;
	}

	_next_address += _numTiles; // Anzahl TILES  = SIZE / TILESIZE
	
//	iprintf("_vram_address: %u\n",_vram_address);
	Rotate(0);
	Disable();

	Initialized();
}
Ejemplo n.º 2
0
static inline void SetPosSprite(u32 objno,s32 x,s32 y,bool EnabledBlend)
{
  u32 sx=x;
  u32 sy=y;
  
  if(x<0) sx=x+512;
  if(y<0) sy=y+256;
  
  sx&=512-1;
  sy&=256-1;
  
  sx=x & (512-1);
  sy=y & (256-1);
  
  u16 attr0=ATTR0_NORMAL | ATTR0_BMP | ATTR0_SQUARE | sy;
  if(EnabledBlend==false){
    attr0|=ATTR0_TYPE_NORMAL;
    }else{
    attr0|=ATTR0_TYPE_BLENDED;
  }
  sprites[objno].attribute[0] = attr0;
  sprites[objno].attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_64 | sx;
}