Various fixes/improvements (all by Moa):

- (bug) first Tooltip for weapons (secondary and tertiary values like recoil) was missing, last one showed (null,null).
- (cleanup) code cosmetic/potential bug: cnt now (hopefully) match the count of actual rendered values/MouseRegions and Icons.
- (feature adjustment) freshness Bar for food now shows the decay. Color values for bar range from green (over yellow) to red. hight of bar shows the percentage.
- (feature adjustment) Food properties are now shown in DB. A Data patch is needed to show the new Icons, those however are placeholders for better ones, the tooltips also need a rework by a native english and translation to the different languages.
- (feature adjustment) When FoodSystem is enabled the weight of a foodtype item is adjusted to account for partially eaten item.
- (bug) Performance fix 1: multiple TransformIcons where rendered in DB above each other.
- (bug) Performance fix 2: condition to leave loop when on end of Transform list was not met due to missing cast (65535!=-1).
- (bug) 'endless dying mercs in roof edges' fix in rev.6346 condition was never met.
- (bug) Popups were missplaced when clicking on a trainer-assignment multiple times to close the submenu.
- (bug) Popups were missplaced when clicking on a practice-assignment multiple times to close the submenu.
- (bug) Popups were missplaced when clicking on a student-assignment multiple times to close the submenu.
- (bug) Popups were missplaced when clicking on a facility-assignment multiple times to close the submenu. note: the bug might only be reproducable when selecting different screensize then the 3 native ones.
- (bug) MouseMasks for disabling timeCompress buttons did not match size of buttons, Clock Overlay was missing
- (cleanup) Replaced Hardcoded fallback Gridnumbers with CenterGrid if no exitGrid was specified in map editor. Same behavier than before, but since we have bigmaps and possibly other mapsizes it should not be constant.
- (bug) Sight range calulation uses distance visible with and without scope to get a scopeRangeMod=sDistVis/sDistVisNoScope. Blind soldiers will have 0 sDistVisNoScope, which means the scopeRangeMod is a div/0 (not defined result). After fix we get a defined result for scopeRangeMod of 1.0f in case there is a 0 distance. Also we get a defined result for sightrange since sightrange=sightrange/scopeRangeMod = 0/1.0f.
- (bug) Experimental NCTH calulation did return 0 CTH with 0 aimclicks but it should return at least the base CTH.
- (cleanup) added comment to get an idea of the 'magic' aiming Points formula
- (feature adjustment) Flat backpack malus replaced with malus which scales linear with weight of backpack up to maximum specified in ini file. Each 5 kg 1 additional malus is applied for movement. When carrying pack in hands or inside another pocket the full malus is applied. Malus for changing stances is still 1 additional Point when carrying backpack (does not matter in which slot).


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6363 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-09-05 17:42:19 +00:00
parent f0c824e0dd
commit 5c7fa40341
21 changed files with 590 additions and 91 deletions
+20 -7
View File
@@ -4951,7 +4951,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
// bool highPowerScope = false;
// INT16 sTotalAutofirePenalty = 0;
bool fCantSeeTarget = false;
FLOAT scopeRangeMod;
FLOAT scopeRangeMod = 0.0f;
// make sure the guy's actually got a weapon in his hand!
pInHand = &(pSoldier->inv[pSoldier->ubAttackingHand]);
@@ -5011,8 +5011,13 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
gbForceWeaponNotReady = false;
// Flugente: blind soldiers have sDistVisNoScope = 0...
scopeRangeMod = (float)sDistVis / (float)max(1.0f, sDistVisNoScope); // percentage DistVis has been enhanced due to an attached scope
iSightRange = (INT32)(iSightRange / scopeRangeMod);
if ( sDistVisNoScope )
scopeRangeMod = (float)sDistVis / (float)sDistVisNoScope; // percentage DistVis has been enhanced due to an attached scope
iSightRange = 0;
if ( scopeRangeMod )
iSightRange = (INT32)(iSightRange / scopeRangeMod);
if(iSightRange > 0){
//CHRISL: The LOS system, which determines whether to display an enemy unit, does not factor in the AimBonus tag during it's calculations. So having
// the CTH system use that tag to adjust iSightRange for AimBonus applied from armor might not be the best option. Especially as it can sometimes
@@ -5103,7 +5108,7 @@ if (gGameExternalOptions.fUseNewCTHCalculation)
fBaseChance = __max( fBaseChance, 0 );
fBaseChance = __min( fBaseChance, 100 );
fFinalChance = fBaseChance;
//////////////////////////////////////////////////////////////////////////////////
// Second step: Calculate bonuses from aiming
//
@@ -6492,7 +6497,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
UINT16 iBulletsLeft, iTracersFired = 0, iBulletsPerTracer, iBulletsSinceLastTracer=0, iRoundsFiredPreviously;
INT8 bBandaged, maxClickBonus = 10, AIM_PENALTY_PER_TARGET_SHOCK;
UINT8 ubAdjAimPos, ubTargetID, bLightLevel, ubCoweringDivisor, ubAutoPenaltySinceLastTracer=0;
FLOAT maxBonus, aimTimeBonus, scopeRangeMod, iAimBonus;
FLOAT maxBonus, aimTimeBonus, scopeRangeMod = 0.0f, iAimBonus;
bool fCantSeeTarget = false, fCoverObscured = false;
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CalcChanceToHitGun"));
@@ -6548,7 +6553,11 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
gbForceWeaponNotReady = true;
sDistVisNoScope = pSoldier->GetMaxDistanceVisible(sGridNo, pSoldier->bTargetLevel, CALC_FROM_ALL_DIRS ) * CELL_X_SIZE;
gbForceWeaponNotReady = false;
scopeRangeMod = (float)sDistVis / (float)sDistVisNoScope; // percentage DistVis has been enhanced due to an attached scope
// Flugente: blind soldiers have sDistVisNoScope = 0...
if ( sDistVisNoScope )
scopeRangeMod = (float)sDistVis / (float)sDistVisNoScope; // percentage DistVis has been enhanced due to an attached scope
iMaxNormRange = MaxNormalDistanceVisible() * CELL_X_SIZE;
if ( Item[ usItemUsed ].usItemClass == IC_GUN || Item[ usItemUsed ].usItemClass == IC_LAUNCHER)
iMaxRange = GunRange( pInHand, pSoldier ); // SANDRO - added argument
@@ -6571,7 +6580,11 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
/////////////////////////////////////////////////////////////////////////////////////
// Modify Sight and Physical Range
iSightRange = (INT32)(iSightRange / scopeRangeMod);
iSightRange = 0;
if ( scopeRangeMod )
iSightRange = (INT32)(iSightRange / scopeRangeMod);
if(iSightRange > 0 && !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) ){
//CHRISL: The LOS system, which determines whether to display an enemy unit, does not factor in the AimBonus tag during it's calculations. So having
// the CTH system use that tag to adjust iSightRange for AimBonus applied from armor might not be the best option. Especially as it can sometimes