示例#1
0
文件: spectate.c 项目: MrPnut/QHome
/*
================
SpectatorImpulseCommand

Called by SpectatorThink if the spectator entered an impulse
================
*/
void SpectatorImpulseCommand(  )
{
	gedict_t *goal;

	if ( self->s.v.impulse == 1 )
	{
		// teleport the spectator to the next spawn point
		// note that if the spectator is tracking, this doesn't do
		// much
		goal = PROG_TO_EDICT( self->s.v.goalentity );
		goal = trap_find( goal, FOFS( s.v.classname ), "info_player_deathmatch" );
		if ( !goal )
			goal = trap_find( world, FOFS( s.v.classname ), "info_player_deathmatch" );
		if ( goal )
		{
			setorigin( self, PASSVEC3( goal->s.v.origin ) );
			VectorCopy( goal->s.v.angles, self->s.v.angles );
			self->s.v.fixangle = true;	// turn this way immediately
		} else
			goal = world;
		self->s.v.goalentity = EDICT_TO_PROG( goal );
	}

	self->s.v.impulse = 0;
}
示例#2
0
文件: spy.c 项目: MrPnut/QHome
//=========================================================================
// Try and find the player's name who's skin and team closest fit the 
// current disguise of the spy
void TeamFortress_SpyCalcName( gedict_t * spy )
{
	gedict_t *te;

	spy->undercover_name = NULL;
	// Find a player on the team the spy is disguised as to pretend to be
	if ( spy->undercover_team )
	{
		for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), "player" )); )
		{
		        // First, try to find a player with same color and skins
			if ( te->team_no == spy->undercover_team && te->s.v.skin == spy->undercover_skin )
			{
				spy->undercover_name = te->s.v.netname;
				break;
			}
		}
		// If we couldn't, just find one of that team
		if ( !spy->undercover_name )
		{

			for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), "player" )); )
			{
				if ( te->team_no == spy->undercover_team )
				{
					spy->undercover_name = te->s.v.netname;
					break;
				}
			}
		}
	}
}
示例#3
0
文件: vote.c 项目: MrPnut/QHome
void Vote_Elect_Yes()
{
	int 		f1, needed_votes;
	gedict_t* 	p = world;

	if(!k_vote) return;

	if(self->k_voted) {
		G_sprint(self, 2, "--- your vote is still good ---\n");
		return;
	}

// register the vote
	k_vote ++;
	G_bprint(2, "%s gives his vote\n",self->s.v.netname);
	f1 = CountPlayers();
	needed_votes = (int)(f1 * elect_percentage / 100)+1 - k_vote;

	//if(  elect_percentage * f1 < 100 * k_vote ) 
	if( needed_votes < 1)
	{
		k_vote = 0;
		current_vote = -1;
        	while((p = trap_find(p, FOFS(s.v.classname), "player"))) 
        	{
			if( p->s.v.netname[0] ) p->k_voted = 0;
		}

		p = trap_find(world, FOFS(s.v.classname), "voteguard");
		if(p) {
			p->s.v.classname  = "";
		 dremove(p);
		}
		G_bprint(2,  "%s ηαιξσ αδνιξ στατυσ!\n", elect_player->s.v.netname);
		G_sprint(elect_player, 2, "Type γνδ αδνιξ for admin commands.\n");
		elect_player->is_admin = elect_level;
		return;	
	}

// calculate how many more votes are needed
	self->k_voted = 1;

	if( needed_votes > 1)
		G_bprint(2, "%d‘ total votes needed\nType ", needed_votes);
	else
		G_bprint(2, "%d‘ total vote needed\nType ", needed_votes);


}
示例#4
0
文件: ui.c 项目: MrPnut/QHome
void BotReport(  )
{
	gedict_t *te;


	for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "player" ) ); )
	{
		if ( te->has_disconnected )
			continue;
		if ( te->isBot )
		{
                   G_bprint(3,"Bot: %s, state %d, menu %d flags %d velocity %3.0f\norigin [%.0f %.0f %.0f]\n",
                           te->s.v.netname,te->action,te->current_menu,
                           (int)(te->s.v.flags),
                           vlen(te->s.v.velocity),
                           PASSVEC3(te->s.v.origin)
                   );

                   if( te->wp )
                       G_bprint(3, "wp     [%.0f %.0f %.0f]\n", PASSVEC3(te->wp->origin));
                   else
                       G_bprint(3, "nowp\n");

                   if( te->end_wp )
                       G_bprint(3, "endwp  [%.0f %.0f %.0f]\n", PASSVEC3(te->end_wp->origin));

		}
	}
}
示例#5
0
/*
=============
t_movetarget

Something has bumped into a movetarget.  If it is a monster
moving towards it, change the next destination and continue.
==============
*/
void t_movetarget(  )
{
	gedict_t *temp;
	vec3_t  tmpv;

	if ( other->movetarget != self )
		return;

	if ( other->s.v.enemy )
		return;		// fighting, not following a path

	temp = self;
	self = other;
	other = temp;

	self->movetarget = trap_find( world, FOFS( s.v.targetname ), other->s.v.target );
	self->s.v.goalentity = EDICT_TO_PROG( self->movetarget );

	VectorSubtract( self->movetarget->s.v.origin, self->s.v.origin, tmpv );
	self->s.v.ideal_yaw = vectoyaw( tmpv );
	if ( !self->movetarget )
	{
		self->pausetime = g_globalvars.time + 999999;
//  self.th_stand (); //monster code
		return;
	}
}
示例#6
0
文件: engineer.c 项目: MrPnut/QHome
//=======================================
// TG Stuff
void Eng_SGUp(  )
{
    gedict_t *sg;
//    int numupg = 0;

    for ( sg = world; (sg = trap_find( sg, FOFS( s.v.classname ), "building_sentrygun" )); )
    {
	if ( sg->s.v.weapon == 3 && sg->s.v.ammo_shells == 144 && sg->s.v.ammo_rockets == 20
	     && sg->s.v.health == sg->s.v.max_health )
	    continue;

	sg->s.v.weapon = 3;
	sg->s.v.max_health = 216;
	sg->maxammo_shells = 144;
	sg->s.v.health = sg->s.v.max_health;
	sound( sg, 3, "weapons/turrset.wav", 1, 1 );
	sg->s.v.think = ( func_t ) lvl3_sentry_stand;
	sg->s.v.skin = 2;
	G_sprint( self, 2, "You have upgraded/fixed/reloaded sentrygun\n" );
	sg->s.v.ammo_shells = 144;
	sg->s.v.ammo_rockets = 20;
	return;
    }
    G_sprint( self, 2, "no sg to upgrade\n" );
}
示例#7
0
文件: vote.c 项目: MrPnut/QHome
void Vote_Elect_No()
{
	gedict_t* p;
	int f1, needed_votes;

// withdraw one's vote
	if(!k_vote || !self->k_voted) return;

	G_bprint(2, "%s withdraws his vote\n",self->s.v.netname);
	self->k_voted = 0;
	k_vote--;
	if(!k_vote) {
		G_bprint(3, "Voting is closed\n");
		p = trap_find(world, FOFS(s.v.classname), "voteguard");
		if(p) 
		{
			p->s.v.classname  = "";
		 	dremove(p);
		}
		current_vote = -1;
		return;
	}

	f1 = CountPlayers();
	needed_votes = (int)(f1 * elect_percentage / 100)+1 - k_vote;

	
	if(needed_votes > 1)
		G_bprint(2, "%d‘ more votes needed\n",needed_votes);
	else
		G_bprint(2, "%d‘ more vote needed\n",needed_votes);
}
示例#8
0
文件: tforttm.c 项目: MrPnut/QHome
void TeamFortress_TeamShowMemberClasses( gedict_t * Player )
{
	gedict_t *e;
	int     found = 0;

	found = 0;

	for ( e = world; ( e = trap_find( e, FOFS( s.v.classname ), "player" ) ); )
	{
		if ( ( e->team_no == Player->team_no || !e->team_no ) && e != Player )
		{
			if ( e->s.v.model && e->s.v.model[0] )
			{
				if ( !found )
				{
					found = 1;
					G_sprint( Player, 2, "The other members of your team are:\n" );
				}
				G_sprint( Player, 2, "%s : ", e->s.v.netname );
				TeamFortress_PrintClassName( Player, e->playerclass, e->tfstate & 8 );
			}
		}
	}
	if ( !found )
		G_sprint( Player, 2, "There are no other players on your team.\n" );
}
示例#9
0
int Sentry_FindTarget_Angel(  )
{
    gedict_t *client;
    gedict_t *enemy = PROG_TO_EDICT( self->s.v.enemy );

    if ( enemy != world )
    {
        if ( CheckTarget( enemy ) )
        {
            if ( g_globalvars.time > self->height )
            {
                Sentry_FoundTarget(  );
                return 1;
            } else
                return 0;
        }
    }
    for ( client = world; (client = trap_find( client, FOFS( s.v.classname ), "player" )); )
    {
        if ( CheckTarget( client ) )
        {
            self->s.v.enemy = EDICT_TO_PROG( client );
            self->height = g_globalvars.time + 0.1 * ( int ) ( g_random(  ) * tfset_sgppl );
            //     self.height = g_globalvars.time + 0.1 * Q_rint(sgppl);
            if ( self->height == g_globalvars.time )
            {
                Sentry_FoundTarget(  );
                return 1;
            }
            return 0;
        }
    }
    self->s.v.enemy = EDICT_TO_PROG( world );
    return 0;
}
示例#10
0
文件: vote.c 项目: MrPnut/QHome
void Vote_ChangeMap_No()
{
	gedict_t* p;
	int f1, f2;

// withdraw one's vote
	if(!k_vote || !self->k_voted) return;

	G_bprint(2, "%s would rather play this map\n",self->s.v.netname);
	self->k_voted = 0;
	k_vote--;
	if(!k_vote) {
		G_bprint(3, "Voting is closed\n");
		p = trap_find(world, FOFS(s.v.classname), "voteguard");
		if(p) 
		{
			p->s.v.classname  = "";
		 	dremove(p);
		}
		current_vote = -1;
		return;
	}
	f1 = CountPlayers();
	f2 = (f1 / 2) + 1;
	f1 = f2 - k_vote;
	if(f1 > 1)
		G_bprint(2, "%d‘ more votes needed\n",f1);
	else
		G_bprint(2, "%d‘ more vote needed\n",f1);
}
示例#11
0
文件: tforttm.c 项目: MrPnut/QHome
int TeamFortress_GetNoPlayers(  )
{
	int     nump = 0;
	gedict_t *search;

	for ( search = world;( search = trap_find( search, FOFS( s.v.classname ), "player" ) ) ; )
		nump++;
	return nump;
}
示例#12
0
文件: vote.c 项目: MrPnut/QHome
void Vote_ChangeMap_Yes()
{
	int 		f1, f2;
	gedict_t* 	p = world;

	if(!k_vote) return;

	if(self->k_voted) {
		G_sprint(self, 2, "--- your vote is still good ---\n");
		return;
	}

// register the vote
	k_vote ++;
	G_bprint(2, "%s votes for mapchange\n",self->s.v.netname);
	f1 = CountPlayers();
	f2 = f1 / 2 + 1;
	if(k_vote >= f2) {
		G_bprint(3, "Map changed by majority vote\n");
		k_vote = 0;
		current_vote = -1;
        	while((p = trap_find(p, FOFS(s.v.classname), "player"))) 
        	{
			if(p->s.v.netname[0] ) p->k_voted = 0;
		}

		p = trap_find(world, FOFS(s.v.classname), "voteguard");
		if(p) {
			p->s.v.classname  = "";
		 dremove(p);
		}
		NextLevel();
		return;
	}

// calculate how many more votes are needed
	self->k_voted = 1;
	f1 = f2 - k_vote;
	if(f1>1)
		G_bprint(2, "%d‘ more votes needed\n",f1);
	else
		G_bprint(2, "%d‘ more vote needed\n",f1);	
}
示例#13
0
文件: vote.c 项目: MrPnut/QHome
int CountPlayers()
{
	gedict_t	*p=world;
	int 		num = 0;

	while((p = trap_find(p, FOFS(s.v.classname), "player"))) 
		if(p->s.v.netname[0]) 
			num++;

	return num;
}
示例#14
0
文件: tforttm.c 项目: MrPnut/QHome
int TeamFortress_TeamGetNoPlayers( int tno )
{
	int     size_team = 0;
	gedict_t *search;

	for ( search = world; ( search = trap_find( search, FOFS( s.v.classname ), "player" ) ); )
	{
		if ( search->team_no == tno )
			size_team++;
	}
	return size_team;
}
示例#15
0
文件: tforttm.c 项目: MrPnut/QHome
void teamsprint( int tno, gedict_t * ignore, char *st )
{
	gedict_t *te;

	if ( !tno )
		return;

	for ( te = world;( te = trap_find( te, FOFS( s.v.classname ), "player" ) ) ; )
	{
		if ( te->team_no == tno && te != ignore )
			G_sprint( te, 2, st );
	}
}
示例#16
0
文件: vote.c 项目: MrPnut/QHome
void VoteThink()
{
	gedict_t* p=world;

	G_bprint(2, "The voting has timed out.\n");
	self->s.v.nextthink = -1;
	k_vote = 0;
	current_vote = -1;
        while((p = trap_find(p, FOFS(s.v.classname), "player"))) 
        {
		if(p->s.v.netname[0] ) p->k_voted = 0;
	}
	dremove(self);
}
示例#17
0
void TeamFortress_HelpMap(  )
{
	gedict_t *te;

	te = trap_find( world, FOFS( s.v.classname ), "info_tfdetect" );
	if ( te )
	{
		if ( te->non_team_broadcast )
		{
			G_sprint( self, 2, "%s", te->non_team_broadcast );
			return;
		}
	}
	G_sprint( self, 2, "There is no help for this map.\n" );
}
示例#18
0
文件: ui.c 项目: MrPnut/QHome
void RemoveBot(  )
{
	gedict_t *te;


	for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "player" ) ); )
	{
		if ( te->has_disconnected )
			continue;
		if ( te->isBot )
			break;
	}

	if ( !te )
		return;
	botDisconnect( te );
}
示例#19
0
文件: engineer.c 项目: MrPnut/QHome
//=========================================================================
// Function handling the Engineer's build impulse
void TeamFortress_EngineerBuild(  )
{
    gedict_t *te;

/*    if ( !( ( int ) self->s.v.flags & FL_ONGROUND ) )
    {
	CenterPrint( self, "You can't build in the air!\n\n" );
	return;
    }*/
    // Pop up the menu
    if ( !self->is_building )
    {
        if(!tg_data.tg_enabled)
        {
        	if ( self->s.v.ammo_cells < 100 && !self->has_dispenser && !self->has_sentry )
        	{
        	    CenterPrint( self, "You don't have enough metal to \nbuild anything.\n\n" );
        	    return;
        	}
        }
	self->current_menu = MENU_ENGINEER;
	self->menu_count = MENU_REFRESH_RATE;
    } else
    {
//	if ( self->is_building == 1 )
//	{
	    G_sprint( self, 2, "You stop building.\n" );
	    self->tfstate = self->tfstate - ( self->tfstate & TFSTATE_CANT_MOVE );
	    TeamFortress_SetSpeed( self );
	    // Remove the timer
	    for ( te = world; (te = trap_find( te, FOFS( s.v.netname ), "build_timer" )); )
	    {
		if ( te->s.v.owner == EDICT_TO_PROG( self ) )
		{
		    dremove( te );
		    break;
		}
	    }
	    self->is_building = 0;
	    self->current_weapon = self->s.v.weapon;
	    W_SetCurrentAmmo(  );
//	}
    }
}
示例#20
0
文件: tforttm.c 项目: MrPnut/QHome
void TeamFortress_TeamIncreaseScore( int tno, int scoretoadd )
{
	gedict_t *e;

	if ( !tno || !scoretoadd || tno > 4 )
		return;
	teamscores[tno] += scoretoadd;

	if ( ( tf_data.toggleflags & TFLAG_TEAMFRAGS ) || ( tf_data.toggleflags & TFLAG_FULLTEAMSCORE ) )
	{
		
		for ( e = world; ( e = trap_find( e, FOFS( s.v.classname ), "player" ) ) ; )
		{
			if ( e->team_no == tno )
				e->s.v.frags = TeamFortress_TeamGetScore( tno );
		}
	}
	UpdateServerinfoScores();
}
示例#21
0
文件: engineer.c 项目: MrPnut/QHome
void Eng_SGReload(  )
{
    gedict_t *sg;

    for ( sg = world; (sg = trap_find( sg, FOFS( s.v.classname ), "building_sentrygun" )); )
    {
	if ( sg->s.v.ammo_shells == sg->maxammo_shells && sg->s.v.ammo_rockets == sg->maxammo_rockets
	     && sg->s.v.health == sg->s.v.max_health )
	    continue;
	sg->s.v.health = sg->s.v.max_health;
	sg->s.v.ammo_shells = sg->maxammo_shells;
	sg->s.v.ammo_rockets = sg->maxammo_rockets;
	sound( sg, 3, "weapons/turrset.wav", 1, 1 );
	G_sprint( self, 2, "You have fixed/reloaded ONE sentrygun\n" );
	return;
    }
    G_sprint( self, 2, "no sg to reload\n" );

}
示例#22
0
文件: tforttm.c 项目: MrPnut/QHome
int ClassIsRestricted( int tno, int pc )
{
	int     max, num = 0;
	gedict_t *te;

	if ( pc <= 0 || pc > 10 )
		return 0;
	if ( !tno )
		return 0;

	max = GetSVInfokeyInt( li_classrestricted[pc-1][0], li_classrestricted[pc-1][1], 0 );

	if ( max > 0 )
	{
	        for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "player" ) ); )
		{
			if ( te->team_no == tno )
			{
				if ( pc == 10 )
				{
					if ( te->tfstate & TFSTATE_RANDOMPC )
						num++;
				} else
				{
					if ( te->playerclass == pc || te->nextpc == pc )
					{
						if ( !( te->tfstate & TFSTATE_RANDOMPC ) )
							num++;
					}
				}
			}
		}
		if ( num >= max )
			return 1;
	}
	if ( max == -1 )
		return 1;
	return 0;
}
示例#23
0
文件: engineer.c 项目: MrPnut/QHome
void Eng_DispUnload(  )
{
    gedict_t *disp;
    float power;

    for ( disp = world; (disp = trap_find( disp, FOFS( s.v.classname ), "building_dispenser" )); )
    {
	disp->s.v.ammo_cells = disp->s.v.ammo_cells - 20;
	disp->s.v.ammo_rockets = disp->s.v.ammo_rockets - 15;
	if ( disp->s.v.ammo_rockets < 0 )
	    disp->s.v.ammo_rockets = 0;
	if ( disp->s.v.ammo_cells < 0 )
	    disp->s.v.ammo_cells = 0;
	self->hook_out = 0;
	power = ceil( 25 + disp->s.v.ammo_rockets * 1.5 + disp->s.v.ammo_cells );
	if ( power > 250 )
	    power = 250;
	G_bprint( 2, "maximum detdispenser damage - %.0f\n", power );
	return;
    }
    G_sprint( self, 2, "no disp\n" );
}
示例#24
0
文件: qw.c 项目: stayoutEE/TF2003-qvm
void BotFrame( void )
{
	gedict_t *te, *oself;

	oself = self;
	for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "player" ) ); )
	{
		if ( te->has_disconnected )
			continue;

		if ( !te->isBot )
			continue;

		self = te;
		if( !tf_data.enable_bot )
		{
		        botDisconnect( self );
		        continue;
		}
		self->old_button0 = self->s.v.button0;
		self->old_button2 = self->s.v.button2;
		self->old_keys = self->keys;

               	self->s.v.button0 = 0;
       		self->s.v.button2 = 0;
       		self->s.v.impulse = 0;
       		self->keys = 0;
       		if( self->team_no && self->team_no != 1)
       		{
       		        G_bprint(3,"%s: i'm dont know how to play for team 2\n",self->s.v.netname);
       		        botDisconnect(self);
       		        continue;
       		}
       		Bot_AI(  );
		Bot_CL_KeyMove(  );
	}
	self = oself;

}
示例#25
0
文件: engineer.c 项目: MrPnut/QHome
void DestroyBuilding( gedict_t * eng, char *bld )
{
    gedict_t *te;
    gedict_t *oldself;
    float pos;

    for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), bld )); )
    {
	if ( te->real_owner == eng )
	{
	    pos = trap_pointcontents( PASSVEC3( te->s.v.origin ) );
	    if ( pos == CONTENT_SOLID || pos == CONTENT_SKY )
	    {
		oldself = self;
		self = eng;
		self->s.v.ammo_cells = self->s.v.ammo_cells + 100;
		bound_other_ammo( self );
		W_SetCurrentAmmo(  );
		self = oldself;
	    }
	    if ( te->real_owner->building == te )
	    {
		if ( !te->real_owner->StatusBarSize )
		    CenterPrint( te->real_owner, "\n" );
		else
		    te->real_owner->StatusRefreshTime = g_globalvars.time + 0.1;
		te->real_owner->menu_count = MENU_REFRESH_RATE;
		te->real_owner->current_menu = MENU_DEFAULT;
		te->real_owner->building = world;
	    }
          if( tg_data.tg_enabled )
	    	te->has_sentry = 0;
	    TF_T_Damage( te, world, world, 500, 0, 0 );
	}
    }
}
示例#26
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 ));
}
示例#27
0
文件: tforttm.c 项目: MrPnut/QHome
void TeamFortress_TeamShowMemberClasses_New( gedict_t * Player )
{
	int		stf;
	gedict_t*	e,*te;
	int	found = 0;
	stf = self->settings_bits;
	for(e= world; (e = trap_find( e, FOFS( s.v.classname ), "player" )); )
	{
		if ( ( e->team_no == Player->team_no /*|| !e->team_no*/ ) && e != Player )
		{
			if ( e->s.v.model && e->s.v.model[0] )
			{
				if ( !found )
				{
					found = 1;
					G_sprint( Player, 2, "The other members of your team are:\n" );
				}
				G_sprint( Player, 2, "%s : %s", e->s.v.netname, TeamFortress_GetClassName(e->playerclass) );

				if ( e->tfstate & TFSTATE_RANDOMPC)
					G_sprint(Player, 2, " (Random)");
				if( !e->playerclass)
				{
					G_sprint(Player, 2, "\n");
					continue;
				}
				if((stf & TF_STATUS_STATS_MASK) ==0)
				{

					if(e->s.v.armortype == (float) 0.8)
						G_sprint(Player, 2, " R");
					else if(e->s.v.armortype == (float) 0.6)
						G_sprint(Player, 2, " Y");
					else if(e->s.v.armortype == (float) 0.3)
						G_sprint(Player, 2, " G");
					else 
						G_sprint(Player, 2, "  ");

					G_sprint(Player, 2, "%.0f/%.0f",e->s.v.armorvalue,e->s.v.health);

					if((e->playerclass == PC_SPY) && ((stf & TF_STATUS_SPY_MASK) ==0))
					{
					        if( e->undercover_team ) 
					                G_sprint(Player, 2, " %s", GetTeamName(e->undercover_team));
					        if( e->undercover_skin ) 
					                G_sprint(Player, 2, " %s", TeamFortress_GetClassName(e->undercover_skin));
					}

					if((e->playerclass == PC_DEMOMAN) && ((stf & TF_STATUS_DETPACK_MASK) !=0))
					{
						for(te= world; (te = trap_find( te, FOFS( s.v.classname ), "detpack" )); )
						{
							if (te->s.v.owner == EDICT_TO_PROG(e))
							{
								G_sprint(Player, 2, " DTP:%.0f", te->s.v.nextthink - g_globalvars.time);
								break;
							}
						}
					}
					if((e->playerclass == PC_ENGINEER) && ((stf & TF_STATUS_SENTRY_MASK) !=0))
					{

						if( e->has_sentry)
						{
							for(te= world; (te = trap_find( te, FOFS( s.v.classname ), "building_sentrygun" )); )
							{
								if (te->real_owner == e)
								{
									G_sprint(Player, 2, " SENTRY:%.0f", te->s.v.weapon );
									break;
								}
							}
						}else
						{
							G_sprint(Player, 2, " NOSENTRY");
						}
					}
					if((stf & TF_STATUS_COORD_MASK) !=0)
						G_sprint(Player, 2, " '%3.0f %3.0f %3.0f'",PASSVEC3(e->s.v.origin));
					G_sprint(Player, 2, "\n");
				}
			}
		}
	
	}
	if ( !found )
		G_sprint( Player, 2, "There are no other players on your team.\n" );
}
示例#28
0
const char* GetEngSbar( gedict_t * pl )
{
        const char  *build;
        char        *strp;
        gedict_t    *te;
        static char sg_status[1024];

        if( pl->is_building )
                build = "  building                             ";
        else
                build = "                                       ";

        if( !pl->has_dispenser && !pl->has_sentry )
                return build;
                        
        strp = sg_status;

      	if ( pl->has_dispenser )
      	{

        	for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), "building_dispenser" )); )
        	{
        		if ( te->real_owner != pl )
        			continue;
        		_snprintf( strp, 30, "DISP: %3d ", ( int ) te->s.v.health );
        		strp += 10;
        		break;
        	}
      		if ( pl->has_sentry )
      			*strp++ = '|';
      	}
      	*strp = 0;
      	if ( pl->has_sentry )
      	{
        	for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), "building_sentrygun" )); )
        	{
        		if ( te->real_owner != pl )
        			continue;
        		if ( (te->has_sentry && te->s.v.health <= 0 ) && tfset(tg_enabled) )
        		{
        			strcat( strp, "SENTRY:dead " );
        			break;
        		}
        		if ( te->s.v.health > 0 )
        		{
        			_snprintf( strp, 30, " SENTRY: %3d ", ( int ) te->s.v.health );
        			strp += 13;
        		}

        		if ( !te->s.v.ammo_shells )
        		{
        			if ( !te->s.v.ammo_rockets && te->s.v.weapon == 3 )
        				strcat( strp, "no ammo   " );
        			else
        				strcat( strp, "no shells " );
        		} else
        		{
        			if ( !te->s.v.ammo_rockets && te->s.v.weapon == 3 )
        				strcat( strp, "no rockets ");
        			else
        				strcat( strp, "           ");
        		}
        		strp += 11;
        		break;
        	}
        	
      	}
      	strcat( strp, build );
      	return sg_status;
}
示例#29
0
文件: tg.c 项目: stayoutEE/TF2003-qvm
void TG_Eff_Remove( gedict_t * pl )
{
	gedict_t *te;
	float   healam;

	if ( strneq( pl->s.v.classname, "player" ) )
		return;
	if ( pl->s.v.health <= 0 )
		return;

	for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "timer" ) ); )
	{
		if ( te->s.v.owner != EDICT_TO_PROG( pl ) )
			continue;
		if ( te->s.v.think != ( func_t ) ConcussionGrenadeTimer &&
		     te->s.v.think != ( func_t ) OldConcussionGrenadeTimer )
			continue;
		if ( tf_data.old_grens == 1 )
			stuffcmd( pl, "v_idlescale 0\nfov 90\n" );
		dremove( te );
		break;
	}
	if ( pl->tfstate & TFSTATE_HALLUCINATING )
	{
		for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "timer" ) ); )
		{
			if ( te->s.v.owner != EDICT_TO_PROG( pl ) )
				continue;
			if ( te->s.v.think != ( func_t ) HallucinationTimer )
				continue;

			pl->tfstate -= ( pl->tfstate & TFSTATE_HALLUCINATING );

			ResetGasSkins( pl );

			if ( tf_data.new_gas & GAS_MASK_PALETTE )
				stuffcmd( pl, "v_cshift; wait; bf\n" );
			dremove( te );
			break;
		}
		if ( !te )
			G_conprintf( "Warning: Error in Hallucination Timer logic.\n" );
	}
	if ( pl->tfstate & TFSTATE_TRANQUILISED )
	{
		for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "timer" ) ); )
		{
			if ( te->s.v.owner != EDICT_TO_PROG( pl ) )
				continue;
			if ( te->s.v.think != ( func_t ) TranquiliserTimer )
				continue;

			pl->tfstate -= ( pl->tfstate & TFSTATE_TRANQUILISED );
			TeamFortress_SetSpeed( pl );
			dremove( te );
			break;
		}
		if ( !te )
			G_conprintf( "Warning: Error in Tranquilisation Timer logic.\n" );
	}
	if ( pl->FlashTime > 0 )
	{
		for ( te = world; ( te = trap_find( te, FOFS( s.v.netname ), "flashtimer" ) ); )
		{
			if ( te->s.v.owner != EDICT_TO_PROG( pl ) )
				continue;
			if ( strneq( te->s.v.classname, "timer" ) )
				continue;

			pl->FlashTime = 0;
			if ( tf_data.new_flash )
				disableupdates( pl, -1 );	/* server-side flash */
			break;
		}
		if ( !te )
		{
			G_conprintf( "Warning: Error in Flash Timer logic.\n" );
			pl->FlashTime = 0;
		}
	}
	if ( pl->tfstate & TFSTATE_INFECTED )
	{
		healam = rint( pl->s.v.health / 2 );
		pl->tfstate -= ( pl->tfstate & TFSTATE_INFECTED );
		tf_data.deathmsg = DMSG_MEDIKIT;
		T_Damage( pl, self, self, healam );
		return;
	}
	if ( pl->numflames > 0 )
	{
		sound( pl, 1, "items/r_item1.wav", 1, 1 );
		pl->numflames = 0;
		return;
	}
}
示例#30
0
void Red_Def_command( int argc )
{
        char    cmd_command[1024];
        static  qboolean red_def_mode =  false;
	gedict_t *Goal,*saveself;
	gedict_t *te,*owner;

	if( tf_data.mtfl )
	{
       	        if( self != world )
      		         G_sprint(self,2,"Not allowed for mtfl.\n" );
      		return;
	}
        if( argc < 3)
        {
                if( self == world )
                        return;
                if( red_def_mode )
                        G_sprint(self, 2, "Red-Def mode is ON\n");
                else
                        G_sprint(self, 2, "Red-Def mode is OFF\n");
                return;
        }
        saveself = self;
        trap_CmdArgv( 2, cmd_command, sizeof( cmd_command ) );
        if( !strcmp(cmd_command,"on") )
        {
                if( red_def_mode )
                {
        	        if( self != world )
                                G_sprint(self, 2, "Red-Def mode already activated\n");
                        return;
                }

	        Goal = trap_find( world, FOFS( s.v.classname ), "info_tfdetect" );

                if ( !Goal )
	       	       return;
	        if ( !Goal->display_item_status1 )
	                return;
       	        te = Finditem( Goal->display_item_status1 );

       	        if( !te || te == world || te->team_no != 2 )
       	        {
       	                te = Finditem( Goal->display_item_status2 );
       	        }
       	        if( !te || te == world || te->team_no != 2 )
       	        {
       	                te = Finditem( Goal->display_item_status3 );
       	        }
       	        if( !te || te == world || te->team_no != 2 )
       	        {
       	                te = Finditem( Goal->display_item_status4 );
       	        }

                if ( te == world || te->team_no != 2 )
        	{
        	        if( self != world )
             		         G_sprint(self,2,"Item is missing.\n" );
        		return;
        	}
        	owner = PROG_TO_EDICT(te->s.v.owner);
        	if( owner != world )
        	{
        	        tfgoalitem_RemoveFromPlayer( te, owner, 1 );
        	}
        	te->take_sshot = 1;
                red_def_mode = true;
                G_bprint(2,"�εδ-ΔΕζ νοδε αγτιφατεδ\n");
                return;
        }
        if( !strcmp(cmd_command,"off") )
        {
                if( !red_def_mode )
                {
        	        if( self != world )
                                G_sprint(self,2,"Red-Def mode not active\n");
                        return;
                }
	        Goal = trap_find( world, FOFS( s.v.classname ), "info_tfdetect" );

                if ( !Goal )
	       	       return;
	        if ( !Goal->display_item_status1 )
	                return;
       	        te = Finditem( Goal->display_item_status1 );
       	        if( !te || te == world || te->team_no != 2 )
       	        {
       	                te = Finditem( Goal->display_item_status2 );
       	        }
       	        if( !te || te == world || te->team_no != 2 )
       	        {
       	                te = Finditem( Goal->display_item_status3 );
       	        }
       	        if( !te || te == world || te->team_no != 2 )
       	        {
       	                te = Finditem( Goal->display_item_status4 );
       	        }

                if ( te == world || te->team_no != 2 )
        	{
        	        if( self != world )
             		         G_sprint(self,2,"Item is missing.\n" );
        		return;
        	}
        	te->take_sshot = 0;
                red_def_mode = false;
                G_bprint(2,"�εδ-ΔΕζ νοδε δεαγτιφατεδ\n");
                return;
        }

}