mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
- Fix: delayed explosions not possible in roofs
- Fix: delayed explosions warnings not correctly drawn depending on height level - improved delayed explosion warning calculations git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8382 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -606,7 +606,7 @@ void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
|
|||||||
// ATE: If we are on a higher interface level, substract....
|
// ATE: If we are on a higher interface level, substract....
|
||||||
if ( usLevel == 1 )
|
if ( usLevel == 1 )
|
||||||
sScreenY -= 50;
|
sScreenY -= 50;
|
||||||
|
|
||||||
if ( (GetJA2Clock( ) - uiTimeOfLastUpdate) > 30 )
|
if ( (GetJA2Clock( ) - uiTimeOfLastUpdate) > 30 )
|
||||||
{
|
{
|
||||||
uiTimeOfLastUpdate = GetJA2Clock( );
|
uiTimeOfLastUpdate = GetJA2Clock( );
|
||||||
@@ -622,6 +622,13 @@ void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
|
|||||||
|
|
||||||
INT16 numcircles = max( 1, 4 - usDelay);
|
INT16 numcircles = max( 1, 4 - usDelay);
|
||||||
|
|
||||||
|
// we determine the biggest rectangle we have to reserve
|
||||||
|
INT32 best_xl = 99999;
|
||||||
|
INT32 best_xr = 0;
|
||||||
|
INT32 best_yl = 99999;
|
||||||
|
INT32 best_yr = 0;
|
||||||
|
BOOLEAN sthdrawn = FALSE;
|
||||||
|
|
||||||
for ( int i = 0; i < numcircles; ++i )
|
for ( int i = 0; i < numcircles; ++i )
|
||||||
{
|
{
|
||||||
INT32 radiusvar = (updatecounter + i * periods / numcircles) % periods;
|
INT32 radiusvar = (updatecounter + i * periods / numcircles) % periods;
|
||||||
@@ -636,29 +643,42 @@ void DrawExplosionWarning( INT32 sGridno, INT8 usLevel, INT8 usDelay )
|
|||||||
INT32 xl = max( 0, sScreenX - radius_outer );
|
INT32 xl = max( 0, sScreenX - radius_outer );
|
||||||
INT32 xr = min( gsVIEWPORT_END_X, sScreenX + radius_outer );
|
INT32 xr = min( gsVIEWPORT_END_X, sScreenX + radius_outer );
|
||||||
INT32 yl = max( 0, sScreenY - radius_outer );
|
INT32 yl = max( 0, sScreenY - radius_outer );
|
||||||
INT32 yh = min( gsVIEWPORT_WINDOW_END_Y, sScreenY + radius_outer );
|
INT32 yr = min( gsVIEWPORT_WINDOW_END_Y, sScreenY + radius_outer );
|
||||||
|
|
||||||
|
best_xl = min( best_xl, xl );
|
||||||
|
best_xr = max( best_xr, xr );
|
||||||
|
best_yl = min( best_yl, yl );
|
||||||
|
best_yr = max( best_yr, yr );
|
||||||
|
|
||||||
for ( INT32 x = xl; x <= xr; ++x )
|
for ( INT32 x = xl; x <= xr; ++x )
|
||||||
{
|
{
|
||||||
for ( INT32 y = yl; y <= yh; ++y )
|
FLOAT xdiffsquared = (FLOAT)((sScreenX - x) * (sScreenX - x));
|
||||||
|
|
||||||
|
for ( INT32 y = yl; y <= yr; ++y )
|
||||||
{
|
{
|
||||||
FLOAT diff = sqrt( (FLOAT)((sScreenX - x) * (sScreenX - x) + 2 * (sScreenY - y) * (sScreenY - y)) );
|
FLOAT diff = sqrt( (FLOAT)(xdiffsquared + 2 * (sScreenY - y) * (sScreenY - y)) );
|
||||||
|
|
||||||
if ( radius_inner <= diff && diff <= radius_outer )
|
if ( radius_inner <= diff && diff <= radius_outer )
|
||||||
{
|
{
|
||||||
PixelDraw( FALSE, x, y, usLineColor, pDestBuf );
|
PixelDraw( FALSE, x, y, usLineColor, pDestBuf );
|
||||||
|
|
||||||
|
sthdrawn = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, xl, yl, (INT16)(xr + 1), (INT16)(yh + 1) );
|
// only do this once
|
||||||
|
if ( sthdrawn )
|
||||||
|
{
|
||||||
|
iBack = RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, best_xl, best_yl, (INT16)(best_xr + 1), (INT16)(best_yr + 1) );
|
||||||
|
|
||||||
if ( iBack != -1 )
|
if ( iBack != -1 )
|
||||||
{
|
{
|
||||||
SetBackgroundRectFilled( iBack );
|
SetBackgroundRectFilled( iBack );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnLockVideoSurface( FRAME_BUFFER );
|
UnLockVideoSurface( FRAME_BUFFER );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4254,7 +4254,7 @@ void HandleExplosionWarningAnimations( )
|
|||||||
|
|
||||||
if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_TIMED && !((*pObj).fFlags & OBJECT_DISABLED_BOMB) && (*pObj)[0]->data.misc.bDelay )
|
if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_TIMED && !((*pObj).fFlags & OBJECT_DISABLED_BOMB) && (*pObj)[0]->data.misc.bDelay )
|
||||||
{
|
{
|
||||||
DrawExplosionWarning( gWorldItems[gWorldBombs[uiWorldBombIndex].iItemIndex].sGridNo, gsInterfaceLevel, ( *pObj )[0]->data.misc.bDelay );
|
DrawExplosionWarning( gWorldItems[gWorldBombs[uiWorldBombIndex].iItemIndex].sGridNo, gWorldItems[gWorldBombs[uiWorldBombIndex].iItemIndex].ubLevel, (*pObj)[0]->data.misc.bDelay );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4279,7 +4279,7 @@ void HandleExplosionWarningAnimations( )
|
|||||||
|
|
||||||
if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_TIMED && (*pObj)[0]->data.misc.bDelay )
|
if ( (*pObj)[0]->data.misc.bDetonatorType == BOMB_TIMED && (*pObj)[0]->data.misc.bDelay )
|
||||||
{
|
{
|
||||||
DrawExplosionWarning( pSoldier->sGridNo, gsInterfaceLevel, ( *pObj )[0]->data.misc.bDelay );
|
DrawExplosionWarning( pSoldier->sGridNo, pSoldier->pathing.bLevel, (*pObj)[0]->data.misc.bDelay );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2643,11 +2643,11 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Flugente: explosions on the roof do work...
|
||||||
// If we landed on anything other than the floor, always! go off...
|
// If we landed on anything other than the floor, always! go off...
|
||||||
if( sZ != 0 ||
|
if ( pObject->fInWater ||
|
||||||
pObject->fInWater ||
|
!fCanDelayExplosion ||
|
||||||
!fCanDelayExplosion ||
|
fGoodStatus && !gGameExternalOptions.fDelayedGrenadeExplosion && !fDelayedExplosion )
|
||||||
fGoodStatus && !gGameExternalOptions.fDelayedGrenadeExplosion && !fDelayedExplosion )
|
|
||||||
{
|
{
|
||||||
fDoImpact = TRUE;
|
fDoImpact = TRUE;
|
||||||
fIsDud = false;
|
fIsDud = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user