diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 675d0b0a..688e7e09 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -2290,13 +2290,13 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // Flugente: food system - symbols used if hungry or thirsty if ( gGameOptions.fFoodSystem ) { - if ( MercPtrs[ pFace->ubSoldierID ]->bDrinkLevel < FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold ) + if ( MercPtrs[ pFace->ubSoldierID ]->bDrinkLevel < FoodMoraleMods[FOOD_MERC_START_SHOW_HUNGER_SYMBOL].bThreshold ) { DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 19 ); bNumRightIcons++; } - if ( MercPtrs[ pFace->ubSoldierID ]->bFoodLevel < FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold ) + if ( MercPtrs[ pFace->ubSoldierID ]->bFoodLevel < FoodMoraleMods[FOOD_MERC_START_SHOW_HUNGER_SYMBOL].bThreshold ) { DoRightIcon( uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 20 ); bNumRightIcons++; diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index f39190cc..82fad660 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -731,8 +731,15 @@ UINT8 GetWaterQuality(INT16 asMapX, INT16 asMapY, INT8 asMapZ) // a function that tries to fill up all canteens in this sector void SectorFillCanteens( void ) { + if ( !gGameOptions.fFoodSystem ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"SectorFillCanteen not possible, Food System is off!" ); + return; + } + // no functionality if not in tactical or in combat, or nobody is here - if ( guiCurrentScreen != GAME_SCREEN || (gTacticalStatus.uiFlags & INCOMBAT) || gusSelectedSoldier == NOBODY ) + // can be called from a messagebox, thus the check for MSG_BOX_SCREEN + if ( (guiCurrentScreen != GAME_SCREEN && guiCurrentScreen != MSG_BOX_SCREEN) || (gTacticalStatus.uiFlags & INCOMBAT) || gusSelectedSoldier == NOBODY ) return; // determine if there are any patches of water in this sector. diff --git a/Tactical/Food.h b/Tactical/Food.h index 01cdbed7..afa0126a 100644 --- a/Tactical/Food.h +++ b/Tactical/Food.h @@ -33,9 +33,10 @@ typedef enum NUM_FOOD_MORALE_TYPES } FoodMoraleModType; -#define FOOD_MERC_START_CONSUME FOOD_EVEN_LOWER -#define FOOD_MERC_STOP_FACILITY FOOD_FULL -#define FOOD_MERC_REFUSAL FOOD_VERY_FULL +#define FOOD_MERC_START_CONSUME FOOD_LOW +#define FOOD_MERC_START_SHOW_HUNGER_SYMBOL FOOD_EVEN_LOWER +#define FOOD_MERC_STOP_FACILITY FOOD_FULL +#define FOOD_MERC_REFUSAL FOOD_VERY_FULL typedef struct { diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index ad90e1db..6e547994 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -66,6 +66,7 @@ #include "Morale.h" // added by Flugente #include "drugs and alcohol.h" + #include "Food.h" #endif #ifdef JA2UB @@ -99,6 +100,7 @@ static INT32 gsTempGridNo; static INT8 bTempFrequency; void BombMessageBoxCallBack( UINT8 ubExitValue ); +void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue ); // Flugente: callback after deciding what tactical function to use void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ); void SwitchMessageBoxCallBack( UINT8 ubExitValue ); void BoobyTrapDialogueCallBack( void ); @@ -128,6 +130,8 @@ INT8 gbTrapDifficulty; BOOLEAN gfJustFoundBoobyTrap = FALSE; void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo ); +void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel ); // added by Flugente +void CleanWeapons(); BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, INT32 sTargetGridNo , INT8 bLevel ) { @@ -1636,6 +1640,13 @@ void HandleSoldierUseRemote( SOLDIERTYPE *pSoldier, INT32 sGridNo ) StartBombMessageBox( pSoldier, sGridNo ); } +void HandleTacticalFunctionSelection( SOLDIERTYPE *pSoldier, INT32 sGridNo ) +{ + if ( guiCurrentScreen == GAME_SCREEN ) + StartTacticalFunctionSelectionMessageBox( pSoldier, sGridNo, pSoldier->pathing.bLevel ); +} + + void SoldierHandleDropItem( SOLDIERTYPE *pSoldier ) { // LOOK IN PANDING DATA FOR ITEM TO DROP, AND LOCATION @@ -4485,6 +4496,58 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo ) } } +// Flugente +void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel ) +{ + if ( !pSoldier ) + return; + + gpTempSoldier = pSoldier; + gsTempGridNo = sGridNo; + + DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ FUNCTION_SELECTION_STR ], GAME_SCREEN, MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, TacticalFunctionSelectionMessageBoxCallBack, NULL ); +} + +void CleanWeapons() +{ + if ( !gGameExternalOptions.fDirtSystem ) + return; + + // no functionality if not in tactical or in combat, or nobody is here + if ( (guiCurrentScreen != GAME_SCREEN && guiCurrentScreen != MSG_BOX_SCREEN) || (gTacticalStatus.uiFlags & INCOMBAT) ) + return; + + // if in turnbased mode, perform this action only for the selected merc, and use up APs + if ( gTacticalStatus.uiFlags & TURNBASED ) + { + if ( gusSelectedSoldier == NOBODY ) + return; + + SOLDIERTYPE* pSoldier = MercPtrs[ gusSelectedSoldier ]; + + if ( pSoldier->bActive ) + pSoldier->CleanWeapon(); + } + else // peform action for every merc in this sector + { + UINT8 bMercID, bLastTeamID; + SOLDIERTYPE* pSoldier = NULL; + + bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + + // loop through all mercs + for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID, ++pSoldier ) + { + //if the merc is in this sector + if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bInSector && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) + { + pSoldier->CleanWeapon(); + } + } + } +} + void BombMessageBoxCallBack( UINT8 ubExitValue ) { if (gpTempSoldier) @@ -4578,9 +4641,31 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) } } } - } +// Flugente: callback after deciding what tactical function to use +void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue ) +{ + if (gpTempSoldier) + { + INT32 nextGridNoinSight = gpTempSoldier->sGridNo; + nextGridNoinSight = NewGridNo( nextGridNoinSight, DirectionInc( gpTempSoldier->ubDirection ) ); + + INT8 level = gpTempSoldier->bTargetLevel; + + switch (ubExitValue) + { + case 1: + SectorFillCanteens(); + break; + case 2: + CleanWeapons(); + break; + default: + break; + } + } +} BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot ) { diff --git a/Tactical/Handle Items.h b/Tactical/Handle Items.h index f5960f62..09d0d25a 100644 --- a/Tactical/Handle Items.h +++ b/Tactical/Handle Items.h @@ -133,6 +133,8 @@ BOOLEAN DoesItemPoolContainAllHiddenItems( ITEM_POOL *pItemPool ); void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ); void HandleSoldierUseRemote( SOLDIERTYPE *pSoldier, INT32 sGridNo ); +void HandleTacticalFunctionSelection( SOLDIERTYPE *pSoldier, INT32 sGridNo ); // Flugente: in tactical, open a selection box for different actions + BOOLEAN ItemPoolOKForDisplay( ITEM_POOL *pItemPool, INT8 bZLevel ); INT16 GetNumOkForDisplayItemsInPool( ITEM_POOL *pItemPool, INT8 bZLevel ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index e1769636..106846a1 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -14334,7 +14334,7 @@ void SOLDIERTYPE::CleanWeapon() // in turnbased, this action costs APs. remove them if possible, otherwise, return INT16 apcost = APBPConstants[AP_FORTIFICATION]; - if ( gTacticalStatus.uiFlags & INCOMBAT ) + if ( gTacticalStatus.uiFlags & TURNBASED ) { if ( !EnoughPoints( this, apcost, 0, TRUE ) ) return; @@ -14373,7 +14373,7 @@ void SOLDIERTYPE::CleanWeapon() if ( Random(2) > 0 ) UseKitPoints( pCleaningKit, 1, this ); - if ( gTacticalStatus.uiFlags & INCOMBAT ) + if ( gTacticalStatus.uiFlags & TURNBASED ) { // use up APs DeductPoints( this, apcost, 0, AFTERACTION_INTERRUPT ); diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 466d4a2c..0a04fe6d 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -122,7 +122,6 @@ #include "IMP Skill Trait.h" // added by Flugente -#include "Food.h" // added by Flugente //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -225,7 +224,6 @@ void ToggleZBuffer(); void TogglePlanningMode(); void SetBurstMode(); void SetScopeMode( INT32 usMapPos ); -void CleanWeapons(); void ObliterateSector(); void RandomizeMercProfile(); void CreateNextCivType(); @@ -4459,12 +4457,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) case '.': if ( fCtrl ) { - SectorFillCanteens(); + if ( gusSelectedSoldier != NOBODY ) + { + HandleTacticalFunctionSelection(MercPtrs[ gusSelectedSoldier ], usMapPos ); + } } else if ( fAlt ) { - CleanWeapons(); - /*// Flugente: spawn items while debugging if ( gusSelectedSoldier != NOBODY ) { @@ -5279,46 +5278,6 @@ void SetScopeMode( INT32 usMapPos ) } } -void CleanWeapons() -{ - if ( !gGameExternalOptions.fDirtSystem ) - return; - - // no functionality if not in tactical or in combat, or nobody is here - if ( guiCurrentScreen != GAME_SCREEN || (gTacticalStatus.uiFlags & INCOMBAT) ) - return; - - // if in turnbased mode, perform this action only for the selected merc, and use up APs - if ( gTacticalStatus.uiFlags & TURNBASED ) - { - if ( gusSelectedSoldier == NOBODY ) - return; - - SOLDIERTYPE* pSoldier = MercPtrs[ gusSelectedSoldier ]; - - if ( pSoldier->bActive ) - pSoldier->CleanWeapon(); - } - else // peform action for every merc in this sector - { - UINT8 bMercID, bLastTeamID; - SOLDIERTYPE* pSoldier = NULL; - - bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - - // loop through all mercs - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID, ++pSoldier ) - { - //if the merc is in this sector - if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bInSector && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) - { - pSoldier->CleanWeapon(); - } - } - } -} - void ObliterateSector() { INT32 cnt; diff --git a/Utils/Text.h b/Utils/Text.h index 006ac78c..459a5ea6 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -817,6 +817,8 @@ enum MERC_VITAL_STATS_WITH_POISON_POPUPTEXT, MERC_VITAL_STATS_WITH_FOOD_POPUPTEXT, MERC_VITAL_STATS_WITH_POISON_AND_FOOD_POPUPTEXT, + + FUNCTION_SELECTION_STR, TEXT_NUM_TACTICAL_STR }; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 42a92c4d..acacede4 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -2933,6 +2933,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"生命: %d/%d\n精力: %d/%d\n士气: %s\n口渴: %d%s\n饥饿: %d%s", L"生命: %d/%d\n毒性: %d/%d\n精力: %d/%d\n士气: %s\n口渴: %d%s\n饥饿: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 87af13ac..a85f9d87 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -2930,6 +2930,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 8ed8fd6a..2e113d59 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -2932,7 +2932,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", - L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 1336a110..2651cfde 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -2932,6 +2932,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index b5e649e5..ad6722ca 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -2936,6 +2936,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Gesundheit: %d/%d\nAusdauer: %d/%d\nMoral: %s\nWasser: %d%s\nEssen: %d%s", L"Ges.: %d/%d\nGift: %d/%d\nAusd.: %d/%d\nMoral: %s\nWasser: %d%s\nEssen: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 04a3a7f0..710324d7 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -2925,6 +2925,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index f95786a4..1229166f 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2940,6 +2940,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 1a1fc4a9..7eb80b7f 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -2933,6 +2933,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index f0de3a4c..48da1368 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -2934,6 +2934,9 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = // added by Flugente to display food status L"Health: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", + + // added by Flugente: selection of a function to call in tactical + L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.