Exemplo n.º 1
0
Arquivo: p_weapon.c Projeto: qbism/tmg
/*
===============
ChangeWeapon

The old weapon has been dropped all the way, so make the new one
current
===============
*/
void ChangeWeapon (edict_t *ent)
{
  // Make sure ent exists!
  if (!G_EntExists(ent)) return;

 
	if (ent->client->grenade_time)
	{
		ent->client->grenade_time = level.time;
		ent->client->weapon_sound = 0;
		weapon_grenade_fire (ent, false);
		ent->client->grenade_time = 0;
	}

	ent->client->pers.lastweapon = ent->client->pers.weapon;
	ent->client->pers.weapon = ent->client->newweapon;
	ent->client->newweapon = NULL;
	ent->client->machinegun_shots = 0;

	if (ent->client->pers.weapon && ent->client->pers.weapon->ammo)
		ent->client->ammo_index = ITEM_INDEX(FindItem(ent->client->pers.weapon->ammo));
	else
		ent->client->ammo_index = 0;

	if (!ent->client->pers.weapon)
	{	// dead
		ent->client->ps.gunindex = 0;
		return;
	}

	ent->client->weaponstate = WEAPON_ACTIVATING;
	ent->client->ps.gunframe = 0;
	ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);

	// ### Hentai ### BEGIN	
	ShowGun(ent);		
	// ### Hentai ### END
}
Exemplo n.º 2
0
qboolean dom_pickupflag (edict_t *ent, edict_t *other)
{
	int		i;
	edict_t *cl_ent;

	//if (!G_EntExists(other))
	//	return false;
	if (!other || !other->inuse || !other->client || G_IsSpectator(other))
		return false;

	//if ((other->myskills.class_num == CLASS_POLTERGEIST) || other->mtype)
	//	return false; // poltergeist and morphed players can't pick up flag

	// unmorph morphed players
	if (other->mtype)
	{
		other->mtype = 0;
		other->s.modelindex = 255;
		other->s.skinnum = ent-g_edicts-1;
		ShowGun(other);
	}
	
	// if this is a player-monster, remove the monster and restore the player
	if (PM_PlayerHasMonster(other))
		PM_RemoveMonster(other);

	// disable movement abilities
	if (other->client)
	{
		//jetpack
		other->client->thrusting = 0;
		//grapple hook
		other->client->hook_state = HOOK_READY;
	}
	// super speed
	other->superspeed = false;
	// antigrav
	other->antigrav = false;

	VortexRemovePlayerSummonables(other);

	// disable scanner
	if (other->client->pers.scanner_active & 1)
		other->client->pers.scanner_active = 0;

	// reset their velocity
	VectorClear(other->velocity);

	// alert everyone
	gi.bprintf(PRINT_HIGH, "%s got the flag!\n", other->client->pers.netname);
	gi.bprintf(PRINT_HIGH, "The %s team is now in control.\n", TeamName(other));

	// alert teammates
	for (i=0 ; i<game.maxclients ; i++) {
		cl_ent = g_edicts+1+i;
		if (G_EntExists(cl_ent) && (cl_ent->teamnum == other->teamnum) && (cl_ent != other))
			gi.centerprintf(cl_ent, "Protect the flag carrier!\n");
	}

	DEFENSE_TEAM = other->teamnum;

	// if a new team takes control of the flag, then reset the counter
	if (PREV_DEFENSE_TEAM != DEFENSE_TEAM)
		FLAG_FRAMES = 0;

	PREV_DEFENSE_TEAM = DEFENSE_TEAM;

	gi.sound(other, CHAN_ITEM, gi.soundindex("world/xianbeats.wav"), 1, ATTN_NORM, 0);
	other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
	return true;
}