Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "../../progs.h"
- #include "../../common/util-pre.hpp"
- #include "../../dpdefs/csprogsdefs.hpp"
- #include "../announcer.cpp"
- #include "../bgmscript.cpp"
- #include "../casings.cpp"
- #include "../csqcmodel_hooks.cpp"
- #include "../damage.cpp"
- #include "../effects.cpp"
- #include "../gibs.cpp"
- #include "../hook.cpp"
- #include "../hud_config.cpp"
- #include "../hud.cpp"
- #include "../laser.cpp"
- #include "../main.cpp"
- #include "../mapvoting.cpp"
- #include "../miscfunctions.cpp"
- #include "../modeleffects.cpp"
- #include "../movetypes.cpp"
- #include "../noise.cpp"
- #include "../particles.cpp"
- #include "../player_skeleton.cpp"
- #include "../prandom.cpp"
- #include "../rubble.cpp"
- #include "../scoreboard.cpp"
- #include "../shownames.cpp"
- #include "../sortlist.cpp"
- #include "../target_music.cpp"
- #include "../teamradar.cpp"
- #include "../tturrets.cpp"
- #include "../tuba.cpp"
- #include "../vehicles/vehicles.cpp"
- #include "../view.cpp"
- #include "../wall.cpp"
- #include "../waypointsprites.cpp"
- #include "../command/cl_cmd.cpp"
- namespace xon {
- void SUB_Stop() {
- self[move_velocity] = self[move_avelocity] = Vector(x=0.0, y=0.0, z=0.0);
- self[move_movetype] = MOVETYPE_NONE;
- };
- void Projectile_ResetTrail(vector to) {
- self[trail_oldorigin] = to;
- self[trail_oldtime] = time;
- };
- void Projectile_DrawTrail(vector to) {
- from;
- float t0;
- from = self[trail_oldorigin];
- t0 = self[trail_oldtime];
- self[trail_oldorigin] = to;
- self[trail_oldtime] = time;
- if (self[cnt] == PROJECTILE_FIREMINE) if (from == to) from[z] += (int) 1.0;
- if (self[traileffect]) {
- particles_alphamin = particles_alphamax = particles_fade = sqrt(self[alpha]);
- boxparticles(self[traileffect], self, from, to, self[velocity], self[velocity], (int) 1.0, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
- };
- };
- void Projectile_Draw() {
- rot;
- trailorigin;
- int f;
- bool drawn;
- float t;
- float a;
- f = self[move_flags];
- if (self[count] & 128.0) {
- if (self[move_movetype] == MOVETYPE_NONE || self[move_movetype] == MOVETYPE_FLY) Movetype_Physics_NoMatchServer() else Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
- if (!self[move_flags] & FL_ONGROUND) if (self[velocity] != Vector(x=0.0, y=0.0, z=0.0)) self[move_angles] = self[angles] = vectoangles(self[velocity]);
- } else {
- InterpolateOrigin_Do();
- };
- if (self[count] & 128.0) {
- drawn = time >= self[spawntime] - 0.02;
- t = max(time, self[spawntime]);
- } else {
- drawn = self[iflags] & IFLAG_VALID;
- t = time;
- };
- if (!f & FL_ONGROUND) {
- rot = Vector(x=0.0, y=0.0, z=0.0);
- switch (self[cnt]) {
- {
- case PROJECTILE_GRENADE_BOUNCING:;
- rot = Vector(x=0.0, y=-1000.0, z=0.0);
- break;
- case PROJECTILE_HOOKBOMB:;
- rot = Vector(x=1000.0, y=0.0, z=0.0);
- break;
- default:;
- break;
- };
- };
- if (Nade_IDFromProjectile(self[cnt]) != (int) 0.0) rot = self[avelocity];
- self[angles] = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(self[angles]), rot * t - self[spawntime]));
- };
- ang;
- ang = self[angles];
- ang[x] = -ang[x];
- makevectors(ang);
- a = (int) 1.0 - time - self[fade_time] * self[fade_rate];
- self[alpha] = bound((int) 0.0, self[alphamod] * a, (int) 1.0);
- if (self[alpha] <= (int) 0.0) drawn = (int) 0.0;
- self[renderflags] = (int) 0.0;
- trailorigin = self[origin];
- switch (self[cnt]) {
- {
- case PROJECTILE_GRENADE:;
- case PROJECTILE_GRENADE_BOUNCING:;
- trailorigin += v_right * (int) 1.0 + v_forward * -(int) 10.0;
- break;
- default:;
- break;
- };
- };
- if (Nade_IDFromProjectile(self[cnt]) != (int) 0.0) trailorigin += v_up * (int) 4.0;
- if (drawn) Projectile_DrawTrail(trailorigin) else Projectile_ResetTrail(trailorigin);
- self[drawmask] = (int) 0.0;
- if (!drawn) return;
- switch (self[cnt]) {
- {
- default:;
- break;
- };
- };
- self[drawmask] = MASK_NORMAL;
- };
- void loopsound(entity e, int ch, string samp, float vol, float attn) {
- if (self[silent]) return;
- sound7(e, ch, samp, vol, attn, (int) 0.0, (int) 0.0);
- e[snd_looping] = ch;
- };
- void Ent_RemoveProjectile() {
- if (self[count] & 128.0) {
- tracebox(self[origin], self[mins], self[maxs], self[origin] + self[velocity] * 0.05, MOVE_NORMAL, self);
- Projectile_DrawTrail(trace_endpos);
- };
- };
- void Ent_Projectile() {
- int f;
- f = ReadByte();
- self[count] = f & 128.0;
- self[iflags] = self[iflags] & IFLAG_VALID | IFLAG_PREVALID | IFLAG_AUTOANGLES | IFLAG_ANGLES | IFLAG_ORIGIN;
- self[solid] = SOLID_TRIGGER;
- self[move_nomonsters] = MOVE_WORLDONLY;
- if (f & 64.0) self[move_flags] |= FL_ONGROUND else self[move_flags] &= ~FL_ONGROUND;
- if (!self[move_time]) {
- self[move_time] = time;
- self[spawntime] = time;
- } else self[move_time] = max(self[move_time], time);
- if (!self[count] & 128.0) InterpolateOrigin_Undo();
- if (f & (int) 1.0) {
- self[origin][x] = ReadCoord();
- self[origin][y] = ReadCoord();
- self[origin][z] = ReadCoord();
- setorigin(self, self[origin]);
- if (self[count] & 128.0) {
- self[velocity][x] = ReadCoord();
- self[velocity][y] = ReadCoord();
- self[velocity][z] = ReadCoord();
- if (f & 16.0) self[gravity] = ReadCoord() else self[gravity] = (int) 0.0;
- self[move_origin] = self[origin];
- self[move_velocity] = self[velocity];
- };
- if (time == self[spawntime] || self[count] & 128.0 || f & 8.0) {
- self[trail_oldorigin] = self[origin];
- if (!self[count] & 128.0) InterpolateOrigin_Reset();
- };
- if (f & 32.0) {
- self[fade_time] = time + ReadByte() * ticrate;
- self[fade_rate] = (int) 1.0 / ReadByte() * ticrate;
- } else {
- self[fade_time] = (int) 0.0;
- self[fade_rate] = (int) 0.0;
- };
- self[team] = ReadByte() - (int) 1.0;
- };
- if (f & (int) 2.0) {
- self[cnt] = ReadByte();
- self[silent] = self[cnt] & 128.0;
- self[cnt] = self[cnt] & 127.0;
- self[scale] = (int) 1.0;
- self[traileffect] = (int) 0.0;
- switch (self[cnt]) {
- {
- case PROJECTILE_ELECTRO:;
- setmodel(self, models/ebomb.mdl);
- self[traileffect] = particleeffectnum(TR_NEXUIZPLASMA);
- break;
- case PROJECTILE_ROCKET:;
- setmodel(self, models/rocket.md3);
- self[traileffect] = particleeffectnum(TR_ROCKET);
- self[scale] = (int) 2.0;
- break;
- case PROJECTILE_CRYLINK:;
- setmodel(self, models/plasmatrail.mdl);
- self[traileffect] = particleeffectnum(TR_CRYLINKPLASMA);
- break;
- case PROJECTILE_CRYLINK_BOUNCING:;
- setmodel(self, models/plasmatrail.mdl);
- self[traileffect] = particleeffectnum(TR_CRYLINKPLASMA);
- break;
- case PROJECTILE_ELECTRO_BEAM:;
- setmodel(self, models/elaser.mdl);
- self[traileffect] = particleeffectnum(TR_NEXUIZPLASMA);
- break;
- case PROJECTILE_GRENADE:;
- setmodel(self, models/grenademodel.md3);
- self[traileffect] = particleeffectnum(TR_GRENADE);
- break;
- case PROJECTILE_GRENADE_BOUNCING:;
- setmodel(self, models/grenademodel.md3);
- self[traileffect] = particleeffectnum(TR_GRENADE);
- break;
- case PROJECTILE_MINE:;
- setmodel(self, models/mine.md3);
- self[traileffect] = particleeffectnum(TR_GRENADE);
- break;
- case PROJECTILE_BLASTER:;
- setmodel(self, models/laser.mdl);
- self[traileffect] = particleeffectnum();
- break;
- case PROJECTILE_HLAC:;
- setmodel(self, models/hlac_bullet.md3);
- self[traileffect] = particleeffectnum();
- break;
- case PROJECTILE_PORTO_RED:;
- setmodel(self, models/grenademodel.md3);
- self[traileffect] = particleeffectnum(TR_WIZSPIKE);
- self[scale] = (int) 4.0;
- break;
- case PROJECTILE_PORTO_BLUE:;
- setmodel(self, models/grenademodel.md3);
- self[traileffect] = particleeffectnum(TR_WIZSPIKE);
- self[scale] = (int) 4.0;
- break;
- case PROJECTILE_HOOKBOMB:;
- setmodel(self, models/grenademodel.md3);
- self[traileffect] = particleeffectnum(TR_KNIGHTSPIKE);
- break;
- case PROJECTILE_HAGAR:;
- setmodel(self, models/hagarmissile.mdl);
- self[traileffect] = particleeffectnum(tr_hagar);
- self[scale] = 0.75;
- break;
- case PROJECTILE_HAGAR_BOUNCING:;
- setmodel(self, models/hagarmissile.mdl);
- self[traileffect] = particleeffectnum(tr_hagar);
- self[scale] = 0.75;
- break;
- case PROJECTILE_NAPALM_FOUNTAIN:;
- case PROJECTILE_FIREBALL:;
- self[model] = ;
- self[modelindex] = (int) 0.0;
- self[traileffect] = particleeffectnum(fireball);
- break;
- case PROJECTILE_FIREMINE:;
- self[model] = ;
- self[modelindex] = (int) 0.0;
- self[traileffect] = particleeffectnum(firemine);
- break;
- case PROJECTILE_TAG:;
- setmodel(self, models/laser.mdl);
- self[traileffect] = particleeffectnum(TR_ROCKET);
- break;
- case PROJECTILE_FLAC:;
- setmodel(self, models/hagarmissile.mdl);
- self[scale] = 0.4;
- self[traileffect] = particleeffectnum(TR_SEEKER);
- break;
- case PROJECTILE_SEEKER:;
- setmodel(self, models/tagrocket.md3);
- self[traileffect] = particleeffectnum(TR_SEEKER);
- break;
- case PROJECTILE_MAGE_SPIKE:;
- setmodel(self, models/ebomb.mdl);
- self[traileffect] = particleeffectnum(TR_VORESPIKE);
- break;
- case PROJECTILE_SHAMBLER_LIGHTNING:;
- setmodel(self, models/ebomb.mdl);
- self[traileffect] = particleeffectnum(TR_NEXUIZPLASMA);
- break;
- case PROJECTILE_RAPTORBOMB:;
- setmodel(self, models/vehicles/clusterbomb.md3);
- self[gravity] = (int) 1.0;
- self[avelocity] = Vector(x=0.0, y=0.0, z=180.0);
- self[traileffect] = particleeffectnum();
- break;
- case PROJECTILE_RAPTORBOMBLET:;
- setmodel(self, models/vehicles/bomblet.md3);
- self[gravity] = (int) 1.0;
- self[avelocity] = Vector(x=0.0, y=0.0, z=180.0);
- self[traileffect] = particleeffectnum();
- break;
- case PROJECTILE_RAPTORCANNON:;
- setmodel(self, models/plasmatrail.mdl);
- self[traileffect] = particleeffectnum(TR_CRYLINKPLASMA);
- break;
- case PROJECTILE_SPIDERROCKET:;
- setmodel(self, models/vehicles/rocket02.md3);
- self[traileffect] = particleeffectnum(spiderbot_rocket_thrust);
- break;
- case PROJECTILE_WAKIROCKET:;
- setmodel(self, models/vehicles/rocket01.md3);
- self[traileffect] = particleeffectnum(wakizashi_rocket_thrust);
- break;
- case PROJECTILE_WAKICANNON:;
- setmodel(self, models/laser.mdl);
- self[traileffect] = particleeffectnum();
- break;
- case PROJECTILE_BUMBLE_GUN:;
- setmodel(self, models/elaser.mdl);
- self[traileffect] = particleeffectnum(TR_NEXUIZPLASMA);
- break;
- case PROJECTILE_BUMBLE_BEAM:;
- setmodel(self, models/elaser.mdl);
- self[traileffect] = particleeffectnum(TR_NEXUIZPLASMA);
- break;
- case PROJECTILE_RPC:;
- setmodel(self, models/weapons/ok_rocket.md3);
- self[traileffect] = particleeffectnum(TR_ROCKET);
- break;
- default:;
- if (Nade_IDFromProjectile(self[cnt]) != (int) 0.0) {
- 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!);
- break;
- };
- };
- self[mins] = Vector(x=0.0, y=0.0, z=0.0);
- self[maxs] = Vector(x=0.0, y=0.0, z=0.0);
- self[colormod] = Vector(x=0.0, y=0.0, z=0.0);
- self[move_touch] = SUB_Stop;
- self[move_movetype] = MOVETYPE_TOSS;
- self[alphamod] = (int) 1.0;
- switch (self[cnt]) {
- {
- case PROJECTILE_ELECTRO:;
- loopsound(self, CH_SHOTS_SINGLE, weapons/electro_fly.wav, VOL_BASE, ATTEN_NORM);
- self[mins] = Vector(x=0.0, y=0.0, z=-4.0);
- self[maxs] = Vector(x=0.0, y=0.0, z=-4.0);
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- self[move_bounce_factor] = g_balance_electro_secondary_bouncefactor;
- self[move_bounce_stopspeed] = g_balance_electro_secondary_bouncestop;
- break;
- case PROJECTILE_RPC:;
- case PROJECTILE_ROCKET:;
- loopsound(self, CH_SHOTS_SINGLE, weapons/rocket_fly.wav, VOL_BASE, ATTEN_NORM);
- self[mins] = Vector(x=-3.0, y=-3.0, z=-3.0);
- self[maxs] = Vector(x=3.0, y=3.0, z=3.0);
- break;
- case PROJECTILE_GRENADE:;
- self[mins] = Vector(x=-3.0, y=-3.0, z=-3.0);
- self[maxs] = Vector(x=3.0, y=3.0, z=3.0);
- break;
- case PROJECTILE_GRENADE_BOUNCING:;
- self[mins] = Vector(x=-3.0, y=-3.0, z=-3.0);
- self[maxs] = Vector(x=3.0, y=3.0, z=3.0);
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- self[move_bounce_factor] = g_balance_mortar_bouncefactor;
- self[move_bounce_stopspeed] = g_balance_mortar_bouncestop;
- break;
- case PROJECTILE_SHAMBLER_LIGHTNING:;
- self[mins] = Vector(x=-8.0, y=-8.0, z=-8.0);
- self[maxs] = Vector(x=8.0, y=8.0, z=8.0);
- self[scale] = 2.5;
- self[avelocity] = randomvec() * (int) 720.0;
- break;
- case PROJECTILE_MINE:;
- self[mins] = Vector(x=-4.0, y=-4.0, z=-4.0);
- self[maxs] = Vector(x=4.0, y=4.0, z=4.0);
- break;
- case PROJECTILE_PORTO_RED:;
- self[colormod] = Vector(x=2.0, y=1.0, z=1.0);
- self[alphamod] = 0.5;
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- break;
- case PROJECTILE_PORTO_BLUE:;
- self[colormod] = Vector(x=1.0, y=1.0, z=2.0);
- self[alphamod] = 0.5;
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- break;
- case PROJECTILE_HAGAR_BOUNCING:;
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- break;
- case PROJECTILE_CRYLINK_BOUNCING:;
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- break;
- case PROJECTILE_NAPALM_FOUNTAIN:;
- case PROJECTILE_FIREBALL:;
- loopsound(self, CH_SHOTS_SINGLE, weapons/fireball_fly2.wav, VOL_BASE, ATTEN_NORM);
- self[mins] = Vector(x=-16.0, y=-16.0, z=-16.0);
- self[maxs] = Vector(x=16.0, y=16.0, z=16.0);
- break;
- case PROJECTILE_FIREMINE:;
- loopsound(self, CH_SHOTS_SINGLE, weapons/fireball_fly.wav, VOL_BASE, ATTEN_NORM);
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- self[mins] = Vector(x=-4.0, y=-4.0, z=-4.0);
- self[maxs] = Vector(x=4.0, y=4.0, z=4.0);
- break;
- case PROJECTILE_TAG:;
- self[mins] = Vector(x=-2.0, y=-2.0, z=-2.0);
- self[maxs] = Vector(x=2.0, y=2.0, z=2.0);
- break;
- case PROJECTILE_FLAC:;
- self[mins] = Vector(x=-2.0, y=-2.0, z=-2.0);
- self[maxs] = Vector(x=2.0, y=2.0, z=2.0);
- break;
- case PROJECTILE_SEEKER:;
- loopsound(self, CH_SHOTS_SINGLE, weapons/tag_rocket_fly.wav, VOL_BASE, ATTEN_NORM);
- self[mins] = Vector(x=-4.0, y=-4.0, z=-4.0);
- self[maxs] = Vector(x=4.0, y=4.0, z=4.0);
- break;
- case PROJECTILE_RAPTORBOMB:;
- self[mins] = Vector(x=-3.0, y=-3.0, z=-3.0);
- self[maxs] = Vector(x=3.0, y=3.0, z=3.0);
- break;
- case PROJECTILE_RAPTORBOMBLET:;
- break;
- case PROJECTILE_RAPTORCANNON:;
- break;
- case PROJECTILE_SPIDERROCKET:;
- loopsound(self, CH_SHOTS_SINGLE, weapons/tag_rocket_fly.wav, VOL_BASE, ATTEN_NORM);
- break;
- case PROJECTILE_WAKIROCKET:;
- loopsound(self, CH_SHOTS_SINGLE, weapons/tag_rocket_fly.wav, VOL_BASE, ATTEN_NORM);
- break;
- default:;
- break;
- };
- };
- if (Nade_IDFromProjectile(self[cnt]) != (int) 0.0) {
- int nade_type;
- int nade_type = Nade_IDFromProjectile(self[cnt]);
- self[mins] = Vector(x=-16.0, y=-16.0, z=-16.0);
- self[maxs] = Vector(x=16.0, y=16.0, z=16.0);
- self[colormod] = Nade_Color(nade_type);
- self[move_movetype] = MOVETYPE_BOUNCE;
- self[move_touch] = func_null;
- self[scale] = 1.5;
- self[avelocity] = randomvec() * (int) 720.0;
- if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN) self[dphitcontentsmask] = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP else self[dphitcontentsmask] = DPCONTENTS_SOLID | DPCONTENTS_BODY;
- };
- setsize(self, self[mins], self[maxs]);
- };
- if (self[gravity]) {
- if (self[move_movetype] == MOVETYPE_FLY) self[move_movetype] = MOVETYPE_TOSS;
- if (self[move_movetype] == MOVETYPE_BOUNCEMISSILE) self[move_movetype] = MOVETYPE_BOUNCE;
- } else {
- if (self[move_movetype] == MOVETYPE_TOSS) self[move_movetype] = MOVETYPE_FLY;
- if (self[move_movetype] == MOVETYPE_BOUNCE) self[move_movetype] = MOVETYPE_BOUNCEMISSILE;
- };
- if (!self[count] & 128.0) InterpolateOrigin_Note();
- self[draw] = Projectile_Draw;
- self[entremove] = Ent_RemoveProjectile;
- };
- void Projectile_Precache() {
- precache_model(models/ebomb.mdl);
- precache_model(models/elaser.mdl);
- precache_model(models/grenademodel.md3);
- precache_model(models/mine.md3);
- precache_model(models/hagarmissile.mdl);
- precache_model(models/hlac_bullet.md3);
- precache_model(models/laser.mdl);
- precache_model(models/plasmatrail.mdl);
- precache_model(models/rocket.md3);
- precache_model(models/tagrocket.md3);
- precache_model(models/tracer.mdl);
- precache_model(models/sphere/sphere.md3);
- precache_model(models/weapons/v_ok_grenade.md3);
- precache_model(models/weapons/ok_rocket.md3);
- precache_sound(weapons/electro_fly.wav);
- precache_sound(weapons/rocket_fly.wav);
- precache_sound(weapons/fireball_fly.wav);
- precache_sound(weapons/fireball_fly2.wav);
- precache_sound(weapons/tag_rocket_fly.wav);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement