- added new item flag for camo-removing items, to remove hard-coded value (CAMO_REMOVAL, #1024)

- fixed a bug that caused incorrect deduction of kit points

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5467 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2012-08-13 20:53:50 +00:00
parent ef981b5342
commit 660d8d126f
3 changed files with 7 additions and 13 deletions
+2 -8
View File
@@ -192,7 +192,7 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, BOOLEAN fForce )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s ate %s", pSoldier->name, Item[pObject->usItem].szItemName ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s ate %s", pSoldier->name, Item[pObject->usItem].szItemName );
else else
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s drank %s", pSoldier->name, Item[pObject->usItem].szItemName ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s drank %s", pSoldier->name, Item[pObject->usItem].szItemName );
// now remove a portion of the food item (or the whole item altogether) // now remove a portion of the food item (or the whole item altogether)
UINT16 ptsconsumed = UseKitPoints( pObject, Food[foodtype].ubPortionSize, pSoldier ); UINT16 ptsconsumed = UseKitPoints( pObject, Food[foodtype].ubPortionSize, pSoldier );
@@ -200,13 +200,7 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, BOOLEAN fForce )
// if the food is more of a drink, we also restore breath points // if the food is more of a drink, we also restore breath points
if ( Food[foodtype].bDrinkPoints > Food[foodtype].bFoodPoints ) if ( Food[foodtype].bDrinkPoints > Food[foodtype].bFoodPoints )
{ {
//UINT16 ptsconsumed = Food[foodtype].ubPortionSize - ptsleft; sBPAdjustment = 2 * ptsconsumed * -(100 - pSoldier->bBreath);
INT16 usTotalKitPoints = TotalPoints( pObject );
INT16 sPointsToUse = __min( ptsconsumed, usTotalKitPoints );
sBPAdjustment = 2 * sPointsToUse * -(100 - pSoldier->bBreath);
} }
DeductPoints( pSoldier, APBPConstants[type], sBPAdjustment ); DeductPoints( pSoldier, APBPConstants[type], sBPAdjustment );
+2 -2
View File
@@ -724,8 +724,8 @@ extern OBJECTTYPE gTempObject;
#define AMMO_BELT 0x00000100 //256 // this item can be used to feed externally #define AMMO_BELT 0x00000100 //256 // this item can be used to feed externally
#define AMMO_BELT_VEST 0x00000200 //512 // this is a vest that can contain AMMO_BELT items in its medium slots #define AMMO_BELT_VEST 0x00000200 //512 // this is a vest that can contain AMMO_BELT items in its medium slots
/*#define unused 0x00000400 //1024 #define CAMO_REMOVAL 0x00000400 //1024 // item can be used to remove camo
#define ENEMY_NET_4_LVL_3 0x00000800 //2048 /*#define ENEMY_NET_4_LVL_3 0x00000800 //2048
#define ENEMY_NET_1_LVL_4 0x00001000 //4096 #define ENEMY_NET_1_LVL_4 0x00001000 //4096
#define ENEMY_NET_2_LVL_4 0x00002000 //8192 #define ENEMY_NET_2_LVL_4 0x00002000 //8192
+3 -3
View File
@@ -7151,13 +7151,13 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier )
else if ( Item[pObj->usItem].canteen == TRUE ) else if ( Item[pObj->usItem].canteen == TRUE )
{ {
// consume this kit totally // consume this kit totally
usPoints -= (((*pObj)[bLoop]->data.objectStatus - 1) / (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction))) /100); usPoints -= (((*pObj)[bLoop]->data.objectStatus - 1) / ((max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction))) /100));
(*pObj)[bLoop]->data.objectStatus = 1; (*pObj)[bLoop]->data.objectStatus = 1;
} }
else else
{ {
// consume this kit totally // consume this kit totally
usPoints -= (((*pObj)[bLoop]->data.objectStatus) / (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction))) /100); usPoints -= (((*pObj)[bLoop]->data.objectStatus) / ((max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction))) /100));
(*pObj)[bLoop]->data.objectStatus = 0; (*pObj)[bLoop]->data.objectStatus = 0;
pObj->ubNumberOfObjects--; pObj->ubNumberOfObjects--;
@@ -8851,7 +8851,7 @@ BOOLEAN ApplyCammo( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN *pfGoodAP
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// added possibility to remove all camo by using a rag on self - SANDRO // added possibility to remove all camo by using a rag on self - SANDRO
if (pObj->usItem == 1022 && gGameExternalOptions.fCamoRemoving) if ( HasItemFlag(pObj->usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving)
{ {
if (!EnoughPoints( pSoldier, (APBPConstants[AP_CAMOFLAGE]/2), 0, TRUE ) ) if (!EnoughPoints( pSoldier, (APBPConstants[AP_CAMOFLAGE]/2), 0, TRUE ) )
{ {