mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
[Fix] Incorrect displaying info and tooltips in Advances Properties Tab
* Tooltips were shifted by one position due to wrong handling "Accuracy modifier".
* DrawAdvancedValues():
if ( iFloatModifier[0] > 1.0 || ( fComparisonMode && iComparedFloatModifier[0] > 1.0 ) )
it checks number of laser range tiles (iFloatModifier[0] > 1.0, "meters" / CELL_X_SIZE) right before actual drawing a line with values. So if someone put 1..9 into XML (<BestLaserRange>) it will not print that value. But number of "meters" was checked (like x > 0) everywhere prior to this code.
so all the code before decided to draw line with icon for laser range, but the guilty code line didn't
I suppose not to draw laser info at all if a modder screwed up <BestLaserRange> putting a 1..9 value
so all values 0..9 basically mean 0 tiles, i.e. there is no laser ability.
This commit is contained in:
+9
-14
@@ -14078,29 +14078,29 @@ INT16 GetFlatToHitBonus( OBJECTTYPE * pObj )
|
||||
// HEADROCK: Function to get average of all "best laser range" attributes from weapon and attachments
|
||||
INT16 GetAverageBestLaserRange( OBJECTTYPE * pObj )
|
||||
{
|
||||
INT16 bonus=0;
|
||||
FLOAT bonus = 0.0;
|
||||
INT16 numModifiers=0;
|
||||
|
||||
if (Item[pObj->usItem].bestlaserrange > 0)
|
||||
{
|
||||
numModifiers++;
|
||||
bonus += Item[pObj->usItem].bestlaserrange;
|
||||
bonus += (FLOAT) Item[pObj->usItem].bestlaserrange;
|
||||
}
|
||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter)
|
||||
{
|
||||
if (Item[iter->usItem].bestlaserrange > 0 && iter->exists())
|
||||
{
|
||||
numModifiers++;
|
||||
bonus += Item[iter->usItem].bestlaserrange;
|
||||
bonus += (FLOAT) Item[iter->usItem].bestlaserrange;
|
||||
}
|
||||
}
|
||||
|
||||
if (numModifiers>0)
|
||||
if (numModifiers > 1)
|
||||
{
|
||||
bonus = bonus / numModifiers;
|
||||
}
|
||||
|
||||
return( bonus * gItemSettings.fBestLaserRangeModifier );
|
||||
return (INT16)(bonus * gItemSettings.fBestLaserRangeModifier);
|
||||
}
|
||||
|
||||
// get the best laser range from the weapon and attachments
|
||||
@@ -14120,7 +14120,7 @@ INT16 GetBestLaserRange( OBJECTTYPE * pObj )
|
||||
}
|
||||
}
|
||||
|
||||
return( range * gItemSettings.fBestLaserRangeModifier );
|
||||
return (INT16) ((FLOAT)range * gItemSettings.fBestLaserRangeModifier);
|
||||
}
|
||||
|
||||
// HEADROCK: This function determines the bipod bonii of the gun or its attachments
|
||||
@@ -15642,14 +15642,9 @@ BOOLEAN GetItemFromRandomItem( UINT16 usRandomItem, UINT16* pusNewItem )
|
||||
// as it is also possible to reference to other random items, we also have to check for them
|
||||
|
||||
// clear the random item arrays and reset the counters
|
||||
for ( int i = 0; i < RANDOM_ITEM_MAX_NUMBER; ++i)
|
||||
randomitemarray[i] = 0;
|
||||
|
||||
for ( int i = 0; i < RANDOM_TABOO_MAX; ++i)
|
||||
{
|
||||
randomitemtabooarray[i] = 0;
|
||||
randomitemclasstabooarray[i] = 0;
|
||||
}
|
||||
memset(randomitemarray, 0, sizeof(randomitemarray));
|
||||
memset(randomitemtabooarray, 0, sizeof(randomitemtabooarray));
|
||||
memset(randomitemclasstabooarray, 0, sizeof(randomitemclasstabooarray));
|
||||
|
||||
itemcnt = 0;
|
||||
rdtaboocnt = 0;
|
||||
|
||||
Reference in New Issue
Block a user