mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Minor code improvements
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8833 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+13
-12
@@ -2972,7 +2972,7 @@ UINT16 CalculateAmmoWeight( UINT16 usGunAmmoItem, UINT16 ubShotsLeft )
|
|||||||
uiMinWeight = 1;
|
uiMinWeight = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
double weight = 0.0;
|
double weight = 0.5; //Pulmu:To round correctly
|
||||||
|
|
||||||
if(ubShotsLeft > 0)
|
if(ubShotsLeft > 0)
|
||||||
{
|
{
|
||||||
@@ -2985,7 +2985,7 @@ UINT16 CalculateAmmoWeight( UINT16 usGunAmmoItem, UINT16 ubShotsLeft )
|
|||||||
weight += (double)uiMinWeight + (( (double)ubShotsLeft / (double)Magazine[ Item[usGunAmmoItem].ubClassIndex ].ubMagSize) * ( (double)Item[usGunAmmoItem].ubWeight - (double)uiMinWeight ));
|
weight += (double)uiMinWeight + (( (double)ubShotsLeft / (double)Magazine[ Item[usGunAmmoItem].ubClassIndex ].ubMagSize) * ( (double)Item[usGunAmmoItem].ubWeight - (double)uiMinWeight ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
weight += 0.5; //Pulmu:To round correctly
|
|
||||||
return (UINT16)weight;
|
return (UINT16)weight;
|
||||||
//Pulmu end
|
//Pulmu end
|
||||||
}
|
}
|
||||||
@@ -3010,11 +3010,10 @@ UINT16 CalculateObjectWeight( OBJECTTYPE *pObject )
|
|||||||
weight += CalculateAmmoWeight(pObject->usItem, (*pObject)[cnt]->data.ubShotsLeft);
|
weight += CalculateAmmoWeight(pObject->usItem, (*pObject)[cnt]->data.ubShotsLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
// Start with base weight
|
{
|
||||||
weight = pItem->ubWeight;
|
// Start with base weight, multiply by the number of objects, can be 0
|
||||||
//multiply by the number of objects, can be 0
|
weight = pItem->ubWeight * pObject->ubNumberOfObjects;
|
||||||
weight *= pObject->ubNumberOfObjects;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -3040,7 +3039,7 @@ UINT16 OBJECTTYPE::GetWeightOfObjectInStack(unsigned int index)
|
|||||||
UINT16 weight = pItem->ubWeight;
|
UINT16 weight = pItem->ubWeight;
|
||||||
|
|
||||||
// Are we looking at an LBENODE item? New inventory only.
|
// Are we looking at an LBENODE item? New inventory only.
|
||||||
if ( pItem->usItemClass == IC_LBEGEAR && IsActiveLBE( index ) && ( UsingNewInventorySystem() == true ) )
|
if ( UsingNewInventorySystem() && IsActiveLBE( index ) )
|
||||||
{
|
{
|
||||||
LBENODE* pLBE = GetLBEPointer( index );
|
LBENODE* pLBE = GetLBEPointer( index );
|
||||||
if ( pLBE )
|
if ( pLBE )
|
||||||
@@ -3081,8 +3080,7 @@ UINT16 OBJECTTYPE::GetWeightOfObjectInStack(unsigned int index)
|
|||||||
weight += Item[ (*this)[index]->data.gun.usGunAmmoItem ].ubWeight;
|
weight += Item[ (*this)[index]->data.gun.usGunAmmoItem ].ubWeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( gGameExternalOptions.fAmmoDynamicWeight && ( pItem->camouflagekit || pItem->canteen || pItem->drugtype || pItem->foodtype || usItem == JAR_ELIXIR ) )
|
||||||
if ( gGameExternalOptions.fAmmoDynamicWeight && ( pItem->camouflagekit || pItem->canteen || pItem->drugtype || pItem->foodtype || usItem == JAR_ELIXIR ) )
|
|
||||||
{
|
{
|
||||||
weight *= (FLOAT)( ( *this )[index] )->data.objectStatus / 100.0f;
|
weight *= (FLOAT)( ( *this )[index] )->data.objectStatus / 100.0f;
|
||||||
}
|
}
|
||||||
@@ -3150,8 +3148,11 @@ UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier, BOOLEAN fConsiderDragging
|
|||||||
|
|
||||||
// Flugente: diseases can affect stat effectivity
|
// Flugente: diseases can affect stat effectivity
|
||||||
INT16 diseaseeffect = 0;
|
INT16 diseaseeffect = 0;
|
||||||
for ( int i = 0; i < NUM_DISEASES; ++i )
|
if ( gGameExternalOptions.fDisease )
|
||||||
diseaseeffect += Disease[i].sEffCarryStrength * pSoldier->GetDiseaseMagnitude( i );
|
{
|
||||||
|
for ( int i = 0; i < NUM_DISEASES; ++i )
|
||||||
|
diseaseeffect += Disease[i].sEffCarryStrength * pSoldier->GetDiseaseMagnitude( i );
|
||||||
|
}
|
||||||
|
|
||||||
ubStrengthForCarrying = (ubStrengthForCarrying * (100 + diseaseeffect + pSoldier->GetBackgroundValue( BG_PERC_CARRYSTRENGTH )) / 100);
|
ubStrengthForCarrying = (ubStrengthForCarrying * (100 + diseaseeffect + pSoldier->GetBackgroundValue( BG_PERC_CARRYSTRENGTH )) / 100);
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,11 @@ INT16 EffectiveStrength( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer )
|
|||||||
|
|
||||||
// Flugente: diseases can affect stat effectivity
|
// Flugente: diseases can affect stat effectivity
|
||||||
INT16 diseaseeffect = 0;
|
INT16 diseaseeffect = 0;
|
||||||
for ( int i = 0; i < NUM_DISEASES; ++i )
|
if ( gGameExternalOptions.fDisease )
|
||||||
diseaseeffect += Disease[i].sEffStat[INFST_STR] * pSoldier->GetDiseaseMagnitude( i );
|
{
|
||||||
|
for ( int i = 0; i < NUM_DISEASES; ++i )
|
||||||
|
diseaseeffect += Disease[i].sEffStat[INFST_STR] * pSoldier->GetDiseaseMagnitude( i );
|
||||||
|
}
|
||||||
|
|
||||||
iEffStrength = (iEffStrength * (100 + diseaseeffect + pSoldier->GetBackgroundValue( BG_STRENGTH ))) / 100;
|
iEffStrength = (iEffStrength * (100 + diseaseeffect + pSoldier->GetBackgroundValue( BG_STRENGTH ))) / 100;
|
||||||
|
|
||||||
|
|||||||
@@ -11283,7 +11283,7 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT16 soundtoplay = 1 + Random( numBattleSounds_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID] );
|
UINT32 soundtoplay = 1 + Random( numBattleSounds_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID] );
|
||||||
|
|
||||||
sprintf( zFilename, "BATTLESNDS\\%s%d_%s%d", gBattleSndsNpcHelperData[entrynum].zName, pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName, soundtoplay );
|
sprintf( zFilename, "BATTLESNDS\\%s%d_%s%d", gBattleSndsNpcHelperData[entrynum].zName, pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName, soundtoplay );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user