Beispiel #1
0
void PlagueCloudSpawn (edict_t *ent)
{
	float	radius;
	edict_t *e=NULL;

	if (ent->myskills.abilities[PLAGUE].disable)
		return;

	if (!V_CanUseAbilities(ent, PLAGUE, 0, false))
		return;

	if ((ent->myskills.class_num == CLASS_POLTERGEIST) && !ent->mtype && !PM_PlayerHasMonster(ent))
		return; // can't use this in human form

	radius = PLAGUE_DEFAULT_RADIUS+PLAGUE_ADDON_RADIUS*ent->myskills.abilities[PLAGUE].current_level;

	if (radius > PLAGUE_MAX_RADIUS)
		radius = PLAGUE_MAX_RADIUS;

	// find someone nearby to infect
	while ((e = findradius(e, ent->s.origin, radius)) != NULL)
	{
		if (!G_ValidTarget(ent, e, true))
			continue;
	//	if (HasActiveCurse(e, CURSE_PLAGUE))
		if (que_typeexists(e->curses, CURSE_PLAGUE))
			continue;
		// holy water grants temporary immunity to curses
		if (e->holywaterProtection > level.time)
			continue;

		PlagueCloud(ent, e);
	}
}
Beispiel #2
0
edict_t *NextNearestTotem(edict_t *ent, int totemType, edict_t *lastTotem, qboolean allied)
{
	edict_t *ed, *owner, *closestEnt = NULL;
	float closestDistance = -1.0;
	float lastTotemDistance = 0.0;

	if (lastTotem)		lastTotemDistance = V_EntDistance(ent, lastTotem);

	for (ed = g_edicts ; ed < &g_edicts[globals.num_edicts]; ed++)
	{
		float thisDistance;

		//skip all ents that are not totems, and skip the last "closest" totem.
		if(ed->mtype != totemType || ed == lastTotem)
			continue;
		
		// air totems can be configured to protect only their owner
		if (PM_PlayerHasMonster(ed->activator))
			owner = ed->activator->owner;
		else
			owner = ed->activator;
		if (ed->mtype == TOTEM_AIR && ed->style && ent != owner)
			continue;

		//skip any totems that are "not on my team" or are "not my enemy"
		if(allied && !OnSameTeam(ent, ed))
			continue;
		else if(!allied && OnSameTeam(ent, ed))
			continue;

		thisDistance = V_EntDistance(ent, ed);

        //Totem must be in range and must be in "line of sight".
		//Using visible1() so forcewall, etc.. can block it.
		if(thisDistance > TOTEM_MAX_RANGE || !visible1(ed, ent))
			continue;

		//The closest totem found must be farther away than the last one found.
		if(lastTotem != NULL && thisDistance < lastTotemDistance)
			continue;

		//This is a valid totem, but is it the closest one?		
		if(thisDistance < closestDistance || closestDistance == -1.0)
		{
			closestDistance = thisDistance;
			closestEnt = ed;
		}
	}

	//This should be the next closest totem to the target, and should be null if there isn't one.
	return closestEnt;
}
Beispiel #3
0
void allymarker_think (edict_t *self)
{
	vec3_t start, right;

	// must have an owner
	if (!self->owner || !self->owner->inuse || !self->owner->teamnum)
	{
		G_FreeEdict(self);
		return;
	}

	// beam diameter goes to 0 if we're dead or cloaked (to hide it)
	if ((self->owner->health < 1) || (self->owner->client->cloaking 
		&& self->owner->svflags & SVF_NOCLIENT) || (self->owner->flags & FL_WORMHOLE))
		self->s.frame = 0;
	else 
		self->s.frame = 4;

	self->s.skinnum = GetTeamColor(self->owner->teamnum);

	self->s.angles[YAW]+=18;
	AngleCheck(&self->s.angles[YAW]);
	AngleVectors(self->s.angles, NULL, right, NULL);

	if (PM_PlayerHasMonster(self->owner))
	{
		VectorCopy(self->owner->owner->s.origin, start);
		start[2] = self->owner->owner->absmax[2]+16;
	}
	else
	{
		VectorCopy(self->owner->s.origin, start);
		start[2] = self->owner->absmax[2]+16;
	}
	
	VectorMA(start, 12, right, self->s.origin);
	VectorMA(start, -12, right, self->s.old_origin);
	gi.linkentity(self);

	self->nextthink = level.time + FRAMETIME;
}
Beispiel #4
0
void Cmd_PlayerToMedic_f (edict_t *ent)
{
	vec3_t	boxmin, boxmax;
	trace_t	tr;
	int cost = MEDIC_INIT_COST;
	//Talent: More Ammo
	int talentLevel = getTalentLevel(ent, TALENT_MORE_AMMO);

	if (debuginfo->value)
		gi.dprintf("DEBUG: %s just called Cmd_PlayerToMedic_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(getTalentSlot(ent, TALENT_MORPHING) != -1)
		cost *= 1.0 - 0.25 * getTalentLevel(ent, TALENT_MORPHING);

//	if (!G_CanUseAbilities(ent, ent->myskills.abilities[MEDIC].current_level, cost))
//		return;

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

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

	// make sure don't get stuck in a wall
	VectorSet (boxmin, -24, -24, -24);
	VectorSet (boxmax, 24, 24, 32);
	tr = gi.trace(ent->s.origin, boxmin, boxmax, ent->s.origin, ent, MASK_SHOT);
	if (tr.fraction<1)
	{
		safe_cprintf(ent, PRINT_HIGH, "Not enough room to morph!\n");
		return;
	}
	
	V_ModifyMorphedHealth(ent, MORPH_MEDIC, true);

	VectorCopy(boxmin, ent->mins);
	VectorCopy(boxmax, ent->maxs);

	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 + MEDIC_DELAY;

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

	if (!ent->myskills.administrator)
		ent->s.skinnum = 0;
	else
		ent->s.skinnum = 2; // commander

	// set maximum hyperblaster ammo
	ent->myskills.abilities[MEDIC].max_ammo = MEDIC_HB_INITIAL_AMMO+MEDIC_HB_ADDON_AMMO
		*ent->myskills.abilities[MEDIC].current_level;

	// Talent: More Ammo
	// increases ammo 10% per talent level
	if(talentLevel > 0) ent->myskills.abilities[MEDIC].max_ammo *= 1.0 + 0.1*talentLevel;

	// give them some starting ammo
	ent->myskills.abilities[MEDIC].ammo = MEDIC_HB_START_AMMO;

	ent->client->refire_frames = 0; // reset charged weapon
	ent->client->weapon_mode = 0; // reset weapon mode
	lasersight_off(ent);

	gi.sound (ent, CHAN_WEAPON, gi.soundindex("spells/morph.wav") , 1, ATTN_NORM, 0);
}
void Cmd_PlayerToParasite_f (edict_t *ent)
{
	int para_cubecost = PARASITE_INIT_COST;

	if (debuginfo->value)
		gi.dprintf("DEBUG: %s just called Cmd_PlayerToParasite_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))
		{
			gi.cprintf(ent, PRINT_HIGH, "You can't morph while cursed!\n");
			return;
		}

		V_RestoreMorphed(ent, 0);
		return;
	}

	//Talent: Morphing
	if(getTalentSlot(ent, TALENT_MORPHING) != -1)
		para_cubecost *= 1.0 - 0.25 * getTalentLevel(ent, TALENT_MORPHING);

//	if (!G_CanUseAbilities(ent, ent->myskills.abilities[BLOOD_SUCKER].current_level, para_cubecost))
	//	return;
	if (!V_CanUseAbilities(ent, BLOOD_SUCKER, para_cubecost, true))
		return;

	if (HasFlag(ent))
	{
		gi.cprintf(ent, PRINT_HIGH, "Can't morph while carrying flag!\n");
		return;
	}

	V_ModifyMorphedHealth(ent, M_MYPARASITE, true);

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

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

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

	// decloak
	ent->svflags &= ~SVF_NOCLIENT;
	ent->client->cloaking = false;
	ent->client->cloakable = 0;

	ent->maxs[2] = 8;
	ent->viewheight = 0;

	ent->client->refire_frames = 0; // reset charged weapon
	ent->client->weapon_mode = 0; // reset weapon mode
	lasersight_off(ent);

	gi.sound (ent, CHAN_WEAPON, gi.soundindex("spells/morph.wav") , 1, ATTN_NORM, 0);
}
Beispiel #6
0
void plague_think (edict_t *self)
{
	int		dmg;
	float	radius;
	edict_t *e=NULL;
	
	// plague self-terminates if:
	if (!G_EntIsAlive(self->owner) || !G_EntIsAlive(self->enemy)	//someone dies
		|| (self->owner->flags & FL_WORMHOLE)						// owner enters a wormhole
		|| (self->owner->client->tball_delay > level.time)			//owner tballs away
		|| (self->owner->flags & FL_CHATPROTECT)					//3.0 owner is in chatprotect
		|| ((self->owner->myskills.class_num == CLASS_POLTERGEIST) && (!self->owner->mtype) && !PM_PlayerHasMonster(self->owner))  //3.0 poltergeist is in human form
		|| que_findtype(self->enemy->curses, NULL, HEALING) != NULL)	//3.0 player is blessed with healing
	{
		que_removeent(self->enemy->curses, self, true);
		return;
	}

	VectorCopy(self->enemy->s.origin, self->s.origin); // follow enemy

	radius = PLAGUE_DEFAULT_RADIUS+PLAGUE_ADDON_RADIUS*self->owner->myskills.abilities[PLAGUE].current_level;

	if (radius > PLAGUE_MAX_RADIUS)
		radius = PLAGUE_MAX_RADIUS;

	// find someone nearby to infect
	while ((e = findradius(e, self->s.origin, radius)) != NULL)
	{
		if (e == self->enemy)
			continue;
		if (!G_ValidTarget(self, e, true))
			continue;
		// don't allow more than one curse of the same type
		if (que_typeexists(e->curses, CURSE_PLAGUE))
			continue;
		// holy water grants temporary immunity to curses
		if (e->holywaterProtection > level.time)
			continue;
		// spawn another plague cloud on this entity
		PlagueCloud(self->owner, e);
	}

	if (level.time > self->wait)
	{
		dmg = (float)self->owner->myskills.abilities[PLAGUE].current_level/10 * ((float)self->enemy->max_health/20);
		if (!self->enemy->client && strcmp(self->enemy->classname, "player_tank") != 0)
			dmg *= 2; // non-clients take double damage (helps with pvm)
		if (dmg < 1)
			dmg = 1;
		if (dmg > 100)
			dmg = 100;
		T_Damage(self->enemy, self->enemy, self->owner, vec3_origin, self->enemy->s.origin, vec3_origin, 
			dmg, 0, DAMAGE_NO_ABILITIES, MOD_PLAGUE); // hurt 'em
		self->wait = level.time + PLAGUE_DELAY;
	}
	
	self->nextthink = level.time + FRAMETIME;

}
Beispiel #7
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;
}
Beispiel #8
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);
}
Beispiel #9
0
void G_SetStats (edict_t *ent)
{
	gitem_t		*item;
//	int			num;
	int			index, cells;
	int			power_armor_type = 0;

//	int			time_left;//K03

	//
	// health
	//


	ent->client->ps.stats[STAT_HEALTH_ICON] = level.pic_health;

	if (ent->health <= 32767)
		ent->client->ps.stats[STAT_HEALTH] = ent->health;
	else
		ent->client->ps.stats[STAT_HEALTH] = 666;

//GHz START
	// 3.5 show percent ability is charged
	if (ent->client->charge_index)
		ent->client->ps.stats[STAT_CHARGE_LEVEL] = ent->myskills.abilities[ent->client->charge_index-1].charge;
	else
		ent->client->ps.stats[STAT_CHARGE_LEVEL] = 0;

	if (G_EntExists(ent->supplystation) /*&& (ent->supplystation->wait >= level.time)*/)
	{
		ent->client->ps.stats[STAT_STATION_ICON] = gi.imageindex("i_tele");
		//if (ent->supplystation->wait < 100)
			ent->client->ps.stats[STAT_STATION_TIME] = (int)ent->supplystation->wait;//-level.time;
		//else
		//	ent->client->ps.stats[STAT_STATION_TIME] = 0;
	}
	else
	{
		ent->client->ps.stats[STAT_STATION_ICON] = 0;
		ent->client->ps.stats[STAT_STATION_TIME] = 0;
	}

	if (ptr->value || domination->value)
	{
		//if (G_EntExists(ent))
		if (ent->inuse && ent->teamnum)
		{
			index = 0;
			if (ent->teamnum == 1)
			{
				if (DEFENSE_TEAM == ent->teamnum)
					index =  gi.imageindex("i_ctf1"); // show team color pic
				else
					index = gi.imageindex("i_ctf1d"); // not in control
			}
			else if (ent->teamnum == 2)
			{
				if (DEFENSE_TEAM == ent->teamnum)
					index = gi.imageindex("i_ctf2");
				else
					index = gi.imageindex("i_ctf2d");
			}
			ent->client->ps.stats[STAT_TEAM_ICON] = index;
		}
		else
		{
			ent->client->ps.stats[STAT_TEAM_ICON] = 0;
		}

	}

	if (ctf->value)
	{
		if (ent->inuse && ent->teamnum)
		{
			edict_t *base;
			index = 0;

			if ((base = CTF_GetFlagBaseEnt(ent->teamnum)) != NULL)
			{
				if (ent->teamnum == RED_TEAM)
				{
					if (base->count == BASE_FLAG_SECURE)
						index =  gi.imageindex("i_ctf1"); // show team color pic
					else
					{
						if (level.framenum&8)
							index = gi.imageindex("i_ctf1d"); // flag taken
						else
							index = gi.imageindex("i_ctf1");
					}
				}
				else if (ent->teamnum == BLUE_TEAM)
				{
					if (base->count == BASE_FLAG_SECURE)
						index = gi.imageindex("i_ctf2");
					else
					{
						if (level.framenum&8)
							index = gi.imageindex("i_ctf2d");
						else
							index = gi.imageindex("i_ctf2");
					}
				}
			}
			ent->client->ps.stats[STAT_TEAM_ICON] = index;
		}
		else
		{
			ent->client->ps.stats[STAT_TEAM_ICON] = 0;
		}
	}
//GHz END

	// player boss
	if (G_EntExists(ent->owner))
		ent->client->ps.stats[STAT_HEALTH] = ent->owner->health;

	//
	// ammo
	//
	if (!ent->client->ammo_index /* || !ent->client->pers.inventory[ent->client->ammo_index] */)
	{
		ent->client->ps.stats[STAT_AMMO_ICON] = 0;
		ent->client->ps.stats[STAT_AMMO] = 0;
	}
	else
	{
		item = &itemlist[ent->client->ammo_index];
		ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex (item->icon);
		ent->client->ps.stats[STAT_AMMO] = ent->client->pers.inventory[ent->client->ammo_index];
	}
//GHz START
	// blaster weapon ammo
	if (ent->client->pers.weapon == Fdi_BLASTER)
	{
		ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex("a_cells");
		ent->client->ps.stats[STAT_AMMO] = ent->monsterinfo.lefty;
	}
//GHz END

	//
	// armor
	//

	power_armor_type = PowerArmorType (ent);

	if (power_armor_type)
	{
		cells = ent->client->pers.inventory[ITEM_INDEX(Fdi_CELLS)];

		if (cells == 0)
		{	// ran out of cells for power armor
			ent->flags &= ~FL_POWER_ARMOR;
			gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
			power_armor_type = 0;
		}
	}

	index = ArmorIndex (ent);
	if (power_armor_type && (!index || ent->mtype || (level.framenum & 8) ) )//4.2 morphed players only have powered armor
	{	// flash between power armor and other armor icon
		ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex ("i_powershield");
		ent->client->ps.stats[STAT_ARMOR] = cells;
	}
	else if (index && !ent->mtype)
	{
		item = GetItemByIndex (index);
		ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex (item->icon);
		ent->client->ps.stats[STAT_ARMOR] = ent->client->pers.inventory[index];
	}
	else
	{
		ent->client->ps.stats[STAT_ARMOR_ICON] = 0;
		ent->client->ps.stats[STAT_ARMOR] = 0;
	}

	// morphed players
	if (ent->mtype)
	{
		if ((ent->mtype == MORPH_MEDIC) && (ent->client->weapon_mode == 0 || ent->client->weapon_mode == 2))
		{
			ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex("a_cells");
			ent->client->ps.stats[STAT_AMMO] = ent->myskills.abilities[MEDIC].ammo;
		}
		else if (ent->mtype == MORPH_FLYER)
		{
			ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex("a_cells");
			ent->client->ps.stats[STAT_AMMO] = ent->myskills.abilities[FLYER].ammo;
		}
		else if (ent->mtype == MORPH_CACODEMON)
		{
			ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex("a_rockets");
			ent->client->ps.stats[STAT_AMMO] = ent->myskills.abilities[CACODEMON].ammo;
		}
		else
		{
			ent->client->ps.stats[STAT_AMMO_ICON] = 0;
			ent->client->ps.stats[STAT_AMMO] = 0;
		}

	}
	
	// player-monsters
	if (PM_PlayerHasMonster(ent))
	{
		if (ent->owner->mtype == P_TANK)
		{
			if (ent->client->weapon_mode == 0)
			{
				ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex("a_rockets");
				ent->client->ps.stats[STAT_AMMO] = ent->owner->monsterinfo.jumpup;
			}
			else if (ent->client->weapon_mode == 2)
			{
				ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex("a_bullets");
				ent->client->ps.stats[STAT_AMMO] = ent->owner->monsterinfo.lefty;
			}
			else if (ent->client->weapon_mode == 3)
			{
				ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex("a_cells");
				ent->client->ps.stats[STAT_AMMO] = ent->owner->monsterinfo.radius;
			}
			else
			{
				ent->client->ps.stats[STAT_AMMO_ICON] = 0;
				ent->client->ps.stats[STAT_AMMO] = 0;
			}
			
			if (power_armor_type)
			{
				ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex ("i_powershield");
				ent->client->ps.stats[STAT_ARMOR] = cells;
			}
			else
			{
				ent->client->ps.stats[STAT_ARMOR_ICON] = 0;
				ent->client->ps.stats[STAT_ARMOR] = 0;
			}
			
		}
		else
		{
			ent->client->ps.stats[STAT_AMMO_ICON] = 0;
			ent->client->ps.stats[STAT_AMMO] = 0;
		}
	}

	//
	// pickup message
	//
	if (level.time > ent->client->pickup_msg_time)
	{
		ent->client->ps.stats[STAT_PICKUP_ICON] = 0;
		ent->client->ps.stats[STAT_PICKUP_STRING] = 0;
	}

	//
	// timers
	//
	if (ent->client->quad_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_quad");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->quad_framenum - level.framenum)/10;
	}
	// RAFAEL
	else if (ent->client->quadfire_framenum > level.framenum)
	{
		// note to self
		// need to change imageindex
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_quadfire");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->quadfire_framenum - level.framenum)/10;
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_invulnerability");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->invincible_framenum - level.framenum)/10;
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_envirosuit");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->enviro_framenum - level.framenum)/10;
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_rebreather");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->breather_framenum - level.framenum)/10;
	}
	//K03 Begin
	else if (ent->client->thrusting == 1 ||
		ent->client->cloakable ||
		ent->client->hook_state)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("k_powercube");
		ent->client->ps.stats[STAT_TIMER] = ent->client->pers.inventory[power_cube_index];
	}
	//K03 End
	else
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = 0;
		ent->client->ps.stats[STAT_TIMER] = 0;
	}

	//
	// selected item
	//
	if (ent->client->pers.selected_item == -1)
		ent->client->ps.stats[STAT_SELECTED_ICON] = 0;
	else
		ent->client->ps.stats[STAT_SELECTED_ICON] = gi.imageindex (itemlist[ent->client->pers.selected_item].icon);

	ent->client->ps.stats[STAT_SELECTED_ITEM] = ent->client->pers.selected_item;

	//
	// layouts
	//
	ent->client->ps.stats[STAT_LAYOUTS] = 0;

	if (deathmatch->value)
	{
		if (ent->client->pers.health <= 0 || level.intermissiontime
			|| ent->client->showscores || ent->client->pers.scanner_active)
			ent->client->ps.stats[STAT_LAYOUTS] |= 1;
		if (ent->client->showinventory && ent->client->pers.health > 0)
			ent->client->ps.stats[STAT_LAYOUTS] |= 2;
	}
	else
	{
		if (ent->client->showscores || ent->client->showhelp)
			ent->client->ps.stats[STAT_LAYOUTS] |= 1;
		if (ent->client->showinventory && ent->client->pers.health > 0)
			ent->client->ps.stats[STAT_LAYOUTS] |= 2;
	}

	//
	// frags
	//
	ent->client->ps.stats[STAT_FRAGS] = ent->client->resp.score;

	//
	// help icon / current weapon if not shown
	//
	if (ent->client->resp.helpchanged && (level.framenum&8) )
		ent->client->ps.stats[STAT_HELPICON] = gi.imageindex ("i_help");
	else if ( (ent->client->pers.hand == CENTER_HANDED || ent->client->ps.fov > 91)
		&& ent->client->pers.weapon)
		ent->client->ps.stats[STAT_HELPICON] = gi.imageindex (ent->client->pers.weapon->icon);
	else
		ent->client->ps.stats[STAT_HELPICON] = 0;

//ponpoko
	/*K03 if(ent->client->zc.aiming == 1)
	{
		ent->client->ps.stats[STAT_SIGHT_PIC] = gi.imageindex ("zsight");
	}
	else if(ent->client->zc.aiming == 3)
	{
		if(ent->client->zc.lockon) ent->client->ps.stats[STAT_SIGHT_PIC] = gi.imageindex ("zsight_l1");
		else ent->client->ps.stats[STAT_SIGHT_PIC] = gi.imageindex ("zsight_l0");
	}
	else ent->client->ps.stats[STAT_SIGHT_PIC] = 0;*/
//ponpoko

	//K03 Begin
	//ent->client->ps.stats[STAT_LEVEL] = ent->myskills.level;
	ent->client->ps.stats[STAT_STREAK] = ent->myskills.streak;

	/*if (timelimit->value)
		time_left = (timelimit->value*60 - level.time);
	else
		time_left = 60*99;

	ent->client->ps.stats[STAT_TIMEMIN] = (int)(time_left/60);*/
	ent->client->ps.stats[STAT_TIMEMIN] = ent->client->pers.inventory[power_cube_index];
	if (ent->client->ps.stats[STAT_TIMEMIN] < 0)
		ent->client->ps.stats[STAT_TIMEMIN] = 0;
	
	

	if (ent->client->pers.selected_item == -1)
		ent->client->ps.stats[STAT_SELECTED_NUM] = 0;
	else
		ent->client->ps.stats[STAT_SELECTED_NUM] = ent->client->pers.inventory[ent->client->pers.selected_item];
	//K03 End

	//GHz Begin
	V_PlayerID(ent, NULL);
	// id code
	//GHz End
//GHz START
	if ((ent->myskills.abilities[ID].disable) || (!ent->myskills.abilities[ID].current_level) || (level.time > ent->lastdmg+2))
		ent->client->ps.stats[STAT_ID_DAMAGE] = 0;
//GHz END

}
Beispiel #10
0
void Cmd_Deflect_f(edict_t *ent)
{
	float duration;
	edict_t *target = ent; // default target is self

	if (!V_CanUseAbilities(ent, DEFLECT, DEFLECT_COST, true))
		return;

	duration = DEFLECT_INITIAL_DURATION + DEFLECT_ADDON_DURATION * ent->myskills.abilities[DEFLECT].current_level;

	// bless the tank instead of the noclipped player
	if (PM_PlayerHasMonster(ent))
		target = target->owner;

	//Blessing self?
	if (Q_strcasecmp(gi.argv(1), "self") == 0)
	{
		if (!curse_add(target, ent, DEFLECT, 0, duration))
		{
			gi.cprintf(ent, PRINT_HIGH, "Unable to bless self.\n");
			return;
		}
		//target = ent;
	}
	else
	{
		target = curse_Attack(ent, DEFLECT, 512.0, duration, false);
	}

	if (target != NULL)
	{
		que_t *slot = NULL;

		//Finish casting the spell
		ent->client->ability_delay = level.time + DEFLECT_DELAY;
		ent->client->pers.inventory[power_cube_index] -= DEFLECT_COST;
	//	ent->myskills.abilities[DEFLECT].delay = level.time + duration + DEFLECT_DELAY;

		//Change the curse think to the deflect think
		slot = que_findtype(target->curses, NULL, DEFLECT);
		if (slot)
		{
			slot->ent->think = deflect_think;
			slot->ent->nextthink = level.time + FRAMETIME;
			slot->ent->random = DEFLECT_INITIAL_PROJECTILE_CHANCE+DEFLECT_ADDON_HITSCAN_CHANCE*ent->myskills.abilities[DEFLECT].current_level;
			if (slot->ent->random > DEFLECT_MAX_PROJECTILE_CHANCE)
				slot->ent->random = DEFLECT_MAX_PROJECTILE_CHANCE;
		}

		//Notify the target
		if (target == ent)
		{
			gi.cprintf(target, PRINT_HIGH, "You have been blessed with deflect for %0.1f seconds!\n", duration);
		}
		else if ((target->client) && !(target->svflags & SVF_MONSTER))
		{
			gi.cprintf(target, PRINT_HIGH, "You have been blessed with deflect for %0.1f seconds!\n\n", duration);
			gi.cprintf(ent, PRINT_HIGH, "Blessed %s with deflect for %0.1f seconds.\n", target->myskills.player_name, duration);
		}
		else
		{
			gi.cprintf(ent, PRINT_HIGH, "Blessed %s with deflect for %0.1f seconds.\n", V_GetMonsterName(target), duration);
		}

		//Play the spell sound!
		gi.sound(target, CHAN_ITEM, gi.soundindex("curses/prayer.wav"), 1, ATTN_NORM, 0);
	}
}