============= SV_BuildClientSnapshot Decides which entities are going to be visible to the client, and copies off the playerstate and areabits. This properly handles multiple recursive portals, but the render currently doesn't. For viewing through other player's eyes, clent can be something other than client->gentity ============= */
| 504 | ============= |
| 505 | */ |
| 506 | static clientSnapshot_t *SV_BuildClientSnapshot( client_t *client ) { |
| 507 | vec3_t org; |
| 508 | clientSnapshot_t *frame; |
| 509 | snapshotEntityNumbers_t entityNumbers; |
| 510 | int i; |
| 511 | gentity_t *ent; |
| 512 | entityState_t *state; |
| 513 | gentity_t *clent; |
| 514 | |
| 515 | // bump the counter used to prevent double adding |
| 516 | sv.snapshotCounter++; |
| 517 | |
| 518 | // this is the frame we are creating |
| 519 | frame = &client->frames[ client->netchan.outgoingSequence & PACKET_MASK ]; |
| 520 | |
| 521 | // clear everything in this snapshot |
| 522 | entityNumbers.numSnapshotEntities = 0; |
| 523 | memset( frame->areabits, 0, sizeof( frame->areabits ) ); |
| 524 | |
| 525 | clent = client->gentity; |
| 526 | if ( !clent ) { |
| 527 | return frame; |
| 528 | } |
| 529 | |
| 530 | // grab the current playerState_t |
| 531 | frame->ps = *clent->client; |
| 532 | |
| 533 | // this stops the main client entity playerstate from being sent across, which has the effect of breaking |
| 534 | // looping sounds for the main client. So I took it out. |
| 535 | /* { |
| 536 | int clientNum; |
| 537 | svEntity_t *svEnt; |
| 538 | clientNum = frame->ps.clientNum; |
| 539 | if ( clientNum < 0 || clientNum >= MAX_GENTITIES ) { |
| 540 | Com_Error( ERR_DROP, "SV_SvEntityForGentity: bad gEnt" ); |
| 541 | } |
| 542 | svEnt = &sv.svEntities[ clientNum ]; |
| 543 | // never send client's own entity, because it can |
| 544 | // be regenerated from the playerstate |
| 545 | svEnt->snapshotCounter = sv.snapshotCounter; |
| 546 | } |
| 547 | */ |
| 548 | // find the client's viewpoint |
| 549 | |
| 550 | //if in camera mode use camera position instead |
| 551 | if ( VM_Call( CG_CAMERA_POS, org)) |
| 552 | { |
| 553 | //org[2] += clent->client->viewheight; |
| 554 | } |
| 555 | else |
| 556 | { |
| 557 | VectorCopy( clent->client->origin, org ); |
| 558 | org[2] += clent->client->viewheight; |
| 559 | |
| 560 | //============ |
| 561 | // need to account for lean, or areaportal doors don't draw properly... -slc |
| 562 | if (frame->ps.leanofs != 0) |
| 563 | { |
no test coverage detected