mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Press [\] to break window glass with crowbar or any two-handed weapon. Weapon can be damaged in the process.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9368 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+11
-1
@@ -4656,4 +4656,14 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier )
|
||||
iKickPower = max(0, iKickPower);
|
||||
|
||||
return ( iKickPower );
|
||||
}
|
||||
}
|
||||
|
||||
INT16 GetAPsToBreakWindow(SOLDIERTYPE *pSoldier, BOOLEAN fStance)
|
||||
{
|
||||
if (fStance)
|
||||
{
|
||||
return MinAPsToPunch(pSoldier, pSoldier->sGridNo);
|
||||
}
|
||||
|
||||
return MinAPsToPunch(pSoldier, NOWHERE);
|
||||
}
|
||||
|
||||
@@ -387,4 +387,7 @@ INT16 GetBPsToJumpWall( SOLDIERTYPE *pSoldier, BOOLEAN fClimbDown );
|
||||
INT32 GetBPCostPer10APsForGunHolding( SOLDIERTYPE * pSoldier, BOOLEAN fEstimate = FALSE );
|
||||
INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier );
|
||||
|
||||
// sevenfm
|
||||
INT16 GetAPsToBreakWindow(SOLDIERTYPE *pSoldier, BOOLEAN fStance);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -376,6 +376,36 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
case 430:
|
||||
{
|
||||
// sevenfm: breaking window with crowbar code
|
||||
if (pSoldier->inv[HANDPOS].exists() &&
|
||||
(Item[pSoldier->inv[HANDPOS].usItem].crowbar && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) ||
|
||||
Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[pSoldier->inv[HANDPOS].usItem].twohanded && Item[pSoldier->inv[HANDPOS].usItem].metal))
|
||||
{
|
||||
INT32 sWindowGridNo = pSoldier->sTargetGridNo;
|
||||
if (pSoldier->ubDirection == NORTH || pSoldier->ubDirection == WEST)
|
||||
sWindowGridNo = NewGridNo(pSoldier->sGridNo, (UINT16)DirectionInc((UINT8)pSoldier->ubDirection));
|
||||
|
||||
// is there really an intact window that we jump through?
|
||||
if (IsJumpableWindowPresentAtGridNo(sWindowGridNo, pSoldier->ubDirection, TRUE) && !IsJumpableWindowPresentAtGridNo(sWindowGridNo, pSoldier->ubDirection, FALSE))
|
||||
{
|
||||
STRUCTURE * pStructure = FindStructure(sWindowGridNo, STRUCTURE_WALLNWINDOW);
|
||||
if (pStructure && !(pStructure->fFlags & STRUCTURE_OPEN))
|
||||
{
|
||||
// intact window found. Smash it!
|
||||
WindowHit(sWindowGridNo, pStructure->usStructureID, (pSoldier->ubDirection == SOUTH || pSoldier->ubDirection == EAST), TRUE);
|
||||
// damage weapon
|
||||
if (Chance(50 - 10 * min(5, Item[pSoldier->inv[HANDPOS].usItem].bReliability)))
|
||||
{
|
||||
pSoldier->inv[HANDPOS][0]->data.objectStatus--;
|
||||
if (Random(100) < Item[pSoldier->inv[HANDPOS].usItem].usDamageChance)
|
||||
{
|
||||
pSoldier->inv[HANDPOS][0]->data.sRepairThreshold--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"AdjustToNextAnimationFrame: case 430");
|
||||
// SHOOT GUN
|
||||
// MAKE AN EVENT, BUT ONLY DO STUFF IF WE OWN THE GUY!
|
||||
@@ -386,7 +416,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
SFireWeapon.bTargetCubeLevel= pSoldier->bTargetCubeLevel;
|
||||
if((is_server && pSoldier->ubID<120) || (!is_server && is_client && pSoldier->ubID<20) || (!is_server && !is_client) )
|
||||
{
|
||||
//only carry on if own werc
|
||||
//only carry on if own merc
|
||||
AddGameEvent( S_FIREWEAPON, 0, &SFireWeapon );
|
||||
|
||||
//hayden
|
||||
|
||||
@@ -24402,6 +24402,58 @@ void BeginSoldierClimbWallUp( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
void SOLDIERTYPE::BreakWindow(void)
|
||||
{
|
||||
if (this->inv[HANDPOS].exists() &&
|
||||
this->inv[HANDPOS][0]->data.objectStatus >= USABLE &&
|
||||
(Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) ||
|
||||
Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal))
|
||||
{
|
||||
this->usAttackingWeapon = this->inv[HANDPOS].usItem;
|
||||
this->aiData.bAction = AI_ACTION_KNIFE_STAB;
|
||||
this->aiData.usActionData = this->sGridNo;
|
||||
this->aiData.ubPendingAction = NO_PENDING_ACTION;
|
||||
this->sTargetGridNo = this->sGridNo;
|
||||
this->bTargetLevel = this->pathing.bLevel;
|
||||
//this->sLastTarget = sGridNo; //dnl ch73 021013
|
||||
this->ubTargetID = NOBODY; //WhoIsThere2(this->sTargetGridNo, this->bTargetLevel);
|
||||
this->EVENT_InitNewSoldierAnim(CROWBAR_ATTACK, 0, FALSE);
|
||||
SetUIBusy(this->ubID);
|
||||
|
||||
DeductPoints(this, GetAPsToBreakWindow(this, FALSE), BP_USE_CROWBAR);
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN SOLDIERTYPE::CanBreakWindow(void)
|
||||
{
|
||||
if (this->stats.bLife >= OKLIFE &&
|
||||
!this->IsUnconscious() &&
|
||||
IS_MERC_BODY_TYPE(this) &&
|
||||
this->inv[HANDPOS].exists() &&
|
||||
this->inv[HANDPOS][0]->data.objectStatus >= USABLE &&
|
||||
(Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) ||
|
||||
Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal))
|
||||
{
|
||||
//INT32 sWindowGridNo = this->sTargetGridNo;
|
||||
INT32 sWindowGridNo = this->sGridNo;
|
||||
if (this->ubDirection == NORTH || this->ubDirection == WEST)
|
||||
sWindowGridNo = NewGridNo(this->sGridNo, (UINT16)DirectionInc((UINT8)this->ubDirection));
|
||||
|
||||
// is there really an intact window that we jump through?
|
||||
if (IsJumpableWindowPresentAtGridNo(sWindowGridNo, this->ubDirection, TRUE) && !IsJumpableWindowPresentAtGridNo(sWindowGridNo, this->ubDirection, FALSE))
|
||||
{
|
||||
STRUCTURE * pStructure = FindStructure(sWindowGridNo, STRUCTURE_WALLNWINDOW);
|
||||
if (pStructure && !(pStructure->fFlags & STRUCTURE_OPEN))
|
||||
{
|
||||
// intact window found
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN DoesSoldierWearGasMask( SOLDIERTYPE *pSoldier )//dnl ch40 200909
|
||||
{
|
||||
INT8 bPosOfMask = FindGasMask( pSoldier );
|
||||
|
||||
@@ -1789,6 +1789,9 @@ public:
|
||||
void ChangeToFlybackAnimation( UINT8 flyBackDirection );
|
||||
void ChangeToFallbackAnimation( UINT8 fallBackDirection );
|
||||
|
||||
// sevenfm
|
||||
void BreakWindow(void);
|
||||
BOOLEAN CanBreakWindow(void);
|
||||
|
||||
void UpdateRobotControllerGivenController( void );
|
||||
void UpdateRobotControllerGivenRobot( void );
|
||||
|
||||
@@ -2959,6 +2959,20 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
}
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
if (gusSelectedSoldier != NOBODY)
|
||||
{
|
||||
SOLDIERTYPE *pSoldier;
|
||||
if (GetSoldier(&pSoldier, gusSelectedSoldier))
|
||||
{
|
||||
if (pSoldier->CanBreakWindow() && EnoughPoints(pSoldier, GetAPsToBreakWindow(pSoldier, TRUE), BP_USE_CROWBAR, TRUE))
|
||||
pSoldier->BreakWindow();
|
||||
//else if (pSoldier->CanStartDrag())
|
||||
//pSoldier->StartDrag();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#if 0//dnl ch75 021113
|
||||
case '\"':
|
||||
Testing(1);
|
||||
|
||||
Reference in New Issue
Block a user