New feature: riot shields protect against damage from some directions.

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23452&start=0&

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8434 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-07-29 21:18:13 +00:00
parent 8a82802932
commit 11729a132e
22 changed files with 498 additions and 19 deletions
+44
View File
@@ -1571,6 +1571,28 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo
return( FALSE );
}
// Flugente: do we have a riot shield equipped?
if ( pSoldier->IsRiotShieldEquipped( ) )
{
UINT8 attackdir_inverse = GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sBombGridNo );
// if the shield faces the direction of the attack, block it
if ( attackdir_inverse == pSoldier->ubDirection || attackdir_inverse == gOneCCDirection[pSoldier->ubDirection] || attackdir_inverse == gOneCDirection[pSoldier->ubDirection] )
{
INT32 damage = sWoundAmt;
INT32 breathdamage = sBreathAmt;
DamageRiotShield( pSoldier, damage, breathdamage );
sWoundAmt = damage;
sBreathAmt = breathdamage;
if ( sWoundAmt == 0 && sBreathAmt == 0 )
{
return FALSE;
}
}
}
// Lesh: if flashbang
// check if soldier is outdoor and situated farther that half explosion radius and not underground
usHalfExplosionRadius = Explosive[Item[usItem].ubClassIndex].ubRadius / 2;
@@ -4238,6 +4260,9 @@ void HandleExplosionQueue( void )
}
}
// Flugente: riot shields
extern void ShowRiotShield( SOLDIERTYPE* pSoldier );
// Flugente: show warnings around armed timebombs both in map and inventories
void HandleExplosionWarningAnimations( )
{
@@ -4315,6 +4340,25 @@ void HandleExplosionWarningAnimations( )
}
}
}
// show riot shields
SOLDIERTYPE* pSoldier;
UINT16 cnt = gTacticalStatus.Team[0].bFirstID;
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt, pSoldier++ )
{
if ( pSoldier && pSoldier->bActive && pSoldier->bInSector )
{
if ( (pSoldier->ubDirection == EAST ||
pSoldier->ubDirection == SOUTHEAST ||
pSoldier->ubDirection == SOUTH ||
pSoldier->ubDirection == SOUTHWEST ||
pSoldier->ubDirection == NORTHEAST)
&& pSoldier->IsRiotShieldEquipped( ) )
{
ShowRiotShield( pSoldier );
}
}
}
}
void DecayBombTimers( void )
+59
View File
@@ -53,6 +53,11 @@
#include "Render Z.h"
///////////////////////////
#include "Utilities.h"
UINT32 guiShieldGraphic = 0;
BOOLEAN fShieldGraphicInit = FALSE;
extern CHAR8 gDebugStr[128];
extern BOOLEAN fLandLayerDirty = TRUE;
@@ -603,6 +608,50 @@ void DeleteFromWorld( UINT16 usTileIndex, UINT32 uiRenderTiles, UINT16 usIndex )
void RenderHighlight( INT16 sMouseX_M, INT16 sMouseY_M, INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
BOOLEAN CheckRenderCenter( INT16 sNewCenterX, INT16 sNewCenterY );
// Flugente: display a riot shield
void ShowRiotShield( SOLDIERTYPE* pSoldier )
{
if (pSoldier)
{
if (!fShieldGraphicInit)
{
VOBJECT_DESC VObjectDesc;
// Flugente: enemy role symbols
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
FilenameForBPP("Tilecache\\riotshield.sti", VObjectDesc.ImageFile);
if (!AddVideoObject(&VObjectDesc, &guiShieldGraphic))
AssertMsg(0, "Missing Tilecache\\riotshield.sti");
fShieldGraphicInit = TRUE;
}
// Get screen pos of gridno......
INT16 sScreenX, sScreenY;
GetGridNoScreenXY(pSoldier->sGridNo, &sScreenX, &sScreenY);
// redraw background to stop weird graphic remnants remaining
// but don*t do so while scrolling, because that looks weird
if ( !gfScrollPending && !gfScrollInertia)
{
INT32 iBack = RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sScreenX - 50, sScreenY - 60, sScreenX + 50, sScreenY + 35);
if (iBack != -1)
{
SetBackgroundRectFilled(iBack);
}
}
UINT16 offset = 0;
OBJECTTYPE* pObj = pSoldier->GetEquippedRiotShield();
if (pObj)
offset = Item[pObj->usItem].usRiotShieldGraphic;
BltVideoObjectFromIndex( FRAME_BUFFER, guiShieldGraphic, offset * 8 + pSoldier->ubDirection, sScreenX - 20, sScreenY - 60, VO_BLT_TRANSSHADOW, NULL );
}
}
BOOLEAN RevealWalls(INT16 sX, INT16 sY, INT16 sRadius)
{
LEVELNODE *pStruct;
@@ -1837,6 +1886,16 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
usImageIndex = pSoldier->CryoAniFrame( );
}
// Flugente: riot shields
if ( pSoldier &&
(pSoldier->ubDirection == NORTH ||
pSoldier->ubDirection == NORTHWEST ||
pSoldier->ubDirection == WEST)
&& pSoldier->IsRiotShieldEquipped( ) )
{
ShowRiotShield( pSoldier );
}
uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED| BGND_FLAG_MERC;
break;
}