diff --git a/Editor/Item Statistics.cpp b/Editor/Item Statistics.cpp
index dacfb234..5458b9c6 100644
--- a/Editor/Item Statistics.cpp
+++ b/Editor/Item Statistics.cpp
@@ -91,45 +91,49 @@ CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] =
*/
const STR16 GetActionItemName( OBJECTTYPE *pItem )
{
-UINT32 i,o;
-CHAR16 temp[30];
+ UINT32 i,o;
+ CHAR16 temp[30];
if( !pItem || pItem->usItem != ACTION_ITEM )
return NULL;
-if( (*pItem)[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP )
+ if( (*pItem)[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP )
{
- for (i= ACTIONITEM_TRIP_KLAXON; i< NUM_ACTIONITEMS; /*=ACTIONITEM_NEW;*/ i++ )
+ for (i= ACTIONITEM_TRIP_KLAXON; i< NUM_ACTIONITEMS; /*=ACTIONITEM_NEW;*/ ++i )
+ {
+ if ( ActionItemsValues[ i ].BlowUp == 0 )
+ {
+ if ( (*pItem)[0]->data.misc.bActionValue == ActionItemsValues[ i ].ActionID )
{
- if ( ActionItemsValues[ i ].BlowUp == 0 )
- {
- if ( (*pItem)[0]->data.misc.bActionValue == ActionItemsValues[ i ].ActionID )
- {
- wcscpy(temp, gszActionItemDesc[i]);
- o = i;
- }
- }
+ wcscpy(temp, gszActionItemDesc[i]);
+ o = i;
+ break;
}
- return ActionItemsValues[ o ].szName;
+ }
+ }
+
+ return ActionItemsValues[ o ].szName;
}
else
{
- for (i= ACTIONITEM_TRIP_KLAXON; i< NUM_ACTIONITEMS; /*=ACTIONITEM_NEW;*/ i++ )
+ for (i= ACTIONITEM_TRIP_KLAXON; i< NUM_ACTIONITEMS; /*=ACTIONITEM_NEW;*/ ++i )
+ {
+ if ( ActionItemsValues[ i ].BlowUp == 1 )
+ {
+ if ( (*pItem)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP )
{
- if ( ActionItemsValues[ i ].BlowUp == 1 )
+ if ( (*pItem)[0]->data.misc.usBombItem == ActionItemsValues[ i ].BombItem )
{
- if ( (*pItem)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP )
- {
- if ( (*pItem)[0]->data.misc.usBombItem == ActionItemsValues[ i ].BombItem )
- {
- wcscpy(temp, gszActionItemDesc[i]);
- o = i;
- }
- }
+ wcscpy(temp, gszActionItemDesc[i]);
+ o = i;
+ break;
}
}
- return ActionItemsValues[ o ].szName;
+ }
+ }
+
+ return ActionItemsValues[ o ].szName;
/*
@@ -1506,24 +1510,37 @@ void ActionItemCallback( GUI_BUTTON *btn, INT32 reason )
void ChangeActionItem( OBJECTTYPE *pItem, /*INT8*/ INT16 bActionItemIndex )
{
-/*UINT32*/ INT16 i;
-//(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP;
+ /*INT16 i; //UINT32 i;
+ //(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP;
- for (i= ACTIONITEM_TRIP_KLAXON; i< NUM_ACTIONITEMS; /*=ACTIONITEM_NEW;*/ i++ )
- {
- pItem->usItem = ACTION_ITEM;
+ for (i= ACTIONITEM_TRIP_KLAXON; i< NUM_ACTIONITEMS; ++i) //=ACTIONITEM_NEW; i++ )
+ {
+ pItem->usItem = ACTION_ITEM;
- if ( bActionItemIndex == i && ActionItemsValues[ i ].BlowUp == 1 )
- {
- (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP;
- (*pItem)[0]->data.misc.usBombItem = ActionItemsValues[ i ].BombItem;
- }
- else if ( bActionItemIndex == i && ActionItemsValues[ i ].BlowUp == 0 )
- {
- (*pItem)[0]->data.misc.usBombItem = NOTHING; //ActionItemsValues[ i ].BombItem;
- (*pItem)[0]->data.misc.bActionValue = ActionItemsValues[ i ].ActionID;
- }
- }
+ if ( bActionItemIndex == i && ActionItemsValues[ i ].BlowUp == 1 )
+ {
+ (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP;
+ (*pItem)[0]->data.misc.usBombItem = ActionItemsValues[ i ].BombItem;
+ break;
+ }
+ else if ( bActionItemIndex == i && ActionItemsValues[ i ].BlowUp == 0 )
+ {
+ (*pItem)[0]->data.misc.usBombItem = NOTHING; //ActionItemsValues[ i ].BombItem;
+ (*pItem)[0]->data.misc.bActionValue = ActionItemsValues[ i ].ActionID;
+ break;
+ }
+ }*/
+
+ if ( ActionItemsValues[ bActionItemIndex ].BlowUp == 1 )
+ {
+ (*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP;
+ (*pItem)[0]->data.misc.usBombItem = ActionItemsValues[ bActionItemIndex ].BombItem;
+ }
+ else if ( ActionItemsValues[ bActionItemIndex ].BlowUp == 0 )
+ {
+ (*pItem)[0]->data.misc.usBombItem = NOTHING;
+ (*pItem)[0]->data.misc.bActionValue = ActionItemsValues[ bActionItemIndex ].ActionID;
+ }
/*
diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp
index 0479402e..6ddc5047 100644
--- a/Tactical/Item Types.cpp
+++ b/Tactical/Item Types.cpp
@@ -4,6 +4,7 @@
#include "Items.h"
#include "GameSettings.h"
#include "screenids.h"
+#include "Action Items.h" // added by Flugente for the ACTION_ITEM_BLOW_UP value
int BODYPOSFINAL = GUNSLINGPOCKPOS;//RESET in initInventory
@@ -1158,6 +1159,46 @@ OLD_OBJECTTYPE_101& OLD_OBJECTTYPE_101::operator=(OBJECTTYPE& src)
this->ugYucky.ubGunState = src[0]->data.gun.ubGunState;
break;
}
+
+ // Flugente fix: there is a severe problem with Action items. The problem is that in the above switch statement, we use the default stuff for action items.
+ // If the action item is a bomb etc. (bActionValue = 3), we want to set the bomb item. But due to EXTREME RETARDNESS, the ugYucky-struct differs on variable positions.
+ // To be precise (see in ItemTypes.h: union OLD_OBJECTTYPE_101_UNION for reference), its
+ //
+ // ...
+ // INT8 bGunStatus; // status % of gun
+ // UINT8 ubGunAmmoType; // ammo type, as per weapons.h
+ // UINT8 ubGunShotsLeft; // duh, amount of ammo left
+ // UINT16 usGunAmmoItem; // the item # for the item table
+ // ...
+ //
+ // in the first struct, that is used for the default stuff, but
+ //
+ // ...
+ // INT8 bBombStatus; // % status
+ // INT8 bDetonatorType; // timed, remote, or pressure-activated
+ // UINT16 usBombItem; // the usItem of the bomb.
+ // union
+ // {
+ // ...
+ //
+ // in the struct that stores the bomb item.
+ // Now, if our action item has a Bombitem > 255, that value is read from UINT16 ubGunShotsLeft in OBJECT_GUN.
+ // In the OBJECTTYPE::data union, OBJECT_GUN and OBJECT_BOMBS_AND_OTHER both have the UINT16 that stores the usBombItem or ubGunShotsLeft at the same position. So until here it is ok...
+ // However, this value now gets written into ugYucky.ubGunShotsLeft - which is an UINT8 instead of UINT16. This means that any item number > 255 is cut down.
+ // This error seems to have always been here (13 years). It just never occured until now.
+ // An easy fix would be to just switch the positions of UINT8ubGunShotsLeft and UINT16 usGunAmmoItem. However we cannot do that, as that will affect every object read ever anywhere.
+ //
+ // For this reason, I now present you this filthy, ugly hack, specifically for action items handle bombs:
+ if ( src.usItem == ACTION_ITEM && src[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP )
+ {
+ this->ugYucky.bDetonatorType = src[0]->data.misc.bDetonatorType;
+ this->ugYucky.usBombItem = src[0]->data.misc.usBombItem;
+ this->ugYucky.bDelay = src[0]->data.misc.bDelay;
+ this->ugYucky.ubBombOwner = src[0]->data.misc.ubBombOwner;
+ this->ugYucky.bActionValue = src[0]->data.misc.bActionValue;
+ this->ugYucky.ubTolerance = src[0]->data.misc.ubTolerance;
+ }
+
this->bTrap = src[0]->data.bTrap;
this->ubImprintID = src[0]->data.ubImprintID;
this->fUsed = src[0]->data.fUsed;
@@ -1331,6 +1372,95 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src)
break;
}
+ // Flugente fix: there is a severe problem with Action items. The problem is that in the above switch statement, we use the default stuff for action items.
+ // If the action item is a bomb etc. (bActionValue = 3), we want to set the bomb item. But due to EXTREME RETARDNESS, the ugYucky-struct differs on variable positions.
+ // To be precise (see in ItemTypes.h: union OLD_OBJECTTYPE_101_UNION for reference), its
+ //
+ // ...
+ // INT8 bGunStatus; // status % of gun
+ // UINT8 ubGunAmmoType; // ammo type, as per weapons.h
+ // UINT8 ubGunShotsLeft; // duh, amount of ammo left
+ // UINT16 usGunAmmoItem; // the item # for the item table
+ // ...
+ //
+ // in the first struct, that is used for the default stuff, but
+ //
+ // ...
+ // INT8 bBombStatus; // % status
+ // INT8 bDetonatorType; // timed, remote, or pressure-activated
+ // UINT16 usBombItem; // the usItem of the bomb.
+ // union
+ // {
+ // ...
+ //
+ // in the struct that stores the bomb item.
+ // Now, if our action item has a Bombitem > 255, that value is read from UINT16 ubGunShotsLeft in OBJECT_GUN.
+ // In the OBJECTTYPE::data union, OBJECT_GUN and OBJECT_BOMBS_AND_OTHER both have the UINT16 that stores the usBombItem or ubGunShotsLeft at the same position. So until here it is ok...
+ // However, this value now gets written into ugYucky.ubGunShotsLeft - which is an UINT8 instead of UINT16. This means that any item number > 255 is cut down.
+ // This error seems to have always been here (13 years). It just never occured until now.
+ // An easy fix would be to just switch the positions of UINT8ubGunShotsLeft and UINT16 usGunAmmoItem. However we cannot do that, as that will affect every object read ever anywhere.
+ //
+ // For this reason, I now present you this filthy, ugly hack, specifically for action items handle bombs:
+ if ( src.usItem == ACTION_ITEM && src.ugYucky.bActionValue == ACTION_ITEM_BLOW_UP )
+ {
+ (*this)[0]->data.misc.bDetonatorType = src.ugYucky.bDetonatorType;
+ (*this)[0]->data.misc.usBombItem = src.ugYucky.usBombItem;
+ (*this)[0]->data.misc.bDelay = src.ugYucky.bDelay; // includes bFrequency
+ (*this)[0]->data.misc.ubBombOwner = src.ugYucky.ubBombOwner;
+ (*this)[0]->data.misc.bActionValue = src.ugYucky.bActionValue;
+ (*this)[0]->data.misc.ubTolerance = src.ugYucky.ubTolerance; // includes ubLocationID
+ (*this)[0]->data.ubWireNetworkFlag = TRIPWIRE_NETWORK_OWNER_ENEMY; // it is always assumed that preplated traps are of hostile origin
+
+ // if the item has any tripwire action item flags, use them, otherwise, use default values
+ if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_ANY )
+ {
+ if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_NET_1 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_NET_1;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_NET_2 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_NET_2;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_NET_3 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_NET_3;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_NET_4 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_NET_4;
+
+ if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_LVL_1 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_LVL_1;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_LVL_2 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_LVL_2;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_LVL_3 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_LVL_3;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_TRIPWIRE_NETWORK_LVL_4 )
+ (*this)[0]->data.ubWireNetworkFlag |= TRIPWIRE_NETWORK_LVL_4;
+ }
+ else
+ (*this)[0]->data.ubWireNetworkFlag |= (TRIPWIRE_NETWORK_NET_1|TRIPWIRE_NETWORK_LVL_1);
+
+ // if the item has any directional action item flag, use them, otherwise, direction does not matter
+ if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_ANY )
+ {
+ if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_NORTH )
+ (*this)[0]->data.ubDirection = NORTH;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_NORTHEAST )
+ (*this)[0]->data.ubDirection = NORTHEAST;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_EAST )
+ (*this)[0]->data.ubDirection = EAST;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_SOUTHEAST )
+ (*this)[0]->data.ubDirection = SOUTHEAST;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_SOUTH )
+ (*this)[0]->data.ubDirection = SOUTH;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_SOUTHWEST )
+ (*this)[0]->data.ubDirection = SOUTHWEST;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_WEST )
+ (*this)[0]->data.ubDirection = WEST;
+ else if ( Item[src.ugYucky.usBombItem].usActionItemFlag & ITEM_DIRECTION_NORTHWEST )
+ (*this)[0]->data.ubDirection = NORTHWEST;
+ }
+ else
+ (*this)[0]->data.ubDirection = DIRECTION_IRRELEVANT;
+
+ (*this)[0]->data.bDefuseFrequency = 0;
+ }
+
(*this)[0]->data.bTrap = src.bTrap; // 1-10 exp_lvl to detect
(*this)[0]->data.ubImprintID = src.ubImprintID; // ID of merc that item is imprinted on
(*this)[0]->data.fUsed = src.fUsed; // flags for whether the item is used or not
diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h
index b9e3ac1c..6704a0e2 100644
--- a/Tactical/Item Types.h
+++ b/Tactical/Item Types.h
@@ -809,6 +809,56 @@ extern OBJECTTYPE gTempObject;
#define TRIPWIRE_ACTIVATED 0x80000000 //2147483648 // for tripwire activation (gets set and unset when activating tripwire)
// ----------------------------------------------------------------
+// -------- added by Flugente: flags for action items --------
+// the numbering of these flags is important. DO NOT CHANGE THEM, UNLESS YOU KNOW WHAT YOU ARE DOING!!!
+// these flags are supposed to be given to items that are used with action items. When an object is created from these action items, various object properties are set depending on this
+// for example, directional explosive mines have to get their direction from this, as there is no way to specify this in the editor. Even if there was, there are no varaibles to store this information
+// adding variables to the existing structure is unadvisable, as it would break too many existing structures.
+// note: it will be assumed that tripwire placed via the editor is of enemy networks, so there is no flag for that
+#define ITEM_TRIPWIRE_NETWORK_NET_1 0x00000001 //1 // network number of the wire
+#define ITEM_TRIPWIRE_NETWORK_NET_2 0x00000002 //2
+#define ITEM_TRIPWIRE_NETWORK_NET_3 0x00000004 //4
+#define ITEM_TRIPWIRE_NETWORK_NET_4 0x00000008 //8
+
+#define ITEM_TRIPWIRE_NETWORK_LVL_1 0x00000010 //16 // hierarchy level of the wire
+#define ITEM_TRIPWIRE_NETWORK_LVL_2 0x00000020 //32
+#define ITEM_TRIPWIRE_NETWORK_LVL_3 0x00000040 //64
+#define ITEM_TRIPWIRE_NETWORK_LVL_4 0x00000080 //128
+
+#define ITEM_DIRECTION_NORTH 0x00000100 //256 // direction for directional exxplosives (claymore etc.)
+#define ITEM_DIRECTION_NORTHEAST 0x00000200 //512
+#define ITEM_DIRECTION_EAST 0x00000400 //1024
+#define ITEM_DIRECTION_SOUTHEAST 0x00000800 //2048
+
+#define ITEM_DIRECTION_SOUTH 0x00001000 //4096
+#define ITEM_DIRECTION_SOUTHWEST 0x00002000 //8192
+#define ITEM_DIRECTION_WEST 0x00004000 //16384
+#define ITEM_DIRECTION_NORTHWEST 0x00008000 //32768
+
+/*#define PLAYER_NET_1_LVL_1 0x00010000 //65536
+#define PLAYER_NET_2_LVL_1 0x00020000 //131072
+#define PLAYER_NET_3_LVL_1 0x00040000 //262144
+#define PLAYER_NET_4_LVL_1 0x00080000 //524288
+
+#define TRIPWIRE_NETWORK_LVL_1 0x00100000 //1048576 // hierarchy level of the wire
+#define TRIPWIRE_NETWORK_LVL_2 0x00200000 //2097152
+#define TRIPWIRE_NETWORK_LVL_3 0x00400000 //4194304
+#define TRIPWIRE_NETWORK_LVL_4 0x00800000 //8388608
+
+/*#define TRIPWIRE_NETWORK_LVL_1 0x01000000 //16777216
+#define TRIPWIRE_NETWORK_LVL_2 0x02000000 //33554432
+#define TRIPWIRE_NETWORK_LVL_3 0x04000000 //67108864
+#define TRIPWIRE_NETWORK_LVL_4 0x08000000 //134217728
+
+#define PLAYER_NET_1_LVL_4 0x10000000 //268435456
+#define PLAYER_NET_2_LVL_4 0x20000000 //536870912
+#define PLAYER_NET_3_LVL_4 0x40000000 //1073741824
+#define PLAYER_NET_4_LVL_4 0x80000000 //2147483648*/
+
+#define ITEM_TRIPWIRE_ANY 0x000000FF
+#define ITEM_DIRECTION_ANY 0x0000FF00
+// ----------------------------------------------------------------
+
// replaces candamage
//#define ITEM_DAMAGEABLE 0x0001
//// replaces canrepair
@@ -1078,6 +1128,9 @@ typedef struct
UINT8 usDamageChance; // chance that damage to the status will also damage the repair threshold
FLOAT dirtIncreaseFactor; // one shot causes this much dirt on a gun
+ // Flugente: a flag that is necessary for transforming action items to objects with new abilities (for now, tripwire networks and directional explosives)
+ UINT32 usActionItemFlag;
+
} INVTYPE;
// CHRISL: Added new structures to handle LBE gear and the two new XML files that will be needed to deal
diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp
index b3f25f9c..4c730948 100644
--- a/TileEngine/Explosion Control.cpp
+++ b/TileEngine/Explosion Control.cpp
@@ -3678,11 +3678,16 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN
OBJECTTYPE* pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].object );
if (!((*pObj).fFlags & OBJECT_DISABLED_BOMB))
{
+ // Flugente: we can either activate a bomb, or an action item that simulates a bomb - we have to check that first
+ UINT16 usBombItem = pObj->usItem;
+ if ( usBombItem == ACTION_ITEM )
+ usBombItem = (*pObj)[0]->data.misc.usBombItem;
+
// if item can be activated by tripwire, detonate it
- if ( Item[pObj->usItem].tripwireactivation == 1 )
+ if ( Item[usBombItem].tripwireactivation == 1 )
{
// tripwire just gets activated
- if ( Item[pObj->usItem].tripwire == 1 )
+ if ( Item[usBombItem].tripwire == 1 )
{
// this is important - we have to check wether the wire has already been activated
if ( ( (*pObj)[0]->data.sObjectFlag & TRIPWIRE_ACTIVATED ) == 0 )
@@ -3910,6 +3915,37 @@ void HandleExplosionQueue( void )
// now add a tripwire item to the floor, simulating that activating tripwire deactivates it
AddItemToPool( sGridNo, &newtripwireObject, 1, ubLevel, 0, -1 );
}
+ // Flugente: handle tripwire gun traps here...
+ // tripwire gets called and activated in ActivateSurroundingTripwire
+ // now for action item tripwire
+ else if ( pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 )
+ {
+ OBJECTTYPE newtripwireObject;
+ CreateItem( (*pObj)[0]->data.misc.usBombItem, (*pObj)[0]->data.objectStatus, &newtripwireObject );
+
+ // determine this tripwire's flag
+ UINT32 ubWireNetworkFlag = (TRIPWIRE_NETWORK_OWNER_ENEMY|TRIPWIRE_NETWORK_NET_1|TRIPWIRE_NETWORK_LVL_1); // this will get fixed eventually
+
+ // this is important: delete the tripwire, otherwise we get into an infinite loop if there are two piecs of tripwire....
+ RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel );
+
+ // if no other bomb exists here
+ if ( FindWorldItemForBombInGridNo(sGridNo, ubLevel) == -1 )
+ {
+ // make sure no one thinks there is a bomb here any more!
+ if ( gpWorldLevelData[sGridNo].uiFlags & MAPELEMENT_PLAYER_MINE_PRESENT )
+ {
+ RemoveBlueFlag( sGridNo, ubLevel );
+ }
+ gpWorldLevelData[sGridNo].uiFlags &= ~(MAPELEMENT_ENEMY_MINE_PRESENT);
+ }
+
+ // delete the flag, otherwise wire will only work once
+ (newtripwireObject)[0]->data.sObjectFlag &= ~TRIPWIRE_ACTIVATED;
+
+ // now add a tripwire item to the floor, simulating that activating tripwire deactivates it
+ AddItemToPool( sGridNo, &newtripwireObject, 1, ubLevel, 0, -1 );
+ }
else
{
gfExplosionQueueMayHaveChangedSight = TRUE;
@@ -4369,7 +4405,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8
SetOffBombsByFrequency( ubID, (*pObj)[0]->data.misc.bFrequency );
}
// Flugente: a tripwire activates all other tripwires in connection, and detonates all bombs in connection that are tripwire-activated
- else if ( Item[pObj->usItem].tripwire == 1 )
+ else if ( Item[pObj->usItem].tripwire == 1 || (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 ) )
{
gubPersonToSetOffExplosions = ubID;
diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp
index 15f0c5e4..19d0968d 100644
--- a/Utils/XML_Items.cpp
+++ b/Utils/XML_Items.cpp
@@ -276,7 +276,8 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
strcmp(name, "LockPickModifier") == 0 ||
strcmp(name, "CrowbarModifier") == 0 ||
strcmp(name, "DisarmModifier") == 0 ||
- strcmp(name, "RepairModifier") == 0 ))
+ strcmp(name, "RepairModifier") == 0 ||
+ strcmp(name, "usActionItemFlag") == 0 ))
{
pData->curElement = ELEMENT_PROPERTY;
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) );
@@ -1387,7 +1388,12 @@ itemEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curItem.dirtIncreaseFactor = (FLOAT) atof(pData->szCharData);
}
-
+ else if(strcmp(name, "usActionItemFlag") == 0)
+ {
+ pData->curElement = ELEMENT;
+ pData->curItem.usActionItemFlag = (UINT32) atol(pData->szCharData);
+ }
+
pData->maxReadDepth--;
}
@@ -2019,7 +2025,9 @@ BOOLEAN WriteItemStats()
FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usDamageChance );
FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].dirtIncreaseFactor );
-
+
+ FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usActionItemFlag );
+
FilePrintf(hFile,"\t\r\n");
}
FilePrintf(hFile,"\r\n");