tr2/objects/xian: fix Xian warriors twitching in 60 fps
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / Build TR1 (push) Has been skipped
Publish a pre-release / Build TR2 (push) Has been skipped
Publish a pre-release / Create a prerelease (push) Has been skipped

Resolves #2644.
This commit is contained in:
Marcin Kurczewski 2025-03-17 09:44:42 +01:00
parent 430ed4b671
commit 2131530332
5 changed files with 9 additions and 0 deletions

View file

@ -69,6 +69,8 @@ typedef struct {
uint16_t pad : 7; // 0x0200…0x8000
#endif
bool enable_interpolation;
struct {
struct {
XYZ_32 pos;

View file

@ -71,6 +71,7 @@ void Item_Initialise(int16_t item_num)
item->priv = nullptr;
item->carried_item = nullptr;
item->enable_shadow = true;
item->enable_interpolation = true;
if (item->flags & IF_INVISIBLE) {
item->status = IS_INVISIBLE;

View file

@ -93,6 +93,7 @@ void Item_Initialise(const int16_t item_num)
item->collidable = 1;
item->looked_at = 0;
item->killed = 0;
item->enable_interpolation = true;
if ((item->flags & IF_INVISIBLE) != 0) {
item->status = IS_INVISIBLE;
@ -360,6 +361,7 @@ int32_t Item_GetFrames(const ITEM *item, ANIM_FRAME *frmptr[], int32_t *rate)
// interpolated
if (item != g_LaraItem
&& (!item->active || item->status != IS_ACTIVE
|| !item->enable_interpolation
|| !Object_Get(item->object_id)->enable_interpolation)) {
*rate = denominator;
return numerator;

View file

@ -12,6 +12,7 @@
#include "global/vars.h"
#include <libtrx/debug.h>
#include <libtrx/game/interpolation.h>
#include <libtrx/utils.h>
// clang-format off
@ -120,6 +121,7 @@ static void M_Control(const int16_t item_num)
if (item->hit_points <= 0) {
item->current_anim_state = XIAN_KNIGHT_STATE_DEATH;
item->mesh_bits >>= 1;
item->enable_interpolation = false;
if (item->mesh_bits == 0) {
Sound_Effect(SFX_EXPLOSION_1, nullptr, SPM_NORMAL);
item->mesh_bits = -1;

View file

@ -11,6 +11,7 @@
#include "global/vars.h"
#include <libtrx/debug.h>
#include <libtrx/game/interpolation.h>
#include <libtrx/utils.h>
// clang-format off
@ -157,6 +158,7 @@ static void M_Control(const int16_t item_num)
if (item->hit_points <= 0) {
item->current_anim_state = XIAN_SPEARMAN_STATE_DEATH;
item->mesh_bits >>= 1;
item->enable_interpolation = false;
if (item->mesh_bits == 0) {
Sound_Effect(SFX_EXPLOSION_1, nullptr, SPM_NORMAL);
item->mesh_bits = -1;