- 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
+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