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

Function Q3_LookTarget

code/game/Q3_Interface.cpp:5942–5980  ·  view source on GitHub ↗

============ Q3_LookTarget ? ============ */

Source from the content-addressed store, hash-verified

5940============
5941*/
5942static void Q3_LookTarget( int entID, char *targetName)
5943{
5944 gentity_t *ent = &g_entities[entID];
5945
5946 if ( !ent )
5947 {
5948 Quake3Game()->DebugPrint( IGameInterface::WL_WARNING, "Q3_LookTarget: invalid entID %d\n", entID);
5949 return;
5950 }
5951
5952 if ( !ent->client )
5953 {
5954 Quake3Game()->DebugPrint( IGameInterface::WL_ERROR, "Q3_LookTarget: '%s' is not an NPC/player!\n", ent->targetname );
5955 return;
5956 }
5957
5958 if(Q_stricmp("none", targetName) == 0 || Q_stricmp("NULL", targetName) == 0)
5959 {//clearing look target
5960 NPC_ClearLookTarget( ent );
5961 return;
5962 }
5963
5964 gentity_t *targ = G_Find(NULL, FOFS(targetname), targetName);
5965 if(!targ)
5966 {
5967 targ = G_Find(NULL, FOFS(script_targetname), targetName);
5968 if (!targ)
5969 {
5970 targ = G_Find(NULL, FOFS(NPC_targetname), targetName);
5971 if (!targ)
5972 {
5973 Quake3Game()->DebugPrint( IGameInterface::WL_ERROR, "Q3_LookTarget: Can't find ent %s\n", targetName );
5974 return;
5975 }
5976 }
5977 }
5978
5979 NPC_SetLookTarget( ent, targ->s.number, 0 );
5980}
5981
5982/*
5983============

Callers 1

SetMethod · 0.70

Calls 6

Quake3GameFunction · 0.85
Q_stricmpFunction · 0.85
DebugPrintMethod · 0.80
NPC_ClearLookTargetFunction · 0.70
G_FindFunction · 0.70
NPC_SetLookTargetFunction · 0.70

Tested by

no test coverage detected