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

Function Q3_SetViewEntity

codeJK2/game/Q3_Interface.cpp:3261–3297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3259extern qboolean G_ClearViewEntity( gentity_t *ent );
3260extern void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity );
3261void Q3_SetViewEntity(int entID, const char *name)
3262{
3263 gentity_t *self = &g_entities[entID];
3264 gentity_t *viewtarget = G_Find( NULL, FOFS(targetname), (char *) name);
3265
3266 if ( entID != 0 )
3267 {//only valid on player
3268 Q3_DebugPrint( WL_ERROR, "Q3_SetViewEntity: only valid on player\n", entID);
3269 return;
3270 }
3271
3272 if ( !self )
3273 {
3274 Q3_DebugPrint( WL_ERROR, "Q3_SetViewEntity: invalid entID %d\n", entID);
3275 return;
3276 }
3277
3278 if ( !self->client )
3279 {
3280 Q3_DebugPrint( WL_ERROR, "Q3_SetViewEntity: '%s' is not a player!\n", self->targetname );
3281 return;
3282 }
3283
3284 if ( !name )
3285 {
3286 G_ClearViewEntity( self );
3287 return;
3288 }
3289
3290 if ( viewtarget == NULL )
3291 {
3292 Q3_DebugPrint( WL_WARNING, "Q3_SetViewEntity: can't find ViewEntity: '%s'\n", name );
3293 return;
3294 }
3295
3296 G_SetViewEntity( self, viewtarget );
3297}
3298
3299/*
3300============

Callers 2

Q3_SetFunction · 0.70
Svcmd_Control_fFunction · 0.70

Calls 4

G_FindFunction · 0.70
Q3_DebugPrintFunction · 0.70
G_ClearViewEntityFunction · 0.70
G_SetViewEntityFunction · 0.70

Tested by

no test coverage detected