/* ========================= HUD_CreateEntities Gives us a chance to add additional entities to the render this frame ========================= */ void HUD_CreateEntities( void ) { // e.g., create a persistent cl_entity_t somewhere. // Load an appropriate model into it ( gEngfuncs.CL_LoadModel ) // Call gEngfuncs.CL_CreateVisibleEntity to add it to the visedicts list if( tr.world_has_portals || tr.world_has_screens ) HUD_AddEntity( ET_PLAYER, GET_LOCAL_PLAYER(), GET_LOCAL_PLAYER()->model->name ); }
//========================== // V_CalcThirdPersonRefdef //========================== void V_CalcThirdPersonRefdef( struct ref_params_s * pparams ) { static float lasttime, oldz = 0; pparams->vieworg = pparams->simorg; pparams->vieworg += pparams->viewheight; pparams->viewangles = pparams->cl_viewangles; V_CalcSendOrigin( pparams ); // this is smooth stair climbing in thirdperson mode but not affected for client model :( if( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0.0f ) { float steptime; steptime = pparams->time - lasttime; if( steptime < 0 ) steptime = 0; oldz += steptime * 150.0f; if( oldz > pparams->simorg[2] ) oldz = pparams->simorg[2]; if( pparams->simorg[2] - oldz > pparams->movevars->stepsize ) oldz = pparams->simorg[2] - pparams->movevars->stepsize; pparams->vieworg[2] += oldz - pparams->simorg[2]; } else { oldz = pparams->simorg[2]; } lasttime = pparams->time; V_GetChaseOrigin( pparams->viewangles, pparams->vieworg, cl_chasedist->value, pparams->vieworg ); float pitch = pparams->viewangles[PITCH]; // normalize angles if( pitch > 180.0f ) pitch -= 360.0f; else if( pitch < -180.0f ) pitch += 360.0f; // player pitch is inverted pitch /= -3.0; cl_entity_t *ent = GET_LOCAL_PLAYER(); // slam local player's pitch value ent->angles[PITCH] = pitch; ent->curstate.angles[PITCH] = pitch; ent->prevstate.angles[PITCH] = pitch; ent->latched.prevangles[PITCH] = pitch; }
/* ========================= HUD_ProcessPlayerState We have received entity_state_t for this player over the network. We need to copy appropriate fields to the playerstate structure ========================= */ void HUD_ProcessPlayerState( struct entity_state_s *dst, const struct entity_state_s *src ) { // Copy in network data dst->origin = src->origin; dst->angles = src->angles; dst->velocity = src->velocity; dst->basevelocity = src->basevelocity; dst->frame = src->frame; dst->modelindex = src->modelindex; dst->skin = src->skin; dst->effects = src->effects; dst->weaponmodel = src->weaponmodel; dst->movetype = src->movetype; dst->sequence = src->sequence; dst->animtime = src->animtime; dst->solid = src->solid; dst->rendermode = src->rendermode; dst->renderamt = src->renderamt; dst->rendercolor.r = src->rendercolor.r; dst->rendercolor.g = src->rendercolor.g; dst->rendercolor.b = src->rendercolor.b; dst->renderfx = src->renderfx; dst->framerate = src->framerate; dst->body = src->body; dst->friction = src->friction; dst->gravity = src->gravity; dst->gaitsequence = src->gaitsequence; dst->usehull = src->usehull; dst->playerclass = src->playerclass; dst->team = src->team; dst->colormap = src->colormap; memcpy( &dst->controller[0], &src->controller[0], 4 * sizeof( byte )); memcpy( &dst->blending[0], &src->blending[0], 2 * sizeof( byte )); // Save off some data so other areas of the Client DLL can get to it cl_entity_t *player = GET_LOCAL_PLAYER(); // Get the local player's index if( dst->number == player->index ) { // always have valid PVS message r_currentMessageNum = src->messagenum; } }