home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / newweap / weapons.qc < prev    next >
Encoding:
Text File  |  1996-07-28  |  30.2 KB  |  1,453 lines

  1. /*
  2. */
  3. void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
  4. void () player_run;
  5. void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
  6. void(vector org, vector vel, float damage) SpawnBlood;
  7. void() SuperDamageSound;
  8.  
  9.  
  10. // called by worldspawn
  11. void() W_Precache =
  12. {
  13.     precache_sound ("weapons/r_exp3.wav");    // new rocket explosion
  14.     precache_sound ("weapons/rocket1i.wav");    // spike gun
  15.     precache_sound ("weapons/sgun1.wav");
  16.     precache_sound ("weapons/guncock.wav");    // player shotgun
  17.     precache_sound ("weapons/ric1.wav");    // ricochet (used in c code)
  18.     precache_sound ("weapons/ric2.wav");    // ricochet (used in c code)
  19.     precache_sound ("weapons/ric3.wav");    // ricochet (used in c code)
  20.     precache_sound ("weapons/spike2.wav");    // super spikes
  21.     precache_sound ("weapons/tink1.wav");    // spikes tink (used in c code)
  22.     precache_sound ("weapons/grenade.wav");    // grenade launcher
  23.     precache_sound ("weapons/bounce.wav");        // grenade bounce
  24.     precache_sound ("weapons/shotgn2.wav");    // super shotgun
  25.         precache_sound ("enforcer/enfire.wav"); // laser gun
  26.         precache_sound ("enforcer/enfstop.wav"); // laser hit
  27.         precache_sound ("weapons/plasma.wav"); // plasma cannon
  28. };
  29.  
  30. float() crandom =
  31. {
  32.     return 2*(random() - 0.5);
  33. };
  34.  
  35. /*
  36. ================
  37. W_FireAxe
  38. ================
  39. */
  40. void() W_FireAxe =
  41. {
  42.     local    vector    source;
  43.     local    vector    org;
  44.  
  45.     source = self.origin + '0 0 16';
  46.     traceline (source, source + v_forward*64, FALSE, self);
  47.     if (trace_fraction == 1.0)
  48.         return;
  49.     
  50.     org = trace_endpos - v_forward*4;
  51.  
  52.     if (trace_ent.takedamage)
  53.     {
  54.         trace_ent.axhitme = 1;
  55.         SpawnBlood (org, '0 0 0', 20);
  56.         T_Damage (trace_ent, self, self, 20);
  57.     }
  58.     else
  59.     {    // hit wall
  60.         sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
  61.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  62.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  63.         WriteCoord (MSG_BROADCAST, org_x);
  64.         WriteCoord (MSG_BROADCAST, org_y);
  65.         WriteCoord (MSG_BROADCAST, org_z);
  66.     }
  67. };
  68.  
  69.  
  70. //============================================================================
  71.  
  72.  
  73. vector() wall_velocity =
  74. {
  75.     local vector    vel;
  76.     
  77.     vel = normalize (self.velocity);
  78.     vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
  79.     vel = vel + 2*trace_plane_normal;
  80.     vel = vel * 200;
  81.     
  82.     return vel;
  83. };
  84.  
  85.  
  86. /*
  87. ================
  88. SpawnMeatSpray
  89. ================
  90. */
  91. void(vector org, vector vel) SpawnMeatSpray =
  92. {
  93.     local    entity missile, mpuff;
  94.     local    vector    org;
  95.  
  96.     missile = spawn ();
  97.     missile.owner = self;
  98.     missile.movetype = MOVETYPE_BOUNCE;
  99.     missile.solid = SOLID_NOT;
  100.  
  101.     makevectors (self.angles);
  102.  
  103.     missile.velocity = vel;
  104.     missile.velocity_z = missile.velocity_z + 250 + 50*random();
  105.  
  106.     missile.avelocity = '3000 1000 2000';
  107.     
  108. // set missile duration
  109.     missile.nextthink = time + 1;
  110.     missile.think = SUB_Remove;
  111.  
  112.     setmodel (missile, "progs/zom_gib.mdl");
  113.     setsize (missile, '0 0 0', '0 0 0');        
  114.     setorigin (missile, org);
  115. };
  116.  
  117. /*
  118. ================
  119. SpawnBlood
  120. ================
  121. */
  122. void(vector org, vector vel, float damage) SpawnBlood =
  123. {
  124.     particle (org, vel*0.1, 73, damage*2);
  125. };
  126.  
  127. /*
  128. ================
  129. spawn_touchblood
  130. ================
  131. */
  132. void(float damage) spawn_touchblood =
  133. {
  134.     local vector    vel;
  135.  
  136.     vel = wall_velocity () * 0.2;
  137.     SpawnBlood (self.origin + vel*0.01, vel, damage);
  138. };
  139.  
  140.  
  141. /*
  142. ================
  143. SpawnChunk
  144. ================
  145. */
  146. void(vector org, vector vel) SpawnChunk =
  147. {
  148.     particle (org, vel*0.02, 0, 10);
  149. };
  150.  
  151. /*
  152. ==============================================================================
  153.  
  154. MULTI-DAMAGE
  155.  
  156. Collects multiple small damages into a single damage
  157.  
  158. ==============================================================================
  159. */
  160.  
  161. entity    multi_ent;
  162. float    multi_damage;
  163.  
  164. void() ClearMultiDamage =
  165. {
  166.     multi_ent = world;
  167.     multi_damage = 0;
  168. };
  169.  
  170. void() ApplyMultiDamage =
  171. {
  172.     if (!multi_ent)
  173.         return;
  174.     T_Damage (multi_ent, self, self, multi_damage);
  175. };
  176.  
  177. void(entity hit, float damage) AddMultiDamage =
  178. {
  179.     if (!hit)
  180.         return;
  181.     
  182.     if (hit != multi_ent)
  183.     {
  184.         ApplyMultiDamage ();
  185.         multi_damage = damage;
  186.         multi_ent = hit;
  187.     }
  188.     else
  189.         multi_damage = multi_damage + damage;
  190. };
  191.  
  192. /*
  193. ==============================================================================
  194.  
  195. BULLETS
  196.  
  197. ==============================================================================
  198. */
  199.  
  200. /*
  201. ================
  202. TraceAttack
  203. ================
  204. */
  205. void(float damage, vector dir) TraceAttack =
  206. {
  207.     local    vector    vel, org;
  208.     
  209.     vel = normalize(dir + v_up*crandom() + v_right*crandom());
  210.     vel = vel + 2*trace_plane_normal;
  211.     vel = vel * 200;
  212.  
  213.     org = trace_endpos - dir*4;
  214.  
  215.     if (trace_ent.takedamage)
  216.     {
  217.         SpawnBlood (org, vel*0.2, damage);
  218.         AddMultiDamage (trace_ent, damage);
  219.     }
  220.     else
  221.     {
  222.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  223.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  224.         WriteCoord (MSG_BROADCAST, org_x);
  225.         WriteCoord (MSG_BROADCAST, org_y);
  226.         WriteCoord (MSG_BROADCAST, org_z);
  227.     }
  228. };
  229.  
  230. /*
  231. ================
  232. FireBullets
  233.  
  234. Used by shotgun, super shotgun, and enemy soldier firing
  235. Go to the trouble of combining multiple pellets into a single damage call.
  236. ================
  237. */
  238. void(float shotcount, vector dir, vector spread) FireBullets =
  239. {
  240.     local    vector direction;
  241.     local    vector    src;
  242.     
  243.     makevectors(self.v_angle);
  244.  
  245.     src = self.origin + v_forward*10;
  246.     src_z = self.absmin_z + self.size_z * 0.7;
  247.  
  248.     ClearMultiDamage ();
  249.     while (shotcount > 0)
  250.     {
  251.         direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
  252.  
  253.         traceline (src, src + direction*2048, FALSE, self);
  254.         if (trace_fraction != 1.0)
  255.             TraceAttack (4, direction);
  256.  
  257.         shotcount = shotcount - 1;
  258.     }
  259.     ApplyMultiDamage ();
  260. };
  261.  
  262. /*
  263. ================
  264. W_FireShotgun
  265. ================
  266. */
  267. void() W_FireShotgun =
  268. {
  269.     local vector dir;
  270.  
  271.     sound (self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM);    
  272.  
  273.     self.punchangle_x = -2;
  274.     
  275.     self.currentammo = self.ammo_shells = self.ammo_shells - 1;
  276.     dir = aim (self, 100000);
  277.     FireBullets (6, dir, '0.04 0.04 0');
  278. };
  279.  
  280.  
  281. /*
  282. ================
  283. W_FireSuperShotgun
  284. ================
  285. */
  286. void() W_FireSuperShotgun =
  287. {
  288.     local vector dir;
  289.  
  290.     if (self.currentammo == 1)
  291.     {
  292.         W_FireShotgun ();
  293.         return;
  294.     }
  295.         
  296.     sound (self ,CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);    
  297.  
  298.     self.punchangle_x = -4;
  299.     
  300.     self.currentammo = self.ammo_shells = self.ammo_shells - 2;
  301.     dir = aim (self, 100000);
  302.     FireBullets (14, dir, '0.14 0.08 0');
  303. };
  304.  
  305.  
  306. /*
  307. ==============================================================================
  308.  
  309. ROCKETS
  310.  
  311. ==============================================================================
  312. */
  313.  
  314. void()    s_explode1    =    [0,        s_explode2] {};
  315. void()    s_explode2    =    [1,        s_explode3] {};
  316. void()    s_explode3    =    [2,        s_explode4] {};
  317. void()    s_explode4    =    [3,        s_explode5] {};
  318. void()    s_explode5    =    [4,        s_explode6] {};
  319. void()    s_explode6    =    [5,        SUB_Remove] {};
  320.  
  321. void() BecomeExplosion =
  322. {
  323.     self.movetype = MOVETYPE_NONE;
  324.     self.velocity = '0 0 0';
  325.     self.touch = SUB_Null;
  326.     setmodel (self, "progs/s_explod.spr");
  327.     self.solid = SOLID_NOT;
  328.     s_explode1 ();
  329. };
  330.  
  331. void() T_MissileTouch =
  332. {
  333.     local float    damg;
  334.  
  335.     if (other == self.owner)
  336.         return;        // don't explode on owner
  337.  
  338.     if (pointcontents(self.origin) == CONTENT_SKY)
  339.     {
  340.         remove(self);
  341.         return;
  342.     }
  343.  
  344.     damg = 100 + random()*20;
  345.     
  346.     if (other.health)
  347.     {
  348.         if (other.classname == "monster_shambler")
  349.             damg = damg * 0.5;    // mostly immune
  350.         T_Damage (other, self, self.owner, damg );
  351.     }
  352.  
  353.     // don't do radius damage to the other, because all the damage
  354.     // was done in the impact
  355.     T_RadiusDamage (self, self.owner, 120, other);
  356.  
  357. //    sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  358.     self.origin = self.origin - 8*normalize(self.velocity);
  359.  
  360.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  361.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  362.     WriteCoord (MSG_BROADCAST, self.origin_x);
  363.     WriteCoord (MSG_BROADCAST, self.origin_y);
  364.     WriteCoord (MSG_BROADCAST, self.origin_z);
  365.  
  366.     BecomeExplosion ();
  367. };
  368.  
  369.  
  370.  
  371. /*
  372. ================
  373. W_FireRocket
  374. ================
  375. */
  376. void() W_FireRocket =
  377. {
  378.     local    entity missile, mpuff;
  379.     
  380.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  381.     
  382.     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
  383.  
  384.     self.punchangle_x = -2;
  385.  
  386.     missile = spawn ();
  387.     missile.owner = self;
  388.     missile.movetype = MOVETYPE_FLYMISSILE;
  389.     missile.solid = SOLID_BBOX;
  390.         
  391. // set missile speed    
  392.  
  393.     makevectors (self.v_angle);
  394.     missile.velocity = aim(self, 1000);
  395.     missile.velocity = missile.velocity * 1000;
  396.     missile.angles = vectoangles(missile.velocity);
  397.     
  398.     missile.touch = T_MissileTouch;
  399.     
  400. // set missile duration
  401.     missile.nextthink = time + 5;
  402.     missile.think = SUB_Remove;
  403.  
  404.     setmodel (missile, "progs/missile.mdl");
  405.     setsize (missile, '0 0 0', '0 0 0');        
  406.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  407. };
  408.  
  409. /*
  410. ===============================================================================
  411.  
  412. LIGHTNING
  413.  
  414. ===============================================================================
  415. */
  416.  
  417. /*
  418. =================
  419. LightningDamage
  420. =================
  421. */
  422. void(vector p1, vector p2, entity from, float damage) LightningDamage =
  423. {
  424.     local entity        e1, e2;
  425.     local vector        f;
  426.     
  427.     f = p2 - p1;
  428.     normalize (f);
  429.     f_x = 0 - f_y;
  430.     f_y = f_x;
  431.     f_z = 0;
  432.     f = f*16;
  433.  
  434.     e1 = e2 = world;
  435.  
  436.     traceline (p1, p2, FALSE, self);
  437.     if (trace_ent.takedamage)
  438.     {
  439.         particle (trace_endpos, '0 0 100', 225, damage*4);
  440.         T_Damage (trace_ent, from, from, damage);
  441.         if (self.classname == "player")
  442.         {
  443.             if (other.classname == "player")
  444.                 trace_ent.velocity_z = trace_ent.velocity_z + 400;
  445.         }
  446.     }
  447.     e1 = trace_ent;
  448.  
  449.     traceline (p1 + f, p2 + f, FALSE, self);
  450.     if (trace_ent != e1 && trace_ent.takedamage)
  451.     {
  452.         particle (trace_endpos, '0 0 100', 225, damage*4);
  453.         T_Damage (trace_ent, from, from, damage);
  454.     }
  455.     e2 = trace_ent;
  456.  
  457.     traceline (p1 - f, p2 - f, FALSE, self);
  458.     if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage)
  459.     {
  460.         particle (trace_endpos, '0 0 100', 225, damage*4);
  461.         T_Damage (trace_ent, from, from, damage);
  462.     }
  463. };
  464.  
  465.  
  466. void() W_FireLightning =
  467. {
  468.     local    vector        org;
  469.  
  470.     if (self.ammo_cells < 1)
  471.     {
  472.         self.weapon = W_BestWeapon ();
  473.         W_SetCurrentAmmo ();
  474.         return;
  475.     }
  476.  
  477. // explode if under water
  478.     if (self.waterlevel > 1)
  479.     {
  480.         T_RadiusDamage (self, self, 35*self.ammo_cells, world);
  481.         self.ammo_cells = 0;
  482.         W_SetCurrentAmmo ();
  483.         return;
  484.     }
  485.  
  486.     if (self.t_width < time)
  487.     {
  488.         sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
  489.         self.t_width = time + 0.6;
  490.     }
  491.     self.punchangle_x = -2;
  492.  
  493.     self.currentammo = self.ammo_cells = self.ammo_cells - 1;
  494.  
  495.     org = self.origin + '0 0 16';
  496.     
  497.     traceline (org, org + v_forward*600, TRUE, self);
  498.  
  499.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  500.     WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
  501.     WriteEntity (MSG_BROADCAST, self);
  502.     WriteCoord (MSG_BROADCAST, org_x);
  503.     WriteCoord (MSG_BROADCAST, org_y);
  504.     WriteCoord (MSG_BROADCAST, org_z);
  505.     WriteCoord (MSG_BROADCAST, trace_endpos_x);
  506.     WriteCoord (MSG_BROADCAST, trace_endpos_y);
  507.     WriteCoord (MSG_BROADCAST, trace_endpos_z);
  508.  
  509.     LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
  510. };
  511.  
  512.  
  513. //=============================================================================
  514.  
  515.  
  516. void() GrenadeExplode =
  517. {
  518.     T_RadiusDamage (self, self.owner, 120, world);
  519.  
  520.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  521.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  522.     WriteCoord (MSG_BROADCAST, self.origin_x);
  523.     WriteCoord (MSG_BROADCAST, self.origin_y);
  524.     WriteCoord (MSG_BROADCAST, self.origin_z);
  525.  
  526.     BecomeExplosion ();
  527. };
  528.  
  529. void() GrenadeTouch =
  530. {
  531.     if (other == self.owner)
  532.         return;        // don't explode on owner
  533.     if (other.takedamage == DAMAGE_AIM)
  534.     {
  535.         GrenadeExplode();
  536.         return;
  537.     }
  538.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);    // bounce sound
  539.     if (self.velocity == '0 0 0')
  540.         self.avelocity = '0 0 0';
  541. };
  542.  
  543. /*
  544. ================
  545. W_FireGrenade
  546. ================
  547. */
  548. void() W_FireGrenade =
  549. {
  550.     local    entity missile, mpuff;
  551.     
  552.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  553.     
  554.     sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  555.  
  556.     self.punchangle_x = -2;
  557.  
  558.     missile = spawn ();
  559.     missile.owner = self;
  560.     missile.movetype = MOVETYPE_BOUNCE;
  561.     missile.solid = SOLID_BBOX;
  562.     missile.classname = "grenade";
  563.         
  564. // set missile speed    
  565.  
  566.     makevectors (self.v_angle);
  567.  
  568.     if (self.v_angle_x)
  569.         missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
  570.     else
  571.     {
  572.         missile.velocity = aim(self, 10000);
  573.         missile.velocity = missile.velocity * 600;
  574.         missile.velocity_z = 200;
  575.     }
  576.  
  577.     missile.avelocity = '300 300 300';
  578.  
  579.     missile.angles = vectoangles(missile.velocity);
  580.     
  581.     missile.touch = GrenadeTouch;
  582.     
  583. // set missile duration
  584.     missile.nextthink = time + 2.5;
  585.     missile.think = GrenadeExplode;
  586.  
  587.     setmodel (missile, "progs/grenade.mdl");
  588.     setsize (missile, '0 0 0', '0 0 0');        
  589.     setorigin (missile, self.origin);
  590. };
  591.  
  592.  
  593. //=============================================================================
  594.  
  595. void() spike_touch;
  596. void() superspike_touch;
  597.  
  598.  
  599. /*
  600. ===============
  601. launch_spike
  602.  
  603. Used for both the player and the ogre
  604. ===============
  605. */
  606. void(vector org, vector dir) launch_spike =
  607. {
  608.     newmis = spawn ();
  609.     newmis.owner = self;
  610.     newmis.movetype = MOVETYPE_FLYMISSILE;
  611.     newmis.solid = SOLID_BBOX;
  612.  
  613.     newmis.angles = vectoangles(dir);
  614.     
  615.     newmis.touch = spike_touch;
  616.     newmis.classname = "spike";
  617.     newmis.think = SUB_Remove;
  618.     newmis.nextthink = time + 6;
  619.     setmodel (newmis, "progs/spike.mdl");
  620.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  621.     setorigin (newmis, org);
  622.  
  623.     newmis.velocity = dir * 1000;
  624. };
  625.  
  626. void() W_FireSuperSpikes =
  627. {
  628.     local vector    dir;
  629.     local entity    old;
  630.     
  631.     sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  632.     self.attack_finished = time + 0.2;
  633.     self.currentammo = self.ammo_nails = self.ammo_nails - 2;
  634.     dir = aim (self, 1000);
  635.     launch_spike (self.origin + '0 0 16', dir);
  636.     newmis.touch = superspike_touch;
  637.     setmodel (newmis, "progs/s_spike.mdl");
  638.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  639.     self.punchangle_x = -2;
  640. };
  641.  
  642. void(float ox) W_FireSpikes =
  643. {
  644.     local vector    dir;
  645.     local entity    old;
  646.     
  647.     makevectors (self.v_angle);
  648.     
  649.     if (self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN)
  650.     {
  651.         W_FireSuperSpikes ();
  652.         return;
  653.     }
  654.  
  655.     if (self.ammo_nails < 1)
  656.     {
  657.         self.weapon = W_BestWeapon ();
  658.         W_SetCurrentAmmo ();
  659.         return;
  660.     }
  661.  
  662.     sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
  663.     self.attack_finished = time + 0.2;
  664.     self.currentammo = self.ammo_nails = self.ammo_nails - 1;
  665.     dir = aim (self, 1000);
  666.     launch_spike (self.origin + '0 0 16' + v_right*ox, dir);
  667.  
  668.     self.punchangle_x = -2;
  669. };
  670.  
  671.  
  672.  
  673. .float hit_z;
  674. void() spike_touch =
  675. {
  676. local float rand;
  677.     if (other == self.owner)
  678.         return;
  679.  
  680.     if (other.solid == SOLID_TRIGGER)
  681.         return;    // trigger field, do nothing
  682.  
  683.     if (pointcontents(self.origin) == CONTENT_SKY)
  684.     {
  685.         remove(self);
  686.         return;
  687.     }
  688.     
  689. // hit something that bleeds
  690.     if (other.takedamage)
  691.     {
  692.         spawn_touchblood (9);
  693.         T_Damage (other, self, self.owner, 9);
  694.     }
  695.     else
  696.     {
  697.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  698.         
  699.         if (self.classname == "wizspike")
  700.             WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
  701.         else if (self.classname == "knightspike")
  702.             WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  703.         else
  704.             WriteByte (MSG_BROADCAST, TE_SPIKE);
  705.         WriteCoord (MSG_BROADCAST, self.origin_x);
  706.         WriteCoord (MSG_BROADCAST, self.origin_y);
  707.         WriteCoord (MSG_BROADCAST, self.origin_z);
  708.     }
  709.  
  710.     remove(self);
  711.  
  712. };
  713.  
  714. void() superspike_touch =
  715. {
  716. local float rand;
  717.     if (other == self.owner)
  718.         return;
  719.  
  720.     if (other.solid == SOLID_TRIGGER)
  721.         return;    // trigger field, do nothing
  722.  
  723.     if (pointcontents(self.origin) == CONTENT_SKY)
  724.     {
  725.         remove(self);
  726.         return;
  727.     }
  728.     
  729. // hit something that bleeds
  730.     if (other.takedamage)
  731.     {
  732.         spawn_touchblood (18);
  733.         T_Damage (other, self, self.owner, 18);
  734.     }
  735.     else
  736.     {
  737.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  738.         WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
  739.         WriteCoord (MSG_BROADCAST, self.origin_x);
  740.         WriteCoord (MSG_BROADCAST, self.origin_y);
  741.         WriteCoord (MSG_BROADCAST, self.origin_z);
  742.     }
  743.  
  744.     remove(self);
  745.  
  746. };
  747. /*
  748. ===========
  749. Laser shit
  750. derived from nails
  751. 90% of this shit is a kludge, so BEWARE!
  752. ===========
  753. */
  754.  void() laser_touch =
  755. {
  756.     local vector org;
  757.     
  758.     if (other == self.owner)
  759.         return;        // don't explode on owner
  760.  
  761.     if (pointcontents(self.origin) == CONTENT_SKY)
  762.     {
  763.         remove(self);
  764.         return;
  765.     }
  766.     
  767.     sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
  768.     org = self.origin - 8*normalize(self.velocity);
  769.  
  770.     if (other.health)
  771.     {
  772.         SpawnBlood (org, self.velocity*0.2, 15);
  773.                 T_Damage (other, self, self.owner, 50);
  774.     }
  775.     else
  776.     {
  777.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  778.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  779.         WriteCoord (MSG_BROADCAST, org_x);
  780.         WriteCoord (MSG_BROADCAST, org_y);
  781.         WriteCoord (MSG_BROADCAST, org_z);
  782.     }
  783.     
  784.     remove(self);    
  785. };
  786.  
  787.  
  788. void(vector org, vector dir) launch_laser =
  789. {
  790.     newmis = spawn ();
  791.     newmis.owner = self;
  792.     newmis.movetype = MOVETYPE_FLYMISSILE;
  793.     newmis.solid = SOLID_BBOX;
  794.  
  795.     newmis.angles = vectoangles(dir);
  796.     
  797.         newmis.touch = laser_touch;
  798.     newmis.classname = "spike";
  799.     newmis.think = SUB_Remove;
  800.     newmis.nextthink = time + 6;
  801.         setmodel (newmis, "progs/laser.mdl");
  802.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  803.     setorigin (newmis, org);
  804.  
  805.         newmis.velocity = dir * 800;
  806. };
  807.  
  808. void(float ox) W_FireLaser =
  809. {
  810.     local vector    dir;
  811.     local entity    old;
  812.     
  813.     makevectors (self.v_angle);
  814.     
  815.  
  816.         if (self.ammo_cells < 1)
  817.     {
  818.         self.weapon = W_BestWeapon ();
  819.         W_SetCurrentAmmo ();
  820.         return;
  821.     }
  822.  
  823.         sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
  824.         self.currentammo = self.ammo_cells = self.ammo_cells - 1;
  825.         // self.attack_finished = time + 0.6;
  826.     dir = aim (self, 1000);
  827.         launch_laser (self.origin, dir);
  828.  
  829.         self.punchangle_x = 0;
  830. };
  831.  
  832. /*
  833. ===========
  834. Plasma cannon
  835. derived from nails
  836. This shit is a kludge, fyi!
  837. ===========
  838. */
  839.  void() plasma_touch =
  840. {
  841.     local vector org;
  842.     
  843.     if (other == self.owner)
  844.         return;        // don't explode on owner
  845.  
  846.     if (pointcontents(self.origin) == CONTENT_SKY)
  847.     {
  848.         remove(self);
  849.         return;
  850.     }
  851.     
  852.     sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
  853.     org = self.origin - 8*normalize(self.velocity);
  854.  
  855.     if (other.health)
  856.     {
  857.         SpawnBlood (org, self.velocity*0.2, 15);
  858.                 T_Damage (other, self, self.owner, 125);
  859.     }
  860.     else
  861.     {
  862.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  863.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  864.         WriteCoord (MSG_BROADCAST, org_x);
  865.         WriteCoord (MSG_BROADCAST, org_y);
  866.         WriteCoord (MSG_BROADCAST, org_z);
  867.     }
  868.     
  869.     remove(self);    
  870. };
  871.  
  872. void(vector org, vector dir) launch_plasma =
  873. {
  874.     newmis = spawn ();
  875.     newmis.owner = self;
  876.     newmis.movetype = MOVETYPE_FLYMISSILE;
  877.     newmis.solid = SOLID_BBOX;
  878.  
  879.     newmis.angles = vectoangles(dir);
  880.     
  881.         newmis.touch = plasma_touch;
  882.     newmis.classname = "spike";
  883.     newmis.think = SUB_Remove;
  884.     newmis.nextthink = time + 6;
  885.         setmodel (newmis, "progs/w_spike.mdl");
  886.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  887.     setorigin (newmis, org);
  888.  
  889.         newmis.velocity = dir * 500;
  890. };
  891. void(float ox) W_FirePlasma =
  892. {
  893.     local vector    dir;
  894.     local entity    old;
  895.     
  896.     makevectors (self.v_angle);
  897.     
  898.  
  899.         if (self.ammo_cells < 2)
  900.     {
  901.         self.weapon = W_BestWeapon ();
  902.         W_SetCurrentAmmo ();
  903.         return;
  904.     }
  905.  
  906.         sound (self, CHAN_WEAPON, "weapons/plasma.wav", 1, ATTN_NORM);
  907.         // self.attack_finished = time + 0.6;
  908.         self.currentammo = self.ammo_cells = self.ammo_cells - 2;
  909.     dir = aim (self, 1000);
  910.         launch_plasma (self.origin, dir);
  911.  
  912.         self.punchangle_x = -2;
  913. };
  914.  
  915. /*
  916. ===============================================================================
  917.  
  918. PLAYER WEAPON USE
  919.  
  920. ===============================================================================
  921. */
  922.  
  923. void() W_SetCurrentAmmo =
  924. {
  925.     player_run ();        // get out of any weapon firing states
  926.  
  927.     self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
  928.     
  929.     if (self.weapon == IT_AXE)
  930.     {
  931.         self.currentammo = 0;
  932.         self.weaponmodel = "progs/v_axe.mdl";
  933.         self.weaponframe = 0;
  934.     }
  935.     else if (self.weapon == IT_SHOTGUN)
  936.     {
  937.         self.currentammo = self.ammo_shells;
  938.         self.weaponmodel = "progs/v_shot.mdl";
  939.         self.weaponframe = 0;
  940.         self.items = self.items | IT_SHELLS;
  941.     }
  942.     else if (self.weapon == IT_SUPER_SHOTGUN)
  943.     {
  944.         self.currentammo = self.ammo_shells;
  945.         self.weaponmodel = "progs/v_shot2.mdl";
  946.         self.weaponframe = 0;
  947.         self.items = self.items | IT_SHELLS;
  948.     }
  949.     else if (self.weapon == IT_NAILGUN)
  950.     {
  951.         self.currentammo = self.ammo_nails;
  952.         self.weaponmodel = "progs/v_nail.mdl";
  953.         self.weaponframe = 0;
  954.         self.items = self.items | IT_NAILS;
  955.     }
  956.     else if (self.weapon == IT_SUPER_NAILGUN)
  957.     {
  958.         self.currentammo = self.ammo_nails;
  959.         self.weaponmodel = "progs/v_nail2.mdl";
  960.         self.weaponframe = 0;
  961.         self.items = self.items | IT_NAILS;
  962.     }
  963.     else if (self.weapon == IT_GRENADE_LAUNCHER)
  964.     {
  965.         self.currentammo = self.ammo_rockets;
  966.         self.weaponmodel = "progs/v_rock.mdl";
  967.         self.weaponframe = 0;
  968.         self.items = self.items | IT_ROCKETS;
  969.     }
  970.     else if (self.weapon == IT_ROCKET_LAUNCHER)
  971.     {
  972.         self.currentammo = self.ammo_rockets;
  973.         self.weaponmodel = "progs/v_rock2.mdl";
  974.         self.weaponframe = 0;
  975.         self.items = self.items | IT_ROCKETS;
  976.     }
  977.     else if (self.weapon == IT_LIGHTNING)
  978.     {
  979.         self.currentammo = self.ammo_cells;
  980.         self.weaponmodel = "progs/v_light.mdl";
  981.         self.weaponframe = 0;
  982.         self.items = self.items | IT_CELLS;
  983.     }
  984.         else if (self.weapon == IT_LASER_GUN)
  985.     {
  986.                 self.currentammo = self.ammo_cells;
  987.                 self.weaponmodel = "progs/v_shot.mdl";
  988.         self.weaponframe = 0;
  989.                 self.items = self.items | IT_CELLS;
  990.         }
  991.         else if (self.weapon == IT_PLASMA_CANNON)
  992.     {
  993.                 self.currentammo = self.ammo_cells;
  994.                 self.weaponmodel = "progs/v_rock.mdl";
  995.         self.weaponframe = 0;
  996.                 self.items = self.items | IT_CELLS;
  997.         }
  998.         else
  999.     {
  1000.         self.currentammo = 0;
  1001.         self.weaponmodel = "";
  1002.         self.weaponframe = 0;
  1003.     }
  1004. };
  1005.  
  1006. float() W_BestWeapon =
  1007. {
  1008.     local    float    it;
  1009.     
  1010.     it = self.items;
  1011.         if(self.ammo_cells >= 2 && (it & IT_PLASMA_CANNON) )
  1012.                 return IT_PLASMA_CANNON;
  1013.         else if(self.ammo_cells >= 1 && (it & IT_LASER_GUN) )
  1014.                 return IT_LASER_GUN;
  1015.         else if(self.ammo_cells >= 1 && (it & IT_LIGHTNING) )
  1016.         return IT_LIGHTNING;
  1017.     else if(self.ammo_nails >= 2 && (it & IT_SUPER_NAILGUN) )
  1018.         return IT_SUPER_NAILGUN;
  1019.     else if(self.ammo_shells >= 2 && (it & IT_SUPER_SHOTGUN) )
  1020.         return IT_SUPER_SHOTGUN;
  1021.     else if(self.ammo_nails >= 1 && (it & IT_NAILGUN) )
  1022.         return IT_NAILGUN;
  1023.     else if(self.ammo_shells >= 1 && (it & IT_SHOTGUN) )
  1024.         return IT_SHOTGUN;
  1025.         
  1026. /*
  1027.     if(self.ammo_rockets >= 1 && (it & IT_ROCKET_LAUNCHER) )
  1028.         return IT_ROCKET_LAUNCHER;
  1029.     else if(self.ammo_rockets >= 1 && (it & IT_GRENADE_LAUNCHER) )
  1030.         return IT_GRENADE_LAUNCHER;
  1031.  
  1032. */
  1033.  
  1034.     return IT_AXE;
  1035. };
  1036.  
  1037. float() W_CheckNoAmmo =
  1038. {
  1039.     if (self.currentammo > 0)
  1040.         return TRUE;
  1041.  
  1042.     if (self.weapon == IT_AXE)
  1043.         return TRUE;
  1044.     
  1045.     self.weapon = W_BestWeapon ();
  1046.  
  1047.     W_SetCurrentAmmo ();
  1048.     
  1049. // drop the weapon down
  1050.     return FALSE;
  1051. };
  1052.  
  1053. /*
  1054. ============
  1055. W_Attack
  1056.  
  1057. An attack impulse can be triggered now
  1058. ============
  1059. */
  1060. void()    player_axe1;
  1061. void()    player_axeb1;
  1062. void()    player_axec1;
  1063. void()    player_axed1;
  1064. void()    player_shot1;
  1065. void()    player_nail1;
  1066. void()    player_light1;
  1067. void()    player_rocket1;
  1068. void()  player_laser1;
  1069. void()  player_plasma1;
  1070.  
  1071. void() W_Attack =
  1072. {
  1073.     local    float    r;
  1074.  
  1075.     if (!W_CheckNoAmmo ())
  1076.         return;
  1077.  
  1078.     makevectors    (self.v_angle);            // calculate forward angle for velocity
  1079.     self.show_hostile = time + 1;    // wake monsters up
  1080.  
  1081.     if (self.weapon == IT_AXE)
  1082.     {
  1083.         sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
  1084.         r = random();
  1085.         if (r < 0.25)
  1086.             player_axe1 ();
  1087.         else if (r<0.5)
  1088.             player_axeb1 ();
  1089.         else if (r<0.75)
  1090.             player_axec1 ();
  1091.         else
  1092.             player_axed1 ();
  1093.         self.attack_finished = time + 0.5;
  1094.     }
  1095.     else if (self.weapon == IT_SHOTGUN)
  1096.     {
  1097.         player_shot1 ();
  1098.         W_FireShotgun ();
  1099.         self.attack_finished = time + 0.5;
  1100.     }
  1101.     else if (self.weapon == IT_SUPER_SHOTGUN)
  1102.     {
  1103.         player_shot1 ();
  1104.         W_FireSuperShotgun ();
  1105.         self.attack_finished = time + 0.7;
  1106.     }
  1107.     else if (self.weapon == IT_NAILGUN)
  1108.     {
  1109.         player_nail1 ();
  1110.     }
  1111.     else if (self.weapon == IT_SUPER_NAILGUN)
  1112.     {
  1113.         player_nail1 ();
  1114.     }
  1115.     else if (self.weapon == IT_GRENADE_LAUNCHER)
  1116.     {
  1117.         player_rocket1();
  1118.         W_FireGrenade();
  1119.         self.attack_finished = time + 0.6;
  1120.     }
  1121.     else if (self.weapon == IT_ROCKET_LAUNCHER)
  1122.     {
  1123.         player_rocket1();
  1124.         W_FireRocket();
  1125.         self.attack_finished = time + 0.8;
  1126.     }
  1127.     else if (self.weapon == IT_LIGHTNING)
  1128.     {
  1129.         player_light1();
  1130.         self.attack_finished = time + 0.1;
  1131.         sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
  1132.     }
  1133.         else if (self.weapon == IT_LASER_GUN)
  1134.     {
  1135.                 player_laser1();
  1136.                 W_FireLaser();
  1137.                 self.attack_finished = time + 0.5;
  1138.  
  1139.                // player_laser1 ();
  1140.     }
  1141.         else if (self.weapon == IT_PLASMA_CANNON)
  1142.     {
  1143.                 player_plasma1();
  1144.                 W_FirePlasma();
  1145.                 self.attack_finished = time + 0.5;
  1146.  
  1147.               //  player_plasma1 ();
  1148.     }
  1149.  
  1150. };
  1151.  
  1152.  
  1153. /*
  1154. ============
  1155. W_ChangeWeapon
  1156.  
  1157. ============
  1158. */
  1159. void() W_ChangeWeapon =
  1160. {
  1161.     local    float    it, am, fl;
  1162.     
  1163.     it = self.items;
  1164.     am = 0;
  1165.     
  1166.     if (self.impulse == 1)
  1167.     {
  1168.         fl = IT_AXE;
  1169.     }
  1170.     else if (self.impulse == 2)
  1171.     {
  1172.         fl = IT_SHOTGUN;
  1173.         if (self.ammo_shells < 1)
  1174.             am = 1;
  1175.     }
  1176.     else if (self.impulse == 3)
  1177.     {
  1178.         fl = IT_SUPER_SHOTGUN;
  1179.         if (self.ammo_shells < 2)
  1180.             am = 1;
  1181.     }        
  1182.     else if (self.impulse == 4)
  1183.     {
  1184.         fl = IT_NAILGUN;
  1185.         if (self.ammo_nails < 1)
  1186.             am = 1;
  1187.     }
  1188.     else if (self.impulse == 5)
  1189.     {
  1190.         fl = IT_SUPER_NAILGUN;
  1191.         if (self.ammo_nails < 2)
  1192.             am = 1;
  1193.     }
  1194.     else if (self.impulse == 6)
  1195.     {
  1196.         fl = IT_GRENADE_LAUNCHER;
  1197.         if (self.ammo_rockets < 1)
  1198.             am = 1;
  1199.     }
  1200.     else if (self.impulse == 7)
  1201.     {
  1202.         fl = IT_ROCKET_LAUNCHER;
  1203.         if (self.ammo_rockets < 1)
  1204.             am = 1;
  1205.     }
  1206.     else if (self.impulse == 8)
  1207.     {
  1208.         fl = IT_LIGHTNING;
  1209.         if (self.ammo_cells < 1)
  1210.             am = 1;
  1211.     }
  1212.         else if (self.impulse == 9)
  1213.     {
  1214.                 fl = IT_LASER_GUN;
  1215.                 if (self.ammo_cells < 1)
  1216.             am = 1;
  1217.     }
  1218.         else if (self.impulse == 10)
  1219.     {
  1220.                 fl = IT_PLASMA_CANNON;
  1221.                 if (self.ammo_cells < 2)
  1222.             am = 1;
  1223.     }
  1224.  
  1225.     self.impulse = 0;
  1226.     
  1227.     if (!(self.items & fl))
  1228.     {    // don't have the weapon or the ammo
  1229.         sprint (self, "no weapon.\n");
  1230.         return;
  1231.     }
  1232.     
  1233.     if (am)
  1234.     {    // don't have the ammo
  1235.         sprint (self, "not enough ammo.\n");
  1236.         return;
  1237.     }
  1238.  
  1239. //
  1240. // set weapon, set ammo
  1241. //
  1242.     self.weapon = fl;        
  1243.     W_SetCurrentAmmo ();
  1244. };
  1245.  
  1246. /*
  1247. ============
  1248. CheatCommand
  1249. ============
  1250. */
  1251. void() CheatCommand =
  1252. {
  1253.     if (deathmatch || coop)
  1254.         return;
  1255.  
  1256.     self.ammo_rockets = 100;
  1257.     self.ammo_nails = 200;
  1258.     self.ammo_shells = 100;
  1259.     self.items = self.items | 
  1260.         IT_AXE |
  1261.         IT_SHOTGUN |
  1262.         IT_SUPER_SHOTGUN |
  1263.         IT_NAILGUN |
  1264.         IT_SUPER_NAILGUN |
  1265.         IT_GRENADE_LAUNCHER |
  1266.         IT_ROCKET_LAUNCHER |
  1267.                 IT_LASER_GUN |
  1268.                 IT_PLASMA_CANNON |
  1269.         IT_KEY1 | IT_KEY2;
  1270.  
  1271.     self.ammo_cells = 200;
  1272.     self.items = self.items | IT_LIGHTNING;
  1273.  
  1274.     self.weapon = IT_ROCKET_LAUNCHER;
  1275.     self.impulse = 0;
  1276.     W_SetCurrentAmmo ();
  1277. };
  1278.  
  1279. /*
  1280. ============
  1281. CycleWeaponCommand
  1282.  
  1283. Go to the next weapon with ammo
  1284. ============
  1285. */
  1286. void() CycleWeaponCommand =
  1287. {
  1288.     local    float    it, am;
  1289.     
  1290.     it = self.items;
  1291.     self.impulse = 0;
  1292.     
  1293.     while (1)
  1294.     {
  1295.         am = 0;
  1296.  
  1297.         if (self.weapon == IT_LIGHTNING)
  1298.         {
  1299.             self.weapon = IT_AXE;
  1300.         }
  1301.                 if (self.weapon == IT_LASER_GUN)
  1302.         {
  1303.             self.weapon = IT_AXE;
  1304.         }
  1305.  
  1306.                 else if (self.weapon == IT_AXE)
  1307.         {
  1308.             self.weapon = IT_SHOTGUN;
  1309.             if (self.ammo_shells < 1)
  1310.                 am = 1;
  1311.         }
  1312.         else if (self.weapon == IT_SHOTGUN)
  1313.         {
  1314.             self.weapon = IT_SUPER_SHOTGUN;
  1315.             if (self.ammo_shells < 2)
  1316.                 am = 1;
  1317.         }        
  1318.         else if (self.weapon == IT_SUPER_SHOTGUN)
  1319.         {
  1320.             self.weapon = IT_NAILGUN;
  1321.             if (self.ammo_nails < 1)
  1322.                 am = 1;
  1323.         }
  1324.         else if (self.weapon == IT_NAILGUN)
  1325.         {
  1326.             self.weapon = IT_SUPER_NAILGUN;
  1327.             if (self.ammo_nails < 2)
  1328.                 am = 1;
  1329.         }
  1330.         else if (self.weapon == IT_SUPER_NAILGUN)
  1331.         {
  1332.             self.weapon = IT_GRENADE_LAUNCHER;
  1333.             if (self.ammo_rockets < 1)
  1334.                 am = 1;
  1335.         }
  1336.         else if (self.weapon == IT_GRENADE_LAUNCHER)
  1337.         {
  1338.             self.weapon = IT_ROCKET_LAUNCHER;
  1339.             if (self.ammo_rockets < 1)
  1340.                 am = 1;
  1341.         }
  1342.         else if (self.weapon == IT_ROCKET_LAUNCHER)
  1343.         {
  1344.             self.weapon = IT_LIGHTNING;
  1345.             if (self.ammo_cells < 1)
  1346.                 am = 1;
  1347.         }
  1348.                 else if (self.weapon == IT_LIGHTNING)
  1349.         {
  1350.                         self.weapon = IT_PLASMA_CANNON;
  1351.                         if (self.ammo_cells < 2)
  1352.                 am = 1;
  1353.         }
  1354.     
  1355.         if ( (self.items & self.weapon) && am == 0)
  1356.         {
  1357.             W_SetCurrentAmmo ();
  1358.             return;
  1359.         }
  1360.     }
  1361.  
  1362. };
  1363.  
  1364. /*
  1365. ============
  1366. ServerflagsCommand
  1367.  
  1368. Just for development
  1369. ============
  1370. */
  1371. void() ServerflagsCommand =
  1372. {
  1373.     serverflags = serverflags * 2 + 1;
  1374. };
  1375.  
  1376. void() QuadCheat =
  1377. {
  1378.     if (deathmatch || coop)
  1379.         return;
  1380.     self.super_time = 1;
  1381.     self.super_damage_finished = time + 30;
  1382.     self.items = self.items | IT_QUAD;
  1383.     dprint ("quad cheat\n");
  1384. };
  1385.  
  1386. /*
  1387. ============
  1388. ImpulseCommands
  1389.  
  1390. ============
  1391. */
  1392. void() ImpulseCommands =
  1393. {
  1394.         if (self.impulse >= 1 && self.impulse <= 10)
  1395.         W_ChangeWeapon ();
  1396.  
  1397.         if (self.impulse == 11)
  1398.         CheatCommand ();
  1399.         if (self.impulse == 12)
  1400.         CycleWeaponCommand ();
  1401.         if (self.impulse == 13)
  1402.         ServerflagsCommand ();
  1403.  
  1404.     if (self.impulse == 255)
  1405.         QuadCheat ();
  1406.         
  1407.     self.impulse = 0;
  1408. };
  1409.  
  1410. /*
  1411. ============
  1412. W_WeaponFrame
  1413.  
  1414. Called every frame so impulse events can be handled as well as possible
  1415. ============
  1416. */
  1417. void() W_WeaponFrame =
  1418. {
  1419.     if (time < self.attack_finished)
  1420.         return;
  1421.  
  1422.     ImpulseCommands ();
  1423.     
  1424. // check for attack
  1425.     if (self.button0)
  1426.     {
  1427.         SuperDamageSound ();
  1428.         W_Attack ();
  1429.     }
  1430. };
  1431.  
  1432. /*
  1433. ========
  1434. SuperDamageSound
  1435.  
  1436. Plays sound if needed
  1437. ========
  1438. */
  1439. void() SuperDamageSound =
  1440. {
  1441.     if (self.super_damage_finished > time)
  1442.     {
  1443.         if (self.super_sound < time)
  1444.         {
  1445.             self.super_sound = time + 1;
  1446.             sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM);
  1447.         }
  1448.     }
  1449.     return;
  1450. };
  1451.  
  1452.  
  1453.