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

Function ClientSpawn

code/game/g_client.cpp:2119–2470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2117
2118void G_ChangePlayerModel( gentity_t *ent, const char *newModel );
2119qboolean ClientSpawn(gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded )
2120{
2121 int index;
2122 vec3_t spawn_origin, spawn_angles;
2123 gclient_t *client;
2124 int i;
2125 clientPersistant_t saved;
2126 clientSession_t savedSess;
2127 clientInfo_t savedCi;
2128 int persistant[MAX_PERSISTANT];
2129 usercmd_t ucmd;
2130 gentity_t *spawnPoint;
2131 qboolean beamInEffect = qfalse;
2132 extern qboolean g_qbLoadTransition;
2133
2134 index = ent - g_entities;
2135 client = ent->client;
2136
2137 if ( eSavedGameJustLoaded == eFULL && g_qbLoadTransition == qfalse )//qbFromSavedGame)
2138 {//loading up a full save game
2139 ent->client->pers.teamState.state = TEAM_ACTIVE;
2140
2141 // increment the spawncount so the client will detect the respawn
2142 client->ps.persistant[PERS_SPAWN_COUNT]++;
2143 client->ps.persistant[PERS_TEAM] = client->sess.sessionTeam;
2144
2145 client->airOutTime = level.time + 12000;
2146
2147 for (i=0; i<3; i++)
2148 {
2149 ent->client->pers.cmd_angles[i] = 0.0f;
2150 }
2151
2152 SetClientViewAngle( ent, ent->client->ps.viewangles);//spawn_angles );
2153
2154 gi.linkentity (ent);
2155
2156 // run the presend to set anything else
2157 ClientEndFrame( ent );
2158
2159 // clear entity state values
2160 PlayerStateToEntityState( &client->ps, &ent->s );
2161
2162 // ALL OF MY RAGE... they decided it would be a great idea to treat NPC_type like a player model here,
2163 // which is all kinds of unbelievable. I will be having a stern talk with James later. --eez
2164 if( ent->NPC_type &&
2165 Q_stricmp( ent->NPC_type, "player" ) )
2166 {
2167 // FIXME: game doesn't like it when you pass ent->NPC_type into this func. Insert all kinds of noises here --eez
2168 char bleh[MAX_SPAWN_VARS_CHARS];
2169 Q_strncpyz(bleh, ent->NPC_type, sizeof(bleh));
2170
2171 G_ChangePlayerModel( ent, bleh );
2172 }
2173 else
2174 {
2175 G_LoadAnimFileSet( ent, ent->NPC_type );
2176 G_SetSkin( ent );

Callers 1

ClientBeginFunction · 0.70

Calls 15

Q_stricmpFunction · 0.85
Q_strncpyzFunction · 0.85
G_ChangePlayerModelFunction · 0.85
G_ReloadSaberDataFunction · 0.85
VectorCopyFunction · 0.85
G_InitPlayerFromCvarsFunction · 0.85
Quake3GameFunction · 0.85
WP_SaberAddG2SaberModelsFunction · 0.85
G_CheckPlayerDarkSideFunction · 0.85
SaberDeactivateMethod · 0.80
FreeEntityMethod · 0.80
InitEntityMethod · 0.80

Tested by

no test coverage detected