/* ==================== CL_AddLinksToPmove collect solid entities ==================== */ void CL_AddLinksToPmove() { cl_entity_t *check; physent_t *pe; int i, solid, idx; for( i = 0; i < cl.frame.num_entities; i++ ) { idx = cls.packet_entities[(cl.frame.first_entity + i) % cls.num_client_entities].number; check = CL_GetEntityByIndex( idx ); // don't add the world and clients here if( !check || check == &clgame.entities[0] ) continue; if( clgame.pmove->numvisent < MAX_PHYSENTS ) { pe = &clgame.pmove->visents[clgame.pmove->numvisent]; if( CL_CopyEntityToPhysEnt( pe, check )) clgame.pmove->numvisent++; } // players will be added later if( check->player ) continue; // can't collide with zeroed hull if( VectorIsNull( check->curstate.mins ) && VectorIsNull( check->curstate.maxs )) continue; solid = check->curstate.solid; if( solid == SOLID_BSP || solid == SOLID_BBOX || solid == SOLID_SLIDEBOX || solid == SOLID_CUSTOM ) { // reserve slots for all the clients if( clgame.pmove->numphysent < ( MAX_PHYSENTS - cl.maxclients )) { pe = &clgame.pmove->physents[clgame.pmove->numphysent]; if( CL_CopyEntityToPhysEnt( pe, check )) clgame.pmove->numphysent++; } } else if( solid == SOLID_NOT && check->curstate.skin != CONTENTS_NONE ) { if( clgame.pmove->nummoveent < MAX_MOVEENTS ) { pe = &clgame.pmove->moveents[clgame.pmove->nummoveent]; if( CL_CopyEntityToPhysEnt( pe, check )) clgame.pmove->nummoveent++; } } } }
/* =============== CL_SetSolid Builds all the pmove physents for the current frame Note that CL_SetUpPlayerPrediction() must be called first! pmove must be setup with world and solid entity hulls before calling (via CL_PredictMove) =============== */ void CL_SetSolidPlayers( int playernum ) { int j; extern vec3_t player_mins; extern vec3_t player_maxs; cl_entity_t *ent; physent_t *pe; if( !cl_solid_players->integer ) return; for( j = 0; j < cl.maxclients; j++ ) { // the player object never gets added if( j == playernum ) continue; ent = CL_GetEntityByIndex( j + 1 ); if( !ent || !ent->player ) continue; // not present this frame pe = &clgame.pmove->physents[clgame.pmove->numphysent]; if( CL_CopyEntityToPhysEnt( pe, ent )) clgame.pmove->numphysent++; } }
/* =============== CL_SetSolid Builds all the pmove physents for the current frame Note that CL_SetUpPlayerPrediction() must be called first! pmove must be setup with world and solid entity hulls before calling (via CL_PredictMove) =============== */ void CL_SetSolidPlayers( int playernum ) { int j; cl_entity_t *ent; entity_state_t *state; physent_t *pe; if( !cl_solid_players->integer ) return; for( j = 0; j < cl.maxclients; j++ ) { // the player object never gets added if( j == playernum ) continue; ent = CL_GetEntityByIndex( j + 1 ); if( !ent || !ent->player ) continue; // not present this frame #if 1 // came from SetUpPlayerPrediction state = cl.frames[cl.parsecountmod].playerstate + j; if( ent->curstate.messagenum != cl.parsecount ) continue; // not present this frame [2] if( ent->curstate.movetype == MOVETYPE_NONE ) continue; if( state->effects & EF_NODRAW ) continue; // skip invisible if( !state->solid ) continue; // not solid #endif pe = &clgame.pmove->physents[clgame.pmove->numphysent]; if( CL_CopyEntityToPhysEnt( pe, ent )) clgame.pmove->numphysent++; } }
void CL_SetSolidEntities( void ) { // world not initialized if( !clgame.entities ) return; // setup physents clgame.pmove->numvisent = 0; clgame.pmove->numphysent = 0; clgame.pmove->nummoveent = 0; CL_CopyEntityToPhysEnt( &clgame.pmove->physents[0], &clgame.entities[0] ); clgame.pmove->visents[0] = clgame.pmove->physents[0]; clgame.pmove->numphysent = 1; // always have world clgame.pmove->numvisent = 1; if( cls.state == ca_active && cl.frame.valid ) CL_AddLinksToPmove(); };