]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_hagar.c
Added crylink trails
[divverent/nexuiz.git] / qcsrc / gamec / w_hagar.c
1 void() hagar_ready_01;
2 void() hagar_fire1_01;
3 void() hagar_fire2_01;
4 void() hagar_deselect_01;
5 void() hagar_select_01;
6
7 float() hagar_check =
8 {
9         if (self.ammo_rockets >= 1)
10                 return TRUE;
11         return FALSE;
12 };
13
14 void(float req) w_hagar =
15 {
16         if (req == WR_IDLE)
17                 hagar_ready_01();
18         else if (req == WR_FIRE1)
19                 weapon_prepareattack(hagar_check, hagar_check, hagar_fire1_01, 0.2);
20         else if (req == WR_FIRE2)
21                 weapon_prepareattack(hagar_check, hagar_check, hagar_fire2_01, 0.2);
22         else if (req == WR_RAISE)
23                 hagar_select_01();
24         else if (req == WR_UPDATECOUNTS)
25                 self.currentammo = self.ammo_rockets;
26         else if (req == WR_DROP)
27                 hagar_deselect_01();
28         else if (req == WR_SETUP)
29                 weapon_setup(WEP_HAGAR, "w_hagar.zym", IT_ROCKETS);
30         else if (req == WR_CHECKAMMO)
31                 weapon_hasammo = hagar_check();
32 };
33
34 void W_Hagar_Explode (void)
35 {
36         ImpactEffect (self, IT_HAGAR);
37
38         self.event_damage = nullfunction;
39         RadiusDamage (self, self.owner, cvar("g_balance_hagar_damage"), cvar("g_balance_hagar_edgedamage"), cvar("g_balance_hagar_radius"), world, cvar("g_balance_hagar_force"), IT_HAGAR);
40
41         remove (self);
42 }
43
44 void W_Hagar_Touch (void)
45 {
46         if (other == self.owner)
47                 return;
48         else if (pointcontents (self.origin) == CONTENT_SKY)
49         {
50                 remove (self);
51                 return;
52         }
53
54         W_Hagar_Explode ();
55 }
56
57 void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
58 {
59         self.health = self.health - damage;
60         if (self.health <= 0)
61                 W_Hagar_Explode();
62 }
63
64 void W_Hagar_Attack (void)
65 {
66         entity  missile;
67         float   sped;
68
69         makevectors(self.v_angle);
70         sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", 1, ATTN_NORM);
71
72         missile = spawn ();
73         missile.owner = self;
74         missile.classname = "missile";
75
76         missile.takedamage = DAMAGE_YES;
77         missile.damageforcescale = 4;
78         missile.health = 10;
79         missile.event_damage = W_Hagar_Damage;
80
81         missile.movetype = MOVETYPE_FLY;
82         missile.solid = SOLID_BBOX;
83         setmodel (missile, "models/hagarmissile.mdl");
84         setsize (missile, '0 0 0', '0 0 0');
85         missile.scale = 0.4;
86
87         setorigin (missile, self.origin + self.view_ofs + v_forward * 25 + v_right * 5 + v_up * -8);
88
89         sped = cvar("g_balance_hagar_speed");
90         missile.velocity = v_forward * sped + v_right * crandom() * 0.035 * sped + v_up * crandom() * 0.015 * sped;
91         missile.angles = vectoangles (missile.velocity);
92
93         missile.touch = W_Hagar_Touch;
94         missile.think = W_Hagar_Explode;
95         missile.nextthink = time + 10;
96
97         self.attack_finished = time + 0.2;
98         self.ammo_rockets = self.ammo_rockets - 1;
99 }
100
101 void W_Hagar_Attack2 (void)
102 {
103         entity  missile;
104
105         sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", 1, ATTN_NORM);
106
107         makevectors(self.v_angle);
108
109         missile = spawn ();
110         missile.owner = self;
111         missile.classname = "missile";
112
113         missile.movetype = MOVETYPE_TOSS;
114         missile.solid = SOLID_BBOX;
115
116         missile.takedamage = DAMAGE_YES;
117         missile.damageforcescale = 4;
118         missile.health = 5;
119         missile.event_damage = W_Hagar_Damage;
120
121         setmodel (missile, "models/hagarmissile.mdl");
122         setsize (missile, '-6 -6 -3', '6 6 3');
123
124         setorigin (missile, self.origin + self.view_ofs + v_forward * 25 + v_right * 5 + v_up * -8);
125
126         missile.scale = 0.4;
127
128         missile.velocity = v_forward * cvar("g_balance_hagar_speed2") + v_up * cvar("g_balance_hagar_speed2_up");
129         missile.angles = vectoangles (missile.velocity);
130         missile.avelocity = '100 10 10';
131
132         missile.touch = W_Hagar_Touch;
133         missile.think = W_Hagar_Explode;
134         missile.nextthink = time + 10;
135
136         self.attack_finished = time + 0.2;
137         self.ammo_rockets = self.ammo_rockets - 1;
138 }
139
140 // weapon frames
141 void()  hagar_ready_01 =        {weapon_thinkf(WFRAME_IDLE, 0.1, hagar_ready_01); self.weaponentity.state = WS_READY;};
142 void()  hagar_select_01 =       {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
143 void()  hagar_deselect_01 =     {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
144 void()  hagar_fire1_01 =
145 {
146         weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack);
147         weapon_thinkf(WFRAME_FIRE1, 0.15, hagar_ready_01);
148 };
149 void()  hagar_fire2_01 =
150 {
151         weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack2);
152         weapon_thinkf(WFRAME_FIRE2, 0.15, hagar_ready_01);
153 };
154