creature: move Creature_Tilt to trx

This commit is contained in:
Marcin Kurczewski 2025-04-08 17:27:31 +02:00
parent 4e03c39ffd
commit a878739c40
5 changed files with 9 additions and 21 deletions

View file

@ -9,6 +9,7 @@
#define M_ATTACK_RANGE SQUARE(WALL_L * 3) // = 0x900000 = 9437184 #define M_ATTACK_RANGE SQUARE(WALL_L * 3) // = 0x900000 = 9437184
#define M_ESCAPE_CHANCE 2048 #define M_ESCAPE_CHANCE 2048
#define M_RECOVER_CHANCE 256 #define M_RECOVER_CHANCE 256
#define M_MAX_TILT (3 * DEG_1) // = 546
static ITEM *M_ChooseEnemy(const ITEM *item); static ITEM *M_ChooseEnemy(const ITEM *item);
static bool M_SwitchToWater( static bool M_SwitchToWater(
@ -419,3 +420,10 @@ int16_t Creature_Turn(ITEM *const item, int16_t max_turn)
item->rot.y += angle; item->rot.y += angle;
return angle; return angle;
} }
void Creature_Tilt(ITEM *const item, int16_t angle)
{
angle = angle * 4 - item->rot.z;
CLAMP(angle, -M_MAX_TILT, M_MAX_TILT);
item->rot.z += angle;
}

View file

@ -11,11 +11,11 @@ bool Creature_EnsureHabitat(
void Creature_Mood(const ITEM *item, const AI_INFO *info, bool violent); void Creature_Mood(const ITEM *item, const AI_INFO *info, bool violent);
int16_t Creature_Turn(ITEM *item, int16_t max_turn); int16_t Creature_Turn(ITEM *item, int16_t max_turn);
void Creature_Tilt(ITEM *item, int16_t angle);
extern bool Creature_IsHostile(const ITEM *item); extern bool Creature_IsHostile(const ITEM *item);
extern void Creature_Collision( extern void Creature_Collision(
int16_t item_num, ITEM *lara_item, COLL_INFO *coll); int16_t item_num, ITEM *lara_item, COLL_INFO *coll);
extern void Creature_Tilt(ITEM *item, int16_t angle);
extern void Creature_Head(ITEM *item, int16_t required); extern void Creature_Head(ITEM *item, int16_t required);
extern bool Creature_Animate(int16_t item_num, int16_t angle, int16_t tilt); extern bool Creature_Animate(int16_t item_num, int16_t angle, int16_t tilt);
extern int16_t Creature_Effect( extern int16_t Creature_Effect(

View file

@ -18,17 +18,6 @@
#include <libtrx/game/math.h> #include <libtrx/game/math.h>
#include <libtrx/log.h> #include <libtrx/log.h>
void Creature_Tilt(ITEM *item, int16_t angle)
{
angle = angle * 4 - item->rot.z;
if (angle < -MAX_TILT) {
angle = -MAX_TILT;
} else if (angle > MAX_TILT) {
angle = MAX_TILT;
}
item->rot.z += angle;
}
void Creature_Head(ITEM *item, int16_t required) void Creature_Head(ITEM *item, int16_t required)
{ {
CREATURE *creature = item->data; CREATURE *creature = item->data;

View file

@ -57,7 +57,6 @@
#define DIVE_WAIT 10 #define DIVE_WAIT 10
#define STEPUP_HEIGHT ((STEP_L * 3) / 2) // = 384 #define STEPUP_HEIGHT ((STEP_L * 3) / 2) // = 384
#define MAX_HEAD_CHANGE (DEG_1 * 5) // = 910 #define MAX_HEAD_CHANGE (DEG_1 * 5) // = 910
#define MAX_TILT (DEG_1 * 3) // = 546
#define CAM_A_HANG 0 #define CAM_A_HANG 0
#define CAM_E_HANG (-60 * DEG_1) // = -10920 #define CAM_E_HANG (-60 * DEG_1) // = -10920
#define CAM_WADE_ELEVATION (-22 * DEG_1) // = -4004 #define CAM_WADE_ELEVATION (-22 * DEG_1) // = -4004

View file

@ -21,7 +21,6 @@
#include <libtrx/utils.h> #include <libtrx/utils.h>
#define MAX_X_ROT (20 * DEG_1) // = 3640 #define MAX_X_ROT (20 * DEG_1) // = 3640
#define MAX_TILT (3 * DEG_1) // = 546
#define MAX_HEAD_CHANGE (5 * DEG_1) // = 910 #define MAX_HEAD_CHANGE (5 * DEG_1) // = 910
#define HEAD_ARC 0x3000 // = 12288 #define HEAD_ARC 0x3000 // = 12288
#define FLOAT_SPEED 32 #define FLOAT_SPEED 32
@ -359,13 +358,6 @@ bool Creature_Animate(
return true; return true;
} }
void Creature_Tilt(ITEM *const item, int16_t angle)
{
angle = 4 * angle - item->rot.z;
CLAMP(angle, -MAX_TILT, MAX_TILT);
item->rot.z += angle;
}
void Creature_Head(ITEM *item, int16_t required) void Creature_Head(ITEM *item, int16_t required)
{ {
CREATURE *const creature = item->data; CREATURE *const creature = item->data;