Beispiel #1
0
//
// Update_Chain - Repositions the chain links each frame. This single function
//                maintains the positions of all of the links. Only one link
//                is thinking every frame.
//
void UpdateChain()
{
    vec3_t t1, t2, t3;
    vec3_t temp;
    gedict_t *owner = PROG_TO_EDICT( self->s.v.owner ), *goal, *goal2;

    if (!owner->hook_out)
    {
        self->s.v.think     = (func_t) RemoveChain;
        self->s.v.nextthink = g_globalvars.time;
        return;
    }

    VectorSubtract(owner->hook->s.v.origin, owner->s.v.origin, temp);
    VectorScale(temp, 0.25, t1);
    VectorAdd(t1, owner->s.v.origin, t1);
    VectorScale(temp, 0.50, t2);
    VectorAdd(t2, owner->s.v.origin, t2);
    VectorScale(temp, 0.75, t3);
    VectorAdd(t3, owner->s.v.origin, t3);

    goal = PROG_TO_EDICT(self->s.v.goalentity);
    goal2 = PROG_TO_EDICT(goal->s.v.goalentity);
    // These numbers are correct assuming 3 links.
    // 4 links would be *20 *40 *60 and *80
    setorigin (self,  PASSVEC3(t1));
    setorigin (goal,  PASSVEC3(t2));
    setorigin (goal2, PASSVEC3(t3));

    self->s.v.nextthink = g_globalvars.time + 0.1;
}
Beispiel #2
0
/*
		Glass
					*/
void blocker_use()
{
    if (!(self->state ))
    {
        self->state  = 1;
        setorigin(self, self->s.v.origin[0] - 8000,self->s.v.origin[1] - 8000,self->s.v.origin[2] - 8000);// '8000 8000 8000');
        sound(self, 2, self->s.v.noise1, 1, 1);
    }
    else
    {
        self->state  = 0;
        setorigin(self, self->s.v.origin[0] + 8000,self->s.v.origin[1],self->s.v.origin[2]);//'8000 8000 8000');
        sound(self, 2, self->s.v.noise, 1, 1);
    }
}
Beispiel #3
0
/*
================
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 = find( goal, FOFS( s.v.classname ), "info_player_deathmatch" );
		if ( !goal )
			goal =
			    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;
}
Beispiel #4
0
void DeathBubblesSpawn()
{
	gedict_t       *bubble;

	if ( PROG_TO_EDICT( self->s.v.owner )->s.v.waterlevel != 3 )
		return;
	bubble = spawn();
	setmodel( bubble, "progs/s_bubble.spr" );
	setorigin( bubble, PROG_TO_EDICT( self->s.v.owner )->s.v.origin[0],
			PROG_TO_EDICT( self->s.v.owner )->s.v.origin[1],
			PROG_TO_EDICT( self->s.v.owner )->s.v.origin[2] + 24 );

	bubble->s.v.movetype = MOVETYPE_NOCLIP;
	bubble->s.v.solid = SOLID_NOT;

	SetVector( bubble->s.v.velocity, 0, 0, 15 );

	bubble->s.v.nextthink = g_globalvars.time + 0.5;
	bubble->think = ( func_t ) bubble_bob;
	bubble->classname = "bubble";
	bubble->s.v.frame = 0;
	bubble->cnt = 0;
	
	setsize( bubble, -8, -8, -8, 8, 8, 8 );

	self->s.v.nextthink = g_globalvars.time + 0.1;
	self->think = ( func_t ) DeathBubblesSpawn;
	self->air_finished = self->air_finished + 1;

	if ( self->air_finished >= self->bubble_count )
		ent_remove( self );
}
Beispiel #5
0
void bubble_split(  )
{
	gedict_t *bubble;

	bubble = spawn(  );
	setmodel( bubble, "progs/s_bubble.spr" );
	setorigin( bubble, PASSVEC3( self->s.v.origin ) );

	bubble->s.v.movetype = MOVETYPE_NOCLIP;
	bubble->s.v.solid = SOLID_NOT;

	VectorCopy( self->s.v.velocity, bubble->s.v.velocity );

	bubble->s.v.nextthink = g_globalvars.time + 0.5;
	bubble->s.v.think = ( func_t ) bubble_bob;
	bubble->s.v.touch = ( func_t ) bubble_remove;
	bubble->s.v.classname = "bubble";
	bubble->s.v.frame = 1;
	bubble->cnt = 10;

	setsize( bubble, -8, -8, -8, 8, 8, 8 );

	self->s.v.frame = 1;
	self->cnt = 10;

	if ( self->s.v.waterlevel != 3 )
		ent_remove( self );
}
Beispiel #6
0
/*
================
SpawnMeatSpray
================
*/
void SpawnMeatSpray( vec3_t org, vec3_t vel )
{
	gedict_t       *missile;

	//vec3_t  org;

	missile = spawn();
	missile->s.v.owner = EDICT_TO_PROG( self );
	missile->s.v.movetype = MOVETYPE_BOUNCE;
	missile->s.v.solid = SOLID_NOT;

	makevectors( self->s.v.angles );

	VectorCopy( vel, missile->s.v.velocity );
// missile->s.v.velocity = vel;
	missile->s.v.velocity[2] = missile->s.v.velocity[2] + 250 + 50 * g_random();

	SetVector( missile->s.v.avelocity, 3000, 1000, 2000 );
// missile.avelocity = '3000 1000 2000';

// set missile duration
	missile->s.v.nextthink = g_globalvars.time + 1;
	missile->s.v.think = ( func_t ) SUB_Remove;

	setmodel( missile, "progs/zom_gib.mdl" );
	setsize( missile, 0, 0, 0, 0, 0, 0 );
	setorigin( missile, PASSVEC3( org ) );
}
Beispiel #7
0
void FlagThink()
{
	if ( !isCTF() )
		return;

	self->s.v.nextthink = g_globalvars.time + 0.1;

	if (self->cnt == FLAG_AT_BASE)
		return;

	if (self->cnt == FLAG_DROPPED)
	{
		self->cnt2 += 0.1;
		if ( g_globalvars.time > self->super_time )
		{
			RegenFlag( self );
			G_bprint( 2, "The %s flag has been returned\n", redtext( ( (int) self->s.v.items & IT_KEY1) ? "BLUE" : "RED" ) );
		}
		return;
	}

	if (self->cnt == FLAG_RETURNED)
	{
		setorigin( self, PASSVEC3(self->s.v.oldorigin) );
		self->cnt = FLAG_AT_BASE;
		return;
	}

	self->cnt2 += 0.1;
}
Beispiel #8
0
void SUB_regen()
{
	self->s.v.model = self->mdl;	// restore original model
	self->s.v.solid = SOLID_TRIGGER;	// allow it to be touched again
	sound( self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM );	// play respawn sound
	setorigin( self, PASSVEC3( self->s.v.origin ) );
}
Beispiel #9
0
void fire_fly(  )
{
	gedict_t *fireball;

	fireball = spawn(  );
	newmis = fireball;
	g_globalvars.newmis = EDICT_TO_PROG( newmis );
	fireball->s.v.solid = SOLID_TRIGGER;
	fireball->s.v.movetype = MOVETYPE_TOSS;
	SetVector( fireball->s.v.velocity,
		   ( g_random(  ) * 100 ) - 50, ( g_random(  ) * 100 ) - 50, self->speed + ( g_random(  ) * 200 ) );

	fireball->s.v.classname = "fireball";

	setmodel( fireball, "progs/lavaball.mdl" );
	setsize( fireball, 0, 0, 0, 0, 0, 0 );
	setorigin( fireball, PASSVEC3( self->s.v.origin ) );

	fireball->s.v.nextthink = g_globalvars.time + 5;
	fireball->s.v.think = ( func_t ) SUB_Remove;
	fireball->s.v.touch = ( func_t ) fire_touch;

	self->s.v.nextthink = g_globalvars.time + ( g_random(  ) * 5 ) + 3;
	self->s.v.think = ( func_t ) fire_fly;
}
Beispiel #10
0
void LaunchLaser( vec3_t org, vec3_t vec )
{

	if ( !strcmp( self->s.v.classname, "monster_enforcer" ) )
		sound( self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM );

	normalize( vec, vec );

	newmis = spawn(  );
	g_globalvars.newmis = EDICT_TO_PROG( newmis );
	newmis->s.v.owner = EDICT_TO_PROG( self );
	newmis->s.v.movetype = MOVETYPE_FLY;
	newmis->s.v.solid = SOLID_BBOX;
	newmis->s.v.effects = EF_DIMLIGHT;

	setmodel( newmis, "progs/laser.mdl" );
	setsize( newmis, 0, 0, 0, 0, 0, 0 );

	setorigin( newmis, PASSVEC3( org ) );

	//newmis->s.v.velocity = vec * 600;
	VectorScale( vec, 600, newmis->s.v.velocity );

	vectoangles( newmis->s.v.velocity, newmis->s.v.angles );

	newmis->s.v.nextthink = g_globalvars.time + 5;
	newmis->s.v.think = ( func_t ) SUB_Remove;
	newmis->s.v.touch = ( func_t ) Laser_Touch;
}
Beispiel #11
0
Datei: misc.c Projekt: deurk/ktx
void fire_fly()
{
	gedict_t       *fireball;

	fireball = spawn();
	fireball->s.v.solid = SOLID_TRIGGER;
	fireball->s.v.movetype = MOVETYPE_TOSS;
	fireball->isMissile = true; // well, you can really treat fireball as missilie, nothing bad gonna heppen.
	SetVector( fireball->s.v.velocity,
		   ( g_random() * 100 ) - 50,
		   ( g_random() * 100 ) - 50, self->speed + ( g_random() * 200 ) );

	fireball->classname = "fireball";

	setmodel( fireball, "progs/lavaball.mdl" );
	setsize( fireball, 0, 0, 0, 0, 0, 0 );
	setorigin( fireball, PASSVEC3( self->s.v.origin ) );

	fireball->s.v.nextthink = g_globalvars.time + 5;
	fireball->think = ( func_t ) SUB_Remove;
	fireball->touch = ( func_t ) fire_touch;

	self->s.v.nextthink = g_globalvars.time + ( g_random() * 5 ) + 3;
	self->think = ( func_t ) fire_fly;
}
Beispiel #12
0
void SP_func_door_secret()
{
	if ( self->s.v.sounds == 0 )
		self->s.v.sounds = 3;
	if ( self->s.v.sounds == 1 )
	{
		trap_precache_sound( "doors/latch2.wav" );
		trap_precache_sound( "doors/winch2.wav" );
		trap_precache_sound( "doors/drclos4.wav" );
		self->s.v.noise1 = "doors/latch2.wav";
		self->s.v.noise2 = "doors/winch2.wav";
		self->s.v.noise3 = "doors/drclos4.wav";
	}
	if ( self->s.v.sounds == 2 )
	{
		trap_precache_sound( "doors/airdoor1.wav" );
		trap_precache_sound( "doors/airdoor2.wav" );
		self->s.v.noise2 = "doors/airdoor1.wav";
		self->s.v.noise1 = "doors/airdoor2.wav";
		self->s.v.noise3 = "doors/airdoor2.wav";
	}
	if ( self->s.v.sounds == 3 )
	{
		trap_precache_sound( "doors/basesec1.wav" );
		trap_precache_sound( "doors/basesec2.wav" );
		self->s.v.noise2 = "doors/basesec1.wav";
		self->s.v.noise1 = "doors/basesec2.wav";
		self->s.v.noise3 = "doors/basesec2.wav";
	}

	if ( self->dmg == 0 )
		self->dmg = 2;

	// Magic formula...
	VectorCopy( self->s.v.angles, self->mangle );
	SetVector( self->s.v.angles, 0, 0, 0 );
	self->s.v.solid = SOLID_BSP;
	self->s.v.movetype = MOVETYPE_PUSH;
	self->s.v.classname = "door";
	setmodel( self, self->s.v.model );
	setorigin( self, PASSVEC3( self->s.v.origin ) );

	self->s.v.touch = ( func_t ) secret_touch;
	self->s.v.blocked = ( func_t ) secret_blocked;
	self->speed = 50;
	self->s.v.use = ( func_t ) fd_secret_use;
	if ( !self->s.v.targetname
	     || ( int ) ( self->s.v.spawnflags ) & SECRET_YES_SHOOT )
	{
		self->s.v.health = 10000;
		self->s.v.takedamage = DAMAGE_YES;
		self->th_pain = fd_secret_use;
	}
	VectorCopy( self->s.v.origin, self->oldorigin );
// self.oldorigin = self.origin;
	if ( self->wait == 0 )
		self->wait = 5;	// 5 seconds before closing
}
Beispiel #13
0
/*
============
After moving, set origin to exact final destination
============
*/
void SUB_CalcMoveDone()
{
	setorigin( self, PASSVEC3( self->finaldest ) );

	SetVector( self->s.v.velocity, 0, 0, 0 );
	//self->s.v.nextthink = -1;
	if ( self->think1 )
		self->think1();
}
Beispiel #14
0
void SpawnCTFItem( char* classname, float x, float y, float z, float angle )
{
	gedict_t *item = spawn();

	item->s.v.classname = classname;
	setorigin( item, x, y, z );
	item->s.v.angles[0] = 0;
	item->s.v.angles[1] = angle;

	G_CallSpawn( item );
}
Beispiel #15
0
// Throw Toaster
void Toaster ( )
{
	gedict_t *missile;
	if ( self->no_grenades_2 < 2 ) {
		G_sprint( self, 1, "Not enough type 2 grenades... get more\n" );
		return;
	}
	if (!tf_data.drop2)
	{
		G_sprint (self, 2, "Toasters have been disabled by the admin!\n");
		return;
	}
	self->no_grenades_2 = self->no_grenades_2 - 2;
	sound( self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM );
	missile = spawn(  );
	missile->s.v.owner = EDICT_TO_PROG( self );
	missile->s.v.movetype = 10;
	missile->s.v.solid = 2;
	missile->s.v.classname = "grenade";
	missile->s.v.effects = 8;

	// throw that toaster!
	makevectors( self->s.v.v_angle );
	if (self->s.v.v_angle[0]) {
		missile->s.v.velocity[0] =
		    g_globalvars.v_forward[0] * 600 + g_globalvars.v_up[0] * 200 +
		    crandom(  ) * g_globalvars.v_right[0] * 10 + crandom(  ) * g_globalvars.v_up[0] * 10;
		missile->s.v.velocity[1] =
		    g_globalvars.v_forward[1] * 600 + g_globalvars.v_up[1] * 200 +
		    crandom(  ) * g_globalvars.v_right[1] * 10 + crandom(  ) * g_globalvars.v_up[1] * 10;
		missile->s.v.velocity[2] =
		    g_globalvars.v_forward[2] * 600 + g_globalvars.v_up[2] * 200 +
		    crandom(  ) * g_globalvars.v_right[2] * 10 + crandom(  ) * g_globalvars.v_up[0] * 10;
	}
	else {
		//missile->s.v.velocity = aim(self, 10000);
		aim( self->s.v.velocity );	// = aim(self, 10000);
		missile->s.v.velocity[0] = missile->s.v.velocity[0] * 600;
		missile->s.v.velocity[1] = missile->s.v.velocity[1] * 600;
//		missile->s.v.velocity[2] = missile->s.v.velocity[2] * 600;
		missile->s.v.velocity[2] = 200;
	}
	SetVector( missile->s.v.avelocity, 300, 300, 300 );
	//missile.angles = vectoangles(missile.velocity);
	vectoangles( missile->s.v.velocity, missile->s.v.angles );
	missile->s.v.touch = ( func_t ) ToasterTouch;
	missile->s.v.nextthink = g_globalvars.time + 3;
	missile->s.v.think = ( func_t ) ToasterElec;
	setmodel( missile, "progs/v_spike.mdl" );
	setsize( missile, 0, 0, 0, 0, 0, 0 );
	setorigin( missile, self->s.v.origin[0], self->s.v.origin[1], self->s.v.origin[2]);
}
Beispiel #16
0
void SetMarkerIndicatorPosition (gedict_t* item, gedict_t* indicator)
{
	vec3_t pos;

	VectorAdd (item->s.v.absmin, item->s.v.absmax, pos);
	VectorScale (pos, 0.5f, pos);
	if (streq (item->classname, "plat")) {
		VectorAdd (item->s.v.mins, item->s.v.maxs, pos);
		VectorScale (pos, 0.5f, pos);
	}

	setorigin (indicator, PASSVEC3 (pos));
}
Beispiel #17
0
//游戏结束
void gameOver(int playerNum)
{

    mciSendString("play data\\ace.mp3", NULL, 0, NULL);
    setorigin(g_player[playerNum].area.areaPoint.x, g_player[playerNum].area.areaPoint.y);

    char str[] = "GameOver";
    int i, strLength = 8;

    setcolor(RED);
    setfont(L_FONT_LENGTH, L_FONT_WIDTH, L_FONT_TYPE);	// 设置字体
    for(i = 0; i < strLength / 2; i++)
        outtextxy((GAME_WIDTH - 4 * L_FONT_WIDTH) / 2 + i * L_FONT_WIDTH, (GAME_LENGTH - 3 * L_FONT_LENGTH) / 2, str[i]);

    for(i = strLength / 2; i < strLength; i++)
        outtextxy((GAME_WIDTH - 4 * L_FONT_WIDTH) / 2 + (i - 4)*L_FONT_WIDTH, (GAME_LENGTH - L_FONT_LENGTH) / 2, str[i]);

    if(playerNum == 1)
        playerNum = 2;
    else playerNum = 1;
    setorigin(g_player[playerNum].area.areaPoint.x, g_player[playerNum].area.areaPoint.y);

    strcpy( str, "You Win!");


    setcolor(GREEN);
    setfont(L_FONT_LENGTH, L_FONT_WIDTH, L_FONT_TYPE);	// 设置字体
    for(i = 0; i < strLength / 2; i++)
        outtextxy((GAME_WIDTH - 4 * L_FONT_WIDTH) / 2 + i * L_FONT_WIDTH, (GAME_LENGTH - 3 * L_FONT_LENGTH) / 2, str[i]);

    for(i = strLength / 2; i < strLength; i++)
        outtextxy((GAME_WIDTH - 4 * L_FONT_WIDTH) / 2 + (i - 4)*L_FONT_WIDTH, (GAME_LENGTH - L_FONT_LENGTH) / 2, str[i]);

    FlushBatchDraw();
    Sleep(10000);
    getch();
    gameExit();
}
Beispiel #18
0
void BigAssCarry ( )
{
	vec3_t vtemp;

	makevectors ( PROG_TO_EDICT( self->s.v.owner )->s.v.v_angle );
	vtemp[0] = ( PROG_TO_EDICT( self->s.v.owner )->s.v.origin[0] + ( g_globalvars.v_forward[0] * 12 ) + 0 ) + ( g_globalvars.v_right[0] * 5 );
	vtemp[1] = ( PROG_TO_EDICT( self->s.v.owner )->s.v.origin[1] + ( g_globalvars.v_forward[1] * 12 ) + 0 ) + ( g_globalvars.v_right[1] * 5 );
	vtemp[2] = ( PROG_TO_EDICT( self->s.v.owner )->s.v.origin[2] + ( g_globalvars.v_forward[2] * 12 ) + 20 ) + ( g_globalvars.v_right[2] * 5 );

	setorigin (self, PASSVEC3( vtemp ) );
	VectorCopy( PROG_TO_EDICT( self->s.v.owner )->s.v.angles, self->s.v.angles );
	//self->s.v.angles = PROG_TO_EDICT( self->s.v.owner )->s.v.angles;
	self->s.v.think = ( func_t ) BigAssCarry;
	self->s.v.nextthink = g_globalvars.time + 0.02;
}
Beispiel #19
0
void drawStageLine()
{
    int i;

    setorigin(0, 0);
    setfillstyle(BLUE);
    for(i = 1; i <= TOTAL_PLAYER; i++)
    {
        bar(g_player[i].area.areaPoint.x - 1, 0,
            g_player[i].area.areaPoint.x + 1, LENGTH );

        bar(g_player[i].area.areaPoint.x - 1 + ROW * BLOCK_SIZE, 0,
            g_player[i].area.areaPoint.x + 1 + ROW * BLOCK_SIZE, LENGTH );
    }
}
Beispiel #20
0
void make_explosion ( )
{

	newmis = spawn ( );
	setmodel( newmis, "progs/s_expl.spr" );
	setorigin( newmis, PASSVEC3( self->s.v.origin ) );
	newmis->s.v.movetype = 8;
	newmis->s.v.solid = SOLID_NOT;
	sound ( newmis, 0, "weapons/flmfire2.wav", 1, 1 );
	newmis->s.v.effects = 8;
	newmis->s.v.velocity[2] = ( g_random () * 250.000000 );
	newmis->s.v.nextthink = g_globalvars.time + 0.05;
	newmis->s.v.think = ( func_t ) s2_explode1;
	newmis->s.v.nextthink = g_globalvars.time + 0.05;
}
Beispiel #21
0
void DeathBubbles( float num_bubbles )
{
	gedict_t       *bubble_spawner;

	bubble_spawner = spawn();
	setorigin( bubble_spawner, PASSVEC3( self->s.v.origin ) );

	bubble_spawner->s.v.movetype = MOVETYPE_NONE;
	bubble_spawner->s.v.solid = SOLID_NOT;
	bubble_spawner->s.v.nextthink = g_globalvars.time + 0.1;
	bubble_spawner->think = ( func_t ) DeathBubblesSpawn;
	bubble_spawner->air_finished = 0;
	bubble_spawner->s.v.owner = EDICT_TO_PROG( self );
	bubble_spawner->bubble_count = num_bubbles;
	return;
}
Beispiel #22
0
/*
================
SpectatorImpulseCommand

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

	if ( self->ct != ctSpec ) {
		self->s.v.impulse = 0;
		return;
	}

	goal = PROG_TO_EDICT( self->s.v.goalentity );

	if( self->k_adminc && self->s.v.impulse >= 1 && self->s.v.impulse <= 9 ) {

		AdminImpBot();

	}
	else 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 );

		// if track someone - return
		if ( (int)(goal - world) >= 1 && (int)(goal - world) <= MAX_CLIENTS ) {
// qqshka - heh, not all guys like this warning
//			G_sprint(self, 2, "stop %s first\n", redtext("tracking"));
			self->s.v.impulse = 0;
			return;
		}

		goal = find( goal, FOFS( s.v.classname ), "info_player_deathmatch" );

		if ( !goal )
			goal = 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;
}
Beispiel #23
0
////////////////
// GlobalParams:
// time
// self
///////////////
void SpectatorThink()
{
	gedict_t *wizard = self->wizard;

	if ( self->last_goal != self->s.v.goalentity ) {
		SpecGoalChanged();

		self->last_goal = self->s.v.goalentity;
	}

	if ( self->autotrack )
		DoAutoTrack();

	if ( self->s.v.impulse )
		SpectatorImpulseCommand();

	if ( self->sc_stats && self->sc_stats_time && self->sc_stats_time <= g_globalvars.time && match_in_progress != 1 )
		Print_Scores ();

	if ( self->wp_stats && self->wp_stats_time && self->wp_stats_time <= g_globalvars.time && match_in_progress != 1 )
		Print_Wp_Stats ();

	if ( wizard ) {
		// set model angles
		wizard->s.v.angles[0] = -self->s.v.v_angle[0] / 2;
		wizard->s.v.angles[1] = self->s.v.v_angle[1];
        // wizard model blinking at spectator screen - so move model behind spec camera a bit		
		trap_makevectors( self->s.v.v_angle );
		VectorMA (self->s.v.origin, -32, g_globalvars.v_forward, wizard->s.v.origin);
		// model bobbing
		wizard->s.v.origin[2] += sin( g_globalvars.time * 2.5 );
		setorigin( wizard, PASSVEC3( wizard->s.v.origin ) );

		if ( GetSpecWizard () ) {
			gedict_t *goal = PROG_TO_EDICT( self->s.v.goalentity );

			if ( goal && goal->ct == ctPlayer ) // tracking player, so turn model off
				wizard->s.v.model = "";
			else // turn model on
				setmodel( wizard, "progs/wizard.mdl" );
		}
		else {
			wizard->s.v.model = ""; // turn model off
		}
	}
}
Beispiel #24
0
//=========================================================================
// Fire a laserbolt		 -- mtf style
void W_FireLaser(  )
{
    vec3_t vec;
    vec3_t org;

    self->s.v.currentammo = --( self->s.v.ammo_nails );

    makevectors( self->s.v.v_angle );
    VectorScale( g_globalvars.v_forward, 8, org );
    VectorAdd( self->s.v.origin, org, org );
    aim( vec );
    VectorNormalize( vec );

    newmis = spawn(  );
    newmis->s.v.owner = EDICT_TO_PROG( self );
    newmis->s.v.enemy = EDICT_TO_PROG( self ); // The real owner
    newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
    newmis->s.v.solid = SOLID_TRIGGER;

	// set model, skin, and effects
    setmodel( newmis, "progs/beam.mdl" );
	if ( tf_data.coloredlights == TRUE ) {
		if ( self->team_no == 1 )
			newmis->s.v.effects = 64;
		else {
			if ( self->team_no == 2 )
				newmis->s.v.effects = 128;
			else
				newmis->s.v.effects = 2;
		}
	}
	else
		newmis->s.v.effects = 2;
	newmis->s.v.skin = self->team_no - 1;

	SetVector( newmis->s.v.avelocity, 0, 0, 500 );
    setsize( newmis, 0, 0, 0, 0, 0, 0 );
    setorigin( newmis, org[0], org[1], org[2] + 16 );
    VectorScale( vec, 1500, newmis->s.v.velocity );
    vectoangles( newmis->s.v.velocity, newmis->s.v.angles );
	newmis->s.v.angles[1] += 0.1;
    VectorCopy( newmis->s.v.velocity, newmis->s.v.oldorigin );
    newmis->s.v.nextthink = g_globalvars.time + 5;
    newmis->s.v.think = ( func_t ) SUB_Remove;
    newmis->s.v.touch = ( func_t ) LaserBolt_Touch;
}
Beispiel #25
0
// Called from weapons.c
void GrappleThrow()
{
    if ( self->hook_out ) // only throw once
        return;

    g_globalvars.msg_entity = EDICT_TO_PROG( self );
    WriteByte( MSG_ONE, SVC_SMALLKICK );

    // chain out sound (loops)
    sound ( self, CHAN_WEAPON, "weapons/chain1.wav", 1, ATTN_NORM );

    newmis                = spawn();
    g_globalvars.newmis   = EDICT_TO_PROG( newmis );
    newmis->s.v.movetype  = MOVETYPE_FLYMISSILE;
    newmis->s.v.solid     = SOLID_BBOX;
    newmis->s.v.owner     = EDICT_TO_PROG( self );
    self->hook            = newmis;
    newmis->s.v.classname = "hook";

    trap_makevectors ( self->s.v.v_angle );

    // Weapon velocitys should not be based on server maxspeed imo
    // Removing purectf velocity changes ( 2.5 * self->maxspeed )

    if ( self->ctf_flag & CTF_RUNE_HST )
        VectorScale( g_globalvars.v_forward, 1000, newmis->s.v.velocity );
    else
        VectorScale( g_globalvars.v_forward, 800, newmis->s.v.velocity );
    SetVector( newmis->s.v.avelocity, 0, 0, -500 );

    newmis->s.v.touch     = (func_t) GrappleAnchor;
    newmis->s.v.think     = (func_t) BuildChain;
    newmis->s.v.nextthink = g_globalvars.time + 0.1;

    if ( k_ctf_custom_models )
        setmodel ( newmis, "progs/star.mdl" );
    else
        setmodel ( newmis, "progs/v_spike.mdl" );

    setorigin(newmis, self->s.v.origin[0] + g_globalvars.v_forward[0] * 16,
              self->s.v.origin[1] + g_globalvars.v_forward[1] * 16,
              self->s.v.origin[2] + g_globalvars.v_forward[2] * 16 + 16);
    setsize( newmis, 0, 0, 0, 0, 0, 0 );
    self->hook_out = true;
}
Beispiel #26
0
/*QUAKED trigger_multiple (.5 .5 .5) ? notouch
Variable sized repeatable trigger.  Must be targeted at one or more entities.  If "health" is set, the trigger must be killed to activate each time.
If "delay" is set, the trigger waits some time after activating before firing.
"wait" : Seconds between triggerings. (.2 default)
If notouch is set, the trigger is only fired by other entities, not by touching.
NOTOUCH has been obsoleted by trigger_relay!
sounds
1) secret
2) beep beep
3) large switch
4)
set "message" to text string
*/
void SP_trigger_multiple(  )
{
	if ( !CheckExistence(  ) )
	{
		dremove( self );
		return;
	}
	if ( self->s.v.sounds == 1 )
	{
		trap_precache_sound( "misc/secret.wav" );
		self->s.v.noise = "misc/secret.wav";
	} else if ( self->s.v.sounds == 2 )
	{
		trap_precache_sound( "misc/talk.wav" );
		self->s.v.noise = "misc/talk.wav";
	} else if ( self->s.v.sounds == 3 )
	{
		trap_precache_sound( "misc/trigger1.wav" );
		self->s.v.noise = "misc/trigger1.wav";
	}

	if ( !self->wait )
		self->wait = 0.2;
	self->s.v.use = ( func_t ) multi_use;

	InitTrigger(  );

	if ( self->s.v.health )
	{
		if ( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOTOUCH )
			G_Error( "health and notouch don't make sense\n" );
		self->s.v.max_health = self->s.v.health;
		self->th_die = multi_killed;
		self->s.v.takedamage = DAMAGE_YES;
		self->s.v.solid = SOLID_BBOX;
		setorigin( self, PASSVEC3( self->s.v.origin ) );	// make sure it links into the world
	} else
	{
		if ( !( ( int ) ( self->s.v.spawnflags ) & SPAWNFLAG_NOTOUCH ) )
		{
			self->s.v.touch = ( func_t ) multi_touch;
		}
	}
}
Beispiel #27
0
//
// GrappleTrack - Constantly updates the hook's position relative to
//                 what it's hooked to. Inflicts damage if attached to
//                 a player that is not on the same team as the hook's
//                 owner.
//
void GrappleTrack()
{
    gedict_t *enemy = PROG_TO_EDICT(self->s.v.enemy);
    gedict_t *owner = PROG_TO_EDICT(self->s.v.owner);

    // Release dead targets
    if ( enemy->ct == ctPlayer && ISDEAD( enemy ) )
        owner->on_hook = false;

    // drop the hook if owner is dead or has released the button
    if ( !owner->on_hook || owner->s.v.health <= 0 )
    {
        GrappleReset( self );
        return;
    }

    if ( enemy->ct == ctPlayer )
    {
        if ( !CanDamage(enemy, owner) )
        {
            GrappleReset( self );
            return;
        }

        // move the hook along with the player.  It's invisible, but
        // we need this to make the sound come from the right spot
        setorigin( self, PASSVEC3(enemy->s.v.origin) );

        sound ( self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM );
        enemy->deathtype = dtHOOK;
        T_Damage ( enemy, self, owner, 1 );
        trap_makevectors ( self->s.v.v_angle );
        SpawnBlood( enemy->s.v.origin, 1 );
    }

    // If the hook is not attached to the player, constantly copy
    // the target's velocity. Velocity copying DOES NOT work properly
    // for a hooked client.
    if ( enemy->ct != ctPlayer )
        VectorCopy( enemy->s.v.velocity, self->s.v.velocity );

    self->s.v.nextthink = g_globalvars.time + 0.1;
}
Beispiel #28
0
//
// MakeLink - spawns the chain link entities
//
gedict_t* MakeLink()
{
    newmis = spawn ();
    g_globalvars.newmis = EDICT_TO_PROG( newmis );

    newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
    newmis->s.v.solid = SOLID_NOT;
    newmis->s.v.owner = EDICT_TO_PROG( self );
    SetVector ( newmis->s.v.avelocity, 200, 200, 200 );

    if ( k_ctf_custom_models )
        setmodel  ( newmis, "progs/bit.mdl" );
    else
        setmodel  ( newmis, "progs/spike.mdl" );

    setorigin ( newmis, PASSVEC3(self->s.v.origin) );
    setsize   ( newmis, 0, 0, 0, 0, 0, 0 );

    return newmis;
}
Beispiel #29
0
void W_FireRocket()
{
	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_rockets =
		    self->s.v.ammo_rockets - 1;

	sound( self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM );

	g_globalvars.msg_entity = EDICT_TO_PROG( self );
	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );

	newmis = spawn();
	g_globalvars.newmis = EDICT_TO_PROG( newmis );
	newmis->s.v.owner = EDICT_TO_PROG( self );
	newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
	newmis->s.v.solid = SOLID_BBOX;

// set newmis speed     
	makevectors( self->s.v.v_angle );
	aim( newmis->s.v.velocity );	// = aim(self, 1000);
	VectorScale( newmis->s.v.velocity, 1000, newmis->s.v.velocity );
// newmis->s.v.velocity = newmis->s.v.velocity * 1000;

	vectoangles( newmis->s.v.velocity, newmis->s.v.angles );
	
	newmis->s.v.touch = ( func_t ) T_MissileTouch;
	newmis->voided = 0;

// set newmis duration
	newmis->s.v.nextthink = g_globalvars.time + 5;
	newmis->s.v.think = ( func_t ) SUB_Remove;
	newmis->s.v.classname = "rocket";

	setmodel( newmis, "progs/missile.mdl" );
	setsize( newmis, 0, 0, 0, 0, 0, 0 );

// setorigin (newmis, self->s.v.origin + v_forward*8 + '0 0 16');
	setorigin( newmis, self->s.v.origin[0] + g_globalvars.v_forward[0] * 8,
			self->s.v.origin[1] + g_globalvars.v_forward[1] * 8,
			self->s.v.origin[2] + g_globalvars.v_forward[2] * 8 + 16 );
}
Beispiel #30
0
gedict_t* spawn_buble( gedict_t* self )
{
	gedict_t *bubble;

	bubble = spawn(  );
	setmodel( bubble, "progs/s_bubble.spr" );
	setorigin( bubble, PASSVEC3( self->s.v.origin ) );
	bubble->s.v.movetype = MOVETYPE_NOCLIP;
	bubble->s.v.solid = SOLID_NOT;

	SetVector( bubble->s.v.velocity, 0, 0, 15 );
	bubble->s.v.nextthink = g_globalvars.time + 0.5;
	bubble->s.v.think = ( func_t ) bubble_bob;
	bubble->s.v.touch = ( func_t ) bubble_remove;
	bubble->s.v.classname = "bubble";
	bubble->s.v.frame = 0;
	bubble->cnt = 0;

	setsize( bubble, -8, -8, -8, 8, 8, 8 );
    return bubble;
}