2 // increments sprite frame, loops when end is hit.. simple
5 void (vector vec) WriteVec =
7 WriteCoord (MSG_BROADCAST, vec_x);
8 WriteCoord (MSG_BROADCAST, vec_y);
9 WriteCoord (MSG_BROADCAST, vec_z);
11 void (vector org, vector dir, float counts) W_Smoke =
13 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
14 WriteByte (MSG_BROADCAST, TE_SMOKE);
17 WriteByte (MSG_BROADCAST, counts);
20 // increments sprite frame, loops when end is hit.. simple
21 void animate_sprite (float startframe, float frame_count)
23 if ((self.frame - startframe) >= (frame_count - 1 ))
24 self.frame = startframe;
26 self.frame = self.frame + 1;
29 void W_GiveWeapon (entity e, float wep, string name)
36 e.items = e.items | wep;
41 if (other.classname == "player")
43 sprint (other, "You got the ^2");
52 float W_CheckAmmo (void)
54 if (!cvar("g_use_ammunition"))
57 if (self.weapon == IT_LASER)
59 else if (self.currentammo)
65 void FireRailgunBullet (vector start, vector end, float bdamage, float deathtype)
67 local vector hitloc, force, endpoint, dir;
69 //local entity explosion;
71 dir = normalize(end - start);
72 force = dir * 800; //(bdamage * 10);
74 // go a little bit into the wall because we need to hit this wall later
77 // trace multiple times until we hit a wall, each obstacle will be made
78 // non-solid so we can hit the next, while doing this we spawn effects and
79 // note down which entities were hit so we can damage them later
82 traceline_hitcorpse (self, start, end, FALSE, self);
84 //if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
85 if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
86 te_plasmaburn (trace_endpos - dir * 6);
88 // if it is world we can't hurt it so stop now
89 if (trace_ent == world || trace_fraction == 1)
92 // make the entity non-solid so we can hit the next one
93 trace_ent.railgunhit = TRUE;
94 trace_ent.railgunhitloc = end;
95 trace_ent.railgunhitsolidbackup = trace_ent.solid;
97 // stop if this is a wall
98 if (trace_ent.solid == SOLID_BSP)
101 // make the entity non-solid
102 trace_ent.solid = SOLID_NOT;
105 endpoint = trace_endpos;
107 // find all the entities the railgun hit and restore their solid state
108 ent = findfloat(world, railgunhit, TRUE);
111 // restore their solid type
112 ent.solid = ent.railgunhitsolidbackup;
113 ent = findfloat(ent, railgunhit, TRUE);
116 // spawn a temporary explosion entity for RadiusDamage calls
117 //explosion = spawn();
119 // find all the entities the railgun hit and hurt them
120 ent = findfloat(world, railgunhit, TRUE);
123 // get the details we need to call the damage function
124 hitloc = ent.railgunhitloc;
125 ent.railgunhitloc = '0 0 0';
126 ent.railgunhitsolidbackup = SOLID_NOT;
127 ent.railgunhit = FALSE;
130 if (ent.takedamage || ent.classname == "case")
131 Damage (ent, self, self, bdamage, deathtype, hitloc, force);
133 // create a small explosion to throw gibs around (if applicable)
134 //setorigin (explosion, hitloc);
135 //RadiusDamage (explosion, self, 10, 0, 50, world, 300, deathtype);
137 // advance to the next entity
138 ent = findfloat(ent, railgunhit, TRUE);
141 // we're done with the explosion entity, remove it
144 trace_endpos = endpoint;
147 void fireBullet (vector start, vector dir, float spread, float damage, float dtype, float tracer)
153 // use traceline_hitcorpse to make sure it can hit gibs and corpses too
154 dir = dir + randomvec() * spread;
155 end = start + dir * 8192;
156 traceline_hitcorpse (self, start, end, FALSE, self);
162 e.movetype = MOVETYPE_FLY;
164 e.think = SUB_Remove;
165 e.nextthink = time + vlen(trace_endpos - start) / 6000;
166 e.velocity = dir * 6000;
167 e.angles = vectoangles(e.velocity);
168 setmodel (e, "models/tracer.mdl");
169 setsize (e, '0 0 0', '0 0 0');
170 setorigin (e, start);
171 e.effects = e.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_NOSHADOW;
172 e.flags = FL_PROJECTILE;
175 if ((trace_fraction != 1.0) && (pointcontents (trace_endpos) != CONTENT_SKY))
177 if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
179 if (dtype == IT_SHOTGUN)
180 te_gunshot (trace_endpos);
182 te_spike (trace_endpos);
185 PointSound (trace_endpos, "weapons/ric1.ogg", 1, ATTN_NORM);
187 PointSound (trace_endpos, "weapons/ric2.ogg", 1, ATTN_NORM);
189 PointSound (trace_endpos, "weapons/ric3.ogg", 1, ATTN_NORM);
191 //else if (trace_ent.classname == "player" || trace_ent.classname == "corpse" || trace_ent.classname == "gib")
192 //stuffcmd(self, "play2 misc/hit.wav\n");
193 //sound (self, CHAN_BODY, "misc/hit.wav", 1, ATTN_NORM);
194 Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * damage * 5);