From 821893ce68cda17ce7a1da7747d53bfb5ed7aabb Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 20 Jun 2013 17:41:23 +0000 Subject: [PATCH] - Fix: item name in spy disguise notification was wrong - MTAs don't have to stop when no hand item is found (the ones in the trunk use this though) - Fix: militia drops sector equipment it took, even if it should not drop other gear - otherwise militia ould 'consume' sector invetories git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6141 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Rotting Corpses.cpp | 91 +++++++++++++++++++----------------- Tactical/Soldier Control.cpp | 46 +++++++++--------- 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index cdbafa62..395ab47e 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -925,19 +925,19 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE { Corpse.usFlags |= ROTTING_CORPSE_VEHICLE; - if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE ) - { - Corpse.ubDirection = 7; - } - else - { - Corpse.ubDirection = gb2DirectionsFrom8[ Corpse.ubDirection ]; - } + if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE ) + { + Corpse.ubDirection = 7; + } + else + { + Corpse.ubDirection = gb2DirectionsFrom8[ Corpse.ubDirection ]; + } } if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD ) { - Corpse.ubDirection = 7; + Corpse.ubDirection = 7; } @@ -971,42 +971,42 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE } else if ( ubType == QUEEN_MONSTER_DEAD ) { - gTacticalStatus.fLockItemLocators = FALSE; + gTacticalStatus.fLockItemLocators = FALSE; - ubNumGoo = 6 - ( gGameOptions.ubDifficultyLevel - DIF_LEVEL_EASY ); + ubNumGoo = 6 - ( gGameOptions.ubDifficultyLevel - DIF_LEVEL_EASY ); - sNewGridNo = pSoldier->sGridNo + ( WORLD_COLS * 2 ); + sNewGridNo = pSoldier->sGridNo + ( WORLD_COLS * 2 ); - for ( cnt = 0; cnt < ubNumGoo; cnt++ ) - { - CreateItem( JAR_QUEEN_CREATURE_BLOOD, 100, &gTempObject ); + for ( cnt = 0; cnt < ubNumGoo; cnt++ ) + { + CreateItem( JAR_QUEEN_CREATURE_BLOOD, 100, &gTempObject ); - AddItemToPool( sNewGridNo, &gTempObject, bVisible , pSoldier->pathing.bLevel, usItemFlags, -1 ); - } + AddItemToPool( sNewGridNo, &gTempObject, bVisible , pSoldier->pathing.bLevel, usItemFlags, -1 ); + } } else { - // OK, Place what objects this guy was carrying on the ground! - for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ ) - { - pObj = &( pSoldier->inv[ cnt ] ); - - if ( pObj->exists() == true ) + // OK, Place what objects this guy was carrying on the ground! + for ( cnt = 0; cnt < pSoldier->inv.size(); ++cnt ) { - // Check if it's supposed to be dropped - if ( !( (*pObj).fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum ) + pObj = &( pSoldier->inv[ cnt ] ); + + if ( pObj->exists() == true ) { - // and make sure that it really is a droppable item type -// if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) - if ( !(Item[ pObj->usItem ].defaultundroppable ) ) + // Check if it's supposed to be dropped + if ( !( (*pObj).fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum ) { - ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt ); - //if this soldier was an enemy - // Kaiden: Added from UB's reveal all items after combat feature! - // HEADROCK HAM B2.8: Now also reveals equipment dropped by militia, if requirement is met. - if( pSoldier->bTeam == ENEMY_TEAM || - ( gGameExternalOptions.ubMilitiaDropEquipment == 2 && pSoldier->bTeam == MILITIA_TEAM ) || - ( gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && Menptr[ pSoldier->ubAttackerID ].bTeam != OUR_TEAM )) + // and make sure that it really is a droppable item type + // if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) + if ( !(Item[ pObj->usItem ].defaultundroppable ) ) + { + ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt ); + //if this soldier was an enemy + // Kaiden: Added from UB's reveal all items after combat feature! + // HEADROCK HAM B2.8: Now also reveals equipment dropped by militia, if requirement is met. + if( pSoldier->bTeam == ENEMY_TEAM || + ( gGameExternalOptions.ubMilitiaDropEquipment == 2 && pSoldier->bTeam == MILITIA_TEAM ) || + ( gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && Menptr[ pSoldier->ubAttackerID ].bTeam != OUR_TEAM )) { //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; @@ -1020,21 +1020,26 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE } } - if(UsingNewAttachmentSystem()==true){ + if(UsingNewAttachmentSystem()==true) + { ReduceAttachmentsOnGunForNonPlayerChars(pSoldier, pObj); } - // HEADROCK HAM B2.8: Militia will drop items only if allowed. - if (!(gGameExternalOptions.ubMilitiaDropEquipment == 0 && pSoldier->bTeam == MILITIA_TEAM ) && - !(gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && Menptr[ pSoldier->ubAttackerID ].bTeam == OUR_TEAM )) - { - AddItemToPool( pSoldier->sGridNo, pObj, bVisible , pSoldier->pathing.bLevel, usItemFlags, -1 ); + + // HEADROCK HAM B2.8: Militia will drop items only if allowed. + if (!(gGameExternalOptions.ubMilitiaDropEquipment == 0 && pSoldier->bTeam == MILITIA_TEAM ) && + !(gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && Menptr[ pSoldier->ubAttackerID ].bTeam == OUR_TEAM )) + { + AddItemToPool( pSoldier->sGridNo, pObj, bVisible , pSoldier->pathing.bLevel, usItemFlags, -1 ); + } } } } } - } - DropKeysInKeyRing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, bVisible, FALSE, 0, FALSE ); + DropKeysInKeyRing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, bVisible, FALSE, 0, FALSE ); + + // Flugente: even if we forbid militia from dropping their equipment, they will still drop what they took via sector inventory (this functions only drops what they took) + pSoldier->DropSectorEquipment(); } // Make team look for items diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index b49cd635..ada993b5 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -14722,7 +14722,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void ) ( Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0 ) ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_MILITARYGEARFOUND], this->GetName(), Item[bLoop].szItemName ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_MILITARYGEARFOUND], this->GetName(), Item[this->inv[bLoop].usItem].szItemName ); return FALSE; } } @@ -14744,7 +14744,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void ) ( Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0 ) ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_MILITARYGEARFOUND], this->GetName(), Item[bLoop].szItemName ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_MILITARYGEARFOUND], this->GetName(), Item[this->inv[bLoop].usItem].szItemName ); return FALSE; } } @@ -15657,13 +15657,13 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction() // determine the gridno before us and the item we have in our main hand, this is enough for the current actions OBJECTTYPE* pObj = &(this->inv[HANDPOS]); - if ( !pObj || !(pObj->exists()) ) - fActionStillValid = FALSE; - + // error if the gridno we started working on is not the gridno we are currently looking at if ( usMultiTurnAction == MTA_FORTIFY || usMultiTurnAction == MTA_REMOVE_FORTIFY || usMultiTurnAction == MTA_FILL_SANDBAG ) { - if ( this->sMTActionGridNo != NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ) ) + if ( !pObj || !(pObj->exists()) ) + fActionStillValid = FALSE; + else if ( this->sMTActionGridNo != NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ) ) fActionStillValid = FALSE; } @@ -15731,29 +15731,29 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction() return FALSE; } - // if we are not in turnbased and no enemies are around, we reduce the number of necessary action points to 0. No need to keep waiting if there's nobody around anyway - if ( !( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT ) ) - bOverTurnAPS = 0; - // otherwise this might take longer, so we refresh our animation - else + // refresh animations + switch( usMultiTurnAction ) { - // refresh animations - switch( usMultiTurnAction ) + case MTA_FORTIFY: + case MTA_REMOVE_FORTIFY: + case MTA_FILL_SANDBAG: { - case MTA_FORTIFY: - case MTA_REMOVE_FORTIFY: - case MTA_FILL_SANDBAG: - { - if (!is_networked) - this->EVENT_InitNewSoldierAnim( CUTTING_FENCE, 0 , FALSE ); + // if we are not in turnbased and no enemies are around, we reduce the number of necessary action points to 0. No need to keep waiting if there's nobody around anyway + if ( !( gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT ) ) + bOverTurnAPS = 0; + // otherwise this might take longer, so we refresh our animation else - this->ChangeSoldierState( CUTTING_FENCE, 0, 0 ); + { + if (!is_networked) + this->EVENT_InitNewSoldierAnim( CUTTING_FENCE, 0 , FALSE ); + else + this->ChangeSoldierState( CUTTING_FENCE, 0, 0 ); - // as setting the new animation costs APBPConstants[AP_USEWIRECUTTERS] APs every time, account for that - this->bActionPoints += APBPConstants[AP_USEWIRECUTTERS]; + // as setting the new animation costs APBPConstants[AP_USEWIRECUTTERS] APs every time, account for that + this->bActionPoints += APBPConstants[AP_USEWIRECUTTERS]; } - break; } + break; } // if we can afford it, do it now