repair and dirt system change:

Dirt is now part of gun status. The original dirt system has been removed. For details see:
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20198&goto=347370&#msg_347370


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8325 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2016-10-19 15:58:02 +00:00
parent e9a1f4b352
commit 372adc37b8
30 changed files with 716 additions and 806 deletions
+1 -3
View File
@@ -1871,9 +1871,6 @@ void LoadGameExternalOptions()
// Flugente: advanced repair/dirt system
gGameExternalOptions.fAdvRepairSystem = iniReader.ReadBoolean("Strategic Gameplay Settings","ADVANCED_REPAIR", FALSE);
gGameExternalOptions.fOnlyRepairGunsArmour = iniReader.ReadBoolean("Strategic Gameplay Settings","ONLY_REPAIR_GUNS_AND_ARMOUR", FALSE);
gGameExternalOptions.fDirtSystem = iniReader.ReadBoolean("Strategic Gameplay Settings","DIRT_SYSTEM", FALSE);
gGameExternalOptions.fFullRepairCleansGun = iniReader.ReadBoolean("Strategic Gameplay Settings","FULL_REPAIR_CLEANS_GUN", FALSE);
gGameExternalOptions.usSectorDirtDivider = iniReader.ReadInteger("Strategic Gameplay Settings","SECTOR_DIRT_DIVIDER", 1000, 1, 100000);
gGameExternalOptions.iDirtGlobalModifier = iniReader.ReadFloat ("Strategic Gameplay Settings","DIRT_GLOBAL_MODIFIER", 1.25f, 0.1f, 10.0f);
// Flugente: prisoner system
@@ -2302,6 +2299,7 @@ void LoadGameExternalOptions()
gGameExternalOptions.ubRepairCostPerJam = iniReader.ReadInteger("Strategic Assignment Settings","REPAIR_POINT_COST_TO_FIX_WEAPON_JAM",2, 1, 10);
gGameExternalOptions.ubRepairRateDivisor = iniReader.ReadInteger("Strategic Assignment Settings","REPAIR_RATE_DIVISOR",2500, 500, 25000);
gGameExternalOptions.ubCleaningRateDivisor = iniReader.ReadInteger("Strategic Assignment Settings","CLEANING_RATE_DIVISOR",500, 100, 25000);
gGameExternalOptions.ubAssignmentUnitsPerDay = iniReader.ReadInteger("Strategic Assignment Settings","REPAIR_SESSIONS_PER_DAY",24, 1, 96);
//SaveGame slot by Jazz
+1 -3
View File
@@ -747,6 +747,7 @@ typedef struct
INT32 ubRepairCostPerJam;
INT32 ubRepairRateDivisor;
INT32 ubCleaningRateDivisor;
//Misc settings
BOOLEAN fAmmoDynamicWeight; //Pulmu
@@ -1407,9 +1408,6 @@ typedef struct
// Flugente: advanced repair/dirt system
BOOLEAN fAdvRepairSystem; // allow thresholds to repairing
BOOLEAN fOnlyRepairGunsArmour; // we can only repair guns and armour
BOOLEAN fDirtSystem; // allow dirt on items increase the chance for weapon jamming
BOOLEAN fFullRepairCleansGun; // repairing a gun up to its current repair threshold also cleans the gun
UINT32 usSectorDirtDivider; // divide a guns dirt factor by this to get dirt increase for every turn
FLOAT iDirtGlobalModifier; // a global modifier to dirt generation, if one feels that all values should be lower/higher
// Flugente: prisoner related settings
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8325 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8325 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8325 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8325 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8325 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8325 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8325 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.8317 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.8325 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 16.10.15" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 16.10.19" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
+481 -162
View File
@@ -387,6 +387,9 @@ BOOLEAN IsSoldierKnownAsMercInSector(SOLDIERTYPE *pSoldier, INT16 sMapX, INT16 s
// how many points worth of tool kits does the character have?
UINT16 ToolKitPoints(SOLDIERTYPE *pSoldier);
// how many points worth of cleaning kits does the character have?
UINT16 CleaningKitPoints(SOLDIERTYPE *pSoldier);
// how many points worth of doctoring does the character have in his medical kits ?
UINT16 TotalMedicalKitPoints(SOLDIERTYPE *pSoldier);
@@ -411,6 +414,9 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHealA
// can item be repaired?
BOOLEAN IsItemRepairable( SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold );
// can item be cleaned?
BOOLEAN IsItemCleanable( SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold );
// does another merc have a repairable item on them?
OBJECTTYPE* FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOtherSoldier, UINT8 ubPassType );
@@ -619,6 +625,7 @@ void AssignmentAborted( SOLDIERTYPE *pSoldier, UINT8 ubReason );
UINT32 GetLastSquadListedInSquadMenu( void );
BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier );
BOOLEAN IsAnythingAroundForSoldierToClean( SOLDIERTYPE * pSoldier );
BOOLEAN HasCharacterFinishedRepairing( SOLDIERTYPE * pSoldier );
BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE * pSoldier, INT8 bHighestPass );
@@ -633,6 +640,7 @@ BOOLEAN BasicCanCharacterFacility( SOLDIERTYPE *pSoldier );
SOLDIERTYPE *GetSelectedAssignSoldier( BOOLEAN fNullOK );
BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * pObj, UINT8 * pubRepairPtsLeft );
BOOLEAN CleanObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * pObj, UINT8 * pubCleaningPtsLeft );
void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft );
BOOLEAN UnjamGunsOnSoldier( SOLDIERTYPE *pOwnerSoldier, SOLDIERTYPE *pRepairSoldier, UINT8 *pubRepairPtsLeft );
@@ -667,6 +675,8 @@ static INT16 GetMinimumStackDurability(const OBJECTTYPE* pObj);
static BOOLEAN IsGunJammed(const OBJECTTYPE* pObj);
/// Collect items that need repairing and add them to the repair queue
static void CollectRepairableItems(SOLDIERTYPE* pRepairSoldier, SOLDIERTYPE* pSoldier, RepairQueue& itemsToFix);
/// Collect items that need cleaning and add them to the cleaning queue
static void CollectCleanableItems(SOLDIERTYPE* pRepairSoldier, SOLDIERTYPE* pSoldier, RepairQueue& itemsToClean);
extern BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse );
@@ -999,7 +1009,57 @@ BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier )
return( FALSE );
}
BOOLEAN IsAnythingAroundForSoldierToClean( SOLDIERTYPE * pSoldier )
{
// first check own inventory
// Iterate over all pocket slots and add items in need of repair
for (UINT8 pocketIndex = HANDPOS; pocketIndex < NUM_INV_SLOTS; ++pocketIndex)
{
const OBJECTTYPE* pObj = &(const_cast<SOLDIERTYPE *>(pSoldier)->inv[pocketIndex]);
if(pObj == NULL || pObj->ubNumberOfObjects == NOTHING || pObj->usItem == NOTHING)
continue;
// Check if item needs cleaning
for (UINT8 stackIndex = 0; stackIndex < pObj->ubNumberOfObjects; ++stackIndex)
{
// Check the stack item itself
if ( IsItemCleanable(pSoldier, pObj->usItem, (*pObj)[stackIndex]->data.objectStatus, (*pObj)[stackIndex]->data.sRepairThreshold) )
{
// found something dirty
return ( TRUE );
}
}
}
// now the other merc's stuff
for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex < gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex)
{
// Ignore self, mercs in other sectors, etc.
if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex]))
{
// Iterate over all pocket slots and add items in need of repair
for (UINT8 pocketIndex = HANDPOS; pocketIndex < NUM_INV_SLOTS; ++pocketIndex)
{
const OBJECTTYPE* pObj = &(const_cast<SOLDIERTYPE *>(MercPtrs[teamIndex])->inv[pocketIndex]);
if(pObj == NULL || pObj->ubNumberOfObjects == NOTHING || pObj->usItem == NOTHING)
continue;
// Check if item needs cleaning
for (UINT8 stackIndex = 0; stackIndex < pObj->ubNumberOfObjects; ++stackIndex)
{
// Check the stack item itself
if ( IsItemCleanable(pSoldier, pObj->usItem, (*pObj)[stackIndex]->data.objectStatus, (*pObj)[stackIndex]->data.sRepairThreshold) )
{
return ( TRUE );
}
}
}
}
}
return ( FALSE );
}
BOOLEAN HasCharacterFinishedRepairing( SOLDIERTYPE * pSoldier )
{
@@ -1194,7 +1254,13 @@ BOOLEAN CanCharacterRepairButDoesntHaveARepairkit( SOLDIERTYPE *pSoldier )
return( FALSE );
}
return( TRUE );
// only return TRUE if there is something to repair!
if ( IsAnythingAroundForSoldierToRepair( pSoldier ) )
{
return( TRUE );
}
return( FALSE );
}
// can character be assigned as repairman?
@@ -1213,23 +1279,29 @@ BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier )
return( FALSE );
}
// make sure he has a toolkit
if ( FindToolkit( pSoldier ) == NO_SLOT )
// make sure he has a toolkit or cleaning kit to clean guns
if ( FindToolkit( pSoldier ) == NO_SLOT && pSoldier->GetObjectWithFlag( CLEANING_KIT ) == NULL )
{
return( FALSE );
}
// anything around to fix?
if ( !IsAnythingAroundForSoldierToRepair( pSoldier ) )
// anything around to clean?
if ( pSoldier->GetObjectWithFlag( CLEANING_KIT ) != NULL && IsAnythingAroundForSoldierToClean( pSoldier ) )
{
return( FALSE );
return( TRUE );
}
// anything around to fix?
if ( FindToolkit( pSoldier ) != NO_SLOT && IsAnythingAroundForSoldierToRepair( pSoldier ) )
{
return( TRUE );
}
// NOTE: This will not detect situations where character lacks the SKILL to repair the stuff that needs repairing...
// So, in that situation, his assignment will NOT flash, but a message to that effect will be reported every hour.
// all criteria fit, can repair
return ( TRUE );
// no criteria fits, can't repair
return ( FALSE );
}
@@ -2944,6 +3016,67 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
return(( UINT8 )usRepairPts);
}
UINT8 CalculateCleaningPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
{
UINT32 usCleaningPts;
UINT16 usKitPts;
// oops, we have no cleaning kit
if ( pSoldier->GetObjectWithFlag( CLEANING_KIT ) == NULL )
{
*pusMaxPts = 0;
return 0;
}
// calculate effective repair rate (adjusted for drugs, alcohol, etc.)
usCleaningPts = (UINT16) ((EffectiveMechanical( pSoldier ) * EffectiveDexterity( pSoldier, FALSE ) * (100 + ( 5 * EffectiveExpLevel( pSoldier) ) )) / ( gGameExternalOptions.ubCleaningRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ));
// calculate normal repair rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
// and equipment was not a hindrance
INT16 mechanical = (pSoldier->stats.bMechanical * (100 + pSoldier->GetBackgroundValue( BG_MECHANICAL ))) / 100;
INT16 dexterity = (pSoldier->stats.bDexterity * (100 + pSoldier->GetBackgroundValue( BG_DEXTERITY ))) / 100;
*pusMaxPts = (mechanical * dexterity * (100 + (5 * pSoldier->stats.bExpLevel))) / (gGameExternalOptions.ubCleaningRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay);
// SANDRO - Technician trait gives a good bonus to repair items
// we also use that for cleaning guns
if ( gGameOptions.fNewTraitSystem )
{
usCleaningPts = usCleaningPts * (100 + gSkillTraitValues.bSpeedModifierRepairing) / 100;
*pusMaxPts = *pusMaxPts * (100 + gSkillTraitValues.bSpeedModifierRepairing) / 100;
if ( HAS_SKILL_TRAIT( pSoldier, TECHNICIAN_NT ) )
{
usCleaningPts += usCleaningPts * gSkillTraitValues.usTERepairSpeedBonus * (NUM_SKILL_TRAITS( pSoldier, TECHNICIAN_NT )) / 100;
*pusMaxPts += *pusMaxPts * gSkillTraitValues.usTERepairSpeedBonus * (NUM_SKILL_TRAITS( pSoldier, TECHNICIAN_NT )) / 100;
}
// Penalty for aggressive people
if ( DoesMercHavePersonality( pSoldier, CHAR_TRAIT_AGGRESSIVE ) )
{
usCleaningPts -= usCleaningPts / 10; // -10%
*pusMaxPts -= *pusMaxPts / 10;
}
// Bonus for phlegmatic people
else if ( DoesMercHavePersonality( pSoldier, CHAR_TRAIT_PHLEGMATIC ) )
{
usCleaningPts += usCleaningPts / 20; // +5%
*pusMaxPts += *pusMaxPts / 20;
}
}
// adjust for fatigue
ReducePointsForFatigue( pSoldier, &usCleaningPts );
// Flugente: our food situation influences our effectiveness
if ( gGameOptions.fFoodSystem )
ReducePointsForHunger( pSoldier, &usCleaningPts );
usKitPts = CleaningKitPoints( pSoldier );
// return current cleaning pts
return(( UINT8 )usCleaningPts);
}
extern INT32 CalcThreateningEffectiveness( UINT8 ubMerc );
// Flugente: calculate interrogation value
@@ -3517,6 +3650,23 @@ UINT16 ToolKitPoints(SOLDIERTYPE *pSoldier)
return( usKitpts );
}
UINT16 CleaningKitPoints(SOLDIERTYPE *pSoldier)
{
UINT16 usKitpts=0;
UINT8 ubPocket;
// add up kit points
// CHRISL: Changed to dynamically determine max inventory locations.
for (ubPocket=HANDPOS; ubPocket < NUM_INV_SLOTS; ubPocket++)
{
if( HasItemFlag( pSoldier->inv[ubPocket].usItem, CLEANING_KIT ) )
{
usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) );
}
}
return( usKitpts );
}
UINT16 TotalMedicalKitPoints(SOLDIERTYPE *pSoldier)
{
@@ -4227,7 +4377,7 @@ void HandleRepairmenInSector( INT16 sX, INT16 sY, INT8 bZ )
{
if ( IS_REPAIR(pTeamSoldier->bAssignment) && ( pTeamSoldier->flags.fMercAsleep == FALSE ) )
{
if ( MakeSureToolKitIsInHand( pTeamSoldier ) )
if ( MakeSureToolKitIsInHand( pTeamSoldier ) || pTeamSoldier->GetObjectWithFlag( CLEANING_KIT ) != NULL )
{
// character is in sector, check if can repair
if ( CanCharacterRepair( pTeamSoldier ) && ( EnoughTimeOnAssignment( pTeamSoldier ) ) )
@@ -4419,6 +4569,29 @@ static void CollectRepairableItems(SOLDIERTYPE* pRepairSoldier, SOLDIERTYPE* pSo
}
}
static void CollectCleanableItems(SOLDIERTYPE* pRepairSoldier, SOLDIERTYPE* pSoldier, RepairQueue& itemsToClean)
{
// Iterate over all pocket slots and add items in need of repair
for (UINT8 pocketIndex = HANDPOS; pocketIndex < NUM_INV_SLOTS; ++pocketIndex)
{
const OBJECTTYPE* pObj = &(const_cast<SOLDIERTYPE *>(pSoldier)->inv[pocketIndex]);
if(pObj == NULL || pObj->ubNumberOfObjects == NOTHING || pObj->usItem == NOTHING)
continue;
// Check if item needs cleaning
for (UINT8 stackIndex = 0; stackIndex < pObj->ubNumberOfObjects; ++stackIndex)
{
// Check the stack item itself
if ( IsItemCleanable(pRepairSoldier, pObj->usItem, (*pObj)[stackIndex]->data.objectStatus, (*pObj)[stackIndex]->data.sRepairThreshold) )
{
RepairItem item(pObj, pSoldier, (INVENTORY_SLOT) pocketIndex);
itemsToClean.push(item);
break;
}
}
}
}
static BOOLEAN IsGunJammed(const OBJECTTYPE* pObj) {
return (Item[pObj->usItem].usItemClass == IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0);
}
@@ -4633,12 +4806,6 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE *
gMercProfiles[ pSoldier->ubProfile ].records.usItemsRepaired++;
}
if ( (*pObj)[ubLoop]->data.objectStatus == threshold )
{
// if item was fully repaired, consider it cleaned
if ( gGameExternalOptions.fDirtSystem && gGameExternalOptions.fFullRepairCleansGun )
(*pObj)[ubLoop]->data.bDirtLevel = 0.0f;
}
// note: this system is bad if we can repair only 1% per hour (which is rather we are total losers)
///////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -4715,21 +4882,90 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE *
return( fSomethingWasRepaired );
}
BOOLEAN CleanObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * pObj, UINT8 * pubCleaningPtsLeft )
{
UINT8 ubDirtPts, ubPtsCleaned, ubLoop, ubItemsInPocket;
BOOLEAN bFullyCleaned = FALSE;
// no gun? We shouldn't be here...
if ( !Item[pObj->usItem].usItemClass & IC_GUN )
Assert(0);
ubItemsInPocket = pObj->ubNumberOfObjects;
for ( ubLoop = 0; ubLoop < ubItemsInPocket; ++ubLoop )
{
// Flugente: if using the new advanced repair system, we can only clean up to the repair threshold
INT16 sThreshold = 100;
if ( gGameExternalOptions.fAdvRepairSystem )
{
sThreshold = (*pObj)[ubLoop]->data.sRepairThreshold;
}
// how many points of dirt has the gun accumulated?
ubDirtPts = sThreshold - (*pObj)[ubLoop]->data.objectStatus;
// do we have enough pts to fully clean the item?
if ( *pubCleaningPtsLeft >= ubDirtPts )
{
// fix it up to the threshold (max 100%)
(*pObj)[ubLoop]->data.objectStatus = sThreshold;
*pubCleaningPtsLeft -= ubDirtPts;
bFullyCleaned = TRUE;
}
else // not enough, partial clean only, if any at all
{
// clean what we can
ubPtsCleaned = *pubCleaningPtsLeft;
// if we have enough to actually clean anything
if (ubPtsCleaned > 0)
{
(*pObj)[ubLoop]->data.objectStatus += ubPtsCleaned;
}
*pubCleaningPtsLeft = 0;
bFullyCleaned = FALSE;
}
// we have fully cleaned the gun
if ( (*pObj)[ubLoop]->data.objectStatus == sThreshold )
{
// report it as cleaned
if ( pSoldier == pOwner )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_CLEANED ], pSoldier->GetName(), ItemNames[ pObj->usItem ] );
}
else
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_CLEANED_FOR_OWNER ], pSoldier->GetName(), pOwner->GetName(), ItemNames[ pObj->usItem ] );
}
}
if ( *pubCleaningPtsLeft == 0 )
{
// we're out of points!
return ( bFullyCleaned );
}
}
return ( bFullyCleaned );
}
void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
{
UINT16 usMax=0;
UINT8 ubRepairPtsLeft =0;
UINT8 ubInitialRepairPts = 0;
UINT8 ubRepairPtsUsed = 0;
BOOLEAN fNothingLeftToRepair = FALSE;
UINT16 usRepairMax = 0, usCleaningMax = 0;
UINT8 ubRepairPtsLeft = 0, ubCleaningPtsLeft = 0;
UINT8 ubInitialRepairPts = 0, ubInitialCleaningPts = 0;
UINT8 ubRepairPtsUsed = 0, ubCleaningPtsUsed = 0;
BOOLEAN fNothingLeftToRepair = FALSE, bNothingLeftToClean = FALSE;
UINT16 usKitDegrade = 100;
// grab max number of repair pts open to this soldier
ubRepairPtsLeft = CalculateRepairPointsForRepairman( pSoldier, &usMax, TRUE );
ubRepairPtsLeft = CalculateRepairPointsForRepairman( pSoldier, &usRepairMax, TRUE );
ubCleaningPtsLeft = CalculateCleaningPointsForRepairman ( pSoldier, &usCleaningMax );
// no points
if ( ubRepairPtsLeft == 0 )
if ( ubRepairPtsLeft == 0 && ubCleaningPtsLeft == 0 )
{
AssignmentDone( pSoldier, TRUE, TRUE );
return;
@@ -4737,11 +4973,12 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
// remember what we've started off with
ubInitialRepairPts = ubRepairPtsLeft;
ubInitialCleaningPts = ubCleaningPtsLeft;
// check if we are repairing a vehicle
if ( pSoldier->bVehicleUnderRepairID != -1 )
{
if ( CanCharacterRepairVehicle( pSoldier, pSoldier->bVehicleUnderRepairID ) )
if ( CanCharacterRepairVehicle( pSoldier, pSoldier->bVehicleUnderRepairID ) && ubRepairPtsLeft > 0 )
{
// attempt to fix vehicle
ubRepairPtsLeft -= RepairVehicle( pSoldier->bVehicleUnderRepairID, ubRepairPtsLeft, &fNothingLeftToRepair );
@@ -4750,7 +4987,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
// check if we are repairing a robot
else if( pSoldier->flags.fFixingRobot )
{
if ( CanCharacterRepairRobot( pSoldier ) )
if ( CanCharacterRepairRobot( pSoldier ) && ubRepairPtsLeft > 0 )
{
// repairing the robot is very slow & difficult
@@ -4786,7 +5023,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
}
else if ( pSoldier->flags.fFixingSAMSite )
{
if ( CanSoldierRepairSAM( pSoldier ) )
if ( CanSoldierRepairSAM( pSoldier ) && ubRepairPtsLeft > 0 )
{
// repair the SAM
INT16 sStrategicSector = CALCULATE_STRATEGIC_INDEX( pSoldier->sSectorX, pSoldier->sSectorY );
@@ -4811,159 +5048,223 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
}
else
{
if (gGameExternalOptions.fAdditionalRepairMode)
// first priority for item repair is cleaning guns
if ( ubCleaningPtsLeft > 0 )
{
// 2Points: Use new repair algorithm
// Collect all items in need of repair and assign them priorities
RepairQueue itemsToFix;
RepairQueue itemsToClean;
// silversurfer: Looks strange? It's not. This function now needs the guy that does the repairs and the one that owns the stuff.
CollectRepairableItems(pSoldier, pSoldier, itemsToFix);
// first build list of guns to be cleaned
// silversurfer: Looks strange? It's not. This function now needs the guy that does the cleaning and the one that owns the stuff.
// first our own stuff
CollectCleanableItems(pSoldier, pSoldier, itemsToClean);
// then other mercs' stuff
for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex < gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex)
{
// Ignore self, mercs in other sectors, etc.
if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex]))
// silversurfer: This function now needs the guy that does the repairs and the one that owns the stuff.
CollectRepairableItems(pSoldier, MercPtrs[teamIndex], itemsToFix);
CollectCleanableItems(pSoldier, MercPtrs[teamIndex], itemsToClean);
}
// Step through items, starting with the highest priority item
while (!itemsToFix.empty() && ubRepairPtsLeft > 0)
while (!itemsToClean.empty() && ubCleaningPtsLeft > 0)
{
const RepairItem object = itemsToFix.top();
itemsToFix.pop();
const RepairItem object = itemsToClean.top();
itemsToClean.pop();
// Jammed gun; call unjam function first
if ( IsGunJammed(object.item) )
UnjamGunsOnSoldier(const_cast<SOLDIERTYPE*> (object.owner), pSoldier, &ubRepairPtsLeft);
UnjamGunsOnSoldier(const_cast<SOLDIERTYPE*> (object.owner), pSoldier, &ubCleaningPtsLeft);
// Regular repair function
BOOLEAN itemRepaired = RepairObject( pSoldier, const_cast<SOLDIERTYPE*> (object.owner), const_cast<OBJECTTYPE*> (object.item), &ubRepairPtsLeft );
// Clean gun
BOOLEAN bFullyCleaned = CleanObject( pSoldier, const_cast<SOLDIERTYPE*> (object.owner), const_cast<OBJECTTYPE*> (object.item), &ubCleaningPtsLeft);
if ( itemsToClean.empty() && bFullyCleaned )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sRepairsDoneString[ 7 ], pSoldier->GetName() );
bNothingLeftToClean = TRUE;
}
}
// we spent some time cleaning so adjust repair points accordingly
if ( ubRepairPtsLeft > 0 && ubInitialCleaningPts > ubCleaningPtsLeft )
{
ubRepairPtsLeft = UINT8()(ubRepairPtsLeft * ubCleaningPtsLeft / ubInitialCleaningPts);
}
}
// now check if we can repair items
if ( ubRepairPtsLeft > 0 )
{
if (gGameExternalOptions.fAdditionalRepairMode)
{
// 2Points: Use new repair algorithm
// Collect all items in need of repair and assign them priorities
RepairQueue itemsToFix;
// silversurfer: Looks strange? It's not. This function now needs the guy that does the repairs and the one that owns the stuff.
CollectRepairableItems(pSoldier, pSoldier, itemsToFix);
for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex < gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex)
{
// Ignore self, mercs in other sectors, etc.
if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex]))
// silversurfer: This function now needs the guy that does the repairs and the one that owns the stuff.
CollectRepairableItems(pSoldier, MercPtrs[teamIndex], itemsToFix);
}
// Step through items, starting with the highest priority item
while (!itemsToFix.empty() && ubRepairPtsLeft > 0)
{
const RepairItem object = itemsToFix.top();
itemsToFix.pop();
// Jammed gun; call unjam function first
if ( IsGunJammed(object.item) )
UnjamGunsOnSoldier(const_cast<SOLDIERTYPE*> (object.owner), pSoldier, &ubRepairPtsLeft);
// Regular repair function
BOOLEAN itemRepaired = RepairObject( pSoldier, const_cast<SOLDIERTYPE*> (object.owner), const_cast<OBJECTTYPE*> (object.item), &ubRepairPtsLeft );
#ifdef _DEBUG
if (itemRepaired)
ScreenMsg(FONT_ORANGE, MSG_BETAVERSION, L"Repaired: %s's %s in item slot %d [Dur: %d]. %d points left.",
object.owner->name, Item[object.item->usItem].szItemName, object.inventorySlot, GetMinimumStackDurability(object.item), ubRepairPtsLeft);
if (itemRepaired)
ScreenMsg(FONT_ORANGE, MSG_BETAVERSION, L"Repaired: %s's %s in item slot %d [Dur: %d]. %d points left.",
object.owner->name, Item[object.item->usItem].szItemName, object.inventorySlot, GetMinimumStackDurability(object.item), ubRepairPtsLeft);
#endif
// The following assumes that weapon/armor has higher priority than regular items! If the priorities are changed, this notification
// probably won't work reliably anymore.
// The following assumes that weapon/armor has higher priority than regular items! If the priorities are changed, this notification
// probably won't work reliably anymore.
// The item has been repaired completely
if (GetMinimumStackDurability(object.item) == 100)
{
// No items left in queue: All items have been repaired
if (itemsToFix.empty())
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sRepairsDoneString[ 3 ], pSoldier->GetName() );
else {
// The current item was a weapon/armor
if ( (IsWeapon(object.item->usItem) || Item[object.item->usItem].usItemClass == IC_ARMOUR) &&
// ...and the next item isn't:
(!IsWeapon(itemsToFix.top().item->usItem) && Item[itemsToFix.top().item->usItem].usItemClass != IC_ARMOUR) )
{
// The item has been repaired completely
if (GetMinimumStackDurability(object.item) == 100)
{
// No items left in queue: All items have been repaired
if (itemsToFix.empty())
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sRepairsDoneString[ 3 ], pSoldier->GetName() );
else {
// The current item was a weapon/armor
if ( (IsWeapon(object.item->usItem) || Item[object.item->usItem].usItemClass == IC_ARMOUR) &&
// ...and the next item isn't:
(!IsWeapon(itemsToFix.top().item->usItem) && Item[itemsToFix.top().item->usItem].usItemClass != IC_ARMOUR) )
{
// All weapons & armor have been repaired
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sRepairsDoneString[ 1 ], pSoldier->GetName() );
StopTimeCompression();
// All weapons & armor have been repaired
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sRepairsDoneString[ 1 ], pSoldier->GetName() );
StopTimeCompression();
}
}
}
}
}
}
else
{
// Old repair algorithm
INT8 bPocket =0;
BOOLEAN fNothingLeftToRepair = FALSE;
INT8 bLoop, bLoopStart, bLoopEnd;
OBJECTTYPE * pObj;
BOOLEAN fAnyOfSoldiersOwnItemsWereFixed = UnjamGunsOnSoldier( pSoldier, pSoldier, &ubRepairPtsLeft );
// repair items on self
// HEADROCK HAM B2.8: Experimental feature: Fixes LBEs last, as they don't actually require repairs.
for( bLoop = 0; bLoop < 4; ++bLoop )
else
{
if ( bLoop == 0 )
// Old repair algorithm
INT8 bPocket =0;
BOOLEAN fNothingLeftToRepair = FALSE;
INT8 bLoop, bLoopStart, bLoopEnd;
OBJECTTYPE * pObj;
BOOLEAN fAnyOfSoldiersOwnItemsWereFixed = UnjamGunsOnSoldier( pSoldier, pSoldier, &ubRepairPtsLeft );
// repair items on self
// HEADROCK HAM B2.8: Experimental feature: Fixes LBEs last, as they don't actually require repairs.
for( bLoop = 0; bLoop < 4; ++bLoop )
{
bLoopStart = SECONDHANDPOS;
// HEADROCK: New loop stage only checks second hand, to avoid LBEs.
bLoopEnd = SECONDHANDPOS;
}
else if ( bLoop == 1 )
{
// HEADROCK: Second check is for armor and headgear only.
bLoopStart = HELMETPOS;
bLoopEnd = HEAD2POS;
}
else if ( bLoop == 2 )
{
// HEADROCK: Loop stage altered to run through inventory only
bLoopStart = UsingNewInventorySystem() == false ? BIGPOCKSTART : GUNSLINGPOCKPOS;
// CHRISL: Changed to dynamically determine max inventory locations.
bLoopEnd = (NUM_INV_SLOTS - 1);
}
else if ( bLoop == 3 )
{
if (UsingNewInventorySystem() == true)
if ( bLoop == 0 )
{
// HEADROCK: Last loop fixes LBEs
bLoopStart = VESTPOCKPOS;
bLoopEnd = BPACKPOCKPOS;
}
else
{
// HEADROCK: In OIV, simply check everything again.
bLoopStart = SECONDHANDPOS;
// HEADROCK: New loop stage only checks second hand, to avoid LBEs.
bLoopEnd = SECONDHANDPOS;
}
else if ( bLoop == 1 )
{
// HEADROCK: Second check is for armor and headgear only.
bLoopStart = HELMETPOS;
bLoopEnd = HEAD2POS;
}
else if ( bLoop == 2 )
{
// HEADROCK: Loop stage altered to run through inventory only
bLoopStart = UsingNewInventorySystem() == false ? BIGPOCKSTART : GUNSLINGPOCKPOS;
// CHRISL: Changed to dynamically determine max inventory locations.
bLoopEnd = (NUM_INV_SLOTS - 1);
}
}
// now repair objects running from left hand to small pocket
for( bPocket = bLoopStart; bPocket <= bLoopEnd; ++bPocket )
{
//CHRISL: These two conditions allow us to repair LBE pocket items at the same time as worn armor, while
// still letting us repair the item in our offhand first.
// HEADROCK HAM B2.8: No longer necessary, as I've artificially added new stages for this. LBE
// pockets are now repaired LAST.
//if(UsingNewInventorySystem() == true && bLoop == 0 && bPocket>SECONDHANDPOS && bPocket<GUNSLINGPOCKPOS)
// continue;
//if(UsingNewInventorySystem() == true && bLoop == 1 && bPocket==SECONDHANDPOS)
// continue;
pObj = &(pSoldier->inv[ bPocket ]);
if ( RepairObject( pSoldier, pSoldier, pObj, &ubRepairPtsLeft ) )
else if ( bLoop == 3 )
{
fAnyOfSoldiersOwnItemsWereFixed = TRUE;
// quit looking if we're already out
if ( ubRepairPtsLeft == 0 )
break;
if (UsingNewInventorySystem() == true)
{
// HEADROCK: Last loop fixes LBEs
bLoopStart = VESTPOCKPOS;
bLoopEnd = BPACKPOCKPOS;
}
else
{
// HEADROCK: In OIV, simply check everything again.
bLoopStart = SECONDHANDPOS;
bLoopEnd = (NUM_INV_SLOTS - 1);
}
}
// now repair objects running from left hand to small pocket
for( bPocket = bLoopStart; bPocket <= bLoopEnd; ++bPocket )
{
//CHRISL: These two conditions allow us to repair LBE pocket items at the same time as worn armor, while
// still letting us repair the item in our offhand first.
// HEADROCK HAM B2.8: No longer necessary, as I've artificially added new stages for this. LBE
// pockets are now repaired LAST.
//if(UsingNewInventorySystem() == true && bLoop == 0 && bPocket>SECONDHANDPOS && bPocket<GUNSLINGPOCKPOS)
// continue;
//if(UsingNewInventorySystem() == true && bLoop == 1 && bPocket==SECONDHANDPOS)
// continue;
pObj = &(pSoldier->inv[ bPocket ]);
if ( RepairObject( pSoldier, pSoldier, pObj, &ubRepairPtsLeft ) )
{
fAnyOfSoldiersOwnItemsWereFixed = TRUE;
// quit looking if we're already out
if ( ubRepairPtsLeft == 0 )
break;
}
}
// quit looking if we're already out
if ( ubRepairPtsLeft == 0 )
break;
}
// quit looking if we're already out
if ( ubRepairPtsLeft == 0 )
break;
// if he fixed something of his, and now has no more of his own items to fix
if ( fAnyOfSoldiersOwnItemsWereFixed && !DoesCharacterHaveAnyItemsToRepair( pSoldier, -1 ) )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sRepairsDoneString[ 0 ], pSoldier->GetName() );
// let player react
StopTimeCompression();
}
// repair items on others
if ( ubRepairPtsLeft )
RepairItemsOnOthers( pSoldier, &ubRepairPtsLeft );
}
// if he fixed something of his, and now has no more of his own items to fix
if ( fAnyOfSoldiersOwnItemsWereFixed && !DoesCharacterHaveAnyItemsToRepair( pSoldier, -1 ) )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sRepairsDoneString[ 0 ], pSoldier->GetName() );
// let player react
StopTimeCompression();
}
// repair items on others
if ( ubRepairPtsLeft )
RepairItemsOnOthers( pSoldier, &ubRepairPtsLeft );
}
}
// what are the total amount of pts used by character?
// what is the total amount of pts used by character?
ubCleaningPtsUsed = ubInitialCleaningPts - ubCleaningPtsLeft;
if( ubCleaningPtsUsed > 0 )
{
// improve stats
StatChange( pSoldier, MECHANAMT, ( UINT16 ) (ubCleaningPtsUsed / 5), FALSE );
StatChange( pSoldier, DEXTAMT, ( UINT16 ) (ubCleaningPtsUsed / 5), FALSE );
// check if kit damaged/depleted
if( ( Random( 50 ) ) < (UINT32)(ubCleaningPtsUsed) )
{
// kit item damaged/depleted, burn up points of cleaning kit
UseKitPoints( pSoldier->GetObjectWithFlag( CLEANING_KIT ), (UINT16)(ubCleaningPtsUsed / 10 + 1), pSoldier );
}
}
// what is the total amount of pts used by character?
ubRepairPtsUsed = ubInitialRepairPts - ubRepairPtsLeft;
if( ubRepairPtsUsed > 0 )
{
@@ -4985,27 +5286,30 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
}
}
// if he really done
if ( HasCharacterFinishedRepairing( pSoldier ) )
BOOLEAN bCleaning = FALSE, bRepairing = FALSE;
// anything around to clean?
if ( pSoldier->GetObjectWithFlag( CLEANING_KIT ) != NULL && !bNothingLeftToClean )
{
// yup, that's all folks
AssignmentDone( pSoldier, TRUE, TRUE );
bCleaning = TRUE;
}
else // still has stuff to repair
{
// Flugente: observed an instance where toolkit ran out, but assignment was not quitted, resulting in a crash on the next hour - better check here
if ( FindToolkit( pSoldier ) == NO_SLOT )
{
// he could (maybe) repair something, but can't because he doesn't have a tool kit!
AssignmentAborted( pSoldier, NO_MORE_TOOL_KITS );
}
// if nothing got repaired, there's a problem
if ( ubRepairPtsUsed == 0 )
{
// he can't repair anything because he doesn't have enough skill!
AssignmentAborted( pSoldier, INSUF_REPAIR_SKILL );
}
// anything around to fix?
if ( FindToolkit( pSoldier ) != NO_SLOT && IsAnythingAroundForSoldierToRepair( pSoldier ) )
{
bRepairing = TRUE;
}
// if nothing got repaired or cleaned, there's a problem
if ( ubRepairPtsUsed == 0 && ubCleaningPtsUsed == 0 )
{
// he can't repair anything because he doesn't have enough skill!
AssignmentAborted( pSoldier, INSUF_REPAIR_SKILL );
}
// nothing more to do?
else if ( !bCleaning && !bRepairing )
{
AssignmentDone( pSoldier, TRUE, TRUE );
StopTimeCompression();
}
}
@@ -5042,6 +5346,20 @@ BOOLEAN IsItemRepairable(SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, IN
return ( FALSE );
}
BOOLEAN IsItemCleanable( SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold )
{
// only guns can be cleaned
if ( bStatus < 100 && Item[usItem].usItemClass & IC_GUN )
{
// can't clean beyond repair threshold when Advanced Repair System is active
if ( gGameExternalOptions.fAdvRepairSystem && bStatus >= bThreshold )
return ( FALSE );
else
return ( TRUE );
}
return ( FALSE );
}
// Not used anywhere?!
/*void HandleRestAndFatigueInSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
{
@@ -8607,6 +8925,7 @@ void HandleShadingOfLinesForRepairMenu( void )
}
pSoldier = GetSelectedAssignSoldier( FALSE );
BOOL bHasToolkit = (FindToolkit( pSoldier ) != NO_SLOT);
// PLEASE NOTE: make sure any changes you do here are reflected in all 3 routines which must remain in synch:
// CreateDestroyMouseRegionForRepairMenu(), DisplayRepairMenu(), and HandleShadingOfLinesForRepairMenu().
@@ -8622,7 +8941,7 @@ void HandleShadingOfLinesForRepairMenu( void )
{
if ( IsThisVehicleAccessibleToSoldier( pSoldier, iVehicleIndex ) )
{
if( CanCharacterRepairVehicle( pSoldier, iVehicleIndex ) == TRUE )
if( CanCharacterRepairVehicle( pSoldier, iVehicleIndex ) == TRUE && bHasToolkit )
{
// unshade vehicle line
UnShadeStringInBox( ghRepairBox, iCount );
@@ -8643,7 +8962,7 @@ void HandleShadingOfLinesForRepairMenu( void )
if ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) )
{
// handle enable disable of repair sam option
if( CanSoldierRepairSAM( pSoldier ) )
if( CanSoldierRepairSAM( pSoldier ) && bHasToolkit )
{
// unshade SAM line
UnShadeStringInBox( ghRepairBox, iCount );
@@ -8660,7 +8979,7 @@ void HandleShadingOfLinesForRepairMenu( void )
if( IsRobotInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) )
{
// handle shading of repair robot option
if( CanCharacterRepairRobot( pSoldier ) )
if( CanCharacterRepairRobot( pSoldier ) && bHasToolkit )
{
// unshade robot line
UnShadeStringInBox( ghRepairBox, iCount );
@@ -8879,7 +9198,7 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
pSoldier->bVehicleUnderRepairID = ( INT8 ) iRepairWhat;
MakeSureToolKitIsInHand( pSoldier );
// MakeSureToolKitIsInHand( pSoldier );
// assign to a movement group
AssignMercToAMovementGroup( pSoldier );
+3
View File
@@ -266,6 +266,9 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts,
// find number of repair pts repairman has available
UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts, BOOLEAN fMakeSureKitIsInHand );
// find number of cleaning pts repairman has available
UINT8 CalculateCleaningPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts );
// Flugente: calculate interrogation and prison guard values
UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts );
UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier );
@@ -5806,7 +5806,7 @@ void HandleSetFilterButtons()
SaveWorldItemsToTempItemFile( sMapX, sMapY, (INT8)sMapZ, uiTotalNumberOfRealItems, pTotalSectorList );
}*/
// @brief modifies data of items including, but not limited to: bDirtLevel, bTemperature (food/weapon overheat)
// @brief modifies data of items including, but not limited to: bTemperature (food/weapon overheat)
// Uses various external parameters set in ini file(s) labeled under [Tactical Weapon Overheating Settings], [Tactical Food Settings], [Strategic Gameplay Settings](advanced repair/dirt system)
// to calculate a delta decay and adds it to the itemStack.data
// It is assumed that the itemStack consists of the same usItem.
@@ -5817,12 +5817,12 @@ void HandleSetFilterButtons()
// @param isUnderground: flag to reduce food decay in underground sectors to 80%, if omitted default = FALSE is used.
// @auth origninal code by flugente
// @auth Moa
void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UINT16 naturalDirt, BOOLEAN isUnderground )
void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOOLEAN isUnderground )
{
INT32 tickspassed = deltaSeconds / NUM_SEC_PER_TACTICAL_TURN;//1 tick is 5 seconds
if ( tickspassed == 0 || !itemStack->exists() ||
!( gGameExternalOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem || gGameOptions.fFoodSystem ) )
!( gGameExternalOptions.fWeaponOverheating || gGameOptions.fFoodSystem ) )
return;
@@ -5872,25 +5872,6 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UI
}
}//end overheating
// ... if it is a weapon or armor and dirt system is active ...
if ( gGameExternalOptions.fDirtSystem && ( (Item[ itemStack->usItem ].usItemClass & IC_WEAPON) || (Item[ itemStack->usItem ].usItemClass & IC_ARMOUR) ) )
{
FLOAT dirtincreasefactor = GetItemDirtIncreaseFactor( itemStack, FALSE ); // ... get dirt increase factor ...
// the current sector determines how much dirt increases
dirtincreasefactor *= (naturalDirt)/100;
dirtincreasefactor /= gGameExternalOptions.usSectorDirtDivider;
if ( dirtincreasefactor > 0.0f ) // ... item can get dirtier ...
{
for( INT16 i = 0; i < itemStack->ubNumberOfObjects; ++i ) // ... there might be multiple items here (item stack), so for each one ...
{
(*itemStack)[i]->data.bDirtLevel = max(0.0f, (*itemStack)[i]->data.bDirtLevel + tickspassed * dirtincreasefactor ); // set new dirt value
}
}
}//end dirt stuff
// ... if it is food and the food system is active ...
if ( gGameOptions.fFoodSystem && Item[ itemStack->usItem ].foodtype > 0 )
{
@@ -5914,7 +5895,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UI
void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, std::vector<WORLDITEM>& pWorldItem, UINT32 size, BOOLEAN fWithMinutes, BOOLEAN fUndo )//dnl ch75 271013
{
// if not using overheating or food system, no point in all this
if ( !gGameExternalOptions.fWeaponOverheating && !gGameExternalOptions.fDirtSystem && !gGameOptions.fFoodSystem )
if ( !gGameExternalOptions.fWeaponOverheating && !gGameOptions.fFoodSystem )
return;
UINT32 tickspassed = 1;
@@ -5942,103 +5923,8 @@ void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, std::v
if ( sMapZ > 0 )
foofdecaymod *= 0.8f;
// get sector-specific dirt threshold
UINT16 sectormod = 0;
UINT8 ubSectorId = SECTOR(sMapX, sMapY);
if ( sMapZ > 0 )
sectormod = 100;
else if ( ubSectorId >= 0 && ubSectorId < 256 )
{
sectormod = SectorExternalData[ubSectorId][sMapZ].usNaturalDirt;
}
for( UINT32 uiCount = 0; uiCount < size; ++uiCount ) // ... for all items in the world ...
{
HandleItemCooldownFunctions( &(pWorldItem[ uiCount ].object), tickspassed * ( fUndo ? -NUM_SEC_PER_TACTICAL_TURN : NUM_SEC_PER_TACTICAL_TURN ), sectormod, (sMapZ > 0) );
//moved to HandleItemCooldownFunctions to reuse those calculations (see SOLDIERTYPE::SoldierInventoryCoolDown())
/*
if( pWorldItem[ uiCount ].fExists ) // ... if item exists ...
{
OBJECTTYPE* pObj = &(pWorldItem[ uiCount ].object); // ... get pointer for this item ...
if ( pObj != NULL && pObj->exists() ) // ... if pointer is not obviously useless ...
{
// ... if we use overheating and item is a gun, a launcher or a barrel ...
if ( gGameExternalOptions.fWeaponOverheating && ( Item[pWorldItem[ uiCount ].object.usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[pWorldItem[ uiCount ].object.usItem].barrel == TRUE ) )
{
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
{
FLOAT guntemperature = (*pObj)[i]->data.bTemperature; // ... get temperature ...
FLOAT cooldownfactor = GetItemCooldownFactor(pObj); // ... get item cooldown factor provided of attachments ...
if ( Item[pWorldItem[ uiCount ].object.usItem].barrel == TRUE ) // ... a barrel lying around cools down a bit faster ...
cooldownfactor *= gGameExternalOptions.iCooldownModificatorLonelyBarrel;
FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor); // ... calculate new temperature ...
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", guntemperature, newguntemperature );
#endif
(*pObj)[i]->data.bTemperature = newguntemperature; // ... set new temperature
// for every objects, we also have to check whether there are weapon attachments (eg. underbarrel weapons), and cool them down too
attachmentList::iterator iterend = (*pObj)[i]->attachments.end();
for (attachmentList::iterator iter = (*pObj)[i]->attachments.begin(); iter != iterend; ++iter)
{
if ( iter->exists() && Item[ iter->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) )
{
FLOAT temperature = (*iter)[i]->data.bTemperature; // ... get temperature of item ...
FLOAT cooldownfactor = GetItemCooldownFactor( &(*iter) ); // ... get cooldown factor ...
FLOAT newtemperature = max(0.0f, temperature - tickspassed * cooldownfactor); // ... calculate new temperature ...
(*iter)[i]->data.bTemperature = newtemperature; // ... set new temperature
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", temperature, newtemperature );
#endif
// we assume that there can exist only 1 underbarrel weapon per gun
break;
}
}
}
}
if ( gGameExternalOptions.fDirtSystem && ( (Item[pObj->usItem].usItemClass & IC_WEAPON) || (Item[pObj->usItem].usItemClass & IC_ARMOUR) ) )
{
FLOAT dirtincreasefactor = GetItemDirtIncreaseFactor(pObj, FALSE); // ... get dirt increase factor ...
// the current sector determines how much dirt increases
dirtincreasefactor *= (sectormod)/100;
dirtincreasefactor /= gGameExternalOptions.usSectorDirtDivider;
if ( dirtincreasefactor > 0.0f ) // ... item can get dirtier ...
{
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
{
(*pObj)[i]->data.bDirtLevel = max(0.0f, min( OVERHEATING_MAX_TEMPERATURE, (*pObj)[i]->data.bDirtLevel + tickspassed * dirtincreasefactor) ); // set new dirt value
}
}
}
if ( gGameOptions.fFoodSystem && Item[pWorldItem[ uiCount ].object.usItem].foodtype > 0 ) // ... if it is food and the food system is active ...
{
if ( Food[Item[pObj->usItem].foodtype].usDecayRate > 0.0f ) // ... if the food can decay...
{
for(INT16 i = 0; i < pObj->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
{
(*pObj)[i]->data.bTemperature = max(0.0f, (*pObj)[i]->data.bTemperature - foofdecaymod * Food[Item[pObj->usItem].foodtype].usDecayRate); // set new temperature
}
}
}
}
}
*/
HandleItemCooldownFunctions( &(pWorldItem[ uiCount ].object), tickspassed * ( fUndo ? -NUM_SEC_PER_TACTICAL_TURN : NUM_SEC_PER_TACTICAL_TURN ), (sMapZ > 0) );
}
}
@@ -87,4 +87,4 @@ BOOLEAN SwitchToInventoryPoolQ(UINT8 newidx);
// if fWithMinutes = true, adjust cooldown for time since sector was last entered
// otherwise its used for a turn-precise cooldown
void HandleSectorCooldownFunctions( INT16 sMapX, INT16 sMapY, INT8 sMapZ, std::vector<WORLDITEM>& pWorldItem, UINT32 size, BOOLEAN fWithMinutes, BOOLEAN fUndo = FALSE);//dnl ch75 271013
void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UINT16 naturalDirt = 100, BOOLEAN isUnderground = FALSE);
void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOOLEAN isUnderground = FALSE);
+5 -1
View File
@@ -2326,7 +2326,11 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
sIconIndex_Assignment = 0;
fDoIcon_Assignment = TRUE;
sPtsAvailable = CalculateRepairPointsForRepairman( MercPtrs[ pFace->ubSoldierID ], &usMaximumPts, FALSE );
// Show repair points if merc has a toolkit in his hand. Otherwise show cleaning points.
if ( Item[pSoldier->inv[HANDPOS].usItem].toolkit )
sPtsAvailable = CalculateRepairPointsForRepairman( MercPtrs[ pFace->ubSoldierID ], &usMaximumPts, FALSE );
else
sPtsAvailable = CalculateCleaningPointsForRepairman( MercPtrs[ pFace->ubSoldierID ], &usMaximumPts );
fShowNumber = TRUE;
fShowMaximum = TRUE;
+5 -46
View File
@@ -157,7 +157,6 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo );
// added by Flugente
void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel );
void CleanWeapons( BOOLEAN fEntireTeam );
void UpdateGear();
void StartCorpseMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel );
@@ -5041,8 +5040,11 @@ void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGr
wcscpy( gzUserDefinedButton[1], TacticalStr[TAKE_OFF_CLOTHES_STR] );
// clean weapons - in realtime of the entire team, in turnbased only for the selected merc
wcscpy( gzUserDefinedButton[2], (gTacticalStatus.uiFlags & INCOMBAT) ? TacticalStr[CLEAN_ONE_GUN_STR] : TacticalStr[CLEAN_ALL_GUNS_STR] );
// wcscpy( gzUserDefinedButton[2], (gTacticalStatus.uiFlags & INCOMBAT) ? TacticalStr[CLEAN_ONE_GUN_STR] : TacticalStr[CLEAN_ALL_GUNS_STR] );
// silversurfer: instant cleaning is not used anymore. Guns are cleaned via repair items assignment.
wcscpy( gzUserDefinedButton[2], TacticalStr[UNUSED_STR] );
// improve gear
wcscpy( gzUserDefinedButton[3], TacticalStr[IMPROVEGEARBUTTON_STR] );
// order militia to drop/pick up gear
@@ -5068,46 +5070,6 @@ void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGr
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ FUNCTION_SELECTION_STR ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS, TacticalFunctionSelectionMessageBoxCallBack, NULL, MSG_BOX_DEFAULT_BUTTON_1 );
}
void CleanWeapons( BOOLEAN fEntireTeam )
{
if ( !gGameExternalOptions.fDirtSystem )
return;
// no functionality if not in tactical or in combat, or nobody is here
if ( (guiCurrentScreen != GAME_SCREEN && guiCurrentScreen != MSG_BOX_SCREEN) )
return;
// if in combat, always only for selected merc
if ( !fEntireTeam )
{
if ( gusSelectedSoldier == NOBODY )
return;
SOLDIERTYPE* pSoldier = MercPtrs[ gusSelectedSoldier ];
if ( pSoldier->bActive )
pSoldier->CleanWeapon(FALSE);
}
else // perform action for every merc in this sector
{
UINT16 bMercID, bLastTeamID;
SOLDIERTYPE* pSoldier = NULL;
bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
// loop through all mercs
for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID, ++pSoldier )
{
//if the merc is in this sector
if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bInSector && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) )
{
pSoldier->CleanWeapon(TRUE);
}
}
}
}
// Flugente: on a key press, we loop over each team members' inventory and exchange it with world items that have a higher status
// however, we ignore items that have inseparable attachments
// the goal is to simulate the player manually changing items, as that is rather tedious
@@ -5261,7 +5223,6 @@ void UpdateGear()
UINT32 ubWireNetworkFlag = (*pObj)[i]->data.ubWireNetworkFlag;
INT8 bDefuseFrequency = (*pObj)[i]->data.bDefuseFrequency;
INT16 sRepairThreshold = (*pObj)[i]->data.sRepairThreshold;
FLOAT bDirtLevel = (*pObj)[i]->data.bDirtLevel;
UINT64 sObjectFlag = (*pObj)[i]->data.sObjectFlag;
// set data on our object
@@ -5274,7 +5235,6 @@ void UpdateGear()
(*pObj)[i]->data.ubWireNetworkFlag = (*pObj_Better)[index]->data.ubWireNetworkFlag;
(*pObj)[i]->data.bDefuseFrequency = (*pObj_Better)[index]->data.bDefuseFrequency;
(*pObj)[i]->data.sRepairThreshold = (*pObj_Better)[index]->data.sRepairThreshold;
(*pObj)[i]->data.bDirtLevel = (*pObj_Better)[index]->data.bDirtLevel;
(*pObj)[i]->data.sObjectFlag = (*pObj_Better)[index]->data.sObjectFlag;
// set data on world object
@@ -5287,7 +5247,6 @@ void UpdateGear()
(*pObj_Better)[index]->data.ubWireNetworkFlag = ubWireNetworkFlag;
(*pObj_Better)[index]->data.bDefuseFrequency = bDefuseFrequency;
(*pObj_Better)[index]->data.sRepairThreshold = sRepairThreshold;
(*pObj_Better)[index]->data.bDirtLevel = bDirtLevel;
(*pObj_Better)[index]->data.sObjectFlag = sObjectFlag;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[IMPROVEGEARDESCRIBE_STR], pSoldier->GetName( ), Item[pObj->usItem].szItemName );
@@ -5511,7 +5470,7 @@ void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue )
break;
case 3:
// clean weapons - in realtime of the entire team, in turnbased only for the selected merc
CleanWeapons( !(gTacticalStatus.uiFlags & INCOMBAT) );
//CleanWeapons( !(gTacticalStatus.uiFlags & INCOMBAT) );
break;
case 4:
UpdateGear();
+13 -21
View File
@@ -1945,12 +1945,9 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}
}
if ( gGameExternalOptions.fDirtSystem ) // Flugente
{
//////////////////// DIRT MODIFICATOR
{
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 5 ] );
}
//////////////////// DIRT MODIFICATOR
{
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 5 ] );
}
}
}
@@ -4035,9 +4032,8 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}
}
if ( gGameExternalOptions.fDirtSystem )
///////////////////// DIRT MODIFICATOR
{
///////////////////// DIRT MODIFICATOR
if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) )
{
if (!fDrawGenIndexes) fDrawGenIndexes = ++cnt; // new index line here?
@@ -4611,6 +4607,7 @@ void DrawAmmoStats( OBJECTTYPE * gpItemDescObject )
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoAmmoIcon, 1, gItemDescGenRegions[1][0].sLeft+sOffsetX, gItemDescGenRegions[1][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
}
//////////////// PRE-ARMOR EXPLOSION
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoAmmoIcon, 2, gItemDescGenRegions[2][0].sLeft+sOffsetX, gItemDescGenRegions[2][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
@@ -4625,12 +4622,9 @@ void DrawAmmoStats( OBJECTTYPE * gpItemDescObject )
}
}
if ( gGameExternalOptions.fDirtSystem ) // Flugente
//////////////// DIRT MODIFICATOR
{
//////////////// DIRT MODIFICATOR
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoAmmoIcon, 17, gItemDescGenRegions[5][0].sLeft+sOffsetX, gItemDescGenRegions[5][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
}
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoAmmoIcon, 17, gItemDescGenRegions[5][0].sLeft+sOffsetX, gItemDescGenRegions[5][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
}
DrawSecondaryStats( gpItemDescObject );
@@ -5617,7 +5611,7 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject )
// Flugente
// new line is necessary (Moa: only if needed)
INT16 fDrawGenIndexes = FALSE;
if ( gGameExternalOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem )
if ( gGameExternalOptions.fWeaponOverheating )
{
if( ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[gpItemDescObject->usItem].barrel == TRUE || ( Item[gpItemDescObject->usItem].overheatTemperatureModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatCooldownModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatJamThresholdModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatDamageThresholdModificator != 0.0 ) ) ||
( fComparisonMode && ( Item[gpComparedItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[gpComparedItemDescObject->usItem].barrel == TRUE || ( Item[gpComparedItemDescObject->usItem].overheatTemperatureModificator != 0.0 ) || ( Item[gpComparedItemDescObject->usItem].overheatCooldownModificator != 0.0 ) || ( Item[gpComparedItemDescObject->usItem].overheatJamThresholdModificator != 0.0 ) || ( Item[gpComparedItemDescObject->usItem].overheatDamageThresholdModificator != 0.0 ) ) ) )
@@ -5721,12 +5715,11 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject )
}
}
if ( gGameExternalOptions.fDirtSystem )
///////////////////// DIRT MODIFICATOR
{
if ( ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) ||
( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) )
{
///////////////////// DIRT MODIFICATOR
if (cnt >= sFirstLine && cnt < sLastLine)
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoAdvancedIcon, 55, gItemDescAdvRegions[cnt-sFirstLine][0].sLeft + sOffsetX, gItemDescAdvRegions[cnt-sFirstLine][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
@@ -8979,9 +8972,8 @@ void DrawAmmoValues( OBJECTTYPE * gpItemDescObject, int shotsLeft )
}
}
if ( gGameExternalOptions.fDirtSystem ) // Flugente
///////////////////// DIRT MODIFICATOR
{
///////////////////// DIRT MODIFICATOR
// Set line to draw into
ubNumLine = 5;
// Set Y coordinates
@@ -13769,13 +13761,12 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
}
}
if ( gGameExternalOptions.fDirtSystem )
///////////////////// DIRT MODIFICATOR
{
if ( ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) ||
( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) )
{
if (!fDrawGenIndexes) fDrawGenIndexes = ++cnt; //insert Indexes here?
///////////////////// DIRT MODIFICATOR
if (cnt >= sFirstLine && cnt < sLastLine)
{
// Set Y coordinates
@@ -13808,10 +13799,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject )
if ( cnt2 == 1 || fComparisonMode)
SetFontForeground( ITEMDESC_FONTNEGATIVE );
if ( !fComparisonMode )
if ( !fComparisonMode && cnt2 != 1 )
swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] );
else
swprintf( pStr, L"+%4.2f", iFloatModifier[cnt2] );
FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY);
#ifdef CHINESE
wcscat( pStr, ChineseSpecString1 );
+2 -117
View File
@@ -12078,9 +12078,6 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
{
if ( gGameExternalOptions.fAdvRepairSystem )
sThreshold = (*pObject)[subObject]->data.sRepairThreshold;
if ( gGameExternalOptions.fDirtSystem )
bDirt = 100 * (*pObject)[subObject]->data.bDirtLevel / OVERHEATING_MAX_TEMPERATURE;
}
switch( Item[ usItem ].usItemClass )
@@ -12155,36 +12152,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
INT8 accuracy = (UsingNewCTHSystem()==true?Weapon[ usItem ].nAccuracy:Weapon[ usItem ].bAccuracy);
accuracy = (INT8)(accuracy * accuracyheatmultiplicator);
if ( gGameExternalOptions.fAdvRepairSystem && gGameExternalOptions.fDirtSystem && ( sThreshold < 100 || bDirt > 0 ) )
{
#ifdef CHINESE
swprintf( pStr, ChineseSpecString8,
#else
swprintf( pStr, L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%",
#endif
ItemNames[ usItem ],
AmmoCaliber[ Weapon[ usItem ].ubCalibre ],
sValue,
sThreshold,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString(), //Weight units
gWeaponStatsDesc[ 18 ], //Dirt String
bDirt //Dirt
);
}
else if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
{
#ifdef CHINESE
swprintf( pStr, ChineseSpecString11,
@@ -12211,34 +12179,6 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
GetWeightUnitString() //Weight units
);
}
else if ( gGameExternalOptions.fDirtSystem && bDirt > 0 )
{
#ifdef CHINESE
swprintf( pStr, ChineseSpecString12,
#else
swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%",
#endif
ItemNames[ usItem ],
AmmoCaliber[ Weapon[ usItem ].ubCalibre ],
sValue,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString(), //Weight units
gWeaponStatsDesc[ 18 ], //Dirt String
bDirt //Dirt
);
}
else
{
#ifdef CHINESE
@@ -12311,35 +12251,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
INT8 accuracy = (UsingNewCTHSystem()==true?Weapon[ usItem ].nAccuracy:Weapon[ usItem ].bAccuracy);
accuracy = (INT8)(accuracy * accuracyheatmultiplicator);
if ( gGameExternalOptions.fAdvRepairSystem && gGameExternalOptions.fDirtSystem && ( sThreshold < 100 || bDirt > 0 ) )
{
#ifdef CHINESE
swprintf( pStr, L"%s [%d%£¥(%d%£¥)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n %s %.2f%%",
#else
swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%",
#endif
ItemNames[ usItem ],
sValue,
sThreshold,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString(), //Weight units
gWeaponStatsDesc[ 18 ], //Dirt String
bDirt //Dirt
);
}
else if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
{
#ifdef CHINESE
swprintf( pStr, L"%s [%d%£¥(%d%£¥)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
@@ -12365,33 +12277,6 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
GetWeightUnitString() //Weight units
);
}
else if ( gGameExternalOptions.fDirtSystem && bDirt > 0 )
{
#ifdef CHINESE
swprintf( pStr, L"%s [%d%£¥]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n %s %.2f%%",
#else
swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%",
#endif
ItemNames[ usItem ],
sValue,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString(), //Weight units
gWeaponStatsDesc[ 18 ], //Dirt String
bDirt //Dirt
);
}
else
{
#ifdef CHINESE
-4
View File
@@ -1049,7 +1049,6 @@ ObjectData::ObjectData(const ObjectData& src)
this->ubWireNetworkFlag = src.ubWireNetworkFlag;
this->bDefuseFrequency = src.bDefuseFrequency;
this->sRepairThreshold = src.sRepairThreshold;
this->bDirtLevel = src.bDirtLevel;
this->sObjectFlag = src.sObjectFlag;
//copy over the union
@@ -1076,7 +1075,6 @@ ObjectData& ObjectData::operator =(const ObjectData& src)
this->ubWireNetworkFlag = src.ubWireNetworkFlag;
this->bDefuseFrequency = src.bDefuseFrequency;
this->sRepairThreshold = src.sRepairThreshold;
this->bDirtLevel = src.bDirtLevel;
this->sObjectFlag = src.sObjectFlag;
//copy over the union
@@ -1640,7 +1638,6 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src)
}
(*this)[0]->data.sRepairThreshold = 100;
(*this)[0]->data.bDirtLevel = 0.0f;
(*this)[0]->data.sObjectFlag = 0;
//it's unlikely max will get less over the versions, but still, check the min
@@ -1675,7 +1672,6 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src)
}
(*this)[x]->data.sRepairThreshold = 100;
(*this)[x]->data.bDirtLevel = 0.0f;
(*this)[x]->data.sObjectFlag = 0;
}
}
+3 -3
View File
@@ -225,7 +225,6 @@ typedef enum
// Flugente: define for maximum temperature
#define OVERHEATING_MAX_TEMPERATURE 60000.0f
#define DIRT_MIN_TO_CLEAN 10.0f // minimum dirt until we consider cleaning (as weapons constantly get dirtier, this prevents a gun from being constantly cleaned)
//forward declaration
class OBJECTTYPE;
@@ -483,9 +482,10 @@ public:
UINT32 ubWireNetworkFlag; // flags for the tripwire network
INT8 bDefuseFrequency; // frequency for defusing, >=0 values used only
// Flugente: advanced repair/dirt system
// Flugente: advanced repair system
INT16 sRepairThreshold; // repair only possible up to this value
FLOAT bDirtLevel; // counter for how dirty a gun is
FLOAT bFiller; // unused for now
UINT64 sObjectFlag; // used to notify of various states that apply to this object, but not the item in general
};
-6
View File
@@ -1277,10 +1277,6 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness )
return FALSE;
}
// silversurfer: we don't need cleaning kits if the dirt system is off
if ( !gGameExternalOptions.fDirtSystem && HasItemFlag(usItemIndex, CLEANING_KIT) )
return FALSE;
//if the user has selected the reduced gun list
if( !gGameOptions.fGunNut )
{
@@ -7962,7 +7958,6 @@ BOOLEAN CreateGun( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
pStackedObject->data.bTemperature = 0.0f;
pStackedObject->data.sRepairThreshold = (200 + bStatus)/3; // arbitrary threshold
pStackedObject->data.bDirtLevel = 0.0f;
pStackedObject->data.sObjectFlag = 0;
if (Weapon[ usItem ].ubWeaponClass == MONSTERCLASS)
@@ -8117,7 +8112,6 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
else
(*pObj)[0]->data.sRepairThreshold = 100;
(*pObj)[0]->data.bDirtLevel = 0.0f;
}
if (fRet)
{
-2
View File
@@ -3159,7 +3159,6 @@ BOOLEAN RepairIsDone(DEALER_SPECIAL_ITEM* pSpecial)
// Flugente: shopkeepers will also restore an item's repair threshold
RepairItem.ItemObject[0]->data.sRepairThreshold = 100;
RepairItem.ItemObject[0]->data.bDirtLevel = 0.0f;
}
// max condition of all permanent attachments on it
@@ -3171,7 +3170,6 @@ BOOLEAN RepairIsDone(DEALER_SPECIAL_ITEM* pSpecial)
// Flugente: shopkeepers will also restore an item's repair threshold and clean it
(*iter)[0]->data.sRepairThreshold = 100;
(*iter)[0]->data.bDirtLevel = 0.0f;
}
}
+2 -176
View File
@@ -14139,7 +14139,7 @@ BOOLEAN SOLDIERTYPE::SoldierCarriesTwoHandedWeapon( void )
return(FALSE);
}
extern void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, UINT16 naturalDirt = 100, BOOLEAN isUnderground = TRUE );
extern void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOOLEAN isUnderground = TRUE );
// Flugente: Cool down/decay all items in inventory
void SOLDIERTYPE::SoldierInventoryCoolDown( void )
{
@@ -14195,10 +14195,9 @@ void SOLDIERTYPE::SoldierInventoryCoolDown( void )
// handle flashlight. This is necessary in this location, as we need to do this at least once per turn
this->HandleFlashLights( );
if ( !gGameExternalOptions.fWeaponOverheating && !gGameExternalOptions.fDirtSystem && !gGameOptions.fFoodSystem )
if ( !gGameExternalOptions.fWeaponOverheating && !gGameOptions.fFoodSystem )
return;
#if TRUE //start reusing existing code from HandleItemCooldownFunctions, set to FALSE if original code should be used
INT8 numStacks = (INT8)this->inv.size( ); // remember inventorysize, so we don't call size() repeatedly
extern UINT32 guiLastTacticalRealTime, guiLastStrategicTime;
UINT32 secondsPassed = 5;//GetJA2Clock() > guiLastTacticalRealTime? (GetJA2Clock() - guiLastTacticalRealTime)/1000 : 0;
@@ -14206,110 +14205,6 @@ void SOLDIERTYPE::SoldierInventoryCoolDown( void )
{
HandleItemCooldownFunctions( &(this->inv[bLoop]), secondsPassed );
}
#else //start using original redundant code
// one hour has 60 minutes, with 12 5-second-intervals (cooldown values are based on 5-second values)
FLOAT fooddecaymod = gGameExternalOptions.sFoodDecayModificator;
// food decays slower if underground
if ( gbWorldSectorZ > 0 )
fooddecaymod *= 0.8f;
// get sector-specific dirt threshold
UINT16 sectormod = 0;
UINT8 ubSectorId = SECTOR( gWorldSectorX, gWorldSectorY );
if ( gbWorldSectorZ > 0 )
sectormod = 100;
else if ( ubSectorId >= 0 && ubSectorId < 256 )
{
sectormod = SectorExternalData[ubSectorId][gbWorldSectorZ].usNaturalDirt;
}
INT8 invsize = (INT8)this->inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ...
{
if ( this->inv[bLoop].exists( ) )
{
OBJECTTYPE * pObj = &(this->inv[bLoop]); // ... get pointer for this item ...
if ( pObj != NULL ) // ... if pointer is not obviously useless ...
{
// ... if Item exists and is a gun, a launcher or a barrel ...
if ( gGameExternalOptions.fWeaponOverheating && (Item[pObj->usItem].usItemClass & (IC_GUN | IC_LAUNCHER) || Item[pObj->usItem].barrel == TRUE) )
{
for ( INT16 i = 0; i < pObj->ubNumberOfObjects; ++i ) // ... there might be multiple items here (item stack), so for each one ...
{
FLOAT temperature = (*pObj)[i]->data.bTemperature; // ... get temperature of item ...
FLOAT cooldownfactor = GetItemCooldownFactor( pObj ); // ... get cooldown factor ...
FLOAT newtemperature = max( 0.0f, temperature - cooldownfactor ); // ... calculate new temperature ...
(*pObj)[i]->data.bTemperature = newtemperature; // ... set new temperature
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Item temperature lowered from %4.2f to %4.2f", temperature, newtemperature );
#endif
// for every objects, we also have to check wether there are weapon attachments (eg. underbarrel grenade launchers), and cool them down too
attachmentList::iterator iterend = (*pObj)[i]->attachments.end( );
for ( attachmentList::iterator iter = (*pObj)[i]->attachments.begin( ); iter != iterend; ++iter )
{
if ( iter->exists( ) && Item[iter->usItem].usItemClass & (IC_GUN | IC_LAUNCHER) )
{
FLOAT temperature = (*iter)[i]->data.bTemperature; // ... get temperature of item ...
FLOAT cooldownfactor = GetItemCooldownFactor( &(*iter) ); // ... get cooldown factor ...
FLOAT newtemperature = max( 0.0f, temperature - cooldownfactor ); // ... calculate new temperature ...
(*iter)[i]->data.bTemperature = newtemperature; // ... set new temperature
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Item temperature lowered from %4.2f to %4.2f", temperature, newtemperature );
#endif
// we assume that there can exist only 1 UGL per weapon
break;
}
}
}
}
if ( gGameExternalOptions.fDirtSystem && ((Item[pObj->usItem].usItemClass & IC_WEAPON) || (Item[pObj->usItem].usItemClass & IC_ARMOUR)) )
{
FLOAT dirtincreasefactor = GetItemDirtIncreaseFactor( pObj, FALSE ); // ... get dirt increase factor ...
// the current sector determines how much dirt increases
dirtincreasefactor *= (sectormod) / 100;
dirtincreasefactor /= gGameExternalOptions.usSectorDirtDivider;
// items in pockets are a bit protected from dirt
if ( bLoop > KNIFEPOCKPOS )
dirtincreasefactor /= 3.0f;
if ( dirtincreasefactor > 0.0f ) // ... item can get dirtier ...
{
for ( INT16 i = 0; i < pObj->ubNumberOfObjects; ++i ) // ... there might be multiple items here (item stack), so for each one ...
{
(*pObj)[i]->data.bDirtLevel = max( 0.0f, min( OVERHEATING_MAX_TEMPERATURE, (*pObj)[i]->data.bDirtLevel + dirtincreasefactor ) ); // set new temperature
}
}
}
if ( gGameOptions.fFoodSystem && Item[pObj->usItem].foodtype > 0 )
{
if ( Food[Item[pObj->usItem].foodtype].usDecayRate > 0.0f ) // ... if the food can decay...
{
for ( INT16 i = 0; i < pObj->ubNumberOfObjects; ++i ) // ... there might be multiple items here (item stack), so for each one ...
{
(*pObj)[i]->data.bTemperature = max( 0.0f, (*pObj)[i]->data.bTemperature - fooddecaymod * Food[Item[pObj->usItem].foodtype].usDecayRate ); // set new temperature
}
}
}
}
}
}
#endif //end using original code
}
// Flugente: determine if we can rest our weapon on something. This can only happen when STANDING/CROUCHED. As a result, we get superior handling modifiers (we apply the PRONE modfiers)
@@ -15017,75 +14912,6 @@ OBJECTTYPE* SOLDIERTYPE::GetObjectWithFlag( UINT32 aFlag )
return(pObj);
}
// use cleaning kits to clean weapons in inventory. fCleanAll = TRUE: clean all weapons found, otherwise just the first one
void SOLDIERTYPE::CleanWeapon( BOOLEAN fCleanAll )
{
// in turnbased, this action costs APs. remove them if possible, otherwise, return
INT16 apcost = APBPConstants[AP_CLEANINGKIT];
if ( gTacticalStatus.uiFlags & TURNBASED )
{
if ( !EnoughPoints( this, apcost, 0, TRUE ) )
return;
}
OBJECTTYPE* pCleaningKit = GetObjectWithFlag( CLEANING_KIT );
if ( pCleaningKit )
{
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ...
{
if ( inv[bLoop].exists( ) && (Item[inv[bLoop].usItem].usItemClass & IC_WEAPON) )
{
OBJECTTYPE* pObj = &(inv[bLoop]); // ... get pointer for this item ...
if ( pObj != NULL ) // ... if pointer is not obviously useless ...
{
for ( INT16 i = 0; i < pObj->ubNumberOfObjects; ++i ) // ... there might be multiple items here (item stack), so for each one ...
{
if ( (*pObj)[i]->data.bDirtLevel > DIRT_MIN_TO_CLEAN ) // ... if weapon is at least a bit dirty ...
{
// have to recheck for a cleaning kit, as we might have used it up if cleaning a stack of weapons
pCleaningKit = GetObjectWithFlag( CLEANING_KIT );
if ( pCleaningKit )
{
if ( (*pObj)[i]->data.bDirtLevel > 0 )
{
(*pObj)[i]->data.bDirtLevel = 0.0f;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[WEAPON_CLEANING_STR], this->GetName( ), Item[pObj->usItem].szItemName );
// always use up 1% of the cleaning kit (they last too long otherwise)
UseKitPoints( pCleaningKit, 1, this );
if ( gTacticalStatus.uiFlags & TURNBASED )
{
// use up APs
DeductPoints( this, apcost, 0, AFTERACTION_INTERRUPT );
// if fCleanAll is false, only clean first weapon
if ( !fCleanAll )
return;
// get out of here if we dont have enough APs for another cleaning operation
if ( !EnoughPoints( this, apcost, 0, TRUE ) )
return;
}
}
}
else
return;
}
}
}
}
}
}
}
extern INT16 uiNIVSlotType[NUM_INV_SLOTS];
// do we look like a civilian?
-3
View File
@@ -1767,9 +1767,6 @@ public:
// Flugente: return first found object with a specific flag from our inventory
OBJECTTYPE* GetObjectWithFlag( UINT32 aFlag );
// use cleaning kits to clean weapons in inventory. fCleanAll = TRUE: clean all weapons found, otherwise just the first one
void CleanWeapon( BOOLEAN fCleanAll );
// Flugente: functions for the covert ops trait
// do we look like a civilian?
+104 -84
View File
@@ -1284,7 +1284,7 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
if ((*pObj)[0]->data.gun.bGunAmmoStatus > 0)
{
// Algorithm for jamming
int maxJamChance = 50; // Externalize this?
int maxJamChance = 50; // Externalize this?
int reliability = GetReliability( pObj );
int condition = (*pObj)[0]->data.gun.bGunStatus;
@@ -1306,16 +1306,6 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
invertedBaseJamChance -= overheatjamfactor; // lower invertedBaseJamChance (thereby increasing jamChance later on)
}
// Flugente: dirt can also influence a gun's jamming behaviour
if ( gGameExternalOptions.fDirtSystem )
{
FLOAT dirtpercentage = (*pObj)[0]->data.bDirtLevel / OVERHEATING_MAX_TEMPERATURE;
int dirtjamfactor = (int)(100 * dirtpercentage*dirtpercentage);
invertedBaseJamChance -= dirtjamfactor;
}
if (invertedBaseJamChance < 0)
invertedBaseJamChance = 0;
else if (invertedBaseJamChance > 100)
@@ -1330,37 +1320,6 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
else if (jamChance > maxJamChance - reliability)
jamChance = maxJamChance - reliability;
/* Old jam code
// gun might jam, figure out the chance
//iChance = (80 - pObj->bGunStatus);
//rain
iChance = (80 - pObj->ItemData.Gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity;
//end rain
// CJC: removed reliability from formula...
// jams can happen to unreliable guns "earlier" than normal or reliable ones.
//iChance = iChance - Item[pObj->usItem].bReliability * 2;
// decrease the chance of a jam by 20% per point of reliability;
// increased by 20% per negative point...
//iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10;
//rain
// iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10; // Madd: took it back out
//end rain
if (pSoldier->bDoBurst > 1)
{
// if at bullet in a burst after the first, higher chance
iChance -= PreRandom( 80 );
}
else
{
iChance -= PreRandom( 100 );
}
*/
#ifdef TESTGUNJAM
if ( 1 )
#else
@@ -1373,7 +1332,19 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
(*pObj)[0]->data.gun.bGunAmmoStatus *= -1;
// Deduct AMMO!
DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
// silversurfer: Our gun can now take damage when it jams
if ( PreRandom( 100 ) < (90 - condition + (Item[(*pObj).usItem].usDamageChance / 2.0f)) )
{
// damage depends on gun status. The better the status the less damage it takes. Limit it to max 5 or it can be frustrating for the player.
UINT32 uiJamDamage = __min( 5, PreRandom( __max( 0, (UINT32)((90 - condition) / 2.0f ) ) ));
if ( uiJamDamage > 0 )
{
(*pObj)[0]->data.objectStatus -= __min( uiJamDamage, (*pObj)[0]->data.objectStatus );
(*pObj)[0]->data.sRepairThreshold -= __min( uiJamDamage, (*pObj)[0]->data.sRepairThreshold );
}
}
TacticalCharacterDialogue( pSoldier, QUOTE_JAMMED_GUN );
return( TRUE );
@@ -2365,28 +2336,65 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
// ammoReliability = Item[(*pGun)[0]->data.gun.usGunAmmoItem].bReliability;
//}
// silversurfer: Gun status now represents dirt. Shots can increase dirt level.
// Some guns are more susceptible to dirt than others.
FLOAT dirtincreasefactor = GetItemDirtIncreaseFactor( pObjAttHand, TRUE ); // ... get dirt increase factor ...
// get sector-specific dirt threshold
UINT16 sectormod = 0;
UINT8 ubSectorId = SECTOR(gWorldSectorX, gWorldSectorY);
if ( gbWorldSectorZ > 0 )
sectormod = 100;
else if ( ubSectorId >= 0 && ubSectorId < 256 )
{
sectormod = SectorExternalData[ubSectorId][gbWorldSectorZ].usNaturalDirt;
}
// the current sector determines how likely it is that dirt increases
dirtincreasefactor = __max( 1.0f, (dirtincreasefactor * (FLOAT)sectormod / 5000.0f) );
// weather also plays a role. A sand storm doesn't help keep our guns clean.
switch ( SectorInfo[SECTOR( pSoldier->sSectorX, pSoldier->sSectorY )].usWeather )
{
case WEATHER_FORECAST_NORMAL:
break;
case WEATHER_FORECAST_RAIN:
break;
case WEATHER_FORECAST_THUNDERSHOWERS:
dirtincreasefactor *= 1.2f;
break;
case WEATHER_FORECAST_SNOW:
dirtincreasefactor *= 1.1f;
break;
case WEATHER_FORECAST_SANDSTORM:
dirtincreasefactor *= 2.0f;
break;
default:
break;
}
// Flugente: Added a malus to reliability for overheated guns
// HEADROCK HAM 5: Variable NCTH base change
if ( UsingNewCTHSystem() == true)
{
UINT16 usBaseChance = gGameCTHConstants.BASIC_RELIABILITY_ODDS;
FLOAT dReliabilityRatio = 3.0f * ((FLOAT)usBaseChance / (FLOAT)gItemSettings.usBasicDeprecateChance); // Compare original odds to new odds.
uiDepreciateTest = usBaseChance + (INT16)( dReliabilityRatio * GetReliability( &(pSoldier->inv[pSoldier->ubAttackingHand]) ) - iOverheatReliabilityMalus);
uiDepreciateTest = (UINT32)((usBaseChance + (INT16)( dReliabilityRatio * GetReliability( &(pSoldier->inv[pSoldier->ubAttackingHand]) ) - iOverheatReliabilityMalus)) / dirtincreasefactor);
uiDepreciateTest = max(0, uiDepreciateTest);
}
else
{
uiDepreciateTest = max( gItemSettings.usBasicDeprecateChance + 3 * GetReliability( pObjAttHand ) - iOverheatReliabilityMalus, 0 );
uiDepreciateTest = max( (UINT32)((gItemSettings.usBasicDeprecateChance + 3 * GetReliability( pObjAttHand ) - iOverheatReliabilityMalus) / dirtincreasefactor), 0 );
}
if ( !PreRandom( uiDepreciateTest ) && ( (*pObjAttHand)[0]->data.objectStatus > 1) )
{
(*pObjAttHand)[0]->data.objectStatus--;
// Flugente: reduce repair threshold
if ( Random(100) < Item[pObjAttHand->usItem].usDamageChance )
{
(*pObjAttHand)[0]->data.sRepairThreshold--;
}
}
// reduce monster smell (gunpowder smell)
@@ -3027,28 +3035,64 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo )
}
*/
// silversurfer: Gun status now represents dirt. Shots can increase dirt level.
// Some guns are more susceptible to dirt than others.
FLOAT dirtincreasefactor = GetItemDirtIncreaseFactor( pObjUsed, TRUE ); // ... get dirt increase factor ...
// get sector-specific dirt threshold
UINT16 sectormod = 0;
UINT8 ubSectorId = SECTOR(gWorldSectorX, gWorldSectorY);
if ( gbWorldSectorZ > 0 )
sectormod = 100;
else if ( ubSectorId >= 0 && ubSectorId < 256 )
{
sectormod = SectorExternalData[ubSectorId][gbWorldSectorZ].usNaturalDirt;
}
// the current sector determines how likely it is that dirt increases
dirtincreasefactor = __max( 1.0f, (dirtincreasefactor * (FLOAT)sectormod / 5000.0f) );
// weather also plays a role. A sand storm doesn't help keep our guns clean.
switch ( SectorInfo[SECTOR( pSoldier->sSectorX, pSoldier->sSectorY )].usWeather )
{
case WEATHER_FORECAST_NORMAL:
break;
case WEATHER_FORECAST_RAIN:
break;
case WEATHER_FORECAST_THUNDERSHOWERS:
dirtincreasefactor *= 1.2f;
break;
case WEATHER_FORECAST_SNOW:
dirtincreasefactor *= 1.1f;
break;
case WEATHER_FORECAST_SANDSTORM:
dirtincreasefactor *= 2.0f;
break;
default:
break;
}
// Flugente: Added a malus to reliability for overheated guns
if ( UsingNewCTHSystem() == true )
{
UINT16 usBaseChance = gGameCTHConstants.BASIC_RELIABILITY_ODDS;
FLOAT dReliabilityRatio = 3.0f * ((FLOAT)usBaseChance / (FLOAT)gItemSettings.usBasicDeprecateChance); // Compare original odds to new odds.
uiDepreciateTest = usBaseChance + (INT16)( dReliabilityRatio * GetReliability( &(pSoldier->inv[ pSoldier->ubAttackingHand ])) - iOverheatReliabilityMalus);
uiDepreciateTest = (UINT32)(usBaseChance + (INT16)( dReliabilityRatio * GetReliability( &(pSoldier->inv[ pSoldier->ubAttackingHand ])) - iOverheatReliabilityMalus) / dirtincreasefactor);
uiDepreciateTest = max(0, uiDepreciateTest);
}
else
{
uiDepreciateTest = max( gItemSettings.usBasicDeprecateChance + 3 * (GetReliability( pObjUsed )) - iOverheatReliabilityMalus, 0 );
uiDepreciateTest = max( (UINT32)((gItemSettings.usBasicDeprecateChance + 3 * (GetReliability( pObjUsed )) - iOverheatReliabilityMalus) / dirtincreasefactor), 0 );
}
if ( !PreRandom( uiDepreciateTest ) && ( (*pObjUsed)[0]->data.objectStatus > 1) )
{
(*pObjUsed)[0]->data.objectStatus--;
// Flugente: reduce repair threshold
if ( Random(100) < Item[pObjUsed->usItem].usDamageChance )
{
(*pObjUsed)[0]->data.sRepairThreshold--;
}
}
// reduce monster smell (gunpowder smell)
@@ -11347,7 +11391,7 @@ void CalcMagFactorSimple( SOLDIERTYPE *pSoldier, FLOAT d2DDistance, INT16 bAimTi
}
// Flugente: Increase temperature/dirt of gun in ubAttackingHand due to firing a shot
// Flugente: Increase temperature of gun in ubAttackingHand due to firing a shot
void GunIncreaseHeat( OBJECTTYPE *pObj, SOLDIERTYPE* pSoldier )
{
if ( gGameExternalOptions.fWeaponOverheating )
@@ -11363,30 +11407,6 @@ void GunIncreaseHeat( OBJECTTYPE *pObj, SOLDIERTYPE* pSoldier )
(*pObj)[0]->data.bTemperature = newguntemperature; // ... apply new temperature
}
}
// firing a gun also increases dirt
if ( gGameExternalOptions.fDirtSystem )
{
FLOAT dirtincreasefactor = GetItemDirtIncreaseFactor(pObj, TRUE); // ... get dirt increase factor ...
// get sector-specific dirt threshold
UINT16 sectormod = 0;
UINT8 ubSectorId = SECTOR(gWorldSectorX, gWorldSectorY);
if ( gbWorldSectorZ > 0 )
sectormod = 100;
else if ( ubSectorId >= 0 && ubSectorId < 256 )
{
sectormod = SectorExternalData[ubSectorId][gbWorldSectorZ].usNaturalDirt;
}
// the current sector determines how much dirt increases
dirtincreasefactor *= (sectormod)/100;
if ( dirtincreasefactor > 0.0f ) // ... item can get dirtier ...
{
(*pObj)[0]->data.bDirtLevel = min((*pObj)[0]->data.bDirtLevel + dirtincreasefactor, OVERHEATING_MAX_TEMPERATURE ); // dirt and overheating use the same threshold
}
}
}
// Flugente: Overheating Weapons
+1 -1
View File
@@ -165,7 +165,7 @@ loadscreenhintsEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "overheat") == 0)
{
pData->curElement = ELEMENT;
pData->curLoadScreenHint.usFlags |= (UINT8) atol(pData->szCharData) ? LOADSCREEN_OVERHEAT_DIRT : 0;
pData->curLoadScreenHint.usFlags |= (UINT8) atol(pData->szCharData) ? LOADSCREEN_OVERHEAT : 0;
}
else if(strcmp(name, "ncth") == 0)
{
+1 -1
View File
@@ -291,7 +291,7 @@ void SetNewLoadScreenHint()
fShow = TRUE;
else if ( zLoadScreenHint[cnt].usFlags & LOADSCREEN_ZOMBIE && gGameSettings.fOptions[TOPTION_ZOMBIES] )
fShow = TRUE;
else if ( zLoadScreenHint[cnt].usFlags & LOADSCREEN_OVERHEAT_DIRT && (gGameExternalOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem) )
else if ( zLoadScreenHint[cnt].usFlags & LOADSCREEN_OVERHEAT && gGameExternalOptions.fWeaponOverheating )
fShow = TRUE;
else if ( zLoadScreenHint[cnt].usFlags & LOADSCREEN_NCTH && UsingNewCTHSystem() )
fShow = TRUE;
+1 -1
View File
@@ -61,7 +61,7 @@ void ShowLoadScreenHintInTacticalLog();
#define LOADSCREEN_FOOD 0x00000010 //16 // food tips
#define LOADSCREEN_ZOMBIE 0x00000020 //32 // zombie tips
#define LOADSCREEN_OVERHEAT_DIRT 0x00000040 //64 // tips on overheating & dirt
#define LOADSCREEN_OVERHEAT 0x00000040 //64 // tips on overheating
#define LOADSCREEN_NCTH 0x00000080 //128 // tips on using NCTH
#define LOADSCREEN_COVERTOPS 0x00000100 //256 // tips on using the covert ops trait
+3
View File
@@ -600,6 +600,9 @@ enum
STR_REPAIRED_PARTIAL,
STR_REPAIRED_PARTIAL_FOR_OWNER,
STR_CLEANED,
STR_CLEANED_FOR_OWNER,
TEXT_NUM_STR_MESSAGE,
};
+6 -2
View File
@@ -2358,6 +2358,9 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s竭尽可能地修理了%s。",
L"%s竭尽可能地修理了%s的%s。",
L"%s has cleaned the %s.", // TODO.Translate
L"%s has cleaned %s's %s.",
};
// the country and its noun in the game
@@ -2703,7 +2706,7 @@ STR16 pUpperLeftMapScreenStrings[] =
STR16 pTrainingStrings[] =
{
L"锻炼", // tell merc to train self
L"民兵",// tell merc to train town
L"民兵",// tell merc to train town
L"教练", // tell merc to act as trainer
L"学员", // tell merc to be train by other
};
@@ -7069,6 +7072,7 @@ STR16 sRepairsDoneString[] =
L"%s 修复所有人携带的中型物品",//L"%s finished repairing everyone's medium carried items",
L"%s 修复所有人携带的小型物品",//L"%s finished repairing everyone's small carried items",
L"%s 修复所有人的携行具",//L"%s finished repairing everyone's LBE gear",
L"%s finished cleaning everyone's guns.", // TODO.Translate
};
STR16 zGioDifConfirmText[]=
@@ -7968,7 +7972,7 @@ STR16 Additional113Text[]=
{
L"铁血联盟2 v1.13 窗口模式需要一个16bpp的颜色深度。",
L"铁血联盟2 v1.13 全屏模式(%d x %d)不支持你的显示屏分辨率。\n请改变游戏分辨率或使用16bpp窗口模式。", //L"Jagged Alliance 2 v1.13 fullscreen mode (%d x %d) is not supported by your primary screen.\nPlease either change the game resolution or use 16bpp windowed mode.",
L"存盘文件内部读取错误:存盘文件的“%s”数量跟 Ja2_Options.ini 设置的($d)不一致。", //L"Internal error in reading %s slots from Savegame: Number of slots in Savegame (%d) differs from defined slots in ja2_options.ini settings (%d)",
L"存盘文件内部读取错误:存盘文件的“%s”数量跟 Ja2_Options.ini 设置的($d)不一致。", //L"Internal error in reading %s slots from Savegame: Number of slots in Savegame (%d) differs from defined slots in ja2_options.ini settings (%d)",
// WANNE: Savegame slots validation against INI file
L"佣兵 (MAX_NUMBER_PLAYER_MERCS) / 交通工具 (MAX_NUMBER_PLAYER_VEHICLES)",
L"敌人 (MAX_NUMBER_ENEMIES_IN_TACTICAL)",
+11 -7
View File
@@ -2357,6 +2357,9 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s has repaired the %s as much as possible.", // TODO.Translate
L"%s has repaired %s's %s as much as possible.",
L"%s has cleaned the %s.", // TODO.Translate
L"%s has cleaned %s's %s.",
};
// the country and its noun in the game
@@ -7079,13 +7082,14 @@ STR16 gzCreditNameFunny[]=
STR16 sRepairsDoneString[] =
{
L"%s is klaar met reparatie van eigen items",
L"%s is klaar met reparatie van ieders wapens en bepantering",
L"%s is klaar met reparatie van ieders uitrusting",
L"%s finished repairing everyone's large carried items",
L"%s finished repairing everyone's medium carried items",
L"%s finished repairing everyone's small carried items",
L"%s finished repairing everyone's LBE gear",
L"%s is klaar met reparatie van eigen items.",
L"%s is klaar met reparatie van ieders wapens en bepantering.",
L"%s is klaar met reparatie van ieders uitrusting.",
L"%s finished repairing everyone's large carried items.",
L"%s finished repairing everyone's medium carried items.",
L"%s finished repairing everyone's small carried items.",
L"%s finished repairing everyone's LBE gear.",
L"%s finished cleaning everyone's guns.", // TODO.Translate
};
STR16 zGioDifConfirmText[]=
+11 -7
View File
@@ -2358,6 +2358,9 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s has repaired the %s as much as possible.",
L"%s has repaired %s's %s as much as possible.",
L"%s has cleaned the %s.",
L"%s has cleaned %s's %s.",
};
// the country and its noun in the game
@@ -7063,13 +7066,14 @@ STR16 gzCreditNameFunny[]=
// HEADROCK: Adjusted strings for better feedback, and added new string for LBE repair.
STR16 sRepairsDoneString[] =
{
L"%s finished repairing own items",
L"%s finished repairing everyone's guns & armor",
L"%s finished repairing everyone's equipped items",
L"%s finished repairing everyone's large carried items",
L"%s finished repairing everyone's medium carried items",
L"%s finished repairing everyone's small carried items",
L"%s finished repairing everyone's LBE gear",
L"%s finished repairing own items.",
L"%s finished repairing everyone's guns & armor.",
L"%s finished repairing everyone's equipped items.",
L"%s finished repairing everyone's large carried items.",
L"%s finished repairing everyone's medium carried items.",
L"%s finished repairing everyone's small carried items.",
L"%s finished repairing everyone's LBE gear.",
L"%s finished cleaning everyone's guns.",
};
STR16 zGioDifConfirmText[]=
+11 -7
View File
@@ -2366,6 +2366,9 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s a réparé au mieux : %s.",
L"%s a aidé %s pour réparer au mieux : %s.",
L"%s has cleaned the %s.", // TODO.Translate
L"%s has cleaned %s's %s.",
};
// the country and its noun in the game // TODO.Translate
@@ -7076,13 +7079,14 @@ STR16 gzCreditNameFunny[]=
STR16 sRepairsDoneString[] =
{
L"%s a terminé la réparation de ses objets",
L"%s a terminé la réparation des armes & protections",
L"%s a terminé la réparation des objets portés",
L"%s a fini de réparer les grands objets portés par chacun",
L"%s a fini de réparer les moyens objets portés par chacun",
L"%s a fini de réparer les petits objets portés par chacun",
L"%s a fini de réparer le mécanisme LBE de chacun",
L"%s a terminé la réparation de ses objets.",
L"%s a terminé la réparation des armes & protections.",
L"%s a terminé la réparation des objets portés.",
L"%s a fini de réparer les grands objets portés par chacun.",
L"%s a fini de réparer les moyens objets portés par chacun.",
L"%s a fini de réparer les petits objets portés par chacun.",
L"%s a fini de réparer le mécanisme LBE de chacun.",
L"%s finished cleaning everyone's guns.", // TODO.Translate
};
STR16 zGioDifConfirmText[]=
+17 -13
View File
@@ -2372,8 +2372,11 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s passt in keine freie Einbaustelle.",
L"Für diese Tasche ist nicht mehr genug Platz.",
L"%s has repaired the %s as much as possible.", // TODO.Translate
L"%s has repaired %s's %s as much as possible.",
L"%s hat %s so gut wie möglich repariert.",
L"%s hat %s's %s so gut wie möglich repariert.",
L"%s hat %s gereinigt.",
L"%s hat %s's %s gereinigt.",
};
// the country and its noun in the game
@@ -6908,13 +6911,14 @@ STR16 gzCreditNameFunny[]=
STR16 sRepairsDoneString[] =
{
L"%s hat seine eigenen Gegenstände repariert",
L"%s hat die Waffen und Rüstungen aller Teammitglieder repariert",
L"%s hat die aktivierten Gegenstände aller Teammitglieder repariert",
L"%s hat die großen mitgeführten Gegenstände aller Teammitglieder repariert",
L"%s hat die mittelgroßen mitgeführten Gegenstände aller Teammitglieder repariert",
L"%s hat die kleinen mitgeführten Gegenstände aller Teammitglieder repariert",
L"%s hat die Trageausrüstung aller Teammitglieder repariert",
L"%s hat seine eigenen Gegenstände repariert.",
L"%s hat die Waffen und Rüstungen aller Teammitglieder repariert.",
L"%s hat die aktivierten Gegenstände aller Teammitglieder repariert.",
L"%s hat die großen mitgeführten Gegenstände aller Teammitglieder repariert.",
L"%s hat die mittelgroßen mitgeführten Gegenstände aller Teammitglieder repariert.",
L"%s hat die kleinen mitgeführten Gegenstände aller Teammitglieder repariert.",
L"%s hat die Trageausrüstung aller Teammitglieder repariert.",
L"%s hat die Waffen aller Teammitglieder gereinigt.",
};
STR16 zGioDifConfirmText[]=
@@ -7261,10 +7265,10 @@ STR16 gzTransformationMessage[] =
L"%s wurde aufgeteilt in %d Magazine, wobei jedes davon %d Schuss enthält.",
L"%s wurde aufgeteilt in %s's Inventar.",
L"Es ist nicht genügend Platz in %s's Inventar um die Magazine dieses Kalibers abzulegen!",
L"Instant mode", // TODO.Translate
L"Delayed mode",
L"Instant mode (%d AP)",
L"Delayed mode (%d AP)",
L"Sofortmodus",
L"Verzögerter Modus",
L"Sofortmodus (%d AP)",
L"Verzögerter Modus (%d AP)",
};
// WANNE: These are the email texts Speck sends when one of the 4 new 1.13 MERC mercs have levelled up
+11 -7
View File
@@ -2352,6 +2352,9 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s has repaired the %s as much as possible.", // TODO.Translate
L"%s has repaired %s's %s as much as possible.",
L"%s has cleaned the %s.", // TODO.Translate
L"%s has cleaned %s's %s.",
};
// the country and its noun in the game
@@ -7063,13 +7066,14 @@ STR16 gzCreditNameFunny[]=
STR16 sRepairsDoneString[] =
{
L"%s ha finito di riparare gli oggetti",
L"%s ha finito di riparare le armi e i giubbotti antiproiettile di tutti",
L"%s ha finito di riparare gli oggetti dell'equipaggiamento di tutti",
L"%s finished repairing everyone's large carried items",
L"%s finished repairing everyone's medium carried items",
L"%s finished repairing everyone's small carried items",
L"%s finished repairing everyone's LBE gear",
L"%s ha finito di riparare gli oggetti.",
L"%s ha finito di riparare le armi e i giubbotti antiproiettile di tutti.",
L"%s ha finito di riparare gli oggetti dell'equipaggiamento di tutti.",
L"%s finished repairing everyone's large carried items.",
L"%s finished repairing everyone's medium carried items.",
L"%s finished repairing everyone's small carried items.",
L"%s finished repairing everyone's LBE gear.",
L"%s finished cleaning everyone's guns.", // TODO.Translate
};
STR16 zGioDifConfirmText[]=
+4
View File
@@ -2364,6 +2364,9 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s has repaired the %s as much as possible.", // TODO.Translate
L"%s has repaired %s's %s as much as possible.",
L"%s has cleaned the %s.", // TODO.Translate
L"%s has cleaned %s's %s.",
};
// the country and its noun in the game
@@ -7084,6 +7087,7 @@ STR16 sRepairsDoneString[] =
L"%s skończył(a) naprawiać średnie wyposażenie wszystkich członków oddziału",
L"%s skończył(a) naprawiać lekkie wyposażenie wszystkich członków oddziału",
L"%s skończył(a) naprawiać strój LBE wszystkich członków oddziału",
L"%s finished cleaning everyone's guns.", // TODO.Translate
};
STR16 zGioDifConfirmText[]=
+4
View File
@@ -2358,6 +2358,9 @@ CHAR16 Message[][STRING_LENGTH] =
L"%s отремонтировал(а) %s, насколько это было возможно.",
L"%s отремонтировал(а) у наёмника %s предмет %s, насколько это было возможно.",
L"%s has cleaned the %s.", // TODO.Translate
L"%s has cleaned %s's %s.",
};
// the country and its noun in the game
@@ -7070,6 +7073,7 @@ STR16 sRepairsDoneString[] =
L"%s: завершён ремонт всех малых вещей отряда.",
L"%s: завершён ремонт всех мелких вещей отряда.",
L"%s: завершён ремонт разгрузочных систем отряда.",
L"%s finished cleaning everyone's guns.", // TODO.Translate
};
STR16 zGioDifConfirmText[]=