mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
- new function: militia can be ordered to pick up gear from sector in tactical, just like ordering them to drop it. does not work in combat for obvious reason.
- if militia stand in water and are ordered to drop their equipment, they will drop it on land. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6263 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -4845,16 +4845,29 @@ void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGr
|
||||
wcscpy( gzUserDefinedButton[0], TacticalStr[ FILL_CANTEEN_STR ] );
|
||||
wcscpy( gzUserDefinedButton[1], TacticalStr[ CLEAN_ONE_GUN_STR ] );
|
||||
wcscpy( gzUserDefinedButton[2], TacticalStr[ CLEAN_ALL_GUNS_STR ] );
|
||||
wcscpy( gzUserDefinedButton[3], TacticalStr[ TAKE_OFF_CLOTHES_STR ] );
|
||||
wcscpy( gzUserDefinedButton[4], TacticalStr[ MILITIA_DROP_EQ_STR ] );
|
||||
|
||||
if ( gpTempSoldier->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
|
||||
wcscpy( gzUserDefinedButton[3], TacticalStr[ TAKE_OFF_DISGUISE_STR ] );
|
||||
else
|
||||
wcscpy( gzUserDefinedButton[3], TacticalStr[ TAKE_OFF_CLOTHES_STR ] );
|
||||
|
||||
if ( gGameExternalOptions.fMilitiaUseSectorInventory )
|
||||
{
|
||||
wcscpy( gzUserDefinedButton[4], TacticalStr[ MILITIA_DROP_EQ_STR ] );
|
||||
wcscpy( gzUserDefinedButton[5], TacticalStr[ MILITIA_PICK_UP_EQ_STR ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscpy( gzUserDefinedButton[4], TacticalStr[ UNUSED_STR ] );
|
||||
wcscpy( gzUserDefinedButton[5], TacticalStr[ UNUSED_STR ] );
|
||||
}
|
||||
|
||||
// if disguised, allow testing our disguise
|
||||
if ( gpTempSoldier->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
|
||||
wcscpy( gzUserDefinedButton[5], TacticalStr[ SPY_SELFTEST_STR ] );
|
||||
wcscpy( gzUserDefinedButton[6], TacticalStr[ SPY_SELFTEST_STR ] );
|
||||
else
|
||||
wcscpy( gzUserDefinedButton[5], TacticalStr[ UNUSED_STR ] );
|
||||
wcscpy( gzUserDefinedButton[6], TacticalStr[ UNUSED_STR ] );
|
||||
|
||||
wcscpy( gzUserDefinedButton[6], TacticalStr[ UNUSED_STR ] );
|
||||
wcscpy( gzUserDefinedButton[7], TacticalStr[ UNUSED_STR ] );
|
||||
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ FUNCTION_SELECTION_STR ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS, TacticalFunctionSelectionMessageBoxCallBack, NULL );
|
||||
}
|
||||
@@ -5029,9 +5042,15 @@ void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue )
|
||||
break;
|
||||
case 5:
|
||||
// militia drops all gear taken from sector inventory
|
||||
TeamDropAll( MILITIA_TEAM );
|
||||
if ( gGameExternalOptions.fMilitiaUseSectorInventory )
|
||||
TeamDropAll( MILITIA_TEAM );
|
||||
break;
|
||||
case 6:
|
||||
// militia takes gear from sector inventory
|
||||
if ( gGameExternalOptions.fMilitiaUseSectorInventory )
|
||||
TeamRestock( MILITIA_TEAM );
|
||||
break;
|
||||
case 7:
|
||||
// test our disguise
|
||||
if ( gpTempSoldier->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
|
||||
gpTempSoldier->SpySelfTest();
|
||||
|
||||
+45
-3
@@ -109,6 +109,7 @@
|
||||
#include "Militia Control.h"
|
||||
#include "Lua Interpreter.h"
|
||||
#include "bullets.h"
|
||||
#include "Inventory Choosing.h" // added by Flugente for TakeMilitiaEquipmentfromSector()
|
||||
#endif
|
||||
#include "connect.h"
|
||||
|
||||
@@ -10131,13 +10132,12 @@ void TeamDropAll(UINT8 bTeam, BOOLEAN fForce)
|
||||
// not if this team is hostile to us
|
||||
if ( gTacticalStatus.Team[ gbPlayerNum ].bSide != gTacticalStatus.Team[ bTeam ].bSide )
|
||||
return;
|
||||
|
||||
SOLDIERTYPE *pSoldier;
|
||||
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Team %d drops all items for inspection!", bTeam );
|
||||
#endif
|
||||
|
||||
SOLDIERTYPE *pSoldier;
|
||||
UINT32 uiCnt = 0;
|
||||
UINT32 firstid = gTacticalStatus.Team[ bTeam ].bFirstID;
|
||||
UINT32 lastid = gTacticalStatus.Team[ bTeam ].bLastID;
|
||||
@@ -10151,6 +10151,48 @@ void TeamDropAll(UINT8 bTeam, BOOLEAN fForce)
|
||||
}
|
||||
}
|
||||
|
||||
void TeamRestock(UINT8 bTeam)
|
||||
{
|
||||
if ( bTeam > PLAYER_PLAN )
|
||||
return;
|
||||
|
||||
// not if there is a battle going on
|
||||
if ( (gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||
return;
|
||||
|
||||
// not if this team is hostile to us
|
||||
if ( gTacticalStatus.Team[ gbPlayerNum ].bSide != gTacticalStatus.Team[ bTeam ].bSide )
|
||||
return;
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Team %d restocks gear from sector inventory!", bTeam );
|
||||
#endif
|
||||
|
||||
SOLDIERTYPE *pSoldier;
|
||||
UINT32 uiCnt = 0;
|
||||
UINT32 firstid = gTacticalStatus.Team[ bTeam ].bFirstID;
|
||||
UINT32 lastid = gTacticalStatus.Team[ bTeam ].bLastID;
|
||||
for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier)
|
||||
{
|
||||
if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) )
|
||||
{
|
||||
// the function fills a createstruct, so create one
|
||||
SOLDIERCREATE_STRUCT createstruct;
|
||||
|
||||
// we first have to copy over all our currently equipped items, otherwise we might overwrite them later
|
||||
createstruct.Inv = pSoldier->inv;
|
||||
|
||||
TakeMilitiaEquipmentfromSector(pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, &createstruct, pSoldier->ubSoldierClass);
|
||||
|
||||
// replace our inventory with the new one
|
||||
pSoldier->inv = createstruct.Inv;
|
||||
|
||||
// we took new gear, so we can drop it again
|
||||
pSoldier->bSoldierFlagMask &= ~SOLDIER_EQUIPMENT_DROPPED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// are we allowed to steal access this guy's inventory?
|
||||
BOOLEAN AllowedToStealFromTeamMate( UINT8 ubID, UINT8 ubTargetID )
|
||||
{
|
||||
|
||||
+5
-1
@@ -355,9 +355,13 @@ extern UINT8 NumEnemyInSector();
|
||||
extern UINT8 NumZombiesInSector();
|
||||
#endif
|
||||
|
||||
void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ); // Flugente: offer the enemy the chance to surrender
|
||||
// Flugente: offer the enemy the chance to surrender
|
||||
void HandleSurrenderOffer( SOLDIERTYPE* pSoldier );
|
||||
|
||||
// Flugente: order a team to drop gear, or pick it up
|
||||
// setting fForce to TRUE allows dropping of gear in combat (used in auto-resolve instances)
|
||||
void TeamDropAll(UINT8 bTeam, BOOLEAN fForce = FALSE);
|
||||
void TeamRestock(UINT8 bTeam);
|
||||
|
||||
// are we allowed to steal access this guy's inventory?
|
||||
BOOLEAN AllowedToStealFromTeamMate( UINT8 aAccessorID, UINT8 aTargetID );
|
||||
|
||||
@@ -15903,6 +15903,13 @@ void SOLDIERTYPE::DropSectorEquipment()
|
||||
OBJECTTYPE* pObj = NULL;
|
||||
UINT8 size = this->inv.size();
|
||||
|
||||
INT32 sPutGridNo = this->sGridNo;
|
||||
if ( sPutGridNo == NOWHERE )
|
||||
sPutGridNo = RandomGridNo();
|
||||
|
||||
if ( Water( sPutGridNo) )
|
||||
sPutGridNo = gMapInformation.sCenterGridNo;
|
||||
|
||||
if ( ( this->sSectorX == gWorldSectorX ) && ( this->sSectorY == gWorldSectorY ) && ( this->bSectorZ == gbWorldSectorZ) )
|
||||
{
|
||||
for ( UINT8 cnt = 0; cnt < size; ++cnt )
|
||||
@@ -15920,10 +15927,6 @@ void SOLDIERTYPE::DropSectorEquipment()
|
||||
if ( !gGameExternalOptions.fMilitiaUseSectorInventory_Ammo && Item[ pObj->usItem ].usItemClass & IC_GUN )
|
||||
(*pObj)[0]->data.gun.ubGunShotsLeft = 0;
|
||||
|
||||
INT32 sPutGridNo = this->sGridNo;
|
||||
if ( sPutGridNo == NOWHERE )
|
||||
sPutGridNo = RandomGridNo();
|
||||
|
||||
AddItemToPool( sPutGridNo, pObj, 1 , this->pathing.bLevel, (WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO|WORLD_ITEM_REACHABLE), -1 );
|
||||
DeleteObj( &(this->inv[cnt]) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user