mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-11 21:16:55 +03:00
Update tr4_big_scorpion.cpp; name formatting cleanup
This commit is contained in:
parent
155a754362
commit
abc3f2e685
12 changed files with 104 additions and 92 deletions
|
@ -815,10 +815,10 @@ void HitTarget(ItemInfo* laraItem, ItemInfo* target, GameVector* hitPos, int dam
|
|||
target->HitPoints = 0;
|
||||
}
|
||||
}
|
||||
if (!target->luaCallbackOnHitName.empty())
|
||||
if (!target->LuaCallbackOnHitName.empty())
|
||||
{
|
||||
short index = g_GameScriptEntities->GetIndexByName(target->LuaName);
|
||||
g_GameScript->ExecuteFunction(target->luaCallbackOnHitName, index);
|
||||
g_GameScript->ExecuteFunction(target->LuaCallbackOnHitName, index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,10 +203,10 @@ bool GetTargetOnLOS(GameVector* src, GameVector* dest, bool drawTarget, bool fir
|
|||
if (!Objects[item->ObjectNumber].undead)
|
||||
item->HitPoints -= Weapons[(int)Lara.Control.Weapon.GunType].Damage;
|
||||
|
||||
if (!item->luaCallbackOnHitName.empty())
|
||||
if (!item->LuaCallbackOnHitName.empty())
|
||||
{
|
||||
short index = g_GameScriptEntities->GetIndexByName(item->LuaName);
|
||||
g_GameScript->ExecuteFunction(item->luaCallbackOnHitName, index);
|
||||
g_GameScript->ExecuteFunction(item->LuaCallbackOnHitName, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,16 +88,16 @@ void KillItem(short const itemNumber)
|
|||
|
||||
g_GameScriptEntities->NotifyKilled(item);
|
||||
g_GameScriptEntities->TryRemoveColliding(itemNumber, true);
|
||||
if (!item->luaCallbackOnKilledName.empty())
|
||||
if (!item->LuaCallbackOnKilledName.empty())
|
||||
{
|
||||
g_GameScript->ExecuteFunction(item->luaCallbackOnKilledName, itemNumber);
|
||||
g_GameScript->ExecuteFunction(item->LuaCallbackOnKilledName, itemNumber);
|
||||
}
|
||||
|
||||
item->LuaName.clear();
|
||||
item->luaCallbackOnKilledName.clear();
|
||||
item->luaCallbackOnHitName.clear();
|
||||
item->luaCallbackOnCollidedWithObjectName.clear();
|
||||
item->luaCallbackOnCollidedWithRoomName.clear();
|
||||
item->LuaCallbackOnKilledName.clear();
|
||||
item->LuaCallbackOnHitName.clear();
|
||||
item->LuaCallbackOnCollidedWithObjectName.clear();
|
||||
item->LuaCallbackOnCollidedWithRoomName.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,9 +333,9 @@ void RemoveActiveItem(short itemNumber)
|
|||
}
|
||||
|
||||
g_GameScriptEntities->NotifyKilled(&item);
|
||||
if (!item.luaCallbackOnKilledName.empty())
|
||||
if (!item.LuaCallbackOnKilledName.empty())
|
||||
{
|
||||
g_GameScript->ExecuteFunction(item.luaCallbackOnKilledName, itemNumber);
|
||||
g_GameScript->ExecuteFunction(item.LuaCallbackOnKilledName, itemNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ struct EntityAnimationData
|
|||
//todo we need to find good "default states" for a lot of these - squidshire 25/05/2022
|
||||
struct ItemInfo
|
||||
{
|
||||
std::string LuaName;
|
||||
GAME_OBJECT_ID ObjectNumber;
|
||||
int Status; // ItemStatus enum.
|
||||
bool Active;
|
||||
|
@ -108,11 +107,12 @@ struct ItemInfo
|
|||
short AfterDeath;
|
||||
short CarriedItem;
|
||||
|
||||
// New LUA stuff
|
||||
std::string luaCallbackOnKilledName;
|
||||
std::string luaCallbackOnHitName;
|
||||
std::string luaCallbackOnCollidedWithObjectName;
|
||||
std::string luaCallbackOnCollidedWithRoomName;
|
||||
// Lua
|
||||
std::string LuaName;
|
||||
std::string LuaCallbackOnKilledName;
|
||||
std::string LuaCallbackOnHitName;
|
||||
std::string LuaCallbackOnCollidedWithObjectName;
|
||||
std::string LuaCallbackOnCollidedWithRoomName;
|
||||
};
|
||||
|
||||
void EffectNewRoom(short fxNumber, short roomNumber);
|
||||
|
|
|
@ -414,10 +414,10 @@ bool SaveGame::Save(int slot)
|
|||
ObjectInfo* obj = &Objects[itemToSerialize.ObjectNumber];
|
||||
|
||||
auto luaNameOffset = fbb.CreateString(itemToSerialize.LuaName);
|
||||
auto luaOnKilledNameOffset = fbb.CreateString(itemToSerialize.luaCallbackOnKilledName);
|
||||
auto luaOnHitNameOffset = fbb.CreateString(itemToSerialize.luaCallbackOnHitName);
|
||||
auto luaOnCollidedObjectNameOffset = fbb.CreateString(itemToSerialize.luaCallbackOnCollidedWithObjectName);
|
||||
auto luaOnCollidedRoomNameOffset = fbb.CreateString(itemToSerialize.luaCallbackOnCollidedWithRoomName);
|
||||
auto luaOnKilledNameOffset = fbb.CreateString(itemToSerialize.LuaCallbackOnKilledName);
|
||||
auto luaOnHitNameOffset = fbb.CreateString(itemToSerialize.LuaCallbackOnHitName);
|
||||
auto luaOnCollidedObjectNameOffset = fbb.CreateString(itemToSerialize.LuaCallbackOnCollidedWithObjectName);
|
||||
auto luaOnCollidedRoomNameOffset = fbb.CreateString(itemToSerialize.LuaCallbackOnCollidedWithRoomName);
|
||||
|
||||
std::vector<int> itemFlags;
|
||||
for (int i = 0; i < 7; i++)
|
||||
|
@ -1050,10 +1050,10 @@ bool SaveGame::Load(int slot)
|
|||
if (!item->LuaName.empty())
|
||||
g_GameScriptEntities->AddName(item->LuaName, i);
|
||||
|
||||
item->luaCallbackOnKilledName = savedItem->lua_on_killed_name()->str();
|
||||
item->luaCallbackOnHitName = savedItem->lua_on_hit_name()->str();
|
||||
item->luaCallbackOnCollidedWithObjectName = savedItem->lua_on_collided_with_object_name()->str();
|
||||
item->luaCallbackOnCollidedWithRoomName = savedItem->lua_on_collided_with_room_name()->str();
|
||||
item->LuaCallbackOnKilledName = savedItem->lua_on_killed_name()->str();
|
||||
item->LuaCallbackOnHitName = savedItem->lua_on_hit_name()->str();
|
||||
item->LuaCallbackOnCollidedWithObjectName = savedItem->lua_on_collided_with_object_name()->str();
|
||||
item->LuaCallbackOnCollidedWithRoomName = savedItem->lua_on_collided_with_room_name()->str();
|
||||
|
||||
g_GameScriptEntities->TryAddColliding(i);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "framework.h"
|
||||
#include "tr4_bigscorpion.h"
|
||||
#include "tr4_big_scorpion.h"
|
||||
#include "Game/collision/collide_room.h"
|
||||
#include "Game/control/box.h"
|
||||
#include "Game/effects/effects.h"
|
||||
|
@ -17,22 +17,33 @@ int CutSeqNum;
|
|||
BITE_INFO BigScorpionBite1 = { 0, 0, 0, 8 };
|
||||
BITE_INFO BigScorpionBite2 = { 0, 0, 0, 23 };
|
||||
|
||||
constexpr auto BIG_SCORPION_POISON_POTENCY = 8;
|
||||
constexpr auto BIG_SCORPION_DAMAGE = 120;
|
||||
constexpr auto BIG_SCORPION_TROOP_DAMAGE = 15;
|
||||
|
||||
enum BigScorpionState
|
||||
{
|
||||
BSCORPION_STATE_NONE = 0,
|
||||
BSCORPION_STATE_IDLE = 1,
|
||||
BSCORPION_STATE_WALK = 2,
|
||||
BSCORPION_STATE_RUN = 3,
|
||||
BSCORPION_STATE_ATTACK_1 = 4,
|
||||
BSCORPION_STATE_ATTACK_2 = 5,
|
||||
BSCORPION_STATE_WALK_FORWARD = 2,
|
||||
BSCORPION_STATE_RUN_FORWARD = 3,
|
||||
BSCORPION_STATE_PINCER_ATTACK = 4,
|
||||
BSCORPION_STATE_STINGER_ATTACK = 5,
|
||||
BSCORPION_STATE_DEATH = 6,
|
||||
BSCORPION_STATE_SPECIAL_DEATH = 7,
|
||||
BSCORPION_STATE_TROOPS_ATTACK = 8
|
||||
BSCORPION_STATE_KILL = 7,
|
||||
BSCORPION_STATE_KILL_TROOP = 8
|
||||
};
|
||||
|
||||
// TODO
|
||||
enum BigScorpionAnim
|
||||
{
|
||||
|
||||
BSCORPION_ANIM_WALK_FORWARD = 0,
|
||||
BSCORPION_ANIM_RUN_FORWARD = 1,
|
||||
BSCORPION_ANIM_IDLE = 2,
|
||||
BSCORPION_ANIM_PINCER_ATTACK = 3,
|
||||
BSCORPION_ANIM_STINGER_ATTACK = 4,
|
||||
BSCORPION_ANIM_DEATH = 5,
|
||||
BSCORPION_ANIM_KILL = 6,
|
||||
BSCORPION_ANIM_KILL_TROOP = 7
|
||||
};
|
||||
|
||||
void InitialiseScorpion(short itemNumber)
|
||||
|
@ -43,15 +54,15 @@ void InitialiseScorpion(short itemNumber)
|
|||
|
||||
if (item->TriggerFlags == 1)
|
||||
{
|
||||
item->Animation.TargetState = BSCORPION_STATE_TROOPS_ATTACK;
|
||||
item->Animation.ActiveState = BSCORPION_STATE_TROOPS_ATTACK;
|
||||
item->Animation.AnimNumber = Objects[ID_BIG_SCORPION].animIndex + 7;
|
||||
item->Animation.TargetState = BSCORPION_STATE_KILL_TROOP;
|
||||
item->Animation.ActiveState = BSCORPION_STATE_KILL_TROOP;
|
||||
item->Animation.AnimNumber = Objects[ID_BIG_SCORPION].animIndex + BSCORPION_ANIM_KILL_TROOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->Animation.TargetState = BSCORPION_STATE_IDLE;
|
||||
item->Animation.ActiveState = BSCORPION_STATE_IDLE;
|
||||
item->Animation.AnimNumber = Objects[ID_BIG_SCORPION].animIndex + 2;
|
||||
item->Animation.AnimNumber = Objects[ID_BIG_SCORPION].animIndex + BSCORPION_ANIM_IDLE;
|
||||
}
|
||||
|
||||
item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase;
|
||||
|
@ -115,11 +126,12 @@ void ScorpionControl(short itemNumber)
|
|||
item->HitPoints = 0;
|
||||
if (item->Animation.ActiveState != BSCORPION_STATE_DEATH)
|
||||
{
|
||||
if (item->TriggerFlags > 0 && item->TriggerFlags < 7)
|
||||
if (item->TriggerFlags > 0 &&
|
||||
item->TriggerFlags < 7)
|
||||
{
|
||||
CutSeqNum = 4;
|
||||
|
||||
item->Animation.AnimNumber = Objects[item->Animation.AnimNumber].animIndex + 5;
|
||||
item->Animation.AnimNumber = Objects[item->Animation.AnimNumber].animIndex + BSCORPION_ANIM_DEATH;
|
||||
item->Animation.ActiveState = BSCORPION_STATE_DEATH;
|
||||
item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase;
|
||||
item->Status = ITEM_INVISIBLE;
|
||||
|
@ -142,9 +154,9 @@ void ScorpionControl(short itemNumber)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (item->Animation.ActiveState != BSCORPION_STATE_DEATH && item->Animation.ActiveState != BSCORPION_STATE_SPECIAL_DEATH)
|
||||
else if (item->Animation.ActiveState != BSCORPION_STATE_DEATH && item->Animation.ActiveState != BSCORPION_STATE_KILL)
|
||||
{
|
||||
item->Animation.AnimNumber = Objects[item->ObjectNumber].animIndex + 5;
|
||||
item->Animation.AnimNumber = Objects[item->ObjectNumber].animIndex + BSCORPION_ANIM_DEATH;
|
||||
item->Animation.ActiveState = BSCORPION_STATE_DEATH;
|
||||
item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase;
|
||||
}
|
||||
|
@ -166,11 +178,11 @@ void ScorpionControl(short itemNumber)
|
|||
GetAITarget(creature);
|
||||
else
|
||||
{
|
||||
if (creature->HurtByLara && item->Animation.ActiveState != BSCORPION_STATE_TROOPS_ATTACK)
|
||||
if (creature->HurtByLara && item->Animation.ActiveState != BSCORPION_STATE_KILL_TROOP)
|
||||
creature->Enemy = LaraItem;
|
||||
else
|
||||
{
|
||||
creature->Enemy = NULL;
|
||||
creature->Enemy = nullptr;
|
||||
int minDistance = INT_MAX;
|
||||
|
||||
for (int i = 0; i < ActiveCreatures.size(); i++)
|
||||
|
@ -204,11 +216,11 @@ void ScorpionControl(short itemNumber)
|
|||
}
|
||||
}
|
||||
|
||||
AI_INFO info;
|
||||
CreatureAIInfo(item, &info);
|
||||
AI_INFO AI;
|
||||
CreatureAIInfo(item, &AI);
|
||||
|
||||
GetCreatureMood(item, &info, VIOLENT);
|
||||
CreatureMood(item, &info, VIOLENT);
|
||||
GetCreatureMood(item, &AI, VIOLENT);
|
||||
CreatureMood(item, &AI, VIOLENT);
|
||||
|
||||
angle = CreatureTurn(item, creature->MaxTurn);
|
||||
|
||||
|
@ -218,13 +230,13 @@ void ScorpionControl(short itemNumber)
|
|||
creature->MaxTurn = 0;
|
||||
creature->Flags = 0;
|
||||
|
||||
if (info.distance > pow(1365, 2))
|
||||
if (AI.distance > pow(1365, 2))
|
||||
{
|
||||
item->Animation.TargetState = BSCORPION_STATE_WALK;
|
||||
item->Animation.TargetState = BSCORPION_STATE_WALK_FORWARD;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info.bite)
|
||||
if (AI.bite)
|
||||
{
|
||||
creature->MaxTurn = ANGLE(2.0f);
|
||||
|
||||
|
@ -232,59 +244,59 @@ void ScorpionControl(short itemNumber)
|
|||
creature->Enemy->HitPoints <= 15 &&
|
||||
creature->Enemy->ObjectNumber == ID_TROOPS)
|
||||
{
|
||||
item->Animation.TargetState = BSCORPION_STATE_ATTACK_1;
|
||||
item->Animation.TargetState = BSCORPION_STATE_PINCER_ATTACK;
|
||||
}
|
||||
else
|
||||
item->Animation.TargetState = BSCORPION_STATE_ATTACK_2;
|
||||
item->Animation.TargetState = BSCORPION_STATE_STINGER_ATTACK;
|
||||
}
|
||||
else if (!info.ahead)
|
||||
item->Animation.TargetState = BSCORPION_STATE_WALK;
|
||||
else if (!AI.ahead)
|
||||
item->Animation.TargetState = BSCORPION_STATE_WALK_FORWARD;
|
||||
|
||||
break;
|
||||
|
||||
case BSCORPION_STATE_WALK:
|
||||
case BSCORPION_STATE_WALK_FORWARD:
|
||||
creature->MaxTurn = ANGLE(2.0f);
|
||||
|
||||
if (info.distance < pow(1365, 2))
|
||||
if (AI.distance < pow(1365, 2))
|
||||
item->Animation.TargetState = BSCORPION_STATE_IDLE;
|
||||
else if (info.distance > pow(853, 2))
|
||||
item->Animation.TargetState = BSCORPION_STATE_RUN;
|
||||
else if (AI.distance > pow(853, 2))
|
||||
item->Animation.TargetState = BSCORPION_STATE_RUN_FORWARD;
|
||||
|
||||
break;
|
||||
|
||||
case BSCORPION_STATE_RUN:
|
||||
case BSCORPION_STATE_RUN_FORWARD:
|
||||
creature->MaxTurn = ANGLE(3.0f);
|
||||
|
||||
if (info.distance < pow(1365, 2))
|
||||
if (AI.distance < pow(1365, 2))
|
||||
item->Animation.TargetState = BSCORPION_STATE_IDLE;
|
||||
|
||||
break;
|
||||
|
||||
case BSCORPION_STATE_ATTACK_1:
|
||||
case BSCORPION_STATE_ATTACK_2:
|
||||
case BSCORPION_STATE_PINCER_ATTACK:
|
||||
case BSCORPION_STATE_STINGER_ATTACK:
|
||||
creature->MaxTurn = 0;
|
||||
|
||||
if (abs(info.angle) >= ANGLE(2.0f))
|
||||
if (abs(AI.angle) >= ANGLE(2.0f))
|
||||
{
|
||||
if (info.angle >= 0)
|
||||
if (AI.angle >= 0)
|
||||
item->Pose.Orientation.y += ANGLE(2.0f);
|
||||
else
|
||||
item->Pose.Orientation.y -= ANGLE(2.0f);
|
||||
}
|
||||
else
|
||||
item->Pose.Orientation.y += info.angle;
|
||||
item->Pose.Orientation.y += AI.angle;
|
||||
|
||||
if (creature->Flags)
|
||||
break;
|
||||
|
||||
if (creature->Enemy &&
|
||||
creature->Enemy != LaraItem &&
|
||||
info.distance < pow(1365, 2))
|
||||
AI.distance < pow(1365, 2))
|
||||
{
|
||||
creature->Enemy->HitPoints -= 15;
|
||||
creature->Enemy->HitPoints -= BIG_SCORPION_TROOP_DAMAGE;
|
||||
if (creature->Enemy->HitPoints <= 0)
|
||||
{
|
||||
item->Animation.TargetState = BSCORPION_STATE_SPECIAL_DEATH;
|
||||
item->Animation.TargetState = BSCORPION_STATE_KILL;
|
||||
creature->MaxTurn = 0;
|
||||
}
|
||||
|
||||
|
@ -300,12 +312,12 @@ void ScorpionControl(short itemNumber)
|
|||
}
|
||||
else if (item->TouchBits & 0x1B00100)
|
||||
{
|
||||
LaraItem->HitPoints -= 120;
|
||||
LaraItem->HitPoints -= BIG_SCORPION_DAMAGE;
|
||||
LaraItem->HitStatus = true;
|
||||
|
||||
if (item->Animation.ActiveState == 5)
|
||||
if (item->Animation.ActiveState == BSCORPION_STATE_STINGER_ATTACK)
|
||||
{
|
||||
Lara.PoisonPotency += 8;
|
||||
Lara.PoisonPotency += BIG_SCORPION_POISON_POTENCY;
|
||||
|
||||
CreatureEffect2(
|
||||
item,
|
||||
|
@ -335,7 +347,7 @@ void ScorpionControl(short itemNumber)
|
|||
|
||||
break;
|
||||
|
||||
case BSCORPION_STATE_TROOPS_ATTACK:
|
||||
case BSCORPION_STATE_KILL_TROOP:
|
||||
creature->MaxTurn = 0;
|
||||
|
||||
if (item->Animation.FrameNumber == g_Level.Anims[item->Animation.AnimNumber].frameEnd)
|
||||
|
@ -346,7 +358,7 @@ void ScorpionControl(short itemNumber)
|
|||
creature->Enemy->HitPoints <= 0 ||
|
||||
item->TriggerFlags > 6)
|
||||
{
|
||||
item->Animation.TargetState = BSCORPION_STATE_SPECIAL_DEATH;
|
||||
item->Animation.TargetState = BSCORPION_STATE_KILL;
|
||||
creature->Enemy->HitPoints = 0;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#include "tr4_ahmet.h" // OK
|
||||
#include "tr4_baddy.h" // OK
|
||||
#include "tr4_bat.h" // OK
|
||||
#include "tr4_bigscorpion.h" // OK
|
||||
#include "tr4_big_scorpion.h" // OK
|
||||
#include "tr4_crocodile.h" // OK
|
||||
#include "tr4_demigod.h" // OK
|
||||
#include "tr4_guide.h" // OK
|
||||
|
|
|
@ -395,17 +395,17 @@ void Moveable::SetObjectID(GAME_OBJECT_ID id)
|
|||
|
||||
void Moveable::SetOnHit(std::string const & cbName)
|
||||
{
|
||||
m_item->luaCallbackOnHitName = cbName;
|
||||
m_item->LuaCallbackOnHitName = cbName;
|
||||
}
|
||||
|
||||
void Moveable::SetOnKilled(std::string const & cbName)
|
||||
{
|
||||
m_item->luaCallbackOnKilledName = cbName;
|
||||
m_item->LuaCallbackOnKilledName = cbName;
|
||||
}
|
||||
|
||||
void Moveable::SetOnCollidedWithObject(std::string const & cbName)
|
||||
{
|
||||
m_item->luaCallbackOnCollidedWithObjectName = cbName;
|
||||
m_item->LuaCallbackOnCollidedWithObjectName = cbName;
|
||||
|
||||
if(cbName.empty())
|
||||
dynamic_cast<ObjectsHandler*>(g_GameScriptEntities)->TryRemoveColliding(m_num);
|
||||
|
@ -415,7 +415,7 @@ void Moveable::SetOnCollidedWithObject(std::string const & cbName)
|
|||
|
||||
void Moveable::SetOnCollidedWithRoom(std::string const & cbName)
|
||||
{
|
||||
m_item->luaCallbackOnCollidedWithRoomName = cbName;
|
||||
m_item->LuaCallbackOnCollidedWithRoomName = cbName;
|
||||
|
||||
if(cbName.empty())
|
||||
dynamic_cast<ObjectsHandler*>(g_GameScriptEntities)->TryRemoveColliding(m_num);
|
||||
|
@ -425,22 +425,22 @@ void Moveable::SetOnCollidedWithRoom(std::string const & cbName)
|
|||
|
||||
std::string Moveable::GetOnHit() const
|
||||
{
|
||||
return m_item->luaCallbackOnHitName;
|
||||
return m_item->LuaCallbackOnHitName;
|
||||
}
|
||||
|
||||
std::string Moveable::GetOnKilled() const
|
||||
{
|
||||
return m_item->luaCallbackOnKilledName;
|
||||
return m_item->LuaCallbackOnKilledName;
|
||||
}
|
||||
|
||||
std::string Moveable::GetOnCollidedWithObject() const
|
||||
{
|
||||
return m_item->luaCallbackOnCollidedWithObjectName;
|
||||
return m_item->LuaCallbackOnCollidedWithObjectName;
|
||||
}
|
||||
|
||||
std::string Moveable::GetOnCollidedWithRoom() const
|
||||
{
|
||||
return m_item->luaCallbackOnCollidedWithRoomName;
|
||||
return m_item->LuaCallbackOnCollidedWithRoomName;
|
||||
}
|
||||
|
||||
std::string Moveable::GetName() const
|
||||
|
|
|
@ -123,7 +123,7 @@ void ObjectsHandler::TestCollidingObjects()
|
|||
for (const auto idOne : m_collidingItems)
|
||||
{
|
||||
auto item = &g_Level.Items[idOne];
|
||||
if (!item->luaCallbackOnCollidedWithObjectName.empty())
|
||||
if (!item->LuaCallbackOnCollidedWithObjectName.empty())
|
||||
{
|
||||
//test against other moveables
|
||||
GetCollidedObjects(item, 0, true, CollidedItems, nullptr, 0);
|
||||
|
@ -131,17 +131,17 @@ void ObjectsHandler::TestCollidingObjects()
|
|||
while (CollidedItems[i])
|
||||
{
|
||||
short idTwo = CollidedItems[i] - &g_Level.Items[0];
|
||||
g_GameScript->ExecuteFunction(item->luaCallbackOnCollidedWithObjectName, idOne, idTwo);
|
||||
g_GameScript->ExecuteFunction(item->LuaCallbackOnCollidedWithObjectName, idOne, idTwo);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!item->luaCallbackOnCollidedWithRoomName.empty())
|
||||
if (!item->LuaCallbackOnCollidedWithRoomName.empty())
|
||||
{
|
||||
//test against room geometry
|
||||
if (TestItemRoomCollisionAABB(item))
|
||||
{
|
||||
g_GameScript->ExecuteFunction(item->luaCallbackOnCollidedWithRoomName, idOne);
|
||||
g_GameScript->ExecuteFunction(item->LuaCallbackOnCollidedWithRoomName, idOne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
bool TryAddColliding(short id) override
|
||||
{
|
||||
ItemInfo* item = &g_Level.Items[id];
|
||||
bool hasName = !(item->luaCallbackOnCollidedWithObjectName.empty() && item->luaCallbackOnCollidedWithRoomName.empty());
|
||||
bool hasName = !(item->LuaCallbackOnCollidedWithObjectName.empty() && item->LuaCallbackOnCollidedWithRoomName.empty());
|
||||
if(hasName && item->Collidable && (item->Status != ITEM_INVISIBLE))
|
||||
return m_collidingItems.insert(id).second;
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
bool TryRemoveColliding(short id, bool force = false) override
|
||||
{
|
||||
ItemInfo* item = &g_Level.Items[id];
|
||||
bool hasName = !(item->luaCallbackOnCollidedWithObjectName.empty() && item->luaCallbackOnCollidedWithRoomName.empty());
|
||||
bool hasName = !(item->LuaCallbackOnCollidedWithObjectName.empty() && item->LuaCallbackOnCollidedWithRoomName.empty());
|
||||
if(!force && hasName && item->Collidable && (item->Status != ITEM_INVISIBLE))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ CALL gen.bat</Command>
|
|||
<ClInclude Include="Objects\TR4\Entity\tr4_ahmet.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_baddy.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_bat.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_bigscorpion.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_big_scorpion.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_crocodile.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_demigod.h" />
|
||||
<ClInclude Include="Objects\TR4\Entity\tr4_guide.h" />
|
||||
|
@ -824,7 +824,7 @@ CALL gen.bat</Command>
|
|||
<ClCompile Include="Objects\TR3\Entity\tr3_tiger.cpp" />
|
||||
<ClCompile Include="Objects\TR3\Entity\tr3_trex.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_bat.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_bigscorpion.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_big_scorpion.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_crocodile.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_harpy.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_beetle_swarm.cpp" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue