creature: move Creature_IsHostile to trx

This commit is contained in:
Marcin Kurczewski 2025-04-08 23:27:52 +02:00
parent 2d37378223
commit c324d486d3
6 changed files with 9 additions and 15 deletions

View file

@ -1094,6 +1094,12 @@ void Creature_SetAlliesHostile(bool enable)
m_AlliesHostile = enable; m_AlliesHostile = enable;
} }
bool Creature_IsHostile(const ITEM *const item)
{
return Object_IsType(item->object_id, g_EnemyObjects)
|| (Creature_AreAlliesHostile() && Creature_IsAlly(item));
}
int16_t Creature_Effect( int16_t Creature_Effect(
const ITEM *const item, const BITE *const bite, const ITEM *const item, const BITE *const bite,
int16_t (*const spawn)( int16_t (*const spawn)(

View file

@ -31,7 +31,8 @@ int32_t Creature_Vault(
bool Creature_AreAlliesHostile(void); bool Creature_AreAlliesHostile(void);
void Creature_SetAlliesHostile(bool enable); void Creature_SetAlliesHostile(bool enable);
extern bool Creature_IsHostile(const ITEM *item); bool Creature_IsHostile(const ITEM *item);
extern bool Creature_IsAlly(const ITEM *item);
int16_t Creature_Effect( int16_t Creature_Effect(
const ITEM *item, const BITE *bite, const ITEM *item, const BITE *bite,

View file

@ -56,11 +56,6 @@ bool Creature_IsBoss(const int16_t item_num)
return Object_IsType(item->object_id, g_BossObjects); return Object_IsType(item->object_id, g_BossObjects);
} }
bool Creature_IsHostile(const ITEM *const item)
{
return Object_IsType(item->object_id, g_EnemyObjects);
}
bool Creature_IsAlly(const ITEM *const item) bool Creature_IsAlly(const ITEM *const item)
{ {
return Object_IsType(item->object_id, g_AllyObjects); return Object_IsType(item->object_id, g_AllyObjects);

View file

@ -6,7 +6,7 @@
#include <libtrx/game/creature.h> #include <libtrx/game/creature.h>
#include <libtrx/utils.h> #include <libtrx/utils.h>
bool Creature_IsBoss(int16_t item_num);
bool Creature_ShootAtLara( bool Creature_ShootAtLara(
ITEM *item, int32_t distance, BITE *gun, int16_t extra_rotation, ITEM *item, int32_t distance, BITE *gun, int16_t extra_rotation,
int16_t damage); int16_t damage);
bool Creature_IsBoss(int16_t item_num);

View file

@ -24,13 +24,6 @@
#define M_SHOOT_TARGETING_SPEED 300 #define M_SHOOT_TARGETING_SPEED 300
#define M_SHOOT_HIT_CHANCE 0x2000 #define M_SHOOT_HIT_CHANCE 0x2000
bool Creature_IsHostile(const ITEM *const item)
{
return Object_IsType(item->object_id, g_EnemyObjects)
|| (Creature_AreAlliesHostile()
&& (item->object_id == O_MONK_1 || item->object_id == O_MONK_2));
}
bool Creature_IsAlly(const ITEM *const item) bool Creature_IsAlly(const ITEM *const item)
{ {
return Object_IsType(item->object_id, g_AllyObjects); return Object_IsType(item->object_id, g_AllyObjects);

View file

@ -4,7 +4,6 @@
#include <libtrx/game/creature.h> #include <libtrx/game/creature.h>
bool Creature_IsAlly(const ITEM *item);
int32_t Creature_ShootAtLara( int32_t Creature_ShootAtLara(
ITEM *item, const AI_INFO *info, const BITE *gun, int16_t extra_rotation, ITEM *item, const AI_INFO *info, const BITE *gun, int16_t extra_rotation,
int32_t damage); int32_t damage);