mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-30 16:57:57 +03:00
fixed crash with puzzleholes if there is no trigger (#1098)
This commit is contained in:
parent
dda0ce85a4
commit
f54e612e79
1 changed files with 12 additions and 0 deletions
|
@ -230,6 +230,10 @@ void PuzzleDoneCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* co
|
||||||
|
|
||||||
// NOTE: Only execute code below if Triggertype is switch trigger.
|
// NOTE: Only execute code below if Triggertype is switch trigger.
|
||||||
auto triggerIndex = GetTriggerIndex(&receptacleItem);
|
auto triggerIndex = GetTriggerIndex(&receptacleItem);
|
||||||
|
|
||||||
|
if (triggerIndex == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
int triggerType = (*(triggerIndex++) >> 8) & 0x3F;
|
int triggerType = (*(triggerIndex++) >> 8) & 0x3F;
|
||||||
|
|
||||||
if (triggerType != TRIGGER_TYPES::SWITCH)
|
if (triggerType != TRIGGER_TYPES::SWITCH)
|
||||||
|
@ -326,6 +330,10 @@ void PuzzleDoneCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* co
|
||||||
void PuzzleDone(ItemInfo* item, short itemNumber)
|
void PuzzleDone(ItemInfo* item, short itemNumber)
|
||||||
{
|
{
|
||||||
auto triggerIndex = GetTriggerIndex(item);
|
auto triggerIndex = GetTriggerIndex(item);
|
||||||
|
|
||||||
|
if (triggerIndex == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
short triggerType = (*(triggerIndex++) >> 8) & 0x3F;
|
short triggerType = (*(triggerIndex++) >> 8) & 0x3F;
|
||||||
|
|
||||||
if (triggerType == TRIGGER_TYPES::SWITCH)
|
if (triggerType == TRIGGER_TYPES::SWITCH)
|
||||||
|
@ -437,6 +445,10 @@ void KeyHoleCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* coll)
|
||||||
auto* player = GetLaraInfo(laraItem);
|
auto* player = GetLaraInfo(laraItem);
|
||||||
|
|
||||||
short* triggerIndexPtr = GetTriggerIndex(keyHoleItem);
|
short* triggerIndexPtr = GetTriggerIndex(keyHoleItem);
|
||||||
|
|
||||||
|
if (triggerIndexPtr == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
short triggerType = (*(triggerIndexPtr++) >> 8) & 0x3F;
|
short triggerType = (*(triggerIndexPtr++) >> 8) & 0x3F;
|
||||||
|
|
||||||
bool isActionReady = (IsHeld(In::Action) || g_Gui.GetInventoryItemChosen() != NO_ITEM);
|
bool isActionReady = (IsHeld(In::Action) || g_Gui.GetInventoryItemChosen() != NO_ITEM);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue