photo-mode: support 60 FPS

This commit is contained in:
Marcin Kurczewski 2025-03-13 14:20:14 +01:00
parent 5b6b46ea50
commit 50387b888e
9 changed files with 34 additions and 14 deletions

View file

@ -28,6 +28,7 @@
- improved support for pivoting
- improved roll support
- expanded world bounding box by 5 tiles in each direction
- added support for 60 FPS
## [4.8.3](https://github.com/LostArtefacts/TRX/compare/tr1-4.8.2...tr1-4.8.3) - 2025-02-17
- fixed some of Lara's speech in the gym not playing in response to player action (#2514, regression from 4.8)

View file

@ -34,6 +34,7 @@
- improved support for pivoting
- improved roll support
- expanded world bounding box by 5 tiles in each direction
- added support for 60 FPS
## [0.9.2](https://github.com/LostArtefacts/TRX/compare/tr2-0.9.1...tr2-0.9.2) - 2025-02-19
- fixed secret rewards not handed out after loading a save (#2528, regression from 0.8)

View file

@ -45,6 +45,8 @@
static bool m_IsEnabled = true;
static double m_Rate = 0.0;
static double m_WorldRate = 0.0;
static double m_CameraRate = 0.0;
static int32_t M_GetFPS(void);
static XYZ_32 M_GetItemMaxDelta(const ITEM *item);
@ -388,12 +390,20 @@ void Interpolation_Enable(void)
m_IsEnabled = true;
}
double Interpolation_GetRate(void)
double Interpolation_GetWorldRate(void)
{
if (!Interpolation_IsEnabled()) {
return 1.0;
}
return m_Rate;
return m_WorldRate;
}
double Interpolation_GetCameraRate(void)
{
if (!Interpolation_IsEnabled()) {
return 1.0;
}
return m_CameraRate;
}
void Interpolation_SetRate(double rate)
@ -425,7 +435,10 @@ void Interpolation_Remember(void)
void Interpolation_Interpolate(void)
{
const double ratio = Interpolation_GetRate();
if (g_Camera.type != CAM_PHOTO_MODE) {
m_WorldRate = m_Rate;
}
m_CameraRate = m_Rate;
if (g_Camera.pos.room_num != NO_ROOM) {
if (DIFF(&g_Camera, shift) >= 128
@ -437,23 +450,27 @@ void Interpolation_Interpolate(void)
|| DIFF(&g_Camera, target.z) >= CAM_MAX_DELTA) {
M_CommitCamera();
} else {
M_InterpolateCamera(ratio);
M_InterpolateCamera(m_CameraRate);
}
g_Camera.interp.room_num = g_Camera.pos.room_num;
Camera_ClampInterpResult();
}
if (g_Camera.type == CAM_PHOTO_MODE) {
return;
}
ITEM *const lara_item = Lara_GetItem();
LARA_INFO *const lara = Lara_GetLaraInfo();
if (lara != nullptr) {
M_InterpolateLara(ratio, lara);
M_InterpolateLara(m_WorldRate, lara);
}
M_InterpolateItems(ratio);
M_InterpolateEffects(ratio);
M_InterpolateItems(m_WorldRate);
M_InterpolateEffects(m_WorldRate);
if (lara_item != nullptr && Lara_Hair_IsActive()) {
M_InterpolateBraid(ratio, lara_item);
M_InterpolateBraid(m_WorldRate, lara_item);
}
}

View file

@ -69,6 +69,7 @@ static void M_End(PHASE *const phase)
static PHASE_CONTROL M_Control(PHASE *const phase, int32_t num_frames)
{
M_PRIV *const p = phase->priv;
Interpolation_Remember();
Input_Update();
Shell_ProcessInput();
@ -101,9 +102,7 @@ static PHASE_CONTROL M_Control(PHASE *const phase, int32_t num_frames)
static void M_Draw(PHASE *const phase)
{
M_PRIV *const p = phase->priv;
Interpolation_Disable();
Game_Draw(false);
Interpolation_Enable();
Output_DrawPolyList();
if (!p->taking_screenshot) {

View file

@ -7,6 +7,8 @@ void Interpolation_Disable(void);
void Interpolation_Enable(void);
double Interpolation_GetRate(void);
double Interpolation_GetWorldRate(void);
double Interpolation_GetCameraRate(void);
void Interpolation_SetRate(double rate);
void Interpolation_Interpolate(void);

View file

@ -55,7 +55,7 @@ static int32_t M_GetFrames(
*out_frame1 = &obj->frame_base[cur_frame_num];
*out_frame2 = &obj->frame_base[next_frame_num];
*out_rate = 10;
return (Interpolation_GetRate() - 0.5) * 10.0;
return (Interpolation_GetWorldRate() - 0.5) * 10.0;
// OG
fallback:

View file

@ -476,7 +476,7 @@ int32_t Item_GetFrames(const ITEM *item, ANIM_FRAME *frmptr[], int32_t *rate)
return numerator;
}
const double clock_ratio = Interpolation_GetRate() - 0.5;
const double clock_ratio = Interpolation_GetWorldRate() - 0.5;
const double final =
(key_frame_shift + clock_ratio) / (double)key_frame_span;
const double interp_frame_num =

View file

@ -52,7 +52,7 @@ static int32_t M_GetFrames(
*out_frame1 = &obj->frame_base[cur_frame_num];
*out_frame2 = &obj->frame_base[next_frame_num];
*out_rate = 10;
return (Interpolation_GetRate() - 0.5) * 10.0;
return (Interpolation_GetWorldRate() - 0.5) * 10.0;
// OG
fallback:

View file

@ -365,7 +365,7 @@ int32_t Item_GetFrames(const ITEM *item, ANIM_FRAME *frmptr[], int32_t *rate)
return numerator;
}
const double clock_ratio = Interpolation_GetRate() - 0.5;
const double clock_ratio = Interpolation_GetWorldRate() - 0.5;
const double final =
(key_frame_shift + clock_ratio) / (double)key_frame_span;
const double interp_frame_num =