- If NPC_AUTORESOLVE_DROP_ALL is TRUE (default FALSE), NPCs (enemies, militia, bandits, creatures...) drop items in autresolve like they would in tactical combat.

- Fix: dropped items are clones when dropping from autoresolve

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8594 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2018-08-15 14:47:43 +00:00
parent cb2002af2a
commit 7246b671f8
5 changed files with 25 additions and 23 deletions
+5 -2
View File
@@ -1196,7 +1196,10 @@ void LoadGameExternalOptions()
gGameExternalOptions.ubMilitiaDropEquipment = iniReader.ReadInteger("Tactical Difficulty Settings","MILITIA_DROP_EQUIPMENT", 0, 0, 2 ); gGameExternalOptions.ubMilitiaDropEquipment = iniReader.ReadInteger("Tactical Difficulty Settings","MILITIA_DROP_EQUIPMENT", 0, 0, 2 );
// silversurfer: enable dropping of all items for civilians? // silversurfer: enable dropping of all items for civilians?
gGameExternalOptions.fCiviliansDropAll = iniReader.ReadBoolean("Tactical Difficulty Settings","CIVILIANS_DROP_ALL", FALSE); gGameExternalOptions.fCiviliansDropAll = iniReader.ReadBoolean("Tactical Difficulty Settings","CIVILIANS_DROP_ALL", FALSE);
// Flugente: can NPCs drop items in autoresolve?
gGameExternalOptions.fNPCAutoresolveItemDrop = iniReader.ReadBoolean("Tactical Difficulty Settings", "NPC_AUTORESOLVE_DROP_ALL", FALSE );
// HEADROCK HAM B2.7: Change the speed of skill progression. (defaults set to JA2 normal) // HEADROCK HAM B2.7: Change the speed of skill progression. (defaults set to JA2 normal)
gGameExternalOptions.usHealthSubpointsToImprove = iniReader.ReadInteger("Tactical Difficulty Settings","HEALTH_SUBPOINTS_TO_IMPROVE", 50, 1, 1000 ); gGameExternalOptions.usHealthSubpointsToImprove = iniReader.ReadInteger("Tactical Difficulty Settings","HEALTH_SUBPOINTS_TO_IMPROVE", 50, 1, 1000 );
@@ -1866,7 +1869,7 @@ void LoadGameExternalOptions()
gGameExternalOptions.sMinEnterMilitiaReinforcements = iniReader.ReadInteger("Strategic Gameplay Settings", "MIN_ENTER_MILITIA_REINFORCEMENTS", 6, 1, 64); gGameExternalOptions.sMinEnterMilitiaReinforcements = iniReader.ReadInteger("Strategic Gameplay Settings", "MIN_ENTER_MILITIA_REINFORCEMENTS", 6, 1, 64);
gGameExternalOptions.sRndEnterMilitiaReinforcements = iniReader.ReadInteger("Strategic Gameplay Settings", "RND_ENTER_MILITIA_REINFORCEMENTS", 4, 1, 64); gGameExternalOptions.sRndEnterMilitiaReinforcements = iniReader.ReadInteger("Strategic Gameplay Settings", "RND_ENTER_MILITIA_REINFORCEMENTS", 4, 1, 64);
//dnl ch68 090913 Don't allow permanent items removal from sector //dnl ch68 090913 Don't allow permanent items removal from sector
gGameExternalOptions.fNoRemoveRandomSectorItems = iniReader.ReadBoolean("Strategic GamePlay Settings", "NO_REMOVE_RANDOM_SECTOR_ITEMS", true, false); gGameExternalOptions.fNoRemoveRandomSectorItems = iniReader.ReadBoolean("Strategic GamePlay Settings", "NO_REMOVE_RANDOM_SECTOR_ITEMS", TRUE );
gGameExternalOptions.fArmyUsesTanksInAttacks = iniReader.ReadBoolean("Strategic Gameplay Settings","ARMY_USES_TANKS_IN_ATTACKS", FALSE); gGameExternalOptions.fArmyUsesTanksInAttacks = iniReader.ReadBoolean("Strategic Gameplay Settings","ARMY_USES_TANKS_IN_ATTACKS", FALSE);
gGameExternalOptions.fArmyUsesTanksInPatrols = iniReader.ReadBoolean("Strategic Gameplay Settings","ARMY_USES_TANKS_IN_PATROLS", FALSE); gGameExternalOptions.fArmyUsesTanksInPatrols = iniReader.ReadBoolean("Strategic Gameplay Settings","ARMY_USES_TANKS_IN_PATROLS", FALSE);
+3
View File
@@ -1235,6 +1235,9 @@ typedef struct
// enables item drops for civilians // enables item drops for civilians
BOOLEAN fCiviliansDropAll; BOOLEAN fCiviliansDropAll;
// Flugente: can NPCs drop items in autoresolve?
BOOLEAN fNPCAutoresolveItemDrop;
// WANNE: Don't stop and talk when spotting a new item in turn based mode // WANNE: Don't stop and talk when spotting a new item in turn based mode
BOOLEAN fItemSpottedNoTalk; BOOLEAN fItemSpottedNoTalk;
+2 -2
View File
@@ -55,8 +55,8 @@
#endif #endif
CHAR8 czVersionNumber[16] = { "Build 18.08.12" }; //YY.MM.DD CHAR8 czVersionNumber[16] = { "Build 18.08.15" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" }; CHAR16 zTrackingNumber[16] = { L"Z" };
CHAR16 zRevisionNumber[16] = { L"Revision 8591" }; CHAR16 zRevisionNumber[16] = { L"Revision 8594" };
// SAVE_GAME_VERSION is defined in header, change it there // SAVE_GAME_VERSION is defined in header, change it there
+2 -1
View File
@@ -2434,8 +2434,9 @@ else
// only enemy soldiers use auto-drop system! // only enemy soldiers use auto-drop system!
// don't use the auto-drop system in auto-resolve: player won't see what's being used & enemies will often win & keep'em // don't use the auto-drop system in auto-resolve: player won't see what's being used & enemies will often win & keep'em
// Flugente: nah. We can decide to not drop later on if we want anyway.
// HEADROCK HAM B2.8: Militia now drop all their equipment... IF not killed by player (see TurnSoldierIntoCorpse() ) // HEADROCK HAM B2.8: Militia now drop all their equipment... IF not killed by player (see TurnSoldierIntoCorpse() )
if ( (SOLDIER_CLASS_ENEMY( bSoldierClass ) || ( gGameExternalOptions.ubMilitiaDropEquipment > 0 && SOLDIER_CLASS_MILITIA( bSoldierClass ) )) && !IsAutoResolveActive() ) if ( SOLDIER_CLASS_ENEMY( bSoldierClass ) || ( gGameExternalOptions.ubMilitiaDropEquipment > 0 && SOLDIER_CLASS_MILITIA( bSoldierClass ) ) )
{ {
// SPECIAL handling for weapons: we'll always drop a weapon type that has never been dropped before // SPECIAL handling for weapons: we'll always drop a weapon type that has never been dropped before
UINT32 invsize = pp->Inv.size(); UINT32 invsize = pp->Inv.size();
+11 -16
View File
@@ -1970,7 +1970,7 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT
if( fOverWrite ) if( fOverWrite )
{ {
//first loop through and mark all entries that they dont exists //first loop through and mark all entries that they dont exists
for( UINT32 cnt=0; cnt<uiNumberOfItems; cnt++) for( UINT32 cnt=0; cnt<uiNumberOfItems; ++cnt)
pWorldItems[ cnt ].fExists = FALSE; pWorldItems[ cnt ].fExists = FALSE;
//Now delete the item temp file //Now delete the item temp file
@@ -1980,10 +1980,14 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT
uiLastItemPos = 0; uiLastItemPos = 0;
//loop through all the objects to add //loop through all the objects to add
for( uiLoop=0; uiLoop < uiNumberOfItemsToAdd; uiLoop++) for( uiLoop=0; uiLoop < uiNumberOfItemsToAdd; ++uiLoop)
{ {
// Flugente: only add an item if it exists. Otherwise we will happily add items that are supposed to have been deleted
if ( !pWorldItem[uiLoop].fExists )
continue;
//Loop through the array to see if there is a free spot to add an item to it //Loop through the array to see if there is a free spot to add an item to it
for( ; uiLastItemPos < uiNumberOfItems; uiLastItemPos++) for( ; uiLastItemPos < uiNumberOfItems; ++uiLastItemPos)
{ {
if( pWorldItems[ uiLastItemPos ].fExists == FALSE ) if( pWorldItems[ uiLastItemPos ].fExists == FALSE )
{ {
@@ -2023,7 +2027,6 @@ BOOLEAN AddWorldItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT
pWorldItems[ uiLastItemPos ].bVisible = pWorldItem[ uiLoop ].bVisible; pWorldItems[ uiLastItemPos ].bVisible = pWorldItem[ uiLoop ].bVisible;
pWorldItems[ uiLastItemPos ].bRenderZHeightAboveLevel = pWorldItem[ uiLoop ].bRenderZHeightAboveLevel; pWorldItems[ uiLastItemPos ].bRenderZHeightAboveLevel = pWorldItem[ uiLoop ].bRenderZHeightAboveLevel;
//Check //Check
if(TileIsOutOfBounds(pWorldItem[ uiLoop ].sGridNo) && !( pWorldItems[ uiLastItemPos ].usFlags & WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT ) ) if(TileIsOutOfBounds(pWorldItem[ uiLoop ].sGridNo) && !( pWorldItems[ uiLastItemPos ].usFlags & WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT ) )
{ {
@@ -2819,8 +2822,6 @@ BOOLEAN GetSectorFlagStatus( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, UINT32 uiFla
return( (GetUnderGroundSectorFlagStatus( sMapX, sMapY, bMapZ, uiFlagToSet ) ) ? 1 : 0 ); return( (GetUnderGroundSectorFlagStatus( sMapX, sMapY, bMapZ, uiFlagToSet ) ) ? 1 : 0 );
} }
BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiFlags ) BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiFlags )
{ {
UINT32 uiNumberOfItems; UINT32 uiNumberOfItems;
@@ -2851,8 +2852,6 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
else else
AssertMsg( 0, "ERROR!! Flag not is Switch statement"); AssertMsg( 0, "ERROR!! Flag not is Switch statement");
// //
//Create an array of objects from the mercs inventory //Create an array of objects from the mercs inventory
// //
@@ -2864,15 +2863,11 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
{ {
if( pSoldier->inv[ i ].exists() == true ) if( pSoldier->inv[ i ].exists() == true )
{ {
// if not a player soldier // Flugente: if we don't want items to drop in autoresolve, this is the place to set that
if ( pSoldier->bTeam != gbPlayerNum ) if ( pSoldier->bTeam != gbPlayerNum && !gGameExternalOptions.fNPCAutoresolveItemDrop )
{ {
// this percent of the time, they don't drop stuff they would've dropped in tactical... // mark it undroppable...
if ( Random( 100 ) < 75 ) pSoldier->inv[i].fFlags |= OBJECT_UNDROPPABLE;
{
// mark it undroppable...
pSoldier->inv[ i ].fFlags |= OBJECT_UNDROPPABLE;
}
} }
//if the item can be dropped //if the item can be dropped