mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
objects/wolf: create Golden Mask wolf alias
This allows for the small spider in the Golden Mask to be used as an alias for the wolf.
This commit is contained in:
parent
5bc307b14f
commit
ae5a7fe208
6 changed files with 64 additions and 47 deletions
|
@ -1,3 +1,5 @@
|
|||
#include "game/objects/creatures/wolf.h"
|
||||
|
||||
#include "game/creature.h"
|
||||
#include "game/lara/common.h"
|
||||
#include "game/random.h"
|
||||
|
@ -18,7 +20,11 @@
|
|||
#define WOLF_SLEEP_CHANCE 32
|
||||
#define WOLF_HOWL_CHANCE 384
|
||||
#define WOLF_TOUCH 0x774F
|
||||
#if TR_VERSION == 1
|
||||
#define WOLF_HITPOINTS 6
|
||||
#else
|
||||
#define WOLF_HITPOINTS 10
|
||||
#endif
|
||||
#define WOLF_RADIUS (WALL_L / 3) // = 341
|
||||
#define WOLF_SMARTNESS 0x2000
|
||||
// clang-format on
|
||||
|
@ -51,32 +57,9 @@ static BITE m_WolfJawBite = { 0, -14, 174, 6 };
|
|||
static BITE m_WolfJawBite = { .pos = { 0, -14, 174 }, .mesh_num = 6 };
|
||||
#endif
|
||||
|
||||
static void M_Setup(OBJECT *obj);
|
||||
static void M_Initialise(int16_t item_num);
|
||||
static void M_Control(int16_t item_num);
|
||||
|
||||
static void M_Setup(OBJECT *const obj)
|
||||
{
|
||||
if (!obj->loaded) {
|
||||
return;
|
||||
}
|
||||
obj->initialise_func = M_Initialise;
|
||||
obj->control_func = M_Control;
|
||||
obj->collision_func = Creature_Collision;
|
||||
obj->shadow_size = UNIT_SHADOW / 2;
|
||||
obj->hit_points = WOLF_HITPOINTS;
|
||||
obj->pivot_length = 375;
|
||||
obj->radius = WOLF_RADIUS;
|
||||
obj->smartness = WOLF_SMARTNESS;
|
||||
obj->intelligent = 1;
|
||||
obj->save_position = 1;
|
||||
obj->save_hitpoints = 1;
|
||||
obj->save_anim = 1;
|
||||
obj->save_flags = 1;
|
||||
|
||||
Object_GetBone(obj, 2)->rot_y = true;
|
||||
}
|
||||
|
||||
static void M_Initialise(const int16_t item_num)
|
||||
{
|
||||
Item_Get(item_num)->frame_num = WOLF_SLEEP_FRAME;
|
||||
|
@ -232,6 +215,26 @@ static void M_Control(const int16_t item_num)
|
|||
Creature_Animate(item_num, angle, tilt);
|
||||
}
|
||||
|
||||
#if TR_VERSION == 1
|
||||
REGISTER_OBJECT(O_WOLF, M_Setup)
|
||||
#endif
|
||||
void Wolf_Setup(OBJECT *const obj)
|
||||
{
|
||||
if (!obj->loaded) {
|
||||
return;
|
||||
}
|
||||
obj->initialise_func = M_Initialise;
|
||||
obj->control_func = M_Control;
|
||||
obj->collision_func = Creature_Collision;
|
||||
obj->shadow_size = UNIT_SHADOW / 2;
|
||||
obj->hit_points = WOLF_HITPOINTS;
|
||||
obj->pivot_length = 375;
|
||||
obj->radius = WOLF_RADIUS;
|
||||
obj->smartness = WOLF_SMARTNESS;
|
||||
obj->intelligent = 1;
|
||||
obj->save_position = 1;
|
||||
obj->save_hitpoints = 1;
|
||||
obj->save_anim = 1;
|
||||
obj->save_flags = 1;
|
||||
|
||||
Object_GetBone(obj, 2)->rot_y = true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(O_WOLF, Wolf_Setup)
|
||||
|
|
5
src/libtrx/include/libtrx/game/objects/creatures/wolf.h
Normal file
5
src/libtrx/include/libtrx/game/objects/creatures/wolf.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
void Wolf_Setup(OBJECT *obj);
|
|
@ -273,6 +273,7 @@ OBJ_ID_DEFINE(O_EARTHQUAKE, 264)
|
|||
// the slot.
|
||||
OBJ_ID_DEFINE(O_MONK_3, O_MONK_1)
|
||||
OBJ_ID_DEFINE(O_BEAR, O_BIG_SPIDER)
|
||||
OBJ_ID_DEFINE(O_WOLF, O_SPIDER)
|
||||
|
||||
// Force the O_NUMBER_OF to be valid
|
||||
OBJ_ID_DEFINE(O_LAST, 264)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include "game/objects/creatures/spider.h"
|
||||
|
||||
#include "game/creature.h"
|
||||
#include "game/items.h"
|
||||
#include "game/lara/control.h"
|
||||
|
@ -66,26 +68,6 @@ static void M_Leap(const int16_t item_num, const int16_t angle)
|
|||
Creature_Animate(item_num, angle, 0);
|
||||
}
|
||||
|
||||
static void M_Setup(OBJECT *const obj)
|
||||
{
|
||||
if (!obj->loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
obj->control_func = M_Control;
|
||||
obj->collision_func = Creature_Collision;
|
||||
|
||||
obj->hit_points = SPIDER_HITPOINTS;
|
||||
obj->radius = SPIDER_RADIUS;
|
||||
obj->shadow_size = UNIT_SHADOW / 2;
|
||||
|
||||
obj->intelligent = 1;
|
||||
obj->save_position = 1;
|
||||
obj->save_hitpoints = 1;
|
||||
obj->save_flags = 1;
|
||||
obj->save_anim = 1;
|
||||
}
|
||||
|
||||
static void M_Control(const int16_t item_num)
|
||||
{
|
||||
if (!Creature_Activate(item_num)) {
|
||||
|
@ -172,4 +154,24 @@ static void M_Control(const int16_t item_num)
|
|||
M_Leap(item_num, angle);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(O_SPIDER, M_Setup)
|
||||
void Spider_Setup(OBJECT *const obj)
|
||||
{
|
||||
if (!obj->loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
obj->control_func = M_Control;
|
||||
obj->collision_func = Creature_Collision;
|
||||
|
||||
obj->hit_points = SPIDER_HITPOINTS;
|
||||
obj->radius = SPIDER_RADIUS;
|
||||
obj->shadow_size = UNIT_SHADOW / 2;
|
||||
|
||||
obj->intelligent = 1;
|
||||
obj->save_position = 1;
|
||||
obj->save_hitpoints = 1;
|
||||
obj->save_flags = 1;
|
||||
obj->save_anim = 1;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(O_SPIDER, Spider_Setup)
|
||||
|
|
5
src/tr2/game/objects/creatures/spider.h
Normal file
5
src/tr2/game/objects/creatures/spider.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <libtrx/game/objects/types.h>
|
||||
|
||||
void Spider_Setup(OBJECT *obj);
|
|
@ -24,6 +24,7 @@ const GAME_OBJECT_ID g_EnemyObjects[] = {
|
|||
O_WORKER_5,
|
||||
O_JELLY,
|
||||
O_SPIDER,
|
||||
O_WOLF,
|
||||
O_BIG_SPIDER,
|
||||
O_BEAR,
|
||||
O_CROW,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue