Пример #1
0
/*
=================
TossClientItems

Toss the weapon and powerups for the killed player
=================
*/
void TossClientItems( gentity_t *self ) {
	gitem_t		*item;
	int			weapon;
	float		angle;
	int			i;
	gentity_t	*drop;

	// drop the weapon if not a gauntlet or machinegun
	weapon = self->s.weapon;

	//Never drop in elimination or last man standing mode!
	if( g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_LMS)
		return;

	// make a special check to see if they are changing to a new
	// weapon that isn't the mg or gauntlet.  Without this, a client
	// can pick up a weapon, be killed, and not drop the weapon because
	// their weapon change hasn't completed yet and they are still holding the MG.
	if ( weapon == WP_MACHINEGUN || weapon == WP_GRAPPLING_HOOK ) {
		if ( self->client->ps.weaponstate == WEAPON_DROPPING ) {
			weapon = self->client->pers.cmd.weapon;
		}
		if ( !( self->client->ps.stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) {
			weapon = WP_NONE;
		}
	}

	if (g_instantgib.integer || g_rockets.integer || g_gametype.integer == GT_CTF_ELIMINATION || g_elimination_allgametypes.integer){
	//Nothing!	
	}
	else
	if ( weapon > WP_MACHINEGUN && weapon != WP_GRAPPLING_HOOK && 
		self->client->ps.ammo[ weapon ] ) {
		// find the item type for this weapon
		item = BG_FindItemForWeapon( weapon );

		// spawn the item
		Drop_Item( self, item, 0 );
	}

	// drop all the powerups if not in teamplay
	if ( g_gametype.integer != GT_TEAM ) {
		angle = 45;
		for ( i = 1 ; i < PW_NUM_POWERUPS ; i++ ) {
			if ( self->client->ps.powerups[ i ] > level.time ) {
				item = BG_FindItemForPowerup( i );
				if ( !item ) {
					continue;
				}
				drop = Drop_Item( self, item, angle );
				// decide how many seconds it has left
				drop->count = ( self->client->ps.powerups[ i ] - level.time ) / 1000;
				if ( drop->count < 1 ) {
					drop->count = 1;
				}
				angle += 45;
			}
		}
	}
}
Пример #2
0
static void PortalTouch(gentity_t * self, gentity_t * other, trace_t * trace)
{
	gentity_t      *destination;

	// see if we will even let other try to use it
	if(other->health <= 0)
	{
		return;
	}
	if(!other->client)
	{
		return;
	}
//  if( other->client->ps.persistant[PERS_TEAM] != self->spawnflags ) {
//      return;
//  }

	if(other->client->ps.powerups[PW_NEUTRALFLAG])
	{							// only happens in One Flag CTF
		Drop_Item(other, BG_FindItemForPowerup(PW_NEUTRALFLAG), 0);
		other->client->ps.powerups[PW_NEUTRALFLAG] = 0;
	}
	else if(other->client->ps.powerups[PW_REDFLAG])
	{							// only happens in standard CTF
		Drop_Item(other, BG_FindItemForPowerup(PW_REDFLAG), 0);
		other->client->ps.powerups[PW_REDFLAG] = 0;
	}
	else if(other->client->ps.powerups[PW_BLUEFLAG])
	{							// only happens in standard CTF
		Drop_Item(other, BG_FindItemForPowerup(PW_BLUEFLAG), 0);
		other->client->ps.powerups[PW_BLUEFLAG] = 0;
	}

	// find the destination
	destination = NULL;
	while((destination = G_Find(destination, FOFS(classname), "hi_portal destination")) != NULL)
	{
		if(destination->count == self->count)
		{
			break;
		}
	}

	// if there is not one, die!
	if(!destination)
	{
		if(self->pos1[0] || self->pos1[1] || self->pos1[2])
		{
			TeleportPlayer(other, self->pos1, self->s.angles);
		}
		G_Damage(other, other, other, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG);
		return;
	}

	TeleportPlayer(other, destination->s.pos.trBase, destination->s.angles);
}
Пример #3
0
/*
===========
TossPlayerGametypeItems

Drop CTF flag and Harvester cubes
===========
*/
void TossPlayerGametypeItems(gentity_t *ent) {
	int j;
	gitem_t *item;
	gentity_t *drop;
	int angle = 0;

	// drop flags in CTF
	item = NULL;
	j = 0;

	if ( ent->player->ps.powerups[ PW_REDFLAG ] ) {
		item = BG_FindItemForPowerup( PW_REDFLAG );
		j = PW_REDFLAG;
	} else if ( ent->player->ps.powerups[ PW_BLUEFLAG ] ) {
		item = BG_FindItemForPowerup( PW_BLUEFLAG );
		j = PW_BLUEFLAG;
	} else if ( ent->player->ps.powerups[ PW_NEUTRALFLAG ] ) {
		item = BG_FindItemForPowerup( PW_NEUTRALFLAG );
		j = PW_NEUTRALFLAG;
	}

	if ( item ) {
		drop = Drop_Item( ent, item, angle );
		angle += 45;
		// decide how many seconds it has left
		drop->count = ( ent->player->ps.powerups[ j ] - level.time ) / 1000;
		if ( drop->count < 1 ) {
			drop->count = 1;
		}
		ent->player->ps.powerups[ j ] = 0;
	}

#ifdef MISSIONPACK
	if ( g_gametype.integer == GT_HARVESTER ) {
		if ( ent->player->ps.tokens > 0 ) {
			if ( ent->player->sess.sessionTeam == TEAM_RED ) {
				item = BG_FindItem( "Blue Cube" );
			} else {
				item = BG_FindItem( "Red Cube" );
			}
			if ( item ) {
				for ( j = 0; j < ent->player->ps.tokens; j++ ) {
					drop = Drop_Item( ent, item, angle );
					if ( ent->player->sess.sessionTeam == TEAM_RED ) {
						drop->s.team = TEAM_BLUE;
					} else {
						drop->s.team = TEAM_RED;
					}
					angle += 45;
				}
			}
			ent->player->ps.tokens = 0;
		}
	}
#endif
}
Пример #4
0
/*
=================
TossPlayerItems

Toss the weapon and powerups for the killed player
=================
*/
void TossPlayerItems( gentity_t *self ) {
	gitem_t		*item;
	int			weapon;
	float		angle;
	int			i;
	gentity_t	*drop;

	// drop the weapon if not a gauntlet or machinegun
	weapon = self->s.weapon;

	// make a special check to see if they are changing to a new
	// weapon that isn't the mg or gauntlet.  Without this, a player
	// can pick up a weapon, be killed, and not drop the weapon because
	// their weapon change hasn't completed yet and they are still holding the MG.
	if ( weapon == WP_MACHINEGUN || weapon == WP_GRAPPLING_HOOK ) {
		if ( self->player->ps.weaponstate == WEAPON_DROPPING ) {
			BG_DecomposeUserCmdValue( self->player->pers.cmd.stateValue, &weapon );
		}
		if ( !( self->player->ps.stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) {
			weapon = WP_NONE;
		}
	}

	if ( weapon > WP_MACHINEGUN && weapon != WP_GRAPPLING_HOOK && 
		self->player->ps.ammo[ weapon ] ) {
		// find the item type for this weapon
		item = BG_FindItemForWeapon( weapon );

		// spawn the item
		Drop_Item( self, item, 0 );
	}

	// drop all the powerups if not in teamplay
	if ( g_gametype.integer != GT_TEAM ) {
		angle = 45;
		for ( i = 1 ; i < PW_NUM_POWERUPS ; i++ ) {
			if ( self->player->ps.powerups[ i ] > level.time ) {
				item = BG_FindItemForPowerup( i );
				if ( !item ) {
					continue;
				}
				drop = Drop_Item( self, item, angle );
				// decide how many seconds it has left
				drop->count = ( self->player->ps.powerups[ i ] - level.time ) / 1000;
				if ( drop->count < 1 ) {
					drop->count = 1;
				}
				angle += 45;
			}
		}
	}
}
Пример #5
0
Файл: timer.c Проект: qbism/tmg
//#define rndnum(y,z) ((random()*((z)-((y)+1)))+(y))
void RestartLevel()
{
	edict_t *player;
	int i;
	edict_t *dropped = NULL;
	techspawn = false;
	ResetItems();
	match_nextthink = level.time + 1;
	match_state = STATE_NEEDPLAYERS;
	match_state_end = 1;
	ResetCaps();
	hstime = level.time - 10;
	mapvoteactive = false;
	for_each_player(player, i)
	{
		player->client->resp.score = 0;
		player->client->resp.frags = 0;
		player->client->resp.spree = 0;
		player->client->resp.deaths = 0;
		player->client->pers.db_hud = true;
		if(player->client->pers.pl_state == 2)
			player->client->pers.pl_state = 3;
		player->client->resp.startframe = level.newframenum;
		if (ctf->value)
		{
			if ((!flag1_item || !flag2_item) && ctf->value)
				CTFInit();
			if (player->client->pers.inventory[ITEM_INDEX(flag1_item)])
			{
				dropped = Drop_Item(player, flag1_item);
				player->client->pers.inventory[ITEM_INDEX(flag1_item)] = 0;
				my_bprintf(PRINT_HIGH, "%s lost the %s flag!\n",
					player->client->pers.netname, CTFTeamName(CTF_TEAM1));
			}
			else if (player->client->pers.inventory[ITEM_INDEX(flag2_item)])
			{
				dropped = Drop_Item(player, flag2_item);
				player->client->pers.inventory[ITEM_INDEX(flag2_item)] = 0;
				my_bprintf(PRINT_HIGH, "%s lost the %s flag!\n",
					player->client->pers.netname, CTFTeamName(CTF_TEAM2));
			}
			if (dropped)
			{
				dropped->think = G_FreeEdict;
				dropped->timestamp = level.time;
				dropped->nextthink = level.time + 0.2;
			}
			//JSW - clear flag carrier var
			player->hasflag = 0;
		}
	}
Пример #6
0
void TossClientWeapon (edict_t *self)
{
	gitem_t		*item;
	edict_t		*drop;
	qboolean	quad;
	float		spread;

	if (!deathmatch->value)
		return;

	item = self->client->pers.weapon;
	if (! self->client->pers.inventory[self->client->ammo_index] )
		item = NULL;
	if (item && (strcmp (item->pickup_name, "Blaster") == 0))
		item = NULL;

#if defined(_DEBUG) && defined(_Z_TESTMODE)
	if (item && (strcmp (item->pickup_name, "Line Draw") == 0))
		item = NULL;
#endif

	if (!((int)(dmflags->value) & DF_QUAD_DROP))
		quad = false;
	else
		quad = (self->client->quad_framenum > (level.framenum + 10));

	if (item && quad)
		spread = 22.5;
	else
		spread = 0.0;

	if (item)
	{
		self->client->v_angle[YAW] -= spread;
		drop = Drop_Item (self, item);
		self->client->v_angle[YAW] += spread;
		drop->spawnflags = DROPPED_PLAYER_ITEM;
	}

	if (quad)
	{
		self->client->v_angle[YAW] += spread;
		drop = Drop_Item (self, FindItemByClassname ("item_quad"));
		self->client->v_angle[YAW] -= spread;
		drop->spawnflags |= DROPPED_PLAYER_ITEM;

		drop->touch = Touch_Item;
		drop->nextthink = level.time + (self->client->quad_framenum - level.framenum) * FRAMETIME;
		drop->think = G_FreeEdict;
	}
}
Пример #7
0
/*
================
monster_death_use

When a monster dies, it fires all of its targets with the current
enemy as activator.
================
*/
void monster_death_use (edict_t *self)
{
	edict_t	*player;
	int		i;

	self->flags &= ~(FL_FLY|FL_SWIM);
	self->monsterinfo.aiflags &= AI_GOOD_GUY;

	// Lazarus: If actor/monster is being used as a camera by a player,
	// turn camera off for that player
	for (i=0,player=g_edicts+1; i<maxclients->value; i++, player++) {
		if(player->client && player->client->spycam == self)
			camera_off(player);
	}

	if (self->item)
	{
		Drop_Item (self, self->item);
		self->item = NULL;
	}

	if (self->deathtarget)
		self->target = self->deathtarget;

	if (!self->target)
		return;

	G_UseTargets (self, self->enemy);
}
Пример #8
0
void Drop_Ammo (edict_t *ent, gitem_t *item)
{
	edict_t	*dropped;
	int		index;

	index = ITEM_INDEX(item);
	dropped = Drop_Item (ent, item);
	if (ent->client->pers.inventory[index] >= item->quantity)
		dropped->count = item->quantity;
	else
		dropped->count = ent->client->pers.inventory[index];

	//Wheaty: Only drop ONE grenade
/*	if (item->tag == AMMO_TYPE_GRENADES)
	{
		dropped->count = 1;
	} */

	//Wheaty: Clear inventory of any grenades (even though you only drop 1)
//	if (!item->tag == AMMO_TYPE_GRENADES)
		ent->client->pers.inventory[index] -= dropped->count;
//	else
//		ent->client->pers.inventory[index] = 0;

	ValidateSelectedItem (ent);
	WeighPlayer(ent);
}
Пример #9
0
/*
==============
RQ3_ResetItem

Added by Elder
Items respawn themselves after a period of time
Based on the AQ2 item code which was based off Q2 CTF techs
This can be called directly when a player dies in a CONTENTS_NODROP area
==============
*/
void RQ3_ResetItem(int itemTag)
{
	gitem_t *rq3_item;
	gentity_t *rq3_temp;
	float angle = rand() % 360;

// JBravo: no resetting items in TP or CTB
	if (g_gametype.integer == GT_TEAMPLAY || g_gametype.integer == GT_CTF)
		return;
	if (g_gametype.integer == GT_TEAM && !g_RQ3_tdmMode.integer)
		return;

	switch (itemTag) {
	case HI_KEVLAR:
	case HI_LASER:
	case HI_SILENCER:
	case HI_BANDOLIER:
	case HI_SLIPPERS:
	case HI_HELMET:
		//Free entity and reset position in unique item array
		//level.uniqueItemsUsed &= ~(1 << ent->item->giTag);
		rq3_item = BG_FindItemForHoldable(itemTag);
		rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint();
		Drop_Item(rq3_temp, rq3_item, angle);
		//G_Printf("RQ3_DroppedItemThink: Freeing item entity + respawning\n");
		break;
	default:
		//Elder: shouldn't have to come here
		G_Printf("RQ3_ResetItem: Out of range or invalid item %d\n", itemTag);
		break;
	}
}
Пример #10
0
void adminSpawnRune(edict_t *self, int type, int index)
{
	gitem_t *item;
	edict_t *rune;

	item = FindItem("Rune");		// get the item properties
	rune = Drop_Item(self, item);	// create the entity that holds those properties
	V_ItemClear(&rune->vrxitem);	// initialize the rune
	rune->vrxitem.quantity = 1;
	
	switch(type)
	{
	case ITEM_WEAPON:		spawnNorm(rune, index, ITEM_WEAPON); return;
	case ITEM_ABILITY:		spawnNorm(rune, index, ITEM_ABILITY); return;
	case ITEM_COMBO:		spawnCombo(rune, index); return;
	case ITEM_CLASSRUNE:	spawnClassRune(rune, index); return;
	//Try to spawn a unique (or a random one if it fails to find one at the index)
	case ITEM_UNIQUE:		if (!spawnUnique(rune, index)) spawnNorm(rune, index, 0); return;
	}

	//Randomize id
	strcpy(rune->vrxitem.id, GetRandomString(16));

	//Free the ent (if no rune was spawned)
	G_FreeEdict(rune);
}
Пример #11
0
void
Drop_Weapon(edict_t *ent, gitem_t *item)
{
	int index;

	if (!ent || !item)
	{
		return;
	}

	if ((int)(dmflags->value) & DF_WEAPONS_STAY)
	{
		return;
	}

	index = ITEM_INDEX(item);

	/* see if we're already using it */
	if (((item == ent->client->pers.weapon) ||
		 (item == ent->client->newweapon)) &&
		(ent->client->pers.inventory[index] == 1))
	{
		gi.cprintf(ent, PRINT_HIGH, "Can't drop current weapon\n");
		return;
	}

	Drop_Item(ent, item);
	ent->client->pers.inventory[index]--;
}
Пример #12
0
gentity_s* dropWeapon(int32_t client, int32_t weapon, int32_t camo)
{
	uint16_t tag = scr_const->tag_weapon_right;
	gentity_s* ent = Drop_Item(&g_entities[client], weapon, 20, tag, 0);
	ent->item[0].ammoCount = ent->item[0].clipAmmoCount = 999;
	ent->s.renderOptions = camo;
	Scr_AddEntity(SCRIPTINSTANCE_SERVER, ent);
	return ent;
}
Пример #13
0
void Drop_General (edict_t *ent, gitem_t *item)
{
	if (!item)
		return; // out of ammo, switched before frame?

	Drop_Item (ent, item);
	ent->client->pers.inventory[ITEM_INDEX(item)]--;
	ValidateSelectedItem (ent);
	WeighPlayer(ent);
}
Пример #14
0
static edict_t *Drop_General( edict_t *ent, const gsitem_t *item )
{
	edict_t *dropped = Drop_Item( ent, item );
	if( dropped )
	{
		if( ent->r.client && ent->r.client->ps.inventory[item->tag] > 0 )
			ent->r.client->ps.inventory[item->tag]--;
	}
	return dropped;
}
Пример #15
0
/*
=================
TossClientItems

Toss the weapon and powerups for the killed player
=================
*/
void TossClientItems( gentity_t *self ) {
	gitem_t		*item;

	if ( IsBot( self ) )
		return;	//bots don't drop items in single player

	//the player drops a backpack in single player
	item = BG_FindItemForBackpack(); 
	Drop_Item( self, item, 0 );

}
Пример #16
0
void Drop_Spec(edict_t *ent, gitem_t *item)
{
        edict_t *spec;

        spec = Drop_Item(ent, item);
        //gi.cprintf(ent, PRINT_HIGH, "Dropping special item.\n");
        spec->nextthink = level.time + 1;
        spec->think = MakeTouchSpecThink;
                //zucc this and the one below should probably be -- not = 0, if
                // a server turns on multiple item pickup.
        ent->client->pers.inventory[ITEM_INDEX(item)]--;
}
void Container::DropItem(const short lat, const short lon)
{
	if (_state == 's')
	{
		_state = 'g';
		_myLatitude = lat;
		_myLongitude= lon;
		printf(Drop_Item(BAG));
	}
	else
		printf(NO_BAG);
}
Пример #18
0
void G_Gametype_GENERIC_PlayerKilled( edict_t *targ, edict_t *attacker, edict_t *inflictor )
{
	if( !attacker || GS_MatchState() != MATCH_STATE_PLAYTIME || ( targ->r.svflags & SVF_CORPSE ) )
		return;

	if( !attacker->r.client || attacker == targ || attacker == world )
		teamlist[targ->s.team].stats.score--;
	else
	{
		if( GS_InvidualGameType() )
			teamlist[attacker->s.team].stats.score = attacker->r.client->level.stats.score;
		if( GS_IsTeamDamage( &targ->s, &attacker->s ) )
			teamlist[attacker->s.team].stats.score--;
		else
			teamlist[attacker->s.team].stats.score++;
	}

	// drop items
	if( targ->r.client && !( G_PointContents( targ->s.origin ) & CONTENTS_NODROP ) )
	{
		// drop the weapon
		if ( targ->r.client->ps.stats[STAT_WEAPON] > WEAP_GUNBLADE )
		{
			gsitem_t *weaponItem = GS_FindItemByTag( targ->r.client->ps.stats[STAT_WEAPON] );
			if( weaponItem )
			{
				edict_t *drop = Drop_Item( targ, weaponItem );
				if( drop )
				{
					drop->count = targ->r.client->ps.inventory[ weaponItem->weakammo_tag ];
					targ->r.client->ps.inventory[ weaponItem->weakammo_tag ] = 0;
				}
			}
		}

		// drop ammo pack (won't drop anything if player doesn't have any strong ammo)
		Drop_Item( targ, GS_FindItemByTag( AMMO_PACK ) );
	}
}
Пример #19
0
void Drop_Briefcase (edict_t *ent, gitem_t *item)
{
	if (!item)
		return; // out of ammo, switched before frame?

	Drop_Item (ent, item);
	ent->client->pers.inventory[ITEM_INDEX(item)]--;
	ValidateSelectedItem (ent);
	
	ent->s.modelindex3 = 0;
	gi.cprintf(ent, PRINT_HIGH, "You dropped the briefcase!\n");

	ent->client->has_briefcase = false;//used to display icon in hud
}
Пример #20
0
edict_t *DropRandomAmmo (edict_t *self)
{
	gitem_t *item;

	switch (GetRandom(1, 6))
	{
	case 1: item = FindItemByClassname("ammo_shells"); break;
	case 2: item = FindItemByClassname("ammo_bullets"); break;
	case 3: item = FindItemByClassname("ammo_grenades"); break;
	case 4: item = FindItemByClassname("ammo_rockets"); break;
	case 5: item = FindItemByClassname("ammo_cells"); break;
	case 6: item = FindItemByClassname("ammo_slugs"); break;
	}
	return Drop_Item(self, item);
}
Пример #21
0
/*
================
monster_death_use
 
When a monster dies, it fires all of its targets with the current
enemy as activator.
================
*/
void monster_death_use(edict_t *self){
	self->flags &= ~(FL_FLY | FL_SWIM);
	self->monsterinfo.aiflags &= AI_GOOD_GUY;
	
	if(self->item){
		Drop_Item(self, self->item);
		self->item = NULL;
	}
	
	if(self->deathtarget)
		self->target = self->deathtarget;
		
	if(!self->target)
		return;
		
	G_UseTargets(self, self->enemy);
}
Пример #22
0
static void Drop_Ammo( edict_t *ent, gsitem_t *item )
{
	edict_t	*dropped;
	int index;

	index = item->tag;
	dropped = Drop_Item( ent, item );
	if( dropped )
	{
		if( ent->r.client->ps.inventory[index] >= item->quantity )
			dropped->count = item->quantity;
		else
			dropped->count = ent->r.client->ps.inventory[index];

		ent->r.client->ps.inventory[index] -= dropped->count;
	}
}
Пример #23
0
/*
=================
TossClientItems

Toss the weapon and powerups for the killed player
=================
*/
void TossClientItems( gentity_t *self ) {
	gitem_t     *item;
	int weapon;
	gentity_t   *drop = 0;

	// drop the weapon if not a gauntlet or machinegun
	weapon = self->s.weapon;

	// make a special check to see if they are changing to a new
	// weapon that isn't the mg or gauntlet.  Without this, a client
	// can pick up a weapon, be killed, and not drop the weapon because
	// their weapon change hasn't completed yet and they are still holding the MG.

	// (SA) always drop what you were switching to
	if ( 1 ) {
		if ( self->client->ps.weaponstate == WEAPON_DROPPING ) {
			weapon = self->client->pers.cmd.weapon;
		}
		if ( !( COM_BitCheck( self->client->ps.weapons, weapon ) ) ) {
			weapon = WP_NONE;
		}
	}

	// JPW NERVE don't drop these weapon types
	if ( ( weapon == WP_FLAMETHROWER ) || ( weapon == WP_GARAND ) || ( weapon == WP_MAUSER ) || ( weapon == WP_VENOM ) ) {
		weapon = WP_NONE;
	}
	// jpw

	if ( weapon > WP_NONE && weapon < WP_MONSTER_ATTACK1 && self->client->ps.ammo[ BG_FindAmmoForWeapon( weapon_t (weapon) )] ) {
		// find the item type for this weapon
		item = BG_FindItemForWeapon( weapon_t (weapon) );
		// spawn the item

		// Rafael
		if ( !( self->client->ps.persistant[PERS_HWEAPON_USE] ) ) {
			drop = Drop_Item( self, item, 0, qfalse );
			// JPW NERVE -- fix ammo counts
			drop->count = self->client->ps.ammoclip[BG_FindClipForWeapon( weapon_t (weapon) )];
			drop->item->quantity = self->client->ps.ammoclip[BG_FindClipForWeapon( weapon_t (weapon) )];
			// jpw
		}
	}
}
Пример #24
0
void DeadDropSpec(edict_t * ent)
{
	gitem_t *spec;
	edict_t *dropped;
	int i;

	for(i = 0; i<ITEM_COUNT; i++)
	{
		if (INV_AMMO(ent, tnums[i]) > 0) {
			spec = GET_ITEM(tnums[i]);
			dropped = Drop_Item(ent, spec);
			// hack the velocity to make it bounce random
			dropped->velocity[0] = (rand() % 600) - 300;
			dropped->velocity[1] = (rand() % 600) - 300;
			dropped->nextthink = level.time + 1;
			dropped->think = MakeTouchSpecThink;
			dropped->owner = NULL;
			dropped->spawnflags = DROPPED_PLAYER_ITEM;
			ent->client->pers.inventory[ITEM_INDEX(spec)] = 0;
		}
	}
}
Пример #25
0
void DeadDropSpec(edict_t *ent)
{
        gitem_t *spec;
        edict_t *dropped;
        int i;

        i = 0;
        while (tnames[i]) {
                if ((spec = FindItemByClassname(tnames[i])) != NULL &&
                        ent->client->pers.inventory[ITEM_INDEX(spec)]) {
                        dropped = Drop_Item(ent, spec);
                        // hack the velocity to make it bounce random
                        dropped->velocity[0] = (rand() % 600) - 300;
                        dropped->velocity[1] = (rand() % 600) - 300;
                        dropped->nextthink = level.time + 1;
                        dropped->think = MakeTouchSpecThink;
                        dropped->owner = NULL;
                        ent->client->pers.inventory[ITEM_INDEX(spec)] = 0;
                }
                i++;
        }
}
Пример #26
0
//==========================================
// M_default_die
//==========================================
void M_default_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
	//if(AIDevel.debugMode && bot_debugmonster->value)
	Com_Printf("AI_monster: Die\n");


	//throw gibs
	//G_Sound (self, CHAN_BODY, trap_SoundIndex ("sound/misc/udeath.wav"), 1, ATTN_NORM);
	//ThrowSmallPileOfGibs ( self, 8, damage );
	ThrowHead (self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC);
	self->deadflag = DEAD_DEAD;
	
	if (self->item)
	{
		Drop_Item (self, self->item);
		self->item = NULL;
	}

	AI_EnemyRemoved( self );

	//explode
	barrel_delay (self, inflictor, attacker, damage, point);
}
Пример #27
0
void DeadDropSpec(edict_t * ent)
{
	gitem_t *spec;
	edict_t *dropped;
	int i, itemNum;

	for(i = 0; i<ITEM_COUNT; i++)
	{
		itemNum = ITEM_FIRST + i;
		if (INV_AMMO(ent, itemNum) > 0) {
			spec = GET_ITEM(itemNum);
			dropped = Drop_Item(ent, spec);
			// hack the velocity to make it bounce random
			dropped->velocity[0] = (rand() % 600) - 300;
			dropped->velocity[1] = (rand() % 600) - 300;
			dropped->nextthink = level.framenum + 1 * HZ;
			dropped->think = MakeTouchSpecThink;
			dropped->owner = NULL;
			dropped->spawnflags = DROPPED_PLAYER_ITEM;
			ent->client->inventory[ITEM_INDEX(spec)] = 0;
		}
	}
}
Пример #28
0
/*
================
Drop_Weapon
================
*/
void Drop_Weapon (edict_t *ent, gitem_t *item)
{
	int		index;

  // Make sure ent exists!
  if (!G_EntExists(ent)) return;


	if (dmflag & DF_WEAPONS_STAY)
		return;

	index = ITEM_INDEX(item);
	// see if we're already using it
	if ( ((item == ent->client->pers.weapon) || (item == ent->client->newweapon))&& (ent->client->pers.inventory[index] == 1) )
	{
		if (!ent->bot_client)
			safe_cprintf (ent, PRINT_HIGH, "Can't drop current weapon\n");
		return;
	}

	Drop_Item (ent, item);
	ent->client->pers.inventory[index]--;
}
Пример #29
0
/*
* Drop_Weapon
*/
void Drop_Weapon( edict_t *ent, const gsitem_t *item )
{
	int otherweapon;
	edict_t *drop;
	int ammodrop = 0;

	if( item->tag < 1 || item->tag >= WEAP_TOTAL )
	{
		G_PrintMsg( ent, "Can't drop unknown weapon\n" );
		return;
	}

	// find out the amount of ammo to drop
	if( ent->r.client->ps.inventory[item->tag] > 1 && ent->r.client->ps.inventory[item->ammo_tag] > 5 )
	{
		ammodrop = ent->r.client->ps.inventory[item->ammo_tag] / 2;
	}
	else // drop all
	{
		ammodrop = ent->r.client->ps.inventory[item->ammo_tag];
	}

	drop = Drop_Item( ent, item );
	if( drop )
	{
		ent->r.client->ps.inventory[item->ammo_tag] -= ammodrop;
		drop->count = ammodrop;
		drop->spawnflags |= DROPPED_PLAYER_ITEM;
		ent->r.client->ps.inventory[item->tag]--;

		if( !ent->r.client->ps.inventory[item->tag] )
		{
			otherweapon = GS_SelectBestWeapon( &ent->r.client->ps );
			Use_Weapon( ent, GS_FindItemByTag( otherweapon ) );
		}
	}
}
Пример #30
0
void dom_dropflag (edict_t *ent, gitem_t *item)
{
	edict_t *flag;

	//if (!G_EntExists(ent))
	//	return;
	if (!ent || !ent->inuse || G_IsSpectator(ent))
		return;
	if (!domination->value || !ent->client->pers.inventory[flag_index])
		return;
	gi.bprintf(PRINT_HIGH, "%s dropped the flag.\n", ent->client->pers.netname);
	flag = Drop_Item (ent, item);
	flag->think = dom_flagthink;
	flag->count = 0;
	//Wait a second before starting to think
	flag->nextthink = level.time + 1.0;
	ent->client->pers.inventory[ITEM_INDEX(item)] = 0;
	ValidateSelectedItem (ent);
	DEFENSE_TEAM = 0;
	//FLAG_FRAMES = 0;

	if (SpawnWaitingPlayers())
		OrganizeTeams(true);
}