]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/cl_weaponsystem.qc
change all function declarations (except builtins and data types) to ANSI C-like...
[divverent/nexuiz.git] / data / qcsrc / server / cl_weaponsystem.qc
1 /*
2 ===========================================================================
3
4   CLIENT WEAPONSYSTEM CODE
5   Bring back W_Weaponframe
6
7 ===========================================================================
8 */
9
10 .float antilag_debug;
11
12 // VorteX: static frame globals
13 float WFRAME_FIRE1 = 0;
14 float WFRAME_FIRE2 = 1;
15 float WFRAME_IDLE = 2;
16
17 void(float fr, float t, void() func) weapon_thinkf;
18
19 vector w_shotorg;
20 vector w_shotdir;
21
22 // this function calculates w_shotorg and w_shotdir based on the weapon model
23 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
24 // make sure you call makevectors first (FIXME?)
25 void W_SetupShot(entity ent, vector vecs, float antilag, float recoil, string snd)
26 {
27         float nudge = 1; // added to traceline target and subtracted from result
28         local vector trueaimpoint;
29         local float oldsolid;
30         oldsolid = self.solid;
31         self.solid = SOLID_BBOX; // make all shot test traces bypass playerclip
32         traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NOMONSTERS, self);
33         trueaimpoint = trace_endpos;
34
35         if (cvar("g_shootfromeye"))
36                 w_shotorg = ent.origin + ent.view_ofs;
37         else if (cvar("g_shootfromcenter"))
38                 w_shotorg = ent.origin + ent.view_ofs + '0 0 1' * vecs_z;
39         else
40                 w_shotorg = ent.origin + ent.view_ofs + v_right * vecs_y + v_up * vecs_z;
41         // now move the shotorg forward as much as requested if possible
42         traceline(w_shotorg, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, self);
43         w_shotorg = trace_endpos - v_forward * nudge;
44         // calculate the shotdir from the chosen shotorg
45         w_shotdir = normalize(trueaimpoint - w_shotorg);
46
47         // explanation of g_antilag:
48         // if client reports it was aiming at a player, and the serverside trace
49         // says it would miss, change the aim point to the player's new origin,
50         // but only if the shot at the player's new origin would hit of course
51         //
52         // FIXME: a much better method for bullet weapons would be to leave a
53         // trail of lagged 'ghosts' behind players, and see if the bullet hits the
54         // ghost corresponding to this player's ping time, and if so it would do
55         // damage to the real player
56         if (antilag)
57         if (self.cursor_trace_ent)                 // client was aiming at someone
58         if (self.cursor_trace_ent != self)         // just to make sure
59         if (self.cursor_trace_ent.takedamage)      // and that person is killable
60         if (self.cursor_trace_ent.classname == "player") // and actually a player
61         if (cvar("g_antilag") == 1)
62         {
63                 // verify that the shot would miss without antilag
64                 // (avoids an issue where guns would always shoot at their origin)
65                 traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
66                 if (!trace_ent.takedamage)
67                 {
68                         // verify that the shot would hit if altered
69                         traceline(w_shotorg, self.cursor_trace_ent.origin, MOVE_NORMAL, self);
70                         if (trace_ent == self.cursor_trace_ent)
71                         {
72                                 // verify that the shot would hit in the past
73                                 if(self.antilag_debug)
74                                         antilag_takeback(self.cursor_trace_ent, time - self.antilag_debug);
75                                 else
76                                         antilag_takeback(self.cursor_trace_ent, time - self.ping * 0.001);
77
78                                 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
79                                 antilag_restore(self.cursor_trace_ent);
80
81                                 if(trace_ent == self.cursor_trace_ent)
82                                 {
83                                         // HIT!
84                                         w_shotdir = normalize(self.cursor_trace_ent.origin - w_shotorg);
85                                         dprint("ANTILAG HIT for ", self.netname, "\n");
86                                 }
87                                 else
88                                 {
89                                         // prydon cursor aimbot or odd network conditions
90                                         dprint("WARNING: antilag ghost trace for ", self.netname, " failed!\n");
91                                 }
92
93                                 if(cvar("developer") >= 2)
94                                 {
95                                         vector v, vplus, vel;
96                                         float X;
97                                         v     = antilag_takebackorigin(self.cursor_trace_ent, time - (self.ping * 0.001       ));
98                                         vplus = antilag_takebackorigin(self.cursor_trace_ent, time - (self.ping * 0.001 + 0.01));
99                                         vel = (vplus - v) * (1 / 0.01);
100                                         // solve: v + X * vel = closest to self.origin + self.view_ofs, v_forward axis
101                                         v     -= (self.origin + self.view_ofs);
102                                         // solve: v + X * vel = closest to v_forward axis
103                                         // project into 2D by subtracting v_forward components:
104                                         v   -= (v   * v_forward) * v_forward;
105                                         vel -= (vel * v_forward) * v_forward;
106                                         // solve: v + X * vel = closest to origin
107                                         // (v + X * vel)^2 closest to 0
108                                         // v^2 + 2 * X * (v * vel) + X^2 * vel^2 closest to 0
109                                         X = -(v * vel) / (vel * vel);
110                                         dprint("dead center needs adjustment of ", ftos(X * 1000), " (that is, ", ftos(self.ping + X * 1000), " instead of ", ftos(self.ping), "\n");
111                                 }
112                         }
113                 }
114         }
115
116         self.solid = oldsolid; // restore solid type (generally SOLID_SLIDEBOX)
117
118         if (!g_norecoil)
119                 self.punchangle_x = recoil * -1;
120
121         if (snd != "")
122                 sound (self, CHAN_WEAPON, snd, 1, ATTN_NORM);
123
124         if (self.items & IT_STRENGTH)
125         if (!g_minstagib)
126                 sound (self, CHAN_AUTO, "weapons/strength_fire.wav", 1, ATTN_NORM);
127 };
128
129 void LaserTarget_Think()
130 {
131         entity e;
132         vector offset;
133         float uselaser;
134         uselaser = 0;
135
136         // list of weapons that will use the laser, and the options that enable it
137         if(self.owner.laser_on && self.owner.weapon == WEP_ROCKET_LAUNCHER && g_laserguided_missile)
138                 uselaser = 1;
139         // example
140         //if(self.owner.weapon == WEP_ELECTRO && cvar("g_laserguided_electro"))
141         //      uselaser = 1;
142
143
144
145         // if a laser-enabled weapon isn't selected, delete any existing laser and quit
146         if(!uselaser)
147         {
148                 // rocket launcher isn't selected, so no laser target.
149                 if(self.lasertarget != world)
150                 {
151                         remove(self.lasertarget);
152                         self.lasertarget = world;
153                 }
154                 return;
155         }
156
157         if(!self.lasertarget)
158         {
159                 // we don't have a lasertarget entity, so spawn one
160                 //bprint("create laser target\n");
161                 e = self.lasertarget = spawn();
162                 e.owner = self.owner;                   // Its owner is my owner
163                 e.classname = "laser_target";
164                 e.movetype = MOVETYPE_NOCLIP;   // don't touch things
165                 setmodel(e, "models/laser_dot.mdl");    // what it looks like, precision set below
166                 e.scale = 1.25;                         // make it larger
167                 e.alpha = 0.25;                         // transparency
168                 e.colormod = '255 0 0' * (1/255) * 8;   // change colors
169                 e.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
170                 // make it dynamically glow
171                 // you should avoid over-using this, as it can slow down the player's computer.
172                 e.glow_color = 251; // red color
173                 e.glow_size = 12;
174         }
175         else
176                 e = self.lasertarget;
177
178         // move the laser dot to where the player is looking
179
180         makevectors(self.owner.v_angle); // set v_forward etc to the direction the player is looking
181         offset = '0 0 26' + v_right*3;
182         traceline(self.owner.origin + offset, self.owner.origin + offset + v_forward * MAX_SHOT_DISTANCE, FALSE, self); // trace forward until you hit something, like a player or wall
183         setorigin(e, trace_endpos + v_forward*8); // move me to where the traceline ended
184         if(trace_plane_normal != '0 0 0')
185                 e.angles = vectoangles(trace_plane_normal);
186         else
187                 e.angles = vectoangles(v_forward);
188 }
189
190 float CL_Weaponentity_CustomizeEntityForClient()
191 {
192         self.viewmodelforclient = self.owner;
193         if(other.classname == "spectator")
194                 if(other.enemy == self.owner)
195                         self.viewmodelforclient = other;
196         return TRUE;
197 }
198
199 .string weaponname;
200 void CL_Weaponentity_Think()
201 {
202         self.nextthink = time;
203         if (intermission_running)
204                 self.frame = WFRAME_IDLE;
205         if (self.owner.weaponentity != self)
206         {
207                 remove(self);
208                 return;
209         }
210         if (self.owner.deadflag != DEAD_NO)
211         {
212                 self.model = "";
213                 return;
214         }
215         if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag)
216         {
217                 self.cnt = self.owner.weapon;
218                 self.dmg = self.owner.modelindex;
219                 self.deadflag = self.owner.deadflag;
220                 if (self.owner.weaponname != "")
221                         setmodel(self, strcat("models/weapons/w_", self.owner.weaponname, ".zym")); // precision set below
222                 else
223                         self.model = "";
224         }
225         self.effects = self.owner.effects | EF_LOWPRECISION;
226         self.effects = self.effects - (self.effects & (EF_FULLBRIGHT)); // can mask team color, so get rid of it
227
228         if (self.flags & FL_FLY)
229                 // owner is currently being teleported, so don't apply EF_NODRAW otherwise the viewmodel would "blink"
230                 self.effects = self.effects - (self.effects & EF_NODRAW);
231
232         if(self.owner.alpha >= 0)
233                 self.alpha = self.owner.alpha;
234         else
235                 self.alpha = 1;
236         self.colormap = self.owner.colormap;
237
238         self.angles = '0 0 0';
239         local float f;
240         f = 0;
241         if (self.state == WS_RAISE)
242                 f = (self.owner.weapon_nextthink - time) / cvar("g_balance_weaponswitchdelay");
243         else if (self.state == WS_DROP)
244                 f = 1 - (self.owner.weapon_nextthink - time) / cvar("g_balance_weaponswitchdelay");
245         else if (self.state == WS_CLEAR)
246                 f = 1;
247         self.angles_x = -90 * f * f;
248
249         // create or update the lasertarget entity
250         LaserTarget_Think();
251 };
252
253 void CL_ExteriorWeaponentity_Think()
254 {
255         float tag_found;
256         self.nextthink = time;
257         if (self.owner.exteriorweaponentity != self)
258         {
259                 remove(self);
260                 return;
261         }
262         if (self.owner.deadflag != DEAD_NO)
263         {
264                 self.model = "";
265                 return;
266         }
267         if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag)
268         {
269                 self.cnt = self.owner.weapon;
270                 self.dmg = self.owner.modelindex;
271                 self.deadflag = self.owner.deadflag;
272                 if (self.owner.weaponname != "")
273                         setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); // precision set below
274                 else
275                         self.model = "";
276
277                 if((tag_found = gettagindex(self.owner, "tag_weapon")))
278                 {
279                         self.tag_index = tag_found;
280                         self.tag_entity = self.owner;
281                 }
282                 else
283                         setattachment(self, self.owner, "bip01 r hand");
284
285                 // if that didn't find a tag, hide the exterior weapon model
286                 if (!self.tag_index)
287                         self.model = "";
288         }
289         self.effects = self.owner.effects | EF_LOWPRECISION;
290         self.effects = self.effects - (self.effects & (EF_BLUE | EF_RED)); // eat performance
291         if(self.owner.alpha >= 0)
292                 self.alpha = self.owner.alpha;
293         else
294                 self.alpha = 1;
295         self.colormap = self.owner.colormap;
296 };
297
298 // spawning weaponentity for client
299 void CL_SpawnWeaponentity()
300 {
301         self.weaponentity = spawn();
302         self.weaponentity.solid = SOLID_NOT;
303         self.weaponentity.owner = self;
304         self.weaponentity.weaponentity = self.weaponentity;
305         setmodel(self.weaponentity, ""); // precision set when changed
306         self.weaponentity.origin = '0 0 0';
307         self.weaponentity.angles = '0 0 0';
308         self.weaponentity.viewmodelforclient = self;
309         self.weaponentity.flags = 0;
310         self.weaponentity.think = CL_Weaponentity_Think;
311         self.weaponentity.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
312         self.weaponentity.nextthink = time;
313         self.weaponentity.scale = 0.61;
314
315         self.exteriorweaponentity = spawn();
316         self.exteriorweaponentity.solid = SOLID_NOT;
317         self.exteriorweaponentity.exteriorweaponentity = self.exteriorweaponentity;
318         self.exteriorweaponentity.owner = self;
319         self.exteriorweaponentity.origin = '0 0 0';
320         self.exteriorweaponentity.angles = '0 0 0';
321         self.exteriorweaponentity.think = CL_ExteriorWeaponentity_Think;
322         self.exteriorweaponentity.nextthink = time;
323 };
324
325 float client_hasweapon(entity cl, float wpn, float andammo, float complain)
326 {
327         local float itemcode, f;
328         local entity oldself;
329
330         if (wpn < WEP_FIRST || wpn > WEP_LAST)
331         {
332                 if (complain)
333                         sprint(self, "Invalid weapon\n");
334                 return FALSE;
335         }
336         itemcode = W_ItemCode(wpn);
337         if (cl.items & itemcode)
338         {
339                 if (andammo)
340                 {
341                         oldself = self;
342                         self = cl;
343                         f = weapon_action(wpn, WR_CHECKAMMO1);
344                         f = f + weapon_action(wpn, WR_CHECKAMMO2);
345                         self = oldself;
346                         if (!f)
347                         {
348                                 if (complain)
349                                         sprint(self, "You don't have any ammo for that weapon\n");
350                                 return FALSE;
351                         }
352                 }
353                 return TRUE;
354         }
355         if (complain)
356         {
357                 // DRESK - 3/16/07
358                 // Report Proper Weapon Status / Modified Weapon Ownership Message
359                 if(itemsInMap & itemcode)
360                         sprint(self, strcat("You do not have the ^2", W_Name(wpn), "\n") );
361                 else
362                         sprint(self, strcat("The ^2", W_Name(wpn), "^7 is ^1NOT AVAILABLE^7 in this map\n") );
363         }
364         return FALSE;
365 };
366
367 // Weapon subs
368 void w_clear()
369 {
370         if (self.weapon != -1)
371                 self.weapon = 0;
372         if (self.weaponentity)
373         {
374                 self.weaponentity.state = WS_CLEAR;
375                 // self.weaponname = ""; // next frame will setmodel it to "" when needed anyway
376                 self.weaponentity.effects = 0;
377         }
378 };
379
380 void w_ready()
381 {
382         if (self.weaponentity)
383                 self.weaponentity.state = WS_READY;
384         weapon_thinkf(WFRAME_IDLE, 1000000, w_ready);
385 };
386
387 // FIXME: add qw-style client-custom weaponrating (cl_weaponrating)?
388 float(entity e) w_getbestweapon
389 {// add new weapons here
390         if (client_hasweapon(e, WEP_ROCKET_LAUNCHER, TRUE, FALSE))
391                 return WEP_ROCKET_LAUNCHER;
392         else if (client_hasweapon(e, WEP_NEX, TRUE, FALSE))
393                 return WEP_NEX;
394         else if (client_hasweapon(e, WEP_HAGAR, TRUE, FALSE))
395                 return WEP_HAGAR;
396         else if (client_hasweapon(e, WEP_GRENADE_LAUNCHER, TRUE, FALSE))
397                 return WEP_GRENADE_LAUNCHER;
398         else if (client_hasweapon(e, WEP_ELECTRO, TRUE, FALSE))
399                 return WEP_ELECTRO;
400         else if (client_hasweapon(e, WEP_CRYLINK, TRUE, FALSE))
401                 return WEP_CRYLINK;
402         else if (client_hasweapon(e, WEP_UZI, TRUE, FALSE))
403                 return WEP_UZI;
404         else if (client_hasweapon(e, WEP_SHOTGUN, TRUE, FALSE))
405                 return WEP_SHOTGUN;
406         else if (client_hasweapon(e, WEP_LASER, FALSE, FALSE))
407                 return WEP_LASER;
408         else
409                 return 0;
410 };
411
412 // Setup weapon for client (after this raise frame will be launched)
413 void weapon_setup(float windex, string wname, float hudammo)
414 {
415         self.items = self.items - (self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS));
416         self.items = self.items | hudammo;
417
418         // the two weapon entities will notice this has changed and update their models
419         self.weapon = windex;
420         self.weaponname = wname;
421 };
422
423 // perform weapon to attack (weaponstate and attack_finished check is here)
424 float weapon_prepareattack(float secondary, float attacktime)
425 {
426         //if sv_ready_restart_after_countdown is set, don't allow the player to shoot
427         //if all players readied up and the countdown is running
428         if (cvar("sv_ready_restart_after_countdown"))
429                 if(time < restart_countdown) {
430                         return FALSE;
431                 }
432         
433         if (!weapon_action(self.weapon, WR_CHECKAMMO1 + secondary))
434         {
435                 self.switchweapon = w_getbestweapon(self);
436                 if (self.switchweapon != self.weapon)
437                         self.cnt = self.weapon;
438                 return FALSE;
439         }
440
441         if (timeoutStatus == 2) //don't allow the player to shoot while game is paused
442                 return FALSE;
443
444         // don't fire if previous attack is not finished
445         if (ATTACK_FINISHED(self) > time + frametime * 0.5)
446                 return FALSE;
447         // don't fire while changing weapon
448         if (self.weaponentity.state != WS_READY)
449                 return FALSE;
450         self.weaponentity.state = WS_INUSE;
451         // if the weapon hasn't been firing continuously, reset the timer
452         if (ATTACK_FINISHED(self) < time - frametime * 1.5)
453         {
454                 ATTACK_FINISHED(self) = time;
455                 //dprint("resetting attack finished to ", ftos(time), "\n");
456         }
457         ATTACK_FINISHED(self) = ATTACK_FINISHED(self) + attacktime;
458         //dprint("attack finished ", ftos(ATTACK_FINISHED(self)), "\n");
459         return TRUE;
460 };
461
462 void weapon_thinkf(float fr, float t, void() func)
463 {
464         if (fr >= 0)
465         {
466                 if (self.weaponentity != world)
467                         self.weaponentity.frame = fr;
468         }
469
470         if(self.weapon_think == w_ready && func != w_ready && self.weaponentity.state == WS_RAISE)
471         {
472                 backtrace("Tried to override initial weapon think function - should this really happen?");
473         }
474
475         if(g_runematch)
476         {
477                 if(self.runes & RUNE_SPEED)
478                 {
479                         if(self.runes & CURSE_SLOW)
480                                 t = t * cvar("g_balance_rune_speed_combo_atkrate");
481                         else
482                                 t = t * cvar("g_balance_rune_speed_atkrate");
483                 }
484                 else if(self.runes & CURSE_SLOW)
485                 {
486                         t = t * cvar("g_balance_curse_slow_atkrate");
487                 }
488         }
489
490         // VorteX: haste can be added here
491         if (self.weapon_think == w_ready)
492         {
493                 self.weapon_nextthink = time;
494                 //dprint("started firing at ", ftos(time), "\n");
495         }
496         if (self.weapon_nextthink < time - frametime * 1.5 || self.weapon_nextthink > time + frametime * 1.5)
497         {
498                 self.weapon_nextthink = time;
499                 //dprint("reset weapon animation timer at ", ftos(time), "\n");
500         }
501         self.weapon_nextthink = self.weapon_nextthink + t;
502         self.weapon_think = func;
503         //dprint("next ", ftos(self.weapon_nextthink), "\n");
504
505         if (fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2)
506         if (t)
507         if (!self.crouch) // shoot anim stands up, this looks bad
508         {
509                 local vector anim;
510                 anim = self.anim_shoot;
511                 anim_z = anim_y / t;
512                 player_setanim(anim, FALSE, TRUE, TRUE);
513         }
514 };
515
516 void weapon_boblayer1(float spd, vector org)
517 {
518         // VorteX: haste can be added here
519 };
520
521 vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity)
522 {
523         vector mdirection;
524         float mspeed;
525         float outspeed;
526         float nstyle;
527         vector outvelocity;
528
529         mdirection = normalize(mvelocity);
530         mspeed = vlen(mvelocity);
531
532         nstyle = cvar("g_projectiles_newton_style");
533         if(nstyle == 0)
534         {
535                 // absolute velocity
536                 outvelocity = mvelocity;
537         }
538         else if(nstyle == 1)
539         {
540                 // true Newtonian projectiles
541                 outvelocity = pvelocity + mvelocity;
542         }
543         else if(nstyle == 2)
544         {
545                 // true Newtonian projectiles with automatic aim adjustment
546                 //
547                 // solve: |outspeed * mdirection - pvelocity| = mspeed
548                 // outspeed^2 - 2 * outspeed * (mdirection * pvelocity) + pvelocity^2 - mspeed^2 = 0
549                 // outspeed = (mdirection * pvelocity) +- sqrt((mdirection * pvelocity)^2 - pvelocity^2 + mspeed^2)
550                 // PLUS SIGN!
551                 // not defined?
552                 // then...
553                 // pvelocity^2 - (mdirection * pvelocity)^2 > mspeed^2
554                 // velocity without mdirection component > mspeed
555                 // fire at smallest possible mspeed that works?
556                 // |(mdirection * pvelocity) * pvelocity - pvelocity| = mspeed
557
558                 float D;
559                 float p;
560                 float q;
561                 p = mdirection * pvelocity;
562                 q = pvelocity * pvelocity - mspeed * mspeed;
563                 D = p * p - q;
564                 if(D < 0)
565                 {
566                         //dprint("impossible shot, adjusting\n");
567                         D = 0;
568                 }
569                 outspeed = p + sqrt(D);
570                 outspeed = bound(mspeed * 0.7, outspeed, mspeed * 5.0);
571                 outvelocity = mdirection * outspeed;
572         }
573         else if(nstyle == 3)
574         {
575                 // pseudo-Newtonian:
576                 outspeed = mspeed + mdirection * pvelocity;
577                 outspeed = bound(mspeed * 0.7, outspeed, mspeed * 5.0);
578                 outvelocity = mdirection * outspeed;
579         }
580         else if(nstyle == 4)
581         {
582                 // tZorkian:
583                 outspeed = mspeed + vlen(pvelocity);
584                 outvelocity = mdirection * outspeed;
585         }
586         else
587                 error("g_projectiles_newton_style must be 0 (absolute), 1 (Newtonian), 2 (Newtonian + aimfix), 3 (pseudo Newtonian) or 4 (tZorkian)!");
588
589         return outvelocity;
590 }
591
592 void W_SetupProjectileVelocity(entity missile)
593 {
594         if(missile.owner == world)
595                 error("Unowned missile");
596
597         missile.velocity = W_CalculateProjectileVelocity(missile.owner.velocity, missile.velocity);
598 }
599
600 void weapon_register(float wepcode, float minammo)
601 {
602         string s;
603         float itemcode;
604         s = strcat("register_bestweapon ", ftos(wepcode), " "); // char for bestweapon
605         s = strcat(s, ftos(wepcode), " "); // impulse
606         s = strcat(s, ftos(W_ItemCode(wepcode)), " "); // item code
607         s = strcat(s, ftos(wepcode), " "); // self.weapon code
608
609         // ammo stat
610         itemcode = W_AmmoItemCode(wepcode);
611         if(itemcode == IT_SHELLS)
612                 s = strcat(s, "6 ");
613         else if(itemcode == IT_NAILS)
614                 s = strcat(s, "7 ");
615         else if(itemcode == IT_ROCKETS)
616                 s = strcat(s, "8 ");
617         else // if(itemcode == IT_CELLS)
618                 s = strcat(s, "9 ");
619
620         s = strcat(s, ftos(minammo), "\n");
621         //dprint(s);
622         stuffcmd(self, s);
623 }