added retrieving of RotScale parameters for sprites, removed CHECKME: H/V-flips are within original drawing rectangle

This commit is contained in:
mightymax 2007-01-10 20:21:48 +00:00
parent 19457346cd
commit 5599c9ee15
1 changed files with 21 additions and 1 deletions

View File

@ -1310,6 +1310,17 @@ void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab)
u8 * src; u8 * src;
u8 * pal; u8 * pal;
u16 j; u16 j;
u16 rotScaleA,rotScaleB,rotScaleC,rotScaleD ;
if (spriteInfo->RotScale & 1) {
/* if we need to do rotscale, gather its parameters */
/* http://nocash.emubase.de/gbatek.htm#lcdobjoamrotationscalingparameters */
rotScaleA = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x06,0) ;
rotScaleB = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x0E,0) ;
rotScaleC = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x16,0) ;
rotScaleD = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x1E,0) ;
} ;
sprX = (spriteInfo->X<<23)>>23; /* get sprite location and size */ sprX = (spriteInfo->X<<23)>>23; /* get sprite location and size */
sprY = spriteInfo->Y; sprY = spriteInfo->Y;
@ -1322,7 +1333,6 @@ void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab)
/* FIXME: for rot/scale, a list of entries into the sprite should be maintained, that tells us where the first pixel */ /* FIXME: for rot/scale, a list of entries into the sprite should be maintained, that tells us where the first pixel */
/* of a screenline starts in the sprite, and how a step to the right in a screenline translates within the sprite */ /* of a screenline starts in the sprite, and how a step to the right in a screenline translates within the sprite */
/* CHECKME: if H-flipped, are the clippings meet? What happens if x direction is flipped, is the range checking working? */
if( (spriteInfo->RotScale == 2) || /* rotscale == 2 => sprite disabled */ if( (spriteInfo->RotScale == 2) || /* rotscale == 2 => sprite disabled */
(l<sprY)||(l>=sprY+sprSize.y) || /* sprite occupies only lines outside the current drawn line */ (l<sprY)||(l>=sprY+sprSize.y) || /* sprite occupies only lines outside the current drawn line */
(sprX==256) ) /* sprite is outside our line */ (sprX==256) ) /* sprite is outside our line */
@ -1474,6 +1484,16 @@ void sprite2D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab)
u8 * pal; u8 * pal;
u16 j; u16 j;
u16 rotScaleA,rotScaleB,rotScaleC,rotScaleD ;
if (spriteInfo->RotScale & 1) {
/* if we need to do rotscale, gather its parameters */
/* http://nocash.emubase.de/gbatek.htm#lcdobjoamrotationscalingparameters */
rotScaleA = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x06,0) ;
rotScaleB = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x0E,0) ;
rotScaleC = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x16,0) ;
rotScaleD = T1ReadWord(gpu->oam + spriteInfo->RotScalIndex*0x20 + 0x1E,0) ;
} ;
sprX = (spriteInfo->X<<23)>>23; sprX = (spriteInfo->X<<23)>>23;
sprY = spriteInfo->Y; sprY = spriteInfo->Y;
sprSize = sprSizeTab[spriteInfo->Size][spriteInfo->Shape]; sprSize = sprSizeTab[spriteInfo->Size][spriteInfo->Shape];