]> icculus.org git repositories - divverent/nexuiz.git/blob - attic/TeamNexuiz/game/gamec/w_setrope.c
now menu qc respects g_campaign_name
[divverent/nexuiz.git] / attic / TeamNexuiz / game / gamec / w_setrope.c
1 void() setrope_ready_01;\r
2 void() setrope_fire1_01;\r
3 void() setrope_deselect_01;\r
4 void() setrope_select_01;\r
5 \r
6 float() setrope_check =\r
7 {\r
8         return TRUE;\r
9 }\r
10 \r
11 void(float req) w_setrope =\r
12 {\r
13         if (req == WR_IDLE)\r
14                 setrope_ready_01();\r
15         else if (req == WR_FIRE1)\r
16                 weapon_prepareattack(setrope_check, setrope_check, setrope_fire1_01, cvar("g_balance_setrope_refire"));\r
17         else if (req == WR_RAISE)\r
18                 setrope_select_01();\r
19         else if (req == WR_UPDATECOUNTS)\r
20                 self.currentammo = 1;\r
21         else if (req == WR_DROP)\r
22                 setrope_deselect_01();\r
23         else if (req == WR_SETUP)\r
24                 weapon_setup(WEP_SETROPE, "w_setrope.zym", 0);\r
25         else if (req == WR_CHECKAMMO)\r
26                 weapon_hasammo = setrope_check();\r
27 }\r
28 \r
29 void RemoveRope()\r
30 {\r
31 }\r
32 \r
33 void RopeThink()\r
34 {\r
35 }\r
36 \r
37 void RopeTouch (void)\r
38 {\r
39         if (other.classname != "player" || other.health < 1)\r
40                 return;\r
41         other.ladder_time = time + 0.1;\r
42         other.ladder_entity = self;\r
43 }\r
44 \r
45 void W_SetRope (void)\r
46 {\r
47         local entity ropestand, oself;\r
48         local vector org;\r
49 \r
50         makevectors(self.v_angle);\r
51         org = self.origin + self.view_ofs + v_forward * 15 - v_right * 5 + v_up * -12;\r
52 \r
53         ropestand = spawn ();\r
54         ropestand.owner = self;\r
55         ropestand.classname = "ropestand";\r
56 \r
57         ropestand.movetype = MOVETYPE_NONE;\r
58         ropestand.solid = SOLID_BBOX;\r
59 \r
60         setmodel (ropestand, "models/ropebase.mdl");\r
61         setsize (ropestand, '0 0 0', '0 0 0');\r
62         setorigin (ropestand, org);\r
63 \r
64         oself = self;\r
65         self = ropestand;\r
66         droptofloor();\r
67         self = oself;\r
68 \r
69         ropestand.angles = self.angles;\r
70         ropestand.angles_x = ropestand.angles_z = 0;\r
71 \r
72         //ropestand.touch = RopeStandTouch;\r
73         ropestand.think = RopeExtend;\r
74         ropestand.nextthink = time + 0.1;\r
75 }\r
76 \r
77 void()  setrope_ready_01 =      {weapon_thinkf(WFRAME_IDLE, 0.1, setrope_ready_01); self.weaponentity.state = WS_READY;};\r
78 void()  setrope_select_01 =     {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};\r
79 void()  setrope_deselect_01 =   {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};\r
80 void()  setrope_fire1_01 =\r
81 {\r
82         weapon_doattack(setrope_check, setrope_check, W_SetRope);\r
83         weapon_thinkf(WFRAME_FIRE1, 0.3, setrope_ready_01);\r
84 }\r