======================== PlayerStateToEntityState This is done after each set of usercmd_t on the server, and after local prediction on the client ======================== */
| 555 | ======================== |
| 556 | */ |
| 557 | void PlayerStateToEntityState( playerState_t *ps, entityState_t *s ) { |
| 558 | int i; |
| 559 | |
| 560 | if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR ) |
| 561 | { |
| 562 | s->eType = ET_INVISIBLE; |
| 563 | } |
| 564 | /*else if ( ps->stats[STAT_HEALTH] <= GIB_HEALTH ) |
| 565 | { |
| 566 | s->eType = ET_INVISIBLE; |
| 567 | } */ |
| 568 | else |
| 569 | { |
| 570 | s->eType = ET_PLAYER; |
| 571 | } |
| 572 | |
| 573 | s->number = ps->clientNum; |
| 574 | |
| 575 | s->pos.trType = TR_INTERPOLATE; |
| 576 | VectorCopy( ps->origin, s->pos.trBase ); |
| 577 | //SnapVector( s->pos.trBase ); |
| 578 | |
| 579 | s->apos.trType = TR_INTERPOLATE; |
| 580 | VectorCopy( ps->viewangles, s->apos.trBase ); |
| 581 | //SnapVector( s->apos.trBase ); |
| 582 | |
| 583 | s->angles2[YAW] = ps->movementDir; |
| 584 | s->legsAnim = ps->legsAnim; |
| 585 | s->torsoAnim = ps->torsoAnim; |
| 586 | s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number |
| 587 | // so corpses can also reference the proper config |
| 588 | s->eFlags = ps->eFlags; |
| 589 | if ( ps->stats[STAT_HEALTH] <= 0 ) { |
| 590 | s->eFlags |= EF_DEAD; |
| 591 | } else { |
| 592 | s->eFlags &= ~EF_DEAD; |
| 593 | } |
| 594 | |
| 595 | // new sabre stuff |
| 596 | s->saberActive = ps->saberActive; |
| 597 | s->saberInFlight = ps->saberInFlight; |
| 598 | |
| 599 | s->vehicleModel = ps->vehicleModel; |
| 600 | |
| 601 | s->weapon = ps->weapon; |
| 602 | s->groundEntityNum = ps->groundEntityNum; |
| 603 | |
| 604 | s->powerups = 0; |
| 605 | for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { |
| 606 | if ( ps->powerups[ i ] ) { |
| 607 | s->powerups |= 1 << i; |
| 608 | } |
| 609 | } |
| 610 | #if 0 |
| 611 | if ( ps->externalEvent ) { |
| 612 | s->event = ps->externalEvent; |
| 613 | s->eventParm = ps->externalEventParm; |
| 614 | } else { |
no test coverage detected