Various glow stuff: People should now glow coloredly:

a) If they're holding an item belonging to a team, they get that team's glowcolor
b) If they're quad they get blue
c) If they're pent they get red.

Yellow and Green are both just DIMLIGHT for now, but I'll see if I can't
use QSG glow_color/glow_size
This commit is contained in:
Finny Merrill 2003-12-03 02:43:02 +00:00
parent e63ce1578a
commit 841a2e09b3
11 changed files with 95 additions and 99 deletions

View File

@ -212,7 +212,7 @@ void () PrematchBegin =
other.items = other.items & ~IT_INVULNERABILITY;
other.invincible_time = 0;
other.invincible_finished = 0;
other.effects = other.effects - (other.effects & EF_DIMLIGHT);
other.effects &= ~EF_ANYGLOW;
TF_T_Damage(other, NIL, NIL, other.health + 20, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
other = find(other, classname, "player");
}
@ -225,7 +225,7 @@ void () PrematchBegin =
other.items = other.items & ~IT_INVULNERABILITY;
other.invincible_time = 0;
other.invincible_finished = 0;
other.effects = other.effects - (other.effects & EF_DIMLIGHT);
other.effects &= ~EF_ANYGLOW;
TF_T_Damage(other, NIL, NIL, other.health + 20, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
other = find(other, classname, "grunty");
}*/
@ -2702,7 +2702,7 @@ void() PlayerPreThink =
if (self.undercover_team || self.undercover_skin || self.is_undercover)
{
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT))
if (self.effects & EF_ANYGLOW)
{
sprint(self, PRINT_MEDIUM, "The glowing removes your disguise.\n");
Spy_RemoveDisguise(self);
@ -2710,7 +2710,7 @@ void() PlayerPreThink =
}
/*if (self.job & JOB_THIEF && self.job & JOB_FULL_HIDE)
{
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT))
if (self.effects & EF_ANYGLOW)
{
sprint(self, PRINT_MEDIUM, "The glowing removes your full invisibility.\n");
self.job = self.job - (self.job & JOB_FULL_HIDE);
@ -2859,9 +2859,6 @@ Check for turning off powerups
*/
void() CheckPowerups =
{
local float lighton;
local entity te;
if (self.health <= 0)
return;
@ -2963,26 +2960,8 @@ void() CheckPowerups =
self.items = self.items & ~IT_INVULNERABILITY;
self.invincible_time = 0;
self.invincible_finished = 0;
}
if (self.invincible_finished > time)
self.effects = self.effects | EF_DIMLIGHT;
else
{
// Only remove dimlight if it's not being supplied by a GoalItem
lighton = FALSE;
te = find (NIL, classname, "item_tfgoal");
while (te)
{
if (te.owner == self)
{
if (te.goal_activation & TFGI_GLOW)
lighton = TRUE;
}
te = find(te, classname, "item_tfgoal");
}
if (!lighton)
self.effects = self.effects - (self.effects & EF_DIMLIGHT);
self.effects &= ~EF_ANYGLOW;
self.effects |= EF_GlowColor(self);
}
}
@ -3021,26 +3000,8 @@ void() CheckPowerups =
self.super_time = 0;
//WK If inspired, remove inspiration
self.tfstate = self.tfstate - (self.tfstate & TFSTATE_INSPIRED);
}
if (self.super_damage_finished > time)
self.effects = self.effects | EF_DIMLIGHT;
else
{
// Only remove dimlight if it's not being supplied by a GoalItem
lighton = FALSE;
te = find (NIL, classname, "item_tfgoal");
while (te)
{
if (te.owner == self)
{
if (te.goal_activation & TFGI_GLOW)
lighton = TRUE;
}
te = find(te, classname, "item_tfgoal");
}
if (!lighton)
self.effects = self.effects - (self.effects & EF_DIMLIGHT);
self.effects &= ~EF_ANYGLOW;
self.effects |= EF_GlowColor(self);
}
}

View File

@ -397,7 +397,7 @@ void(entity targ, entity inflictor, entity attacker, float damage, float T_flags
attacker.tfstate = attacker.tfstate - TFSTATE_INSPIRED;
attacker.super_damage_finished = 0;
attacker.items = attacker.items & ~IT_QUAD;
attacker.effects = attacker.effects - (attacker.effects & EF_DIMLIGHT);
attacker.effects &= ~EF_ANYGLOW;
}
}
if (targ.classname == "player" && targ.tfstate & TFSTATE_INSPIRED) {
@ -407,7 +407,7 @@ void(entity targ, entity inflictor, entity attacker, float damage, float T_flags
targ.tfstate = targ.tfstate - TFSTATE_INSPIRED;
targ.super_damage_finished = 0;
targ.items = targ.items & ~IT_QUAD;
targ.effects = targ.effects - (targ.effects & EF_DIMLIGHT);
targ.effects &= ~EF_ANYGLOW;
}
}

14
defs.qh
View File

@ -175,11 +175,19 @@
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTFIELD 8 //really 1, doesn't exist in quakeworld
#define EF_MUZZLEFLASH 8 //really 2, doesn't exist in quakeworld
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
#define EF_DIMLIGHT 8
#define EF_FLAG1 16
#define EF_FLAG2 32
#define EF_RED 64
#define EF_BLUE 128
#define EF_ANYGLOW (EF_BRIGHTLIGHT | EF_DIMLIGHT | EF_RED | EF_BLUE)
float (entity e) EF_GlowColor;
// network writes. argument to Write*
#define MSG_ONE 1 // reliable to one (msg_entity)

View File

@ -84,7 +84,7 @@ void() JobThief =
//}
else { //Become fully hidden
//RJM - Can't hide while carrying flags.
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT)) {
if (self.effects & EF_ANYGLOW) {
sprint(self,PRINT_HIGH,"Not while glowing, idiot.\n");
return;
}
@ -113,7 +113,7 @@ void() JobThief =
//RJM - Can't hide while carrying flags.
//WK - Allow them to go eyes invisible but not full hide
/*
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT)) {
if (self.effects & EF_ANYGLOW) {
sprint(self, PRINT_HIGH, "Not while glowing, gimp.\n");
return;
}
@ -319,7 +319,7 @@ void() ChaplanThink = {
//Sync CHAN_MUSIC with disconnect and sound below
self.job = self.job - (self.job & JOB_ACTIVE);
sound (self, CHAN_MUSIC, "items/r_item1.wav", 0.1, ATTN_NORM);
self.effects = self.effects - (self.effects & EF_BRIGHTLIGHT);
self.effects &= ~EF_ANYGLOW;
//self.tfstate = self.tfstate - (self.tfstate & TFSTATE_RELOADING);
self.current_weapon = self.weapon;
W_SetCurrentAmmo();
@ -368,7 +368,7 @@ void() JobChaplan =
//Start playing preacher music, glow and inspire!
//sound (self, CHAN_VOICE, "ambience/orff.wav", 0.75, ATTN_NORM);
sound (self, CHAN_MUSIC, "ambience/orff.wav", 0.75, ATTN_NORM);
self.effects = self.effects | EF_BRIGHTLIGHT;
self.effects |= EF_BRIGHTLIGHT | EF_GlowColor(self);
ChaplanInspire();
};

View File

@ -967,7 +967,7 @@ void(float inp) Menu_Spy_Input =
{
if (inp == 1 || inp == 2)
{
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT))
if (self.effects & EF_ANYGLOW)
{
sprint(self, PRINT_HIGH, "You can't go undercover while glowing.\n");
ResetMenu();

View File

@ -1254,7 +1254,6 @@ void() PlayerDie =
//WK Stop orff
sound (self, CHAN_MUSIC, "items/r_item1.wav", 0.1, ATTN_NORM);
//WK Stop glows!
self.flags &= ~(EF_BRIGHTLIGHT | EF_DIMLIGHT);
self.effects = 0;
// make dead guy release hook (wedge)
if (self.hook_out) {
@ -1498,3 +1497,59 @@ void() player_laser4 =[$nailatt1, player_laser1 ]
}
self.weaponframe=5;
};
float(entity e) EF_GlowColor =
{
local float ret = 0;
if (e.classname == "player")
{
local entity te = NIL;
te = find(NIL, classname, "item_tfgoal");
while (te)
{
if (te.owner == e && (te.goal_activation & TFGI_GLOW))
{
ret |= EF_DIMLIGHT;
local float teamno = 0;
if (te.owned_by == 1)
ret |= EF_BLUE;
else if (te.owned_by == 2)
ret |= EF_RED;
}
}
if (e.super_damage_finished)
ret |= EF_BLUE;
if (e.invincible_finished)
ret |= EF_RED;
if ((ret & EF_ANYGLOW) != EF_DIMLIGHT)
ret &= ~EF_DIMLIGHT;
return ret;
}
else if (e.classname == "item_tfgoal")
{
if (e.owned_by)
{
if (e.owned_by == 1)
return EF_BLUE;
else if (e.owned_by == 2)
return EF_RED;
}
else if (e.team)
{
if (e.team == 1)
return EF_BLUE;
else if (e.team == 2)
return EF_RED;
}
return EF_DIMLIGHT;
}
};

4
spy.qc
View File

@ -273,7 +273,7 @@ void(float type) TeamFortress_SpyFeignDeath =
}
//WK - Can't feign while carrying flag. King cheater!
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT)) {
if (self.effects & EF_ANYGLOW) {
sprint(self, PRINT_HIGH, "Can't feign while glowing, you sloppy bitch.\n");
return;
}
@ -404,7 +404,7 @@ void() TeamFortress_SpyGoUndercover =
{
local entity te;
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT))
if (self.effects & EF_ANYGLOW)
{
sprint(self, PRINT_MEDIUM, "You cannot disguise while glowing.\n");
return;

View File

@ -125,7 +125,7 @@ float(entity targ) Teleporter_check_person =
CenterPrint(targ, "Civilian + Teleporter = No, NFC!\n");
return FALSE;
}
if (targ.effects & (EF_BRIGHTLIGHT | EF_DIMLIGHT | EF_BRIGHTFIELD)) {//no flag for you!
if (targ.effects & EF_ANYGLOW) {//no flag for you!
CenterPrint(targ, "Can't use teleporter while glowing!\n");
return FALSE;
}

View File

@ -144,7 +144,7 @@ void() UseSpecialSkill =
if (self.money)
self.impulse = TF_ENGINEER_BUILD;
else {
if (self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT)) //CH why not have the check here too, saves a keypress
if (self.effects & EF_ANYGLOW) //CH why not have the check here too, saves a keypress
self.impulse = TF_ENGINEER_BUILD;
else
self.impulse = TF_SPY_SPY;
@ -3589,7 +3589,7 @@ void() TeamFortress_RegenerateCells =
}
else if ((self.owner.velocity_z == 0 && self.owner.velocity_y == 0 && self.owner.velocity_x == 0)
&& !(self.owner.job & JOB_FULL_HIDE)
&& !(self.effects & (EF_DIMLIGHT | EF_BRIGHTLIGHT)))
&& !(self.effects & EF_ANYGLOW))
{
self.owner.frame = 0;
self.owner.weaponframe = 0;

View File

@ -195,7 +195,7 @@ void() TF_PlaceItem =
// self.oldorigin = self.origin; // So we can return it later
if (self.goal_activation & TFGI_ITEMGLOWS)
self.effects = self.effects | EF_DIMLIGHT;
self.effects = self.effects | EF_GlowColor(self);
// Setup the item_list mask
if (item_list_bit == 0)
@ -2770,12 +2770,12 @@ void(entity Item, entity AP, entity Goal) tfgoalitem_GiveToPlayer =
// Do the deeds on the player
if (Item.goal_activation & TFGI_GLOW)
AP.effects = AP.effects | EF_DIMLIGHT;
AP.effects = AP.effects | EF_GlowColor(AP);
if (Item.goal_activation & TFGI_SLOW)
TeamFortress_SetSpeed(AP);
if (Item.goal_activation & TFGI_ITEMGLOWS)
Item.effects = Item.effects - (Item.effects | EF_DIMLIGHT);
Item.effects &= ~EF_ANYGLOW;
// Light up console icons
if (Item.items & IT_KEY1)
@ -2899,7 +2899,7 @@ void() ReturnItem =
void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer =
{
local entity te;
local float lighton, slowon;
local float slowon;
local float key1on, key2on;
local float spyoff;
local entity DelayReturn;
@ -2918,46 +2918,18 @@ void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer =
RPrint("\n");
#endif
lighton = FALSE;
slowon = FALSE;
key1on = FALSE;
key2on = FALSE;
spyoff = FALSE;
// Remove the deeds from the player
// Make sure we don't remove an effect another Goal is also supplying
te = find (NIL, classname, "item_tfgoal");
while (te)
{
if ((te.owner == AP) && (te != Item))
{
if (te.goal_activation & TFGI_GLOW)
lighton = TRUE;
if (te.goal_activation & TFGI_SLOW)
slowon = TRUE;
if (te.items & IT_KEY1)
key1on = TRUE;
if (te.items & IT_KEY2)
key2on = TRUE;
if (te.goal_result & TFGR_REMOVE_DISGUISE)
spyoff = 1;
}
te = find(te, classname, "item_tfgoal");
}
// Check Powerups too
if (!lighton)
{
if (AP.invincible_finished > time + 3)
lighton = TRUE;
}
if (!lighton)
AP.effects = AP.effects - (AP.effects & EF_DIMLIGHT);
AP.effects &= ~EF_ANYGLOW;
AP.effects |= EF_GlowColor(AP); // This handles other glows
if (Item.goal_activation & TFGI_ITEMGLOWS)
Item.effects = Item.effects | EF_DIMLIGHT;
Item.effects = Item.effects | EF_GlowColor(self);
// Remove the Spy prevention
if (!spyoff)

View File

@ -195,7 +195,7 @@ void() Wiz_FastFire =
if (self.owner.health > 0)
{
self.owner.effects = self.owner.effects | EF_MUZZLEFLASH;
self.owner.effects = self.owner.effects | EF_DIMLIGHT;
makevectors (self.enemy.angles);
dst = self.enemy.origin - 13*self.movedir;