- Fix: animated explosion warnings were drawn over inventory

- Fix: animated explosion warnings were only drawn if explosive item was on screen

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8381 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-01-29 12:54:09 +00:00
parent 70473557cd
commit bdc46603d8
+11 -8
View File
@@ -582,7 +582,7 @@ void RenderRubberBanding( )
UnLockVideoSurface( FRAME_BUFFER );
}
// Flugente: draw moving circles around a gridno. This is used to warn the playe of impending explosions
// Flugente: draw moving circles around a gridno. This is used to warn the player of impending explosions
void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
{
if ( usDelay <= 0 )
@@ -597,7 +597,7 @@ void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
static INT32 updatecounter = 0;
INT16 sScreenX, sScreenY;
if ( TileIsOutOfBounds( sGridno ) || !GridNoOnScreen( sGridno ) )
if ( TileIsOutOfBounds( sGridno ) )
return;
// Get screen pos of gridno......
@@ -616,6 +616,8 @@ void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
}
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
// make sure to check for these boundaries later on, and only draw inside them
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y );
INT16 numcircles = max( 1, 4 - usDelay);
@@ -628,11 +630,14 @@ void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
INT16 radius_inner = max( 2, radiusvar );
INT16 radius_outer = radius_inner + radius;
INT32 xl = max( 0, sScreenX - radius_outer );
INT32 xr = sScreenX + radius_outer;
INT32 yl = max( 0, sScreenY - radius_outer );
INT32 yh = sScreenY + radius_outer;
usLineColor = Get16BPPColor( FROMRGB( min( 255, 50 + 2 * radiusvar ), 0, 0 ) );
// determine area of where the circle will be drawn in, take into account what part of the sector we actually see
INT32 xl = max( 0, sScreenX - radius_outer );
INT32 xr = min( gsVIEWPORT_END_X, sScreenX + radius_outer );
INT32 yl = max( 0, sScreenY - radius_outer );
INT32 yh = min( gsVIEWPORT_WINDOW_END_Y, sScreenY + radius_outer );
for ( INT32 x = xl; x <= xr; ++x )
{
for ( INT32 y = yl; y <= yh; ++y )
@@ -641,8 +646,6 @@ void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
if ( radius_inner <= diff && diff <= radius_outer )
{
usLineColor = Get16BPPColor( FROMRGB( min( 255, 50 + 2 * radiusvar ), 0, 0 ) );
PixelDraw( FALSE, x, y, usLineColor, pDestBuf );
}
}