Commit fcf4579b authored by Mario's avatar Mario

Merge branch 'TimePath/nadesys' into 'master'

Objectify nades

Also fixes translocate grenade facing direction

See merge request !170
parents d78c1f16 384be561
...@@ -978,8 +978,8 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan ...@@ -978,8 +978,8 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
float bonusNades = getstatf(STAT_NADE_BONUS); float bonusNades = getstatf(STAT_NADE_BONUS);
float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE); float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE);
float bonusType = getstati(STAT_NADE_BONUS_TYPE); float bonusType = getstati(STAT_NADE_BONUS_TYPE);
vector nadeColor = Nade_Color(bonusType); vector nadeColor = NADES[bonusType].m_color;
string nadeIcon = Nade_Icon(bonusType); string nadeIcon = NADES[bonusType].m_icon;
vector iconPos, textPos; vector iconPos, textPos;
......
...@@ -140,9 +140,9 @@ void CSQC_Init(void) ...@@ -140,9 +140,9 @@ void CSQC_Init(void)
GetTeam(NUM_SPECTATOR, true); // add specs first GetTeam(NUM_SPECTATOR, true); // add specs first
// needs to be done so early because of the constants they create // needs to be done so early because of the constants they create
static_init();
CALL_ACCUMULATED_FUNCTION(RegisterWeapons); CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
CALL_ACCUMULATED_FUNCTION(RegisterMonsters); CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
CALL_ACCUMULATED_FUNCTION(RegisterItems);
CALL_ACCUMULATED_FUNCTION(RegisterGametypes); CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
CALL_ACCUMULATED_FUNCTION(RegisterNotifications); CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
......
...@@ -543,7 +543,7 @@ void UpdateCrosshair() ...@@ -543,7 +543,7 @@ void UpdateCrosshair()
if(getstati(STAT_FROZEN)) if(getstati(STAT_FROZEN))
drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE); drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
else if (getstatf(STAT_HEALING_ORB)>time) else if (getstatf(STAT_HEALING_ORB)>time)
drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, Nade_Color(NADE_TYPE_HEAL), autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE); drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, NADE_TYPE_HEAL.m_color, autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
if(!intermission) if(!intermission)
if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
{ {
......
...@@ -114,7 +114,7 @@ void Projectile_Draw() ...@@ -114,7 +114,7 @@ void Projectile_Draw()
break; break;
} }
if(Nade_IDFromProjectile(self.cnt) != 0) if(Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
rot = self.avelocity; rot = self.avelocity;
self.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(self.angles), rot * (t - self.spawntime))); self.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(self.angles), rot * (t - self.spawntime)));
...@@ -142,7 +142,7 @@ void Projectile_Draw() ...@@ -142,7 +142,7 @@ void Projectile_Draw()
break; break;
} }
if(Nade_IDFromProjectile(self.cnt) != 0) if(Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
trailorigin += v_up * 4; trailorigin += v_up * 4;
if(drawn) if(drawn)
...@@ -318,7 +318,12 @@ void Ent_Projectile() ...@@ -318,7 +318,12 @@ void Ent_Projectile()
case PROJECTILE_RPC: setmodel(self, "models/weapons/ok_rocket.md3");self.traileffect = particleeffectnum("TR_ROCKET"); break; case PROJECTILE_RPC: setmodel(self, "models/weapons/ok_rocket.md3");self.traileffect = particleeffectnum("TR_ROCKET"); break;
default: default:
if(Nade_IDFromProjectile(self.cnt) != 0) { setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum(Nade_TrailEffect(self.cnt, self.team)); break; } if (Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
{
setmodel(self, "models/weapons/v_ok_grenade.md3");
self.traileffect = particleeffectnum(Nade_TrailEffect(self.cnt, self.team));
break;
}
error("Received invalid CSQC projectile, can't work with this!"); error("Received invalid CSQC projectile, can't work with this!");
break; break;
} }
...@@ -448,12 +453,12 @@ void Ent_Projectile() ...@@ -448,12 +453,12 @@ void Ent_Projectile()
break; break;
} }
if(Nade_IDFromProjectile(self.cnt) != 0) if(Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
{ {
int nade_type = Nade_IDFromProjectile(self.cnt); entity nade_type = Nade_FromProjectile(self.cnt);
self.mins = '-16 -16 -16'; self.mins = '-16 -16 -16';
self.maxs = '16 16 16'; self.maxs = '16 16 16';
self.colormod = Nade_Color(nade_type); self.colormod = nade_type.m_color;
self.move_movetype = MOVETYPE_BOUNCE; self.move_movetype = MOVETYPE_BOUNCE;
self.move_touch = func_null; self.move_touch = func_null;
self.scale = 1.5; self.scale = 1.5;
......
...@@ -9,6 +9,7 @@ entity ITEMS[MAX_ITEMS]; ...@@ -9,6 +9,7 @@ entity ITEMS[MAX_ITEMS];
int ITEM_COUNT; int ITEM_COUNT;
/** If you register a new item, make sure to add it to all.inc */ /** If you register a new item, make sure to add it to all.inc */
#define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, ITEMS, ITEM_COUNT, id, class, m_id) #define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, ITEMS, ITEM_COUNT, id, class, m_id)
REGISTER_REGISTRY(RegisterItems)
#define ITEMS_FOREACH(pred, body) do { \ #define ITEMS_FOREACH(pred, body) do { \
for (int i = 0; i < ITEM_COUNT; i++) { \ for (int i = 0; i < ITEM_COUNT; i++) { \
......
#ifndef NADES_H #ifndef NADES_H
#define NADES_H #define NADES_H
#include "oo.qh"
#include "registry.qh"
#include "teams.qh" #include "teams.qh"
.float healer_lifetime; .float healer_lifetime;
...@@ -21,104 +23,110 @@ const int PROJECTILE_NADE_HEAL_BURN = 81; ...@@ -21,104 +23,110 @@ const int PROJECTILE_NADE_HEAL_BURN = 81;
const int PROJECTILE_NADE_MONSTER = 82; const int PROJECTILE_NADE_MONSTER = 82;
const int PROJECTILE_NADE_MONSTER_BURN = 83; const int PROJECTILE_NADE_MONSTER_BURN = 83;
const int NADE_TYPE_NORMAL = 1; void RegisterNades();
const int NADE_TYPE_NAPALM = 2; const int NADES_MAX = 8;
const int NADE_TYPE_ICE = 3; entity NADES[NADES_MAX];
const int NADE_TYPE_TRANSLOCATE = 4; int NADES_COUNT;
const int NADE_TYPE_SPAWN = 5; #define REGISTER_NADE(id) REGISTER(RegisterNades, NADE_TYPE, NADES, NADES_COUNT, id, Nade, m_id)
const int NADE_TYPE_HEAL = 6; REGISTER_REGISTRY(RegisterNades)
const int NADE_TYPE_MONSTER = 7;
CLASS(Nade, Object)
ATTRIB(Nade, m_id, int, 0)
ATTRIB(Nade, m_color, vector, '0 0 0')
ATTRIB(Nade, m_icon, string, "nade_normal")
ATTRIBARRAY(Nade, m_projectile, int, 2)
ATTRIBARRAY(Nade, m_trail, string, 2)
ENDCLASS(Nade)
REGISTER_NADE(NULL);
#define NADE_PROJECTILE(i, projectile, trail) do { \
this.m_projectile[i] = projectile; \
this.m_trail[i] = trail; \
} while (0)
REGISTER_NADE(NORMAL) {
this.m_color = '1 1 1';
NADE_PROJECTILE(0, PROJECTILE_NADE, string_null);
NADE_PROJECTILE(1, PROJECTILE_NADE_BURN, string_null);
}
const int NADE_TYPE_LAST = 7; // a check to prevent using higher values & crashing REGISTER_NADE(NAPALM) {
this.m_color = '2 0.5 0';
this.m_icon = "nade_napalm";
NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, "TR_ROCKET");
NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, "spiderbot_rocket_thrust");
}
vector Nade_Color(int nadeid) REGISTER_NADE(ICE) {
{ this.m_color = '0 0.5 2';
switch(nadeid) this.m_icon = "nade_ice";
{ NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, "TR_NEXUIZPLASMA");
case NADE_TYPE_NORMAL: return '1 1 1'; NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, "wakizashi_rocket_thrust");
case NADE_TYPE_NAPALM: return '2 0.5 0';
case NADE_TYPE_ICE: return '0 0.5 2';
case NADE_TYPE_TRANSLOCATE: return '1 0 1';
case NADE_TYPE_SPAWN: return '1 0.9 0';
case NADE_TYPE_HEAL: return '1 0 0';
case NADE_TYPE_MONSTER: return '0.25 0.75 0';
}
return '0 0 0';
} }
string Nade_Icon(int nadeid) REGISTER_NADE(TRANSLOCATE) {
{ this.m_color = '1 0 1';
switch(nadeid) this.m_icon = "nade_translocate";
{ NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, "TR_CRYLINKPLASMA");
case NADE_TYPE_NORMAL: return "nade_normal"; NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, "TR_CRYLINKPLASMA");
case NADE_TYPE_NAPALM: return "nade_napalm";
case NADE_TYPE_ICE: return "nade_ice";
case NADE_TYPE_TRANSLOCATE: return "nade_translocate";
case NADE_TYPE_SPAWN: return "nade_spawn";
case NADE_TYPE_HEAL: return "nade_heal";
case NADE_TYPE_MONSTER: return "nade_monster";
}
return "nade_normal";
} }
int Nade_IDFromProjectile(float proj) REGISTER_NADE(SPAWN) {
{ this.m_color = '1 0.9 0';
switch(proj) this.m_icon = "nade_spawn";
{ NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, "nade_yellow");
case PROJECTILE_NADE: NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, "nade_yellow");
case PROJECTILE_NADE_BURN: return NADE_TYPE_NORMAL; }
case PROJECTILE_NADE_NAPALM:
case PROJECTILE_NADE_NAPALM_BURN: return NADE_TYPE_NAPALM; REGISTER_NADE(HEAL) {
case PROJECTILE_NADE_ICE: this.m_color = '1 0 0';
case PROJECTILE_NADE_ICE_BURN: return NADE_TYPE_ICE; this.m_icon = "nade_heal";
case PROJECTILE_NADE_TRANSLOCATE: return NADE_TYPE_TRANSLOCATE; NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, "nade_red");
case PROJECTILE_NADE_SPAWN: return NADE_TYPE_SPAWN; NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, "nade_red_burn");
case PROJECTILE_NADE_HEAL: }
case PROJECTILE_NADE_HEAL_BURN: return NADE_TYPE_HEAL;
case PROJECTILE_NADE_MONSTER: REGISTER_NADE(MONSTER) {
case PROJECTILE_NADE_MONSTER_BURN: return NADE_TYPE_MONSTER; this.m_color = '0.25 0.75 0';
} this.m_icon = "nade_monster";
NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, "nade_red");
return 0; NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, "nade_red_burn");
} }
int Nade_ProjectileFromID(int proj, bool burn) entity Nade_FromProjectile(float proj)
{ {
switch(proj) for (int i = 0; i < NADES_COUNT; i++)
{ {
case NADE_TYPE_NORMAL: return (burn) ? PROJECTILE_NADE_BURN : PROJECTILE_NADE; entity nade = NADES[i];
case NADE_TYPE_NAPALM: return (burn) ? PROJECTILE_NADE_NAPALM_BURN : PROJECTILE_NADE_NAPALM; for (int j = 0; j < 2; j++)
case NADE_TYPE_ICE: return (burn) ? PROJECTILE_NADE_ICE_BURN : PROJECTILE_NADE_ICE; {
case NADE_TYPE_TRANSLOCATE: return PROJECTILE_NADE_TRANSLOCATE; if (nade.m_projectile[j] == proj) return nade;
case NADE_TYPE_SPAWN: return PROJECTILE_NADE_SPAWN; }
case NADE_TYPE_HEAL: return (burn) ? PROJECTILE_NADE_HEAL_BURN : PROJECTILE_NADE_HEAL; }
case NADE_TYPE_MONSTER: return (burn) ? PROJECTILE_NADE_MONSTER_BURN : PROJECTILE_NADE_MONSTER; return NADE_TYPE_NULL;
}
return 0;
} }
string Nade_TrailEffect(float proj, float nade_team) string Nade_TrailEffect(float proj, float nade_team)
{ {
switch(proj) for (int i = 0; i < NADES_COUNT; i++)
{ {
case PROJECTILE_NADE: return strcat("nade_", Static_Team_ColorName_Lower(nade_team)); entity nade = NADES[i];
case PROJECTILE_NADE_BURN: return strcat("nade_", Static_Team_ColorName_Lower(nade_team), "_burn"); for (int j = 0; j < 2; j++)
case PROJECTILE_NADE_NAPALM: return "TR_ROCKET"; {
case PROJECTILE_NADE_NAPALM_BURN: return "spiderbot_rocket_thrust"; if (nade.m_projectile[j] == proj)
case PROJECTILE_NADE_ICE: return "TR_NEXUIZPLASMA"; {
case PROJECTILE_NADE_ICE_BURN: return "wakizashi_rocket_thrust"; string trail = nade.m_trail[j];
case PROJECTILE_NADE_TRANSLOCATE: return "TR_CRYLINKPLASMA"; if (trail) return trail;
case PROJECTILE_NADE_SPAWN: return "nade_yellow"; break;
case PROJECTILE_NADE_HEAL: return "nade_red"; }
case PROJECTILE_NADE_HEAL_BURN: return "nade_red_burn"; }
case PROJECTILE_NADE_MONSTER: return "nade_red"; }
case PROJECTILE_NADE_MONSTER_BURN: return "nade_red_burn"; switch (proj)
} {
case PROJECTILE_NADE: return strcat("nade_", Static_Team_ColorName_Lower(nade_team));
return ""; case PROJECTILE_NADE_BURN: return strcat("nade_", Static_Team_ColorName_Lower(nade_team), "_burn");
}
return "";
} }
#ifdef SVQC #ifdef SVQC
......
...@@ -9,11 +9,15 @@ ...@@ -9,11 +9,15 @@
void Register_##ns##_##id() { \ void Register_##ns##_##id() { \
entity this = NEW(class); \ entity this = NEW(class); \
ns##_##id = this; \ ns##_##id = this; \
this.fld = ns##_COUNT; \ this.fld = counter; \
array[counter++] = this; \ array[counter++] = this; \
Register_##ns##_##id##_init(this); \ Register_##ns##_##id##_init(this); \
} \ } \
ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \ ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \
REGISTER_INIT(ns, id) REGISTER_INIT(ns, id)
void __static_init() { }
#define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func)
#endif #endif
...@@ -80,8 +80,8 @@ void m_init() ...@@ -80,8 +80,8 @@ void m_init()
} }
// needs to be done so early because of the constants they create // needs to be done so early because of the constants they create
static_init();
CALL_ACCUMULATED_FUNCTION(RegisterWeapons); CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
CALL_ACCUMULATED_FUNCTION(RegisterItems);
CALL_ACCUMULATED_FUNCTION(RegisterGametypes); CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
RegisterSLCategories(); RegisterSLCategories();
......
...@@ -559,9 +559,9 @@ void spawnfunc___init_dedicated_server(void) ...@@ -559,9 +559,9 @@ void spawnfunc___init_dedicated_server(void)
self.classname = "worldspawn"; // safeguard against various stuff ;) self.classname = "worldspawn"; // safeguard against various stuff ;)
// needs to be done so early because of the constants they create // needs to be done so early because of the constants they create
static_init();
CALL_ACCUMULATED_FUNCTION(RegisterWeapons); CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
CALL_ACCUMULATED_FUNCTION(RegisterMonsters); CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
CALL_ACCUMULATED_FUNCTION(RegisterItems);
CALL_ACCUMULATED_FUNCTION(RegisterGametypes); CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
CALL_ACCUMULATED_FUNCTION(RegisterNotifications); CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
...@@ -610,9 +610,9 @@ void spawnfunc_worldspawn (void) ...@@ -610,9 +610,9 @@ void spawnfunc_worldspawn (void)
server_is_dedicated = (stof(cvar_defstring("is_dedicated")) ? true : false); server_is_dedicated = (stof(cvar_defstring("is_dedicated")) ? true : false);
// needs to be done so early because of the constants they create // needs to be done so early because of the constants they create
static_init();
CALL_ACCUMULATED_FUNCTION(RegisterWeapons); CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
CALL_ACCUMULATED_FUNCTION(RegisterMonsters); CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
CALL_ACCUMULATED_FUNCTION(RegisterItems);
CALL_ACCUMULATED_FUNCTION(RegisterGametypes); CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
CALL_ACCUMULATED_FUNCTION(RegisterNotifications); CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes); CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
......
...@@ -23,7 +23,7 @@ void nade_timer_think() ...@@ -23,7 +23,7 @@ void nade_timer_think()
void nade_burn_spawn(entity _nade) void nade_burn_spawn(entity _nade)
{ {
CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, true), true); CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[true], true);
} }
void nade_spawn(entity _nade) void nade_spawn(entity _nade)
...@@ -42,7 +42,7 @@ void nade_spawn(entity _nade) ...@@ -42,7 +42,7 @@ void nade_spawn(entity _nade)
_nade.effects |= EF_LOWPRECISION; _nade.effects |= EF_LOWPRECISION;
CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, false), true); CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[false], true);
} }
void napalm_damage(float dist, float damage, float edgedamage, float burntime) void napalm_damage(float dist, float damage, float edgedamage, float burntime)
...@@ -366,7 +366,7 @@ void nade_translocate_boom() ...@@ -366,7 +366,7 @@ void nade_translocate_boom()
self.realowner = self; self.realowner = self;
self = oldself; self = oldself;
TeleportPlayer(self, self.realowner, locout, self.realowner.mangle, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER); TeleportPlayer(self, self.realowner, locout, self.realowner.angles, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
} }
void nade_spawn_boom() void nade_spawn_boom()
...@@ -490,7 +490,7 @@ void nade_boom() ...@@ -490,7 +490,7 @@ void nade_boom()
string expef; string expef;
bool nade_blast = true; bool nade_blast = true;
switch ( self.nade_type ) switch ( NADES[self.nade_type] )
{ {
case NADE_TYPE_NAPALM: case NADE_TYPE_NAPALM:
nade_blast = autocvar_g_nades_napalm_blast; nade_blast = autocvar_g_nades_napalm_blast;
...@@ -549,7 +549,7 @@ void nade_boom() ...@@ -549,7 +549,7 @@ void nade_boom()
} }
if(self.takedamage) if(self.takedamage)
switch ( self.nade_type ) switch ( NADES[self.nade_type] )
{ {
case NADE_TYPE_NAPALM: nade_napalm_boom(); break; case NADE_TYPE_NAPALM: nade_napalm_boom(); break;
case NADE_TYPE_ICE: nade_ice_boom(); break; case NADE_TYPE_ICE: nade_ice_boom(); break;
...@@ -605,7 +605,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, ...@@ -605,7 +605,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype,
return; return;
} }
if(self.nade_type == NADE_TYPE_TRANSLOCATE || self.nade_type == NADE_TYPE_SPAWN) if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id)
return; return;
if(DEATH_ISWEAPON(deathtype, WEP_BLASTER)) if(DEATH_ISWEAPON(deathtype, WEP_BLASTER))
...@@ -653,7 +653,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, ...@@ -653,7 +653,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype,
self.health -= damage; self.health -= damage;
if ( self.nade_type != NADE_TYPE_HEAL || IS_PLAYER(attacker) ) if ( self.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
self.realowner = attacker; self.realowner = attacker;
if(self.health <= 0) if(self.health <= 0)
...@@ -724,7 +724,7 @@ void toss_nade(entity e, vector _velocity, float _time) ...@@ -724,7 +724,7 @@ void toss_nade(entity e, vector _velocity, float _time)
_nade.toss_time = time; _nade.toss_time = time;
_nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX); _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX);
if(_nade.nade_type == NADE_TYPE_TRANSLOCATE || _nade.nade_type == NADE_TYPE_SPAWN) if(_nade.nade_type == NADE_TYPE_TRANSLOCATE.m_id || _nade.nade_type == NADE_TYPE_SPAWN.m_id)
_nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
else else
_nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
...@@ -783,7 +783,7 @@ float nade_customize() ...@@ -783,7 +783,7 @@ float nade_customize()
{ {
//self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; //self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
if(!self.traileffectnum) if(!self.traileffectnum)
self.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(self.nade_type, false), self.team)); self.traileffectnum = particleeffectnum(Nade_TrailEffect(NADES[self.nade_type].m_projectile[false], self.team));
self.alpha = 1; self.alpha = 1;
} }
...@@ -817,14 +817,14 @@ void nade_prime() ...@@ -817,14 +817,14 @@ void nade_prime()
n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type); n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
} }
n.nade_type = bound(1, n.nade_type, NADE_TYPE_LAST); n.nade_type = bound(1, n.nade_type, NADES_COUNT);
setmodel(n, "models/weapons/v_ok_grenade.md3"); setmodel(n, "models/weapons/v_ok_grenade.md3");
//setattachment(n, self, "bip01 l hand"); //setattachment(n, self, "bip01 l hand");
n.exteriormodeltoclient = self; n.exteriormodeltoclient = self;
n.customizeentityforclient = nade_customize; n.customizeentityforclient = nade_customize;
n.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(n.nade_type, false), self.team)); n.traileffectnum = particleeffectnum(Nade_TrailEffect(NADES[n.nade_type].m_projectile[false], self.team));
n.colormod = Nade_Color(n.nade_type); n.colormod = NADES[n.nade_type].m_color;
n.realowner = self; n.realowner = self;
n.colormap = self.colormap; n.colormap = self.colormap;
n.glowmod = self.glowmod; n.glowmod = self.glowmod;
...@@ -837,7 +837,7 @@ void nade_prime() ...@@ -837,7 +837,7 @@ void nade_prime()
setmodel(fn, "models/weapons/h_ok_grenade.iqm"); setmodel(fn, "models/weapons/h_ok_grenade.iqm");
setattachment(fn, self.weaponentity, ""); setattachment(fn, self.weaponentity, "");
fn.realowner = fn.owner = self; fn.realowner = fn.owner = self;
fn.colormod = Nade_Color(n.nade_type); fn.colormod = NADES[n.nade_type].m_color;
fn.colormap = self.colormap; fn.colormap = self.colormap;
fn.glowmod = self.glowmod; fn.glowmod = self.glowmod;
fn.think = SUB_Remove; fn.think = SUB_Remove;
...@@ -995,7 +995,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink) ...@@ -995,7 +995,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
self.pokenade_type = autocvar_g_nades_pokenade_monster_type; self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
} }
self.nade_type = bound(1, self.nade_type, NADE_TYPE_LAST); self.nade_type = bound(1, self.nade_type, NADES_COUNT);
if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max) if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max); nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment