annotate shortcomm.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1 /* $Id: shortcomm.c,v 1.1.1.1 1997/12/06 05:41:30 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 /* This file implements all SHORT_PACKETS functions */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 /* HW 19.07.93 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 #ifdef SHORT_PACKETS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 #ifdef HPBSD
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8 #include <machine/endian.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 #include <sys/types.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 #include <netinet/in.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 #include <sys/socket.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15 #include <sys/time.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 #ifdef RS6K
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 #include <sys/select.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 #endif /* RS6K */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 #include <netdb.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 #include <math.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21 #include <errno.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 #include "Wlib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 #include "struct.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 #include "data.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 #include "packets.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 #include "gameconf.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 #ifdef SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 #include "Slib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 #include "sound.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 #if 1
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 char *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 ship_type(shp)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 struct ship *shp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 static char ring[4][3];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40 static int ri;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41 char *rval;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 ring[ri][0] = shp->s_desig[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 ring[ri][1] = shp->s_desig[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 ring[ri][2] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45 rval = ring[ri];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 ri++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 if (ri >= sizeof(ring) / sizeof(*ring))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48 ri = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49 return rval;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51 #define TEAM_LETTER(p) ( teaminfo[(p).p_teami].letter )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52 #define TEAM_SHORT(p) ( teaminfo[(p).p_teami].shortname )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 #define TEAM_LETTERP(pl) ( teaminfo[mask_to_idx((pl).pl_owner)].letter )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54 #define TEAM_SHORTP(pl) ( teaminfo[mask_to_idx((pl).pl_owner)].shortname )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 #define reviewWin messWin[WREVIEW].window
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56 #define MAXTORP ntorps
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57 #define MAXPLANETS nplanets
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58 #define MAXPLASMA nplasmas
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 #define ship_type(shp) shiptype[(shp).s_type]
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 #define TEAM_LETTER(p) ( teamlet[(p).p_team] )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64 #define TEAM_SHORT(p) ( teamshort[(p).p_team] )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 #define TEAM_LETTERP(pl) ( teamlet[(pl).pl_owner] )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66 #define TEAM_SHORTP(pl) ( teamshort[(pl).pl_owner] )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 /* from here on all SHORT_PACKETS */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71 #include "wtext.h" /* here are all warningdefines */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 /* Here are all warnings that are send with SP_S_WARNING */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74 /* HW 93 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 /* DaemonMessages */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 char *daemon_texts[] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 /* Game_Paused() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 "Game is paused. CONTINUE to continue.", /* 0 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 "Game is no-longer paused!",/* 1 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82 "Game is paused. Captains CONTINUE to continue.", /* 2 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83 "Game will continue in 10 seconds", /* 3 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84 /* send_about_to_start() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85 "Teams chosen. Game will start in 1 minute.", /* 4 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 "----------- Game will start in 1 minute -------------", /* 5 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 };
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 /* VARITEXTE = warnings with 1 or more arguments argument */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90 char *vari_texts[] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 /* redraw.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93 "Engineering: Energizing transporters in %d seconds", /* 0 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 "Stand By ... Self Destruct in %d seconds", /* 1 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 "Helmsman: Docking manuever completed Captain. All moorings secured at port %d.", /* 2 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 /* interface.c from INL server */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 "Not constructed yet. %d minutes required for completion", /* 3 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99 };
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103 char *w_texts[] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105 /* socket.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 "Tractor beams haven't been invented yet.", /* 0 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 "Weapons's Officer: Cannot tractor while cloaked, sir!", /* 1 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 "Weapon's Officer: Vessel is out of range of our tractor beam.", /* 2 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110 /* handleRepressReq */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 /**************** coup.c ***********************/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112 /* coup() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 "You must have one kill to throw a coup", /* 3 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 "You must orbit your home planet to throw a coup", /* 4 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 "You already own a planet!!!", /* 5 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 "You must orbit your home planet to throw a coup", /* 6 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 "Too many armies on planet to throw a coup", /* 7 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 "Planet not yet ready for a coup", /* 8 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119 /* getentry.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120 /* getentry() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121 "I cannot allow that. Pick another team", /* 9 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 "Please confirm change of teams. Select the new team again.", /* 10 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 "That is an illegal ship type. Try again.", /* 11 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 "That ship hasn't beed designed yet. Try again.", /* 12 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 "Your new starbase is still under construction", /* 13 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 "Your team is not capable of defending such an expensive ship!", /* 14 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 "Your team's stuggling economy cannot support such an expenditure!", /* 15 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128 "Your side already has a starbase!", /* 16 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 /* plasma.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 /* nplasmatorp(course, type) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 "Plasmas haven't been invented yet.", /* 17 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132 "Weapon's Officer: Captain, this ship is not armed with plasma torpedoes!", /* 18 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 "Plasma torpedo launch tube has exceeded the maximum safe temperature!", /* 19 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134 "Our fire control system limits us to 1 live torpedo at a time captain!", /* 20 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 "Our fire control system limits us to 1 live torpedo at a time captain!", /* 21 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 "We don't have enough fuel to fire a plasma torpedo!", /* 22 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137 "We cannot fire while our vessel is undergoing repairs.", /* 23 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138 "We are unable to fire while in cloak, captain!", /* 24 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 /******** torp.c *********/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140 /* ntorp(course, type) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141 "Torpedo launch tubes have exceeded maximum safe temperature!", /* 25 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142 "Our computers limit us to having 8 live torpedos at a time captain!", /* 26 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143 "We don't have enough fuel to fire photon torpedos!", /* 27 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144 "We cannot fire while our vessel is in repair mode.", /* 28 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145 "We are unable to fire while in cloak, captain!", /* 29 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 "We only have forward mounted cannons.", /* 30 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147 /* phasers.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 /* phaser(course) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 "Weapons Officer: This ship is not armed with phasers, captain!", /* 31 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 "Phasers have not recharged", /* 32 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 "Not enough fuel for phaser", /* 33 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152 "Can't fire while repairing", /* 34 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 "Weapons overheated", /* 35 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 "Cannot fire while cloaked",/* 36 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 "Phaser missed!!!", /* 37 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 "You destroyed the plasma torpedo!", /* 38 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157 /* interface.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 /* bomb_planet() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159 "Must be orbiting to bomb", /* 39 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 "Can't bomb your own armies. Have you been reading Catch-22 again?", /* 40 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161 "Must declare war first (no Pearl Harbor syndrome allowed here).", /* 41 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162 "Bomb out of T-mode? Please verify your order to bomb.", /* 42 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 "Hoser!", /* 43 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 /* beam_up() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 "Must be orbiting or docked to beam up.", /* 44 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166 "Those aren't our men.", /* 45 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 "Comm Officer: We're not authorized to beam foriegn troops on board!", /* 46 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 /* beam_down() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 "Must be orbiting or docked to beam down.", /* 47 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170 "Comm Officer: Starbase refuses permission to beam our troops over.", /* 48 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171 /* declare_war(mask) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 "Pausing ten seconds to re-program battle computers.", /* 49 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173 /* do_refit(type) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 "You must orbit your HOME planet to apply for command reassignment!", /* 50 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 "You must orbit your home planet to apply for command reassignment!", /* 51 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 "Can only refit to starbase on your home planet.", /* 52 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 "You must dock YOUR starbase to apply for command reassignment!", /* 53 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178 "Must orbit home planet or dock your starbase to apply for command reassignment!", /* 54 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 "Central Command refuses to accept a ship in this condition!", /* 55 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 "You must beam your armies down before moving to your new ship", /* 56 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 "That ship hasn't been designed yet.", /* 57 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182 "Your side already has a starbase!", /* 58 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 "Your team is not capable of defending such an expensive ship", /* 59 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 "Your new starbase is still under construction", /* 60 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185 "Your team's stuggling economy cannot support such an expenditure!", /* 61 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186 "You are being transported to your new vessel .... ", /* 62 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 /* redraw.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 /* auto_features() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189 "Engineering: Energize. [ SFX: chimes ]", /* 63 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190 "Wait, you forgot your toothbrush!", /* 64 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 "Nothing like turning in a used ship for a new one.", /* 65 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 "First officer: Oh no, not you again... we're doomed!", /* 66 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 "First officer: Uh, I'd better run diagnostics on the escape pods.", /* 67 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 "Shipyard controller: This time, *please* be more careful, okay?", /* 68 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195 "Weapons officer: Not again! This is absurd...", /* 69 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 "Weapons officer: ... the whole ship's computer is down?", /* 70 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 "Weapons officer: Just to twiddle a few bits of the ship's memory?", /* 71 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198 "Weapons officer: Bah! [ bangs fist on inoperative console ]", /* 72 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 "First Officer: Easy, big guy... it's just one of those mysterious", /* 73 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 "First Officer: laws of the universe, like 'tires on the ether'.", /* 74 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201 "First Officer: laws of the universe, like 'Klingon bitmaps are ugly'.", /* 75 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 "First Officer: laws of the universe, like 'all admirals have scummed'.", /* 76 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203 "First Officer: laws of the universe, like 'Mucus Pig exists'.", /* 77 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 "First Officer: laws of the universe, like 'guests advance 5x faster'.", /* 78 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205 /* orbit.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 /*orbit() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207 "Helmsman: Captain, the maximum safe speed for docking or orbiting is warp 2!", /* 79 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 "Central Command regulations prohibits you from orbiting foreign planets", /* 80 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209 "Helmsman: Sensors read no valid targets in range to dock or orbit sir!", /* 81 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 /* redraw.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 "No more room on board for armies", /* 82 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 "You notice everyone on the bridge is staring at you.", /* 83 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 /* startdaemon.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214 /* practice_robo() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 "Can't send in practice robot with other players in the game.", /* 84 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 /* socket.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217 /* doRead(asock) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218 "Self Destruct has been canceled", /* 85 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219 /* handleMessageReq(packet) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 "Be quiet", /* 86 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221 "You are censured. Message was not sent.", /* 87 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222 "You are ignoring that player. Message was not sent.", /* 88 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 "That player is censured. Message was not sent.", /* 89 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224 /* handleQuitReq(packet) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 "Self destruct initiated", /* 90 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 /* handleScan(packet) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 "Scanners haven't been invented yet", /* 91 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228 /* handleUdpReq(packet) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 "WARNING: BROKEN mode is enabled", /* 92 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230 "Server can't do that UDP mode", /* 93 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 "Server will send with TCP only", /* 94 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 "Server will send with simple UDP", /* 95 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 "Request for fat UDP DENIED (set to simple)", /* 96 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234 "Request for double UDP DENIED (set to simple)", /* 97 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235 /* forceUpdate() */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236 "Update request DENIED (chill out!)", /* 98 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237 /* INL redraw.c */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238 "Player lock lost while player dead.", /* 99 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 "Can only lock on own team.", /* 100 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 "You can only warp to your own team's planets!", /* 101 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241 "Planet lock lost on change of ownership.", /* 102 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242 " Weapons officer: Finally! systems are back online!", /* 103 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244 };
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 #define NUMWTEXTS (sizeof w_texts / sizeof w_texts[0])
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247 #define NUMVARITEXTS ( sizeof vari_texts / sizeof vari_texts[0])
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 #define NUMDAEMONTEXTS ( sizeof daemon_texts / sizeof daemon_texts[0])
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 void add_whydead();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253 extern int vtisize[];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 extern unsigned char numofbits[];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256 int Plx[MAX_PLAYER], Ply[MAX_PLAYER], Pgx[MAX_PLAYER], Pgy[MAX_PLAYER];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257 unsigned char Pdir[MAX_PLAYER];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 int my_x, my_y; /* for rotation we need to keep track of our
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260 real coordinates */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 /* SP_S_WARNING vari texte */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262 char *s_texte[256]; /* Better with a malloc scheme */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 char no_memory[] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264 {"Not enough memory for warning string!"};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 /* For INL Server */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 char *shiptype[NUM_TYPES] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269 {"SC", "DD", "CA", "BB", "AS", "SB", "??"};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271 int spwinside = 500; /* WINSIDE from Server */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 long spgwidth = 100000;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276 sendThreshold(v)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277 unsigned short v;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279 struct threshold_cpacket p;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 p.type = CP_S_THRS;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 p.thresh = v;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 sendServerPacket((struct player_spacket *) & p);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 handleVTorp(sbuf)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288 unsigned char *sbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290 unsigned char *which, *data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291 unsigned char bitset;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 struct torp *thetorp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294 int shiftvar;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297 register int shift = 0; /* How many torps are extracted (for shifting
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 ) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300 /* now we must find the data ... :-) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 if (sbuf[0] == SP_S_8_TORP) { /* MAX packet */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 bitset = 0xff;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 which = &sbuf[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 data = &sbuf[2];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305 } else { /* Normal Packet */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 bitset = sbuf[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307 which = &sbuf[2];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 data = &sbuf[3];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311 #ifdef CORRUPTED_PACKETS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312 /* we probably should do something clever here - jmn */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 thetorp = &torps[((unsigned char) *which * 8)];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 for (shift = 0, i = 0; i < 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 #if defined(RS6K) || defined(__SABER__)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 i++, thetorp++, bitset >>= 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320 i++, thetorp++, bitset = ((unsigned char)bitset) >> 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322 if (bitset & 01) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323 dx = (*data >> shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 data++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 shiftvar = (unsigned char) *data; /* to silence gcc */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 shiftvar <<= (8 - shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 dx |= (shiftvar & 511);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 shift++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 dy = (*data >> shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330 data++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331 shiftvar = (unsigned char) *data; /* to silence gcc */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332 shiftvar <<= (8 - shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 dy |= (shiftvar & 511);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334 shift++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 if (shift == 8) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
336 shift = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
337 data++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
338 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
339 /* This is necessary because TFREE/TMOVE is now encoded in the bitset */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
340 if (thetorp->t_status == TFREE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
341 thetorp->t_status = TMOVE; /* guess */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
342 players[thetorp->t_owner].p_ntorp++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
343 #ifdef UNIX_SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
344 play_sound (SND_FIRETORP); /* Fire Torp */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
345 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
346 } else if (thetorp->t_owner == me->p_no && thetorp->t_status == TEXPLODE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
347 thetorp->t_status = TMOVE; /* guess */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
348 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
349 /* Check if torp is visible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
350 if (dx > spwinside || dy > spwinside) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
351 thetorp->t_x = -100000; /* Not visible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
352 thetorp->t_y = -100000;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
353 } else { /* visible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
354 /* thetorp->t_x = me->p_x + ((dx - spwinside / 2) * SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
355 thetorp->t_y = me->p_y + ((dy - spwinside / 2) * SCALE); */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
356 thetorp->t_x = my_x + ((dx - spwinside / 2) * SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
357 thetorp->t_y = my_y + ((dy - spwinside / 2) * SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
358 #ifdef ROTATERACE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
359 if (rotate) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
360 rotate_coord(&thetorp->t_x, &thetorp->t_y, rotate_deg,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
361 spgwidth / 2, spgwidth / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
362 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
363 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
364 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
365 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
366 /* if */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
367 else { /* We got a TFREE */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
368 if (thetorp->t_status && thetorp->t_status != TEXPLODE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
369 players[thetorp->t_owner].p_ntorp--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
370 thetorp->t_status = TFREE; /* That's no guess */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
371 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
372 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
373 } /* for */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
374 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
375
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
376 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
377 handleSelfShort(packet)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
378 struct youshort_spacket *packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
379 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
380 me = (ghoststart ? &players[ghost_pno] : &players[packet->pnum]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
381 myship = me->p_ship;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
382 mystats = &(me->p_stats);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
383 me->p_hostile = packet->hostile;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
384 me->p_swar = packet->swar;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
385 me->p_armies = packet->armies;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
386 me->p_flags = ntohl(packet->flags);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
387 me->p_whydead = packet->whydead;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
388 me->p_whodead = packet->whodead;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
389 #ifdef SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
390 S_HandlePFlags();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
391 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
392 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
393
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
394 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
395 handleSelfShip(packet)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
396 struct youss_spacket *packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
397 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
398 if (!me)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
399 return; /* wait.. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
400
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
401 me->p_damage = ntohs(packet->damage);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
402 me->p_shield = ntohs(packet->shield);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
403 me->p_fuel = ntohs(packet->fuel);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
404 me->p_etemp = ntohs(packet->etemp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
405 me->p_wtemp = ntohs(packet->wtemp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
406 #ifdef SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
407 S_HandlePFlags();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
408 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
409 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
410
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
411 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
412 handleVPlayer(sbuf)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
413 unsigned char *sbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
414 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
415 register int x, y, i, numofplayers, pl_no, save;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
416 register struct player *pl;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
417 unsigned char newdir; /* needed for uncloak kludge with ROTATERACE */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
418 int offset;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
419
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
420 numofplayers = (unsigned char) sbuf[1] & 0x3f;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
421
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
422 if (sbuf[1] & (unsigned char) 128) { /* Short Header + Extended */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
423 sbuf += 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
424 offset = 32; /* more than 32 players? */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
425 } else if (sbuf[1] & 64) { /* Short Header */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
426 sbuf += 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
427 offset = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
428 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
429 struct player_s_spacket *packet = (struct player_s_spacket *) sbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
430 pl = &players[me->p_no];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
431 pl->p_dir = (unsigned char) packet->dir;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
432 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
433 Pdir[me->p_no] = (unsigned char) rosette(pl->p_dir, 16);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
434 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
435 pl->p_speed = packet->speed;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
436 #ifdef FEATURE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
437 if (F_dead_warp && (pl->p_speed == 14)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
438 if (pl->p_status == PALIVE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
439 pl->p_status = PEXPLODE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
440 pl->p_explode = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
441 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
442 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
443 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
444 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
445 pl->p_x = my_x = ntohl(packet->x);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
446 pl->p_y = my_y = ntohl(packet->y);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
447 #ifdef ROTATERACE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
448 if (rotate) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
449 rotate_coord(&pl->p_x, &pl->p_y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
450 rotate_deg, spgwidth / 2, spgwidth / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
451 rotate_dir(&pl->p_dir, rotate_deg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
452 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
453 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
454 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
455 Plx[me->p_no] = WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
456 Ply[me->p_no] = WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
457 Pgx[me->p_no] = pl->p_x * WINSIDE / spgwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
458 Pgy[me->p_no] = pl->p_y * WINSIDE / spgwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
459 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
460 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
461 redrawPlayer[me->p_no] = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
462 sbuf += 12; /* Now the small packets */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
463 offset = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
464 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
465 for (i = 0; i < numofplayers; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
466 pl_no = ((unsigned char) *sbuf & 0x1f) + offset;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
467 if (pl_no >= nplayers)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
468 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
469 save = (unsigned char) *sbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
470 sbuf++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
471 pl = &players[pl_no];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
472 pl->p_speed = (unsigned char) *sbuf & 15; /* SPEED */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
473 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
474 Pdir[pl_no] = (unsigned char) *sbuf >> 4; /* DIR */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
475 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
476 newdir = (unsigned char) *sbuf & 0xf0; /* realDIR */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
477
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
478 #ifdef ROTATERACE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
479 if (rotate)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
480 rotate_dir(&newdir, rotate_deg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
481 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
482 #ifdef FEATURE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
483 if (cloakerMaxWarp) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
484 if (pl->p_speed == 15)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
485 pl->p_flags |= PFCLOAK;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
486 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
487 pl->p_flags &= ~(PFCLOAK);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
488 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
489 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
490 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
491 #ifdef CHECK_DROPPED
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
492 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
493 this is a mess. Too many exceptions. I don't use it any
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
494 more. cloakerMaxWarp is much much better, but requires server
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
495 support.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
496 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
497 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
498 Kludge to fix lost uncloak packets! [3/94] -JR may be a
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
499 problem with server sending directions after cloakphase is at
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
500 CLOAK_PHASES-1, since cloakphase is strictly a client variable
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
501 :(
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
502 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
503 if (pl->p_flags & PFCLOAK && pl->p_cloakphase >= (CLOAK_PHASES - 1) &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
504 (pl->p_dir & 0xf0 != newdir & 0xf0) && !(pl->p_flags & PFORBIT)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
505 int i, plocked = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
506 for (i = 0; i < nplayers; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
507 if ((phasers[i].ph_status & PHHIT) && (phasers[i].ph_target == pl_no)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
508 plocked = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
509 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
510 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
511 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
512 if (!plocked)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
513 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
514 if all of the above, the guy is *probably* uncloaked.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
515 Ask the server.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
516 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
517 sendShortReq(SPK_SALL);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
518 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
519 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
520 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
521 pl->p_dir = newdir; /* realDIR */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
522
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
523 sbuf++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
524 x = (unsigned char) *sbuf++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
525 y = (unsigned char) *sbuf++; /* The lower 8 Bits are saved */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
526
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
527 /* Now we must preprocess the coordinates */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
528 if ((unsigned char) save & 64)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
529 x |= 256;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
530 if ((unsigned char) save & 128)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
531 y |= 256;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
532 #ifdef FEATURE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
533 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
534 MAY CHANGE! dead_warp is still an experiment, some servers are
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
535 also sending illegal co-ords for dead players, so we'll just
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
536 ignore 'em for now if the guy's dead.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
537 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
538 if (F_dead_warp && pl->p_speed == 14) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
539 if (pl->p_status == PALIVE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
540 pl->p_status = PEXPLODE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
541 pl->p_explode = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
542 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
543 redrawPlayer[pl->p_no] = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
544 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
545 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
546 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
547 /* Now test if it's galactic or local coord */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
548 if (save & 32) { /* It's galactic */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
549 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
550 if (x >= 501 || y >= 501) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
551 pl->p_x = -500 * spgwidth / spwinside;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
552 pl->p_y = -500 * spgwidth / spwinside;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
553 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
554 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
555 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
556 pl->p_x = x * spgwidth / spwinside;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
557 pl->p_y = y * spgwidth / spwinside;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
558 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
559 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
560 Pgx[pl_no] = x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
561 Pgy[pl_no] = y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
562 Plx[pl_no] = -1; /* Not visible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
563 Ply[pl_no] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
564 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
565 } else { /* Local */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
566 pl->p_x = my_x + ((x - spwinside / 2) * SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
567 pl->p_y = my_y + ((y - spwinside / 2) * SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
568 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
569 Plx[pl_no] = x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
570 Ply[pl_no] = y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
571 Pgx[pl_no] = pl->p_x * spwinside / spgwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
572 Pgy[pl_no] = pl->p_y * spwinside / spgwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
573 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
574 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
575 redrawPlayer[pl->p_no] = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
576 #ifdef ROTATERACE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
577 if (rotate) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
578 rotate_coord(&pl->p_x, &pl->p_y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
579 rotate_deg, spgwidth / 2, spgwidth / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
580 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
581 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
582 } /* for */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
583 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
584
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
585 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
586 handleSMessage(packet)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
587 struct mesg_s_spacket *packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
588 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
589 char buf[100];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
590 char addrbuf[9];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
591
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
592 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
593 if (debug)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
594 printf("Length of Message is: %d total Size %d \n", strlen(&packet->mesg), (int) packet->length);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
595 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
596 if (packet->m_from >= nplayers)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
597 packet->m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
598
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
599 if (packet->m_from == 255)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
600 strcpy(addrbuf, "GOD->");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
601 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
602 sprintf(addrbuf, " %c%c->", TEAM_LETTER(players[packet->m_from]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
603 shipnos[players[packet->m_from].p_no]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
604 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
605
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
606 switch (packet->m_flags & (MTEAM | MINDIV | MALL)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
607 case MALL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
608 sprintf(addrbuf + 5, "ALL");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
609 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
610 case MTEAM:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
611 sprintf(addrbuf + 5, TEAM_SHORT(*me));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
612 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
613 case MINDIV:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
614 /* I know that it's me -> xxx but i copied it straight ... */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
615 sprintf(addrbuf + 5, "%c%c ", TEAM_LETTER(players[packet->m_recpt]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
616 shipnos[packet->m_recpt]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
617 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
618 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
619 sprintf(addrbuf + 5, "ALL");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
620 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
621 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
622 sprintf(buf, "%-9s%s", addrbuf, &packet->mesg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
623 dmessage(buf, packet->m_flags, packet->m_from, packet->m_recpt);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
624 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
625
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
626 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
627 handleShortReply(packet)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
628 struct shortreply_spacket *packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
629 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
630 switch (packet->repl) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
631 case SPK_VOFF:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
632 recv_short = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
633 sprefresh(SPK_VFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
634 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
635 case SPK_VON:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
636 recv_short = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
637 sprefresh(SPK_VFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
638
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
639 spwinside = (CARD16) ntohs(packet->winside);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
640 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
641 bug in server-side SP code, wrong-endian machines confuse a client
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
642 with normal byte order
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
643 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
644 if (spwinside == 0xf401)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
645 spwinside = 0x01f4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
646
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
647 if (paradise) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
648 spgwidth = (INT32) ntohl(packet->gwidth);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
649 blk_gwidth = spgwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
650 blk_windgwidth = (float)spwinside;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
651 redrawall = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
652
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
653 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
654 bug in server-side SP code, wrong-endian machines confuse a
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
655 client with normal byte order
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
656 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
657 if (spgwidth == 0xa0860100)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
658 spgwidth = 0x000186a0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
659 if (spgwidth == 0x0100)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
660 spgwidth = 0x000186a0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
661 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
662 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
663 case SPK_MOFF:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
664 recv_mesg = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
665 sprefresh(SPK_MFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
666 W_SetSensitive(reviewWin, 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
667 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
668 case SPK_MON:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
669 recv_mesg = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
670 sprefresh(SPK_MFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
671 W_SetSensitive(reviewWin, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
672 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
673 case SPK_M_KILLS:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
674 recv_kmesg = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
675 sprefresh(SPK_KFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
676 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
677 case SPK_M_NOKILLS:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
678 recv_kmesg = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
679 sprefresh(SPK_KFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
680 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
681 case SPK_M_WARN:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
682 recv_warn = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
683 sprefresh(SPK_WFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
684 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
685 case SPK_M_NOWARN:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
686 recv_warn = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
687 sprefresh(SPK_WFIELD);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
688 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
689
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
690 case SPK_THRESHOLD:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
691 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
692 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
693 fprintf(stderr, "%s: unknown response packet value short-req: %d\n",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
694 "netrek", packet->repl);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
695 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
696 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
697
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
698 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
699 handleVTorpInfo(sbuf)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
700 unsigned char *sbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
701 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
702 unsigned char *bitset, *which, *data, *infobitset, *infodata;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
703 struct torp *thetorp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
704 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
705 int shiftvar;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
706 char status, war;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
707 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
708 register int shift = 0; /* How many torps are extracted (for shifting
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
709 ) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
710
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
711 /* now we must find the data ... :-) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
712 bitset = &sbuf[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
713 which = &sbuf[2];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
714 infobitset = &sbuf[3];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
715 /* Where is the data ? */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
716 data = &sbuf[4];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
717 infodata = &sbuf[vtisize[numofbits[(unsigned char) sbuf[1]]]];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
718
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
719 thetorp = &torps[(unsigned char) (*which * 8)];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
720
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
721 for (shift = 0, i = 0; i < 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
722 #if defined(RS6K) || defined(__SABER__)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
723 thetorp++, *bitset >>= 1, *infobitset >>= 1, i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
724 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
725 thetorp++, *bitset = ((unsigned char)*bitset) >> 1, *infobitset = ((unsigned char) *infobitset) >> 1, i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
726 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
727
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
728 if (*bitset & 01) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
729 dx = (*data >> shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
730 data++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
731 shiftvar = (unsigned char) *data; /* to silence gcc */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
732 shiftvar <<= (8 - shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
733 dx |= (shiftvar & 511);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
734 shift++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
735 dy = (*data >> shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
736 data++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
737 shiftvar = (unsigned char) *data; /* to silence gcc */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
738 shiftvar <<= (8 - shift);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
739 dy |= (shiftvar & 511);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
740 shift++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
741 if (shift == 8) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
742 shift = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
743 data++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
744 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
745 /* Check for torp with no TorpInfo */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
746 if (!(*infobitset & 01)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
747 if (thetorp->t_status == TFREE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
748 thetorp->t_status = TMOVE; /* guess */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
749 players[thetorp->t_owner].p_ntorp++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
750 } else if (thetorp->t_owner == me->p_no &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
751 thetorp->t_status == TEXPLODE) { /* If TFREE got lost */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
752 thetorp->t_status = TMOVE; /* guess */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
753 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
754 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
755 /* Check if torp is visible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
756 if (dx > spwinside || dy > spwinside) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
757 thetorp->t_x = -100000; /* Not visible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
758 thetorp->t_y = -100000;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
759 } else { /* visible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
760 /* thetorp->t_x = me->p_x + ((dx - spwinside / 2) * SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
761 thetorp->t_y = me->p_y + ((dy - spwinside / 2) * SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
762 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
763 thetorp->t_x = my_x + ((dx - spwinside / 2) *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
764 SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
765 thetorp->t_y = my_y + ((dy - spwinside / 2) *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
766 SCALE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
767
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
768 #ifdef ROTATERACE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
769 if (rotate) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
770 rotate_coord(&thetorp->t_x, &thetorp->t_y, rotate_deg,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
771 spgwidth / 2, spgwidth / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
772 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
773 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
774 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
775 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
776 /* if */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
777 else { /* Got a TFREE ? */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
778 if (!(*infobitset & 01)) { /* No other TorpInfo for this Torp */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
779 if (thetorp->t_status && thetorp->t_status != TEXPLODE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
780 players[thetorp->t_owner].p_ntorp--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
781 thetorp->t_status = TFREE; /* That's no guess */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
782 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
783 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
784 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
785 /* Now the TorpInfo */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
786 if (*infobitset & 01) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
787 war = (unsigned char) *infodata & 15 /* 0x0f */ ;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
788 status = ((unsigned char) *infodata & 0xf0) >> 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
789 infodata++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
790 if (status == TEXPLODE && thetorp->t_status == TFREE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
791 /* FAT: redundant explosion; don't update p_ntorp */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
792 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
793 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
794 if (thetorp->t_status == TFREE && status) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
795 players[thetorp->t_owner].p_ntorp++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
796 #ifdef UNIX_SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
797 play_sound (SND_FIRETORP); /* Fire Torp */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
798 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
799 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
800 if (thetorp->t_status && status == TFREE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
801 players[thetorp->t_owner].p_ntorp--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
802 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
803 thetorp->t_war = war;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
804 if (status != thetorp->t_status) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
805 /* FAT: prevent explosion reset */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
806 thetorp->t_status = status;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
807 if (thetorp->t_status == TEXPLODE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
808 thetorp->t_fuse = NUMDETFRAMES;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
809 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
810 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
811 } /* if */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
812 } /* for */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
813 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
814
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
815 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
816 handleVPlanet(sbuf)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
817 unsigned char *sbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
818 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
819 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
820 register int numofplanets; /* How many Planets are in the packet */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
821 struct planet *plan;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
822 struct planet_s_spacket *packet = (struct planet_s_spacket *) & sbuf[2];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
823 /* FAT: prevent excessive redraw */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
824 int redraw = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
825
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
826 numofplanets = (unsigned char) sbuf[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
827
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
828 if (numofplanets > MAXPLANETS + 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
829 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
830
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
831 for (i = 0; i < numofplanets; i++, packet++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
832 if (packet->pnum < 0 || packet->pnum >= MAXPLANETS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
833 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
834
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
835 plan = &planets[packet->pnum];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
836 if (plan->pl_owner != packet->owner)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
837 redraw = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
838 plan->pl_owner = packet->owner;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
839
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
840 if (plan->pl_info != packet->info)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
841 redraw = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
842
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
843 plan->pl_info = packet->info;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
844 /* Redraw the planet because it was updated by server */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
845
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
846 if (plan->pl_flags != (int) ntohs(packet->flags))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
847 redraw = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
848 plan->pl_flags = (int) ntohs(packet->flags);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
849
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
850 if (plan->pl_armies != (unsigned char) packet->armies) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
851 /*#ifdef EM*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
852 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
853 don't redraw when armies change unless it crosses the '4' *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
854 army limit. Keeps people from watching for planet 'flicker' *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
855 when players are beaming
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
856 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
857 int planetarmies = (unsigned char) packet->armies;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
858 if ((plan->pl_armies < 5 && planetarmies > 4) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
859 (plan->pl_armies > 4 && planetarmies < 5))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
860 /*#endif*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
861 redraw = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
862 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
863
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
864 plan->pl_armies = (unsigned char) packet->armies;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
865 if (plan->pl_info == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
866 plan->pl_owner = NOBODY;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
867 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
868
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
869 if (redraw) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
870 plan->pl_flags |= PLREDRAW;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
871 pl_update[packet->pnum].plu_update = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
872 pl_update[packet->pnum].plu_x = plan->pl_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
873 pl_update[packet->pnum].plu_y = plan->pl_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
874
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
875 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
876 } /* FOR */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
877 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
878
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
879 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
880 sendShortReq(state)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
881 char state;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
882 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
883 struct shortreq_cpacket shortReq;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
884
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
885 shortReq.type = CP_S_REQ;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
886 shortReq.req = state;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
887 shortReq.version = SHORTVERSION;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
888 switch (state) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
889 case SPK_VON:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
890 warning("Sending short packet request");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
891 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
892 case SPK_VOFF:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
893 warning("Sending old packet request");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
894 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
895 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
896 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
897 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
898 if ((state == SPK_SALL || state == SPK_ALL) && recv_short) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
899 /* Let the client do the work, and not the network :-) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
900
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
901 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
902 for (i = 0; i < nplayers * MAXTORP; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
903 torps[i].t_status = TFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
904
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
905 for (i = 0; i < nplayers * MAXPLASMA; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
906 plasmatorps[i].pt_status = PTFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
907
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
908 for (i = 0; i < nplayers; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
909 players[i].p_ntorp = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
910 players[i].p_nplasmatorp = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
911 phasers[i].ph_status = PHFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
912 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
913 if (state == SPK_SALL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
914 warning("Sent request for small update (weapons+planets+kills)");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
915 else if (state == SPK_ALL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
916 warning("Sent request for medium update (all except stats)");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
917 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
918 warning("Sent some unknown request...");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
919 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
920 sendServerPacket((struct shortreq_cpacket *) & shortReq);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
921 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
922
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
923 char *whydeadmess[] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
924 {"", "[quit]", "[photon]", "[phaser]", "[planet]", "[explosion]",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
925 "", "", "[ghostbust]", "[genocide]", "", "[plasma]", "[detted photon]", "[chain explosion]",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
926 "[TEAM]", "", "[team det]", "[team explosion]"};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
927
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
928
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
929 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
930 handleSWarning(packet)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
931 struct warning_s_spacket *packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
932 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
933 char buf[80];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
934 register struct player *target;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
935 register int damage;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
936 static int arg3, arg4; /* Here are the arguments for warnings with
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
937 more than 2 arguments */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
938 static int karg3, karg4, karg5 = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
939 char killmess[20];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
940
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
941 switch (packet->whichmessage) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
942 case TEXTE: /* damage used as tmp var */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
943 damage = (unsigned char) packet->argument;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
944 damage |= (unsigned char) packet->argument2 << 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
945 if (damage >= 0 && damage < NUMWTEXTS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
946 warning(w_texts[damage]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
947 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
948 case PHASER_HIT_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
949 target = &players[(unsigned char) packet->argument & 0x3f];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
950 damage = (unsigned char) packet->argument2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
951 if ((unsigned char) packet->argument & 64)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
952 damage |= 256;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
953 if ((unsigned char) packet->argument & 128)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
954 damage |= 512;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
955 (void) sprintf(buf, "Phaser burst hit %s for %d points", target->p_name, damage);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
956 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
957 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
958 case BOMB_INEFFECTIVE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
959 sprintf(buf, "Weapons Officer: Bombing is ineffective. Only %d armies are defending.",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
960 (int) packet->argument); /* nifty info feature 2/14/92
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
961 TMC */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
962 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
963 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
964 case BOMB_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
965 sprintf(buf, "Weapons Officer: Bombarding %s... Sensors read %d armies left.",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
966 planets[(unsigned char) packet->argument].pl_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
967 (unsigned char) packet->argument2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
968 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
969 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
970 case BEAMUP_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
971 sprintf(buf, "%s: Too few armies to beam up",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
972 planets[(unsigned char) packet->argument].pl_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
973 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
974 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
975 case BEAMUP2_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
976 sprintf(buf, "Beaming up. (%d/%d)", (unsigned char) packet->argument, (unsigned char) packet->argument2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
977 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
978 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
979 case BEAMUPSTARBASE_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
980 sprintf(buf, "Starbase %s: Too few armies to beam up",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
981 players[packet->argument].p_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
982 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
983 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
984 case BEAMDOWNSTARBASE_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
985 sprintf(buf, "No more armies to beam down to Starbase %s.",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
986 players[packet->argument].p_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
987 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
988
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
989 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
990 case BEAMDOWNPLANET_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
991 sprintf(buf, "No more armies to beam down to %s.",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
992 planets[(unsigned char) packet->argument].pl_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
993 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
994 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
995 case SBREPORT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
996 sprintf(buf, "Transporter Room: Starbase %s reports all troop bunkers are full!",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
997 players[packet->argument].p_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
998 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
999 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1000 case ONEARG_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1001 if (packet->argument >= 0 && packet->argument < NUMVARITEXTS) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1002 sprintf(buf, vari_texts[packet->argument], (unsigned char) packet->argument2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1003 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1004 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1005 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1006 case BEAM_D_PLANET_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1007 sprintf(buf, "Beaming down. (%d/%d) %s has %d armies left",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1008 arg3,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1009 arg4,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1010 planets[(unsigned char) packet->argument].pl_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1011 packet->argument2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1012 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1013 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1014 case ARGUMENTS:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1015 arg3 = (unsigned char) packet->argument;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1016 arg4 = (unsigned char) packet->argument2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1017 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1018 case BEAM_U_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1019 sprintf(buf, "Transfering ground units. (%d/%d) Starbase %s has %d armies left",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1020 (unsigned char) arg3, (unsigned char) arg4, players[packet->argument].p_name, (unsigned char) packet->argument2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1021 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1022 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1023 case LOCKPLANET_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1024 sprintf(buf, "Locking onto %s", planets[(unsigned char) packet->argument].pl_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1025 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1026 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1027 case SBRANK_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1028 sprintf(buf, "You need a rank of %s or higher to command a starbase!", ranks[packet->argument].name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1029 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1030 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1031 case SBDOCKREFUSE_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1032 sprintf(buf, "Starbase %s refusing us docking permission captain.",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1033 players[packet->argument].p_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1034 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1035 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1036 case SBDOCKDENIED_TEXT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1037 sprintf(buf, "Starbase %s: Permission to dock denied, all ports currently occupied.", players[packet->argument].p_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1038 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1039 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1040 case SBLOCKSTRANGER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1041 sprintf(buf, "Locking onto %s (%c%c)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1042 players[packet->argument].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1043 TEAM_LETTER(players[packet->argument]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1044 shipnos[players[packet->argument].p_no]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1045 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1046 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1047 case SBLOCKMYTEAM:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1048 sprintf(buf, "Locking onto %s (%c%c) (docking is %s)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1049 players[packet->argument].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1050 TEAM_LETTER(players[packet->argument]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1051 shipnos[players[packet->argument].p_no],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1052 (players[packet->argument].p_flags & PFDOCKOK) ? "enabled" : "disabled");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1053 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1054 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1055 case DMKILL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1056 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1057 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1058 int killer, victim, armies;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1059 float kills;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1060 victim = (unsigned char) packet->argument & 0x3f;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1061 killer = (unsigned char) packet->argument2 & 0x3f;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1062 /* that's only a temp */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1063 damage = (unsigned char) karg3;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1064 damage |= (karg4 & 127) << 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1065 kills = damage / 100.0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1066 if (kills == 0.0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1067 strcpy(killmess, "NO CREDIT");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1068 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1069 sprintf(killmess, "%0.2f", kills);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1070 armies = (((unsigned char) packet->argument >> 6) | ((unsigned char) packet->argument2 & 192) >> 4);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1071 if (karg4 & 128)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1072 armies |= 16;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1073 if (armies == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1074 (void) sprintf(msg.mesg, "%s%s (%c%c) [%c%c] was kill %s for %s (%c%c) [%c%c]",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1075 (godToAllOnKills ? "GOD->ALL " : ""),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1076 players[victim].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1077 TEAM_LETTER(players[victim]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1078 shipnos[victim],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1079 players[victim].p_ship->s_desig[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1080 players[victim].p_ship->s_desig[1],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1081 killmess,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1082 players[killer].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1083 TEAM_LETTER(players[killer]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1084 shipnos[killer],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1085 players[killer].p_ship->s_desig[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1086 players[killer].p_ship->s_desig[1]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1087 msg.m_flags = MALL | MVALID | MKILL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1088 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1089 #ifdef SOUND /* was feeling a little silly :-) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1090 if (killer == me->p_no || alwaysSoundDoosh)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1091 S_PlaySound(S_DOOSH);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1092 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1093 (void) sprintf(msg.mesg, "%s%s (%c%c+%d armies) [%c%c]: kill %s for %s (%c%c) [%c%c]",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1094 (godToAllOnKills ? "GOD->ALL " : ""),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1095 players[victim].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1096 TEAM_LETTER(players[victim]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1097 shipnos[victim],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1098 armies,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1099 players[victim].p_ship->s_desig[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1100 players[victim].p_ship->s_desig[1],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1101 killmess,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1102 players[killer].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1103 TEAM_LETTER(players[killer]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1104 shipnos[killer],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1105 players[killer].p_ship->s_desig[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1106 players[killer].p_ship->s_desig[1]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1107 msg.m_flags = MALL | MVALID | MKILLA;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1108 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1109 if (why_dead) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1110 add_whydead(msg.mesg, karg5);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1111 karg5 = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1112 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1113 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1114 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1115 msg.m_recpt = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1116 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1117 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1118 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1119 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1120 case KILLARGS:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1121 karg3 = (unsigned char) packet->argument;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1122 karg4 = (unsigned char) packet->argument2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1123 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1124 case KILLARGS2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1125 karg5 = (unsigned char) packet->argument;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1126 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1127 case DMKILLP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1128 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1129 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1130 (void) sprintf(msg.mesg, "%s%s (%c%c) [%c%c] killed by %s (%c)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1131 (godToAllOnKills ? "GOD->ALL " : ""),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1132 players[packet->argument].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1133 TEAM_LETTER(players[packet->argument]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1134 shipnos[packet->argument],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1135 players[packet->argument].p_ship->s_desig[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1136 players[packet->argument].p_ship->s_desig[1],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1137 planets[(unsigned char) packet->argument2].pl_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1138 TEAM_LETTERP(planets[(unsigned char) packet->argument2]));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1139 if (why_dead) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1140 add_whydead(msg.mesg, karg5);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1141 karg5 = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1142 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1143 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1144 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1145 msg.m_flags = MALL | MVALID | MKILLP;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1146 msg.m_recpt = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1147 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1148 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1149 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1150 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1151 case DMBOMB:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1152 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1153 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1154 char buf1[80];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1155 (void) sprintf(buf, "%-3s->%-3s", planets[(unsigned char) packet->argument2].pl_name, TEAM_SHORTP(planets[(unsigned char) packet->argument2]));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1156 (void) sprintf(buf1, "We are being attacked by %s %c%c who is %d%% damaged.",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1157 players[packet->argument].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1158 TEAM_LETTER(players[packet->argument]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1159 shipnos[packet->argument],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1160 arg3);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1161 (void) sprintf(msg.mesg, "%s %s", buf, buf1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1162 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1163 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1164 msg.m_flags = MTEAM | MBOMB | MVALID;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1165 msg.m_recpt = planets[(unsigned char) packet->argument2].pl_owner;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1166 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1167 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1168 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1169 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1170 case DMDEST:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1171 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1172 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1173 char buf1[80];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1174 (void) sprintf(buf, "%s destroyed by %s (%c%c)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1175 planets[(unsigned char) packet->argument].pl_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1176 players[packet->argument2].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1177 TEAM_LETTER(players[packet->argument2]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1178 shipnos[(unsigned char) packet->argument2]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1179 (void) sprintf(buf1, "%-3s->%-3s",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1180 planets[(unsigned char) packet->argument].pl_name, TEAM_SHORTP(planets[(unsigned char) packet->argument]));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1181 (void) sprintf(msg.mesg, "%s %s", buf1, buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1182 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1183 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1184 msg.m_flags = MTEAM | MDEST | MVALID;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1185 msg.m_recpt = planets[(unsigned char) packet->argument].pl_owner;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1186 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1187 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1188 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1189 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1190 case DMTAKE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1191 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1192 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1193 char buf1[80];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1194 (void) sprintf(buf, "%s taken over by %s (%c%c)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1195 planets[(unsigned char) packet->argument].pl_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1196 players[packet->argument2].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1197 TEAM_LETTER(players[packet->argument2]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1198 shipnos[packet->argument2]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1199 (void) sprintf(buf1, "%-3s->%-3s",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1200 planets[(unsigned char) packet->argument].pl_name, TEAM_SHORT(players[packet->argument2]));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1201 (void) sprintf(msg.mesg, "%s %s", buf1, buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1202 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1203 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1204 msg.m_flags = MTEAM | MTAKE | MVALID;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1205 msg.m_recpt = idx_to_mask(players[packet->argument2].p_teami);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1206 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1207 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1208 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1209 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1210 case DGHOSTKILL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1211 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1212 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1213 ushort damage;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1214 damage = (unsigned char) karg3;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1215 damage |= (unsigned char) (karg4 & 0xff) << 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1216 (void) sprintf(msg.mesg, "GOD->ALL %s (%c%c) was kill %0.2f for the GhostBusters",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1217 players[(unsigned char) packet->argument].p_name, TEAM_LETTER(players[(unsigned char) packet->argument]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1218 shipnos[(unsigned char) packet->argument],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1219 (float) damage / 100.0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1220 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1221 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1222 msg.m_flags = MALL | MVALID;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1223 msg.m_recpt = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1224 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1225 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1226 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1227 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1228 /* INL Daemon Mesages */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1229 case INLDMKILLP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1230 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1231 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1232 *buf = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1233 if (arg3) { /* Armies */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1234 sprintf(buf, "+%d", arg3);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1235 #ifdef SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1236 if(alwaysSoundDoosh)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1237 S_PlaySound(S_DOOSH);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1238 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1239 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1240 (void) sprintf(msg.mesg, "%s%s[%s] (%c%c%s) killed by %s (%c)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1241 (godToAllOnKills ? "GOD->ALL " : ""),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1242 players[(unsigned char) packet->argument].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1243 ship_type(players[(unsigned char) packet->argument].p_ship),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1244 TEAM_LETTER(players[(unsigned char) packet->argument]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1245 shipnos[(unsigned char) packet->argument],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1246 buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1247 planets[(unsigned char) packet->argument2].pl_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1248 TEAM_LETTERP(planets[(unsigned char) packet->argument2]));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1249 if (why_dead) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1250 add_whydead(msg.mesg, karg5);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1251 karg5 = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1252 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1253 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1254 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1255 msg.m_flags = MALL | MVALID | MKILLP;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1256 msg.m_recpt = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1257 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1258 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1259 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1260 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1261 case INLDMKILL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1262 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1263 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1264 int killer, victim, armies;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1265 float kills;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1266 victim = (unsigned char) packet->argument & 0x3f;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1267 killer = (unsigned char) packet->argument2 & 0x3f;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1268 /* that's only a temp */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1269 damage = (unsigned char) karg3;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1270 damage |= (karg4 & 127) << 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1271 kills = damage / 100.0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1272 armies = (((unsigned char) packet->argument >> 6) | ((unsigned char) packet->argument2 & 192) >> 4);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1273 if (karg4 & 128)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1274 armies |= 16;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1275 if (armies == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1276 (void) sprintf(msg.mesg, "%s%s[%s] (%c%c) was kill %0.2f for %s[%s] (%c%c)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1277 (godToAllOnKills ? "GOD->ALL " : ""),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1278 players[victim].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1279 ship_type(players[victim].p_ship),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1280 TEAM_LETTER(players[victim]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1281 shipnos[victim],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1282 kills,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1283 players[killer].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1284 ship_type(players[killer].p_ship),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1285 TEAM_LETTER(players[killer]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1286 shipnos[killer]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1287 msg.m_flags = MALL | MVALID | MKILL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1288 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1289 #ifdef SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1290 if(killer == me->p_no || alwaysSoundDoosh)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1291 S_PlaySound(S_DOOSH);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1292 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1293 (void) sprintf(msg.mesg, "%s%s[%s] (%c%c+%d armies) was kill %0.2f for %s[%s] (%c%c)",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1294 (godToAllOnKills ? "GOD->ALL " : ""),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1295 players[victim].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1296 ship_type(players[victim].p_ship),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1297 TEAM_LETTER(players[victim]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1298 shipnos[victim],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1299 armies,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1300 kills,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1301 players[killer].p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1302 ship_type(players[killer].p_ship),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1303 TEAM_LETTER(players[killer]),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1304 shipnos[killer]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1305 msg.m_flags = MALL | MVALID | MKILLA;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1306 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1307 if (why_dead) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1308 add_whydead(msg.mesg, karg5);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1309 karg5 = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1310 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1311 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1312 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1313 msg.m_recpt = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1314 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1315 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1316 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1317 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1318 case INLDRESUME:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1319 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1320 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1321 sprintf(msg.mesg, " Game will resume in %d seconds", (unsigned char) packet->argument);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1322 msg.m_flags = MALL | MVALID;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1323 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1324 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1325 msg.m_recpt = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1326 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1327 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1328 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1329 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1330 case INLDTEXTE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1331 if (packet->argument >= 0 && (unsigned char) packet->argument < NUMDAEMONTEXTS) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1332 struct mesg_spacket msg;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1333 strcpy(msg.mesg, daemon_texts[(unsigned char) packet->argument]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1334 msg.m_flags = MALL | MVALID;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1335 msg.type = SP_MESSAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1336 msg.mesg[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1337 msg.m_recpt = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1338 msg.m_from = 255;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1339 handleMessage(&msg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1340 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1341 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1342 case STEXTE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1343 warning(s_texte[(unsigned char) packet->argument]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1344 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1345 case SHORT_WARNING:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1346 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1347 struct warning_spacket *warn = (struct warning_spacket *) packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1348 warning(warn->mesg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1349 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1350 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1351 case STEXTE_STRING:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1352 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1353 struct warning_spacket *warn = (struct warning_spacket *) packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1354 warning(warn->mesg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1355 s_texte[(unsigned char) warn->pad2] = (char *) malloc(warn->pad3 - 4);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1356 if (s_texte[(unsigned char) warn->pad2] == NULL) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1357 s_texte[(unsigned char) warn->pad2] = no_memory;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1358 warning("Could not add warning! (No memory!)");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1359 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1360 strcpy(s_texte[(unsigned char) warn->pad2], warn->mesg);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1361 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1362 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1363 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1364 warning("Unknown Short Warning!");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1365 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1366 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1367 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1368
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1369 #define MY_SIZEOF(a) (sizeof(a) / sizeof(*(a)))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1370
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1371 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1372 add_whydead(s, m) /* 7/22/93 LAB */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1373 char *s;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1374 int m;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1375 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1376 char b[256];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1377
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1378 if (m < MY_SIZEOF(whydeadmess)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1379 sprintf(b, "%-50s %s", s, whydeadmess[m]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1380 b[79] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1381 strcpy(s, b);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1382 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1383 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1384
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1385 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1386
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1387 /* END SHORT_PACKETS */