From 660d8d126feb732a44d1dabe4cfad7c286c12350 Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 13 Aug 2012 20:53:50 +0000 Subject: [PATCH] - 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 --- Tactical/Food.cpp | 10 ++-------- Tactical/Item Types.h | 4 ++-- Tactical/Items.cpp | 6 +++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 53c26a3d..f9dd99bc 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -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 ); else 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) 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 ( Food[foodtype].bDrinkPoints > Food[foodtype].bFoodPoints ) { - //UINT16 ptsconsumed = Food[foodtype].ubPortionSize - ptsleft; - - INT16 usTotalKitPoints = TotalPoints( pObject ); - - INT16 sPointsToUse = __min( ptsconsumed, usTotalKitPoints ); - - sBPAdjustment = 2 * sPointsToUse * -(100 - pSoldier->bBreath); + sBPAdjustment = 2 * ptsconsumed * -(100 - pSoldier->bBreath); } DeductPoints( pSoldier, APBPConstants[type], sBPAdjustment ); diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 28e53e66..547bcb57 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -724,8 +724,8 @@ extern OBJECTTYPE gTempObject; #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 unused 0x00000400 //1024 -#define ENEMY_NET_4_LVL_3 0x00000800 //2048 +#define CAMO_REMOVAL 0x00000400 //1024 // item can be used to remove camo +/*#define ENEMY_NET_4_LVL_3 0x00000800 //2048 #define ENEMY_NET_1_LVL_4 0x00001000 //4096 #define ENEMY_NET_2_LVL_4 0x00002000 //8192 diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index a6db2cad..adab0bd0 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -7151,13 +7151,13 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier ) else if ( Item[pObj->usItem].canteen == TRUE ) { // 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; } else { // 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->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 - if (pObj->usItem == 1022 && gGameExternalOptions.fCamoRemoving) + if ( HasItemFlag(pObj->usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving) { if (!EnoughPoints( pSoldier, (APBPConstants[AP_CAMOFLAGE]/2), 0, TRUE ) ) {