mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- new icon for ammo belt and ammo vest
- mercs can refuse to eat if they do not like the food (works only once) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5422 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -256,7 +256,7 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject )
|
||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
|
||||
if ( !consumeitem )
|
||||
ApplyFood( pSoldier, pObject );
|
||||
ApplyFood( pSoldier, pObject, TRUE );
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
+33
-10
@@ -58,8 +58,12 @@ FoodMoraleMod FoodMoraleMods[NUM_FOOD_MORALE_TYPES] =
|
||||
};
|
||||
|
||||
|
||||
BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject )
|
||||
BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, BOOLEAN fForce )
|
||||
{
|
||||
// static variables to remember the last food someone was forced to eat
|
||||
static UINT8 lasteater = 0;
|
||||
static UINT16 lastitem = 0;
|
||||
|
||||
// how did this even happen?
|
||||
if ( !pSoldier || !pObject || !(pObject->exists() ) || (*pObject)[0]->data.objectStatus < 1 )
|
||||
return( FALSE);
|
||||
@@ -96,16 +100,28 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject )
|
||||
|
||||
// we have to determine wether the food is rotten, that might influence its condition and poison us
|
||||
FLOAT foodcondition = (*pObject)[0]->data.bTemperature / OVERHEATING_MAX_TEMPERATURE;
|
||||
FLOAT conditionmodifier = 0.5f * (1.0f + sqrt(foodcondition));
|
||||
|
||||
FLOAT percentualsize = min(Food[foodtype].ubPortionSize, (*pObject)[0]->data.objectStatus) / 100.0f;
|
||||
|
||||
INT32 foodpts = (INT32) (Food[foodtype].bFoodPoints * percentualsize * conditionmodifier );
|
||||
INT32 drinkpts = (INT32) (Food[foodtype].bDrinkPoints * percentualsize * conditionmodifier );
|
||||
|
||||
|
||||
// food in bad condition is harmful!
|
||||
if ( foodcondition < FOOD_BAD_THRESHOLD )
|
||||
{
|
||||
// if we can choose to reject a food and haven't yet done so with this type of bad food, do so. Works only once
|
||||
if ( !fForce && ( lasteater != pSoldier->ubID || lastitem != pObject->usItem) )
|
||||
{
|
||||
lasteater = pSoldier->ubID;
|
||||
lastitem = pObject->usItem;
|
||||
|
||||
// notification
|
||||
if ( type == AP_EAT )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s does not want to eat %s", pSoldier->name, Item[pObject->usItem].szItemName );
|
||||
else
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s does not want to drink %s", pSoldier->name, Item[pObject->usItem].szItemName );
|
||||
|
||||
// Say quote!
|
||||
TacticalCharacterDialogue( pSoldier, 61 );
|
||||
|
||||
return( FALSE);
|
||||
}
|
||||
|
||||
// determine the max nutritional value
|
||||
INT32 maxpts = max(Food[foodtype].bFoodPoints, Food[foodtype].bDrinkPoints);
|
||||
|
||||
@@ -116,6 +132,13 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject )
|
||||
pSoldier->AddPoison(poisonadd);
|
||||
}
|
||||
|
||||
FLOAT conditionmodifier = 0.5f * (1.0f + sqrt(foodcondition));
|
||||
|
||||
FLOAT percentualsize = min(Food[foodtype].ubPortionSize, (*pObject)[0]->data.objectStatus) / 100.0f;
|
||||
|
||||
INT32 foodpts = (INT32) (Food[foodtype].bFoodPoints * percentualsize * conditionmodifier );
|
||||
INT32 drinkpts = (INT32) (Food[foodtype].bDrinkPoints * percentualsize * conditionmodifier );
|
||||
|
||||
// eat it!
|
||||
pSoldier->bFoodLevel = min(pSoldier->bFoodLevel + foodpts, FOOD_MAX);
|
||||
pSoldier->bFoodLevel = max(pSoldier->bFoodLevel, FOOD_MIN);
|
||||
@@ -506,7 +529,7 @@ void HourlyFoodAutoDigestion( SOLDIERTYPE *pSoldier )
|
||||
if ( Item[pObj->usItem].drugtype > 0 )
|
||||
ApplyDrugs( pSoldier, pObj );
|
||||
else
|
||||
ApplyFood( pSoldier, pObj );
|
||||
ApplyFood( pSoldier, pObj, TRUE ); // cannot reject to eat this, we chose to eat this ourself!
|
||||
|
||||
// if we're full, finish
|
||||
if ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold )
|
||||
@@ -538,7 +561,7 @@ void HourlyFoodAutoDigestion( SOLDIERTYPE *pSoldier )
|
||||
if ( Item[pObj->usItem].drugtype > 0 )
|
||||
ApplyDrugs( pSoldier, pObj );
|
||||
else
|
||||
ApplyFood( pSoldier, pObj );
|
||||
ApplyFood( pSoldier, pObj, TRUE ); // cannot reject to eat this, we chose to eat this ourself!
|
||||
|
||||
// if we're full, finish
|
||||
if ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold )
|
||||
|
||||
+2
-1
@@ -72,7 +72,8 @@ typedef enum
|
||||
WATER_POISONOUS // there is water, but it is poisoned (swamps and polluted sectors)
|
||||
} FoodSectorWaterSupply;
|
||||
|
||||
BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject );
|
||||
// eat a food object. if fForce = FALSE, the soldier can reject to eat this once
|
||||
BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, BOOLEAN fForce );
|
||||
|
||||
UINT8 GetFoodSituation( SOLDIERTYPE *pSoldier );
|
||||
void FoodMaxMoraleModifiy( SOLDIERTYPE *pSoldier, UINT8* pubMaxMorale );
|
||||
|
||||
@@ -2484,6 +2484,25 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////// EXTERNAL FEEDING
|
||||
if ( gGameExternalOptions.ubExternalFeeding )
|
||||
{
|
||||
if ( HasItemFlag(gpItemDescObject->usItem, AMMO_BELT) )
|
||||
{
|
||||
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 28 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 28 ]);
|
||||
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
|
||||
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + cnt ] );
|
||||
cnt++;
|
||||
}
|
||||
else if ( HasItemFlag(gpItemDescObject->usItem, AMMO_BELT_VEST) )
|
||||
{
|
||||
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 29 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 29 ]);
|
||||
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
|
||||
MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + cnt ] );
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
@@ -5476,7 +5495,7 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject )
|
||||
cnt++;
|
||||
}
|
||||
|
||||
//////////////////// drinkable WATER
|
||||
//////////////////// FOOD
|
||||
UINT32 foodtype = Item[gpItemDescObject->usItem].foodtype;
|
||||
if ( foodtype > 0 )
|
||||
{
|
||||
@@ -5492,6 +5511,21 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject )
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////// EXTERNAL FEEDING
|
||||
if ( gGameExternalOptions.ubExternalFeeding )
|
||||
{
|
||||
if ( HasItemFlag(gpItemDescObject->usItem, AMMO_BELT) )
|
||||
{
|
||||
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 28, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
cnt++;
|
||||
}
|
||||
else if ( HasItemFlag(gpItemDescObject->usItem, AMMO_BELT_VEST) )
|
||||
{
|
||||
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 29, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWeaponValues( OBJECTTYPE * gpItemDescObject )
|
||||
|
||||
@@ -3342,7 +3342,7 @@ void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
gpSMCurrentMerc->DoMercBattleSound( BATTLE_SOUND_COOL1 );
|
||||
|
||||
}
|
||||
else if ( gGameOptions.fFoodSystem && ApplyFood( gpSMCurrentMerc, gpItemPointer ) )
|
||||
else if ( gGameOptions.fFoodSystem && ApplyFood( gpSMCurrentMerc, gpItemPointer, FALSE ) )
|
||||
{
|
||||
// Dirty
|
||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
|
||||
Reference in New Issue
Block a user