]> icculus.org git repositories - divverent/nexuiz.git/blob - TeamNexuiz/game/gamec/tfclient.c
- Improved accuracy of Rail Gun. Note: it still looks a bit off so sooner or later...
[divverent/nexuiz.git] / TeamNexuiz / game / gamec / tfclient.c
1 float intermission_running;                             // This was moved here from mauvebot.c\r
2 float intermission_exittime;                    // This was moved here from g_world.c\r
3 void (entity AD) ParseTFDetect;\r
4 \r
5 entity () FindIntermission =\r
6 {\r
7         local entity spot;\r
8         local float cyc;\r
9 \r
10         spot = find (world, classname, "info_intermission");\r
11         if (spot)\r
12         {\r
13                 cyc = (random () * 1);\r
14                 return (spot);\r
15         }\r
16         spot = find (world, classname, "info_player_start");\r
17         if (spot)\r
18         {\r
19                 return (spot);\r
20         }\r
21         spot = find (world, classname, "info_player_deathmatch");\r
22         if (spot)\r
23         {\r
24                 cyc = (random () * 6);\r
25                 while ((cyc > 1))\r
26                 {\r
27                         spot = find (spot, classname, "info_player_deathmatch");\r
28                         if (!spot)\r
29                         {\r
30                                 spot = find (spot, classname, "info_player_deathmatch");\r
31                         }\r
32                         cyc = (cyc - 1);\r
33                 }\r
34                 return (spot);\r
35         }\r
36         objerror ("FindIntermission: no spot");\r
37 };\r
38 \r
39 // This sets all the settings for the level including teams allowed, and lives and legal classes etc.\r
40 // it is called only once, for the first player who joins\r
41 void () DecodeLevelParms =\r
42 {\r
43                 if (parems_decoded == 1)\r
44                         return;\r
45                 else {\r
46                         // The following allows play on Nexuiz/NexCTF maps if there is no info_tfdetect on a map\r
47                         if (team1maxplayers == 0)\r
48                                 team1maxplayers = 4;\r
49                         if (team2maxplayers == 0)\r
50                                 team2maxplayers = 4;\r
51                         if (team1lives == 0)\r
52                                 team1lives = -1;\r
53                         if (team2lives == 0)\r
54                                 team2lives = -1;\r
55 \r
56                         local entity decent;\r
57                         decent = find (world, classname, "info_tfdetect");\r
58                         if ((decent != world))\r
59                         {\r
60 //                              teamplay = cvar ("teamplay");\r
61 //                              if ((teamplay == 0))\r
62 //                              {\r
63                                         cvar_set ("teamplay", "21?TeamFortress");\r
64 //                              }\r
65                                 ParseTFDetect (decent);         // This returns the map's team/class allowances\r
66                                 if (((number_of_teams <= 0.000000) || (number_of_teams >= 5.000000)))\r
67                                 {\r
68                                         number_of_teams = 4.000000;\r
69                                 }\r
70                         }\r
71                 }\r
72                 parems_decoded = 1;\r
73 };\r
74 \r
75 // Execute Change Level\r
76 void () execute_changelevel =\r
77 {\r
78         local entity pos;\r
79 \r
80         intermission_running = 1;\r
81         if (deathmatch)\r
82         {\r
83                 intermission_exittime = (time + 5);\r
84         }\r
85         else\r
86         {\r
87                 intermission_exittime = (time + 2);\r
88         }\r
89         WriteByte (2, 32);\r
90         WriteByte (2, 3);\r
91         WriteByte (2, 3);\r
92         pos = FindIntermission ();\r
93         other = find (world, classname, "player");\r
94         while ((other != world))\r
95         {\r
96                 other.view_ofs = '0 0 0';\r
97                 other.v_angle = pos.mangle;\r
98                 other.angles = pos.mangle;\r
99                 other.fixangle = 1;\r
100                 other.nextthink = (time + 0.5);\r
101                 other.takedamage = 0;\r
102                 other.solid = 0;\r
103                 other.movetype = 0;\r
104                 other.modelindex = 0;\r
105                 setorigin (other, pos.origin);\r
106                 other = find (other, classname, "player");\r
107         }\r
108         WriteByte (2, 30);\r
109 };