/* =========== 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 ============ */ void ClientBegin( int clientNum ) { gentity_t *ent; gclient_t *client; int flags; ent = g_entities + clientNum; client = level.clients + clientNum; // ignore if client already entered the game if( client->pers.connected != CON_CONNECTING ) return; if( ent->r.linked ) trap_UnlinkEntity( ent ); G_InitGentity( ent ); ent->touch = 0; ent->pain = 0; ent->client = client; client->pers.connected = CON_CONNECTED; client->pers.enterTime = level.time; // save eflags around this, because changing teams will // cause this to happen with a valid entity, and we // want to make sure the teleport bit is set right // so the viewpoint doesn't interpolate through the // world to the new position flags = client->ps.eFlags; memset( &client->ps, 0, sizeof( client->ps ) ); memset( &client->pmext, 0, sizeof( client->pmext ) ); client->ps.eFlags = flags; // locate ent at a spawn point ClientSpawn( ent, NULL, NULL, NULL ); trap_SendServerCommand( -1, va( "print \"%s" S_COLOR_WHITE " entered the game\n\"", client->pers.netname ) ); G_namelog_restore( client ); G_LogPrintf( "ClientBegin: %i\n", clientNum ); // count current clients and rank for scoreboard CalculateRanks( ); // send the client a list of commands that can be used G_ListCommands( ent ); // reset cuboidSelection client->cuboidSelection[ 0 ] = client->cuboidSelection[ 1 ] = client->cuboidSelection[ 2 ] = 32; }
/* =========== ClientBegin Called when a client has finished connecting, and is ready to be placed into the level. This will happen on every level load and level restart, but doesn't happen on respawns. ============ */ void ClientBegin( int clientNum ) { gentity_t *ent; gclient_t *client; int flags; char startMsg[ MAX_STRING_CHARS ]; ent = g_entities + clientNum; client = level.clients + clientNum; // ignore if client already entered the game if ( client->pers.connected != CON_CONNECTING ) { return; } if ( ent->r.linked ) { trap_UnlinkEntity( ent ); } G_InitGentity( ent ); // Create a basic client entity, will be replaced by a more specific one later. ent->entity = new ClientEntity({ent, client}); ent->touch = 0; ent->pain = 0; ent->client = client; client->pers.connected = CON_CONNECTED; client->pers.enterTime = level.time; ClientAdminChallenge( clientNum ); // save eflags around this, because changing teams will // cause this to happen with a valid entity, and we // want to make sure the teleport bit is set right // so the viewpoint doesn't interpolate through the // world to the new position flags = client->ps.eFlags; memset( &client->ps, 0, sizeof( client->ps ) ); memset( &client->pmext, 0, sizeof( client->pmext ) ); client->ps.eFlags = flags; // locate ent at a spawn point ClientSpawn( ent, nullptr, nullptr, nullptr ); trap_SendServerCommand( -1, va( "print_tr %s %s", QQ( N_("$1$^7 entered the game") ), Quote( client->pers.netname ) ) ); trap_Cvar_VariableStringBuffer( "g_mapStartupMessage", startMsg, sizeof( startMsg ) ); if ( *startMsg ) { trap_SendServerCommand( ent - g_entities, va( "cpd %d %s", g_mapStartupMessageDelay.integer, Quote( startMsg ) ) ); } G_namelog_restore( client ); G_LogPrintf( "ClientBegin: %i", clientNum ); // count current clients and rank for scoreboard CalculateRanks(); // display the help menu, if connecting the first time if ( !client->sess.seenWelcome ) { client->sess.seenWelcome = 1; // 0 - don't show // 1 - always show to all // 2 - show only to unregistered switch ( g_showHelpOnConnection.integer ) { case 0: if (0) default: if ( !client->pers.admin ) case 1: G_TriggerMenu( client->ps.clientNum, MN_WELCOME ); } } }
/* =========== ClientBegin Called when a client has finished connecting, and is ready to be placed into the level. This will happen on every level load and level restart, but doesn't happen on respawns. ============ */ void ClientBegin( int clientNum ) { gentity_t *ent; gclient_t *client; int flags; char startMsg[ MAX_STRING_CHARS ]; ent = g_entities + clientNum; client = level.clients + clientNum; // ignore if client already entered the game if ( client->pers.connected != CON_CONNECTING ) { return; } if ( ent->r.linked ) { trap_UnlinkEntity( ent ); } G_InitGentity( ent ); ent->touch = 0; ent->pain = 0; ent->client = client; client->pers.connected = CON_CONNECTED; client->pers.enterTime = level.time; ClientAdminChallenge( clientNum ); // save eflags around this, because changing teams will // cause this to happen with a valid entity, and we // want to make sure the teleport bit is set right // so the viewpoint doesn't interpolate through the // world to the new position flags = client->ps.eFlags; memset( &client->ps, 0, sizeof( client->ps ) ); memset( &client->pmext, 0, sizeof( client->pmext ) ); client->ps.eFlags = flags; // locate ent at a spawn point ClientSpawn( ent, NULL, NULL, NULL ); trap_SendServerCommand( -1, va( "print_tr %s %s", QQ( N_("$1$^7 entered the game\n") ), Quote( client->pers.netname ) ) ); trap_Cvar_VariableStringBuffer( "g_mapStartupMessage", startMsg, sizeof( startMsg ) ); if ( *startMsg ) { trap_SendServerCommand( ent - g_entities, va( "cpd %d %s", g_mapStartupMessageDelay.integer, Quote( startMsg ) ) ); } G_namelog_restore( client ); G_LogPrintf( "ClientBegin: %i\n", clientNum ); // count current clients and rank for scoreboard CalculateRanks(); // send the client a list of commands that can be used if ( !client->pers.admin ) { G_ListCommands( ent ); } }
/* =========== ClientBegin Called when a client has finished connecting, and is ready to be placed into the level. This will happen on every level load and level restart, but doesn't happen on respawns. ============ */ void ClientBegin( int clientNum ) { gentity_t *ent; gclient_t *client; int flags; g_admin_admin_t *admin; ent = g_entities + clientNum; client = level.clients + clientNum; admin = client->pers.admin; // ignore if client already entered the game if ( client->pers.connected != CON_CONNECTING ) { return; } if ( ent->r.linked ) { trap_UnlinkEntity( ent ); } G_InitGentity( ent ); ent->touch = 0; ent->pain = 0; ent->client = client; client->pers.connected = CON_CONNECTED; client->pers.enterTime = level.time; if ( !client->pers.pubkey_authenticated && admin && admin->pubkey[ 0 ] ) { trap_SendServerCommand( ent - g_entities, va( "pubkey_decrypt %s", admin->msg2 ) ); // copy the decrypted message because generating a new message will overwrite it G_admin_writeconfig(); } // save eflags around this, because changing teams will // cause this to happen with a valid entity, and we // want to make sure the teleport bit is set right // so the viewpoint doesn't interpolate through the // world to the new position flags = client->ps.eFlags; memset( &client->ps, 0, sizeof( client->ps ) ); memset( &client->pmext, 0, sizeof( client->pmext ) ); client->ps.eFlags = flags; // locate ent at a spawn point ClientSpawn( ent, NULL, NULL, NULL ); trap_SendServerCommand( -1, va( "print_tr %s %s", QQ( N_("$1$^7 entered the game\n") ), Quote( client->pers.netname ) ) ); G_namelog_restore( client ); G_LogPrintf( "ClientBegin: %i\n", clientNum ); // count current clients and rank for scoreboard CalculateRanks(); // send the client a list of commands that can be used if ( !client->pers.admin ) { G_ListCommands( ent ); } }