Skip to content

Commit

Permalink
lara: rename hit properties
Browse files Browse the repository at this point in the history
This renames Lara's various hit properties.
  • Loading branch information
lahm86 committed Jan 25, 2025
1 parent 529d482 commit cd19c4d
Show file tree
Hide file tree
Showing 28 changed files with 126 additions and 128 deletions.
4 changes: 2 additions & 2 deletions src/libtrx/include/libtrx/game/collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct {
uint16_t slopes_are_pits : 1;
uint16_t lava_is_pit : 1;
uint16_t enable_baddie_push : 1;
uint16_t enable_spaz : 1;
uint16_t enable_hit : 1;
} COLL_INFO;

#elif TR_VERSION == 2
Expand Down Expand Up @@ -72,7 +72,7 @@ typedef struct {
uint16_t slopes_are_pits: 1; // 0x02 2
uint16_t lava_is_pit: 1; // 0x04 4
uint16_t enable_baddie_push: 1; // 0x08 8
uint16_t enable_spaz: 1; // 0x10 16
uint16_t enable_hit: 1; // 0x10 16
uint16_t hit_ceiling: 1; // 0x20 32
uint16_t pad: 10;
// clang-format on
Expand Down
8 changes: 4 additions & 4 deletions src/libtrx/include/libtrx/game/lara/enum_tr1.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ typedef enum {
LA_ROLLING_BALL_DEATH = 139,
LA_SPIKE_DEATH = 149,
LA_GRAB_LEDGE_IN = 150,
LA_SPAZ_FORWARD = 125,
LA_SPAZ_BACK = 126,
LA_SPAZ_RIGHT = 127,
LA_SPAZ_LEFT = 128,
LA_HIT_FRONT = 125,
LA_HIT_BACK = 126,
LA_HIT_RIGHT = 127,
LA_HIT_LEFT = 128,
LA_SURF_CLIMB_MEDIUM = 169,
LA_WADE = 170,
LA_SURF_TO_WADE = 178,
Expand Down
8 changes: 4 additions & 4 deletions src/libtrx/include/libtrx/game/lara/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ typedef struct {
int16_t death_timer;
int16_t current_active;
int32_t water_surface_dist;
int16_t spaz_effect_count;
EFFECT *spaz_effect;
int16_t hit_effect_count;
EFFECT *hit_effect;
int32_t mesh_effects;
OBJECT_MESH *mesh_ptrs[LM_NUMBER_OF];
ITEM *target;
Expand Down Expand Up @@ -107,7 +107,7 @@ typedef struct {
int16_t dive_count;
int16_t death_timer;
int16_t current_active;
int16_t spaz_effect_count;
int16_t hit_effect_count;
int16_t flare_age;
int16_t skidoo;
int16_t weapon_item;
Expand All @@ -123,7 +123,7 @@ typedef struct {
// clang-format on
int32_t water_surface_dist;
XYZ_32 last_pos;
EFFECT *spaz_effect;
EFFECT *hit_effect;
uint32_t mesh_effects;
OBJECT_MESH *mesh_ptrs[LM_NUMBER_OF];
ITEM *target;
Expand Down
2 changes: 1 addition & 1 deletion src/tr1/game/creature.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void Creature_Collision(int16_t item_num, ITEM *lara_item, COLL_INFO *coll)
if (item->hit_points <= 0) {
Lara_Push(item, coll, 0, 0);
} else {
Lara_Push(item, coll, coll->enable_spaz, 0);
Lara_Push(item, coll, coll->enable_hit, 0);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/tr1/game/lara/cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ bool Lara_Cheat_EnterFlyMode(void)
g_Lara.torso_rot.y = 0;
}
g_Lara.water_status = LWS_CHEAT;
g_Lara.spaz_effect_count = 0;
g_Lara.spaz_effect = NULL;
g_Lara.hit_effect_count = 0;
g_Lara.hit_effect = NULL;
g_Lara.hit_frame = 0;
g_Lara.hit_direction = -1;
g_Lara.air = LARA_MAX_AIR;
Expand Down
8 changes: 4 additions & 4 deletions src/tr1/game/lara/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ void Lara_Initialise(const GAME_FLOW_LEVEL *const level)
g_Lara.hit_direction = 0;
g_Lara.death_timer = 0;
g_Lara.target = NULL;
g_Lara.spaz_effect = NULL;
g_Lara.spaz_effect_count = 0;
g_Lara.hit_effect = NULL;
g_Lara.hit_effect_count = 0;
g_Lara.turn_rate = 0;
g_Lara.move_angle = 0;
g_Lara.right_arm.flash_gun = 0;
Expand Down Expand Up @@ -710,7 +710,7 @@ bool Lara_MovePosition(ITEM *item, XYZ_32 *vec)
return Item_MovePosition(g_LaraItem, item, vec, velocity);
}

void Lara_Push(ITEM *item, COLL_INFO *coll, bool spaz_on, bool big_push)
void Lara_Push(ITEM *item, COLL_INFO *coll, bool hit_on, bool big_push)
{
ITEM *const lara_item = g_LaraItem;
int32_t x = lara_item->pos.x - item->pos.x;
Expand Down Expand Up @@ -760,7 +760,7 @@ void Lara_Push(ITEM *item, COLL_INFO *coll, bool spaz_on, bool big_push)
x -= (c * rx + s * rz) >> W2V_SHIFT;
z -= (c * rz - s * rx) >> W2V_SHIFT;

if (spaz_on) {
if (hit_on) {
PHD_ANGLE hitang = lara_item->rot.y - (DEG_180 + Math_Atan(z, x));
g_Lara.hit_direction = (hitang + DEG_45) / DEG_90;
if (!g_Lara.hit_frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/tr1/game/lara/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool Lara_TestBoundsCollide(ITEM *item, int32_t radius);
bool Lara_TestPosition(const ITEM *item, const OBJECT_BOUNDS *bounds);
void Lara_AlignPosition(ITEM *item, XYZ_32 *vec);
bool Lara_MovePosition(ITEM *item, XYZ_32 *vec);
void Lara_Push(ITEM *item, COLL_INFO *coll, bool spaz_on, bool big_push);
void Lara_Push(ITEM *item, COLL_INFO *coll, bool hit_on, bool big_push);

void Lara_TakeDamage(int16_t damage, bool hit_status);

Expand Down
14 changes: 7 additions & 7 deletions src/tr1/game/lara/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ static void M_BaddieCollision(ITEM *lara_item, COLL_INFO *coll)
}
}

if (g_Lara.spaz_effect_count && g_Lara.spaz_effect && coll->enable_spaz) {
int32_t x = g_Lara.spaz_effect->pos.x - lara_item->pos.x;
int32_t z = g_Lara.spaz_effect->pos.z - lara_item->pos.z;
if (g_Lara.hit_effect_count && g_Lara.hit_effect && coll->enable_hit) {
int32_t x = g_Lara.hit_effect->pos.x - lara_item->pos.x;
int32_t z = g_Lara.hit_effect->pos.z - lara_item->pos.z;
PHD_ANGLE hitang = lara_item->rot.y - (DEG_180 + Math_Atan(z, x));
g_Lara.hit_direction = (hitang + DEG_45) / DEG_90;
if (!g_Lara.hit_frame) {
Expand All @@ -156,7 +156,7 @@ static void M_BaddieCollision(ITEM *lara_item, COLL_INFO *coll)
g_Lara.hit_frame = 34;
}

g_Lara.spaz_effect_count--;
g_Lara.hit_effect_count--;
}

if (g_Lara.hit_direction == -1) {
Expand Down Expand Up @@ -184,7 +184,7 @@ void Lara_HandleAboveWater(ITEM *item, COLL_INFO *coll)
coll->lava_is_pit = 0;
coll->slopes_are_walls = 0;
coll->slopes_are_pits = 0;
coll->enable_spaz = 1;
coll->enable_hit = 1;
coll->enable_baddie_push = 1;

if (g_Config.gameplay.enable_enhanced_look && item->hit_points > 0) {
Expand Down Expand Up @@ -257,7 +257,7 @@ void Lara_HandleSurface(ITEM *item, COLL_INFO *coll)
coll->slopes_are_walls = 0;
coll->slopes_are_pits = 0;
coll->lava_is_pit = 0;
coll->enable_spaz = 0;
coll->enable_hit = 0;
coll->enable_baddie_push = 0;

g_LaraStateRoutines[item->current_anim_state](item, coll);
Expand Down Expand Up @@ -322,7 +322,7 @@ void Lara_HandleUnderwater(ITEM *item, COLL_INFO *coll)
coll->slopes_are_walls = 0;
coll->slopes_are_pits = 0;
coll->lava_is_pit = 0;
coll->enable_spaz = 0;
coll->enable_hit = 0;
coll->enable_baddie_push = 0;

if (g_Config.gameplay.enable_enhanced_look && item->hit_points > 0) {
Expand Down
8 changes: 4 additions & 4 deletions src/tr1/game/lara/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ void Lara_Draw(ITEM *item)
switch (g_Lara.hit_direction) {
default:
case DIR_NORTH:
frame = Object_GetAnim(object, LA_SPAZ_FORWARD)->frame_ptr;
frame = Object_GetAnim(object, LA_HIT_FRONT)->frame_ptr;
break;
case DIR_EAST:
frame = Object_GetAnim(object, LA_SPAZ_RIGHT)->frame_ptr;
frame = Object_GetAnim(object, LA_HIT_RIGHT)->frame_ptr;
break;
case DIR_SOUTH:
frame = Object_GetAnim(object, LA_SPAZ_BACK)->frame_ptr;
frame = Object_GetAnim(object, LA_HIT_BACK)->frame_ptr;
break;
case DIR_WEST:
frame = Object_GetAnim(object, LA_SPAZ_LEFT)->frame_ptr;
frame = Object_GetAnim(object, LA_HIT_LEFT)->frame_ptr;
break;
}

Expand Down
8 changes: 4 additions & 4 deletions src/tr1/game/lara/hair.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ void Lara_Hair_Control(void)
LARA_ANIMATION hit_anim;
switch (g_Lara.hit_direction) {
case DIR_NORTH:
hit_anim = LA_SPAZ_FORWARD;
hit_anim = LA_HIT_FRONT;
break;

case DIR_SOUTH:
hit_anim = LA_SPAZ_BACK;
hit_anim = LA_HIT_BACK;
break;

case DIR_EAST:
hit_anim = LA_SPAZ_RIGHT;
hit_anim = LA_HIT_RIGHT;
break;

default:
hit_anim = LA_SPAZ_LEFT;
hit_anim = LA_HIT_LEFT;
break;
}

Expand Down
Loading

0 comments on commit cd19c4d

Please sign in to comment.