/* ==================== StudioDrawModel ==================== */ int CStudioModelRenderer::StudioDrawModel( int flags ) { alight_t lighting; vec3_t dir; m_pCurrentEntity = IEngineStudio.GetCurrentEntity(); IEngineStudio.GetTimes( &m_nFrameCount, &m_clTime, &m_clOldTime ); IEngineStudio.GetViewInfo( m_vRenderOrigin, m_vUp, m_vRight, m_vNormal ); IEngineStudio.GetAliasScale( &m_fSoftwareXScale, &m_fSoftwareYScale ); if (m_pCurrentEntity->curstate.renderfx == kRenderFxDeadPlayer) { entity_state_t deadplayer; int result; int save_interp; if (m_pCurrentEntity->curstate.renderamt <= 0 || m_pCurrentEntity->curstate.renderamt > gEngfuncs.GetMaxClients() ) return 0; // get copy of player deadplayer = *(IEngineStudio.GetPlayerState( m_pCurrentEntity->curstate.renderamt - 1 )); //cl.frames[cl.parsecount & CL_UPDATE_MASK].playerstate[m_pCurrentEntity->curstate.renderamt-1]; // clear weapon, movement state deadplayer.number = m_pCurrentEntity->curstate.renderamt; deadplayer.weaponmodel = 0; deadplayer.gaitsequence = 0; deadplayer.movetype = MOVETYPE_NONE; VectorCopy( m_pCurrentEntity->curstate.angles, deadplayer.angles ); VectorCopy( m_pCurrentEntity->curstate.origin, deadplayer.origin ); save_interp = m_fDoInterp; m_fDoInterp = 0; // draw as though it were a player result = StudioDrawPlayer( flags, &deadplayer ); m_fDoInterp = save_interp; return result; } m_pRenderModel = m_pCurrentEntity->model; m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata (m_pRenderModel); IEngineStudio.StudioSetHeader( m_pStudioHeader ); IEngineStudio.SetRenderModel( m_pRenderModel ); StudioSetUpTransform( 0 ); if (flags & STUDIO_RENDER) { // see if the bounding box lets us trivially reject, also sets if (!IEngineStudio.StudioCheckBBox ()) return 0; (*m_pModelsDrawn)++; (*m_pStudioModelCount)++; // render data cache cookie if (m_pStudioHeader->numbodyparts == 0) return 1; } if (m_pCurrentEntity->curstate.movetype == MOVETYPE_FOLLOW) { StudioMergeBones( m_pRenderModel ); } else { StudioSetupBones( ); } StudioSaveBones( ); if (flags & STUDIO_EVENTS) { StudioCalcAttachments( ); IEngineStudio.StudioClientEvents( ); // copy attachments into global entity array if ( m_pCurrentEntity->index > 0 ) { cl_entity_t *ent = gEngfuncs.GetEntityByIndex( m_pCurrentEntity->index ); memcpy( ent->attachment, m_pCurrentEntity->attachment, sizeof( vec3_t ) * 4 ); } } if (flags & STUDIO_RENDER) { lighting.plightvec = dir; IEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting ); IEngineStudio.StudioEntityLight( &lighting ); // model and frame independant IEngineStudio.StudioSetupLighting (&lighting); // get remap colors m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF; m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8; IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor ); StudioRenderModel( ); }
int CStudioModelRenderer::StudioDrawModel(int flags) { m_pCurrentEntity = IEngineStudio.GetCurrentEntity(); IEngineStudio.GetTimes(&m_nFrameCount, &m_clTime, &m_clOldTime); IEngineStudio.GetViewInfo(m_vRenderOrigin, m_vUp, m_vRight, m_vNormal); IEngineStudio.GetAliasScale(&m_fSoftwareXScale, &m_fSoftwareYScale); if (m_pCurrentEntity->curstate.renderfx == kRenderFxDeadPlayer) { entity_state_t deadplayer; int result; int save_interp; if (m_pCurrentEntity->curstate.renderamt <= 0 || m_pCurrentEntity->curstate.renderamt > gEngfuncs.GetMaxClients()) return 0; deadplayer = *(IEngineStudio.GetPlayerState(m_pCurrentEntity->curstate.renderamt - 1)); deadplayer.number = m_pCurrentEntity->curstate.renderamt; deadplayer.weaponmodel = 0; deadplayer.gaitsequence = 0; deadplayer.movetype = MOVETYPE_NONE; VectorCopy(m_pCurrentEntity->curstate.angles, deadplayer.angles); VectorCopy(m_pCurrentEntity->curstate.origin, deadplayer.origin); save_interp = m_fDoInterp; m_fDoInterp = 0; result = StudioDrawPlayer(flags, &deadplayer); m_fDoInterp = save_interp; return result; } m_pRenderModel = m_pCurrentEntity->model; m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata(m_pRenderModel); IEngineStudio.StudioSetHeader(m_pStudioHeader); IEngineStudio.SetRenderModel(m_pRenderModel); StudioSetUpTransform(0); if(m_pCurrentEntity == gEngfuncs.GetViewModel() && (gHUD.cl_righthand->value)) { (*m_protationmatrix)[0][1] *= -1; (*m_protationmatrix)[1][1] *= -1; (*m_protationmatrix)[2][1] *= -1; //IEngineStudio.StudioSetCullState(true); } if (flags & STUDIO_RENDER) { if (!IEngineStudio.StudioCheckBBox()) return 0; (*m_pModelsDrawn)++; (*m_pStudioModelCount)++; if (m_pStudioHeader->numbodyparts == 0) return 1; } if (m_pCurrentEntity->curstate.movetype == MOVETYPE_FOLLOW) StudioMergeBones(m_pRenderModel); else StudioSetupBones(); StudioSaveBones(); if (flags & STUDIO_EVENTS) { StudioCalcAttachments(); IEngineStudio.StudioClientEvents(); if (m_pCurrentEntity->index > 0) { cl_entity_t *ent = gEngfuncs.GetEntityByIndex(m_pCurrentEntity->index); memcpy(ent->attachment, m_pCurrentEntity->attachment, sizeof(vec3_t) * 4); } } if (flags & STUDIO_RENDER) { alight_t lighting; vec3_t dir; lighting.plightvec = dir; IEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting); IEngineStudio.StudioEntityLight(&lighting); IEngineStudio.StudioSetupLighting(&lighting); m_nTopColor = m_pCurrentEntity->curstate.colormap & 0xFF; m_nBottomColor = (m_pCurrentEntity->curstate.colormap & 0xFF00) >> 8; IEngineStudio.StudioSetRemapColors(m_nTopColor, m_nBottomColor); StudioRenderModel(dir); }