New Feature: static fortifications can now be built by mercs (by Flugente)

- if the terrain allows it, an empty sandbag (item 1540) can be filled to a full sandbag (item 1541). You need to have a shovel (item 1015) in your second hand. You will notice the new hammer cursor
- by using a full sandbag, you can build a sandbag barrier
- by using a concertina stack, you can build a concertina wire barrier
- this only works if the current map has sandbags/concertina wire in its tileset
- with a shovel in your hand, you can remove a sandbag barrier
- changed the size of shovel so it can actually be put in inventories. It was also necessary to remove its ability to be used as a melee weapon.
- for further info, see this thread: http://www.bears-pit.com/board/ubbthreads.php/topics/305822.html#Post305822


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5340 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-06-11 08:32:07 +00:00
parent 56df9f8f69
commit 80509d2b61
25 changed files with 654 additions and 4 deletions
+103 -1
View File
@@ -13403,7 +13403,12 @@ INT32 SOLDIERTYPE::GetDamageResistance(BOOLEAN fAutoResolve, BOOLEAN fCalcBreath
else if (this->ubSoldierClass == SOLDIER_CLASS_ELITE && gGameExternalOptions.sEnemyEliteDamageResistance != 0)
resistance += gGameExternalOptions.sEnemyEliteDamageResistance;
else if (IsZombie())
resistance += gGameExternalOptions.sEnemyZombieDamageResistance;
{
if ( fCalcBreathLoss )
resistance += gGameExternalOptions.sEnemyZombieBreathDamageResistance;
else
resistance += gGameExternalOptions.sEnemyZombieDamageResistance;
}
}
//////////////////////////////////////////////////////////////////////////////////////
@@ -14370,6 +14375,103 @@ void SOLDIERTYPE::EVENT_SoldierBeginAttachCan( INT32 sGridNo, UINT8 ubDirection
}
void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection )
{
BOOLEAN fSuccess = FALSE;
// do checks here...
OBJECTTYPE* pObj = &(this->inv[HANDPOS]);
if ( pObj && pObj->exists() && HasItemFlag(this->inv[ HANDPOS ].usItem, (EMPTY_SANDBAG|FULL_SANDBAG|SHOVEL|CONCERTINA)) )
{
// CHANGE DIRECTION AND GOTO ANIMATION NOW
this->EVENT_SetSoldierDesiredDirection( ubDirection );
this->EVENT_SetSoldierDirection( ubDirection );
if (!is_networked)
this->EVENT_InitNewSoldierAnim( CUTTING_FENCE, 0 , FALSE );
else
this->ChangeSoldierState( CUTTING_FENCE, 0, 0 );
if ( HasItemFlag(this->inv[ HANDPOS ].usItem, (FULL_SANDBAG|CONCERTINA)) )
{
// Build the thing
if ( BuildFortification( Item[ pObj->usItem ].usItemFlag ) )
{
// Erase 'material' item from our hand - we 'used' it to build the structure
DeleteObj( &(this->inv[HANDPOS]) );
// we gain a bit of experience...
StatChange( this, STRAMT, 4, TRUE );
StatChange( this, HEALTHAMT, 2, TRUE );
fSuccess = TRUE;
}
}
else if ( HasItemFlag(this->inv[ HANDPOS ].usItem, (EMPTY_SANDBAG)) )
{
INT8 bOverTerrainType = GetTerrainType( sGridNo );
if( bOverTerrainType == FLAT_GROUND || bOverTerrainType == DIRT_ROAD || bOverTerrainType == LOW_GRASS )
{
// check if we have a shovel in our second hand
OBJECTTYPE* pShovelObj = &(this->inv[SECONDHANDPOS]);
if ( pShovelObj && pShovelObj->exists() && HasItemFlag(this->inv[ SECONDHANDPOS ].usItem, (SHOVEL)) )
{
// test: does there an item that is a filled sandbag exist? (xmls might have changed)
UINT16 fullsandbagnr = 1541;
if ( HasItemFlag(fullsandbagnr, FULL_SANDBAG) )
{
// Erase 'material' item from our hand - we 'used' it to build the structure
INT8 bObjSlot = HANDPOS;
CreateItem( fullsandbagnr, 100, &gTempObject );
SwapObjs( this, bObjSlot, &gTempObject, TRUE );
// we gain a bit of experience...
StatChange( this, STRAMT, 1, TRUE );
StatChange( this, HEALTHAMT, 1, TRUE );
fSuccess = TRUE;
}
}
}
}
else if ( HasItemFlag(this->inv[ HANDPOS ].usItem, (SHOVEL)) )
{
// Build the thing
if ( RemoveFortification( sGridNo ) )
{
// test: does there an item that is a filled sandbag exist? (xmls might have changed)
UINT16 fullsandbagnr = 1541;
if ( HasItemFlag(fullsandbagnr, FULL_SANDBAG) )
{
// Erase 'material' item from our hand - we 'used' it to build the structure
INT8 bObjSlot = HANDPOS;
CreateItem( fullsandbagnr, 100, &gTempObject );
// now add a tripwire item to the floor, simulating that activating tripwire deactivates it
AddItemToPool( sGridNo, &gTempObject, 1, 0, 0, -1 );
// we gain a bit of experience...
StatChange( this, STRAMT, 3, TRUE );
StatChange( this, HEALTHAMT, 2, TRUE );
fSuccess = TRUE;
}
}
}
}
if ( !fSuccess )
{
// Say NOTHING quote...
this->DoMercBattleSound( BATTLE_SOUND_NOTHING );
}
}
void SOLDIERTYPE::EVENT_SoldierBeginReloadRobot( INT32 sGridNo, UINT8 ubDirection, UINT8 ubMercSlot )
{
UINT8 ubPerson;