@ -26,14 +26,10 @@ void UpdatePalette(Art *art, const SDL_Surface *output)
void DrawArt ( Point screenPosition , Art * art , int nFrame , Uint16 srcW , Uint16 srcH )
void DrawArt ( Point screenPosition , Art * art , int nFrame , Uint16 srcW , Uint16 srcH )
{
{
if ( screenPosition . y > = gnScreenHeight | | screenPosition . x > = gnScreenWidth | | art - > surface = = nullptr )
if ( art - > surface = = nullptr | | screenPosition . y > = gnScreenHeight | | screenPosition . x > = gnScreenWidth )
return ;
return ;
SDL_Rect srcRect ;
SDL_Rect srcRect = MakeSdlRect ( 0 , nFrame * art - > h ( ) , art - > w ( ) , art - > h ( ) ) ;
srcRect . x = 0 ;
srcRect . y = nFrame * art - > h ( ) ;
srcRect . w = art - > w ( ) ;
srcRect . h = art - > h ( ) ;
ScaleOutputRect ( & srcRect ) ;
ScaleOutputRect ( & srcRect ) ;
@ -50,23 +46,19 @@ void DrawArt(Point screenPosition, Art *art, int nFrame, Uint16 srcW, Uint16 src
ErrSdl ( ) ;
ErrSdl ( ) ;
}
}
void DrawArt ( const Surface & out , Point screenP osition, Art * art , int nFrame , Uint16 srcW , Uint16 srcH )
void DrawArt ( const Surface & out , Point p osition, Art * art , int nFrame , Uint16 srcW , Uint16 srcH )
{
{
if ( screenPosition . y > = gnScreenHeight | | screenPosition . x > = gnScreenWidth | | art - > surface = = nullptr )
if ( art - > surface = = nullptr | | position . y > = out . h ( ) | | position . x > = out . w ( ) )
return ;
return ;
SDL_Rect srcRect ;
SDL_Rect srcRect = MakeSdlRect ( 0 , nFrame * art - > h ( ) , art - > w ( ) , art - > h ( ) ) ;
srcRect . x = 0 ;
srcRect . y = nFrame * art - > h ( ) ;
srcRect . w = art - > w ( ) ;
srcRect . h = art - > h ( ) ;
if ( srcW ! = 0 & & srcW < srcRect . w )
if ( srcW ! = 0 & & srcW < srcRect . w )
srcRect . w = srcW ;
srcRect . w = srcW ;
if ( srcH ! = 0 & & srcH < srcRect . h )
if ( srcH ! = 0 & & srcH < srcRect . h )
srcRect . h = srcH ;
srcRect . h = srcH ;
out . Clip ( & srcRect , & screenPosition ) ;
SDL_Rect dstRect { screenPosition . x + out . region . x , screenPosition . y + out . region . y , 0 , 0 } ;
out . Clip ( & srcRect , & position ) ;
SDL_Rect dstRect = MakeSdlRect ( position . x + out . region . x , position . y + out . region . y , 0 , 0 ) ;
UpdatePalette ( art , out . surface ) ;
UpdatePalette ( art , out . surface ) ;