diff --git a/GameSettings.cpp b/GameSettings.cpp index 580aca2b4..33430f413 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -2127,6 +2127,7 @@ void LoadGameExternalOptions() ////////// ALL ASSIGNMENTS ////////// gGameExternalOptions.ubMinutesForAssignmentToCount = iniReader.ReadInteger("Strategic Assignment Settings","MINUTES_FOR_ASSIGNMENT_TO_COUNT",45, 1, NUM_MIN_IN_DAY); + gGameExternalOptions.fSleepDisplayFailNotification = iniReader.ReadBoolean("Strategic Assignment Settings","NOTIFY_IF_SLEEP_FAILS", TRUE ); ////////// PRACTICE/TRAIN/STUDY ////////// diff --git a/GameSettings.h b/GameSettings.h index a1c252e45..c054a8c32 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -612,6 +612,7 @@ typedef struct //Merc Assignment settings INT32 ubAssignmentUnitsPerDay; INT32 ubMinutesForAssignmentToCount; + BOOLEAN fSleepDisplayFailNotification; INT32 ubTrainingSkillMin; INT32 ubTrainingSkillMax; diff --git a/GameVersion.cpp b/GameVersion.cpp index 7e75de4f8..807dbd53e 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -15,9 +15,9 @@ #ifdef JA2EDITOR #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7884 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7884 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7884 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7884 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7884 (Development Build)" }; #endif #elif defined CRIPPLED_VERSION @@ -46,16 +46,16 @@ //RELEASE BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7884 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7884 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.7870 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.7884 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 15.05.20" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 15.06.01" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 0dc000b20..3d130a07e 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -1419,86 +1419,92 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) // health if( Menptr[iId].bAssignment != ASSIGNMENT_POW ) { - if( gMercProfiles[Menptr[iId].ubProfile].bLifeDelta > 0 ) + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bLifeDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_HEALTH]); + + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bLifeDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); } - //else - //{ - swprintf(sString, L"%d/%d",Menptr[iId].stats.bLife,Menptr[iId].stats.bLifeMax); - //} + swprintf( sString, L"%d/%d", Menptr[iId].stats.bLife, Menptr[iId].stats.bLifeMax ); } else { swprintf( sString, pPOWStrings[ 1 ] ); } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_HEALTH]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_HEALTH]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); break; case 1: // agility if( !fAmIaRobot ) { - if( gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta > 0 ) + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_AGILITY]); + + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bAgility); - //} + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + } + + swprintf( sString, L"%d", Menptr[iId].stats.bAgility ); } else { swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); break; case 2: // dexterity - if( !fAmIaRobot ) + if ( !fAmIaRobot ) { - if( gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta > 0 ) + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_DEXTERITY]); + + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bDexterity); - //} + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + } + + swprintf(sString, L"%d",Menptr[iId].stats.bDexterity); } else { swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); break; case 3: // strength if( !fAmIaRobot ) { - if( gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta > 0 ) + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_STRENGTH]); + + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bStrength ); - //} + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + } + + swprintf( sString, L"%d", Menptr[iId].stats.bStrength ); } else { @@ -1513,15 +1519,17 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) // leadership if( !fAmIaRobot ) { - if( gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta > 0 ) + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_LEADERSHIP]); + + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bLeadership ); - //} + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + } + + swprintf( sString, L"%d", Menptr[iId].stats.bLeadership ); } else { @@ -1536,16 +1544,17 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) // wisdom if( !fAmIaRobot ) { - if( gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta > 0 ) + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_WISDOM]); + + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bWisdom ); - //} + + swprintf( sString, L"%d", Menptr[iId].stats.bWisdom ); } else { @@ -1586,98 +1595,102 @@ void DisplayCharStats(INT32 iId, INT32 iSlot) //mrkmanship if( !fAmIaRobot ) { - if( gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta > 0 ) + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MARKSMANSHIP]); + + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bMarksmanship); - //} + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + } + + swprintf( sString, L"%d", Menptr[iId].stats.bMarksmanship ); } else { swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); } - - - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 8: + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 8: // mech if( !fAmIaRobot ) { + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MECHANICAL]); - if( gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta > 0 ) + if ( change ) { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bMechanical); - //} + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + } + + swprintf( sString, L"%d", Menptr[iId].stats.bMechanical ); } else { swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); } - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 9: - // exp - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta > 0 ) - { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bExplosive); - //} - - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } - - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; - case 10: - // med - if( !fAmIaRobot ) - { - if( gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta > 0 ) - { - swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } - //else - //{ - swprintf(sString, L"%d",Menptr[iId].stats.bMedical); - //} - } - else - { - swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - } - - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); - break; + break; + case 9: + // exp + if( !fAmIaRobot ) + { + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_EXPLOSIVES]); + + if ( change ) + { + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + } + + swprintf( sString, L"%d", Menptr[iId].stats.bExplosive ); + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 10: + // med + if( !fAmIaRobot ) + { + // Flugente: stats can have gone up or down, find out which + INT16 change = gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MEDICAL]); + + if ( change ) + { + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + } + + swprintf( sString, L"%d", Menptr[iId].stats.bMedical ); + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; // Added by Flugente case 16: diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 7369bd849..62b81efcf 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -617,8 +617,6 @@ BOOLEAN PlayerSoldierTooTiredToTravel( SOLDIERTYPE *pSoldier ); void AssignmentAborted( SOLDIERTYPE *pSoldier, UINT8 ubReason ); -UINT8 CalcSoldierNeedForSleep( SOLDIERTYPE *pSoldier ); - UINT32 GetLastSquadListedInSquadMenu( void ); BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier ); @@ -4969,84 +4967,8 @@ INT8 GetRegainDueToSleepNeeded( SOLDIERTYPE *pSoldier, INT32 iRateOfReGain ) void RestCharacter( SOLDIERTYPE *pSoldier ) { - // handle the sleep of this character, update bBreathMax based on sleep they have - INT8 bMaxBreathRegain = 0; - INT16 sSectorModifier = 100; - FLOAT bDivisor = 0; - - // Determine how many hours a day this merc must sleep. Normally this would range between 6 and 12 hours. - // Injuries and/or martial arts trait can change the limits to between 3 and 18 hours a day. - bDivisor = CalcSoldierNeedForSleep( pSoldier ); - - // HEADROCK HAM 3.6: - // Night ops specialists sleep better during the day. Others sleep better during the night. - // silversurfer: The code below did the complete opposite. A higher bDivisor means LESS regeneration. Fixed. - if (DayTime()) //if (NightTime()) - { - if ( gGameOptions.fNewTraitSystem ) // SANDRO - Old/New traits - { - if ( !HAS_SKILL_TRAIT( pSoldier, NIGHT_OPS_NT ) ) - bDivisor += 3; - } - else - bDivisor += 4-(2*NUM_SKILL_TRAITS( pSoldier, NIGHTOPS_OT )); - } - else - { - if ( gGameOptions.fNewTraitSystem ) // SANDRO - Old/New traits - { - if ( HAS_SKILL_TRAIT( pSoldier, NIGHT_OPS_NT ) ) - bDivisor += 3; - } - else - bDivisor += (2*NUM_SKILL_TRAITS( pSoldier, NIGHTOPS_OT )); - } - - // HEADROCK HAM 3.5: Read adjustment from local sector facilities - if (pSoldier->bSectorZ == 0) - { - if (pSoldier->flags.fMercAsleep) - { - sSectorModifier = GetSectorModifier( pSoldier, FACILITY_SLEEP_MOD ); - } - else - { - // Resting can be done at a facility now, and the program will automatically apply a performance bonus - // to this if the facility has one. If the character is simply resting ("On Duty", assigned to a squad), - // then only Ambient effects take place. - sSectorModifier = GetSectorModifier( pSoldier, FACILITY_PERFORMANCE_MOD ); - } - bDivisor = (bDivisor * 100) / sSectorModifier; - } - - // silversurfer: Items can provide a bonus to regeneration, sleeping bags for example. - // They will not provide such bonus if the merc is already using a bed in a facility. - if ( GetSoldierFacilityAssignmentIndex( pSoldier ) != FAC_PATIENT && GetSoldierFacilityAssignmentIndex( pSoldier ) != FAC_REST ) - { - bDivisor = ( bDivisor * 100 ) / ( 100 + GetInventorySleepModifier( pSoldier ) ); - } - - // silversurfer: I moved all modifiers above this point because we don't want anybody to rest faster or slower than the already extreme thresholds. - // Re-enforce limits - bDivisor = __min(18, __max(3, bDivisor)); - - // round up so the bonuses above make more sense - bMaxBreathRegain = ( 50 / bDivisor + 0.5 ); - - // Limit so that characters can't regain faster than 3 hours, ever - if (bMaxBreathRegain > 17) - { - bMaxBreathRegain = 17; - } - - // if breath max is below the "really tired" threshold - if( pSoldier->bBreathMax < BREATHMAX_PRETTY_TIRED ) - { - // real tired, rest rate is 50% higher (this is to prevent absurdly long sleep times for totally exhausted mercs) - bMaxBreathRegain = (UINT8)( bMaxBreathRegain * 3 / 2 ); - } - - pSoldier->bBreathMax += bMaxBreathRegain; + // handle the sleep of this character, update bBreathMax based on sleep they have + pSoldier->bBreathMax += pSoldier->GetSleepBreathRegeneration( ); // Flugente: diseases can affect stat effectivity UINT16 diseasemaxbreathreduction = 0; diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 0c330730b..98400fbf4 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -479,6 +479,8 @@ BOOLEAN MercStaffsMilitaryHQ(); BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier ); +UINT8 CalcSoldierNeedForSleep( SOLDIERTYPE *pSoldier ); + #endif diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 1d82caa27..55f5349b3 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -2028,6 +2028,8 @@ void UpdateCharRegionHelpText( void ) pSoldier->PrintFoodDesc( sString, TRUE ); pSoldier->PrintDiseaseDesc( sString, TRUE ); + + pSoldier->PrintSleepDesc( sString ); } } else diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 9b8df9a8c..d67674618 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -11429,7 +11429,8 @@ void TeamListSleepRegionBtnCallBack( MOUSE_REGION *pRegion, INT32 iReason ) else // awake { // try to put him to sleep - if( SetMercAsleep( pSoldier, TRUE ) ) + // Flugente: externalised option on whether messages on why merc cannot sleep appear + if ( SetMercAsleep( pSoldier, gGameExternalOptions.fSleepDisplayFailNotification ) ) { // HEADROCK HAM B2.8: New feature sends all trainees/trainers to sleep automatically HandleTrainingSleepSynchronize( pSoldier ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 0a29c8bd3..88012a923 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -14510,6 +14510,8 @@ void UpdateMercBodyRegionHelpText( ) pSoldier->PrintFoodDesc( sString, TRUE ); pSoldier->PrintDiseaseDesc( sString, TRUE ); + + pSoldier->PrintSleepDesc( sString ); } } } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index ee450df8c..682b845f8 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -96,6 +96,7 @@ #include "Queen Command.h" // added by Flugente #include "Town Militia.h" // added by Flugente #include "Auto Bandage.h" // added by Flugente +#include "Facilities.h" // added by Flugente #endif #include "ub_config.h" @@ -18750,7 +18751,7 @@ void SOLDIERTYPE::PrintFoodDesc( CHAR16* apStr, BOOLEAN fFullDesc ) if ( !gGameOptions.fFoodSystem ) return; - // only for living mercs with a profile with a valid infection method + // only for living mercs with a profile if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE || this->ubProfile == NO_PROFILE ) return; @@ -18849,6 +18850,19 @@ void SOLDIERTYPE::PrintFoodDesc( CHAR16* apStr, BOOLEAN fFullDesc ) } } +void SOLDIERTYPE::PrintSleepDesc( CHAR16* apStr ) +{ + // only for people + if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) + return; + + CHAR16 atStr[100]; + swprintf( atStr, L"" ); + + swprintf( atStr, gpStrategicString[STR_BREATH_REGEN_SLEEP], this->GetSleepBreathRegeneration( ) ); + wcscat( apStr, atStr ); +} + // get percentage protection from infections via contact FLOAT SOLDIERTYPE::GetDiseaseContactProtection( ) { @@ -18901,6 +18915,89 @@ INT16 SOLDIERTYPE::GetDiseaseResistance( ) return(val); } +// Flugente: hourly breath regen calculation +INT8 SOLDIERTYPE::GetSleepBreathRegeneration( ) +{ + // handle the sleep of this character, update bBreathMax based on sleep they have + INT8 bMaxBreathRegain = 0; + INT16 sSectorModifier = 100; + FLOAT bDivisor = 0; + + // Determine how many hours a day this merc must sleep. Normally this would range between 6 and 12 hours. + // Injuries and/or martial arts trait can change the limits to between 3 and 18 hours a day. + bDivisor = CalcSoldierNeedForSleep( this ); + + // HEADROCK HAM 3.6: + // Night ops specialists sleep better during the day. Others sleep better during the night. + // silversurfer: The code below did the complete opposite. A higher bDivisor means LESS regeneration. Fixed. + if ( DayTime( ) ) //if (NightTime()) + { + if ( gGameOptions.fNewTraitSystem ) // SANDRO - Old/New traits + { + if ( !HAS_SKILL_TRAIT( this, NIGHT_OPS_NT ) ) + bDivisor += 3; + } + else + bDivisor += 4 - (2 * NUM_SKILL_TRAITS( this, NIGHTOPS_OT )); + } + else + { + if ( gGameOptions.fNewTraitSystem ) // SANDRO - Old/New traits + { + if ( HAS_SKILL_TRAIT( this, NIGHT_OPS_NT ) ) + bDivisor += 3; + } + else + bDivisor += (2 * NUM_SKILL_TRAITS( this, NIGHTOPS_OT )); + } + + // HEADROCK HAM 3.5: Read adjustment from local sector facilities + if ( this->bSectorZ == 0 ) + { + if ( this->flags.fMercAsleep ) + { + sSectorModifier = GetSectorModifier( this, FACILITY_SLEEP_MOD ); + } + else + { + // Resting can be done at a facility now, and the program will automatically apply a performance bonus + // to this if the facility has one. If the character is simply resting ("On Duty", assigned to a squad), + // then only Ambient effects take place. + sSectorModifier = GetSectorModifier( this, FACILITY_PERFORMANCE_MOD ); + } + bDivisor = (bDivisor * 100) / sSectorModifier; + } + + // silversurfer: Items can provide a bonus to regeneration, sleeping bags for example. + // They will not provide such bonus if the merc is already using a bed in a facility. + if ( GetSoldierFacilityAssignmentIndex( this ) != FAC_PATIENT && GetSoldierFacilityAssignmentIndex( this ) != FAC_REST ) + { + bDivisor = (bDivisor * 100) / (100 + GetInventorySleepModifier( this )); + } + + // silversurfer: I moved all modifiers above this point because we don't want anybody to rest faster or slower than the already extreme thresholds. + // Re-enforce limits + bDivisor = __min( 18, __max( 3, bDivisor ) ); + + // round up so the bonuses above make more sense + bMaxBreathRegain = (50 / bDivisor + 0.5); + + // Limit so that characters can't regain faster than 3 hours, ever + if ( bMaxBreathRegain > 17 ) + { + bMaxBreathRegain = 17; + } + + // if breath max is below the "really tired" threshold + if ( this->bBreathMax < BREATHMAX_PRETTY_TIRED ) + { + // real tired, rest rate is 50% higher (this is to prevent absurdly long sleep times for totally exhausted mercs) + bMaxBreathRegain = (UINT8)(bMaxBreathRegain * 3 / 2); + } + + return bMaxBreathRegain; +} + INT32 CheckBleeding( SOLDIERTYPE *pSoldier ) { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 2c87c17ba..754b8b0b6 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1868,9 +1868,13 @@ public: FLOAT GetDiseaseMagnitude( UINT8 aDisease ); // get the magnitude os a disease we might have, used to determine wether there are any effects void PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc = FALSE ); void PrintFoodDesc( CHAR16* apStr, BOOLEAN fFullDesc = FALSE ); + void PrintSleepDesc( CHAR16* apStr ); FLOAT GetDiseaseContactProtection(); // get percentage protection from infections via contact INT16 GetDiseaseResistance(); + // Flugente: hourly breath regen calculation + INT8 GetSleepBreathRegeneration(); + ////////////////////////////////////////////////////////////////////////////// }; // SOLDIERTYPE; diff --git a/Utils/Text.h b/Utils/Text.h index db9c531cf..72b185622 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -1853,6 +1853,8 @@ enum STR_AR_TANK_NAME, + STR_BREATH_REGEN_SLEEP, + TEXT_NUM_STRATEGIC_TEXT }; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 12584c8e3..dd4659b50 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -2851,6 +2851,8 @@ STR16 gpStrategicString[] = L"War room isn't staffed - militia move aborted!", L"Tank", //STR_AR_TANK_NAME, + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index a5936d058..b69996a17 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -2848,6 +2848,8 @@ STR16 gpStrategicString[] = L"War room isn't staffed - militia move aborted!", L"Tank", //STR_AR_TANK_NAME, + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] = diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index e7f338443..c9de7e286 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -2851,6 +2851,8 @@ STR16 gpStrategicString[] = L"War room isn't staffed - militia move aborted!", L"Tank", //STR_AR_TANK_NAME, + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 3cd16c952..0f71a519a 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -2857,6 +2857,8 @@ STR16 gpStrategicString[] = L"La salle d'opérations n'est pas ouverte... Le mouvement de la milice a avorté !", L"Tank", //STR_AR_TANK_NAME, // TODO.Translate + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] = diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 55f621eda..0cd74b8ec 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -2860,6 +2860,8 @@ STR16 gpStrategicString[] = L"War room isn't staffed - militia move aborted!", L"Panzer", //STR_AR_TANK_NAME, + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index f37fee85a..090949a04 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -2844,6 +2844,8 @@ STR16 gpStrategicString[] = L"War room isn't staffed - militia move aborted!", L"Tank", //STR_AR_TANK_NAME, + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] = diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index eecd57697..cd3bd15a6 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2859,6 +2859,8 @@ STR16 gpStrategicString[] = L"War room isn't staffed - militia move aborted!", L"Tank", //STR_AR_TANK_NAME, + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] = diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 929977c88..33ab0b683 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -2849,6 +2849,8 @@ STR16 gpStrategicString[] = L"War room isn't staffed - militia move aborted!", L"Tank", //STR_AR_TANK_NAME, + + L"\nBreath regeneration per hour: %d", // STR_BREATH_REGEN_SLEEP }; STR16 gpGameClockString[] =