Beispiel #1
0
/*QUAKED target_kill (.5 .5 .5) (-8 -8 -8) (8 8 8) FALLING ELECTRICAL
Kills the activator.
*/
void target_kill_use( gentity_t *self, gentity_t *other, gentity_t *activator ) {

	G_ActivateBehavior(self,BSET_USE);

	if ( self->spawnflags & 1 )
	{//falling death
		G_Damage ( activator, NULL, NULL, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_FALLING );
		if ( !activator->s.number && activator->health <= 0 && 1 )
		{
			extern void CGCam_Fade( vec4_t source, vec4_t dest, float duration );
			float	src[4] = {0,0,0,0},dst[4]={0,0,0,1};
			CGCam_Fade( src, dst, 10000 );
		}
	}
	else if ( self->spawnflags & 2 ) // electrical
	{
		G_Damage ( activator, NULL, NULL, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_ELECTROCUTE );
		
		if ( activator->client )
		{
			activator->s.powerups |= ( 1 << PW_SHOCKED );
			activator->client->ps.powerups[PW_SHOCKED] = level.time + 4000;
		}
	}
	else
	{
		G_Damage ( activator, NULL, NULL, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_UNKNOWN);
	}
}
Beispiel #2
0
void CG_CameraParse( void )
{
	const char *o;
	int int_data;
	vec3_t vector_data, vector2_data;
	float float_data, float2_data;
	vec4_t color, color2;
	int CGroup[16];

	o = CG_ConfigString( CS_CAMERA );
	if(strncmp("enable", o, 6) == 0)
	{
		CGCam_Enable();
	}
	else if(strncmp("move", o, 4) == 0)
	{
		sscanf(o, "%*s %f %f %f %f", &vector_data[0], &vector_data[1], &vector_data[2], &float_data);
		CGCam_Move(vector_data, float_data);
	}
	else if(strncmp("pan", o, 3) == 0)
	{
		sscanf(o, "%*s %f %f %f %f %f %f %f", &vector_data[0], &vector_data[1], 
			&vector_data[2], &vector2_data[0], &vector2_data[1], &vector2_data[2], &float_data);
		CGCam_Pan(vector_data, vector2_data, float_data);
	}
	else if(strncmp("fade", o, 4) == 0)
	{
		sscanf(o, "%*s %f %f %f %f %f %f %f %f %f", &color[0],
		&color[1], &color[2], &color[3], &color2[0], &color2[1], &color2[2], &color2[3], 
		&float_data);
		CGCam_Fade(color, color2, float_data);
	}
	else if(strncmp("zoom", o, 4) == 0)
	{
		sscanf(o, "%*s %f %f", &float_data, &float2_data);
		CGCam_Zoom(float_data, float2_data);
	}
	else if(strncmp("disable", o, 7) == 0)
	{
		CGCam_Disable();
	}
	else if(strncmp("shake", o, 5) == 0)
	{
		sscanf(o, "%*s %f %i", &float_data, &int_data);
		CGCam_Shake(float_data, int_data);
	}
	else if(strncmp("follow", o, 6) == 0)
	{
		sscanf(o, "%*s %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %f %f", &CGroup[0], 
			&CGroup[1], &CGroup[2], &CGroup[3], &CGroup[4], &CGroup[5], &CGroup[6], 
		&CGroup[7], &CGroup[8], &CGroup[9], &CGroup[10], &CGroup[11], &CGroup[12], &CGroup[13],
		&CGroup[14], &CGroup[15], &float_data, &float2_data);
		CGCam_Follow(CGroup, float_data, float2_data);
	}
	else
	{
		CG_Printf("Bad CS_CAMERA configstring in CG_CameraParse().\n");
	}
}
Beispiel #3
0
void hurt_touch( gentity_t *self, gentity_t *other, trace_t *trace ) 
{
	int		dflags;
	int		actualDmg = self->damage;

	if ( self->svFlags & SVF_INACTIVE )
	{//set by target_deactivate
		return;
	}
	
	if ( !other->takedamage ) 
	{
		return;
	}
	
	if( level.time < self->painDebounceTime + self->wait  ) // normal 'wait' check
	{
		if( self->spawnflags & 2048 ) // MULTIPLE - allow multiple entities to touch this trigger in one frame
		{
			if ( self->painDebounceTime && level.time > self->painDebounceTime ) // if we haven't reached the next frame continue to let ents touch the trigger
			{
				return;
			}
		}
		else // only allowing one ent per frame to touch trigger
		{
			return;
		}
	}

	// if the player has already activated this trigger this frame
	if( other && !other->s.number && self->aimDebounceTime == level.time )
	{
		return;		
	}


	if ( self->spawnflags & 2 )
	{//player only
		if ( other->s.number )
		{
			return;
		}
	}

	if ( self->NPC_targetname && self->NPC_targetname[0] )
	{//I am for you, Kirk
		if ( other->script_targetname && other->script_targetname[0] )
		{//must have a name
			if ( Q_stricmp( self->NPC_targetname, other->script_targetname ) != 0 )
			{//not the right guy to fire me off
				return;
			}
		}
		else
		{//no name?  No trigger.
			return;
		}
	}

	// play sound
	if ( !(self->spawnflags & 4) ) 
	{
		G_Sound( other, self->noise_index );
	}

	if ( self->spawnflags & 8 )
	{
		dflags = DAMAGE_NO_PROTECTION;
	}
	else
	{
		dflags = 0;
	}
	
	if ( self->delay )
	{//Increase dmg over time
		if ( self->attackDebounceTime < self->delay )
		{//FIXME: this is for the entire trigger, not per person, so if someone else jumped in after you were in it for 5 seconds, they'd get damaged faster
			actualDmg = floor( (double)(self->damage * self->attackDebounceTime / self->delay) );
		}
		self->attackDebounceTime += FRAMETIME;

		self->e_ThinkFunc = thinkF_trigger_hurt_reset;
		self->nextthink = level.time + FRAMETIME*2;
	}

	if ( actualDmg )
	{
		if (( self->spawnflags & 64 ) && other->client )//electrical damage
		{
			// zap effect
			other->s.powerups |= ( 1 << PW_SHOCKED );
			other->client->ps.powerups[PW_SHOCKED] = level.time + 1000;
		}

		if ( self->spawnflags & 32 )
		{//falling death
			G_Damage (other, self, self, NULL, NULL, actualDmg, dflags|DAMAGE_NO_ARMOR, MOD_FALLING);
			// G_Damage will free this ent, which makes it s.number 0, so we must check inuse...
			if ( !other->s.number && other->health <= 0 )
			{
				if ( self->count )
				{
					extern void CGCam_Fade( vec4_t source, vec4_t dest, float duration );
					float	src[4] = {0,0,0,0},dst[4]={0,0,0,1};
					CGCam_Fade( src, dst, self->count );
				}
				if ( self->spawnflags & 16 )
				{//lock cam
					cg.overrides.active |= CG_OVERRIDE_3RD_PERSON_CDP;
					cg.overrides.thirdPersonCameraDamp = 0;
				}
				if ( other->client )
				{
					other->client->ps.pm_flags |= PMF_SLOW_MO_FALL;
				}
				//G_SoundOnEnt( other, CHAN_VOICE, "*falling1.wav" );//CHAN_VOICE_ATTEN?
			}
		}
		else
		{
			G_Damage (other, self, self, NULL, NULL, actualDmg, dflags, MOD_TRIGGER_HURT);
		}
		if( other && !other->s.number )
		{
			self->aimDebounceTime = level.time;
		}
		if (( self->spawnflags & 64 ) && other->client && other->health <= 0 )//electrical damage
		{//just killed them, make the effect last longer since dead clients don't touch triggers
			other->client->ps.powerups[PW_SHOCKED] = level.time + 10000;
		}
		self->painDebounceTime = level.time;
	}

	if ( self->wait < 0 )
	{
		self->e_TouchFunc = touchF_NULL;
	}
}