mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
- AI controlled soldiers can now jump through windows
- new ini option allows to jump through closed windows, smashing them while doing so git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5682 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -8912,7 +8912,7 @@ void SOLDIERTYPE::BeginSoldierClimbUpRoof( void )
|
||||
this->ubPendingDirection = bNewDirection;
|
||||
//this->usPendingAnimation = CLIMBUPROOF;
|
||||
|
||||
#ifdef ENABLE_ZOMBIES
|
||||
#ifdef ENABLE_ZOMBIES
|
||||
// Flugente: In case an animation is missing (zombies with bodytype of civilians), we TELEPORT instead
|
||||
if ( IsAnimationValidForBodyType( this, CLIMBUPROOF ) == FALSE )
|
||||
{
|
||||
@@ -8990,8 +8990,43 @@ void SOLDIERTYPE::BeginSoldierClimbWindow( void )
|
||||
EVENT_InternalSetSoldierDesiredDirection( this, bDirection, FALSE, this->usAnimState );
|
||||
this->flags.fTurningUntilDone = TRUE;
|
||||
// ATE: Reset flag to go back to prone...
|
||||
|
||||
// Flugente: In case an animation is missing (civilian bodytypes), we TELEPORT instead
|
||||
if ( IsAnimationValidForBodyType( this, JUMPWINDOWS ) == FALSE )
|
||||
{
|
||||
TeleportSoldier( this, this->sTempNewGridNo, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF;
|
||||
this->usPendingAnimation = JUMPWINDOWS; //HOPFENCE;
|
||||
this->usPendingAnimation = JUMPWINDOWS;
|
||||
}
|
||||
|
||||
// Flugente: if an AI guy, end turn (weird endless clock syndrome)
|
||||
if ( this->bTeam != OUR_TEAM )
|
||||
EndAIGuysTurn( this);
|
||||
|
||||
// Flugente: if we are jumping through an intact window, smash it during our animation
|
||||
if ( gGameExternalOptions.fCanJumpThroughClosedWindows )
|
||||
{
|
||||
INT32 sNewGridNo = sGridNo;
|
||||
if (this->ubDirection == NORTH || this->ubDirection == WEST)
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)this->ubDirection ) );
|
||||
|
||||
// is there really an intact window that we jump through?
|
||||
if ( IsJumpableWindowPresentAtGridNo( sNewGridNo, this->ubDirection, TRUE ) && !IsJumpableWindowPresentAtGridNo( sNewGridNo, this->ubDirection, FALSE ) )
|
||||
{
|
||||
STRUCTURE * pStructure = FindStructure( sNewGridNo, STRUCTURE_WALLNWINDOW );
|
||||
if ( pStructure && !( pStructure->fFlags & STRUCTURE_OPEN ) )
|
||||
{
|
||||
// intact window found. Smash it!
|
||||
WindowHit( sNewGridNo, pStructure->usStructureID, (this->ubDirection == SOUTH || this->ubDirection == EAST), TRUE );
|
||||
|
||||
// we get a bit of damage for jumping through a window
|
||||
this->SoldierTakeDamage( 0, 1, 0, 1000, TAKE_DAMAGE_ELECTRICITY, NOBODY, sNewGridNo, 0, TRUE );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "worlddef.h"
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include "GameSettings.h" // added by Flugente
|
||||
|
||||
#define PTR_CIVILIAN (pSoldier->bTeam == CIV_TEAM)
|
||||
#define PTR_CROUCHED (gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_CROUCH)
|
||||
|
||||
+11
-10
@@ -21,7 +21,7 @@ extern BOOLEAN DoesSAMExistHere( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ,
|
||||
|
||||
//----------------legion by Jazz
|
||||
|
||||
BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo, INT8 direction2 )
|
||||
BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo, INT8 direction2, BOOLEAN fIntactWindowsAlso )
|
||||
{
|
||||
STRUCTURE * pStructure;
|
||||
|
||||
@@ -29,16 +29,17 @@ BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo, INT8 direction2 )
|
||||
|
||||
if ( pStructure )
|
||||
{
|
||||
|
||||
if ( ( direction2 == SOUTH || direction2 == NORTH ) && (pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT || pStructure->ubWallOrientation == INSIDE_TOP_LEFT ) && pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) && ( pStructure->fFlags & STRUCTURE_OPEN ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
if ( ( direction2 == SOUTH || direction2 == NORTH ) && (pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT || pStructure->ubWallOrientation == INSIDE_TOP_LEFT ) && pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) )
|
||||
{
|
||||
if ( fIntactWindowsAlso || ( pStructure->fFlags & STRUCTURE_OPEN ) )
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
if ( ( direction2 == EAST || direction2 == WEST ) && ( pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT || pStructure->ubWallOrientation == INSIDE_TOP_RIGHT ) && pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) && ( pStructure->fFlags & STRUCTURE_OPEN ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
if ( ( direction2 == EAST || direction2 == WEST ) && ( pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT || pStructure->ubWallOrientation == INSIDE_TOP_RIGHT ) && pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) )
|
||||
{
|
||||
if ( fIntactWindowsAlso || ( pStructure->fFlags & STRUCTURE_OPEN ) )
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
|
||||
@@ -50,7 +50,7 @@ BOOLEAN IsCorpseAtGridNo( INT32 sGridNo, UINT8 ubLevel );
|
||||
BOOLEAN SetOpenableStructureToClosed( INT32 sGridNo, UINT8 ubLevel );
|
||||
|
||||
//Legion by Jazz
|
||||
BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo , INT8 direction2 ); //legion 2 Windows
|
||||
BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo , INT8 direction2, BOOLEAN fIntactWindowsAlso ); //legion 2 Windows
|
||||
BOOLEAN IsLegionWallPresentAtGridno( INT32 sGridNo ); //legion 2 Fence
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user