/** * @brief G_AttachBodyParts * @param[in] ent */ static void G_AttachBodyParts(gentity_t *ent) { int i; gentity_t *list; for (i = 0; i < level.numConnectedClients; i++, list++) { list = g_entities + level.sortedClients[i]; // ok lets test everything under the sun if (list->inuse && (list->client->sess.sessionTeam == TEAM_AXIS || list->client->sess.sessionTeam == TEAM_ALLIES) && (list != ent) && list->r.linked && !(list->client->ps.pm_flags & PMF_LIMBO) && (list->client->ps.pm_type == PM_NORMAL || list->client->ps.pm_type == PM_DEAD) ) { list->client->tempHead = G_BuildHead(list, &refent, qtrue); list->client->tempLeg = G_BuildLeg(list, &refent, qfalse); } else { list->client->tempHead = NULL; list->client->tempLeg = NULL; } } }
qboolean IsHeadShot( gentity_t *targ, vec3_t dir, vec3_t point, int mod ) { gentity_t *head; trace_t tr; vec3_t start, end; gentity_t *traceEnt; // not a player or critter so bail if( !(targ->client) ) return qfalse; if( targ->health <= 0 ) return qfalse; if (!IsHeadShotWeapon (mod) ) { return qfalse; } head = G_BuildHead( targ ); // trace another shot see if we hit the head VectorCopy( point, start ); VectorMA( start, 64, dir, end ); trap_Trace( &tr, start, NULL, NULL, end, targ->s.number, MASK_SHOT ); traceEnt = &g_entities[ tr.entityNum ]; if( g_debugBullets.integer >= 3 ) { // show hit player head bb gentity_t *tent; vec3_t b1, b2; VectorCopy(head->r.currentOrigin, b1); VectorCopy(head->r.currentOrigin, b2); VectorAdd(b1, head->r.mins, b1); VectorAdd(b2, head->r.maxs, b2); tent = G_TempEntity( b1, EV_RAILTRAIL ); VectorCopy(b2, tent->s.origin2); tent->s.dmgFlags = 1; // show headshot trace // end the headshot trace at the head box if it hits if( tr.fraction != 1 ) { VectorMA(start, (tr.fraction * 64), dir, end); } tent = G_TempEntity( start, EV_RAILTRAIL ); VectorCopy(end, tent->s.origin2); tent->s.dmgFlags = 0; } G_FreeEntity( head ); if( traceEnt == head ) { level.totalHeadshots++; // NERVE - SMF return qtrue; } else level.missedHeadshots++; // NERVE - SMF return qfalse; }
void G_AttachBodyParts(gentity_t *ent) { int i; gentity_t *list; for (i = 0; i < level.numConnectedClients; i++) { list = g_entities + level.sortedClients[i]; list->client->tempHead = (list != ent && IS_ACTIVE(list)) ? G_BuildHead(list) : NULL; } }