Beispiel #1
0
void counter_use()
{
// char* junk;

	self->count = self->count - 1;
	if ( self->count < 0 )
		return;

	if ( self->count != 0 )
	{
		if ( streq( activator->s.v.classname, "player" )
		     && ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOMESSAGE ) == 0 )
		{
			if ( self->count >= 4 )
				G_centerprint( activator, "There are more to go..." );
			else if ( self->count == 3 )
				G_centerprint( activator, "Only 3 more to go..." );
			else if ( self->count == 2 )
				G_centerprint( activator, "Only 2 more to go..." );
			else
				G_centerprint( activator, "Only 1 more to go..." );
		}
		return;
	}

	if ( streq( activator->s.v.classname, "player" )
	     && ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOMESSAGE ) == 0 )
		G_centerprint( activator, "Sequence completed!" );
	self->s.v.enemy = EDICT_TO_PROG( activator );
	multi_trigger();
}
Beispiel #2
0
Datei: admin.c Projekt: deurk/ktx
void ReadyThink ()
{
    float i1;
	char *txt, *gr;
    gedict_t *p=NULL, *p2=NULL;

    p2 = PROG_TO_EDICT( self->s.v.owner );
	
    if(    ( p2->ct == ctPlayer && !( p2->ready ) ) // forcestart breaked via break command
		|| ( p2->ct == ctSpec && !k_force )	// forcestart breaked via forcebreak command (spectator admin)
	  )
    {
        k_force = 0;

        G_bprint(2, "%s interrupts countdown\n", p2->netname );

        ent_remove ( self );

        return;
    }

	k_attendees = CountPlayers();

	if ( !isCanStart(NULL, true) ) {
        k_force = 0;

        G_bprint(2, "Forcestart canceled\n");

        ent_remove ( self );

        return;
	}


    self->attack_finished--;

    i1 = self->attack_finished;

    if( i1 <= 0 )
    {
        k_force = 0;

        AdminMatchStart();

        ent_remove ( self );

        return;
    }

	txt = va( "%s second%s left before game starts", dig3( i1 ), ( i1 == 1 ? "" : "s") );
	gr  = va( "\n%s!", redtext("Get ready") );

    for( p = world; (p = find_client( p )); )
		if ( p->ct == ctPlayer )
			G_centerprint(p, "%s%s", txt, (p->ready ? "" : gr));
		else
			G_centerprint(p, "%s", txt);

    self->s.v.nextthink = g_globalvars.time + 1;
}
Beispiel #3
0
void trigger_onlyregistered_touch(  )
{
	gedict_t *te;

	if ( strneq( other->s.v.classname, "player" ) )
		return;
	if ( !Activated( self, other ) )
	{
		if ( self->else_goal )
		{
			te = Findgoal( self->else_goal );
			if ( te )
				AttemptToActivate( te, other, self );
		}
		return;
	}
	if ( self->attack_finished > g_globalvars.time )
		return;

	self->attack_finished = g_globalvars.time + 2;
	if ( trap_cvar( "registered" ) )
	{
		self->s.v.message = "";
		activator = other;
		SUB_UseTargets(  );
		ent_remove( self );
	} else
	{
		if ( self->s.v.message && strneq( self->s.v.message, "" ) )
		{
			G_centerprint( other, "%s", self->s.v.message );
			sound( other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM );
		}
	}
}
Beispiel #4
0
/*
================
secret_touch

Prints messages
================
*/
void secret_touch()
{
	if ( strneq( other->s.v.classname, "player" ) )
		return;
	
	if ( self->attack_finished > g_globalvars.time )
		return;

	self->attack_finished = g_globalvars.time + 2;

	if ( self->s.v.message )
	{
		G_centerprint( other, self->s.v.message );
		sound( other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM );
	}
}
Beispiel #5
0
//=========================================================================
// Make the spy who owns this timer undercover, and then remove itself
void TeamFortress_SpyUndercoverThink(  )
{
	gedict_t *owner = PROG_TO_EDICT( self->s.v.owner );

	if ( owner->playerclass != PC_SPY )
		return;
	if ( owner->is_undercover == 2 )
	{
		if ( tf_data.invis_only == 1 )
		{
			owner->s.v.items = ( int ) owner->s.v.items | IT_INVISIBILITY;
			owner->s.v.frame = 0;
			owner->s.v.modelindex = modelindex_eyes;
			owner->is_undercover = 1;
		} else
		{
			owner->immune_to_check = g_globalvars.time + tf_data.cheat_pause;	//10;
			if ( self->s.v.skin )
			{
				owner->undercover_skin = self->s.v.skin;
				TeamFortress_SetSkin( owner );
				G_sprint( owner, 2, "Skin set to " );
				TeamFortress_PrintClassName( owner, self->s.v.skin, 0 );
			}
			if ( self->s.v.team )
			{
				owner->undercover_team = self->s.v.team;
				TeamFortress_SetColor( owner, TeamFortress_TeamGetTopColor( self->s.v.team ),
					  TeamFortress_TeamGetColor( self->s.v.team ) - 1 );

				TeamFortress_SetSkin( owner );
				G_sprint( owner, 2, "Colors set to Team %.0f\n", self->s.v.team );
			}
			TeamFortress_SpyCalcName( owner );
			if ( !owner->StatusBarSize )
				G_centerprint( owner, "You are now disguised.\n" );
			owner->is_undercover = 1;
		}
	}
	owner->StatusRefreshTime = g_globalvars.time + 0.1;
	dremove( self );
}
Beispiel #6
0
void trigger_onlyregistered_touch()
{
	if ( strneq( other->s.v.classname, "player" ) )
		return;
	if ( self->attack_finished > g_globalvars.time )
		return;

	self->attack_finished = g_globalvars.time + 2;
	if ( trap_cvar( "registered" ) )
	{
		self->s.v.message = "";
		activator = other;
		SUB_UseTargets();
		ent_remove( self );
	} else
	{
		if ( self->s.v.message && strneq( self->s.v.message, "" ) )
		{
			G_centerprint( other, self->s.v.message );
			sound( other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM );
		}
	}
}
Beispiel #7
0
/*
================
door_touch

Prints messages and opens key doors
================
*/
void door_touch()
{
	char           *msg;

	if ( strneq( other->s.v.classname, "player" ) )
		return;

	if ( PROG_TO_EDICT( self->s.v.owner )->attack_finished > g_globalvars.time )
		return;

	PROG_TO_EDICT( self->s.v.owner )->attack_finished = g_globalvars.time + 2;
	msg = PROG_TO_EDICT( self->s.v.owner )->s.v.message;

	if ( msg && msg[0] )
	{
		G_centerprint( other, PROG_TO_EDICT( self->s.v.owner )->s.v.message );
		sound( other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM );
	}
// key door stuff
	if ( self->s.v.items == 0 )
		return;

// FIXME: blink key on player's status bar
	if ( ( ( int ) self->s.v.items & ( int ) other->s.v.items ) != self->s.v.items )
	{
		if ( PROG_TO_EDICT( self->s.v.owner )->s.v.items == IT_KEY1 )
		{
			if ( world->worldtype == 2 )
			{
				G_centerprint( other, "You need the silver keycard" );
				sound( self, CHAN_VOICE, self->s.v.noise3, 1,
					    ATTN_NORM );
			} else if ( world->worldtype == 1 )
			{
				G_centerprint( other, "You need the silver runekey" );
				sound( self, CHAN_VOICE, self->s.v.noise3, 1,
					    ATTN_NORM );
			} else if ( world->worldtype == 0 )
			{
				G_centerprint( other, "You need the silver key" );
				sound( self, CHAN_VOICE, self->s.v.noise3, 1,
					    ATTN_NORM );
			}
		} else
		{
			if ( world->worldtype == 2 )
			{
				G_centerprint( other, "You need the gold keycard" );
				sound( self, CHAN_VOICE, self->s.v.noise3, 1,
					    ATTN_NORM );
			} else if ( world->worldtype == 1 )
			{
				G_centerprint( other, "You need the gold runekey" );
				sound( self, CHAN_VOICE, self->s.v.noise3, 1,
					    ATTN_NORM );
			} else if ( world->worldtype == 0 )
			{
				G_centerprint( other, "You need the gold key" );
				sound( self, CHAN_VOICE, self->s.v.noise3, 1,
					    ATTN_NORM );
			}
		}
		return;
	}

	other->s.v.items -= self->s.v.items;
	self->s.v.touch = ( func_t ) SUB_Null;

	if ( self->s.v.enemy )
		PROG_TO_EDICT( self->s.v.enemy )->s.v.touch = ( func_t ) SUB_Null;	// get paired door

	door_use();
}
Beispiel #8
0
/*
==============================
SUB_UseTargets

the global "activator" should be set to the entity that initiated the firing.

If self.delay is set, a DelayedUse entity will be created that will actually
do the SUB_UseTargets after that many seconds have passed.

Centerprints any self.message to the activator.

Removes all entities with a targetname that match self.killtarget,
and removes them, so some events can remove other triggers.

Search for (string)targetname in all entities that
match (string)self.target and call their .use function

==============================
*/
void SUB_UseTargets()
{
	gedict_t       *t, *stemp, *otemp, *act;

//
// check for a delay
//
	if ( self->delay )
	{
		// create a temp object to fire at a later time
		t = spawn();
		t->s.v.classname = "DelayedUse";
		t->s.v.nextthink = g_globalvars.time + self->delay;
		t->s.v.think = ( func_t ) DelayThink;
		t->s.v.enemy = EDICT_TO_PROG( activator );
		t->s.v.message = self->s.v.message;
		t->killtarget = self->killtarget;
		t->s.v.target = self->s.v.target;
		return;
	}

//
// print the message
//activator->s.v.classname && 
	if ( streq( activator->s.v.classname, "player" ) && self->s.v.message )
		if ( strneq( self->s.v.message, "" ) )
		{
			G_centerprint( activator, self->s.v.message );
			if ( !self->s.v.noise )
				sound( activator, CHAN_VOICE, "misc/talk.wav", 1,
					    ATTN_NORM );
		}
//
// kill the killtagets
//
	if ( self->killtarget )
	{
		t = world;
		do
		{
			t = find( t, FOFS( s.v.targetname ), self->killtarget );
			if ( !t )
				return;
			ent_remove( t );
		}
		while ( 1 );
	}
//
// fire targets
//
	if ( self->s.v.target )
	{
		act = activator;
		t = world;
		do
		{

			t = find( t, FOFS( s.v.targetname ), self->s.v.target );
			if ( !t )
			{
				return;
			}
			stemp = self;
			otemp = other;
			self = t;
			other = stemp;
			//if (self.use != SUB_Null)
			{
				if ( self->s.v.use )
					( ( void ( * )() ) ( self->s.v.use ) ) ();
			}
			self = stemp;
			other = otemp;
			activator = act;
		}while ( 1 );
	}


}
Beispiel #9
0
void RefreshStatusBar( gedict_t * pl )
{
	int     win;
	int     sec;
	gedict_t *te;
	const char *status_size,*status;
	char   stmp[1024];
	int    clip;

	if ( !pl->StatusBarSize )
	{
		pl->StatusRefreshTime = g_globalvars.time + 60;
		return;
	}
	pl->StatusRefreshTime = g_globalvars.time + 1.5;
	if ( !pl->playerclass )
		return;

	status_size = GetStatusSize( pl );
	status = default_status;

	if ( pl->playerclass == 9 || ( (pl->playerclass == 2 ||
	     pl->playerclass == 3 || pl->playerclass == 5 || 
	     pl->playerclass == 6 || pl->playerclass == 7 || tg_data.tg_sbar) && tfset(tg_enabled)) )
	{			/// eng sbar
	        status = GetEngSbar( pl );
	} else
	{
		if ( pl->playerclass == 8 )
		        status = GetSpySbar( pl );

		if ( pl->playerclass == 4 )
		{
			if ( pl->is_detpacking )
			{
				status = "  setting detpack                      ";
			} else
			{
				for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), "detpack" ));)
				{
					if ( te->s.v.owner != EDICT_TO_PROG( self ) )
						continue;
					_snprintf( stmp, sizeof(stmp) , "Detpack: %d                 ",
						 ( int ) ( te->s.v.nextthink - g_globalvars.time ) );
					status = stmp;
					break;
				}
			}
		}
		if ( pl->playerclass == 1 )
		{
			_snprintf( stmp, sizeof(stmp), "Scan %3d %s%s %3s                       ",
				 pl->ScanRange, ( pl->tf_items_flags & 1 ) ? "En" : "  ",
				 ( pl->tf_items_flags & 2 ) ? "Fr" : "  ", ( pl->ScannerOn ) ? "On " : "Off" );
			status = stmp;
		}
	}

	win = TeamFortress_TeamGetWinner(  );
	sec = TeamFortress_TeamGetSecond(  );
	clip = GetClipSize( pl );
	if( clip >= 0)
	        G_centerprint( pl, "%s%s\n%s%3d %s%3d  " _C _L _I _P ":%2d\n", status_size, status, 
	        teamnames[win], TeamFortress_TeamGetScore( win ), teamnames[sec], TeamFortress_TeamGetScore( sec ),
	        clip);
	else
	        G_centerprint( pl, "%s%s\n%s%3d %s%3d         \n", status_size, status, 
	        teamnames[win], TeamFortress_TeamGetScore( win ), teamnames[sec], TeamFortress_TeamGetScore( sec ));
}