=========== ClientBegin called when a client has finished connecting, and is ready to be placed into the level. This will happen every level load, and on transition between teams, but doesn't happen on respawns ============ */
| 578 | ============ |
| 579 | */ |
| 580 | void ClientBegin( int clientNum, usercmd_t *cmd, SavedGameJustLoaded_e eSavedGameJustLoaded) |
| 581 | // qboolean qbFromSavedGame |
| 582 | { |
| 583 | gentity_t *ent; |
| 584 | gclient_t *client; |
| 585 | |
| 586 | ent = g_entities + clientNum; |
| 587 | client = level.clients + clientNum; |
| 588 | |
| 589 | if (eSavedGameJustLoaded == eFULL)//qbFromSavedGame) |
| 590 | { |
| 591 | client->pers.connected = CON_CONNECTED; |
| 592 | ent->client = client; |
| 593 | ClientSpawn( ent, eSavedGameJustLoaded ); |
| 594 | } |
| 595 | else |
| 596 | { |
| 597 | if ( ent->linked ) { |
| 598 | gi.unlinkentity( ent ); |
| 599 | } |
| 600 | G_InitGentity( ent, qfalse ); |
| 601 | ent->e_TouchFunc = touchF_NULL; |
| 602 | ent->e_PainFunc = painF_PlayerPain;//painF_NULL; |
| 603 | ent->client = client; |
| 604 | |
| 605 | client->pers.connected = CON_CONNECTED; |
| 606 | client->pers.teamState.state = TEAM_BEGIN; |
| 607 | VectorCopyM( cmd->angles, client->pers.cmd_angles ); |
| 608 | |
| 609 | memset( &client->ps, 0, sizeof( client->ps ) ); |
| 610 | if( gi.Cvar_VariableIntegerValue( "g_clearstats" ) ) |
| 611 | { |
| 612 | memset( &client->sess.missionStats, 0, sizeof( client->sess.missionStats ) ); |
| 613 | client->sess.missionStats.totalSecrets = gi.Cvar_VariableIntegerValue("newTotalSecrets"); |
| 614 | } |
| 615 | |
| 616 | // locate ent at a spawn point |
| 617 | if ( ClientSpawn( ent, eSavedGameJustLoaded) ) // SavedGameJustLoaded_e |
| 618 | { |
| 619 | // send teleport event |
| 620 | } |
| 621 | client->ps.inventory[INV_GOODIE_KEY] = 0; |
| 622 | client->ps.inventory[INV_SECURITY_KEY] = 0; |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | |
| 627 |
nothing calls this directly
no test coverage detected