- food system: auto consumption now starts at -10% instead of -25%

- Moved key commands: 'Ctrl' + '.' now opens a message box. The commands to fill canteens and to clean weapons can be called from there. In the future, similar commands can be placed here

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5485 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2012-08-20 20:57:07 +00:00
parent a64d8a9323
commit 20b40ed761
17 changed files with 138 additions and 55 deletions
+2 -2
View File
@@ -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++;
+8 -1
View File
@@ -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.
+4 -3
View File
@@ -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
{
+86 -1
View File
@@ -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 )
{
+2
View File
@@ -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 );
+2 -2
View File
@@ -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 );
+4 -45
View File
@@ -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;
+2
View File
@@ -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
};
+3
View File
@@ -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.
+3
View File
@@ -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.
+4 -1
View File
@@ -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.
+3
View File
@@ -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.
+3
View File
@@ -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.
+3
View File
@@ -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.
+3
View File
@@ -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.
+3
View File
@@ -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.
+3
View File
@@ -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.