mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Fortification feature fixes (by Flugente)
- fixed a bug that prohibited building a structure in turnbased mode - fixed a bug that caused a wrong AP cost for fortification actions - fixed itemflag - fixed cursor animations for fortifications git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5343 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -5997,12 +5997,12 @@ BOOLEAN BuildFortification( UINT32 flag )
|
||||
if ( gusSelectedSoldier == NOBODY )
|
||||
return FALSE;
|
||||
|
||||
if( (gTacticalStatus.uiFlags & INCOMBAT) && (gTacticalStatus.uiFlags & TURNBASED) )
|
||||
// comment this in to forbid building while enemies are around
|
||||
/*if( (gTacticalStatus.uiFlags & INCOMBAT) && (gTacticalStatus.uiFlags & TURNBASED) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* // comment this in to forbid building while enemies are around
|
||||
|
||||
if( gWorldSectorX != -1 && gWorldSectorY != -1 && gWorldSectorX != 0 && gWorldSectorY != 0 &&
|
||||
NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) > 0 )
|
||||
{
|
||||
|
||||
+2
-7
@@ -3481,13 +3481,8 @@ INT16 GetAPsToBuildFortification( SOLDIERTYPE *pSoldier, INT32 usMapPos )
|
||||
INT16 sAPCost = 0;
|
||||
|
||||
sAPCost = PlotPath( pSoldier, usMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints );
|
||||
|
||||
// If point cost is zero, return 0
|
||||
if ( sAPCost != 0 )
|
||||
{
|
||||
// ADD APS TO PICKUP
|
||||
sAPCost += APBPConstants[AP_FORTIFICATION];
|
||||
}
|
||||
|
||||
sAPCost += APBPConstants[AP_FORTIFICATION];
|
||||
|
||||
return sAPCost;
|
||||
|
||||
|
||||
@@ -14392,6 +14392,11 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
else
|
||||
this->ChangeSoldierState( CUTTING_FENCE, 0, 0 );
|
||||
|
||||
// ugly, ugly hack: as e do not have a special animation for this action, we use the 'cut a fence' animations
|
||||
// however, APs are directly deducted because of this. So we can't use the AP_FORTIFICATION costs
|
||||
// for this reason, we deduct the APS still missing here
|
||||
INT16 restAPs = max(0, APBPConstants[AP_FORTIFICATION] - APBPConstants[AP_USEWIRECUTTERS]);
|
||||
|
||||
if ( HasItemFlag(this->inv[ HANDPOS ].usItem, (FULL_SANDBAG|CONCERTINA)) )
|
||||
{
|
||||
// Build the thing
|
||||
@@ -14404,6 +14409,8 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
StatChange( this, STRAMT, 4, TRUE );
|
||||
StatChange( this, HEALTHAMT, 2, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -14432,8 +14439,31 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
StatChange( this, STRAMT, 1, TRUE );
|
||||
StatChange( this, HEALTHAMT, 1, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fullsandbagnr = 2824;
|
||||
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 );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14458,8 +14488,32 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
StatChange( this, STRAMT, 3, TRUE );
|
||||
StatChange( this, HEALTHAMT, 2, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fullsandbagnr = 2824;
|
||||
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 );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2162,6 +2162,8 @@ UINT8 HandleFortificationCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 ui
|
||||
{
|
||||
return( FORTIFICATION_RED_UICURSOR );
|
||||
}
|
||||
else
|
||||
return( FORTIFICATION_RED_UICURSOR );
|
||||
}
|
||||
|
||||
if ( HasItemFlag( (&(pSoldier->inv[HANDPOS]))->usItem, (SHOVEL)) )
|
||||
@@ -2172,6 +2174,8 @@ UINT8 HandleFortificationCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 ui
|
||||
{
|
||||
return( FORTIFICATION_GREY_UICURSOR );
|
||||
}
|
||||
else
|
||||
return( FORTIFICATION_RED_UICURSOR );
|
||||
}
|
||||
|
||||
// can we build something here?
|
||||
|
||||
Reference in New Issue
Block a user