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