const int MF_TRACER3 = 128; // purple trail
.int csqcmodel_effects;
.int csqcmodel_modelflags;
+.int csqcmodel_traileffect;
void CSQCModel_Effects_PreUpdate(void)
{SELFPARAM();
self.effects = self.csqcmodel_effects;
self.modelflags = self.csqcmodel_modelflags;
+ self.traileffect = self.csqcmodel_traileffect;
}
void Reset_ArcBeam(void);
void CSQCModel_Effects_PostUpdate(void)
}
self.csqcmodel_effects = self.effects;
self.csqcmodel_modelflags = self.modelflags;
+ self.csqcmodel_traileffect = self.traileffect;
self.effects = 0;
self.modelflags = 0;
if(self.csqcmodel_teleported)
void CSQCModel_Effects_Apply(void)
{SELFPARAM();
int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
+ int tref = self.csqcmodel_traileffect;
self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
self.effects = 0;
self.traileffect = 0;
if(eff & EF_BRIGHTFIELD)
- self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA);
+ tref = particleeffectnum(EFFECT_TR_NEXUIZPLASMA);
// ignoring EF_MUZZLEFLASH
if(eff & EF_BRIGHTLIGHT)
adddynamiclight(self.origin, 400, '3 3 3');
self.renderflags |= RF_DYNAMICMODELLIGHT;
// ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION
if(self.csqcmodel_modelflags & MF_ROCKET)
- self.traileffect = particleeffectnum(EFFECT_TR_ROCKET);
+ tref = particleeffectnum(EFFECT_TR_ROCKET);
if(self.csqcmodel_modelflags & MF_GRENADE)
- self.traileffect = particleeffectnum(EFFECT_TR_GRENADE);
+ tref = particleeffectnum(EFFECT_TR_GRENADE);
if(self.csqcmodel_modelflags & MF_GIB)
- self.traileffect = particleeffectnum(EFFECT_TR_BLOOD);
+ tref = particleeffectnum(EFFECT_TR_BLOOD);
if(self.csqcmodel_modelflags & MF_ROTATE)
{
self.renderflags |= RF_USEAXIS;
makevectors(self.angles + '0 100 0' * fmod(time, 3.6));
}
if(self.csqcmodel_modelflags & MF_TRACER)
- self.traileffect = particleeffectnum(EFFECT_TR_WIZSPIKE);
+ tref = particleeffectnum(EFFECT_TR_WIZSPIKE);
if(self.csqcmodel_modelflags & MF_ZOMGIB)
- self.traileffect = particleeffectnum(EFFECT_TR_SLIGHTBLOOD);
+ tref = particleeffectnum(EFFECT_TR_SLIGHTBLOOD);
if(self.csqcmodel_modelflags & MF_TRACER2)
- self.traileffect = particleeffectnum(EFFECT_TR_KNIGHTSPIKE);
+ tref = particleeffectnum(EFFECT_TR_KNIGHTSPIKE);
if(self.csqcmodel_modelflags & MF_TRACER3)
- self.traileffect = particleeffectnum(EFFECT_TR_VORESPIKE);
+ tref = particleeffectnum(EFFECT_TR_VORESPIKE);
+
+ self.traileffect = tref;
if(self.drawmask)
Projectile_DrawTrail(self.origin);
if (self.traileffect)
{
particles_alphamin = particles_alphamax = particles_fade = sqrt(self.alpha);
- boxparticles(self.traileffect, self, from, to, self.velocity, self.velocity, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
+ boxparticles(particleeffectnum(effects_ent[self.traileffect]), self, from, to, self.velocity, self.velocity, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
}
}
self.traileffect = 0;
switch (self.cnt) {
#define CASE(id) case PROJECTILE_##id: setmodel(self, MDL_PROJECTILE_##id);
- CASE(ELECTRO) self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
- CASE(ROCKET) self.traileffect = particleeffectnum(EFFECT_TR_ROCKET); self.scale = 2; break;
- CASE(CRYLINK) self.traileffect = particleeffectnum(EFFECT_TR_CRYLINKPLASMA); break;
- CASE(CRYLINK_BOUNCING) self.traileffect = particleeffectnum(EFFECT_TR_CRYLINKPLASMA); break;
- CASE(ELECTRO_BEAM) self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
- CASE(GRENADE) self.traileffect = particleeffectnum(EFFECT_TR_GRENADE); break;
- CASE(GRENADE_BOUNCING) self.traileffect = particleeffectnum(EFFECT_TR_GRENADE); break;
- CASE(MINE) self.traileffect = particleeffectnum(EFFECT_TR_GRENADE); break;
- CASE(BLASTER) self.traileffect = particleeffectnum(EFFECT_Null); break;
- CASE(HLAC) self.traileffect = particleeffectnum(EFFECT_Null); break;
- CASE(PORTO_RED) self.traileffect = particleeffectnum(EFFECT_TR_WIZSPIKE); self.scale = 4; break;
- CASE(PORTO_BLUE) self.traileffect = particleeffectnum(EFFECT_TR_WIZSPIKE); self.scale = 4; break;
- CASE(HOOKBOMB) self.traileffect = particleeffectnum(EFFECT_TR_KNIGHTSPIKE); break;
- CASE(HAGAR) self.traileffect = particleeffectnum(EFFECT_HAGAR_ROCKET); self.scale = 0.75; break;
- CASE(HAGAR_BOUNCING) self.traileffect = particleeffectnum(EFFECT_HAGAR_ROCKET); self.scale = 0.75; break;
+ CASE(ELECTRO) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break;
+ CASE(ROCKET) self.traileffect = EFFECT_TR_ROCKET.m_id; self.scale = 2; break;
+ CASE(CRYLINK) self.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break;
+ CASE(CRYLINK_BOUNCING) self.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break;
+ CASE(ELECTRO_BEAM) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break;
+ CASE(GRENADE) self.traileffect = EFFECT_TR_GRENADE.m_id; break;
+ CASE(GRENADE_BOUNCING) self.traileffect = EFFECT_TR_GRENADE.m_id; break;
+ CASE(MINE) self.traileffect = EFFECT_TR_GRENADE.m_id; break;
+ CASE(BLASTER) self.traileffect = EFFECT_Null.m_id; break;
+ CASE(HLAC) self.traileffect = EFFECT_Null.m_id; break;
+ CASE(PORTO_RED) self.traileffect = EFFECT_TR_WIZSPIKE.m_id; self.scale = 4; break;
+ CASE(PORTO_BLUE) self.traileffect = EFFECT_TR_WIZSPIKE.m_id; self.scale = 4; break;
+ CASE(HOOKBOMB) self.traileffect = EFFECT_TR_KNIGHTSPIKE.m_id; break;
+ CASE(HAGAR) self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break;
+ CASE(HAGAR_BOUNCING) self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break;
CASE(NAPALM_FOUNTAIN) // fallthrough // sself.modelindex = 0; self.traileffect = _particleeffectnum("torch_small"); break;
- CASE(FIREBALL) self.modelindex = 0; self.traileffect = particleeffectnum(EFFECT_FIREBALL); break; // particle effect is good enough
- CASE(FIREMINE) self.modelindex = 0; self.traileffect = particleeffectnum(EFFECT_FIREMINE); break; // particle effect is good enough
- CASE(TAG) self.traileffect = particleeffectnum(EFFECT_TR_ROCKET); break;
- CASE(FLAC) self.scale = 0.4; self.traileffect = particleeffectnum(EFFECT_FLAC_TRAIL); break;
- CASE(SEEKER) self.traileffect = particleeffectnum(EFFECT_SEEKER_TRAIL); break;
+ CASE(FIREBALL) self.modelindex = 0; self.traileffect = EFFECT_FIREBALL.m_id; break; // particle effect is good enough
+ CASE(FIREMINE) self.modelindex = 0; self.traileffect = EFFECT_FIREMINE.m_id; break; // particle effect is good enough
+ CASE(TAG) self.traileffect = EFFECT_TR_ROCKET.m_id; break;
+ CASE(FLAC) self.scale = 0.4; self.traileffect = EFFECT_FLAC_TRAIL.m_id; break;
+ CASE(SEEKER) self.traileffect = EFFECT_SEEKER_TRAIL.m_id; break;
- CASE(MAGE_SPIKE) self.traileffect = particleeffectnum(EFFECT_TR_VORESPIKE); break;
- CASE(SHAMBLER_LIGHTNING) self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
+ CASE(MAGE_SPIKE) self.traileffect = EFFECT_TR_VORESPIKE.m_id; break;
+ CASE(SHAMBLER_LIGHTNING) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break;
- CASE(RAPTORBOMB) self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(EFFECT_Null); break;
- CASE(RAPTORBOMBLET) self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(EFFECT_Null); break;
- CASE(RAPTORCANNON) self.traileffect = particleeffectnum(EFFECT_TR_CRYLINKPLASMA); break;
+ CASE(RAPTORBOMB) self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = EFFECT_Null.m_id; break;
+ CASE(RAPTORBOMBLET) self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = EFFECT_Null.m_id; break;
+ CASE(RAPTORCANNON) self.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break;
- CASE(SPIDERROCKET) self.traileffect = particleeffectnum(EFFECT_SPIDERBOT_ROCKET_TRAIL); break;
- CASE(WAKIROCKET) self.traileffect = particleeffectnum(EFFECT_RACER_ROCKET_TRAIL); break;
- CASE(WAKICANNON) self.traileffect = particleeffectnum(EFFECT_Null); break;
+ CASE(SPIDERROCKET) self.traileffect = EFFECT_SPIDERBOT_ROCKET_TRAIL.m_id; break;
+ CASE(WAKIROCKET) self.traileffect = EFFECT_RACER_ROCKET_TRAIL.m_id; break;
+ CASE(WAKICANNON) self.traileffect = EFFECT_Null.m_id; break;
- CASE(BUMBLE_GUN) self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
- CASE(BUMBLE_BEAM) self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
+ CASE(BUMBLE_GUN) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break;
+ CASE(BUMBLE_BEAM) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break;
- CASE(RPC) self.traileffect = particleeffectnum(EFFECT_TR_ROCKET); break;
+ CASE(RPC) self.traileffect = EFFECT_TR_ROCKET.m_id; break;
- CASE(ROCKETMINSTA_LASER) self.traileffect = particleeffectnum(EFFECT_ROCKETMINSTA_LASER(self.team)); break;
+ CASE(ROCKETMINSTA_LASER) self.traileffect = EFFECT_ROCKETMINSTA_LASER(self.team).m_id; break;
#undef CASE
default:
if(MUTATOR_CALLHOOK(Ent_Projectile, self))
if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
{
setmodel(self, MDL_PROJECTILE_NADE);
- string trail = Nade_TrailEffect(self.cnt, self.team);
- if (trail) self.traileffect = _particleeffectnum(trail);
+ entity trail = Nade_TrailEffect(self.cnt, self.team);
+ if (trail.eent_eff_name) self.traileffect = trail.m_id;
break;
}
error("Received invalid CSQC projectile, can't work with this!");
CSQCMODEL_PROPERTY(512, float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
CSQCMODEL_ENDIF \
CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
+ CSQCMODEL_PROPERTY(2048, int, ReadByte, WriteByte, traileffect) \
CSQCMODEL_PROPERTY_SCALED(4096, float, ReadByte, WriteByte, scale, 16, 0, 255) \
CSQCMODEL_PROPERTY(8192, int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
CSQCMODEL_PROPERTY(16384, TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME)
if(!((self.flags & FL_FLY) || (self.flags & FL_SWIM)))
self.velocity = '0 0 0';
- CSQCModel_UnlinkEntity();
+ CSQCModel_UnlinkEntity(self);
MON_ACTION(self.monsterid, MR_DEATH);
ATTRIB(Nade, m_name, string, _("Grenade"))
ATTRIB(Nade, m_icon, string, "nade_normal")
ATTRIBARRAY(Nade, m_projectile, int, 2)
- ATTRIBARRAY(Nade, m_trail, string, 2)
+ ATTRIBARRAY(Nade, m_trail, entity, 2)
METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
}
REGISTER_NADE(NORMAL) {
this.m_color = '1 1 1';
- NADE_PROJECTILE(0, PROJECTILE_NADE, string_null);
- NADE_PROJECTILE(1, PROJECTILE_NADE_BURN, string_null);
+ NADE_PROJECTILE(0, PROJECTILE_NADE, EFFECT_Null);
+ NADE_PROJECTILE(1, PROJECTILE_NADE_BURN, EFFECT_Null);
}
REGISTER_NADE(NAPALM) {
this.m_color = '2 0.5 0';
this.m_name = _("Napalm grenade");
this.m_icon = "nade_napalm";
- NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, "TR_ROCKET");
- NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, "spiderbot_rocket_thrust");
+ NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, EFFECT_TR_ROCKET);
+ NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, EFFECT_SPIDERBOT_ROCKET_TRAIL);
}
REGISTER_NADE(ICE) {
this.m_color = '0 0.5 2';
this.m_name = _("Ice grenade");
this.m_icon = "nade_ice";
- NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, "TR_NEXUIZPLASMA");
- NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, "wakizashi_rocket_thrust");
+ NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, EFFECT_TR_NEXUIZPLASMA);
+ NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, EFFECT_RACER_ROCKET_TRAIL);
}
REGISTER_NADE(TRANSLOCATE) {
this.m_color = '1 0 1';
this.m_name = _("Translocate grenade");
this.m_icon = "nade_translocate";
- NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, "TR_CRYLINKPLASMA");
- NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, "TR_CRYLINKPLASMA");
+ NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
+ NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
}
REGISTER_NADE(SPAWN) {
this.m_color = '1 0.9 0';
this.m_name = _("Spawn grenade");
this.m_icon = "nade_spawn";
- NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, "nade_yellow");
- NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, "nade_yellow");
+ NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
+ NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
}
REGISTER_NADE(HEAL) {
this.m_color = '1 0 0';
this.m_name = _("Heal grenade");
this.m_icon = "nade_heal";
- NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, "nade_red");
- NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, "nade_red_burn");
+ NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, EFFECT_NADE_TRAIL_RED);
+ NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, EFFECT_NADE_TRAIL_BURN_RED);
}
REGISTER_NADE(MONSTER) {
this.m_color = '0.25 0.75 0';
this.m_name = _("Monster grenade");
this.m_icon = "nade_monster";
- NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, "nade_red");
- NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, "nade_red_burn");
+ NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, EFFECT_NADE_TRAIL_RED);
+ NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, EFFECT_NADE_TRAIL_BURN_RED);
}
entity Nade_FromProjectile(float proj)
return NADE_TYPE_Null;
}
-string Nade_TrailEffect(int proj, float nade_team)
+entity Nade_TrailEffect(int proj, int nade_team)
{
- switch (proj)
- {
- case PROJECTILE_NADE: return EFFECT_NADE_TRAIL(nade_team).eent_eff_name;
- case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team).eent_eff_name;
- }
FOREACH(NADES, true, LAMBDA(
for (int j = 0; j < 2; j++)
{
if (it.m_projectile[j] == proj)
{
- string trail = it.m_trail[j];
- if (trail) return trail;
+ string trail = it.m_trail[j].eent_eff_name;
+ if (trail) return it.m_trail[j];
break;
}
}
));
- return string_null;
+ switch (proj)
+ {
+ case PROJECTILE_NADE: return EFFECT_NADE_TRAIL(nade_team);
+ case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team);
+ }
+ return EFFECT_Null;
}
#ifdef SVQC
MUTATOR_CALLHOOK(VehicleEnter, pl, veh);
setself(veh);
- CSQCModel_UnlinkEntity();
+ CSQCModel_UnlinkEntity(veh);
VEH_ACTION(veh.vehicleid, VR_ENTER);
setself(this);
{
entity oldself = self;
- CSQCModel_UnlinkEntity();
+ CSQCModel_UnlinkEntity(self);
// Hide beam
if(self.gun3.enemy || !wasfreed(self.gun3.enemy))
if(self.total_damages < time)
{
- boxparticles(self.traileffect, self, self.origin, self.origin + _dir * -64, _dir * -_len , _dir * -_len, 1, PARTICLES_USEALPHA);
+ boxparticles(particleeffectnum(effects_ent[self.traileffect]), self, self.origin, self.origin + _dir * -64, _dir * -_len , _dir * -_len, 1, PARTICLES_USEALPHA);
boxparticles(self.lip, self, self.move_origin, self.move_origin + _dir * -64, _dir * -200 , _dir * -200, 1, PARTICLES_USEALPHA);
self.total_damages = time + 0.1;
}
else
self.colormod = '0 1 0';
- self.traileffect = particleeffectnum(EFFECT_BUMBLEBEE_HEAL_MUZZLEFLASH);
+ self.traileffect = EFFECT_BUMBLEBEE_HEAL_MUZZLEFLASH.m_id;
self.lip = particleeffectnum(EFFECT_BUMBLEBEE_HEAL_IMPACT);
self.draw = bumble_raygun_draw;
self.frame = 10;
self.movetype = MOVETYPE_TOSS;
- CSQCModel_UnlinkEntity(); // networking the death scene would be a nightmare
+ CSQCModel_UnlinkEntity(self); // networking the death scene would be a nightmare
return true;
}
CSQCModel_CheckUpdate(e);
}
-void CSQCModel_UnlinkEntity()
-{SELFPARAM();
- self.SendEntity = func_null;
+void CSQCModel_UnlinkEntity(entity e)
+{
+ e.SendEntity = func_null;
}
void CSQCModel_CheckUpdate(entity e);
void CSQCModel_LinkEntity(entity e);
-void CSQCModel_UnlinkEntity();
+void CSQCModel_UnlinkEntity(entity e);
#define CSQCMODEL_IF(cond)
#define CSQCMODEL_ENDIF
{
//self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
if(!self.traileffectnum)
- self.traileffectnum = _particleeffectnum(Nade_TrailEffect(NADES[self.nade_type].m_projectile[false], self.team));
+ self.traileffectnum = _particleeffectnum(Nade_TrailEffect(NADES[self.nade_type].m_projectile[false], self.team).eent_eff_name);
self.alpha = 1;
}
//setattachment(n, self, "bip01 l hand");
n.exteriormodeltoclient = self;
n.customizeentityforclient = nade_customize;
- n.traileffectnum = _particleeffectnum(Nade_TrailEffect(NADES[n.nade_type].m_projectile[false], self.team));
+ n.traileffectnum = _particleeffectnum(Nade_TrailEffect(NADES[n.nade_type].m_projectile[false], self.team).eent_eff_name);
n.colormod = NADES[n.nade_type].m_color;
n.realowner = self;
n.colormap = self.colormap;