Browse Source

ref: soft: adapt to RefAPI 4 changes

pull/2/head
Alibek Omarov 2 years ago
parent
commit
67903b55cc
  1. 3
      ref/soft/r_local.h
  2. 12
      ref/soft/r_studio.c

3
ref/soft/r_local.h

@ -553,12 +553,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 ); void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
float CL_GetSequenceDuration( cl_entity_t *ent, int sequence ); float CL_GetSequenceDuration( cl_entity_t *ent, int sequence );
struct mstudiotex_s *R_StudioGetTexture( cl_entity_t *e ); struct mstudiotex_s *R_StudioGetTexture( cl_entity_t *e );
float CL_GetStudioEstimatedFrame( cl_entity_t *ent );
int R_GetEntityRenderMode( cl_entity_t *ent ); int R_GetEntityRenderMode( cl_entity_t *ent );
void R_DrawStudioModel( cl_entity_t *e ); void R_DrawStudioModel( cl_entity_t *e );
player_info_t *pfnPlayerInfo( int index ); player_info_t *pfnPlayerInfo( int index );
void R_GatherPlayerLight( void ); 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_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
void R_StudioResetPlayerModels( void ); void R_StudioResetPlayerModels( void );
void CL_InitStudioAPI( void ); void CL_InitStudioAPI( void );

12
ref/soft/r_studio.c

@ -617,14 +617,14 @@ StudioEstimateFrame
==================== ====================
*/ */
float GAME_EXPORT R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc ) float GAME_EXPORT R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc, double time )
{ {
double dfdt, f; double dfdt, f;
if( g_studio.interpolate ) if( g_studio.interpolate )
{ {
if( g_studio.time < e->curstate.animtime ) dfdt = 0.0; if( time < e->curstate.animtime ) dfdt = 0.0;
else dfdt = (g_studio.time - e->curstate.animtime) * e->curstate.framerate * pseqdesc->fps; else dfdt = (time - e->curstate.animtime) * e->curstate.framerate * pseqdesc->fps;
} }
else dfdt = 0; else dfdt = 0;
@ -874,7 +874,7 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel )
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + e->curstate.sequence; 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 ); panim = gEngfuncs.R_StudioGetAnim( m_pStudioHeader, m_pSubModel, pseqdesc );
R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f ); R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f );
@ -940,7 +940,7 @@ void R_StudioSetupBones( cl_entity_t *e )
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + e->curstate.sequence; 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 ); panim = gEngfuncs.R_StudioGetAnim( m_pStudioHeader, RI.currentmodel, pseqdesc );
R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f ); R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f );
@ -2561,7 +2561,7 @@ static void R_StudioClientEvents( void )
if( pseqdesc->numevents == 0 ) if( pseqdesc->numevents == 0 )
return; return;
end = R_StudioEstimateFrame( e, pseqdesc ); end = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
start = end - e->curstate.framerate * gpGlobals->frametime * pseqdesc->fps; start = end - e->curstate.framerate * gpGlobals->frametime * pseqdesc->fps;
pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex); pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex);

Loading…
Cancel
Save