MCPcopy Create free account
hub / github.com/JACoders/OpenJK / ClientBegin

Function ClientBegin

code/game/g_client.cpp:580–624  ·  view source on GitHub ↗

=========== 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 ============ */

Source from the content-addressed store, hash-verified

578============
579*/
580void 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

Callers

nothing calls this directly

Calls 2

ClientSpawnFunction · 0.70
G_InitGentityFunction · 0.70

Tested by

no test coverage detected