Example #1
0
/*QUAKED target_location (0 0.5 0) (-8 -8 -8) (8 8 8)
Set "message" to the name of this location.
Set "count" to 0-7 for color.
0:white 1:red 2:green 3:yellow 4:blue 5:cyan 6:magenta 7:white

Closest target_location in sight used for the location, if none
in site, closest in distance
*/
void SP_target_location( gentity_t *self ) {
	if ( self->targetname && self->targetname[0] ) {
		SP_target_position( self );
		return;
	} else {
		static qboolean didwarn = qfalse;

		if ( !VALIDSTRING( self->message ) ) {
			G_Printf( "target_location with no message at %s\n", vtos( self->s.origin ) );
			G_FreeEntity( self );
			return;
		}

		if ( level.locations.legacy.num >= MAX_LOCATIONS ) {
			if ( !didwarn ) {
				G_Printf( "Maximum target_locations hit (%d)! Remaining locations will be removed.\n", MAX_LOCATIONS );
				didwarn = qtrue;
			}

			G_FreeEntity( self );
			return;
		}

		VectorCopy( self->s.origin, level.locations.legacy.data[level.locations.legacy.num].origin );
		Q_strncpyz( level.locations.legacy.data[level.locations.legacy.num].message, self->message, sizeof( level.locations.legacy.data[level.locations.legacy.num].message ) );
		level.locations.legacy.data[level.locations.legacy.num].count = Com_Clampi( 0, 9, self->count );

		level.locations.legacy.num++;

		G_FreeEntity( self );
	}
}
Example #2
0
/*QUAKED target_location (0 0.5 0) (-8 -8 -8) (8 8 8)
Set "message" to the name of this location.
Set "count" to 0-7 for color.
0:white 1:red 2:green 3:yellow 4:blue 5:cyan 6:magenta 7:white

Closest target_location in sight used for the location, if none
in site, closest in distance
*/
void SP_target_location( gentity_t *self ) {
	if ( self->targetname && self->targetname[0] ) {
		SP_target_position( self );
		return;
	}
	else {
		static qboolean didwarn = qfalse;
		if ( !self->message ) {
			trap->Print( "target_location with no message at %s\n", vtos( self->s.origin ) );
			G_FreeEntity( self );
			return;
		}

		if ( level.locations.num >= MAX_LOCATIONS ) {
			if ( !didwarn ) {
				trap->Print( "Maximum target_locations hit (%d)\n", MAX_LOCATIONS );
				didwarn = qtrue;
			}
			G_FreeEntity( self );
			return;
		}

		VectorCopy( self->s.origin, level.locations.data[level.locations.num].origin );
		Q_strncpyz( level.locations.data[level.locations.num].message, self->message, sizeof( level.locations.data[level.locations.num].message ) );
		level.locations.data[level.locations.num].count = Com_Clampi( 0, 7, self->count );

		level.locations.num++;

		G_FreeEntity( self );
	}
}