From 3fc50d46a33932d2bfc3cb9329c672a6d2558410 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 18 Aug 2013 16:17:43 +0000 Subject: [PATCH] - Fixed EDB modifier weirdness(by Moa) - Fix: overheating modifiers on attachments weren't shown correctly git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6289 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Enhanced.cpp | 452 +++++++++++++++++++++----------- Tactical/Items.cpp | 17 +- Tactical/Items.h | 1 + Tactical/Weapons.cpp | 84 +++--- Tactical/Weapons.h | 3 + 5 files changed, 370 insertions(+), 187 deletions(-) diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index a33a27e1..9e861ab4 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -3702,44 +3702,16 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr cnt++; } }*/ - + + // Moa: used to check if general Indexes (Prop., 0, +-, =) should be shown + INT16 fDrawGenIndexes = FALSE; + // Flugente - if ( gGameOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem ) - { - 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 )) - { - if (cnt >= sFirstLine && cnt < sLastLine) - { - SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ]), gzUDBGenIndexTooltipText[ 0 ] ); - MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ] ); - - iRegionsCreated++; - - for (cnt2 = 1; cnt2 < 4; cnt2++) - { - MSYS_DefineRegion( &gUDBFasthelpRegions[ iRegionsCreated ], - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sLeft), - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sTop), - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sRight), - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sBottom), - MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); - - MSYS_AddRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2]); - SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2]), gzUDBGenIndexTooltipText[ cnt2 ] ); - SetRegionHelpEndCallback( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2]), HelpTextDoneCallback ); - MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2] ); - - iRegionsCreated++; - } - } - ++cnt; - } - } - if ( gGameOptions.fWeaponOverheating ) { if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // new index line here? ///////////////////// SINGLE SHOT TEMPERATURE if (cnt >= sFirstLine && cnt < sLastLine) { @@ -3805,7 +3777,8 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr cnt++; } else if ( Item[gpItemDescObject->usItem].barrel == TRUE ) // for barrel items - { + { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // new index line here? ///////////////////// COOLDOWN FACTOR if (cnt >= sFirstLine && cnt < sLastLine) { @@ -3818,7 +3791,8 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr // other stuff: various overheat modificators if ( ( Item[gpItemDescObject->usItem].overheatTemperatureModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatCooldownModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatJamThresholdModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatDamageThresholdModificator != 0.0 ) ) - { + { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // new index line here? ///////////////////// TEMPERATURE MODIFICATOR if ( Item[gpItemDescObject->usItem].overheatTemperatureModificator != 0.0 ) { @@ -3869,38 +3843,11 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } } - if(!cnt) cnt += 2; - - if (cnt >= sFirstLine && cnt < sLastLine) - { - SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ]), gzUDBGenIndexTooltipText[ 0 ] ); - MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) ] ); - - iRegionsCreated++; - - for (cnt2 = 1; cnt2 < 4; cnt2++) - { - MSYS_DefineRegion( &gUDBFasthelpRegions[ iRegionsCreated ], - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sLeft), - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sTop), - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sRight), - (INT16)(gItemDescAdvIndexRegions[cnt-sFirstLine][cnt2].sBottom), - MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); - - MSYS_AddRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2]); - SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2]), gzUDBGenIndexTooltipText[ cnt2 ] ); - SetRegionHelpEndCallback( &(gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2]), HelpTextDoneCallback ); - MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (cnt-sFirstLine) + cnt2] ); - - iRegionsCreated++; - } - } - ++cnt; - ///////////////////// poison percentage // only draw if item is poisoned in any way if ( Item[gpItemDescObject->usItem].bPoisonPercentage != 0 || ( (Item[gpItemDescObject->usItem].usItemClass & IC_GUN) && AmmoTypes[Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex].ubAmmoType].poisonPercentage != 0 ) ) { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // new index line here? if (cnt >= sFirstLine && cnt < sLastLine) { swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 56 ], szUDBAdvStatsExplanationsTooltipText[ 56 ]); @@ -3915,6 +3862,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr ///////////////////// DIRT MODIFICATOR if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // new index line here? if (cnt >= sFirstLine && cnt < sLastLine ) { swprintf( pStr, L"%s%s", szUDBAdvStatsTooltipText[ 57 ], szUDBAdvStatsExplanationsTooltipText[ 57 ]); @@ -3925,6 +3873,36 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } } + // Moa: moved additional Indexes to the end to avoid doublication. We have allready secured a free slot for this line so no cnt++ here! + if (fDrawGenIndexes) + { + ///////////////////// INDEXES (Prop., 0, +/-, =) + if (fDrawGenIndexes >= sFirstLine && fDrawGenIndexes < sLastLine) + { + SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + (fDrawGenIndexes-sFirstLine) ]), gzUDBGenIndexTooltipText[ 0 ]); + MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + (fDrawGenIndexes-sFirstLine) ] ); + //Moa: start bugfix (changed gItemDescAdvIndexRegions[] to gItemDescAdvRegions[] and adding correct region) + + for (cnt2 = 1; cnt2 < 4; cnt2++) + { + MSYS_DefineRegion( &gUDBFasthelpRegions[ iRegionsCreated ], + (INT16)(gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][cnt2].sLeft), + (INT16)(gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][cnt2].sTop), + (INT16)(gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][cnt2].sRight), + (INT16)(gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][cnt2].sBottom), + MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, ItemDescCallback ); + + MSYS_AddRegion( &gUDBFasthelpRegions[ iRegionsCreated ]); + SetRegionFastHelpText( &(gUDBFasthelpRegions[ iRegionsCreated ]), gzUDBGenIndexTooltipText[ cnt2 ] ); + SetRegionHelpEndCallback( &(gUDBFasthelpRegions[ iRegionsCreated ]), HelpTextDoneCallback ); + + iRegionsCreated++; + } + } + //cnt++; //allready increased the counter above! + //Moa: end bugfix + } + gubDescBoxTotalAdvLines = (UINT8)cnt; } } @@ -5127,12 +5105,13 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject ) */ // Flugente - // new line is necessary + // new line is necessary (Moa: only if needed) + INT16 fDrawGenIndexes = FALSE; if ( gGameOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem ) { 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 ) ) { - ++cnt; // for the new index-line + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // new index line here? } } @@ -5222,15 +5201,12 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject ) } } } - - if(!cnt) cnt += 2; - - ++cnt; // for the new index-line ///////////////////// poison percentage // only draw if item is poisoned in any way if ( Item[gpItemDescObject->usItem].bPoisonPercentage != 0 || ( (Item[gpItemDescObject->usItem].usItemClass & IC_GUN) && AmmoTypes[Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex].ubAmmoType].poisonPercentage != 0 ) ) { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // new index line here? if (cnt >= sFirstLine && cnt < sLastLine) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWH40KIcon, 0, gItemDescAdvRegions[cnt-sFirstLine][0].sLeft + sOffsetX, gItemDescAdvRegions[cnt-sFirstLine][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -10982,43 +10958,16 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) } */ - // Flugente: draw a new description line - if ( gGameOptions.fWeaponOverheating || gGameExternalOptions.fDirtSystem ) - { - if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || ( Item[gpItemDescObject->usItem].barrel == TRUE ) ) - { - ///////////////////////////////////////////////////// INDEXES - if (cnt >= sFirstLine && cnt < sLastLine) - { - SetFontForeground( FONT_MCOLOR_WHITE ); - - // Set Y coordinates - sTop = gItemDescAdvRegions[cnt-sFirstLine][1].sTop; - sHeight = gItemDescAdvRegions[cnt-sFirstLine][1].sBottom - sTop; - - // Repeatedly draw each index: four separate column headers per index. - for (UINT8 i = 0; i < 4; i++) - { - // Select "PROPERTY", "0", "+" or "=" as appropriate. - swprintf(pStr, L"%s", gzItemDescGenIndexes[ i ]); - - sLeft = gItemDescAdvRegions[cnt-sFirstLine][i].sLeft; - sWidth = gItemDescAdvRegions[cnt-sFirstLine][i].sRight - sLeft; - - FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - - mprintf( usX, usY, pStr ); - } - } - ++cnt; - } - } + // Flugente: draw a new description line + // Moa: only if required + INT16 fDrawGenIndexes = FALSE; // Flugente if ( gGameOptions.fWeaponOverheating ) { if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // insert Indexes here? ///////////////////// SINGLE SHOT TEMPERATURE if (cnt >= sFirstLine && cnt < sLastLine) { @@ -11235,31 +11184,7 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) } else if ( Item[gpItemDescObject->usItem].barrel == TRUE ) // display for barrel items { - ///////////////////////////////////////////////////// INDEXES - if (cnt >= sFirstLine && cnt < sLastLine) - { - SetFontForeground( FONT_MCOLOR_WHITE ); - - // Set Y coordinates - sTop = gItemDescAdvRegions[cnt-sFirstLine][1].sTop; - sHeight = gItemDescAdvRegions[cnt-sFirstLine][1].sBottom - sTop; - - // Repeatedly draw each index: four separate column headers per index. - for (UINT8 i = 0; i < 4; i++) - { - // Select "PROPERTY", "0", "+" or "=" as appropriate. - swprintf(pStr, L"%s", gzItemDescGenIndexes[ i ]); - - sLeft = gItemDescAdvRegions[cnt-sFirstLine][i].sLeft; - sWidth = gItemDescAdvRegions[cnt-sFirstLine][i].sRight - sLeft; - - FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - - mprintf( usX, usY, pStr ); - } - } - ++cnt; - + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // insert Indexes here? ///////////////////// COOLDOWN FACTOR if (cnt >= sFirstLine && cnt < sLastLine) { @@ -11313,36 +11238,229 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) } cnt++; } + else if ( ( Item[gpItemDescObject->usItem].overheatTemperatureModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatCooldownModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatJamThresholdModificator != 0.0 ) || ( Item[gpItemDescObject->usItem].overheatDamageThresholdModificator != 0.0 ) ) + { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // insert Indexes here? + + ///////////////////// TEMPERATURE MODIFIER + if ( ( Item[gpItemDescObject->usItem].overheatTemperatureModificator != 0.0 ) && cnt >= sFirstLine && cnt < sLastLine) + { + // Set Y coordinates + sTop = gItemDescAdvRegions[cnt-sFirstLine][1].sTop; + sHeight = gItemDescAdvRegions[cnt-sFirstLine][1].sBottom - sTop; + + iFloatModifier[0] = -1.0f - Item[gpItemDescObject->usItem].overheatTemperatureModificator; + iFloatModifier[1] = GetTemperatureModifier( gpItemDescObject ) - iFloatModifier[0]; + iFloatModifier[2] = GetTemperatureModifier( gpItemDescObject ); + + // Print Values + for (UINT8 cnt2 = 0; cnt2 < 3; cnt2++) + { + SetFontForeground( 5 ); + sLeft = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sLeft; + sWidth = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sRight - sLeft; + if (iFloatModifier[cnt2] > 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTNEGATIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else if (iFloatModifier[cnt2] < 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTPOSITIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else + { + swprintf( pStr, L"--" ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + } + mprintf( usX, usY, pStr ); + } + } + cnt++; + ///////////////////// TEMPERATURE MODIFIER + + ///////////////////// COOLDOWN MODIFIER + if ( ( Item[gpItemDescObject->usItem].overheatCooldownModificator != 0.0 ) && cnt >= sFirstLine && cnt < sLastLine) + { + // Set Y coordinates + sTop = gItemDescAdvRegions[cnt-sFirstLine][1].sTop; + sHeight = gItemDescAdvRegions[cnt-sFirstLine][1].sBottom - sTop; + + iFloatModifier[0] = Item[gpItemDescObject->usItem].overheatCooldownModificator; + iFloatModifier[1] = GetItemCooldownModificator( gpItemDescObject ) - iFloatModifier[0]; + iFloatModifier[2] = GetItemCooldownModificator( gpItemDescObject ); + + // Print Values + for (UINT8 cnt2 = 0; cnt2 < 3; cnt2++) + { + SetFontForeground( 5 ); + sLeft = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sLeft; + sWidth = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sRight - sLeft; + if (iFloatModifier[cnt2] > 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTNEGATIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else if (iFloatModifier[cnt2] < 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTPOSITIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else + { + swprintf( pStr, L"--" ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + } + mprintf( usX, usY, pStr ); + } + } + cnt++; + ///////////////////// COOLDOWN MODIFIER + + ///////////////////// JAM THRESHOLD MODIFIER + if ( ( Item[gpItemDescObject->usItem].overheatJamThresholdModificator != 0.0 ) && cnt >= sFirstLine && cnt < sLastLine) + { + // Set Y coordinates + sTop = gItemDescAdvRegions[cnt-sFirstLine][1].sTop; + sHeight = gItemDescAdvRegions[cnt-sFirstLine][1].sBottom - sTop; + + iFloatModifier[0] = -1.0f - Item[gpItemDescObject->usItem].overheatJamThresholdModificator; + iFloatModifier[1] = GetOverheatJamThresholdModifier( gpItemDescObject ) - iFloatModifier[0]; + iFloatModifier[2] = GetOverheatJamThresholdModifier( gpItemDescObject ); + + // Print Values + for (UINT8 cnt2 = 0; cnt2 < 3; cnt2++) + { + SetFontForeground( 5 ); + sLeft = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sLeft; + sWidth = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sRight - sLeft; + if (iFloatModifier[cnt2] > 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTNEGATIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else if (iFloatModifier[cnt2] < 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTPOSITIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else + { + swprintf( pStr, L"--" ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + } + mprintf( usX, usY, pStr ); + } + } + cnt++; + ///////////////////// JAM THRESHOLD MODIFIER + + ///////////////////// DAMAGE THRESHOLD MODIFIER + if ( ( Item[gpItemDescObject->usItem].overheatDamageThresholdModificator != 0.0 ) && cnt >= sFirstLine && cnt < sLastLine) + { + // Set Y coordinates + sTop = gItemDescAdvRegions[cnt-sFirstLine][1].sTop; + sHeight = gItemDescAdvRegions[cnt-sFirstLine][1].sBottom - sTop; + + iFloatModifier[0] = -1.0f - Item[gpItemDescObject->usItem].overheatDamageThresholdModificator; + iFloatModifier[1] = GetOverheatDamageThresholdModifier( gpItemDescObject ) - iFloatModifier[0]; + iFloatModifier[2] = GetOverheatDamageThresholdModifier( gpItemDescObject ); + + // Print Values + for (UINT8 cnt2 = 0; cnt2 < 3; cnt2++) + { + SetFontForeground( 5 ); + sLeft = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sLeft; + sWidth = gItemDescAdvRegions[cnt-sFirstLine][cnt2+1].sRight - sLeft; + if (iFloatModifier[cnt2] > 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTNEGATIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else if (iFloatModifier[cnt2] < 0) + { + if ( cnt2 == 1 ) + SetFontForeground( ITEMDESC_FONTPOSITIVE ); + + swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + #ifdef CHINESE + wcscat( pStr, ChineseSpecString1 ); + #else + wcscat( pStr, L"%" ); + #endif + } + else + { + swprintf( pStr, L"--" ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + } + mprintf( usX, usY, pStr ); + } + } + cnt++; + ///////////////////// DAMAGE THRESHOLD MODIFIER + } } // Flugente Zombies - ///////////////////////////////////////////////////// INDEXES - if(!cnt) cnt += 2; - - if (cnt >= sFirstLine && cnt < sLastLine) - { - SetFontForeground( FONT_MCOLOR_WHITE ); - - // Set Y coordinates - sTop = gItemDescAdvRegions[cnt-sFirstLine][1].sTop; - sHeight = gItemDescAdvRegions[cnt-sFirstLine][1].sBottom - sTop; - - // Repeatedly draw each index: four separate column headers per index. - for (UINT8 i = 0; i < 4; i++) - { - // Select "PROPERTY", "0", "+" or "=" as appropriate. - swprintf(pStr, L"%s", gzItemDescGenIndexes[ i ]); - - sLeft = gItemDescAdvRegions[cnt-sFirstLine][i].sLeft; - sWidth = gItemDescAdvRegions[cnt-sFirstLine][i].sRight - sLeft; - - FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - - mprintf( usX, usY, pStr ); - } - } - ++cnt; - ///////////////////// poison percentage iModifier[0] = Item[gpItemDescObject->usItem].bPoisonPercentage; @@ -11354,6 +11472,7 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) // only draw if item is poisoned in any way if ( iModifier[0] != 0 || iModifier[1] != 0 || iModifier[2] != 0 ) { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; // insert Indexes here? if (cnt >= sFirstLine && cnt < sLastLine) { // Set Y coordinates @@ -11401,6 +11520,7 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) { if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) { + if (!fDrawGenIndexes) fDrawGenIndexes = cnt++; //insert Indexes here? ///////////////////// DIRT MODIFICATOR if (cnt >= sFirstLine && cnt < sLastLine) { @@ -11455,6 +11575,34 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) cnt++; } } + + //Moa: moved indexes here to avoid doublicates of the index + ///////////////////// ADDITIONAL GENERAL INDEX (if required: cnt was allready increased) + if ( fDrawGenIndexes ) + { + if (fDrawGenIndexes >= sFirstLine && fDrawGenIndexes < sLastLine) + { + SetFontForeground( FONT_MCOLOR_WHITE ); + + // Set Y coordinates + sTop = gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][1].sTop; + sHeight = gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][1].sBottom - sTop; + + // Repeatedly draw each index: four separate column headers per index. + for (UINT8 i = 0; i < 4; i++) + { + // Select "PROPERTY", "0", "+" or "=" as appropriate. + swprintf(pStr, L"%s", gzItemDescGenIndexes[ i ]); + + sLeft = gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][i].sLeft; + sWidth = gItemDescAdvRegions[fDrawGenIndexes-sFirstLine][i].sRight - sLeft; + + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); + + mprintf( usX, usY, pStr ); + } + } + } } void DrawMiscValues( OBJECTTYPE * gpItemDescObject ) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 66878a20..409f03b6 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -13953,12 +13953,10 @@ static UINT16 OldWayOfCalculatingScopeBonus(SOLDIERTYPE *pSoldier) } -// Flugente FTW 1.2 -FLOAT GetItemCooldownFactor( OBJECTTYPE * pObj ) +// Flugente +FLOAT GetItemCooldownModificator( OBJECTTYPE * pObj ) { - FLOAT cooldownfactor = Item[pObj->usItem].usOverheatingCooldownFactor; // ... get item-specific cooldown factor ... - - FLOAT modificator = 1.0; + FLOAT modificator = Item[pObj->usItem].overheatCooldownModificator; if ( pObj->exists() == true ) { @@ -13972,6 +13970,15 @@ FLOAT GetItemCooldownFactor( OBJECTTYPE * pObj ) } } + return modificator; +} + +FLOAT GetItemCooldownFactor( OBJECTTYPE * pObj ) +{ + FLOAT cooldownfactor = Item[pObj->usItem].usOverheatingCooldownFactor; // ... get item-specific cooldown factor ... + + FLOAT modificator = 1.0f + GetItemCooldownModificator( pObj ); + cooldownfactor *= modificator; return cooldownfactor; diff --git a/Tactical/Items.h b/Tactical/Items.h index a9b455ec..b6c62b98 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -451,6 +451,7 @@ BOOLEAN HasExtendedEarOn( SOLDIERTYPE * pSoldier ); BOOLEAN UseTotalMedicalKitPoints( SOLDIERTYPE * pSoldier, UINT16 usPointsToConsume ); // Flugente +FLOAT GetItemCooldownModificator( OBJECTTYPE * pObj ); FLOAT GetItemCooldownFactor( OBJECTTYPE * pObj ); void GetScopeLists( OBJECTTYPE * pObj, std::map& arScopeMap ); diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 598cf8fc..a4f3772e 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -11838,6 +11838,23 @@ void GunIncreaseHeat( OBJECTTYPE *pObj, SOLDIERTYPE* pSoldier ) } // Flugente: Overheating Weapons +FLOAT GetTemperatureModifier( OBJECTTYPE *pObj ) +{ + // determine modificator according to attachments + FLOAT modificator = Item[pObj->usItem].overheatTemperatureModificator; + + attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) + { + if (iter->exists()) + { + modificator += Item[iter->usItem].overheatTemperatureModificator; + } + } + + return modificator; +} + FLOAT GetSingleShotTemperature( OBJECTTYPE *pObj ) { FLOAT singleshottemperature = 0.0; @@ -11847,16 +11864,7 @@ FLOAT GetSingleShotTemperature( OBJECTTYPE *pObj ) singleshottemperature = Weapon[ pObj->usItem ].usOverheatingSingleShotTemperature; // determine modificator according to attachments - FLOAT modificator = 1.0f; - - attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); - for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) - { - if (iter->exists()) - { - modificator += Item[iter->usItem].overheatTemperatureModificator; - } - } + FLOAT modificator = 1.0f + GetTemperatureModifier(pObj); // determine modificator according to ammo modificator += AmmoTypes[(*pObj)[0]->data.gun.ubGunAmmoType].temperatureModificator; @@ -11896,6 +11904,23 @@ FLOAT GetGunOverheatJamPercentage( OBJECTTYPE * pObj ) return temperature/ jamthreshold ; } +FLOAT GetOverheatJamThresholdModifier( OBJECTTYPE *pObj ) +{ + // determine modificator according to attachments + FLOAT modificator = Item[pObj->usItem].overheatJamThresholdModificator; + + attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) + { + if (iter->exists()) + { + modificator += Item[iter->usItem].overheatJamThresholdModificator; + } + } + + return modificator; +} + FLOAT GetOverheatJamThreshold( OBJECTTYPE *pObj ) { FLOAT jamthreshold = OVERHEATING_MAX_TEMPERATURE / 4.0f; @@ -11905,16 +11930,7 @@ FLOAT GetOverheatJamThreshold( OBJECTTYPE *pObj ) jamthreshold = Weapon[ pObj->usItem ].usOverheatingJamThreshold; // determine modificator according to attachments - FLOAT modificator = 1.0; - - attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); - for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) - { - if (iter->exists()) - { - modificator += Item[iter->usItem].overheatJamThresholdModificator; - } - } + FLOAT modificator = 1.0f + GetOverheatJamThresholdModifier(pObj); jamthreshold *= modificator; } @@ -11922,6 +11938,23 @@ FLOAT GetOverheatJamThreshold( OBJECTTYPE *pObj ) return jamthreshold; } +FLOAT GetOverheatDamageThresholdModifier( OBJECTTYPE *pObj ) +{ + // determine modificator according to attachments + FLOAT modificator = Item[pObj->usItem].overheatDamageThresholdModificator; + + attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); + for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) + { + if (iter->exists()) + { + modificator += Item[iter->usItem].overheatDamageThresholdModificator; + } + } + + return modificator; +} + FLOAT GetOverheatDamageThreshold( OBJECTTYPE *pObj ) { FLOAT damagethreshold = OVERHEATING_MAX_TEMPERATURE / 4.0f; @@ -11931,16 +11964,7 @@ FLOAT GetOverheatDamageThreshold( OBJECTTYPE *pObj ) damagethreshold = Weapon[ pObj->usItem ].usOverheatingDamageThreshold; // determine modificator according to attachments - FLOAT modificator = 1.0; - - attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); - for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) - { - if (iter->exists()) - { - modificator += Item[iter->usItem].overheatDamageThresholdModificator; - } - } + FLOAT modificator = 1.0f + GetOverheatDamageThresholdModifier(pObj); damagethreshold *= modificator; } diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index fedda90e..b5782f8c 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -528,10 +528,13 @@ FLOAT GetTargetZPos( SOLDIERTYPE *pShooter, INT32 sTargetGridNo ); // Flugente: Overheating Weapons void GunIncreaseHeat( OBJECTTYPE *pObj, SOLDIERTYPE* pSoldier ); // adding pSoldier allows soldier-specific modification of generated heat +FLOAT GetTemperatureModifier( OBJECTTYPE *pObj ); FLOAT GetSingleShotTemperature( OBJECTTYPE *pObj ); FLOAT GetGunOverheatDamagePercentage( OBJECTTYPE * pObj ); // Flugente: Get percentage: temperature/damagethreshold FLOAT GetGunOverheatJamPercentage( OBJECTTYPE * pObj ); // Flugente: Get percentage: temperature/jamthreshold +FLOAT GetOverheatJamThresholdModifier( OBJECTTYPE *pObj ); FLOAT GetOverheatJamThreshold( OBJECTTYPE *pObj ); +FLOAT GetOverheatDamageThresholdModifier( OBJECTTYPE *pObj ); FLOAT GetOverheatDamageThreshold( OBJECTTYPE *pObj ); #endif