Browse Source

ref: gl: adapt to RefAPI 4 changes

pull/2/head
Alibek Omarov 2 years ago
parent
commit
55bf0e8a53
  1. 3
      ref/gl/gl_local.h
  2. 14
      ref/gl/gl_studio.c

3
ref/gl/gl_local.h

@ -471,12 +471,11 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded ); @@ -471,12 +471,11 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded );
void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
float CL_GetSequenceDuration( cl_entity_t *ent, int sequence );
struct mstudiotex_s *R_StudioGetTexture( cl_entity_t *e );
float CL_GetStudioEstimatedFrame( cl_entity_t *ent );
int R_GetEntityRenderMode( cl_entity_t *ent );
void R_DrawStudioModel( cl_entity_t *e );
player_info_t *pfnPlayerInfo( int index );
void R_GatherPlayerLight( void );
float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc );
float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc, double time );
void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
void R_StudioResetPlayerModels( void );
void CL_InitStudioAPI( void );

14
ref/gl/gl_studio.c

@ -178,7 +178,7 @@ static void R_StudioSetupTimings( void ) @@ -178,7 +178,7 @@ static void R_StudioSetupTimings( void )
{
// synchronize with server time
g_studio.time = gpGlobals->time;
g_studio.frametime = gpGlobals->time - gpGlobals->oldtime;
g_studio.frametime = gpGlobals->time - gpGlobals->oldtime;
}
else
{
@ -626,14 +626,14 @@ StudioEstimateFrame @@ -626,14 +626,14 @@ StudioEstimateFrame
====================
*/
float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc )
float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc, double time )
{
double dfdt, f;
if( g_studio.interpolate )
{
if( g_studio.time < e->curstate.animtime ) dfdt = 0.0;
else dfdt = (g_studio.time - e->curstate.animtime) * e->curstate.framerate * pseqdesc->fps;
if( time < e->curstate.animtime ) dfdt = 0.0;
else dfdt = (time - e->curstate.animtime) * e->curstate.framerate * pseqdesc->fps;
}
else dfdt = 0;
@ -883,7 +883,7 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel ) @@ -883,7 +883,7 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel )
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + e->curstate.sequence;
f = R_StudioEstimateFrame( e, pseqdesc );
f = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
panim = gEngfuncs.R_StudioGetAnim( m_pStudioHeader, m_pSubModel, pseqdesc );
R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f );
@ -949,7 +949,7 @@ void R_StudioSetupBones( cl_entity_t *e ) @@ -949,7 +949,7 @@ void R_StudioSetupBones( cl_entity_t *e )
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + e->curstate.sequence;
f = R_StudioEstimateFrame( e, pseqdesc );
f = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
panim = gEngfuncs.R_StudioGetAnim( m_pStudioHeader, RI.currentmodel, pseqdesc );
R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f );
@ -2789,7 +2789,7 @@ static void R_StudioClientEvents( void ) @@ -2789,7 +2789,7 @@ static void R_StudioClientEvents( void )
if( pseqdesc->numevents == 0 )
return;
end = R_StudioEstimateFrame( e, pseqdesc );
end = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
start = end - e->curstate.framerate * gpGlobals->frametime * pseqdesc->fps;
pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex);

Loading…
Cancel
Save