| 3259 | extern qboolean G_ClearViewEntity( gentity_t *ent ); |
| 3260 | extern void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity ); |
| 3261 | void 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 | ============ |
no test coverage detected