- 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:
Flugente
2013-07-31 18:59:32 +00:00
parent 64f7d6e616
commit 71274fdf55
14 changed files with 152 additions and 61 deletions
+25 -6
View File
@@ -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
View File
@@ -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
View File
@@ -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 );
+7 -4
View File
@@ -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]) );
}
+8 -3
View File
@@ -957,12 +957,20 @@ enum
CLEAN_ONE_GUN_STR,
CLEAN_ALL_GUNS_STR,
TAKE_OFF_CLOTHES_STR,
TAKE_OFF_DISGUISE_STR,
MILITIA_DROP_EQ_STR,
MILITIA_PICK_UP_EQ_STR,
SPY_SELFTEST_STR,
UNUSED_STR,
CORPSE_SELECTION_STR,
DECAPITATE_STR,
GUT_STR,
TAKE_CLOTHES_STR,
TAKE_BODY_STR,
WEAPON_CLEANING_STR,
PRISONER_NO_PRISONS_STR,
PRISONER_DECIDE_STR,
PRISONER_LETGO_STR,
@@ -970,9 +978,6 @@ enum
PRISONER_DEMAND_SURRENDER_STR,
PRISONER_OFFER_SURRENDER_STR,
PRISONER_TALK_STR,
MILITIA_DROP_EQ_STR,
SPY_SELFTEST_STR,
UNUSED_STR,
TEXT_NUM_TACTICAL_STR
};
+5 -3
View File
@@ -2937,6 +2937,11 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"清理枪支污垢(佣兵)",
L"清理所有枪支污垢(小队)",
L"脱掉衣服",
L"Lose disguise",
L"民兵检查", //L"Militia inspection",
L"Militia restock",
L"测试伪装", //L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"你想要对尸体做什么?",
@@ -2956,9 +2961,6 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"劝说敌人投降",
L"劝降", //L"Offer surrender",
L"交谈",
L"民兵检查", //L"Militia inspection",
L"测试伪装", //L"Test disguise",
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+8 -6
View File
@@ -2929,12 +2929,17 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
// added by Flugente: selection of a function to call in tactical // TODO.Translate
// added by Flugente: selection of a function to call in tactical
L"What do you want to do?",
L"Fill canteens",
L"Clean guns (Merc)",//TODO.Translate
L"Clean guns (Merc)",
L"Clean guns (Team)",
L"Take off clothes",
L"Lose disguise",
L"Militia inspection",
L"Militia restock",
L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"What do you want to do with the body?",
@@ -2948,15 +2953,12 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go",
L"Where do you want to send the prisoners?",//TODO.Translate
L"Where do you want to send the prisoners?",
L"Let them go",
L"What do you want to do?",
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//TODO.Translate
L"Test disguise", // TODO.Translate
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+5 -3
View File
@@ -2937,6 +2937,11 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Clean guns (Merc)",
L"Clean guns (Team)",
L"Take off clothes",
L"Lose disguise",
L"Militia inspection",
L"Militia restock",
L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"What do you want to do with the body?",
@@ -2956,9 +2961,6 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",
L"Test disguise",
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+8 -6
View File
@@ -2936,12 +2936,17 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
// added by Flugente: selection of a function to call in tactical // TODO.Translate
// added by Flugente: selection of a function to call in tactical
L"What do you want to do?",
L"Fill canteens",
L"Clean guns (Merc)",//TODO.Translate
L"Clean guns (Merc)",
L"Clean guns (Team)",
L"Take off clothes",
L"Lose disguise",
L"Militia inspection",
L"Militia restock",
L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"What do you want to do with the body?",
@@ -2955,15 +2960,12 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go",
L"Where do you want to send the prisoners?",//TODO.Translate
L"Where do you want to send the prisoners?",
L"Let them go",
L"What do you want to do?",
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//TODO.Translate
L"Test disguise", // TODO.Translate
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+7 -5
View File
@@ -2936,9 +2936,14 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: selection of a function to call in tactical
L"Was möchten Sie tun?",
L"Feldflasche auffüllen",
L"Clean guns (Merc)",//TODO.Translate
L"Clean guns (Team)",
L"Waffen reinigen (Merc)",
L"Waffen reinigen (Team)",
L"Kleidung ausziehen",
L"Verkleidung loswerden",
L"Miliz inspizieren",
L"Miliz ausrüsten",
L"Verkleidung testen",
L"unused",
// added by Flugente: decide what to do with the corpses
L"Was möchten Sie mit der Leiche tun?",
@@ -2958,9 +2963,6 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Kapitulation fordern",
L"Kapitulation anbieten",
L"Sprechen",
L"Miliz inspizieren",
L"Verkleidung testen",
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+8 -6
View File
@@ -2923,12 +2923,17 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
// added by Flugente: selection of a function to call in tactical // TODO.Translate
// added by Flugente: selection of a function to call in tactical
L"What do you want to do?",
L"Fill canteens",
L"Clean guns (Merc)",//TODO.Translate
L"Clean guns (Merc)",
L"Clean guns (Team)",
L"Take off clothes",
L"Lose disguise",
L"Militia inspection",
L"Militia restock",
L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"What do you want to do with the body?",
@@ -2942,15 +2947,12 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go",
L"Where do you want to send the prisoners?",//TODO.Translate
L"Where do you want to send the prisoners?",
L"Let them go",
L"What do you want to do?",
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//TODO.Translate
L"Test disguise", // TODO.Translate
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+8 -6
View File
@@ -2939,12 +2939,17 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
// added by Flugente: selection of a function to call in tactical // TODO.Translate
// added by Flugente: selection of a function to call in tactical
L"What do you want to do?",
L"Fill canteens",
L"Clean guns (Merc)",//TODO.Translate
L"Clean guns (Merc)",
L"Clean guns (Team)",
L"Take off clothes",
L"Lose disguise",
L"Militia inspection",
L"Militia restock",
L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"What do you want to do with the body?",
@@ -2958,15 +2963,12 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go",
L"Where do you want to send the prisoners?",//TODO.Translate
L"Where do you want to send the prisoners?",
L"Let them go",
L"What do you want to do?",
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//TODO.Translate
L"Test disguise", // TODO.Translate
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+5 -3
View File
@@ -2936,6 +2936,11 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Clean guns (Merc)",//TODO.Translate
L"Clean guns (Team)",
L"Снять одежду",
L"Lose disguise",
L"Militia inspection",
L"Militia restock",
L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"Что будем делать с телом?",
@@ -2955,9 +2960,6 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Требовать сдаться",
L"Предлоить сдаться",
L"Переговоры",
L"Militia inspection",//TODO.Translate
L"Test disguise", // TODO.Translate
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+8 -6
View File
@@ -2933,12 +2933,17 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s",
// added by Flugente: selection of a function to call in tactical // TODO.Translate
// added by Flugente: selection of a function to call in tactical
L"What do you want to do?",
L"Fill canteens",
L"Clean guns (Merc)",//TODO.Translate
L"Clean guns (Merc)",
L"Clean guns (Team)",
L"Take off clothes",
L"Lose disguise",
L"Militia inspection",
L"Militia restock",
L"Test disguise",
L"unused",
// added by Flugente: decide what to do with the corpses
L"What do you want to do with the body?",
@@ -2952,15 +2957,12 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go",
L"Where do you want to send the prisoners?",//TODO.Translate
L"Where do you want to send the prisoners?",
L"Let them go",
L"What do you want to do?",
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//TODO.Translate
L"Test disguise", // TODO.Translate
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.