Feature enhancement: Drop All now allows to use the following settings:

0 = Drop All is off and drop chances are used
1 = Drop All is on and everything is dropped
2 = Mild Drop All which means that everything is dropped (like 1) but items that are usually not dropped (like 0) are severely damaged.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8675 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2019-04-22 11:12:13 +00:00
parent dfc69812b4
commit e39652f6e2
7 changed files with 38 additions and 21 deletions
+1 -6
View File
@@ -151,11 +151,6 @@ BOOLEAN UsingImprovedInterruptSystem()
return (!is_networked && gGameExternalOptions.fImprovedInterruptSystem); return (!is_networked && gGameExternalOptions.fImprovedInterruptSystem);
} }
BOOLEAN UsingEnemiesDropAllItemsSystem()
{
return gGameExternalOptions.fEnemiesDropAllItems;
}
BOOLEAN UsingInventoryCostsAPSystem() BOOLEAN UsingInventoryCostsAPSystem()
{ {
#ifdef JA2EDITOR #ifdef JA2EDITOR
@@ -1146,7 +1141,7 @@ void LoadGameExternalOptions()
gGameExternalOptions.bAssignedTraitsRarity = iniReader.ReadInteger("Tactical Difficulty Settings", "ASSIGNED_SKILL_TRAITS_RARITY ", 0, -100, 100); gGameExternalOptions.bAssignedTraitsRarity = iniReader.ReadInteger("Tactical Difficulty Settings", "ASSIGNED_SKILL_TRAITS_RARITY ", 0, -100, 100);
// Flugente: drop all is now set in the ini instead of the starting screen // Flugente: drop all is now set in the ini instead of the starting screen
gGameExternalOptions.fEnemiesDropAllItems = iniReader.ReadBoolean("Tactical Difficulty Settings", "DROP_ALL", FALSE ); gGameExternalOptions.fEnemiesDropAllItems = iniReader.ReadInteger("Tactical Difficulty Settings", "DROP_ALL", 0, 0, 2 );
// HEADROCK HAM B2.8: At "1", Militia will drop their equipment similar to enemies, IF killed by non-player character. At "2" they drop whenever killed. // HEADROCK HAM B2.8: At "1", Militia will drop their equipment similar to enemies, IF killed by non-player character. At "2" they drop whenever killed.
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 );
+1 -2
View File
@@ -278,7 +278,6 @@ bool UsingNewCTHSystem();
BOOLEAN UsingFoodSystem(); BOOLEAN UsingFoodSystem();
BOOLEAN UsingBackGroundSystem(); BOOLEAN UsingBackGroundSystem();
BOOLEAN UsingImprovedInterruptSystem(); BOOLEAN UsingImprovedInterruptSystem();
BOOLEAN UsingEnemiesDropAllItemsSystem();
BOOLEAN UsingInventoryCostsAPSystem(); BOOLEAN UsingInventoryCostsAPSystem();
BOOLEAN IsNIVModeValid(bool checkRes = true); BOOLEAN IsNIVModeValid(bool checkRes = true);
@@ -1088,7 +1087,7 @@ typedef struct
UINT16 usMaxTargetCoweringPenalty; UINT16 usMaxTargetCoweringPenalty;
// Flugente: drop all is now set in the ini instead of the starting screen // Flugente: drop all is now set in the ini instead of the starting screen
BOOLEAN fEnemiesDropAllItems; UINT8 fEnemiesDropAllItems;
// HEADROCK HAM B2.8: If this is turned on, Militia will drop their equipment similar to enemies, IF killed by non-player character. // HEADROCK HAM B2.8: If this is turned on, Militia will drop their equipment similar to enemies, IF killed by non-player character.
UINT8 ubMilitiaDropEquipment; UINT8 ubMilitiaDropEquipment;
+2 -2
View File
@@ -55,8 +55,8 @@
#endif #endif
CHAR8 czVersionNumber[16] = { "Build 19.01.02" }; //YY.MM.DD CHAR8 czVersionNumber[16] = { "Build 19.04.22" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" }; CHAR16 zTrackingNumber[16] = { L"Z" };
CHAR16 zRevisionNumber[16] = { L"Revision 8647" }; CHAR16 zRevisionNumber[16] = { L"Revision 8675" };
// SAVE_GAME_VERSION is defined in header, change it there // SAVE_GAME_VERSION is defined in header, change it there
+3 -3
View File
@@ -2327,7 +2327,7 @@ void RandomlyChooseWhichItemsAreDroppable( SOLDIERCREATE_STRUCT *pp, INT8 bSoldi
//Madd //Madd
//if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) // EXTERNILIZED TO THE INI INSTEAD - SANDRO //if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) // EXTERNILIZED TO THE INI INSTEAD - SANDRO
if ( UsingEnemiesDropAllItemsSystem() ) if ( gGameExternalOptions.fEnemiesDropAllItems == 1 )
{ {
ENEMYAMMODROPRATE = 100; ENEMYAMMODROPRATE = 100;
ENEMYGRENADEDROPRATE = 100; ENEMYGRENADEDROPRATE = 100;
@@ -2446,7 +2446,7 @@ else
//TODO: someday maybe pp->Inv[i].fFlags &= ~ITEM_REPAIRABLE; //TODO: someday maybe pp->Inv[i].fFlags &= ~ITEM_REPAIRABLE;
//if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) // EXTERNILIZED TO THE INI INSTEAD - SANDRO //if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) // EXTERNILIZED TO THE INI INSTEAD - SANDRO
if ( UsingEnemiesDropAllItemsSystem() ) if ( gGameExternalOptions.fEnemiesDropAllItems == 1 )
{ {
// WANNE: "Drop all" should mean "Drop all" // WANNE: "Drop all" should mean "Drop all"
/* /*
@@ -2488,7 +2488,7 @@ else
} }
//if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) // EXTERNILIZED TO THE INI INSTEAD - SANDRO //if ( gGameSettings.fOptions[TOPTION_DROP_ALL] ) // EXTERNILIZED TO THE INI INSTEAD - SANDRO
if ( UsingEnemiesDropAllItemsSystem() ) if ( gGameExternalOptions.fEnemiesDropAllItems == 1 )
return; return;
// WANNE: Randomly choose which type of items should be dropped // WANNE: Randomly choose which type of items should be dropped
+3 -1
View File
@@ -6915,7 +6915,9 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives
{ {
(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random( 20 ); // silversurfer: externalized this
//(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random( 20 );
(*pObj)[0]->data.objectStatus -= Random( zDiffSetting[gGameOptions.ubDifficultyLevel].usLootStatusModifier );
(*pObj)[0]->data.objectStatus = min( max( (*pObj)[0]->data.objectStatus, 1 ), 100 ); // never below 1% or above 100% (*pObj)[0]->data.objectStatus = min( max( (*pObj)[0]->data.objectStatus, 1 ), 100 ); // never below 1% or above 100%
(*pObj)[0]->data.sRepairThreshold = max( 1, min( 100, ((*pObj)[0]->data.objectStatus + 200) / 3 ) ); (*pObj)[0]->data.sRepairThreshold = max( 1, min( 100, ((*pObj)[0]->data.objectStatus + 200) / 3 ) );
+25 -6
View File
@@ -1020,8 +1020,10 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
{ {
// Check if it's supposed to be dropped // Check if it's supposed to be dropped
// silversurfer: new option to drop items from CIV_TEAM regardless of "OBJECT_UNDROPPABLE" flag // silversurfer: new option to drop items from CIV_TEAM regardless of "OBJECT_UNDROPPABLE" flag
// the same applies for enemy soldiers if mild drop all has been enabled
if ( !( (*pObj).fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum if ( !( (*pObj).fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum
|| ( gGameExternalOptions.fCiviliansDropAll && pSoldier->bTeam == CIV_TEAM && !IsVehicle(pSoldier) )) || ( gGameExternalOptions.fCiviliansDropAll && pSoldier->bTeam == CIV_TEAM && !IsVehicle(pSoldier) )
|| ( gGameExternalOptions.fEnemiesDropAllItems == 2 && pSoldier->bTeam == ENEMY_TEAM ) )
{ {
// and make sure that it really is a droppable item type // and make sure that it really is a droppable item type
// if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) // if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) )
@@ -1042,10 +1044,19 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
{ {
// silversurfer: externalized this // silversurfer: externalized this
//(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); //(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
(*pObj)[0]->data.objectStatus -= Random( zDiffSetting[gGameOptions.ubDifficultyLevel].usLootStatusModifier ); // if mild drop all is enabled and the item was usually not allowed to drop we will reduce its status considerably
(*pObj)[0]->data.objectStatus = min(max((*pObj)[0]->data.objectStatus,1),100); // never below 1% or above 100% if ( gGameExternalOptions.fEnemiesDropAllItems == 2 && pSoldier->bTeam == ENEMY_TEAM && (*pObj).fFlags & OBJECT_UNDROPPABLE )
{
(*pObj)[0]->data.objectStatus -= 60 + Random( zDiffSetting[gGameOptions.ubDifficultyLevel].usLootStatusModifier );
(*pObj)[0]->data.objectStatus = min(max((*pObj)[0]->data.objectStatus,1),100); // never below 1% or above 100%
}
else
{
(*pObj)[0]->data.objectStatus -= Random( zDiffSetting[gGameOptions.ubDifficultyLevel].usLootStatusModifier );
(*pObj)[0]->data.objectStatus = min(max((*pObj)[0]->data.objectStatus,1),100); // never below 1% or above 100%
(*pObj)[0]->data.sRepairThreshold = max(1, min(100, ((*pObj)[0]->data.objectStatus + 200)/3 )); }
(*pObj)[0]->data.sRepairThreshold = max(1, min(100, ((*pObj)[0]->data.objectStatus + 200)/3 ));
} }
} }
@@ -2496,7 +2507,7 @@ void ReduceAttachmentsOnGunForNonPlayerChars(SOLDIERTYPE *pSoldier, OBJECTTYPE *
Assert(UsingNewAttachmentSystem()==true); Assert(UsingNewAttachmentSystem()==true);
//If this item has any attachments, is not from a player, and is overwriteable. It's also only for guns. //If this item has any attachments, is not from a player, and is overwriteable. It's also only for guns.
if((*pObj)[0]->AttachmentListSize() > 0 && pSoldier->bTeam != gbPlayerNum && !((*pObj).fFlags & OBJECT_NO_OVERWRITE) && Item[pObj->usItem].usItemClass == IC_GUN && !UsingEnemiesDropAllItemsSystem() ) if((*pObj)[0]->AttachmentListSize() > 0 && pSoldier->bTeam != gbPlayerNum && !((*pObj).fFlags & OBJECT_NO_OVERWRITE) && Item[pObj->usItem].usItemClass == IC_GUN && !(gGameExternalOptions.fEnemiesDropAllItems == 1) )
{ {
UINT8 slotCount = 0; UINT8 slotCount = 0;
for(std::list<OBJECTTYPE>::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter, ++slotCount) for(std::list<OBJECTTYPE>::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter, ++slotCount)
@@ -2509,11 +2520,19 @@ void ReduceAttachmentsOnGunForNonPlayerChars(SOLDIERTYPE *pSoldier, OBJECTTYPE *
int i; int i;
for(i = 0; i < MAX_DEFAULT_ATTACHMENTS && Item[pObj->usItem].defaultattachments[i] != iter->usItem; i++){} for(i = 0; i < MAX_DEFAULT_ATTACHMENTS && Item[pObj->usItem].defaultattachments[i] != iter->usItem; i++){}
// with mild drop all attachments of undropable items need to be damaged as well as the base item
if( gGameExternalOptions.fEnemiesDropAllItems == 2 && pSoldier->bTeam == ENEMY_TEAM && (*pObj).fFlags & OBJECT_UNDROPPABLE )
{
(*iter)[0]->data.objectStatus -= 60 + Random( zDiffSetting[gGameOptions.ubDifficultyLevel].usLootStatusModifier );
(*iter)[0]->data.objectStatus = min(max((*iter)[0]->data.objectStatus,1),100); // never below 1% or above 100%
}
if(Item[pObj->usItem].defaultattachments[i] == iter->usItem) if(Item[pObj->usItem].defaultattachments[i] == iter->usItem)
continue; continue;
//Erase this attachment or not? //Erase this attachment or not?
if(!Chance(gGameExternalOptions.usAttachmentDropRate)){ if(!Chance(gGameExternalOptions.usAttachmentDropRate))
{
(*pObj).RemoveAttachment(&(*iter), 0, 0, pSoldier, 0, 1); (*pObj).RemoveAttachment(&(*iter), 0, 0, pSoldier, 0, 1);
iter = (*pObj)[0]->attachments.begin(); iter = (*pObj)[0]->attachments.begin();
advance(iter, slotCount); advance(iter, slotCount);
+3 -1
View File
@@ -2910,7 +2910,9 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
if ( Item[pSoldier->inv[i].usItem].damageable ) // Madd: drop crappier items on higher difficulty levels if ( Item[pSoldier->inv[i].usItem].damageable ) // Madd: drop crappier items on higher difficulty levels
{ {
pSoldier->inv[i][0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); // silversurfer: externalized this
//pSoldier->inv[i][0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
pSoldier->inv[i][0]->data.objectStatus -= Random( zDiffSetting[gGameOptions.ubDifficultyLevel].usLootStatusModifier );
pSoldier->inv[i][0]->data.objectStatus = max(pSoldier->inv[i][0]->data.objectStatus,1); // never below 1% pSoldier->inv[i][0]->data.objectStatus = max(pSoldier->inv[i][0]->data.objectStatus,1); // never below 1%
} }
pWorldItems[ bCount ].object = pSoldier->inv[i]; pWorldItems[ bCount ].object = pSoldier->inv[i];