annotate newwin.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: newwin.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 * newwin.c
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 #include "copyright.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 #ifdef __STDC__
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 #include <stdlib.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 #include <math.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 #include <signal.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 #include <sys/types.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15 #include <string.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 #ifdef hpux
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 #include <time.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 #else /* hpux */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 #include <sys/time.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 #endif /* hpux */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21 #ifdef RS6K
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 #include <sys/select.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 #include "Wlib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 #include "struct.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 #include "data.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 #include "gameconf.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32 #include "oldbitmaps.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 #include "bitmaps_pr.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34 #include "bitmaps3.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 #include "hullbitmaps.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 #include "planetbitmaps.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 #include "rabbitbitmaps.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 #include "starbitmaps.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40 #ifdef BEEPLITE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41 #include "emph_planet_seq.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 #include "emph_player_seq.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 #include "emph_player_seql.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 #include "packets.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 #include "proto.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49 #define NRHEADERS 4
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50 W_Icon headerA, headerB, headerchanges[NRHEADERS];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51 W_Icon safepic;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52 /* elapsed time in outfit window [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 int elapsed;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 int newMotdStuff = 0; /* set to 1 when new motd packets arrive */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56 static struct piclist *motdPics = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57 /*static struct page *currpage = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58 static struct page *motddata = NULL;*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60 #define LINESPERPAGE 38
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 #define BOXSIDE (WINSIDE / 5)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 #define TILESIDE 16
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64 #define MESSAGESIZE 20
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 #define STATSIZE (MESSAGESIZE * 2 + BORDER)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66 #define YOFF 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68 #define stipple_width 16
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69 #define stipple_height 16
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 static unsigned char stipple_bits[] = {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 /* ATM: extra stuff for those who don't like my visible tractors */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 #define tract_width 5
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78 #define tract_height 5
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 static char tract_bits[] = {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 0x1f, 0x04, 0x04, 0x04, 0x04};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 #define press_width 5
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82 #define press_height 5
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83 static char press_bits[] = {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84 0x0f, 0x11, 0x0f, 0x01, 0x01};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 /* Prototypes */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 static void savebitmaps P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88 static int teamRequest P((int team, int ship));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 static int numShips P((int owner));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90 static int checkBold P((char *line));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91 void showMotd P((W_Window win));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 static void showPics P((W_Window win));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93 void showValues P((W_Window win));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 static void getResources P((char *prog));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 static void getTiles P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 static void redrawTeam P((W_Window win, int teamNo, int *lastnum));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 static void redrawQuit P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98 static void showTimeLeft P((int time, int max));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100 /* from dashboard.c: */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101 void light_erase P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103 extern int helpmessages;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 newwin(hostmon, progname)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 char *hostmon, *progname;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 /* W_Initialize(hostmon); */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 baseWin = W_MakeWindow("netrek", 0, YOFF, WINSIDE * 2 + 1 * BORDER,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 WINSIDE + 2 * BORDER + 2 * MESSAGESIZE, NULL, "bomb here", BORDER, gColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 iconWin = W_MakeWindow("netrek_icon", 0, 0, icon_width, icon_height, NULL,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 (char *) 0, BORDER, gColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 W_SetIconWindow(baseWin, iconWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 w = W_MakeWindow("local", -BORDER, -BORDER, WINSIDE, WINSIDE, baseWin,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119 (char *) 0, BORDER, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120 mapw = W_MakeWindow("map", WINSIDE, -BORDER, WINSIDE, WINSIDE, baseWin,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121 (char *) 0, BORDER, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 tstatw = W_MakeWindow("tstat", -BORDER, WINSIDE, WINSIDE, STATSIZE, baseWin,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 "xterm", BORDER, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 warnw = W_MakeWindow("warn", WINSIDE, WINSIDE, WINSIDE, MESSAGESIZE,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 baseWin, "xterm", BORDER, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 messagew = W_MakeWindow("message", WINSIDE, WINSIDE + BORDER + MESSAGESIZE,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 WINSIDE, MESSAGESIZE, baseWin, "xterm", BORDER, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128 planetw = W_MakeTextWindow("planet", 10, 10, 75, (nplanets + 13) / 2, w, (char *) 0, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 planetw2 = W_MakeTextWindow("planet2", 10, 10, 75, (nplanets + 13) / 2, mapw, (char *) 0, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 rankw = W_MakeTextWindow("rank", 50, 100, 65, nranks2 + 8, w, (char *) 0, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 playerw = W_MakeTextWindow("player", 0, YOFF + WINSIDE + 2 * BORDER + 2 * MESSAGESIZE,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132 83, (nplayers + 14) / 2, NULL, (char *) 0, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 helpWin = W_MakeTextWindow("help", 0, YOFF + WINSIDE + 2 * BORDER + 2 * MESSAGESIZE,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134 160, helpmessages / 4 + 1, NULL, (char *) 0, BORDER);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 #ifdef METASERVER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137 metaWin = W_MakeMenu ("MetaServer List", WINSIDE+10, -BORDER+10, 69,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138 num_servers + 2, NULL, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140 #endif /* METASERVER */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142 W_SetWindowKeyDownHandler(metaWin, metaaction);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143 W_SetWindowButtonHandler(metaWin, metaaction);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144 #endif /* 0 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 initMessageWindows();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 pStats = W_MakeWindow("Network Statistics", 500, 4, pStatsWidth(), pStatsHeight(),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 NULL, (char *) 0, 1, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 udpWin = W_MakeMenu("UDP", WINSIDE + 10, -BORDER + 10, 40, UDP_NUMOPTS,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 NULL, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 #ifdef SHORT_PACKETS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 spWin = W_MakeMenu("network", WINSIDE + 10, -BORDER + 10, 40, SPK_NUMFIELDS,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 NULL, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 #ifdef TOOLS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159 toolsWin = W_MakeScrollingWindow("tools", WINSIDE + BORDER, BORDER,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 80, TOOLSWINLEN, NULL, "xterm", BORDER);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 motdWin = W_MakeWindow("Motd"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 ,-BORDER, -BORDER, WINSIDE, WINSIDE, NULL,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 (char *) 0, BORDER, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 for (i = 0; i < 4; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 teamWin[i] = W_MakeWindow(teaminfo[i].shortname, i * BOXSIDE, 0,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 BOXSIDE, BOXSIDE, mapw, (char *) 0, 1, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171 qwin = W_MakeWindow("quit", 4 * BOXSIDE, 0, BOXSIDE, BOXSIDE, mapw,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 "pirate", 1, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 /* statwin = W_MakeWindow("stats", 422, 13, 160, 95, NULL, (char*)0,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 5, foreColor);*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 statwin = W_MakeWindow("stats", 422, 13, 160, 80, NULL,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 (char *) 0, 5, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 #define WARHEIGHT 2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 #define WARWIDTH 20
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 #define WARBORDER 2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 war = W_MakeMenu("war", WINSIDE + 10, -BORDER + 10, WARWIDTH, 6, baseWin,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 WARBORDER);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 getResources(progname);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 savebitmaps();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 mapAll()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 initinput();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195 W_MapWindow(mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 W_MapWindow(tstatw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 W_MapWindow(warnw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198 W_MapWindow(messagew);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 W_MapWindow(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 W_MapWindow(baseWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203 since we aren't mapping windows that have root as parent in
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 x11window.c (since that messes up the TransientFor feature) we have to
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205 map them here. (If already mapped, W_MapWindow returns)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 if (checkMapped("planet"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209 W_MapWindow(planetw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 if (checkMapped("planet2"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 W_MapWindow(planetw2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 if (checkMapped("rank"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 W_MapWindow(rankw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214 if (checkMapped("help"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 W_MapWindow(helpWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 if (checkMapped("Motd"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217 W_MapWindow(motdWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218 if (checkMapped("review_all"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219 W_MapWindow(messWin[WALL].window);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 if (checkMapped("review_team"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221 W_MapWindow(messWin[WTEAM].window);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222 if (checkMapped("review_your"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 W_MapWindow(messWin[WINDIV].window);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224 if (checkMapped("review_kill"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 W_MapWindow(messWin[WKILL].window);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 if (checkMapped("review_phaser"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 W_MapWindow(messWin[WPHASER].window);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228 if (booleanDefault("player.mapped", 1))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 W_MapWindow(playerw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230 if (booleanDefault("review.mapped", 1))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 W_MapWindow(messWin[WREVIEW].window);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 if (checkMapped("UDP"))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 udpwindow();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238 savebitmaps()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241 int tw, th, mw, mh;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243 /* slurp_ship_bitmaps(); */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245 clockpic = W_StoreBitmap(clock_width, clock_height, clock_bits,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 qwin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247 safepic = W_StoreBitmap(safe_width, safe_height, safe_bits,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 qwin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250 #ifdef BEEPLITE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 for (i = 0; i < emph_player_seq_frames; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252 emph_player_seq[emph_player_seq_frames - (i + 1)] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253 W_StoreBitmap(emph_player_seq_width, emph_player_seq_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 emph_player_seq_bits[i], mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257 for (i = 0; i < emph_player_seql_frames; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258 emph_player_seql[emph_player_seql_frames - (i + 1)] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 W_StoreBitmap(emph_player_seql_width, emph_player_seql_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260 emph_player_seql_bits[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 for (i = 0; i < emph_planet_seq_frames; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264 emph_planet_seq[emph_planet_seq_frames - (i + 1)] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265 W_StoreBitmap(emph_planet_seq_width, emph_planet_seq_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 emph_planet_seq_bits[i], mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 load_default_teamlogos();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 headerA = W_StoreBitmap(headerA_width, headerA_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273 headerA_bits, motdWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274 headerB = W_StoreBitmap(headerB_width, headerB_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 headerB_bits, motdWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276 headerchanges[0] = W_StoreBitmap(header1_width, header1_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277 header1_bits, motdWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 headerchanges[1] = W_StoreBitmap(header2_width, header2_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279 header2_bits, motdWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280 headerchanges[2] = W_StoreBitmap(header3_width, header3_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 header3_bits, motdWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 headerchanges[3] = W_StoreBitmap(header4_width, header4_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 header4_bits, motdWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 for (i = 0; i < HULL_FRAMES; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285 hull[i] = W_StoreBitmap(hull_width, hull_height, hull_bits[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 for (i = 0; i < 5; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288 cloud[i] = W_StoreBitmap(cloud_width, cloud_height, cloud_bits[4 - i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289 plasmacloud[i] = W_StoreBitmap(plasmacloud_width,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290 plasmacloud_height, plasmacloud_bits[4 - i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 etorp = W_StoreBitmap(etorp_width, etorp_height, etorp_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 mtorp = W_StoreBitmap(mtorp_width, mtorp_height, mtorp_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294 for (i = 0; i < NDRONEVIEWS; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295 drone_bm[i] = W_StoreBitmap(drone_width, drone_height, drone_bits[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297 eplasmatorp =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 W_StoreBitmap(eplasmatorp_width, eplasmatorp_height, eplasmatorp_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299 mplasmatorp =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300 W_StoreBitmap(mplasmatorp_width, mplasmatorp_height, mplasmatorp_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 for (i = 0; i < VIEWS; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 fighter[i] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 W_StoreBitmap(fighter_width, fighter_height, fighter_bits[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 };
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305 warpbeacon = W_StoreBitmap(warpbeacon_width, warpbeacon_height, warpbeacon_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 wbflash = W_StoreBitmap(warpbeacon_width, warpbeacon_height, warpflash_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 tw = planet_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309 th = planet_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310 mw = mplanet_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311 mh = mplanet_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 /* tactical screen planet bitmaps for team */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 bplanets[0] = W_StoreBitmap(tw, th, indplanet_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 bplanets[1] = W_StoreBitmap(tw, th, fedplanet_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 bplanets[2] = W_StoreBitmap(tw, th, romplanet_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 bplanets[3] = W_StoreBitmap(tw, th, kliplanet_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319 bplanets[4] = W_StoreBitmap(tw, th, oriplanet_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320 bplanets[5] = W_StoreBitmap(tw, th, planet_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322 /* galactic screen planet bitmaps for team */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 mbplanets[0] = W_StoreBitmap(mw, mh, indmplanet_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 mbplanets[1] = W_StoreBitmap(mw, mh, fedmplanet_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 mbplanets[2] = W_StoreBitmap(mw, mh, rommplanet_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 mbplanets[3] = W_StoreBitmap(mw, mh, klimplanet_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 mbplanets[4] = W_StoreBitmap(mw, mh, orimplanet_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 mbplanets[5] = W_StoreBitmap(mw, mh, mplanet_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 /* tactical screen planet bitmaps for facilities */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 bplanets2[0] = bplanets[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
336 bplanets2[1] = W_StoreBitmap(tw, th, planet001_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
337 bplanets2[2] = W_StoreBitmap(tw, th, planet010_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
338 bplanets2[3] = W_StoreBitmap(tw, th, planet011_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
339 bplanets2[4] = W_StoreBitmap(tw, th, planet100_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
340 bplanets2[5] = W_StoreBitmap(tw, th, planet101_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
341 bplanets2[6] = W_StoreBitmap(tw, th, planet110_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
342 bplanets2[7] = W_StoreBitmap(tw, th, planet111_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
343 bplanets2[8] = W_StoreBitmap(tw, th, planet1010_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
344 bplanets2[9] = W_StoreBitmap(tw, th, planet1011_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
345 bplanets2[10] = bplanets2[8];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
346 bplanets2[11] = bplanets2[9];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
347 bplanets2[12] = W_StoreBitmap(tw, th, planet1110_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
348 bplanets2[13] = W_StoreBitmap(tw, th, planet1111_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
349 bplanets2[14] = bplanets2[12];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
350 bplanets2[15] = bplanets2[13];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
351
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
352 /* galactic screen planet bitmaps for facilities */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
353
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
354 mbplanets2[0] = mbplanets[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
355 mbplanets2[1] = W_StoreBitmap(mw, mh, mplanet001_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
356 mbplanets2[2] = W_StoreBitmap(mw, mh, mplanet010_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
357 mbplanets2[3] = W_StoreBitmap(mw, mh, mplanet011_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
358 mbplanets2[4] = W_StoreBitmap(mw, mh, mplanet100_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
359 mbplanets2[5] = W_StoreBitmap(mw, mh, mplanet101_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
360 mbplanets2[6] = W_StoreBitmap(mw, mh, mplanet110_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
361 mbplanets2[7] = W_StoreBitmap(mw, mh, mplanet111_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
362 mbplanets2[8] = W_StoreBitmap(mw, mh, mplanet1010_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
363 mbplanets2[9] = W_StoreBitmap(mw, mh, mplanet1011_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
364 mbplanets2[10] = mbplanets2[8];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
365 mbplanets2[11] = mbplanets2[9];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
366 mbplanets2[12] = W_StoreBitmap(mw, mh, mplanet1110_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
367 mbplanets2[13] = W_StoreBitmap(mw, mh, mplanet1111_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
368 mbplanets2[14] = mbplanets2[12];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
369 mbplanets2[15] = mbplanets2[13];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
370
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
371 /* tactical screen planet bitmaps for surface properties */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
372
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
373 bplanetsr[0] = bplanets[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
374 bplanetsr[1] = W_StoreBitmap(tw, th, planetr001_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
375 bplanetsr[2] = W_StoreBitmap(tw, th, planetr010_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
376 bplanetsr[3] = W_StoreBitmap(tw, th, planetr011_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
377 bplanetsr[4] = W_StoreBitmap(tw, th, planetr100_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
378 bplanetsr[5] = W_StoreBitmap(tw, th, planetr101_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
379 bplanetsr[6] = W_StoreBitmap(tw, th, planetr110_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
380 bplanetsr[7] = W_StoreBitmap(tw, th, planetr111_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
381
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
382 /* galactic screen planet bitmaps for surface properties */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
383
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
384 mbplanetsr[0] = mbplanets[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
385 mbplanetsr[1] = W_StoreBitmap(mw, mh, mplanetr001_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
386 mbplanetsr[2] = W_StoreBitmap(mw, mh, mplanetr010_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
387 mbplanetsr[3] = W_StoreBitmap(mw, mh, mplanetr011_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
388 mbplanetsr[4] = W_StoreBitmap(mw, mh, mplanetr100_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
389 mbplanetsr[5] = W_StoreBitmap(mw, mh, mplanetr101_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
390 mbplanetsr[6] = W_StoreBitmap(mw, mh, mplanetr110_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
391 mbplanetsr[7] = W_StoreBitmap(mw, mh, mplanetr111_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
392
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
393 /* tactical screen bitmaps for facilities, MOO-style */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
394
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
395 bplanetsMOO[0] = W_StoreBitmap(tw, th, rmyplanet000_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
396 bplanetsMOO[1] = W_StoreBitmap(tw, th, rmyplanet001_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
397 bplanetsMOO[2] = W_StoreBitmap(tw, th, rmyplanet010_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
398 bplanetsMOO[3] = W_StoreBitmap(tw, th, rmyplanet011_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
399 bplanetsMOO[4] = W_StoreBitmap(tw, th, rmyplanet100_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
400 bplanetsMOO[5] = W_StoreBitmap(tw, th, rmyplanet101_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
401 bplanetsMOO[6] = W_StoreBitmap(tw, th, rmyplanet110_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
402 bplanetsMOO[7] = W_StoreBitmap(tw, th, rmyplanet111_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
403 bplanetsMOO[8] = W_StoreBitmap(tw, th, rmyplanet1010_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
404 bplanetsMOO[9] = W_StoreBitmap(tw, th, rmyplanet1011_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
405 bplanetsMOO[10] = bplanetsMOO[8];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
406 bplanetsMOO[11] = bplanetsMOO[9];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
407 bplanetsMOO[12] = W_StoreBitmap(tw, th, rmyplanet1110_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
408 bplanetsMOO[13] = W_StoreBitmap(tw, th, rmyplanet1111_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
409 bplanetsMOO[14] = bplanetsMOO[12];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
410 bplanetsMOO[15] = bplanetsMOO[13];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
411
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
412 /* galactic screen bitmaps for facilities, MOO-style */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
413
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
414 mbplanetsMOO[0] = W_StoreBitmap(mw, mh, rmymplanet000_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
415 mbplanetsMOO[1] = W_StoreBitmap(mw, mh, rmymplanet001_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
416 mbplanetsMOO[2] = W_StoreBitmap(mw, mh, rmymplanet010_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
417 mbplanetsMOO[3] = W_StoreBitmap(mw, mh, rmymplanet011_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
418 mbplanetsMOO[4] = W_StoreBitmap(mw, mh, mplanet100_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
419 mbplanetsMOO[5] = W_StoreBitmap(mw, mh, mplanet101_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
420 mbplanetsMOO[6] = W_StoreBitmap(mw, mh, mplanet110_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
421 mbplanetsMOO[7] = W_StoreBitmap(mw, mh, mplanet111_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
422 mbplanetsMOO[8] = W_StoreBitmap(mw, mh, rmymplanet1010_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
423 mbplanetsMOO[9] = W_StoreBitmap(mw, mh, rmymplanet1011_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
424 mbplanetsMOO[10] = mbplanetsMOO[8];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
425 mbplanetsMOO[11] = mbplanetsMOO[9];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
426 mbplanetsMOO[12] = W_StoreBitmap(mw, mh, mplanet1110_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
427 mbplanetsMOO[13] = W_StoreBitmap(mw, mh, mplanet1111_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
428 mbplanetsMOO[14] = mbplanetsMOO[12];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
429 mbplanetsMOO[15] = mbplanetsMOO[13];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
430
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
431 for (i = 0; i < NSCOUTAGES; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
432 mbplanetsA[i] = W_StoreBitmap(mw, mh, age_bits[i], mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
433
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
434 /* star bitmaps */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
435
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
436 for (i = 0; i < STARFRAMES; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
437 starBM[i] = W_StoreBitmap(star_width, star_height, star_bitarray[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
438 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
439 mstarBM = W_StoreBitmap(starm_width, starm_height, starm_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
440 #ifdef VISIBLE_WORMHOLES
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
441 mholeBM = W_StoreBitmap(holem_width, holem_height, holem_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
442 #endif /*VISIBLE_WORMHOLES*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
443 for (i = 0; i < WORMFRAMES; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
444 wormBM[i] = W_StoreBitmap(wormhole_width, wormhole_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
445 wormhole_bitarray[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
446 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
447
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
448 /* set of 16 asteroid pics, and 3 asteroid fluff filler pics */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
449 asteroidBM[0] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
450 a0000_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
451 asteroidBM[1] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
452 a0001_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
453 asteroidBM[2] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
454 a0010_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
455 asteroidBM[3] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
456 a0011_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
457 asteroidBM[4] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
458 a0100_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
459 asteroidBM[5] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
460 a0101_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
461 asteroidBM[6] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
462 a0110_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
463 asteroidBM[7] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
464 a0111_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
465 asteroidBM[8] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
466 a1000_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
467 asteroidBM[9] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
468 a1001_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
469 asteroidBM[10] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
470 a1010_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
471 asteroidBM[11] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
472 a1011_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
473 asteroidBM[12] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
474 a1100_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
475 asteroidBM[13] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
476 a1101_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
477 asteroidBM[14] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
478 a1110_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
479 asteroidBM[15] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
480 a1111_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
481 asteroidfluff[0] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
482 a0_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
483 asteroidfluff[1] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
484 a1_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
485 asteroidfluff[2] = W_StoreBitmap(terrain_width, terrain_height,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
486 a2_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
487 for (i = 0; i < 2; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
488 basteroid2[i] = W_StoreBitmap(asteroid_width, asteroid_height, asteroid_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
489 mbasteroid2[i] = W_StoreBitmap(masteroid_width, masteroid_height, masteroid_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
490 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
491 for (i = 0; i < 6; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
492 basteroid[i] = W_StoreBitmap(asteroid_width, asteroid_height, asteroid_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
493 mbasteroid[i] = W_StoreBitmap(masteroid_width, masteroid_height, masteroid_bits, mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
494 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
495
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
496 kitchenSink = W_StoreBitmap(sink_width, sink_height, sink_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
497
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
498 for (i = 0; i < EX_FRAMES; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
499 expview[i] = W_StoreBitmap(ex_width, ex_height, ex_bits[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
500 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
501 for (i = 0; i < SBEXPVIEWS; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
502 sbexpview[i] = W_StoreBitmap(sbexp_width, sbexp_height, sbexp_bits[i], w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
503 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
504
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
505 cloakicon = W_StoreBitmap(cloak_width, cloak_height, cloak_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
506 icon = W_StoreBitmap(icon_width, icon_height, icon_bits, iconWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
507 tractbits = W_StoreBitmap(tract_width, tract_height, tract_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
508 pressbits = W_StoreBitmap(press_width, press_height, press_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
509 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
510
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
511 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
512 get_N_dispatch_outfit_event(team, s_type, lastplayercount)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
513 int *team;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
514 int *s_type;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
515 int *lastplayercount;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
516 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
517 W_Event event;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
518 int validshipletter = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
519 static int resetting = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
520 int oldresetting;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
521 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
522
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
523 oldresetting = resetting;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
524
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
525 W_NextEvent(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
526 switch ((int) event.type) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
527 case W_EV_KEY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
528 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
529 struct shiplist *shipscan;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
530 validshipletter = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
531 shipscan = shiptypes;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
532 while (shipscan) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
533 if (shipscan->ship->s_letter == event.key) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
534 *s_type = shipscan->ship->s_type;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
535 validshipletter = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
536 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
537 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
538 shipscan = shipscan->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
539 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
540 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
541
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
542 if (me->p_status == PTQUEUE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
543 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
544 for (i = 0; i < WNUM; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
545 if (event.Window == messWin[i].window) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
546 messageWinEvent(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
547 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
548 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
549 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
550 if (i != WNUM)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
551 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
552 if (event.Window == messagew ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
553 event.Window == tstatw ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
554 event.Window == warnw)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
555 smessage(event.key);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
556 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
557 if (event.Window == motdWin) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
558 motdWinEvent(event.key);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
559 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
560 } else if (event.Window == playerw || event.Window == infow) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
561 /* allow 'i' 'I' and '^i' in playerw [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
562 playerwEvent(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
563 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
564 } else if (event.Window == w || event.Window == mapw) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
565 switch (event.key) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
566 #ifdef Q_OUTFITTING
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
567 case 'q':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
568 *team = number_of_teams;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
569 me->p_status = PFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
570 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
571 #endif /* Q_OUTFITTING */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
572 case 'R':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
573 warning("Are you sure you want to reset your stats?");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
574 resetting = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
575 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
576 case 'y':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
577 if (resetting) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
578 sendResetStatsReq('Y');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
579 warning("OK, your stats have been reset.");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
580 resetting = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
581 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
582 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
583 case 'n':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
584 if (resetting) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
585 warning("I didn't think so.");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
586 resetting = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
587 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
588 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
589
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
590 case 'f': /* Scroll motd forward */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
591 if (currpage == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
592 currpage = motddata;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
593 if (currpage == NULL || currpage->next == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
594 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
595 currpage->next->prev = currpage;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
596 currpage = currpage->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
597 showMotd(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
598 resetting = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
599 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
600 case 'b': /* Scroll motd backward */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
601 if (currpage == NULL || currpage->prev == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
602 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
603 currpage = currpage->prev;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
604 showMotd(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
605 resetting = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
606 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
607 /* ok, let's have some info windows available on the TQ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
608
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
609 default: /* hmm, something that doesn't have to do
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
610 with the MOTD, maybe it's an info window
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
611 request */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
612 switch (doKeymap(&event)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
613 case 'U': /* U = Rank list */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
614 if (W_IsMapped(rankw)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
615 W_UnmapWindow(rankw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
616 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
617 W_MapWindow(rankw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
618 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
619 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
620 case 'P': /* P = Planet list */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
621 if (W_IsMapped(planetw)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
622 W_UnmapWindow(planetw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
623 W_UnmapWindow(planetw2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
624 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
625 W_MapWindow(planetw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
626 W_MapWindow(planetw2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
627 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
628 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
629 case 'h': /* h = Map help window */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
630 if (W_IsMapped(helpWin)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
631 W_UnmapWindow(helpWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
632 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
633 W_MapWindow(helpWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
634 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
635 if (optionWin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
636 optionredrawtarget(helpWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
637 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
638 case 'O': /* O = options Window */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
639 if (optionWin != NULL && W_IsMapped(optionWin))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
640 optiondone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
641 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
642 optionwindow();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
643 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
644 case 'w': /* w = map war stuff */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
645 if (W_IsMapped(war))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
646 W_UnmapWindow(war);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
647 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
648 warwindow();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
649 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
650 case '&':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
651 if (defaultsFile) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
652 char buf[150];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
653 sprintf(buf, "Reading defaults from %s", defaultsFile);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
654 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
655 freeDefaults();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
656 defaultsFile = initDefaults(defaultsFile);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
657 resetDefaults();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
658 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
659 warning("No defaults file to read from!");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
660 }
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 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
664
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
665 break; /* switch event type */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
666 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
667 if (event.Window == qwin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
668 return; /* normal keypresses can't make you quit */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
669
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
670 if (event.Window == optionWin) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
671 optionaction(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
672 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
673 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
674 if (!validshipletter)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
675 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
676 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
677 it wasn't the main window, see if they hit the key in a team
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
678 window to choose their ship... falling through
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
679 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
680 case W_EV_BUTTON:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
681
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
682 for (i = 0; i < number_of_teams; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
683 if (event.Window == teamWin[i]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
684 *team = i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
685 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
686 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
687 if (event.Window == qwin) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
688 *team = number_of_teams;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
689 me->p_status = PFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
690 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
691 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
692 /* allow message scrollback [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
693 for (i = 0; i < WNUM; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
694 if (event.Window == messWin[i].window) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
695 messageWinEvent(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
696 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
697 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
698 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
699 /* allow bozo selection in playerw [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
700 if (event.Window == playerw) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
701 playerwEvent(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
702 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
703 } else if (event.Window == war)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
704 waraction(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
705 else if (event.Window == optionWin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
706 optionaction(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
707 if (*team != -1 && !teamRequest(*team, *s_type)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
708 *team = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
709 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
710 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
711 case W_EV_EXPOSE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
712 for (i = 0; i < number_of_teams; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
713 if (event.Window == teamWin[i]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
714 lastplayercount[i] = -1; /* force update */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
715 redrawTeam(teamWin[i], i, &lastplayercount[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
716 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
717 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
718 if (event.Window == qwin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
719 redrawQuit();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
720 else if (event.Window == w)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
721 showMotd(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
722 else if (event.Window == mapw) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
723 #ifdef COW_HAS_IT_WHY_SHOULDNT_WE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
724 if(showMapAtMotd) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
725 map();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
726 redraw_death_messages();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
727 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
728 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
729 showValues(mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
730 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
731 /* let the normal expose handler figure out who to redraw */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
732 dispatch_W_expose_event(&event);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
733 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
734 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
735
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
736 if (oldresetting && resetting) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
737 resetting = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
738 warning("Resetting of stats cancelled");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
739 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
740 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
741
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
742 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
743 new_entrywindow(team, s_type)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
744 int *team, *s_type;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
745 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
746 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
747 int lastplayercount[4]; /* number of players on each team */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
748 int okayMask, lastOkayMask; /* teams you're allowed to choose */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
749 char buf[100];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
750
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
751 /* OUTFIT timeout stuff */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
752 long startTime = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
753 long lasttime = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
754 int spareTime = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
755
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
756 if (fastQuit) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
757 *team = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
758 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
759 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
760 lastOkayMask = okayMask = tournMask;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
761
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
762 #ifdef PACKET_LIGHTS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
763 /* erase packet lights to make Bob happy [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
764 light_erase();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
765 #endif /* PACKET_LIGHTS */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
766
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
767 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
768 map all team selection windows, and stripe out those that are
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
769 unchoosable
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
770 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
771 for (i = 0; i < number_of_teams; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
772 if (okayMask & (1 << i))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
773 W_UnTileWindow(teamWin[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
774 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
775 W_TileWindow(teamWin[i], stipple);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
776
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
777 W_MapWindow(teamWin[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
778 lastplayercount[i] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
779 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
780 W_MapWindow(qwin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
781
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
782 /* no team selected yet */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
783 *team = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
784 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
785 set to team index (0..n-1) to choose a team. set to n if you want to
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
786 quit
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
787 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
788
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
789 /* I don't know why this restriction is in place - RF */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
790 if (me->p_whydead != KWINNER && me->p_whydead != KGENOCIDE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
791 showMotd(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
792 #ifdef COW_HAS_IT_WHY_SHOULDNT_WE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
793 if(showMapAtMotd) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
794 map();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
795 redraw_death_messages();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
796 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
797 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
798 showValues(mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
799 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
800 do {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
801
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
802 /* set team to n if you want to quit */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
803 while (!W_EventsPending() && (me->p_status == POUTFIT ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
804 me->p_status == PTQUEUE)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
805 /* no window events, just process socket stuff */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
806 fd_set mask;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
807
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
808 #ifdef PACKET_LIGHTS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
809 light_erase();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
810 #endif /* PACKET_LIGHTS */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
811
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
812 readFromServer();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
813
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
814 if (me->p_status == POUTFIT || me->p_status == PTQUEUE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
815 /* wait up to a half-second for input from the window system */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
816 struct timeval tv;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
817
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
818 #ifndef AMIGA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
819 tv.tv_sec = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
820 tv.tv_usec = 500000;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
821
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
822 FD_ZERO(&mask);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
823 FD_SET(W_Socket(), &mask);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
824 select(W_Socket() + 1, &mask, 0, 0, &tv);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
825 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
826 StartTimer(0, 500000);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
827 while (1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
828 #ifdef DNET
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
829 sigsPending = Wait(W_Socket() | portmask | sockMask | udpSockMask | SIGBREAKF_CTRL_C);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
830 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
831 /* something else.... */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
832 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
833 if (sigsPending & SIGBREAKF_CTRL_C) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
834 printf("Ctrl-c break from entrywindow!\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
835 StopTimer();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
836 exit(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
837 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
838 if ((sigsPending & (W_Socket() | sockMask | udpSockMask)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
839 (CheckIO(&(ior->tr_node))))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
840 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
841 } /* timer returns false signals, wish I knew
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
842 why. :-( */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
843 StopTimer();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
844 #endif /* AMIGA */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
845 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
846
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
847 #ifdef COW_HAS_IT_WHY_SHOULDNT_WE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
848 if(showMapAtMotd) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
849 map();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
850 redraw_death_messages();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
851 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
852 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
853
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
854 if (me->p_status == PTQUEUE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
855 startTime = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
856
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
857 if (me->p_status == POUTFIT) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
858 /* time only elapses in OUTFIT mode */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
859
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
860 if (startTime == -1) { /* we were on the tqueue */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
861 /* I hate this [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
862 #if 1
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
863 W_Deiconify(baseWin); /* we changed status. alert
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
864 the user */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
865 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
866 startTime = time(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
867 spareTime = 480; /* Allow them extra time, as long */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
868 /* as they are active */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
869 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
870 elapsed = time(0) - startTime;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
871
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
872 if (elapsed > autoQuit) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
873 printf("Auto-Quit.\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
874 *team = number_of_teams;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
875 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
876 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
877 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
878 if (lasttime != time(0)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
879 if (W_IsMapped(playerw))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
880 playerlist2();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
881
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
882 if (newMotdStuff) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
883 showMotd(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
884 #ifdef COW_HAS_IT_WHY_SHOULDNT_WE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
885 if(showMapAtMotd) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
886 map();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
887 redraw_death_messages();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
888 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
889 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
890 showValues(mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
891 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
892 if (me->p_status == POUTFIT) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
893 showTimeLeft(elapsed, autoQuit);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
894 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
895 lasttime = time(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
896 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
897 okayMask = tournMask;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
898
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
899 /* redraw those windows whose choosable status has changed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
900 for (i = 0; i < number_of_teams; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
901 if ((okayMask ^ lastOkayMask) & (1 << i)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
902 if (okayMask & (1 << i)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
903 W_UnTileWindow(teamWin[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
904 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
905 W_TileWindow(teamWin[i], stipple);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
906 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
907 lastplayercount[i] = -1; /* force update */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
908 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
909 redrawTeam(teamWin[i], i, &lastplayercount[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
910 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
911 lastOkayMask = okayMask;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
912 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
913
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
914 #ifdef RECORDER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
915 if (playback) /* silly. Shouldn't even be mapping team windows. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
916 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
917 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
918 /* they quit or ran out of time */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
919 if (*team == number_of_teams) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
920 me->p_status = PFREE; /* exit outer while loop */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
921 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
922 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
923 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
924 this makes them eventually run out of time no matter how awake
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
925 they are. Only affects the OUTFIT screen.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
926 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
927 if (me->p_status == POUTFIT && startTime != -1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
928 if (time(0) - startTime <= spareTime) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
929 spareTime -= time(0) - startTime;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
930 startTime = time(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
931 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
932 startTime += spareTime;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
933 spareTime = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
934 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
935 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
936 if (!W_EventsPending())
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
937 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
938
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
939 /* ok, there's a window event pending */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
940
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
941 /* thiswill set p_status to PFREE if they decide to quit */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
942 get_N_dispatch_outfit_event(team, s_type, lastplayercount);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
943
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
944 } while ((me->p_status == POUTFIT ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
945 me->p_status == PTQUEUE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
946 #ifdef RECORDER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
947 && (!pb_update)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
948 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
949 );
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
950
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
951 if (*team >= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
952 strcpy(buf, "Welcome aboard ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
953 if (paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
954 strcat(buf, ranks2[me->p_stats2.st_rank].name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
955 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
956 strcat(buf, ranks[me->p_stats.st_rank].name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
957 sprintf(buf, "Welcome aboard %s!", get_players_rank_name(me));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
958 warning(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
959 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
960 #ifdef RECORDER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
961 if (playback) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
962 extern int lastTeamReq;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
963 *team = me->p_teami = lastTeamReq;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
964 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
965 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
966 /* if they quit or ran out of time */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
967 if (me->p_status == PFREE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
968 *team = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
969 else if (me->p_status == PALIVE ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
970 me->p_status == POBSERVE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
971 if (*team == -1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
972 *team = me->p_teami;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
973 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
974 me->p_teami = *team;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
975
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
976
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
977 for (i = 0; i < number_of_teams; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
978 W_UnmapWindow(teamWin[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
979 W_UnmapWindow(qwin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
980 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
981
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
982 /* Attempt to pick specified team & ship */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
983 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
984 teamRequest(team, ship)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
985 int team, ship;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
986 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
987 int lastTime;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
988
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
989 #ifdef RECORDER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
990 extern int lastTeamReq;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
991
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
992 if (!playback)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
993 lastTeamReq = team;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
994 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
995 #ifdef TIMELORD
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
996 if (!allowed_to_keep_playing()) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
997 warning("You've played enough for today. Get back to work!");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
998 return 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
999 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1000 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1001 pickOk = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1002 sendTeamReq(team, ship);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1003 lastTime = time(NULL);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1004 while (pickOk == -1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1005 if (lastTime + 3 < time(NULL)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1006 sendTeamReq(team, ship);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1007 lastTime = time(NULL);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1008 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1009 socketPause(0, 20000);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1010 readFromServer();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1011 if (isServerDead()) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1012 printf("Whoops! We've been ghostbusted!\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1013 printf("Pray for a miracle!\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1014
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1015 /* UDP fail-safe */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1016 commMode = commModeReq = COMM_TCP;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1017 commSwitchTimeout = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1018 if (udpSock >= 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1019 closeUdpConn();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1020 if (udpWin) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1021 udprefresh(UDP_CURRENT);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1022 udprefresh(UDP_STATUS);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1023 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1024 connectToServer(nextSocket);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1025 printf("Yea! We've been resurrected!\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1026 pickOk = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1027 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1028 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1029 #if 0 /* >this< is redundant ;-) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1030 if (me->p_status == PALIVE) { /* well, something happened and we've
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1031 got a ship! */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1032 pickOk = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1033 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1034 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1035 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1036 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1037
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1038 #if 1 /* this is not redundant? */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1039 if (pickOk) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1040 me->p_status = PALIVE; /* we got a ship. We must be alive */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1041 #ifdef TIMER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1042 timeBank[T_SHIP] = time(NULL);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1043 #endif /* TIMER */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1044 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1045 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1046 return (pickOk);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1047 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1048
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1049 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1050 numShips(owner)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1051 int owner;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1052 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1053 int i, num = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1054 struct player *p;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1055
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1056 for (i = 0, p = players; i < nplayers; i++, p++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1057 if ((p->p_status == PALIVE || p->p_status == PTQUEUE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1058 && p->p_teami == owner)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1059 num++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1060 return (num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1061 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1062
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1063 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1064 int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1065 realNumShips(owner)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1066 int owner;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1067 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1068 int i, num = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1069 struct player *p;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1070
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1071 for (i = 0, p = players; i < MAXPLAYER; i++, p++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1072 if (p->p_status != PFREE &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1073 p->p_team == owner)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1074 num++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1075 return (num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1076 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1077 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1078
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1079 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1080 int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1081 deadTeam(owner)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1082 int owner;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1083 /* The team is dead if it has no planets and cannot coup it's home planet */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1084 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1085 int i, num = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1086 struct planet *p;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1087
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1088 if (planets[remap[owner] * 10 - 10].pl_couptime == 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1089 return (0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1090 for (i = 0, p = planets; i < MAXPLANETS; i++, p++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1091 if (p->pl_owner & owner) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1092 num++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1093 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1094 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1095 if (num != 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1096 return (0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1097 return (1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1098 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1099 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1100
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1101 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1102 checkBold(line)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1103 /* Determine if that line should be highlighted on sign-on screen */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1104 /* Which is done when it is the players own score being displayed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1105 char *line;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1106 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1107 char *s, *t;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1108 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1109 int end = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1110
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1111 if ((int) strlen(line) < 60)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1112 return (0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1113 s = line + 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1114 if (!me)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1115 return (0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1116 t = me->p_name;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1117
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1118 for (i = 0; i < 16; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1119 if (!end) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1120 if (*t == '\0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1121 end = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1122 else if (*t != *s)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1123 return (0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1124 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1125 if (end) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1126 if (*s != ' ')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1127 return (0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1128 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1129 s++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1130 t++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1131 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1132 return (1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1133 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1134
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1135 struct list {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1136 char bold;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1137 struct list *next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1138 char *data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1139 };
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1140 static struct list *sysdefptr = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1141
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1142 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1143 showMotd(win)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1144 W_Window win;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1145 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1146 FILE *fopen();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1147 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1148 struct list *data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1149 int count;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1150 int headernum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1151
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1152 newMotdStuff = 0; /* clear the flag */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1153
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1154 if (currpage == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1155 currpage = motddata;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1156 if (currpage == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1157 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1158 if (!W_IsMapped(win))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1159 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1160
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1161 headernum = currpage->page % NRHEADERS;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1162 W_ClearWindow(win);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1163 W_WriteWinBitmap(win, 0, 0, headerA, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1164 W_WriteWinBitmap(win, headerA_width, 0, headerB, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1165 W_WriteWinBitmap(win, headerA_width, headerB_height, headerchanges[headernum], foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1166 if (headernum == 2) { /* fill in client: */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1167 /* note: font dependant */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1168 W_WriteText(win, headerA_width + header3_x_hot, headerB_height + header3_y_hot
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1169 - 7, textColor, CLIENTVERS, strlen(CLIENTVERS), W_BoldFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1170 } else if (headernum == 3) {/* fill in server: */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1171 ;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1172 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1173 if (currpage->first) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1174 currpage->first = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1175 data = currpage->text;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1176 while (data != NULL) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1177 data->bold = checkBold(data->data);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1178 data = data->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1179 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1180 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1181 data = currpage->text;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1182 count = LINESPERPAGE; /* Magical # of lines to display */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1183 i = headerA_height / (paradise ? 10 : W_Textheight) + 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1184 while (count > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1185 if (data == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1186 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1187
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1188 if (data->bold) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1189 W_WriteText(win, 20, i * (paradise ? 10 : W_Textheight), textColor, data->data,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1190 strlen(data->data), W_BoldFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1191 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1192 W_WriteText(win, 20, i * (paradise ? 10 : W_Textheight), textColor, data->data,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1193 strlen(data->data), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1194 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1195 data = data->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1196 count--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1197 i++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1198 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1199 if (win == w) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1200 count = W_StringWidth(blk_refitstring, W_RegularFont) / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1201 W_WriteText(mapw, 250 - count, 480, textColor, blk_refitstring,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1202 strlen(blk_refitstring), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1203 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1204 showPics(win);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1205 /* showValues(mapw); Should be handled in event loop now RF */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1206 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1207
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1208 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1209 showPics(win)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1210 W_Window win;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1211 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1212 struct piclist *temp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1213 int page;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1214
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1215 page = currpage->page;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1216 temp = motdPics;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1217
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1218 while (temp != NULL) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1219 if (page == temp->page) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1220 if (temp->thepic)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1221 W_WriteWinBitmap(win, temp->x, temp->y, temp->thepic, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1222 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1223 W_MakeLine(win, temp->x, temp->y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1224 temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1225 W_MakeLine(win, temp->x, temp->y + temp->height - 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1226 temp->x + temp->width - 1, temp->y, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1227 W_MakeLine(win, temp->x, temp->y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1228 temp->x + temp->width - 1, temp->y, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1229 W_MakeLine(win, temp->x, temp->y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1230 temp->x, temp->y + temp->height - 1, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1231 W_MakeLine(win, temp->x, temp->y + temp->height - 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1232 temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1233 W_MakeLine(win, temp->x + temp->width - 1, temp->y + temp->height - 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1234 temp->x + temp->width - 1, temp->y, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1235 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1236 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1237 temp = temp->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1238 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1239 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1240
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1241 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1242 * ATM: show the current values of the .sysdef parameters.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1243 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1244 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1245 showValues(win)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1246 W_Window win;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1247 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1248 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1249 struct list *data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1250
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1251 /* try to find the start of the info */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1252 data = sysdefptr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1253
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1254 for (i = 12; i < 50; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1255 if (data == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1256 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1257 if (data->data[0] == '+') /* quick boldface hack */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1258 W_WriteText(win, 20, i * W_Textheight, textColor, data->data + 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1259 strlen(data->data) - 1, W_BoldFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1260 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1261 W_WriteText(win, 20, i * W_Textheight, textColor, data->data,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1262 strlen(data->data), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1263 data = data->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1264 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1265 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1266
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1267 #define BETWEEN_PAGES 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1268 #define IN_PAGE 1
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1269 #define IN_SYSDEF 3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1270
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1271 static int motdlinestate = BETWEEN_PAGES;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1272 static int pagecount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1273 static struct list **temp = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1274 static struct page **ptemp = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1275 static int linecount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1276 static struct piclist **motd_buftail = &motdPics;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1277
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1278 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1279 erase_motd()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1280 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1281 struct piclist *temppic;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1282 struct page *temppage;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1283 struct list *templist;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1284
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1285 while (motdPics) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1286 temppic = motdPics;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1287 motdPics = temppic->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1288 if (temppic->thepic)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1289 W_FreeBitmap(temppic->thepic);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1290 free(temppic);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1291 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1292 motd_buftail = &motdPics;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1293
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1294 while (motddata) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1295 temppage = motddata;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1296 motddata = temppage->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1297 while (temppage->text) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1298 templist = temppage->text;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1299 temppage->text = templist->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1300 free(templist->data);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1301 free(templist);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1302 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1303 free(temppage);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1304 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1305 motdlinestate = BETWEEN_PAGES;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1306 currpage = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1307 pagecount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1308 temp = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1309 ptemp = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1310 linecount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1311
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1312 while (sysdefptr) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1313 templist = sysdefptr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1314 sysdefptr = templist->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1315 free(templist->data);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1316 free(templist);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1317 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1318 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1319
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1320 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1321 newMotdPic(x, y, width, height, bits, page)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1322 int x, y, page, width, height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1323 char *bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1324 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1325 struct piclist *temp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1326
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1327 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1328 struct motd_pic_spacket dummy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1329 if ((width + 7) / 8 * height > sizeof(dummy.bits) && bits) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1330 fprintf(stderr, "MOTD picture from server is too big! %dx%d couldn't possibly fit in the %d data bytes of the packet\n",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1331 width, height, (int) sizeof(dummy.bits));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1332 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1333 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1334 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1335 if ((currpage && page == currpage->page) || page == 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1336 newMotdStuff = 1; /* set flag for event loop */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1337
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1338 temp = (*motd_buftail) = (struct piclist *) malloc(sizeof(struct piclist));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1339 temp->next = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1340 temp->x = x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1341 temp->y = y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1342 temp->width = width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1343 temp->height = height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1344 temp->thepic = bits ? W_StoreBitmap(width, height, bits, motdWin) : 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1345 temp->page = page;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1346 motd_buftail = &(temp->next);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1347 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1348
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1349 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1350 newMotdLine(line)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1351 char *line;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1352 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1353
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1354 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1355 Do this first. That way we don't even have to worry about it at all.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1356 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1357
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1358 if (strncmp("BLK: ", line, 5) == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1359 blk_parsemotd(line);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1360 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1361 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1362 if (strncmp("\t@@@", line, 4) == 0 && motdlinestate != IN_SYSDEF) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1363 motdlinestate = IN_SYSDEF;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1364 temp = &sysdefptr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1365 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1366 if (strncmp("\t@@b", line, 4) == 0 && motdlinestate == IN_PAGE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1367 motdlinestate = BETWEEN_PAGES;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1368
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1369 if (motdlinestate == BETWEEN_PAGES ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1370 (motdlinestate == IN_PAGE && linecount >= LINESPERPAGE)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1371 if (motddata == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1372 ptemp = &motddata;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1373 (*ptemp) = (struct page *) malloc(sizeof(struct page));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1374 (*ptemp)->next = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1375 (*ptemp)->first = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1376 (*ptemp)->prev = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1377 (*ptemp)->page = pagecount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1378 temp = &((*ptemp)->text);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1379 (*ptemp)->text = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1380 ptemp = &((*ptemp)->next);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1381 motdlinestate = IN_PAGE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1382 linecount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1383 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1384 if (strncmp("\t@@", line, 3) == 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1385 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1386
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1387 if (!currpage ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1388 (pagecount - 1) == currpage->page ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1389 motdlinestate == IN_SYSDEF)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1390 newMotdStuff = 1; /* set flag for event loop */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1391
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1392 (*temp) = (struct list *) malloc(sizeof(struct list));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1393 (*temp)->next = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1394 (*temp)->data = (char *) malloc(strlen(line) + 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1395 strcpy((*temp)->data, line);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1396 temp = &((*temp)->next);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1397
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1398 if (motdlinestate == IN_PAGE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1399 linecount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1400 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1401
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1402 /*ARGSUSED*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1403 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1404 getResources(prog)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1405 char *prog;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1406 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1407 getColorDefs();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1408 getTiles();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1409 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1410
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1411 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1412 getTiles()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1413 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1414 stipple = W_StoreBitmap(stipple_width, stipple_height, stipple_bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1415 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1416
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1417 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1418 redrawTeam(win, teamNo, lastnum)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1419 W_Window win;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1420 int teamNo;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1421 int *lastnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1422 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1423 char buf[BUFSIZ];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1424 int num = numShips(teamNo);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1425
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1426 /* Only redraw if number of players has changed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1427 if (*lastnum == num)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1428 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1429
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1430 drawIcon();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1431
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1432 W_ClearWindow(win);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1433 W_WriteBitmap(0, 0, teaminfo[teamNo].shield_logo, shipCol[teamNo + 1]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1434
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1435 (void) sprintf(buf, "%d", num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1436 W_MaskText(win, 5, 46, shipCol[teamNo + 1], buf, strlen(buf),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1437 W_BigFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1438 *lastnum = num;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1439 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1440
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1441 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1442 redrawQuit()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1443 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1444 /* W_WriteText(qwin, 5, 5, textColor, "Quit xtrek", 10, W_RegularFont); */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1445 if (me->p_status == PTQUEUE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1446 W_ClearArea(qwin, 0, 0, BOXSIDE, BOXSIDE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1447 W_WriteBitmap(0, 0, safepic, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1448 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1449 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1450
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1451 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1452 drawIcon()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1453 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1454 if (!iconified) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1455 me_messages = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1456 team_messages = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1457 all_messages = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1458 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1459 #ifdef AMIGA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1460 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1461 not sure this isn't appropriate for X as well. This is called from
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1462 redrawTeam(), so iconified is set, and then all my personal messages
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1463 beep...iconified or not.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1464 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1465 if (W_IsMapped(iconWin))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1466 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1467 iconified = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1468 if (!infoIcon) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1469 W_WriteBitmap(0, 0, icon, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1470 } else { /* code for information icon 1/15 [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1471 int side, bottom, top, digits, x, i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1472 char buf[50];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1473
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1474 W_ClearWindow(iconWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1475 side = icon_width / number_of_teams;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1476 bottom = 0 + side;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1477 top = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1478 W_MakeLine(iconWin, 0, bottom, icon_width, bottom, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1479 for (i = 0; i <= number_of_teams; i++) { /* draw the vertical
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1480 lines */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1481 x = i * side;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1482 x = (x > icon_width) ? icon_width : x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1483 W_MakeLine(iconWin, x, bottom, x, top, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1484 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1485 for (i = 0; i < number_of_teams; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1486 sprintf(buf, "%d", numShips(i));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1487 digits = strlen(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1488 W_WriteText(iconWin, i * side + side / 2 - digits * W_Textwidth / 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1489 bottom - side / 2 - W_Textheight / 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1490 shipCol[i + 1], buf, digits, W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1491 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1492 if (me->p_status == PALIVE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1493 #define TOP icon_height-10
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1494 if (me->p_flags & PFGREEN)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1495 W_FillArea(iconWin, 0, TOP, icon_width,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1496 icon_height, W_Green);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1497 else if (me->p_flags & PFYELLOW)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1498 W_FillArea(iconWin, 0, TOP,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1499 icon_width, icon_height, W_Yellow);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1500 else if (me->p_flags & PFRED)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1501 W_FillArea(iconWin, 0, TOP,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1502 icon_width, icon_height, W_Red);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1503 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1504 if (me_messages) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1505 sprintf(buf, "Personal: %d", me_messages);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1506 W_WriteText(iconWin, 1, bottom + 2, W_White, buf, strlen(buf),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1507 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1508 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1509 if (team_messages) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1510 sprintf(buf, "Team: %d", team_messages);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1511 W_WriteText(iconWin, 1, bottom + 2 + W_Textheight, W_White, buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1512 strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1513 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1514 if (all_messages) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1515 sprintf(buf, "All: %d", all_messages);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1516 W_WriteText(iconWin, 1, bottom + 2 + 2 * W_Textheight, W_White, buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1517 strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1518 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1519 if (me->p_status == POUTFIT) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1520 sprintf(buf, "Time left: %d", autoQuit - elapsed);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1521 W_WriteText(iconWin, 1, bottom + 2 + W_Textheight, W_White, buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1522 strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1523 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1524 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1525 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1526
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1527 #define CLOCK_WID BOXSIDE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1528 #define CLOCK_HEI BOXSIDE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1529 #define CLOCK_BDR 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1530
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1531 #ifndef PI
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1532 #define PI 3.141592654
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1533 #endif /* PI */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1534
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1535 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1536 showTimeLeft(time, max)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1537 int time, max;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1538 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1539 char buf[BUFSIZ];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1540 int cx, cy, ex, ey, tx, ty;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1541
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1542 if ((max - time) < 10 && time & 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1543 W_Beep();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1544 W_Deiconify(baseWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1545 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1546 if (iconified)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1547 drawIcon();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1548 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1549 W_ClearArea(qwin, 0, 0, BOXSIDE, BOXSIDE);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1550
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1551 W_WriteBitmap(0, 0, clockpic, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1552
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1553 cx = BOXSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1554 cy = BOXSIDE / 2 - 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1555 ex = cx - 35 * Sin[((255 * time) / max + 64) % 256];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1556 ey = cy - 35 * Cos[((255 * time) / max + 64) % 256];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1557 W_MakeLine(qwin, cx, cy, ex, ey, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1558
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1559 sprintf(buf, "%d", max - time);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1560 cy = BOXSIDE / 2 - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1561 tx = cx - W_StringWidth(buf, W_RegularFont) / 2.0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1562 ty = cy - W_Textheight;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1563 W_WriteText(qwin, tx, ty, textColor, buf, strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1564 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1565
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1566
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1567 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1568 do_refit(type)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1569 int type;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1570 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1571 sendRefitReq(type);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1572 localflags &= ~PFREFIT;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1573 }