mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
New feature: food system requires mercs to eat and drink in order to survive
- food and water levels are lowered every hour, eat food to survive - not doing so leads to various penalties and ultimately death - added food items for that purpose. Food can degrade over time. Rotten food poisons. - Mercs automatically consume food if hungry/thirsty and food is in their inventories - for more info, see http://www.bears-pit.com/board/ubbthreads.php/topics/307396/Re_Mercs_need_food_and_water_t.html#Post307396 - this feature requires new STI files from the GameDir trunk. - added a bunch of filler variable to the soldier type, so hopefully savegame compatibility can be maintained easier in the future. WARNING: This will break savegame compatibility git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5411 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+72
-18
@@ -63,6 +63,7 @@
|
||||
// added by SANDRO
|
||||
#include "AIInternals.h"
|
||||
#include "Morale.h"
|
||||
#include "Food.h"
|
||||
#endif
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
@@ -354,7 +355,7 @@ void UpdatePatientsWhoAreDoneHealing( void );
|
||||
UINT8 GetMinHealingSkillNeeded( SOLDIERTYPE *pPatient );
|
||||
|
||||
// heal patient, given doctor and total healing pts available to doctor at this time
|
||||
UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundredthsHealed );
|
||||
UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHealAmount );
|
||||
|
||||
// can item be repaired?
|
||||
BOOLEAN IsItemRepairable( UINT16 usItem, INT16 bStatus );
|
||||
@@ -1118,10 +1119,17 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
// SANDRO - added check if having damaged stat
|
||||
for ( UINT8 i = 0; i < NUM_DAMAGABLE_STATS; i++)
|
||||
for ( UINT8 i = 0; i < NUM_DAMAGABLE_STATS; ++i)
|
||||
{
|
||||
if ( pSoldier->ubCriticalStatDamage[i] > 0 )
|
||||
return ( TRUE );
|
||||
|
||||
// Flugente: stats can also be damaged
|
||||
if ( !gGameOptions.fFoodSystem || ( gGameOptions.fFoodSystem && pSoldier->bFoodLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold ) )
|
||||
{
|
||||
if ( pSoldier->usStarveDamageHealth > 0 || pSoldier->usStarveDamageStrength > 0 )
|
||||
return ( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: check if poisoned
|
||||
@@ -2451,6 +2459,10 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts,
|
||||
// adjust for fatigue
|
||||
ReducePointsForFatigue( pDoctor, &usHealPts );
|
||||
|
||||
// Flugente: our food situation influences our effectiveness
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
ReducePointsForHunger( pDoctor, &usHealPts );
|
||||
|
||||
// count how much medical supplies we have
|
||||
usKitPts = 100 * TotalMedicalKitPoints( pDoctor );
|
||||
|
||||
@@ -2537,6 +2549,9 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
|
||||
// adjust for fatigue
|
||||
ReducePointsForFatigue( pSoldier, &usRepairPts );
|
||||
|
||||
// Flugente: our food situation influences our effectiveness
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
ReducePointsForHunger( pSoldier, &usRepairPts );
|
||||
|
||||
// figure out what shape his "equipment" is in ("coming" in JA3: Viagra - improves the "shape" your "equipment" is in)
|
||||
usKitPts = ToolKitPoints( pSoldier );
|
||||
@@ -2680,10 +2695,17 @@ void UpdatePatientsWhoAreDoneHealing( void )
|
||||
if( ( pTeamSoldier->bAssignment == PATIENT ) &&( pTeamSoldier->stats.bLife == pTeamSoldier->stats.bLifeMax ) && ( pTeamSoldier->bPoisonSum == 0 ) )
|
||||
{
|
||||
// SANDRO - added check if we can help to heal lost stats to this one
|
||||
for (UINT8 cnt = 0; cnt < NUM_DAMAGABLE_STATS; cnt++)
|
||||
for (UINT8 cnt = 0; cnt < NUM_DAMAGABLE_STATS; ++cnt)
|
||||
{
|
||||
if (pTeamSoldier->ubCriticalStatDamage[cnt] > 0 )
|
||||
fHasDamagedStat = TRUE;
|
||||
|
||||
// Flugente: stats can also be damaged
|
||||
if ( !gGameOptions.fFoodSystem || ( gGameOptions.fFoodSystem && pSoldier->bFoodLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold ) )
|
||||
{
|
||||
if ( pSoldier->usStarveDamageHealth > 0 || pSoldier->usStarveDamageStrength > 0 )
|
||||
fHasDamagedStat = TRUE;
|
||||
}
|
||||
}
|
||||
if (!fHasDamagedStat )// || !DoctorIsPresent( pTeamSoldier, TRUE ))
|
||||
AssignmentDone( pTeamSoldier, TRUE, TRUE );
|
||||
@@ -2988,13 +3010,14 @@ UINT8 GetMinHealingSkillNeeded( SOLDIERTYPE *pPatient )
|
||||
}
|
||||
|
||||
|
||||
UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundredthsHealed )
|
||||
UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHealAmount )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// SANDRO - this whole procedure was heavily changed
|
||||
////////////////////////////////////////////////////
|
||||
UINT16 usHealingPtsLeft = 0;
|
||||
UINT16 usTotalHundredthsUsed = 0;
|
||||
UINT16 usHundredthsHealed = 0;
|
||||
INT16 sPointsToUse = 0;
|
||||
INT8 bPointsHealed = 0;
|
||||
INT8 bMedFactor = 1; // basic medical factor
|
||||
@@ -3004,7 +3027,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr
|
||||
UINT16 ubReturnDamagedStatRate = 0;
|
||||
|
||||
// usPointsLeftToCurePoison will measure how much Hundreths will be left to cure poison
|
||||
INT16 usPointsLeftToCurePoison = usHundredthsHealed;
|
||||
INT16 usPointsLeftToCurePoison = usHealAmount;
|
||||
|
||||
// Look how much life do we need to heal
|
||||
sPointsToUse = ( pPatient->stats.bLifeMax - pPatient->stats.bLife );
|
||||
@@ -3029,7 +3052,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr
|
||||
if ( sPointsToUse > 0 && ( fWillHealLife || fWillRepiarStats ))
|
||||
{
|
||||
// here is our maximum, we can heal this time
|
||||
usHealingPtsLeft = max( 1, ((pPatient->sFractLife + usHundredthsHealed) / 100));
|
||||
usHealingPtsLeft = max( 1, ((pPatient->sFractLife + usHealAmount) / 100));
|
||||
|
||||
// if guy is hurt more than points we have...heal only what we have
|
||||
if( sPointsToUse > usHealingPtsLeft )
|
||||
@@ -3075,12 +3098,19 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr
|
||||
{
|
||||
pPatient->sFractLife += usTotalHundredthsUsed;
|
||||
fWillHealLife = FALSE;
|
||||
usHundredthsHealed = usTotalHundredthsUsed;
|
||||
}
|
||||
// if we would heal more than we need
|
||||
else if ( !fWillRepiarStats && (pPatient->stats.bLifeMax < pPatient->stats.bLife + bPointsHealed) )
|
||||
{
|
||||
usHundredthsHealed = max( 1, (usHundredthsHealed - usTotalHundredthsUsed));
|
||||
usHundredthsHealed = max( 1, (usHealAmount - usTotalHundredthsUsed));
|
||||
}
|
||||
else
|
||||
{
|
||||
usHundredthsHealed = usHealAmount;
|
||||
}
|
||||
|
||||
usHealAmount = max(0, usHealAmount - usHundredthsHealed);
|
||||
}
|
||||
|
||||
// repair our stats here!!
|
||||
@@ -3098,11 +3128,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr
|
||||
usTotalHundredthsUsed -= ((usTotalHundredthsUsed * gSkillTraitValues.ubDOHealingPenaltyIfAlsoStatRepair ) / 100);
|
||||
}
|
||||
}
|
||||
|
||||
// we have to remember what will be left over to cure poison
|
||||
//usPointsLeftToCurePoison = min(usHundredthsHealed, usPointsLeftToCurePoison - usTotalHundredthsUsed);
|
||||
//usPointsLeftToCurePoison = max(usPointsLeftToCurePoison, 0); // do not go below zero
|
||||
|
||||
|
||||
// if we are actually here to heal life
|
||||
if ( fWillHealLife )
|
||||
{
|
||||
@@ -3170,7 +3196,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr
|
||||
if ( pPatient->bPoisonSum > 0 || pPatient->sFractLife < 0 )
|
||||
{
|
||||
if ( fWillHealLife || fWillRepiarStats )
|
||||
usPointsLeftToCurePoison = max(0, usPointsLeftToCurePoison - usHundredthsHealed);
|
||||
usPointsLeftToCurePoison = max(0, usPointsLeftToCurePoison - usHealAmount);
|
||||
|
||||
if ( usPointsLeftToCurePoison > 0 )
|
||||
{
|
||||
@@ -3186,10 +3212,11 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr
|
||||
{
|
||||
UINT16 usTotalHundredthsUsedToCurePoison = 0;
|
||||
// if having enough, no problem
|
||||
if (usTotalMedPointsLeft >= (usPoisontoCure * bMedFactor))
|
||||
// gGameExternalOptions.sPoisonMedicalPtsToCureMultiplicator alters the amount needed for curing poison
|
||||
if (usTotalMedPointsLeft >= ( (UINT16)(gGameExternalOptions.sPoisonMedicalPtsToCureMultiplicator * usPoisontoCure * bMedFactor)))
|
||||
{
|
||||
usTotalHundredthsUsedToCurePoison = usPoisontoCure * 100;
|
||||
usTotalMedPointsLeft = (usPoisontoCure * bMedFactor);
|
||||
usTotalMedPointsLeft = ( (UINT16)(gGameExternalOptions.sPoisonMedicalPtsToCureMultiplicator * usPoisontoCure * bMedFactor));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3198,9 +3225,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHundr
|
||||
}
|
||||
|
||||
pPatient->sFractLife += usTotalHundredthsUsedToCurePoison;
|
||||
|
||||
// modify usHundredthsHealed?
|
||||
//usHundredthsHealed += usTotalHundredthsUsedToCurePoison;
|
||||
usHundredthsHealed += (UINT16)(usTotalHundredthsUsedToCurePoison * gGameExternalOptions.sPoisonMedicalPtsToCureMultiplicator);
|
||||
|
||||
if (pPatient->sFractLife >= 100)
|
||||
{
|
||||
@@ -4884,6 +4909,11 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE
|
||||
// adjust for instructor fatigue
|
||||
UINT32 uiTrainingPts = (UINT32) sTrainingPts;
|
||||
ReducePointsForFatigue( pInstructor, &uiTrainingPts );
|
||||
|
||||
// Flugente: our food situation influences our effectiveness
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
ReducePointsForHunger( pInstructor, &uiTrainingPts );
|
||||
|
||||
sTrainingPts = (INT16)uiTrainingPts;
|
||||
|
||||
return( sTrainingPts );
|
||||
@@ -4998,6 +5028,11 @@ INT16 GetSoldierTrainingPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, UINT16 *pus
|
||||
// adjust for fatigue
|
||||
UINT32 uiTrainingPts = (UINT32) sTrainingPts;
|
||||
ReducePointsForFatigue( pSoldier, &uiTrainingPts );
|
||||
|
||||
// Flugente: our food situation influences our effectiveness
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
ReducePointsForHunger( pSoldier, &uiTrainingPts );
|
||||
|
||||
sTrainingPts = (INT16)uiTrainingPts;
|
||||
|
||||
return( sTrainingPts );
|
||||
@@ -5116,6 +5151,11 @@ INT16 GetSoldierStudentPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, UINT16 *pusM
|
||||
// adjust for fatigue
|
||||
UINT32 uiTrainingPts = (UINT32) sTrainingPts;
|
||||
ReducePointsForFatigue( pSoldier, &uiTrainingPts );
|
||||
|
||||
// Flugente: our food situation influences our effectiveness
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
ReducePointsForHunger( pSoldier, &uiTrainingPts );
|
||||
|
||||
sTrainingPts = (INT16)uiTrainingPts;
|
||||
|
||||
|
||||
@@ -5386,6 +5426,11 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts )
|
||||
// adjust for fatigue of trainer
|
||||
UINT32 uiTrainingPts = (UINT32) sTotalTrainingPts;
|
||||
ReducePointsForFatigue( pTrainer, &uiTrainingPts );
|
||||
|
||||
// Flugente: our food situation influences our effectiveness
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
ReducePointsForHunger( pTrainer, &uiTrainingPts );
|
||||
|
||||
sTotalTrainingPts = (INT16)uiTrainingPts;
|
||||
|
||||
|
||||
@@ -13160,6 +13205,10 @@ UINT8 CalcSoldierNeedForSleep( SOLDIERTYPE *pSoldier )
|
||||
ubNeedForSleep -= NUM_SKILL_TRAITS( pSoldier, MARTIALARTS_OT );
|
||||
}
|
||||
|
||||
// Flugente: ubNeedForSleep can now be influenced by our food situation
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
FoodNeedForSleepModifiy(pSoldier, &ubNeedForSleep);
|
||||
|
||||
return( ubNeedForSleep );
|
||||
}
|
||||
|
||||
@@ -16088,6 +16137,9 @@ void FacilityAssignmentMenuBtnCallback ( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
case FAC_STAFF:
|
||||
ChangeSoldiersAssignment( pSoldier, FACILITY_STAFF );
|
||||
break;
|
||||
case FAC_FOOD:
|
||||
ChangeSoldiersAssignment( pSoldier, FACILITY_EAT );
|
||||
break;
|
||||
case FAC_REST:
|
||||
ChangeSoldiersAssignment( pSoldier, FACILITY_REST );
|
||||
break;
|
||||
@@ -16227,6 +16279,8 @@ void FacilityAssignmentMenuBtnCallback ( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
|
||||
}
|
||||
|
||||
// Flugente: I guess this piece of code is here to get a group Id for the soldier, which must not be there for movement specifically. Just my understanding, in case anybody else coming here wonders
|
||||
// why we get movement related stuff when we were jsut ordered to stay in a facility
|
||||
AssignMercToAMovementGroup( pSoldier );
|
||||
MakeSoldiersTacticalAnimationReflectAssignment( pSoldier );
|
||||
|
||||
|
||||
@@ -62,12 +62,13 @@ enum
|
||||
TRAIN_TEAMMATE,
|
||||
TRAIN_BY_OTHER,
|
||||
FACILITY_STAFF, // HEADROCK HAM 3.6: Operating a facility for strategic gain.
|
||||
FACILITY_EAT, // added by Flugente
|
||||
FACILITY_REST, // HEADROCK HAM 3.6: Facility equivalent of resting (no assignment)
|
||||
ASSIGNMENT_DEAD,
|
||||
ASSIGNMENT_UNCONCIOUS, // unused
|
||||
ASSIGNMENT_POW,
|
||||
ASSIGNMENT_HOSPITAL,
|
||||
ASSIGNMENT_EMPTY,
|
||||
ASSIGNMENT_EMPTY,
|
||||
NUM_ASSIGNMENTS,
|
||||
};
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ enum
|
||||
// Enumerate the different assignments that a facility can emulate.
|
||||
FAC_AMBIENT = 0,
|
||||
FAC_STAFF,
|
||||
FAC_FOOD,
|
||||
FAC_REST,
|
||||
FAC_REPAIR_ITEMS,
|
||||
FAC_REPAIR_VEHICLE,
|
||||
@@ -180,7 +181,7 @@ enum
|
||||
FAC_TRAINER_MEDICAL,
|
||||
FAC_TRAINER_MECHANICAL,
|
||||
FAC_TRAINER_LEADERSHIP,
|
||||
FAC_TRAINER_EXPLOSIVES,
|
||||
FAC_TRAINER_EXPLOSIVES,
|
||||
NUM_FACILITY_ASSIGNMENTS,
|
||||
};
|
||||
|
||||
@@ -247,6 +248,7 @@ typedef struct FACILITYASSIGNMENTTYPE
|
||||
INT16 sSkyriderCostModifier; // Flat modifier for Skyrider's Cost Per Tile
|
||||
UINT16 usMineIncomeModifier; // Percentage income adjustment
|
||||
BOOLEAN fOnlyLocalMineAffected; // Determines whether income modifier applies to local mine only, or all mines.
|
||||
INT16 sCantinaFoodModifier; // how many food points do we get when spending time in a cantina?
|
||||
|
||||
UINT8 ubMinimumStrength; // Minimum STR Requirement to begin this assignment
|
||||
UINT8 ubMinimumHealth; // Minimum HLT Requirement to begin this assignment
|
||||
|
||||
@@ -141,6 +141,12 @@ INT16 GetFacilityModifier( UINT8 ubModifierType, UINT8 ubFacilityType, UINT8 ubA
|
||||
sAssignmentModifier = 100 + ((sAssignmentModifier-100) + (sAmbientModifier-100));
|
||||
return (sAssignmentModifier);
|
||||
|
||||
case FACILITY_CANTINA_MOD:
|
||||
sAssignmentModifier = gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].sCantinaFoodModifier;
|
||||
sAmbientModifier = gFacilityTypes[ubFacilityType].AssignmentData[0].sCantinaFoodModifier;
|
||||
sAssignmentModifier = 100 + ((sAssignmentModifier-100) + (sAmbientModifier-100));
|
||||
return (sAssignmentModifier);
|
||||
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
@@ -894,6 +900,9 @@ INT8 GetSoldierFacilityAssignmentIndex( SOLDIERTYPE *pSoldier )
|
||||
case FACILITY_STAFF:
|
||||
bAssignmentIndex = FAC_STAFF;
|
||||
break;
|
||||
case FACILITY_EAT:
|
||||
bAssignmentIndex = FAC_FOOD;
|
||||
break;
|
||||
case FACILITY_REST:
|
||||
bAssignmentIndex = FAC_REST;
|
||||
break;
|
||||
|
||||
@@ -46,6 +46,8 @@ enum
|
||||
|
||||
FACILITY_MINE_INCOME_MOD,
|
||||
FACILITY_SKYRIDER_COST_MOD,
|
||||
|
||||
FACILITY_CANTINA_MOD
|
||||
};
|
||||
|
||||
// HEADROCK HAM 3.6: Different enemy detection and counting levels
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Text.h"
|
||||
// HEADROCK HAM 3.5: Add facility code for hourly update of detection levels
|
||||
#include "Facilities.h"
|
||||
#include "Food.h" // added by Flugente
|
||||
|
||||
void HourlyQuestUpdate( void );
|
||||
void HourlyLarryUpdate( void );
|
||||
@@ -65,6 +66,10 @@ CHAR16 zString[128];
|
||||
// hourly update of town loyalty
|
||||
HandleTownLoyalty();
|
||||
|
||||
// Flugente: food update
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
HourlyFoodUpdate();
|
||||
|
||||
// hourly update of team assignments
|
||||
UpdateAssignments();
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "SaveLoadGame.h"//dnl ch51 081009
|
||||
#include "Map Information.h"//dnl ch51 091009
|
||||
#include "Interface Items.h"
|
||||
#include "Food.h" // added by Flugente
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
@@ -290,6 +291,8 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2);
|
||||
void SortSectorInventory( std::vector<WORLDITEM>& pInventory, UINT32 uiSizeOfArray );
|
||||
BOOLEAN CanPlayerUseSectorInventory( SOLDIERTYPE *pSelectedSoldier );
|
||||
|
||||
void BuildStashForSelectedSectorAndDecayFood( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); // Flugente: for food decay
|
||||
|
||||
extern void MAPEndItemPointer( );
|
||||
extern BOOLEAN GetCurrentBattleSectorXYZAndReturnTRUEIfThereIsABattle( INT16 *psSectorX, INT16 *psSectorY, INT16 *psSectorZ );
|
||||
extern BOOLEAN MAPInternalInitItemDescriptionBox( OBJECTTYPE *pObject, UINT8 ubStatusIndex, SOLDIERTYPE *pSoldier );
|
||||
@@ -5019,4 +5022,53 @@ void HandleSetFilterButtons()
|
||||
{
|
||||
ButtonList[guiMapInvenFilterButton[ 8 ]]->uiFlags &=~ (BUTTON_CLICKED_ON);
|
||||
}
|
||||
}
|
||||
|
||||
void BuildStashForSelectedSectorAndDecayFood( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
|
||||
{
|
||||
UINT32 uiTotalNumberOfRealItems = 0;
|
||||
WORLDITEM * pTotalSectorList = NULL;
|
||||
|
||||
// #ifdef _DEBUG
|
||||
BOOLEAN fReturn = TRUE;
|
||||
// #endif
|
||||
|
||||
// now load these items into memory, based on fact if sector is in fact loaded
|
||||
if( ( sMapX == gWorldSectorX )&&( gWorldSectorY == sMapY ) &&(gbWorldSectorZ == sMapZ ) )
|
||||
{
|
||||
fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 )( sMapZ ), &( uiTotalNumberOfRealItems ), FALSE );
|
||||
Assert( fReturn );
|
||||
|
||||
if ( !uiTotalNumberOfRealItems )
|
||||
return;
|
||||
|
||||
pTotalSectorList = gWorldItems;
|
||||
}
|
||||
else
|
||||
{
|
||||
// not loaded, load
|
||||
// get total number, visable and invisible
|
||||
fReturn = GetNumberOfWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 )( sMapZ ), &( uiTotalNumberOfRealItems ), FALSE );
|
||||
Assert( fReturn );
|
||||
|
||||
if( uiTotalNumberOfRealItems > 0 )
|
||||
{
|
||||
// allocate space for the list
|
||||
pTotalSectorList = new WORLDITEM[ uiTotalNumberOfRealItems ];
|
||||
|
||||
if ( !uiTotalNumberOfRealItems )
|
||||
return;
|
||||
|
||||
// now load into mem
|
||||
LoadWorldItemsFromTempItemFile( sMapX, sMapY, ( INT8 ) ( sMapZ ), pTotalSectorList );
|
||||
}
|
||||
}
|
||||
|
||||
//Check to see if any of the items in the list have a gridno of NOWHERE and the entry point flag NOT set
|
||||
//CheckGridNoOfItemsInMapScreenMapInventory();
|
||||
|
||||
SectorFoodDecay( pTotalSectorList, uiTotalNumberOfRealItems );
|
||||
|
||||
//Save the Items to the the file
|
||||
SaveWorldItemsToTempItemFile( sMapX, sMapY, (INT8)sMapZ, uiTotalNumberOfRealItems, pTotalSectorList );
|
||||
}
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "Air Raid.h"
|
||||
#include "Queen Command.h"
|
||||
#include "Render Fun.h"
|
||||
#include "Food.h"
|
||||
#endif
|
||||
|
||||
#include "connect.h"
|
||||
@@ -1973,21 +1974,47 @@ void UpdateCharRegionHelpText( void )
|
||||
// person (health/energy/morale)
|
||||
GetMoraleString( pSoldier, pMoraleStr );
|
||||
|
||||
if ( pSoldier->bPoisonSum )
|
||||
if ( gGameOptions.fFoodSystem )
|
||||
{
|
||||
INT8 bPoisonBandaged = pSoldier->bPoisonSum - pSoldier->bPoisonBleeding - pSoldier->bPoisonLife;
|
||||
swprintf( sString, L"%s: %d/%d, %s: %d/%d/%d - %d, %s: %d/%d, %s: %s",
|
||||
pMapScreenStatusStrings[ 0 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax,
|
||||
pMapScreenStatusStrings[ 5 ], pSoldier->bPoisonBleeding, bPoisonBandaged, pSoldier->bPoisonLife, pSoldier->bPoisonSum,
|
||||
pMapScreenStatusStrings[ 1 ], pSoldier->bBreath, pSoldier->bBreathMax,
|
||||
pMapScreenStatusStrings[ 2 ], pMoraleStr );
|
||||
if ( pSoldier->bPoisonSum )
|
||||
{
|
||||
INT8 bPoisonBandaged = pSoldier->bPoisonSum - pSoldier->bPoisonBleeding - pSoldier->bPoisonLife;
|
||||
swprintf( sString, L"%s: %d/%d, %s: %d/%d/%d - %d, %s: %d/%d, %s: %s, %s: %d%s, %s: %d%s",
|
||||
pMapScreenStatusStrings[ 0 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax,
|
||||
pMapScreenStatusStrings[ 5 ], pSoldier->bPoisonBleeding, bPoisonBandaged, pSoldier->bPoisonLife, pSoldier->bPoisonSum,
|
||||
pMapScreenStatusStrings[ 1 ], pSoldier->bBreath, pSoldier->bBreathMax,
|
||||
pMapScreenStatusStrings[ 2 ], pMoraleStr,
|
||||
pMapScreenStatusStrings[ 6 ], (INT32)(100*pSoldier->bDrinkLevel/FOOD_MAX), L"%",
|
||||
pMapScreenStatusStrings[ 7 ], (INT32)(100*pSoldier->bFoodLevel/FOOD_MAX), L"%" );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sString, L"%s: %d/%d, %s: %d/%d, %s: %s, %s: %d%s, %s: %d%s",
|
||||
pMapScreenStatusStrings[ 0 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax,
|
||||
pMapScreenStatusStrings[ 1 ], pSoldier->bBreath, pSoldier->bBreathMax,
|
||||
pMapScreenStatusStrings[ 2 ], pMoraleStr,
|
||||
pMapScreenStatusStrings[ 6 ], (INT32)(100*pSoldier->bDrinkLevel/FOOD_MAX), L"%",
|
||||
pMapScreenStatusStrings[ 7 ], (INT32)(100*pSoldier->bFoodLevel/FOOD_MAX), L"%" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sString, L"%s: %d/%d, %s: %d/%d, %s: %s",
|
||||
pMapScreenStatusStrings[ 0 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax,
|
||||
pMapScreenStatusStrings[ 1 ], pSoldier->bBreath, pSoldier->bBreathMax,
|
||||
pMapScreenStatusStrings[ 2 ], pMoraleStr );
|
||||
if ( pSoldier->bPoisonSum )
|
||||
{
|
||||
INT8 bPoisonBandaged = pSoldier->bPoisonSum - pSoldier->bPoisonBleeding - pSoldier->bPoisonLife;
|
||||
swprintf( sString, L"%s: %d/%d, %s: %d/%d/%d - %d, %s: %d/%d, %s: %s",
|
||||
pMapScreenStatusStrings[ 0 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax,
|
||||
pMapScreenStatusStrings[ 5 ], pSoldier->bPoisonBleeding, bPoisonBandaged, pSoldier->bPoisonLife, pSoldier->bPoisonSum,
|
||||
pMapScreenStatusStrings[ 1 ], pSoldier->bBreath, pSoldier->bBreathMax,
|
||||
pMapScreenStatusStrings[ 2 ], pMoraleStr );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sString, L"%s: %d/%d, %s: %d/%d, %s: %s",
|
||||
pMapScreenStatusStrings[ 0 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax,
|
||||
pMapScreenStatusStrings[ 1 ], pSoldier->bBreath, pSoldier->bBreathMax,
|
||||
pMapScreenStatusStrings[ 2 ], pMoraleStr );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,8 @@ void InitAssignmentDataArray( facilitytypeParseData *pData )
|
||||
pData->curAssignmentData.usMineIncomeModifier = 100;
|
||||
pData->curAssignmentData.fOnlyLocalMineAffected = 0;
|
||||
|
||||
pData->curAssignmentData.sCantinaFoodModifier = 100;
|
||||
|
||||
pData->curAssignmentData.ubMaximumBreath = 100;
|
||||
pData->curAssignmentData.ubMaximumMorale = 100;
|
||||
|
||||
@@ -217,7 +219,8 @@ facilitytypeStartElementHandle(void *userData, const XML_Char *name, const XML_C
|
||||
strcmp(name, "fCountEnemiesInCities") == 0 ||
|
||||
strcmp(name, "sSkyriderCostModifier") == 0 ||
|
||||
strcmp(name, "usMineIncomeModifier") == 0 ||
|
||||
strcmp(name, "fOnlyLocalMineAffected") == 0 ))
|
||||
strcmp(name, "fOnlyLocalMineAffected") == 0 ||
|
||||
strcmp(name, "sCantinaFoodModifier") == 0 ))
|
||||
{
|
||||
pData->curElement = FACILITYTYPE_ASSIGNMENT_ELEMENT;
|
||||
|
||||
@@ -449,6 +452,8 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].usMineIncomeModifier = pData->curFacilityTypeData.AssignmentData[cnt].usMineIncomeModifier;
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].fOnlyLocalMineAffected = pData->curFacilityTypeData.AssignmentData[cnt].fOnlyLocalMineAffected;
|
||||
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].sCantinaFoodModifier = pData->curFacilityTypeData.AssignmentData[cnt].sCantinaFoodModifier;
|
||||
|
||||
// Conditions
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].ubMinimumStrength = pData->curFacilityTypeData.AssignmentData[cnt].ubMinimumStrength;
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].ubMinimumAgility = pData->curFacilityTypeData.AssignmentData[cnt].ubMinimumAgility;
|
||||
@@ -587,6 +592,8 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].usMineIncomeModifier = pData->curAssignmentData.usMineIncomeModifier;
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].fOnlyLocalMineAffected = pData->curAssignmentData.fOnlyLocalMineAffected;
|
||||
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].sCantinaFoodModifier = pData->curAssignmentData.sCantinaFoodModifier;
|
||||
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].ubMaximumBreath = pData->curAssignmentData.ubMaximumBreath;
|
||||
pData->curFacilityTypeData.AssignmentData[pData->curAssignmentType].ubMaximumMorale = pData->curAssignmentData.ubMaximumMorale;
|
||||
|
||||
@@ -648,6 +655,11 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
//pData->curAssignmentType = (INT16) atol(pData->szCharData);
|
||||
pData->curAssignmentType = FAC_STAFF;
|
||||
}
|
||||
else if (strcmp(pData->szCharData, "FACILITY_EAT") == 0)
|
||||
{
|
||||
//pData->curAssignmentType = (INT16) atol(pData->szCharData);
|
||||
pData->curAssignmentType = FAC_FOOD;
|
||||
}
|
||||
else if (strcmp(pData->szCharData, "REST") == 0)
|
||||
{
|
||||
//pData->curAssignmentType = (INT16) atol(pData->szCharData);
|
||||
@@ -811,7 +823,7 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
//pData->curAssignmentType = (INT16) atol(pData->szCharData);
|
||||
pData->curAssignmentType = FAC_STUDENT_EXPLOSIVES;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CHAR16 sErrorString[256];
|
||||
@@ -930,6 +942,12 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curAssignmentData.fOnlyLocalMineAffected = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
|
||||
else if(strcmp(name, "sCantinaFoodModifier") == 0 )
|
||||
{
|
||||
pData->curElement = FACILITYTYPE_ASSIGNMENT;
|
||||
pData->curAssignmentData.sCantinaFoodModifier = (UINT16) atol(pData->szCharData);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// Conditions for assignment
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
// Four different sector names, used at different times.
|
||||
extern CHAR16 gzSectorNames[256][4][MAX_SECTOR_NAME_LENGTH];
|
||||
|
||||
// Flugente: To determine wether a sector has water in it.
|
||||
extern UINT8 gSectorWaterType[256][4];
|
||||
|
||||
// moved to lua
|
||||
//extern CHAR16 gzSectorUndergroundNames1[256][4][MAX_SECTOR_NAME_LENGTH];
|
||||
//extern CHAR16 gzSectorUndergroundNames2[256][4][MAX_SECTOR_NAME_LENGTH];
|
||||
@@ -42,6 +45,7 @@ typedef struct
|
||||
CHAR16 szCurDetailedUnexploredName[MAX_SECTOR_NAME_LENGTH];
|
||||
CHAR16 szCurExploredName[MAX_SECTOR_NAME_LENGTH];
|
||||
CHAR16 szCurDetailedExploredName[MAX_SECTOR_NAME_LENGTH];
|
||||
UINT8 sWaterType;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
} SectorNameParseData;
|
||||
@@ -66,6 +70,10 @@ SectorNameStartElementHandle(void *userData, const XML_Char *name, const char **
|
||||
// Initiate Array by setting first character to 0.
|
||||
for (UINT16 x = 0; x < 256; x++)
|
||||
{
|
||||
gSectorWaterType[x][0] = 0;
|
||||
gSectorWaterType[x][1] = 0;
|
||||
gSectorWaterType[x][2] = 0;
|
||||
gSectorWaterType[x][3] = 0;
|
||||
|
||||
if (Sector_Level == 0 )
|
||||
{
|
||||
@@ -112,7 +120,8 @@ SectorNameStartElementHandle(void *userData, const XML_Char *name, const char **
|
||||
strcmp(name, "szUnexploredName") == 0 ||
|
||||
strcmp(name, "szDetailedUnexploredName") == 0 ||
|
||||
strcmp(name, "szExploredName") == 0 ||
|
||||
strcmp(name, "szDetailedExploredName") == 0 ))
|
||||
strcmp(name, "szDetailedExploredName") == 0 ||
|
||||
strcmp(name, "sWaterType") == 0 ))
|
||||
{
|
||||
pData->curElement = SECTORNAME_ELEMENT;
|
||||
|
||||
@@ -164,6 +173,11 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
|
||||
wcscpy(gzSectorNames[ubSectorId][1], pData->szCurDetailedUnexploredName);
|
||||
wcscpy(gzSectorNames[ubSectorId][2], pData->szCurExploredName);
|
||||
wcscpy(gzSectorNames[ubSectorId][3], pData->szCurDetailedExploredName);
|
||||
|
||||
gSectorWaterType[ubSectorId][0] = pData->sWaterType;
|
||||
gSectorWaterType[ubSectorId][1] = pData->sWaterType;
|
||||
gSectorWaterType[ubSectorId][2] = pData->sWaterType;
|
||||
gSectorWaterType[ubSectorId][3] = pData->sWaterType;
|
||||
}
|
||||
// moved to lua
|
||||
//else if (Sector_Level == 1 )
|
||||
@@ -196,6 +210,11 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
|
||||
wcscpy(gzSectorNames[ubSectorId][1], pData->szCurDetailedUnexploredName);
|
||||
wcscpy(gzSectorNames[ubSectorId][2], pData->szCurExploredName);
|
||||
wcscpy(gzSectorNames[ubSectorId][3], pData->szCurDetailedExploredName);
|
||||
|
||||
gSectorWaterType[ubSectorId][0] = pData->sWaterType;
|
||||
gSectorWaterType[ubSectorId][1] = pData->sWaterType;
|
||||
gSectorWaterType[ubSectorId][2] = pData->sWaterType;
|
||||
gSectorWaterType[ubSectorId][3] = pData->sWaterType;
|
||||
}
|
||||
// moved to lua
|
||||
//else if (Sector_Level == 1 )
|
||||
@@ -268,6 +287,12 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->szCurDetailedExploredName[sizeof(pData->szCurDetailedExploredName)/sizeof(pData->szCurDetailedExploredName[0]) - 1] = '\0';
|
||||
}
|
||||
|
||||
else if(strcmp(name, "sWaterType") == 0)
|
||||
{
|
||||
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
|
||||
pData->sWaterType = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
|
||||
@@ -2361,7 +2361,7 @@ void DrawCharStats( INT16 sCharNum )
|
||||
swprintf( sString, L"%d", pSoldier->stats.bStrength);
|
||||
|
||||
// SANDRO - if damaged stat we could regain, show in red until repaired
|
||||
if( gGameOptions.fNewTraitSystem && ( pSoldier->ubCriticalStatDamage[DAMAGED_STAT_STRENGTH] > 0 ))
|
||||
if ( ( gGameOptions.fNewTraitSystem && ( pSoldier->ubCriticalStatDamage[DAMAGED_STAT_STRENGTH] > 0 )) || (gGameOptions.fFoodSystem && pSoldier->usStarveDamageStrength > 0) )
|
||||
{
|
||||
SetFontForeground( FONT_RED );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user