mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
creature: move Creature_Float to trx
This commit is contained in:
parent
b52a61a1b5
commit
664fdaa1c6
4 changed files with 30 additions and 30 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#define M_FLOAT_SPEED 32
|
||||||
#define M_MAX_DISTANCE (WALL_L * 30)
|
#define M_MAX_DISTANCE (WALL_L * 30)
|
||||||
#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
|
||||||
|
@ -468,6 +469,32 @@ void Creature_Neck(ITEM *const item, const int16_t required)
|
||||||
CLAMP(creature->neck_rotation, -M_HEAD_ARC, M_HEAD_ARC);
|
CLAMP(creature->neck_rotation, -M_HEAD_ARC, M_HEAD_ARC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Creature_Float(const int16_t item_num)
|
||||||
|
{
|
||||||
|
ITEM *const item = Item_Get(item_num);
|
||||||
|
|
||||||
|
item->hit_points = DONT_TARGET;
|
||||||
|
item->rot.x = 0;
|
||||||
|
|
||||||
|
const int32_t wh = Room_GetWaterHeight(
|
||||||
|
item->pos.x, item->pos.y, item->pos.z, item->room_num);
|
||||||
|
if (item->pos.y > wh) {
|
||||||
|
item->pos.y -= M_FLOAT_SPEED;
|
||||||
|
} else if (item->pos.y < wh) {
|
||||||
|
item->pos.y = wh;
|
||||||
|
}
|
||||||
|
|
||||||
|
Item_Animate(item);
|
||||||
|
|
||||||
|
int16_t room_num = item->room_num;
|
||||||
|
const SECTOR *const sector =
|
||||||
|
Room_GetSector(item->pos.x, item->pos.y, item->pos.z, &room_num);
|
||||||
|
item->floor = Room_GetHeight(sector, item->pos.x, item->pos.y, item->pos.z);
|
||||||
|
if (room_num != item->room_num) {
|
||||||
|
Item_NewRoom(item_num, room_num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Creature_CanTargetEnemy(const ITEM *const item, const AI_INFO *const info)
|
bool Creature_CanTargetEnemy(const ITEM *const item, const AI_INFO *const info)
|
||||||
{
|
{
|
||||||
const CREATURE *const creature = item->data;
|
const CREATURE *const creature = item->data;
|
||||||
|
|
|
@ -15,12 +15,13 @@ void Creature_Tilt(ITEM *item, int16_t angle);
|
||||||
void Creature_Head(ITEM *item, int16_t required);
|
void Creature_Head(ITEM *item, int16_t required);
|
||||||
void Creature_Neck(ITEM *item, int16_t required);
|
void Creature_Neck(ITEM *item, int16_t required);
|
||||||
|
|
||||||
|
void Creature_Float(int16_t item_num);
|
||||||
|
|
||||||
bool Creature_CanTargetEnemy(const ITEM *item, const AI_INFO *info);
|
bool Creature_CanTargetEnemy(const ITEM *item, const AI_INFO *info);
|
||||||
bool Creature_CheckBaddieOverlap(int16_t item_num);
|
bool Creature_CheckBaddieOverlap(int16_t item_num);
|
||||||
void Creature_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll);
|
void Creature_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll);
|
||||||
bool Creature_Animate(int16_t item_num, int16_t angle, int16_t tilt);
|
bool Creature_Animate(int16_t item_num, int16_t angle, int16_t tilt);
|
||||||
|
void Creature_Die(int16_t item_num, bool explode);
|
||||||
extern void Creature_Die(int16_t item_num, bool explode);
|
|
||||||
|
|
||||||
extern bool Creature_IsHostile(const ITEM *item);
|
extern bool Creature_IsHostile(const ITEM *item);
|
||||||
|
|
||||||
|
|
|
@ -21,38 +21,11 @@
|
||||||
#include <libtrx/game/math.h>
|
#include <libtrx/game/math.h>
|
||||||
#include <libtrx/utils.h>
|
#include <libtrx/utils.h>
|
||||||
|
|
||||||
#define FLOAT_SPEED 32
|
|
||||||
#define TARGET_TOLERANCE 0x400000
|
#define TARGET_TOLERANCE 0x400000
|
||||||
|
|
||||||
#define CREATURE_SHOOT_TARGETING_SPEED 300
|
#define CREATURE_SHOOT_TARGETING_SPEED 300
|
||||||
#define CREATURE_SHOOT_HIT_CHANCE 0x2000
|
#define CREATURE_SHOOT_HIT_CHANCE 0x2000
|
||||||
|
|
||||||
void Creature_Float(const int16_t item_num)
|
|
||||||
{
|
|
||||||
ITEM *const item = Item_Get(item_num);
|
|
||||||
|
|
||||||
item->hit_points = DONT_TARGET;
|
|
||||||
item->rot.x = 0;
|
|
||||||
|
|
||||||
const int32_t wh = Room_GetWaterHeight(
|
|
||||||
item->pos.x, item->pos.y, item->pos.z, item->room_num);
|
|
||||||
if (item->pos.y > wh) {
|
|
||||||
item->pos.y -= FLOAT_SPEED;
|
|
||||||
} else if (item->pos.y < wh) {
|
|
||||||
item->pos.y = wh;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item_Animate(item);
|
|
||||||
|
|
||||||
int16_t room_num = item->room_num;
|
|
||||||
const SECTOR *const sector =
|
|
||||||
Room_GetSector(item->pos.x, item->pos.y, item->pos.z, &room_num);
|
|
||||||
item->floor = Room_GetHeight(sector, item->pos.x, item->pos.y, item->pos.z);
|
|
||||||
if (room_num != item->room_num) {
|
|
||||||
Item_NewRoom(item_num, room_num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Creature_Underwater(ITEM *const item, const int32_t depth)
|
void Creature_Underwater(ITEM *const item, const int32_t depth)
|
||||||
{
|
{
|
||||||
const int32_t wh = Room_GetWaterHeight(
|
const int32_t wh = Room_GetWaterHeight(
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <libtrx/game/creature.h>
|
#include <libtrx/game/creature.h>
|
||||||
|
|
||||||
void Creature_Float(int16_t item_num);
|
|
||||||
void Creature_Underwater(ITEM *item, int32_t depth);
|
void Creature_Underwater(ITEM *item, int32_t depth);
|
||||||
int32_t Creature_Vault(
|
int32_t Creature_Vault(
|
||||||
int16_t item_num, int16_t angle, int32_t vault, int32_t shift);
|
int16_t item_num, int16_t angle, int32_t vault, int32_t shift);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue