- new feature: we can now equip militia with gear from sectors, see http://www.bears-pit.com/board/ubbthreads.php/topics/315664.html#Post315664 for more information

- increased the object flag size to UINT64, this breaks savegame compatibility

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5869 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-02-23 18:32:55 +00:00
parent 01e2d1b29c
commit 59b2549bd6
38 changed files with 1425 additions and 49 deletions
+1 -1
View File
@@ -3769,7 +3769,7 @@ void PasteMercPlacement( INT32 iMapIndex )
if( gTempBasicPlacement.fDetailedPlacement )
{
CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( &tempDetailedPlacement, &gTempDetailedPlacement, &gTempBasicPlacement );
CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( &tempDetailedPlacement, &gTempDetailedPlacement, &gTempBasicPlacement, sSectorX, sSectorY );
}
else
{
+13
View File
@@ -1833,7 +1833,20 @@ void LoadGameExternalOptions()
gGameExternalOptions.bRegularMilitiaEquipmentQualityModifier = iniReader.ReadInteger("Militia Strength Settings", "REGULAR_MILITIA_EQUIPMENT_QUALITY_MODIFIER", 0, -5, 10);
gGameExternalOptions.bVeteranMilitiaEquipmentQualityModifier = iniReader.ReadInteger("Militia Strength Settings", "VETERAN_MILITIA_EQUIPMENT_QUALITY_MODIFIER", 1, -5, 10);
//################# Militia Equipment Settings ##################
gGameExternalOptions.fMilitiaUseSectorInventory = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT", FALSE);
gGameExternalOptions.fMilitiaUseSectorInventory_Armour = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_ARMOUR", TRUE);
gGameExternalOptions.fMilitiaUseSectorInventory_Face = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_FACE", TRUE);
gGameExternalOptions.fMilitiaUseSectorInventory_Melee = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_MELEE", TRUE);
gGameExternalOptions.fMilitiaUseSectorInventory_Gun = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_GUN", TRUE);
gGameExternalOptions.fMilitiaUseSectorInventory_Ammo = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_AMMO", TRUE);
gGameExternalOptions.fMilitiaUseSectorInventory_Grenade = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_GRENADE", TRUE);
gGameExternalOptions.fMilitiaUseSectorInventory_Launcher = iniReader.ReadBoolean("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_LAUNCHER", TRUE);
gGameExternalOptions.usMilitiaAmmo_Min = iniReader.ReadInteger("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_AMMO_MIN", 10, 1, 400);
gGameExternalOptions.usMilitiaAmmo_Max = iniReader.ReadInteger("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_AMMO_MAX", 200, 30, 400);
gGameExternalOptions.usMilitiaAmmo_OptimalMagCount = iniReader.ReadInteger("Militia Equipment Settings","MILITIA_USE_SECTOR_EQUIPMENT_AMMO_OPTIMAL_MAG_COUNT", 2, 1, 10);
//################# Shopkeeper Inventory Settings ##################
// WDS - Improve Tony's and Devin's inventory like BR's
+13
View File
@@ -473,6 +473,19 @@ typedef struct
INT8 bRegularMilitiaEquipmentQualityModifier;
INT8 bVeteranMilitiaEquipmentQualityModifier;
// Flugente - militia equipment
BOOLEAN fMilitiaUseSectorInventory;
BOOLEAN fMilitiaUseSectorInventory_Armour;
BOOLEAN fMilitiaUseSectorInventory_Face;
BOOLEAN fMilitiaUseSectorInventory_Melee;
BOOLEAN fMilitiaUseSectorInventory_Gun;
BOOLEAN fMilitiaUseSectorInventory_Ammo;
BOOLEAN fMilitiaUseSectorInventory_Grenade;
BOOLEAN fMilitiaUseSectorInventory_Launcher;
UINT16 usMilitiaAmmo_Min;
UINT16 usMilitiaAmmo_Max;
UINT16 usMilitiaAmmo_OptimalMagCount;
// WDS - Improve Tony's and Devin's inventory like BR's
BOOLEAN tonyUsesBRSetting;
BOOLEAN devinUsesBRSetting;
+2 -1
View File
@@ -20,8 +20,8 @@ extern CHAR16 zTrackingNumber[16];
//
// Keeps track of the saved game version. Increment the saved game version whenever
// you will invalidate the saved game file
#define SAVE_GAME_VERSION 138
#define MILITIA_EQUIPMENT 139 // Flugente: militia can equip from sector inventory
#define MULTITURN_ACTIONS 138 // Flugente: multiturn actions
#define EXTERNALISED_MERCHANTS 137 // Flugente: increased the number of merchants and externalised their data
#define PRISON_SYSTEM 136 // Flugente: added var to the sector structure. Shouldn't break compatibility, but let's be safe
@@ -58,6 +58,7 @@ extern CHAR16 zTrackingNumber[16];
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
#define SAVE_GAME_VERSION MILITIA_EQUIPMENT
//#define RUSSIANGOLD
#ifdef __cplusplus
+3 -2
View File
@@ -412,13 +412,12 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH;
// begin from the front
sButtonX = sBlankSpace / 2 - MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
sButtonX = sBlankSpace / 2;
for ( INT8 j = 0; j < 4; ++j)
{
INT8 k = 4*i + j;
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
gMsgBox.uiButton[k] = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton[k], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
@@ -428,6 +427,8 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
MSYS_SetBtnUserData( gMsgBox.uiButton[k], 0, k+1);
SetButtonCursor(gMsgBox.uiButton[k], usCursor);
ForceButtonUnDirty( gMsgBox.uiButton[k] );
sButtonX += 75 + MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
}
}
}
+7 -3
View File
@@ -2186,7 +2186,7 @@ static void ARCreateMilitia( UINT8 mclass, INT32 i, INT16 sX, INT16 sY)
if( mclass == SOLDIER_CLASS_ELITE_MILITIA )
{
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_ELITE_MILITIA );
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_ELITE_MILITIA, sX, sY );
if( gpCivs[i].pSoldier->ubBodyType == REGFEMALE )
{
gpCivs[i].usIndex = MILITIA3F_FACE;
@@ -2198,7 +2198,7 @@ static void ARCreateMilitia( UINT8 mclass, INT32 i, INT16 sX, INT16 sY)
}
else if( mclass == SOLDIER_CLASS_REG_MILITIA )
{
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_REG_MILITIA );
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_REG_MILITIA, sX, sY );
if( gpCivs[i].pSoldier->ubBodyType == REGFEMALE )
{
gpCivs[i].usIndex = MILITIA2F_FACE;
@@ -2210,7 +2210,7 @@ static void ARCreateMilitia( UINT8 mclass, INT32 i, INT16 sX, INT16 sY)
}
else if( mclass == SOLDIER_CLASS_GREEN_MILITIA )
{
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_GREEN_MILITIA );
gpCivs[i].pSoldier = TacticalCreateMilitia( SOLDIER_CLASS_GREEN_MILITIA, sX, sY );
if( gpCivs[i].pSoldier->ubBodyType == REGFEMALE )
{
gpCivs[i].usIndex = MILITIA1F_FACE;
@@ -2725,6 +2725,10 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
#endif
break;
}
// Flugente: drop sector equipment
gpCivs[ i ].pSoldier->DropSectorEquipment();
if( fDeleteForGood && gpCivs[ i ].pSoldier->stats.bLife < OKLIFE/2 )
{
AddDeadSoldierToUnLoadedSector( gpAR->ubSectorX, gpAR->ubSectorY, 0, gpCivs[ i ].pSoldier, RandomGridNo(), ADD_DEAD_SOLDIER_TO_SWEETSPOT );
@@ -612,6 +612,15 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage )
}
}
if( gGameExternalOptions.fMilitiaUseSectorInventory && ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].usFlags & WORLD_ITEM_TABOO_FOR_MILITIA_EQ ) )
{
//Shade the item, but only if it is an active item!
if ( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].object.exists() == true)
{
UINT16 usMilitia_EQColor = Get16BPPColor( FROMRGB( 69, 197, 149 ) );
DrawHatchOnInventory_MilitiaAccess( guiSAVEBUFFER, sX, sY, MAP_INVEN_SLOT_WIDTH, MAP_INVEN_SLOT_IMAGE_HEIGHT , usMilitia_EQColor);
}
}
// the name
@@ -1316,13 +1325,24 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason )
{
if ( gpItemPointer == NULL )
{
swprintf( sString, pMapInventoryErrorString[ 2 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name );
if ( _KeyDown ( TAB ) && gGameExternalOptions.fMilitiaUseSectorInventory )
{
if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags & WORLD_ITEM_TABOO_FOR_MILITIA_EQ )
pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags &= ~ WORLD_ITEM_TABOO_FOR_MILITIA_EQ;
else
pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags |= WORLD_ITEM_TABOO_FOR_MILITIA_EQ;
}
else
{
swprintf( sString, pMapInventoryErrorString[ 2 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name );
DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL );
}
}
else
{
swprintf( sString, pMapInventoryErrorString[ 5 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name );
}
DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL );
DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL );
}
return;
}
}
@@ -1366,7 +1386,15 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason )
*/
}
BeginInventoryPoolPtr( &( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object ) );
if ( _KeyDown ( TAB ) && gGameExternalOptions.fMilitiaUseSectorInventory )
{
if ( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags & WORLD_ITEM_TABOO_FOR_MILITIA_EQ )
pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags &= ~ WORLD_ITEM_TABOO_FOR_MILITIA_EQ;
else
pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].usFlags |= WORLD_ITEM_TABOO_FOR_MILITIA_EQ;
}
else
BeginInventoryPoolPtr( &( pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ].object ) );
}
else
{
+20 -1
View File
@@ -31,6 +31,7 @@
#include "connect.h"
#include "MilitiaSquads.h"
#include "Reinforcement.h"
#include "Inventory Choosing.h" // added by Flugente for MoveOneMilitiaEquipmentSet() and MoveMilitiaEquipment()
// Debug defines
@@ -321,6 +322,7 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY,
ubTargetElite--;
ubMilitiaToTrain--;
ubActualyAdded++;
MoveOneMilitiaEquipmentSet(sMapX, sMapY, sTMapX, sTMapY, ELITE_MILITIA);
}
else if (ubTargetRegular > 0)
{
@@ -329,6 +331,7 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY,
ubTargetRegular--;
ubMilitiaToTrain--;
ubActualyAdded++;
MoveOneMilitiaEquipmentSet(sMapX, sMapY, sTMapX, sTMapY, REGULAR_MILITIA);
}
else if (ubTargetGreen > 0)
{
@@ -337,6 +340,7 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY,
ubTargetGreen--;
ubMilitiaToTrain--;
ubActualyAdded++;
MoveOneMilitiaEquipmentSet(sMapX, sMapY, sTMapX, sTMapY, GREEN_MILITIA);
}
else
{
@@ -366,7 +370,7 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY,
GetWorldDay( ) < gGameExternalOptions.guiTrainVeteranMilitiaDelay )) // Or not YET allowed to train elites
{
// Add a regular. This will effectively replace one Green militia
StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, 1);
StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, 1);
ubTargetElite--;
ubMilitiaToTrain--;
ubActualyAdded++;
@@ -599,6 +603,10 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
bRegularsDestTeam = bTotalRegulars - bRegularsSourceTeam;
bElitesDestTeam = bTotalElites - bElitesSourceTeam;
// Flugente: mobiles take along their gear
// move only gear for those who come new into a sector
MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ], bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ], bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]);
// Erase ALL militia from both locations.
StrategicRemoveMilitiaFromSector( sMapX, sMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] );
StrategicRemoveMilitiaFromSector( sMapX, sMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] );
@@ -627,6 +635,10 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
bElitesSourceTeam = pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
bElitesDestTeam = bElitesSourceTeam / 2;
// Flugente: mobiles take along their gear
// move only gear for those who come new into a sector
MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ], bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ], bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]);
// Add half team to target sector
StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, bGreensDestTeam );
StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, bRegularsDestTeam );
@@ -703,6 +715,10 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
}
}
// Flugente: mobiles take along their gear
// move only gear for those who come new into a sector
MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ], bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ], bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]);
// Erase ALL militia from both locations.
StrategicRemoveMilitiaFromSector( sMapX, sMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] );
StrategicRemoveMilitiaFromSector( sMapX, sMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] );
@@ -721,6 +737,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
}
else
{
// Flugente: mobiles take along their gear
MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ], pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ], pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]);
// Entire group moves from Source to Target, leaving no one behind.
StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] );
StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] );
+3
View File
@@ -6120,6 +6120,9 @@ BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode )
//if we arent loading a saved game
if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) )
{
// Flugente: cause all militia whose equipment is from this sector to drop it
TeamDropAll( MILITIA_TEAM );
// Save the current sectors Item list to a temporary file, if its not the first time in
SaveCurrentSectorsInformationToTempItemFile();
+10 -1
View File
@@ -4683,7 +4683,11 @@ void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGr
wcscpy( gzUserDefinedButton[1], TacticalStr[ CLEAN_ONE_GUN_STR ] );
wcscpy( gzUserDefinedButton[2], TacticalStr[ CLEAN_ALL_GUNS_STR ] );
wcscpy( gzUserDefinedButton[3], TacticalStr[ TAKE_OFF_CLOTHES_STR ] );
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ FUNCTION_SELECTION_STR ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS, TacticalFunctionSelectionMessageBoxCallBack, NULL );
wcscpy( gzUserDefinedButton[4], TacticalStr[ MILITIA_DROP_EQ_STR ] );
wcscpy( gzUserDefinedButton[5], 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 );
}
void CleanWeapons( BOOLEAN fCleanAll )
@@ -4854,6 +4858,11 @@ void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue )
// undisguise or take off custom clothes
Strip(gpTempSoldier);
break;
case 5:
// militia drops all gear taken from sector inventory
TeamDropAll( MILITIA_TEAM );
break;
default:
break;
}
File diff suppressed because it is too large Load Diff
+9
View File
@@ -119,5 +119,14 @@ enum
// Flugente: created separate gun choices for different soldier classes
extern ARMY_GUN_CHOICE_TYPE gArmyItemChoices[SOLDIER_GUN_CHOICE_SELECTIONS][MAX_ITEM_TYPES];
////////////////// Flugente: militia equipment feature ///////////////////////////////////
// move one set of militia equipment between sectors
void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, INT8 bSoldierClass);
// move a number of militia equipment sets between sectors
void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT8 usElites, UINT8 usRegulars, UINT8 usGreens);
// take militia items from sector
void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass );
#endif
+7 -2
View File
@@ -485,7 +485,7 @@ public:
INT16 sRepairThreshold; // repair only possible up to this value
FLOAT bDirtLevel; // counter for how dirty a gun is
INT32 sObjectFlag; // used to notify of various states that apply to this object, but not the item in general
UINT64 sObjectFlag; // used to notify of various states that apply to this object, but not the item in general
};
// Flugente: needed for reading WF maps
#define SIZEOF_OBJECTDATA_POD (offsetof(ObjectData, endOfPOD))
@@ -808,7 +808,12 @@ extern OBJECTTYPE gTempObject;
#define CORPSE_PANTS_BLUE 0x10000000 //268435456
#define CORPSE_PANTS_BEIGE 0x20000000 //536870912
#define CORPSE_NO_VEST 0x40000000 //1073741824 // corpse has no vest item (it has been either taken or been destroyed)
#define CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED 0x80000000 //2147483648 // corpse has no pants item/for tripwire activation (gets set and unset when activating tripwire)
#define CORPSE_NO_PANTS 0x80000000 //2147483648 // corpse has no pants item/for tripwire activation (gets set and unset when activating tripwire)
#define TRIPWIRE_ACTIVATED 0x0000000100000000 // 4294967296
#define TAKEN_BY_MILITIA 0x0000000200000000 // 8589934592
//#define CORPSE_PANTS_TAN 0x0000000400000000 // 17179869184
//#define CORPSE_PANTS_BLACK 0x0000000800000000 // 34359738368
// Flugente TODO 2012-09-17: next time we break savegame compatibility, extend the flagmasks from UINT32 to UINT64. I didn't do it this time (see double-used flag above), as we try to minimise those breaks. But it is needed.
// ----------------------------------------------------------------
+3
View File
@@ -153,6 +153,9 @@ void ResetMilitia()
// a flag for autoresolve if different initialization or destruction is desired.
guiCurrentScreen = GAME_SCREEN;
// Flugente: cause all militia whose equipment is from this sector to drop it
TeamDropAll( MILITIA_TEAM );
RemoveMilitiaFromTactical();
ubNumGreen = MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, GREEN_MILITIA);
ubNumReg = MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, REGULAR_MILITIA);
+31
View File
@@ -10219,3 +10219,34 @@ void HandleSurrenderOffer( SOLDIERTYPE* pSoldier )
wcscpy( gzUserDefinedButton[3], TacticalStr[ PRISONER_TALK_STR ] );
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ PRISONER_OFFER_SURRENDER ], guiCurrentScreen, MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS, PrisonerSurrenderMessageBoxCallBack, NULL );
}
void TeamDropAll(UINT8 bTeam)
{
if ( bTeam > PLAYER_PLAN )
return;
// not if there is a battle going on, or this team is hostile to us
if ( (gTacticalStatus.uiFlags & INCOMBAT ) )
return;
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
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 soldier is in the current sector, drop all equipment (that has the TAKEN_BY_MILITIA-flag set)
if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) )
{
pSoldier->DropSectorEquipment();
}
}
}
+2
View File
@@ -408,4 +408,6 @@ STR16 GetNewTraitStr(UINT8 aTrait); // Flugente: deal with the insane new trait
void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ); // Flugente: offer the enemy the chance to surrender
void TeamDropAll(UINT8 bTeam);
#endif
+2 -2
View File
@@ -2055,7 +2055,7 @@ void TakeCorpse( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel )
gTempObject[0]->data.sObjectFlag |= CORPSE_NO_VEST;
if ( pCorpse->def.usFlags & ROTTING_CORPSE_NO_PANTS )
gTempObject[0]->data.sObjectFlag |= CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED;
gTempObject[0]->data.sObjectFlag |= CORPSE_NO_PANTS;
#ifdef ENABLE_ZOMBIES
if ( pCorpse->def.usFlags & ROTTING_CORPSE_NEVER_RISE_AGAIN )
@@ -2316,7 +2316,7 @@ BOOLEAN AddCorpseFromObject(OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel )
if ( (*pObj)[0]->data.sObjectFlag & CORPSE_NO_VEST )
gRottingCorpse[ iCorpseID ].def.usFlags |= ROTTING_CORPSE_NO_VEST;
if ( (*pObj)[0]->data.sObjectFlag & CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED )
if ( (*pObj)[0]->data.sObjectFlag & CORPSE_NO_PANTS )
gRottingCorpse[ iCorpseID ].def.usFlags |= ROTTING_CORPSE_NO_PANTS;
#ifdef ENABLE_ZOMBIES
+32
View File
@@ -3241,6 +3241,38 @@ void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT1
UnLockVideoSurface( uiSurface );
}
void DrawHatchOnInventory_MilitiaAccess( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor )
{
UINT8 *pDestBuf;
UINT32 uiDestPitchBYTES;
SGPRect ClipRect;
static UINT8 Pattern[8][8] =
{
1,0,0,0,0,0,0,0,
0,0,0,0,0,1,0,0,
0,0,1,0,0,0,0,0,
0,0,0,0,0,0,0,1,
0,0,0,0,1,0,0,0,
0,1,0,0,0,0,0,0,
0,0,0,0,0,0,1,0,
0,0,0,1,0,0,0,0
};
// CHRISL:
ClipRect.iLeft = usPosX-1;
ClipRect.iRight = usPosX + usWidth-1;
ClipRect.iTop = usPosY;
ClipRect.iBottom = usPosY + usHeight;
pDestBuf = LockVideoSurface( uiSurface, &uiDestPitchBYTES );
if(usColor == 0){
Blt16BPPBufferPixelateRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, Pattern );
}
else{
Blt16BPPBufferPixelateRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect, Pattern, usColor );
}
UnLockVideoSurface( uiSurface );
}
UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly, UINT16 usItemID, FLOAT dModifier, OBJECTTYPE *pItemObject )
{
+1
View File
@@ -121,6 +121,7 @@ void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer );
void EnableDisableShopkeeperButtons(UINT32 uiCurrentItemDescriptionScreen, int bpAction);
void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor = 0 );
void DrawHatchOnInventory_MilitiaAccess( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor = 0 );
BOOLEAN ShouldSoldierDisplayHatchOnItem( UINT8 ubProfileID, INT16 sSlotNum );
INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot, INT16 bSlotIdInOtherLocation );
void ConfirmToDeductMoneyFromPlayersAccountMessageBoxCallBack( UINT8 bExitValue );
+65
View File
@@ -112,6 +112,7 @@
#include "IMP Skill Trait.h" // added by Flugente
#include "Food.h" // added by Flugente
#include "Tactical Save.h" // added by Flugente for AddItemsToUnLoadedSector()
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -14717,6 +14718,11 @@ INT8 SOLDIERTYPE::GetUniformType()
// is our equipment too good for a soldier?
BOOLEAN SOLDIERTYPE::EquipmentTooGood( BOOLEAN fCloselook )
{
// if militia is equipped from sector inventory(and thu by the player itself), then its item selection is no longer bound to any progress calculation
// we thus canno check for equipment - the only way to find out is to look at this guy sharply, and to eventually realise that this gear did not come from the player
if ( gGameExternalOptions.fMilitiaUseSectorInventory && this->IsAssassin() )
return FALSE;
// check the guns in our hands and rifle sling
// alert if we have more than 2, any of them has too much attachments or they are way too cool
UINT8 numberofguns = 0;
@@ -15710,6 +15716,65 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction()
return TRUE;
}
void SOLDIERTYPE::DropSectorEquipment()
{
OBJECTTYPE* pObj = NULL;
UINT8 size = this->inv.size();
if ( ( this->sSectorX == gWorldSectorX ) && ( this->sSectorY == gWorldSectorY ) && ( this->bSectorZ == gbWorldSectorZ) )
{
for ( UINT8 cnt = 0; cnt < size; ++cnt )
{
pObj = &( this->inv[ cnt ] );
if ( pObj->exists() )
{
// Check if it's supposed to be dropped
if ( !( (*pObj).fFlags & OBJECT_UNDROPPABLE ) && !(Item[ pObj->usItem ].defaultundroppable ) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA )
{
(*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA;
// if we are not replacing ammo, unload gun prior to dropping it
if ( !gGameExternalOptions.fMilitiaUseSectorInventory_Ammo && Item[ pObj->usItem ].usItemClass & IC_GUN )
(*pObj)[0]->data.gun.ubGunShotsLeft = 0;
AddItemToPool( this->sGridNo, pObj, 1 , this->pathing.bLevel, (WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO|WORLD_ITEM_REACHABLE), -1 );
DeleteObj( &(this->inv[cnt]) );
}
}
}
}
else
{
OBJECTTYPE pObject[NUM_INV_SLOTS];
UINT8 counter = 0;
for ( UINT8 cnt = 0; cnt < size; ++cnt )
{
pObj = &( this->inv[ cnt ] );
if ( pObj->exists() )
{
// Check if it's supposed to be dropped
if ( !( (*pObj).fFlags & OBJECT_UNDROPPABLE ) && !(Item[ pObj->usItem ].defaultundroppable ) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA )
{
(*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA;
// if we are not replacing ammo, unload gun prior to dropping it
if ( !gGameExternalOptions.fMilitiaUseSectorInventory_Ammo && Item[ pObj->usItem ].usItemClass & IC_GUN )
(*pObj)[0]->data.gun.ubGunShotsLeft = 0;
pObject[counter++] = *pObj;
DeleteObj( &(this->inv[cnt]) );
}
}
}
AddItemsToUnLoadedSector( this->sSectorX, this->sSectorY, this->bSectorZ, RandomGridNo(), counter, pObject, 0, WORLD_ITEM_REACHABLE, 0, 1, FALSE );
}
}
INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
{
INT8 bBandaged; //,savedOurTurn;
+4 -2
View File
@@ -363,8 +363,8 @@ enum
#define SOLDIER_POW 0x00000400 //1024 // we are a prisoner of war
#define SOLDIER_ASSASSIN 0x00000800 //2048 // we are an enemy assassin, and thus we will behave very different from normal enemies
/*#define ENEMY_NET_1_LVL_4 0x00001000 //4096
#define ENEMY_NET_2_LVL_4 0x00002000 //8192
/*#define SOLDIER_EQ_TAKEN 0x00001000 //4096 // this militia's equipment was taken from a sector inventory
#define SOLDIER_EQ_EMPTY 0x00002000 //8192 // this militia has no equipment and is to be equipped from the sector inventory
#define ENEMY_NET_3_LVL_4 0x00004000 //16384
#define ENEMY_NET_4_LVL_4 0x00008000 //32768
@@ -1533,6 +1533,8 @@ public:
void StartMultiTurnAction(UINT8 usActionType);
void CancelMultiTurnAction(BOOLEAN fFinished);
BOOLEAN UpdateMultiTurnAction();
void DropSectorEquipment();
//////////////////////////////////////////////////////////////////////////////
}; // SOLDIERTYPE;
+29 -7
View File
@@ -2093,7 +2093,7 @@ INT8 CalcDifficultyModifier( UINT8 ubSoldierClass )
//Used to generate a detailed placement from a basic placement. This assumes that the detailed placement
//doesn't exist, meaning there are no static attributes. This is called when you wish to convert a basic
//placement into a detailed placement just before creating a soldier.
void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, BASIC_SOLDIERCREATE_STRUCT *bp )
void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, BASIC_SOLDIERCREATE_STRUCT *bp, INT16 sX, INT16 sY )
{
INT8 bBaseAttribute;
UINT8 ubSoldierClass;
@@ -2375,7 +2375,17 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B
#else
if( !bp->fDetailedPlacement && ubSoldierClass != SOLDIER_CLASS_NONE && ubSoldierClass != SOLDIER_CLASS_CREATURE && ubSoldierClass != SOLDIER_CLASS_MINER )
#endif
GenerateRandomEquipment( pp, ubSoldierClass, bp->bRelativeEquipmentLevel);
{
GenerateRandomEquipment( pp, ubSoldierClass, bp->bRelativeEquipmentLevel);
// Flugente testing: militia get equipment in a different way
if ( pp->bTeam == MILITIA_TEAM && sX > 0 && sX < 17 && sY > 0 && sY < 17 )
{
INT8 sZ = gbWorldSectorZ > -1 ? gbWorldSectorZ : 0;
TakeMilitiaEquipmentfromSector(sX, sY, sZ, pp, ubSoldierClass);
}
}
DecideToAssignSniperOrders(pp);
@@ -2462,7 +2472,7 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT
//the proper detailed placement slot given the static detailed placement and it's accompanying basic placement.
//For the purposes of merc editing, the static detailed placement is preserved.
void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp )
SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp, INT16 sX, INT16 sY )
{
UINT32 i;
@@ -2499,7 +2509,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
return; //done
}
CreateDetailedPlacementGivenBasicPlacementInfo( pp, bp );
CreateDetailedPlacementGivenBasicPlacementInfo( pp, bp, sX, sY );
pp->ubScheduleID = spp->ubScheduleID;
//Replace any of the new placement's attributes with static attributes.
if( spp->bExpLevel != -1 ) pp->bExpLevel = spp->bExpLevel;
@@ -2550,6 +2560,15 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
#endif
{
GenerateRandomEquipment( pp, bp->ubSoldierClass, bp->bRelativeEquipmentLevel);
// Flugente testing: militia get equipment in a different way
if ( pp->bTeam == MILITIA_TEAM && sX > 0 && sX < 17 && sY > 0 && sY < 17 )
{
INT8 sZ = gbWorldSectorZ > -1 ? gbWorldSectorZ : 0;
TakeMilitiaEquipmentfromSector(sX, sY, sZ, pp, bp->ubSoldierClass);
}
DecideToAssignSniperOrders(pp);
}
@@ -2958,7 +2977,7 @@ SOLDIERTYPE* ReserveTacticalMilitiaSoldierForAutoresolve( UINT8 ubSoldierClass )
}
SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass )
SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass, INT16 sX, INT16 sY )
{
BASIC_SOLDIERCREATE_STRUCT bp;
SOLDIERCREATE_STRUCT pp;
@@ -2984,7 +3003,7 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass )
bp.bAttitude = (INT8) Random( MAXATTITUDES );
//bp.bAttitude = AGGRESSIVE;
bp.bBodyType = -1;
CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp );
CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp, sX, sY );
pSoldier = TacticalCreateSoldier( &pp, &ubID );
return pSoldier;
@@ -4293,7 +4312,10 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
// Chance to gain second weapon and ambidextrous trait
else if ( Chance( iChance/2 ) && !Item[ pCreateStruct->Inv[ HANDPOS ].usItem ].twohanded && !BTraitAssigned ) // 1/2 of chance
{
(pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]);
if ( pCreateStruct->bTeam == MILITIA_TEAM && gGameExternalOptions.fMilitiaUseSectorInventory && gGameExternalOptions.fMilitiaUseSectorInventory_Gun )
;
else
(pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]);
pSoldier->stats.ubSkillTraits[1] = AMBIDEXTROUS_NT;
+5 -3
View File
@@ -423,7 +423,7 @@ SOLDIERTYPE* TacticalCreateArmyTroop();
#ifdef ENABLE_ZOMBIES
SOLDIERTYPE* TacticalCreateZombie(); // Flugente Zombies
#endif
SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass );
SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass, INT16 sX, INT16 sY ); // Flugente: added sector coordinates
SOLDIERTYPE* TacticalCreateCreature( INT8 bCreatureBodyType );
// Flugente: assassins are elite soldiers of the civ team that go hostile on a certain event, otherwise they just blend in
@@ -461,7 +461,8 @@ UINT8 GetPythDistanceFromPalace( INT16 sSectorX, INT16 sSectorY );
//Used to generate a detailed placement from a basic placement. This assumes that the detailed placement
//doesn't exist, meaning there are no static attributes. This is called when you wish to convert a basic
//placement into a detailed placement just before creating a soldier.
void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, BASIC_SOLDIERCREATE_STRUCT *bp );
// Flugente: added sector coordinates, used for militia using sector equipment
void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, BASIC_SOLDIERCREATE_STRUCT *bp, INT16 sX = -1, INT16 sY = -1 );
//Used exclusively by the editor when the user wishes to change a basic placement into a detailed placement.
//Because the intention is to make some of the attributes static, all of the information that can be generated
@@ -473,8 +474,9 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT
//When you are ready to generate a soldier with a static detailed placement slot, this function will generate
//the proper priority placement slot given the static detailed placement and it's accompanying basic placment.
//For the purposes of merc editing, the static detailed placement is preserved.
// Flugente: added sector coordinates, used for militia using sector equipment
void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp );
SOLDIERCREATE_STRUCT *pp, SOLDIERCREATE_STRUCT *spp, BASIC_SOLDIERCREATE_STRUCT *bp, INT16 sX = -1, INT16 sY = -1);
//Used to update a existing soldier's attributes with the new static detailed placement info. This is used
//by the editor upon exiting the editor into the game, to update the existing soldiers with new information.
+40 -14
View File
@@ -646,12 +646,12 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
}
}
CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
&tempDetailedPlacement, curr->pDetailedPlacement, curr->pBasicPlacement );
&tempDetailedPlacement, curr->pDetailedPlacement, curr->pBasicPlacement, gWorldSectorX, gWorldSectorY );
}
else
{
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: create detailed placement"));
CreateDetailedPlacementGivenBasicPlacementInfo( &tempDetailedPlacement, curr->pBasicPlacement );
CreateDetailedPlacementGivenBasicPlacementInfo( &tempDetailedPlacement, curr->pBasicPlacement, gWorldSectorX, gWorldSectorY );
}
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: if not edit mode"));
@@ -1482,10 +1482,16 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
//we now have the numbers of available slots for each soldier class, so loop through three times
//and randomly choose some (or all) of the matching slots to fill. This is done randomly.
for( ubCurrClass = SOLDIER_CLASS_ADMINISTRATOR; ubCurrClass <= SOLDIER_CLASS_ARMY; ubCurrClass++ )
// Flugente: changed the order of the classes, as we want to ahve elites first (relevant if militia takes equipment from the sector)
UINT8 reorder[3];
reorder[0] = SOLDIER_CLASS_ELITE;
reorder[1] = SOLDIER_CLASS_ARMY;
reorder[2] = SOLDIER_CLASS_ADMINISTRATOR;
for( UINT8 i = 0; i < 3; ++i )
{
//First, prepare the counters.
switch( ubCurrClass )
switch( reorder[i] )
{
case SOLDIER_CLASS_ADMINISTRATOR:
pCurrSlots = &ubGreenSlots;
@@ -1506,13 +1512,13 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl
{
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM || curr->pBasicPlacement->bTeam == MILITIA_TEAM )
{
if( curr->pBasicPlacement->ubSoldierClass == ubCurrClass )
if( curr->pBasicPlacement->ubSoldierClass == reorder[i] )
{
if( *pCurrSlots <= *pCurrTotal || Random( *pCurrSlots ) < *pCurrTotal )
{
curr->pBasicPlacement->bTeam = MILITIA_TEAM;
curr->pBasicPlacement->bOrders = STATIONARY;
switch( ubCurrClass )
switch( reorder[i] )
{
case SOLDIER_CLASS_ADMINISTRATOR:
curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_GREEN_MILITIA;
@@ -2537,18 +2543,38 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
if (ubTotalSoldiers == 0)
return;
// Flugente: if militia picks up equipemnt from sectors, it is necessary to know from where it comes
INT16 sX = gWorldSectorX;
INT16 sY = gWorldSectorY;
switch( ubStrategicInsertionCode )
{
case INSERTION_CODE_NORTH: bDesiredDirection = SOUTHEAST; break;
case INSERTION_CODE_EAST: bDesiredDirection = SOUTHWEST; break;
case INSERTION_CODE_SOUTH: bDesiredDirection = NORTHWEST; break;
case INSERTION_CODE_WEST: bDesiredDirection = NORTHEAST; break;
default: AssertMsg( 0, "Illegal direction passed to AddSoldierInitListMilitiaOnEdge()" ); break;
case INSERTION_CODE_NORTH:
bDesiredDirection = SOUTHEAST;
--sY;
break;
case INSERTION_CODE_EAST:
bDesiredDirection = SOUTHWEST;
--sX;
break;
case INSERTION_CODE_SOUTH:
bDesiredDirection = NORTHWEST;
++sY;
break;
case INSERTION_CODE_WEST:
bDesiredDirection = NORTHEAST;
++sX;
break;
default:
AssertMsg( 0, "Illegal direction passed to AddSoldierInitListMilitiaOnEdge()" );
break;
}
#ifdef JA2TESTVERSION
ScreenMsg( FONT_RED, MSG_INTERFACE, L"Militia reinforcements have arrived! (%d admins, %d troops, %d elite)", ubNumGreen, ubNumReg, ubNumElites );
#endif
// Flugente: if militia takes items from sector inventories, then militia coming from neighbouring sectors will have to take it from there
ChooseMapEdgepoints( &MapEdgepointInfo, ubStrategicInsertionCode, (UINT8)(ubNumGreen + ubNumReg + ubNumElites) );
ubCurrSlot = 0;
while( ubTotalSoldiers )
@@ -2557,7 +2583,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
{
ubNumElites--;
ubTotalSoldiers--;
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_ELITE_MILITIA);
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_ELITE_MILITIA, sX, sY);
// Lesh: if pSoldier is NULL then no slot for a new men or other problems
// it better to leave this function is such case
@@ -2597,7 +2623,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
{
ubNumReg--;
ubTotalSoldiers--;
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_REG_MILITIA);
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_REG_MILITIA, sX, sY);
// Lesh: if pSoldier is NULL then no slot for a new men or other problems
// it better to leave this function is such case
@@ -2637,7 +2663,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu
{
ubNumGreen--;
ubTotalSoldiers--;
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_GREEN_MILITIA);
pSoldier = TacticalCreateMilitia(SOLDIER_CLASS_GREEN_MILITIA, sX, sY);
// Lesh: if pSoldier is NULL then no slot for a new men or other problems
// it better to leave this function is such case
+2
View File
@@ -49,6 +49,8 @@ BOOLEAN LoadCurrentSectorsInformationFromTempItemsFile();
// Loads a World Item array from that sectors temp item file
BOOLEAN LoadWorldItemsFromTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, WORLDITEM *pData );
BOOLEAN SaveWorldItemsToTempItemFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems, WORLDITEM *pData );
//When the savegame version changes, load the temp files, then immediately save them again in the new format
BOOLEAN UpdateWorldItemsTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
+6
View File
@@ -4512,6 +4512,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
break;
// added by Flugente
case ':':
TeamDropAll( MILITIA_TEAM );
break;
case 'z':
if( fCtrl && fAlt )
{
+3
View File
@@ -15,6 +15,9 @@
//Kaiden: This constant is to flag items that an enemy drops when they die.
#define WORLD_ITEM_DROPPED_FROM_ENEMY 0x0800
// Flugente: when equipping militia from inventory, do not consider this item
#define WORLD_ITEM_TABOO_FOR_MILITIA_EQ 0x1000
class WORLDITEM;//dnl ch33 120909
class _OLD_WORLDITEM;//dnl ch42 280909
+5 -5
View File
@@ -3701,7 +3701,7 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN
if ( Item[usBombItem].tripwire == 1 )
{
// this is important - we have to check wether the wire has already been activated
if ( ( (*pObj)[0]->data.sObjectFlag & CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED ) == 0 )
if ( ( (*pObj)[0]->data.sObjectFlag & TRIPWIRE_ACTIVATED ) == 0 )
{
// determine this tripwire's flag
UINT32 ubWireNetworkFlag = (*pObj)[0]->data.ubWireNetworkFlag;
@@ -3751,7 +3751,7 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN
// Flugente hack: the tripwire will get removed in HandleExplosionQueue (it is still needed in there until the bomb gets called).
// Because of this, ActivateSurroundingTripwire would normally find this wire again, thus a loop would occur.
// So we mark the wire with this flag
(*pObj)[0]->data.sObjectFlag |= CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED;
(*pObj)[0]->data.sObjectFlag |= TRIPWIRE_ACTIVATED;
// activate surrounding tripwires, unless tripwire is too much damaged and we are unlucky..
if ( (*pObj)[0]->data.objectStatus > (INT16)Random(50) )
@@ -3918,7 +3918,7 @@ void HandleExplosionQueue( void )
}
// delete the flag, otherwise wire will only work once
(newtripwireObject)[0]->data.sObjectFlag &= ~CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED;
(newtripwireObject)[0]->data.sObjectFlag &= ~TRIPWIRE_ACTIVATED;
// now add a tripwire item to the floor, simulating that activating tripwire deactivates it
AddItemToPool( sGridNo, &newtripwireObject, 1, ubLevel, 0, -1 );
@@ -3946,7 +3946,7 @@ void HandleExplosionQueue( void )
}
// delete the flag, otherwise wire will only work once
(newtripwireObject)[0]->data.sObjectFlag &= ~CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED;
(newtripwireObject)[0]->data.sObjectFlag &= ~TRIPWIRE_ACTIVATED;
// now add a tripwire item to the floor, simulating that activating tripwire deactivates it
AddItemToPool( sGridNo, &newtripwireObject, 1, ubLevel, 0, -1 );
@@ -4434,7 +4434,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8
// Flugente hack: the tripwire will get removed in HandleExplosionQueue (it is still needed in there until the bomb gets called).
// Because of this, ActivateSurroundingTripwire would normally find this wire again, thus a loop would occur.
// So we mark the wire with this flag
(*pObj)[0]->data.sObjectFlag |= CORPSE_NO_PANTS_AND_TRIPWIRE_ACTIVATED;
(*pObj)[0]->data.sObjectFlag |= TRIPWIRE_ACTIVATED;
// activate surrounding tripwires and tripwire-activated mines, unless tripwire is too much damaged and we are unlucky..
if ( (*pObj)[0]->data.objectStatus > (INT16)Random(50) )
+2
View File
@@ -946,6 +946,8 @@ enum
PRISONER_DEMAND_SURRENDER_STR,
PRISONER_OFFER_SURRENDER_STR,
PRISONER_TALK_STR,
MILITIA_DROP_EQ_STR,
UNUSED_STR,
TEXT_NUM_TACTICAL_STR
};
+2
View File
@@ -2931,6 +2931,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"劝说敌人投降",
L"Offer surrender",//TODO.Translate
L"交谈",
L"Militia inspection",//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.
+2
View File
@@ -2928,6 +2928,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//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.
+2
View File
@@ -2930,6 +2930,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",
L"unused",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
+2
View File
@@ -2935,6 +2935,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//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.
+2
View File
@@ -2933,6 +2933,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Aufgabe einfordern",
L"Aufgabe anbieten",
L"Sprechen",
L"Militia inspection",//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.
+2
View File
@@ -2923,6 +2923,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//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.
+2
View File
@@ -2938,6 +2938,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//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.
+2
View File
@@ -2930,6 +2930,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Требовать сдаться",
L"Предлоить сдаться",
L"Переговоры",
L"Militia inspection",//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.
+2
View File
@@ -2932,6 +2932,8 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"Demand surrender",
L"Offer surrender",
L"Talk",
L"Militia inspection",//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.