mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-12 05:26:57 +03:00
Fix #337
This commit is contained in:
parent
d2bfd7a49a
commit
bcd10f9e66
2 changed files with 26 additions and 15 deletions
|
@ -30,9 +30,7 @@ int EnableBaddieAI(short itemNum, int always)
|
||||||
|
|
||||||
if (item->data.is<CREATURE_INFO>())
|
if (item->data.is<CREATURE_INFO>())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (SlotsUsed >= NUM_SLOTS)
|
if (SlotsUsed >= NUM_SLOTS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,23 +29,36 @@ namespace TEN::Entities::Switches
|
||||||
auto item = &g_Level.Items[itemNum];
|
auto item = &g_Level.Items[itemNum];
|
||||||
auto triggerIndex = GetTriggerIndex(item);
|
auto triggerIndex = GetTriggerIndex(item);
|
||||||
|
|
||||||
if (!triggerIndex)
|
int targetItemNum;
|
||||||
|
ITEM_INFO* target = nullptr;
|
||||||
|
DOOR_DATA* door = nullptr;
|
||||||
|
|
||||||
|
// Try to find first item in a trigger list, and if it is a door,
|
||||||
|
// attach it to cog. If no object found or object is not door,
|
||||||
|
// bypass further processing and do ordinary object collision.
|
||||||
|
|
||||||
|
if (triggerIndex)
|
||||||
|
{
|
||||||
|
short* trigger = triggerIndex;
|
||||||
|
targetItemNum = trigger[3] & VALUE_BITS;
|
||||||
|
|
||||||
|
if (targetItemNum < g_Level.Items.size())
|
||||||
|
{
|
||||||
|
target = &g_Level.Items[targetItemNum];
|
||||||
|
if (target->data.is<DOOR_DATA>())
|
||||||
|
door = (DOOR_DATA*)target->data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Door was not found, do ordinary collision and exit.
|
||||||
|
|
||||||
|
if (door == nullptr)
|
||||||
{
|
{
|
||||||
ObjectCollision(itemNum, l, coll);
|
ObjectCollision(itemNum, l, coll);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
short* trigger = triggerIndex;
|
// Door is found, attach to it.
|
||||||
int targetItemNum = trigger[3] & VALUE_BITS;
|
|
||||||
|
|
||||||
if (targetItemNum > g_Level.Items.size())
|
|
||||||
{
|
|
||||||
ObjectCollision(itemNum, l, coll);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ITEM_INFO* target = &g_Level.Items[targetItemNum];
|
|
||||||
DOOR_DATA* door = (DOOR_DATA*)target->data;
|
|
||||||
|
|
||||||
if (item->status == ITEM_NOT_ACTIVE)
|
if (item->status == ITEM_NOT_ACTIVE)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue