- bugfix: Endless clock after stealing

- changed: APs for stealing from 10 to 14 (because stealing is more than simple picking enemies gun)
- changed: You cannot steal items from head, body, leg or face until the enemy is collapsed (lying on the ground)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@631 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2006-11-13 08:36:36 +00:00
parent ac117f7143
commit c351c27e37
15 changed files with 107 additions and 31 deletions
+51 -12
View File
@@ -5319,31 +5319,70 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet
ITEM_POOL *pItemPool,*pTempItemPool,*pTempLastItemPool;
OBJECTTYPE *pObject;
UINT8 i;
BOOLEAN fStealItem = FALSE;
//Create a temporary item pool, with index in Opponent's inventory as index
pItemPool=NULL;
for(i=0 ; i<NUM_INV_SLOTS; i++)
{
fStealItem = FALSE;
pObject=pOpponent->inv+i;
if (pObject->usItem!=0)
{
pTempItemPool = (ITEM_POOL*)MemAlloc(sizeof(ITEM_POOL));
++ubCount;
if (pItemPool == NULL)
// Is the enemy collapsed
if ( pOpponent->bLife < OKLIFE || pOpponent->bCollapsed )
{
pItemPool = pTempItemPool;
pItemPool->pPrev = NULL;
// We can steal any of his items in the inventory
fStealItem = TRUE;
}
else
{
pTempItemPool->pPrev = pTempLastItemPool;
pTempLastItemPool->pNext = pTempItemPool;
// Check, if we can steal the item
switch (i)
{
case HANDPOS:
case SECONDHANDPOS:
case BIGPOCK1POS:
case BIGPOCK2POS:
case BIGPOCK3POS:
case BIGPOCK4POS:
case SMALLPOCK1POS:
case SMALLPOCK2POS:
case SMALLPOCK3POS:
case SMALLPOCK4POS:
case SMALLPOCK5POS:
case SMALLPOCK6POS:
case SMALLPOCK7POS:
case SMALLPOCK8POS:
fStealItem = TRUE;
break;
default:
fStealItem = FALSE;
break;
}
}
if (fStealItem == TRUE)
{
pTempItemPool = (ITEM_POOL*)MemAlloc(sizeof(ITEM_POOL));
++ubCount;
if (pItemPool == NULL)
{
pItemPool = pTempItemPool;
pItemPool->pPrev = NULL;
}
else
{
pTempItemPool->pPrev = pTempLastItemPool;
pTempLastItemPool->pNext = pTempItemPool;
}
pTempItemPool->pNext = NULL;
pTempItemPool->iItemIndex = i;
//very bad, jack, to test if we are stealing?
pTempItemPool->pLevelNode=NULL;//finally not used
pTempLastItemPool=pTempItemPool;
}
pTempItemPool->pNext = NULL;
pTempItemPool->iItemIndex = i;
//very bad, jack, to test if we are stealing?
pTempItemPool->pLevelNode=NULL;//finally not used
pTempLastItemPool=pTempItemPool;
}
}
if (ubCount == 0)
+4
View File
@@ -6960,6 +6960,8 @@ void ItemPickupOK( GUI_BUTTON *btn, INT32 reason )
DeletePool(gItemPickupMenu.pItemPool);
if ((gpOpponent->inv[HANDPOS].usItem == NOTHING ) && (usLastItem!=NOTHING))
ReLoadSoldierAnimationDueToHandItemChange( gpOpponent, usLastItem, NOTHING );
PreventFromTheFreezingBug(gItemPickupMenu.pSoldier);
}
else
{
@@ -6992,6 +6994,8 @@ void ItemPickupCancel( GUI_BUTTON *btn, INT32 reason )
if (gfStealing) //jackaians modif
{
DeletePool(gItemPickupMenu.pItemPool);
PreventFromTheFreezingBug(gItemPickupMenu.pSoldier);
}
}
else if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
+1 -1
View File
@@ -23,7 +23,7 @@
#define AP_REVERSE_MODIFIER 1
#define AP_STEALTH_MODIFIER 2
#define AP_STEAL_ITEM 10 // APs to steal item....
#define AP_STEAL_ITEM 14 // APs to steal item....
#define AP_TAKE_BLOOD 10
+34 -9
View File
@@ -2161,11 +2161,13 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
INT16 sAPCost;
EV_S_WEAPONHIT SWeaponHit;
INT32 iImpact;
UINT16 usOldItem;
UINT16 usOldItem, usNewItem;
UINT8 ubExpGain;
UINT8 ubIndexRet;
BOOLEAN fFailure; // no stealing occured
BOOLEAN fNoMoreItems; // The enemy has no more items to steal!
BOOLEAN fNoMoreItems = FALSE; // The enemy has no more items to steal!
BOOLEAN fNoMoreItemInHand = FALSE;
BOOLEAN fSoldierCollapsed = FALSE;
// Deduct points!
// August 13 2002: unless stealing - APs already deducted elsewhere
@@ -2207,6 +2209,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
else if ( pTargetSoldier->bLife < OKLIFE || pTargetSoldier->bCollapsed )
{
iHitChance = 100;
fSoldierCollapsed = TRUE;
}
else
{
@@ -2252,6 +2255,9 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
// Do we have the chance to steal more than 1 item?
if (( iDiceRoll <= iHitChance * 2 / 3) || (pTargetSoldier->bCollapsed))
{
// The item that the enemy holds in his hand before the stealing
usOldItem = pTargetSoldier->inv[HANDPOS].usItem;
INT16 sNumStolenItems = StealItems(pSoldier, pTargetSoldier,&ubIndexRet);
// We have only stolen 1 item, because the enemy has not more than one item.
@@ -2266,6 +2272,15 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
AddItemToPool( pSoldier->sGridNo, &(pTargetSoldier->inv[HANDPOS]), 1, pSoldier->bLevel, 0, -1 );
}
DeleteObj( &(pTargetSoldier->inv[ubIndexRet]) );
// WANNE: NEW
// The item that the enemy holds in his hand before the stealing
usNewItem = pTargetSoldier->inv[HANDPOS].usItem;
if (usOldItem != usNewItem)
{
ReLoadSoldierAnimationDueToHandItemChange(pTargetSoldier, usOldItem, usNewItem );
}
}
// The enemy has no more items to steal
else if (sNumStolenItems == 0)
@@ -2299,11 +2314,10 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
// Reload buddy's animation...
ReLoadSoldierAnimationDueToHandItemChange( pTargetSoldier, usOldItem, NOTHING );
}
// Steal was successfull, but the enemy had nothing to steal (we had stolen the Nada item)
// Enemy has no item in his hand.
else
{
fNoMoreItems = TRUE;
//fFailure=TRUE;
fNoMoreItemInHand = TRUE;
}
// Reload buddy's animation...
//ReLoadSoldierAnimationDueToHandItemChange( pTargetSoldier, usOldItem, NOTHING );
@@ -2329,13 +2343,24 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
}
}
else
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE,
Message[ STR_NO_MORE_ITEM_IN_HAND ]);
}
}
// The enemy had no more items to steal, or we had stolen the Nada item
if (fNoMoreItems == TRUE)
// Enemy had no item in its hand
else if (fNoMoreItemInHand == TRUE)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE,
Message[ STR_NO_MORE_ITEMS_TO_STEAL ],
pSoldier->name, ShortItemNames[ pTargetSoldier->inv[HANDPOS].usItem ] );
Message[ STR_NO_MORE_ITEM_IN_HAND ]);
}
// The enemy has no more items to steal
else if (fNoMoreItems == TRUE)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE,
Message[ STR_NO_MORE_ITEMS_TO_STEAL ]);
}
// Give some experience