Exemplo n.º 1
0
Arquivo: admin.c Projeto: deurk/ktx
qbool DoKick(gedict_t *victim, gedict_t *kicker)
{
	if (!victim || !kicker)
		return false;

	if( victim == kicker )
	{
		G_bprint(2, "%s kicked %s\n", getname(kicker), g_himself( kicker ));

		// hehe
		G_sprint(kicker, 2, "Say \"bye\" and then type \"disconnect\" next time\n");

		stuffcmd(kicker, "disconnect\n");  // FIXME: stupid way

		if ( !FTE_sv )
			localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
	}
	else
	{
		if ( !is_can_kick(victim, kicker) )
			return false;

		G_bprint(2, "%s was kicked by %s\n", getname(victim), getname(kicker));

		G_sprint(victim, 2, "You were kicked from the server\n");

		stuffcmd(victim, "disconnect\n"); // FIXME: stupid way

		if ( !FTE_sv )
			localcmd( "addip %s ban +30\n", cl_ip( victim ) ); // BAN for 30 seconds
	}

	return true;
}
Exemplo n.º 2
0
void Cmd_Statmode_f(edict_t* ent, char *arg)
{
	int i;
	char stuff[32];


	// Ignore if there is no argument.
	if (!arg[0])
		return;

	// Numerical
	i = atoi (arg);

	if (i > 2 || i < 0) {
		gi.dprintf("Warning: stat_mode set to %i by %s\n", i, ent->client->pers.netname);

		// Force the old mode if it is valid else force 0
		if (ent->client->resp.stat_mode > 0 && ent->client->resp.stat_mode < 3)
			sprintf(stuff, "set stat_mode \"%i\"\n", ent->client->resp.stat_mode);
		else
			sprintf(stuff, "set stat_mode \"0\"\n");
	} else {
		sprintf(stuff, "set stat_mode \"%i\"\n", i);
		ent->client->resp.stat_mode = i;
	}
	stuffcmd(ent, stuff);
}
Exemplo n.º 3
0
Arquivo: admin.c Projeto: deurk/ktx
void AdminMatchStart ()
{
    gedict_t *p;
    int i = 0;

    for( p = world; (p = find_plr( p )); )
    {
		if( p->ready ) {
			i++;
		}
		else
		{
			G_bprint(2, "%s was kicked by admin forcestart\n", p->netname);
			G_sprint(p, 2, "Bye bye! Pay attention next time.\n");

			stuffcmd(p, "disconnect\n"); // FIXME: stupid way
		}
	}

    k_attendees = i;

    if( k_attendees ) {
        StartTimer();
	}
    else
    {
        G_bprint(2, "Can't start! More players needed.\n");
		EndMatch( 1 );
    }
}
Exemplo n.º 4
0
void W_FireBigAss ( )
{
	vec3_t dir, vtemp;

	if ( self->s.v.ammo_shells < 10 )
	{
		make_explosion ( );
//		G_sprint (self, 2, "Ammo chamber jammed!\n"); // I just don't like excess messages
		sound ( self, 1, "weapons/asscan4.wav", 1, 1 );
		stuffcmd ( self, "bf\n" );
		self->option4 = 0;
		return;
	}

	self->nojumptime = ( g_globalvars.time + 0.75 );		// stops the 10.30.98 20mm speed "bug"

	// "weapons/sgun1.wav" was the old sound, this is 11.11.04's sound
	sound( self, 1, "weapons/20mm.wav", 1, 1 );

	KickPlayer( -5, self );
	muzzleflash( );
	stuffcmd (self, "bf\n");
//	self.ammo_shells = (self.ammo_shells - 10);
//	self.currentammo = (self.ammo_shells - 10);
	//self->s.v.currentammo = self->s.v.ammo_shells - 10;
	self->s.v.ammo_shells = self->s.v.ammo_shells - 10;
	self->s.v.currentammo = self->s.v.ammo_shells;

	makevectors( self->s.v.v_angle );
	dir[0] = g_globalvars.v_forward[0];dir[1] = g_globalvars.v_forward[1];dir[2] = g_globalvars.v_forward[2];
	mtf_deathmsg( 46 );
	BigAssBullet( dir, 50 );
	EjectShell ( );

	//self->s.v.velocity = (self.velocity - (v_forward * 200));
	VectorScale( g_globalvars.v_forward, 200, vtemp );
	VectorSubtract( self->s.v.velocity, vtemp, vtemp );
	self->s.v.velocity[0] = vtemp[0];
	self->s.v.velocity[1] = vtemp[1];
	if ( vtemp[2] > 179.9 && self->s.v.button2 )
		vtemp[2] = vtemp[2] * 2.1;		// "fixes" 20mm jump when facing down
	self->s.v.velocity[2] = vtemp[2];

	if ( self->s.v.ammo_shells == 0 )
		self->s.v.ammo_shells = 1;
}
Exemplo n.º 5
0
void health_touch()
{
//   float amount;
//   char*  s;

	if ( deathmatch == 4 )
		if ( other->invincible_time > 0 )
			return;

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

	if ( self->healtype == 2 )	// Megahealth?  Ignore max_health...
	{
		if ( other->s.v.health >= 250 )
			return;
		if ( !T_Heal( other, self->healamount, 1 ) )
			return;
	} else
	{
		if ( !T_Heal( other, self->healamount, 0 ) )
			return;
	}

	G_sprint( other, PRINT_LOW, "You receive %.0f health\n", self->healamount );

// health touch sound
	sound( other, CHAN_ITEM, self->s.v.noise, 1, ATTN_NORM );

	stuffcmd( other, "bf\n" );

	self->s.v.model = "";
	self->s.v.solid = SOLID_NOT;

	// Megahealth = rot down the player's super health
	if ( self->healtype == 2 )
	{
		other->s.v.items = ( int ) other->s.v.items | IT_SUPERHEALTH;
		if ( deathmatch != 4 )
		{
			self->s.v.nextthink = g_globalvars.time + 5;
			self->s.v.think = ( func_t ) item_megahealth_rot;
		}
		self->s.v.owner = EDICT_TO_PROG( other );
	} else
	{
		if ( deathmatch != 2 )	// deathmatch 2 is the silly old rules
		{
			self->s.v.nextthink = g_globalvars.time + 20;
			self->s.v.think = ( func_t ) SUB_regen;
		}
	}

	activator = other;
	SUB_UseTargets();	// fire all targets / killtargets
}
Exemplo n.º 6
0
void SetTeamName( gedict_t * p )
{
        if ( p->isBot )
        {
                if( p->team_no >0 && p->team_no <=4)
                        trap_SetBotUserInfo(NUM_FOR_EDICT( p ),"team",team_names[p->team_no-1 ]);
                else
                        trap_SetBotUserInfo(NUM_FOR_EDICT( p ),"team","");
        }else
	       stuffcmd( p, "team %s\n", GetTeamName( p->team_no ) );
}
Exemplo n.º 7
0
Arquivo: p_hud.c Projeto: qbism/tmg
void MoveClientToIntermission (edict_t *ent)
{
	gclient_t	*client;
//RAV
	char song[80];
//
	client = ent->client;

	if (deathmatch->value || coop->value)
		ent->client->showscores = true;
	VectorCopy (level.intermission_origin, ent->s.origin);

	ent->client->ps.pmove.origin[0] = level.intermission_origin[0]*8;
	ent->client->ps.pmove.origin[1] = level.intermission_origin[1]*8;
	ent->client->ps.pmove.origin[2] = level.intermission_origin[2]*8;
	VectorCopy (level.intermission_angle, ent->client->ps.viewangles);
	ent->client->ps.pmove.pm_type = PM_FREEZE;
	ent->client->ps.gunindex = 0;
	ent->client->ps.blend[3] = 0;
	ent->client->ps.rdflags &= ~RDF_UNDERWATER;

	// clean up powerup info
	client->quad_framenum = 0;
	client->invincible_framenum = 0;
	client->breather_framenum = 0;
	client->enviro_framenum = 0;
	client->grenade_blew_up = false;
	client->grenade_time = 0;

	ent->viewheight = 0;
	ent->s.modelindex = 0;
	ent->s.modelindex2 = 0;
	ent->s.modelindex3 = 0;
	ent->s.modelindex = 0;
	ent->s.effects = 0;
	ent->s.sound = 0;
	ent->solid = SOLID_NOT;

	// add the layout

	if (!ent->bot_client && (deathmatch->value || coop->value))
	{
		DeathmatchScoreboardMessage (ent, NULL);
		gi.unicast (ent, true);
	}
//RAV
	if(wavs->value && !ent->bot_client)
	{
		sprintf(song, songtoplay->string);
		//gi.sound (ent, CHAN_ITEM, gi.soundindex (song), 1, ATTN_NORM, 0);
		stuffcmd(ent, va("play %s\n", song));
	}
}
Exemplo n.º 8
0
/*
===============================================================================

ARMOR

===============================================================================
*/
void armor_touch()
{
	float           type = 0, value = 0;
	int             bit = 0;

	if ( other->s.v.health <= 0 )
		return;
	if ( strneq( other->s.v.classname, "player" ) )
		return;
	if ( !strcmp( self->s.v.classname, "item_armor1" ) )
	{
		type = 0.3;
		value = 100;
		bit = IT_ARMOR1;
	}
	if ( !strcmp( self->s.v.classname, "item_armor2" ) )
	{
		type = 0.6;
		value = 150;
		bit = IT_ARMOR2;
	}
	if ( !strcmp( self->s.v.classname, "item_armorInv" ) )
	{
		type = 0.8;
		value = 200;
		bit = IT_ARMOR3;
	}
	if ( other->s.v.armortype * other->s.v.armorvalue >= type * value )
		return;

	other->s.v.armortype = type;
	other->s.v.armorvalue = value;
	other->s.v.items +=
	    -( ( int ) other->s.v.items & ( IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3 ) ) + bit;

	self->s.v.solid = SOLID_NOT;
	self->s.v.model = "";
	if ( deathmatch != 2 )
		self->s.v.nextthink = g_globalvars.time + 20;
	self->s.v.think = ( func_t ) SUB_regen;


	G_sprint( other, PRINT_LOW, "You got armor\n" );
// armor touch sound
	sound( other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM );
	stuffcmd( other, "bf\n" );

	activator = other;
	SUB_UseTargets();	// fire all targets / killtargets
}
Exemplo n.º 9
0
void checkVariableValid(edict_t *ent, int client, char *value) {
    switch (checkvarList[proxyinfo[client].checkvar_idx].type) {
        case CV_CONSTANT:
            if (q2a_strcmp(checkvarList[proxyinfo[client].checkvar_idx].value, value) != 0) {
                sprintf(buffer, "%s %s\n", checkvarList[proxyinfo[client].checkvar_idx].variablename, checkvarList[proxyinfo[client].checkvar_idx].value);
                stuffcmd(ent, buffer);
            }
            break;

        case CV_RANGE:
        {
            double fvalue = q2a_atof(value);

            if (fvalue < checkvarList[proxyinfo[client].checkvar_idx].lower) {
                sprintf(buffer, "%s %g\n", checkvarList[proxyinfo[client].checkvar_idx].variablename, checkvarList[proxyinfo[client].checkvar_idx].lower);
                stuffcmd(ent, buffer);
            } else if (fvalue > checkvarList[proxyinfo[client].checkvar_idx].upper) {
                sprintf(buffer, "%s %g\n", checkvarList[proxyinfo[client].checkvar_idx].variablename, checkvarList[proxyinfo[client].checkvar_idx].upper);
                stuffcmd(ent, buffer);
            }
            break;
        }
    }
}
Exemplo n.º 10
0
/* ** wicked ** shout procedure itself */
void shout_f(edict_t *self, char *channel, char *msg) {
	edict_t *player;
	int		i;
	char	*cmd, *pos;

	cmd = "\0";

	// Check for the right sound theme
	if (pos = strstr(msg,";"))
		pos[0] = 0;


	// If the sound is bound for all players in the game this is what is executed
	for_each_player(player, i) {
		sprintf(cmd, "play shout/%s\n", msg );
		stuffcmd(player, cmd);
	}
Exemplo n.º 11
0
void vote_check_nospecs ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_NOSPECS ) )
		return;

	veto = is_admins_vote( OV_NOSPECS );

	if( veto || !get_votes_req( OV_NOSPECS, true ) )
	{
		vote_clear( OV_NOSPECS );

		// set no specs mode
		cvar_fset("_k_nospecs", !cvar("_k_nospecs"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by admin veto", OnOff(cvar("_k_nospecs")))));
		else
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by majority vote", OnOff(cvar("_k_nospecs")))));

		// kick specs
		if ( cvar("_k_nospecs") )
		{
			gedict_t *spec;

			for ( spec = world; (spec = find_spc( spec )); )
			{
				if ( VIP( spec ) & ALLOWED_NOSPECS_VIPS )
					continue; // don't kick this VIP
    
				if ( is_real_adm(spec) )
					continue; // don't kick real admin
    
				stuffcmd(spec, "disconnect\n");  // FIXME: stupid way
			}
		}

		return;
	}
}
Exemplo n.º 12
0
void q_touch()
{
//gedict_t*    stemp;
//float     best;

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

	self->mdl = self->s.v.model;

	sound( other, CHAN_VOICE, self->s.v.noise, 1, ATTN_NORM );
	stuffcmd( other, "bf\n" );

	self->s.v.solid = SOLID_NOT;
	other->s.v.items = ( ( int ) other->s.v.items ) | IT_QUAD;
	self->s.v.model = "";

	if ( deathmatch == 4 )
	{
		other->s.v.armortype = 0;
		other->s.v.armorvalue = 0 * 0.01;
		other->s.v.ammo_cells = 0;
	}
// do the apropriate action
	other->super_time = 1;
	other->super_damage_finished = self->cnt;

	if ( deathmatch == 4 )
		G_bprint( PRINT_LOW,
			  "%s recovered an OctaPower with %d seconds remaining!\n",
			  other->s.v.netname,
			  ( int ) ( other->super_damage_finished - g_globalvars.time ) );
	else
		G_bprint( PRINT_LOW, "%s recovered a Quad with %d seconds remaining!\n",
			  other->s.v.netname,
			  ( int ) ( other->super_damage_finished - g_globalvars.time ) );


	activator = other;
	SUB_UseTargets();	// fire all targets / killtargets
}
Exemplo n.º 13
0
void checkVariableTest(edict_t *ent, int client, int idx) {
    if (checkvarcmds_enable) {
        if (idx >= maxcheckvars) {
            idx = 0;
        }

        if (maxcheckvars) {
            proxyinfo[client].checkvar_idx = idx;
            generateRandomString(proxyinfo[client].hack_checkvar, RANDOM_STRING_LENGTH);
            sprintf(buffer, "%s $%s\n", proxyinfo[client].hack_checkvar, checkvarList[idx].variablename);
            stuffcmd(ent, buffer);

            idx++;
        }

    } else {
        idx = 0;
    }

    addCmdQueue(client, QCMD_CHECKVARTESTS, (float) checkvar_poll_time, idx, 0);
}
Exemplo n.º 14
0
void Cmd_AutoRecord_f(edict_t * ent)
{
    char rec_date[20], recstr[MAX_QPATH];
    time_t clock;

    time( &clock );
    strftime( rec_date, sizeof(rec_date)-1, "%Y_%b_%d_%H%M", localtime(&clock));

    if (matchmode->value)
    {
        if(use_3teams->value)
            Com_sprintf(recstr, sizeof(recstr), "%s-%s_vs_%s_vs_%s-%s", rec_date, teams[TEAM1].name, teams[TEAM2].name, teams[TEAM3].name, level.mapname);
        else
            Com_sprintf(recstr, sizeof(recstr), "%s-%s_vs_%s-%s", rec_date, teams[TEAM1].name, teams[TEAM2].name, level.mapname);

        RemoveSpaces(recstr); //Remove spaces -M
    } else {
        Com_sprintf(recstr, sizeof(recstr), "%s-%s", rec_date, level.mapname);
    }

    stuffcmd(ent, va("record \"%s\"\n", recstr));
}
Exemplo n.º 15
0
////////////////
// GlobalParams:
// time
// self
// params
///////////////
void SpectatorConnect()
{
	gedict_t *p;
	int diff = (int)(PROG_TO_EDICT(self->s.v.goalentity) - world);

	if ( !SpecCanConnect( self ) )
	{
		stuffcmd(self, "disconnect\n"); // FIXME: stupid way
		return;
	}

	SpecDecodeLevelParms();

	self->ct = ctSpec;
	self->s.v.classname = "spectator"; // Added this in for kick code
	self->k_accepted = 1; // spectator has no restriction to connect

	for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); )
		if ( p != self )  // does't show msg for self
			G_sprint( p, PRINT_HIGH, "Spectator %s entered the game\n", self->s.v.netname  );

	if ( diff < 0 || diff >= MAX_EDICTS ) // something wrong happen - fixing
		self->s.v.goalentity = EDICT_TO_PROG( world );

	VIP_ShowRights( self );
	CheckRate(self, "");

	if ( match_in_progress != 2 ) {
		self->wizard = spawn();
		self->wizard->s.v.classname = "spectator_wizard";
		self->wizard->s.v.think = ( func_t ) wizard_think;
		self->wizard->s.v.nextthink = g_globalvars.time + 0.1;
	}

	// Wait until you do stuffing
	MakeMOTD();
}
Exemplo n.º 16
0
void r_touch()
{
//gedict_t*    stemp;
//float     best;

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

	self->mdl = self->s.v.model;

	sound( other, CHAN_VOICE, self->s.v.noise, 1, ATTN_NORM );
	stuffcmd( other, "bf\n" );

	self->s.v.solid = SOLID_NOT;
	other->s.v.items = ( ( int ) other->s.v.items ) | IT_INVISIBILITY;
	self->s.v.model = "";

// do the apropriate action
	other->invisible_time = 1;
	other->invisible_finished = self->cnt;

	G_bprint( PRINT_LOW, "%s recovered a Ring with %d seconds remaining!\n",
		  other->s.v.netname,
		  ( int ) ( other->invisible_finished - g_globalvars.time ) );
	/*s=ftos(rint(other->invisible_finished - time));
	   trap_BPrint (PRINT_LOW, other->s.v.netname);
	   trap_BPrint (PRINT_LOW, " recovered a Ring with ");
	   trap_BPrint (PRINT_LOW, s);
	   trap_BPrint (PRINT_LOW, " seconds remaining!\n"); */


	activator = other;
	SUB_UseTargets();	// fire all targets / killtargets
}
Exemplo n.º 17
0
void Cmd_PlayerToBerserk_f (edict_t *ent)
{
	int cost = BERSERK_COST;

	if (debuginfo->value)
		gi.dprintf("DEBUG: %s just called Cmd_PlayerToBerserk_f()\n", ent->client->pers.netname);

	// try to switch back
	if (ent->mtype || PM_PlayerHasMonster(ent))
	{
		// don't let a player-tank unmorph if they are cocooned
		if (ent->owner && ent->owner->inuse && ent->owner->movetype == MOVETYPE_NONE)
			return;

		if (que_typeexists(ent->curses, 0))
		{
			safe_cprintf(ent, PRINT_HIGH, "You can't morph while cursed!\n");
			return;
		}

		V_RestoreMorphed(ent, 0);
		return;
	}

	//Talent: Morphing
    if (vrx_get_talent_slot(ent, TALENT_MORPHING) != -1)
        cost *= 1.0 - 0.25 * vrx_get_talent_level(ent, TALENT_MORPHING);

	if (!V_CanUseAbilities(ent, BERSERK, cost, true))
		return;

	if (HasFlag(ent) && !hw->value)
	{
		safe_cprintf(ent, PRINT_HIGH, "Can't morph while carrying flag!\n");
		return;
	}

	V_ModifyMorphedHealth(ent, MORPH_BERSERK, true);

	ent->monsterinfo.attack_finished = level.time + 0.5;// can't attack immediately

	ent->client->pers.inventory[power_cube_index] -= cost;
	ent->client->ability_delay = level.time + BERSERK_DELAY;

	ent->mtype = MORPH_BERSERK;
	ent->s.modelindex = gi.modelindex ("models/monsters/berserk/tris.md2");
	ent->s.modelindex2 = 0;
	ent->s.skinnum = 0;

	// undo crouching / ducked state
	// try asking their client to get up
	stuffcmd(ent, "-movedown\n");
	// if their client ignores the command, force them up
	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
	{
		ent->client->ps.pmove.pm_flags &= ~PMF_DUCKED;
		ent->viewheight = 22;
		ent->maxs[2] += 28;
	}
	
	ent->client->refire_frames = 0; // reset charged weapon
	ent->client->weapon_mode = 0; // reset weapon mode
	ent->client->pers.weapon = NULL;
	ent->client->ps.gunindex = 0;
	lasersight_off(ent);

    gi.sound(ent, CHAN_WEAPON, gi.soundindex("abilities/morph.wav"), 1, ATTN_NORM, 0);
}
Exemplo n.º 18
0
/*
=================
ClientEndServerFrame

Called for each player at the end of the server frame
and right after spawning
=================
*/
void ClientEndServerFrame (edict_t * ent)
{
	float bobtime;
	int i;
	//char player_name[30];
	//char temp[40];
	//        int             damage; // zucc for bleeding

	current_player = ent;
	current_client = ent->client;

	//AQ2:TNG - Slicer : Stuffs the client x seconds after he enters the server, needed for Video check
	if (ent->client->resp.checktime[0] <= level.time)
	{
		ent->client->resp.checktime[0] = level.time + video_checktime->value;
		if (video_check->value || video_check_lockpvs->value
			|| video_check_glclear->value || darkmatch->value)
			stuffcmd (ent, "%!fc $vid_ref\n");
		if (video_force_restart->value && video_check->value && !ent->client->resp.checked)
		{
			stuffcmd (ent, "vid_restart\n");
			ent->client->resp.checked = true;
		}

	}
	if (ent->client->resp.checktime[1] <= level.time)
	{
		ent->client->resp.checktime[1] = level.time + video_checktime->value;
		ent->client->resp.checktime[2] = level.time + 1;
		if (video_check->value || video_check_lockpvs->value
			|| video_check_glclear->value || darkmatch->value)
		{
			if (ent->client->resp.vidref && Q_stricmp(ent->client->resp.vidref, "soft"))
				stuffcmd (ent, "%cpsi $gl_modulate $gl_lockpvs $gl_clear $gl_dynamic $gl_driver\n");
		}

	}
	if (ent->client->resp.checktime[2] <= level.time)
	{
		// ent->client->resp.checktime[2] = level.time + video_checktime->value;
		if (video_check->value || video_check_lockpvs->value
			|| video_check_glclear->value || darkmatch->value)
		{
			if (ent->client->resp.vidref && Q_stricmp(ent->client->resp.vidref, "soft"))
				VideoCheckClient (ent);
		}

	}

	if(pause_time)
	{
		G_SetStats (ent);
		return;
	}

	//FIREBLADE - Unstick avoidance stuff.
	if (ent->solid == SOLID_TRIGGER && !lights_camera_action)
	{
		edict_t *overlap;
		if ((overlap = FindOverlap (ent, NULL)) == NULL)
		{
			ent->solid = SOLID_BBOX;
			gi.linkentity (ent);
			RemoveFromTransparentList (ent);
		}
		else
		{
			do
			{
				if (overlap->solid == SOLID_BBOX)
				{
					overlap->solid = SOLID_TRIGGER;
					gi.linkentity (overlap);
					AddToTransparentList (overlap);
				}
				overlap = FindOverlap (ent, overlap);
			}
			while (overlap != NULL);
		}
	}
	//FIREBLADE

	//
	// If the origin or velocity have changed since ClientThink(),
	// update the pmove values.  This will happen when the client
	// is pushed by a bmodel or kicked by an explosion.
	// 
	// If it wasn't updated here, the view position would lag a frame
	// behind the body position when pushed -- "sinking into plats"
	//
	for (i = 0; i < 3; i++)
	{
		current_client->ps.pmove.origin[i] = ent->s.origin[i] * 8.0;
		current_client->ps.pmove.velocity[i] = ent->velocity[i] * 8.0;
	}

	//
	// If the end of unit layout is displayed, don't give
	// the player any normal movement attributes
	//
	if (level.intermissiontime)
	{
		// FIXME: add view drifting here?
		current_client->ps.blend[3] = 0;
		current_client->ps.fov = 90;
		G_SetStats (ent);
		return;
	}

	AngleVectors (ent->client->v_angle, forward, right, up);

	// burn from lava, etc
	P_WorldEffects ();

	//
	// set model angles from view angles so other things in
	// the world can tell which direction you are looking
	//
	if (ent->client->v_angle[PITCH] > 180)
		ent->s.angles[PITCH] = (-360 + ent->client->v_angle[PITCH]) / 3;
	else
		ent->s.angles[PITCH] = ent->client->v_angle[PITCH] / 3;
	ent->s.angles[YAW] = ent->client->v_angle[YAW];
	ent->s.angles[ROLL] = 0;
	ent->s.angles[ROLL] = SV_CalcRoll (ent->s.angles, ent->velocity) * 4;

	//
	// calculate speed and cycle to be used for
	// all cyclic walking effects
	//
	xyspeed = sqrt(ent->velocity[0]*ent->velocity[0] + ent->velocity[1]*ent->velocity[1]);

	if (xyspeed < 5 || ent->solid == SOLID_NOT)
	{
		bobmove = 0;
		current_client->bobtime = 0;	// start at beginning of cycle again
	}
	else if (ent->groundentity)
	{	// so bobbing only cycles when on ground
		if (xyspeed > 210)
			bobmove = 0.25;
		else if (xyspeed > 100)
			bobmove = 0.125;
		else
			bobmove = 0.0625;
	}

	bobtime = (current_client->bobtime += bobmove);

	if (current_client->ps.pmove.pm_flags & PMF_DUCKED)
		bobtime *= 4;

	bobcycle = (int) bobtime;
	bobfracsin = fabs (sin (bobtime * M_PI));

	// detect hitting the floor
	P_FallingDamage (ent);

	// zucc handle any bleeding damage here
	Do_Bleeding (ent);

	// apply all the damage taken this frame
	P_DamageFeedback (ent);

	// determine the view offsets
	SV_CalcViewOffset (ent);

	// determine the gun offsets
	SV_CalcGunOffset (ent);

	// determine the full screen color blend
	// must be after viewoffset, so eye contents can be
	// accurately determined
	// FIXME: with client prediction, the contents
	// should be determined by the client
	SV_CalcBlend (ent);

	G_SetStats (ent);

	//FIREBLADE
	for (i = 1; i <= maxclients->value; i++)
	{
		int stats_copy;
		edict_t *e = g_edicts + i;

		if (!ent->inuse || e->client->chase_mode == 0 || e->client->chase_target != ent)
			continue;

		for (stats_copy = 0; stats_copy < MAX_STATS; stats_copy++)
		{
			if (stats_copy >= STAT_TEAM_HEADER && stats_copy <= STAT_TEAM2_SCORE)
				continue;		// protect these
			if (stats_copy >= STAT_TEAM3_PIC && stats_copy <= STAT_TEAM3_SCORE)
				continue;		// protect these
			if (stats_copy == STAT_LAYOUTS || stats_copy == STAT_ID_VIEW)
				continue;		// protect these
			if (stats_copy == STAT_SNIPER_ICON && e->client->chase_mode != 2)
				continue;		// only show sniper lens when in chase mode 2
			if (stats_copy == STAT_FRAGS)
				continue;
			e->client->ps.stats[stats_copy] = ent->client->ps.stats[stats_copy];
		}

	//FB                e->client->ps.stats[STAT_LAYOUTS] = 1;
	//FB                break;
	}
	//FIREBLADE

	G_SetClientEvent (ent);

	G_SetClientEffects (ent);

	G_SetClientSound (ent);

	G_SetClientFrame (ent);

	VectorCopy (ent->velocity, ent->client->oldvelocity);
	VectorCopy (ent->client->ps.viewangles, ent->client->oldviewangles);

	// clear weapon kicks
	VectorClear (ent->client->kick_origin);
	VectorClear (ent->client->kick_angles);


	// zucc - clear the open door command
	ent->client->doortoggle = 0;

	if (ent->client->push_timeout > 0)
		ent->client->push_timeout--;
  /*              else
	 {
	 ent->client->attacker = NULL;
	 ent->client->attacker_mod = MOD_BLEEDING;
	 }
   */
	if (ent->client->reload_attempts > 0)
	{
		if (((ent->client->latched_buttons | ent->client->buttons) & BUTTON_ATTACK)
		&& canFire(ent))
		{
			ent->client->reload_attempts = 0;
		}
		else
		{
			Cmd_Reload_f (ent);
		}
	}
	if (ent->client->weapon_attempts > 0)
		Cmd_Weapon_f (ent);

	// if the scoreboard is up, update it
	if (ent->client->showscores && !(level.framenum & 31))
	{
		//FIREBLADE
		if (ent->client->menu)
		{
			PMenu_Update (ent);
		}
		else
		//FIREBLADE
			DeathmatchScoreboardMessage (ent, ent->enemy);
		gi.unicast (ent, false);
	}

	//FIREBLADE
	if(!pause_time)
		RadioThink (ent);
	//FIREBLADE
}
Exemplo n.º 19
0
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;
	}
}
Exemplo n.º 20
0
void TeamFortress_MOTD(  )
{

	if ( self->motd == 4 )
		stuffcmd( self, "is_aliased\n" );
	if ( self->motd <= 20 )
	{
		self->motd += 1;
		return;
	}
	if ( self->motd == 21 )
	{
		if ( !0 )
			self->tfstate |= TFSTATE_ZOOMOFF;

		if ( teamplay && !self->team_no )
		{
		        TeamFortress_SetColor( self, 0,0);
		}
		if ( !self->got_aliases )
			G_sprint( self, 2, "\n\n\n" );
		G_sprint( self, 2, "Type help for more info.\n" );
		G_sprint( self, 2, "ΡυαλεΧοςμδ ΤεανΖοςτςεσσ ”’’•\n" );

		if( tf_data.enable_bot )
		{
		      G_sprint( self, 2, "Bots Enabled\n" );
		}

//		G_sprint(self, 2, "Official ΝΤΖΜ version\n");

		G_sprint( self, 2, "by sd‘ angel for ΝΤΖΜ\n" );
		G_sprint( self, 2, "Bug reports to [email protected]\n" );
		G_sprint( self, 2, "http://ντζμ�σδ�ςυ\n" );

		self->menu_displaytime = 0;
		self->current_menu = MENU_INTRO;
		self->menu_count = MENU_REFRESH_RATE;
		self->motd = 22;
		if ( self->got_aliases == 1 )
			return;
		G_sprint( self, 2, "binding aliases...\n" );
		TeamFortress_Alias( "inv", 135, 0 );
		TeamFortress_Alias( "showtf", 136, 0 );
		TeamFortress_Alias( "autozoom", 174, 0 );
		TeamFortress_Alias( "changeclass", 99, 0 );
		TeamFortress_Alias( "scout", TF_CHANGEPC + PC_SCOUT, 0 );
		TeamFortress_Alias( "sniper", TF_CHANGEPC + PC_SNIPER, 0 );
		TeamFortress_Alias( "soldier", TF_CHANGEPC + PC_SOLDIER, 0 );
		TeamFortress_Alias( "demoman", TF_CHANGEPC + PC_DEMOMAN, 0 );
		TeamFortress_Alias( "medic", TF_CHANGEPC + PC_MEDIC, 0 );
		TeamFortress_Alias( "hwguy", TF_CHANGEPC + PC_HVYWEAP, 0 );
		TeamFortress_Alias( "pyro", TF_CHANGEPC + PC_PYRO, 0 );
		TeamFortress_Alias( "spy", TF_CHANGEPC + PC_SPY, 0 );
		TeamFortress_Alias( "engineer", TF_CHANGEPC + PC_ENGINEER, 0 );
		TeamFortress_Alias( "randompc", TF_CHANGEPC + PC_RANDOM, 0 );
		TeamFortress_Alias( "is_aliased", 13, 0 );
		return;
	}
	if ( self->motd <= 95 )
		self->motd += 1;
	if ( self->motd == 25 )
	{
		TeamFortress_Alias( "detpipe", 170, 0 );
		TeamFortress_Alias( "reload", 173, 0 );
		TeamFortress_Alias( "scan10", 162, 0 );
		TeamFortress_Alias( "scan30", 163, 0 );
		TeamFortress_Alias( "scan50", 164, 0 );
		TeamFortress_Alias( "scan100", 164, 0 );
		TeamFortress_Alias( "scanf", 161, 0 );
		TeamFortress_Alias( "scane", 160, 0 );
		TeamFortress_Alias( "autoscan", AUTOSCAN_IMPULSE, 0 );
		TeamFortress_Alias("scanf_off", TF_SCAN, TF_POST_SCANF_OFF);
		TeamFortress_Alias("scanf_on" , TF_SCAN, TF_POST_SCANF_ON );
		TeamFortress_Alias("scane_off", TF_SCAN, TF_POST_SCANE_OFF);
		TeamFortress_Alias("scane_on" , TF_SCAN, TF_POST_SCANE_ON );
		TeamFortress_Alias("autoscan_on" ,  TF_SCAN, TF_POST_AUTOSCAN_ON  );
		TeamFortress_Alias("autoscan_off" , TF_SCAN, TF_POST_AUTOSCAN_OFF );
		return;
	}
	if ( self->motd == 35 )
	{
		TeamFortress_Alias( "primeone", 150, 0 );
		TeamFortress_Alias( "primetwo", 151, 0 );
		TeamFortress_Alias( "throwgren", 152, 0 );
		TeamFortress_Alias( "+gren1", 150, 0 );
		TeamFortress_Alias( "+gren2", 151, 0 );
		TeamFortress_Alias( "-gren1", 152, 0 );
		TeamFortress_Alias( "-gren2", 152, 0 );
		TeamFortress_Alias( "showscores", 145, 0 );
		TeamFortress_Alias( "showclasses", 144, 0 );
		TeamFortress_Alias( "query", 119, 0 );
		return;
	}
	if ( self->motd == 45 )
	{
		TeamFortress_Alias( "dropkey", 175, 0 );
		TeamFortress_Alias( "dropammo", 172, 0 );
		TeamFortress_Alias( "dropitems", 194, 0 );
		TeamFortress_Alias( "showloc", 118, 0 );
		TeamFortress_Alias( "special", 171, 0 );
		TeamFortress_Alias( "saveme", 181, 0 );
		TeamFortress_Alias( "discard", 184, 0 );
		TeamFortress_Alias( "id", 185, 0 );
		return;
	}
	if ( self->motd == 55 )
	{
		TeamFortress_Alias( "flaginfo", 23, 0 );
		TeamFortress_Alias( "maphelp", 131, 0 );
		TeamFortress_Alias( "showids", 186, 0 );
		stuffcmd( self, "bind 9 \"impulse 9\"\n" );
		stuffcmd( self, "bind 0 \"impulse 10\"\n" );
		return;
	}
	if ( self->motd == 65 )
	{
		TeamFortress_Alias( "sbar_on", 182, 0 );
		TeamFortress_Alias( "sbar_off", 183, 0 );
		TeamFortress_Alias( "sbar_200", 71, 0 );
		TeamFortress_Alias( "sbar_240", 71 + 1, 0 );
		TeamFortress_Alias( "sbar_300", 71 + 2, 0 );
		TeamFortress_Alias( "sbar_350", 71 + 3, 0 );
		TeamFortress_Alias( "sbar_384", 71 + 4, 0 );
		TeamFortress_Alias( "sbar_400", 71 + 5, 0 );
		TeamFortress_Alias( "sbar_480", 71 + 6, 0 );
		TeamFortress_Alias( "sbar_600", 71 + 7, 0 );
		TeamFortress_Alias( "sbar_768", 71 + 8, 0 );
		return;
	}
	if ( self->motd == 75 )
	{
		TeamFortress_Alias( "+det5", 165, 0 );
		TeamFortress_Alias( "-det5", 169, 0 );
		TeamFortress_Alias( "+det20", 166, 0 );
		TeamFortress_Alias( "-det20", 169, 0 );
		TeamFortress_Alias( "+det50", 167, 0 );
		TeamFortress_Alias( "-det50", 169, 0 );
		return;
	}
	if ( self->motd == 85 )
	{
              if(tg_data.tg_enabled)
              {
		TeamFortress_Alias( "mod_menu", TG_MAINMENU_IMPULSE, 0 );
		TeamFortress_Alias( "sg_rebuild", TG_SG_REBUILD_IMPULSE, 0 );
		TeamFortress_Alias( "sg_reload", TG_SG_RELOAD_IMPULSE, 0 );
		TeamFortress_Alias( "sg_upgrade", TG_SG_UPGRADE_IMPULSE, 0 );
		TeamFortress_Alias( "disp_load", TG_DISP_LOAD_IMPULSE, 0 );
		TeamFortress_Alias( "disp_unload", TG_DISP_UNLOAD_IMPULSE, 0 );
		TeamFortress_Alias( "eff_conc", TG_CONC_IMPULSE, 0);
		TeamFortress_Alias( "eff_flash", TG_FLASH_IMPULSE, 0);
		TeamFortress_Alias( "eff_remove", TG_EFF_REMOVE_IMPULSE, 0);
              }
		return;
	}
	if ( self->motd == 95 )
	{
		TeamFortress_Alias( "disguise", 177, 0 );
		TeamFortress_Alias( "feign", 178, 0 );
		TeamFortress_Alias( "sfeign", TF_SPY_SFEIGN_IMPULSE, 0 );
		TeamFortress_Alias( "build", 179, 0 );
		TeamFortress_Alias( "detsentry", 188, 0 );
		TeamFortress_Alias( "detdispenser", 187, 0 );
	}
}