annotate redraw.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 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2 * redraw.c
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 #include "copyright.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 #include <signal.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8 #include <math.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 #include <ctype.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 #include "Wlib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 #include "struct.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 #include "data.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 #include "packets.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15 #include "proto.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 #include "gameconf.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 #ifdef SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 #include "Slib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 #include "sound.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 typedef struct tractor Tractor;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 struct tractor {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 int sx, sy, d1x, d1y, d2x, d2y; /* source (x,y) dest (x1,y1) (x2,y2) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 Tractor *next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 } *tracthead = NULL, *tractcurrent = NULL, *tractrunner;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 struct _clearzone *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 new_czone()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 if (clearzone == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32 czsize = 10;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 clearzone = (struct _clearzone *) malloc(sizeof(*clearzone) * czsize);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34 clearcount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 } else if (clearcount >= czsize) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 clearzone = (struct _clearzone *) realloc(clearzone,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 sizeof(*clearzone) * (czsize *= 2));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 return &clearzone[clearcount++];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 /* Prototypes */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 static void local P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 #ifndef COW_HAS_IT_WHY_SHOULDNT_WE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45 static
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 void map P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48 static void redraw P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49 /* static void stline P((int flag));*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50 static W_Icon planetBitmap P((struct planet * p));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51 static W_Icon planetmBitmap P((struct planet * p));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54 intrupt()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56 static long lastread;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57 static struct timeval lastredraw = {0, 0};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58 struct timeval t;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59 static int needredraw=0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61 #ifndef __osf__
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 long time();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 udcounter++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67 needredraw += readFromServer();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69 gettimeofday(&t, NULL);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 if (needredraw && ((unsigned int) redrawDelay * 100000 <
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71 (unsigned int) ((t.tv_sec - lastredraw.tv_sec) * 1000000
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72 + (t.tv_usec - lastredraw.tv_usec)))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 needredraw = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74 lastredraw=t;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 lastread = time(NULL);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78 #ifdef RECORDER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 if (!playback || (pb_update &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 ((!pb_scan) || !(udcounter % pb_advance))))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83 redraw();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84 playerlist2();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 #ifdef RECORDER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 if (playback) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88 if(!pb_scan) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 if (pb_advance > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90 if ((pb_advance -= pb_update) <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91 pb_advance = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 paused = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 } else if (pb_advance < 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 switch (pb_advance) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 case PB_REDALERT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 if (me->p_flags & PFRED) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98 pb_advance = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99 paused = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102 case PB_YELLOWALERT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103 if (me->p_flags & PFYELLOW) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104 pb_advance = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105 paused = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 case PB_DEATH:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110 if (me->p_status != PALIVE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 pb_advance = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112 paused = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 pb_update = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120 if (recordGame)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121 writeUpdateMarker();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 if (lastread + 3 < time(NULL)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 We haven't heard from server for awhile... Strategy: send a
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128 useless packet to "ping" server.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 sendWarReq(me->p_hostile);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 if (me->p_status == POUTFIT) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134 death();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 redraw()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142 /* erase warning line if necessary */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143 if ((warntimer <= udcounter) && (warncount > 0)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144 #ifndef AMIGA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 W_ClearArea(warnw, 5, 5, W_Textwidth * warncount, W_Textheight);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 W_ClearWindow(warnw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 warncount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152 if (W_FastClear) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 W_ClearWindow(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 clearcount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 clearlcount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 tractcurrent = tracthead;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159 /* just to save a little time on all the function calls */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 /* all the normal clear functions are implemented as well. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161 W_FlushClearZones(w, clearzone, clearcount);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162 clearcount = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 while (clearcount) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 clearcount--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 W_CacheClearArea(w, clearzone[clearcount].x,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 clearzone[clearcount].y, clearzone[clearcount].width,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 clearzone[clearcount].height);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 W_ClearArea(w, clearzone[clearcount].x,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173 clearzone[clearcount].y, clearzone[clearcount].width,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 clearzone[clearcount].height);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178 while (clearlcount) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 clearlcount--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 W_CacheLine(w, clearline[0][clearlcount],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182 clearline[1][clearlcount], clearline[2][clearlcount],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 clearline[3][clearlcount], backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185 W_MakeLine(w, clearline[0][clearlcount],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186 clearline[1][clearlcount], clearline[2][clearlcount],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 clearline[3][clearlcount], backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 #ifndef AMIGA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 W_FlushClearAreaCache(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 W_FlushLineCaches(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195 /* erase the tractor lines [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 for (tractrunner = tracthead; tractrunner != tractcurrent;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 tractrunner = tractrunner->next) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198 W_MakeTractLine(w, tractrunner->sx, tractrunner->sy,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 tractrunner->d1x, tractrunner->d1y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201 W_MakeTractLine(w, tractrunner->sx, tractrunner->sy,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 tractrunner->d2x, tractrunner->d2y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203 backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205 tractcurrent = tracthead;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 local(); /* redraw local window */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 #ifdef AMIGA /* would do it in W_EventsPending, just have
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 it here so the display is updated sooner. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 W_Flush();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 W_FlushLineCaches(w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218 stline(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 if (W_IsMapped(statwin))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221 updateStats();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 updateInform(); /* check and update info window [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 /* XFIX: last since its least accurate information */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 if (mapmode)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 map();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 static W_Icon terrainBitmap(int x, int y)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 int aster_bm = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234 int aster_fluff = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236 /* is no asteroids, then return fluff if adjacent 'roids */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237 if (!(terrainInfo[x*250 + y].types & T_ASTEROIDS)) aster_fluff = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 /* check surrounding terrain */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 if (x > 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241 if (terrainInfo[(x-1)*250 + y].types & T_ASTEROIDS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242 aster_bm |= (1<<0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243 if (x < 249)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244 if (terrainInfo[(x+1)*250 + y].types & T_ASTEROIDS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245 aster_bm |= (1<<2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 if (y > 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247 if (terrainInfo[x*250 + y-1].types & T_ASTEROIDS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 aster_bm |= (1<<3);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249 if (y < 249)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250 if (terrainInfo[x*250 + y+1].types & T_ASTEROIDS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 aster_bm |= (1<<1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253 if (aster_fluff && aster_bm) return asteroidfluff[(x*250 + y)%3];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 else return asteroidBM[aster_bm];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257 static W_Icon
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258 planetBitmap(p)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 register struct planet *p;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262 if (paradise) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 switch (PL_TYPE(*p)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264 case PLWHOLE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265 return wormBM[udcounter % WORMFRAMES];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 case PLSTAR:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 return starBM[udcounter % STARFRAMES];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 case PLAST:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271 return basteroid[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274 if (showlocal == 2) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 return (bplanets[0]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276 } else if (p->pl_info & idx_to_mask(me->p_teami)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277 if (showlocal == 1 || showlocal == 4) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 i = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279 if ((paradise) && (p->pl_flags & PLSHIPYARD))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280 i += 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 if (p->pl_armies > 4)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 i += 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 if (p->pl_flags & PLREPAIR)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 i += 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285 if (p->pl_flags & PLFUEL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286 i += 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 return ((showlocal == 1 ? bplanets2 : bplanetsMOO)[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288 } else if (showlocal == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289 int team = mask_to_idx(p->pl_owner);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290 if (team < -1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291 team = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 else if (team >= number_of_teams)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 team = number_of_teams - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294 return (bplanets[1 + team]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296 int mask;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297 if (paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 mask = (p->pl_flags & PLSURMASK) >> PLSURSHIFT;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300 mask = ((p->pl_flags & PLFUEL) ? 1 : 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 | ((p->pl_flags & PLREPAIR) ? 2 : 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 | ((p->pl_flags & PLAGRI) ? 4 : 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 return bplanetsr[mask];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307 return (bplanets[5]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312 static W_Icon
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 planetmBitmap(p)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314 register struct planet *p;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 if (paradise) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 switch (p->pl_flags & PLTYPEMASK) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319 case PLSTAR:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320 return mstarBM;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321 case PLAST:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322 return mbasteroid[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323 #ifdef VISIBLE_WORMHOLES
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 case PLWHOLE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 return mholeBM;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 #endif /*VISIBLE_WORMHOLES*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 if (showgalactic == 2) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330 return (mbplanets[0]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331 } else if (showgalactic == 4) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332 int infoage = 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 if (!(p->pl_info & idx_to_mask(me->p_teami)))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334 return mbplanetsA[NSCOUTAGES - 1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 if (p->pl_owner == idx_to_mask(me->p_teami))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
336 return mbplanetsA[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
337
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
338 for (i = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
339 i < NSCOUTAGES - 1 && infoage < status2->clock - p->pl_timestamp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
340 i++, infoage = infoage * 5 / 3) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
341 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
342 return mbplanetsA[i];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
343 } else if (p->pl_info & idx_to_mask(me->p_teami)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
344 if (showgalactic == 1 || showgalactic == 5) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
345 i = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
346 if ((paradise) && (p->pl_flags & PLSHIPYARD))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
347 i += 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
348 if (p->pl_armies > 4)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
349 i += 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
350 if (p->pl_flags & PLREPAIR)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
351 i += 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
352 if (p->pl_flags & PLFUEL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
353 i += 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
354 return ((showgalactic == 1 ? mbplanets2 : mbplanetsMOO)[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
355 } else if (showgalactic == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
356 int team = mask_to_idx(p->pl_owner);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
357 if (team < -1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
358 team = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
359 else if (team >= number_of_teams)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
360 team = number_of_teams - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
361 return (mbplanets[1 + team]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
362 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
363 int mask;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
364 if (paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
365 mask = (p->pl_flags & PLSURMASK) >> PLSURSHIFT;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
366 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
367 mask = ((p->pl_flags & PLFUEL) ? 1 : 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
368 | ((p->pl_flags & PLREPAIR) ? 2 : 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
369 | ((p->pl_flags & PLAGRI) ? 4 : 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
370 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
371 return mbplanetsr[mask];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
372 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
373 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
374 return (mbplanets[5]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
375 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
376 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
377
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
378 /* call this from local for each player, instead of having an extra loop! */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
379 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
380 redraw_photon_torps(j)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
381 struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
382 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
383 int i, h;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
384 struct torp *k;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
385 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
386 int view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
387 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
388
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
389 view = SCALE * WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
390 i = j->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
391 if (!j->p_ntorp)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
392 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
393 for (h = 0, k = &torps[ntorps * i + h]; h < ntorps; h++, k++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
394 if (!k->t_status)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
395 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
396 dx = k->t_x - me->p_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
397 dy = k->t_y - me->p_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
398 if (ABS(dx) > view || ABS(dy) > view) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
399 /* Call any torps off screen "free" (if owned by other) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
400 if (k->t_status == TEXPLODE && j != me) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
401 k->t_status = TFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
402 j->p_ntorp--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
403 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
404 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
405 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
406 dx = dx / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
407 dy = dy / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
408 #ifdef UNIX_SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
409 if ((k->t_status == TEXPLODE) && (k->t_fuse == 5)) play_sound (SND_TORPHIT);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
410 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
411 if (k->t_status == TEXPLODE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
412
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
413 k->t_fuse--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
414 if (k->t_fuse <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
415 k->t_status = TFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
416 j->p_ntorp--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
417 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
418 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
419 if (k->t_fuse >= NUMDETFRAMES) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
420 k->t_fuse = NUMDETFRAMES - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
421 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
422 W_WriteBitmap(dx - (cloud_width / 2), dy - (cloud_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
423 cloud[k->t_fuse], torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
424 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
425 cz->x = dx - (cloud_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
426 cz->y = dy - (cloud_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
427 cz->width = cloud_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
428 cz->height = cloud_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
429 } else if (k->t_owner != me->p_no && ((k->t_war & idx_to_mask(me->p_teami)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
430 (idx_to_mask(players[k->t_owner].p_teami) & (me->p_hostile | me->p_swar)))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
431 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
432 solid. Looks strange. W_FillArea(w, dx - (etorp_width/2), dy
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
433 - (etorp_height/2), etorp_width, etorp_height, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
434 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
435
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
436 #ifdef BORGTEST
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
437 W_CacheLine(w, dx - (etorp_width / 2), dy - (etorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
438 dx + (etorp_width / 2), dy + (etorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
439 (k->t_turns == 32767) ? notColor(k) : torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
440 W_CacheLine(w, dx + (etorp_width / 2), dy - (etorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
441 dx - (etorp_width / 2), dy + (etorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
442 (k->t_turns == 32767) ? notColor(k) : torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
443 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
444 #ifdef TORPBITS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
445 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
446 went back to this for Amiga, one bitmap is faster than 2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
447 lines.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
448 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
449 W_WriteBitmap(dx - (etorp_width / 2), dy - (etorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
450 etorp, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
451 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
452 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
453 if (0 && k->frame) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
454 W_CacheLine(w, dx - 2, dy,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
455 dx + 2, dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
456 W_CacheLine(w, dx, dy - 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
457 dx, dy + 2, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
458 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
459 W_CacheLine(w, dx - 1, dy - 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
460 dx + 1, dy + 1, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
461 W_CacheLine(w, dx + 1, dy - 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
462 dx - 1, dy + 1, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
463 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
464 k->frame = !k->frame;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
465 #endif /* TORPBITS */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
466 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
467
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
468 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
469 cz->x = dx - (etorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
470 cz->y = dy - (etorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
471 cz->width = etorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
472 cz->height = etorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
473 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
474 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
475
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
476 if (0 /* animateTorps */ ) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
477 switch (k->frame) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
478 case 0:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
479 W_CacheLine(w, dx - (mtorp_width / 2), dy, dx,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
480 dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
481 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
482 case 1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
483 W_CacheLine(w, dx - (mtorp_width / 2), dy - (mtorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
484 dx, dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
485 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
486 case 2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
487 W_CacheLine(w, dx, dy, dx,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
488 dy + (mtorp_width / 2), torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
489 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
490 case 3:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
491 W_CacheLine(w, dx, dy,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
492 dx + (mtorp_width / 2), dy - (mtorp_width / 2), torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
493 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
494 case 4:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
495 W_CacheLine(w, dx, dy, dx + (mtorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
496 dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
497 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
498 case 5:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
499 W_CacheLine(w, dx - (mtorp_width / 2), dy - (mtorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
500 dx, dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
501 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
502 case 6:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
503 W_CacheLine(w, dx, dy - (mtorp_width / 2), dx,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
504 dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
505 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
506 case 7:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
507 W_CacheLine(w, dx - (mtorp_width / 2), dy - (mtorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
508 dx, dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
509 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
510 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
511 k->frame++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
512 if (k->frame > 7)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
513 k->frame = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
514 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
515 #ifdef TORPBITS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
516 W_WriteBitmap(dx - (mtorp_width / 2), dy - (mtorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
517 mtorp, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
518 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
519 W_CacheLine(w, dx - (mtorp_width / 2), dy,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
520 dx + (mtorp_width / 2), dy, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
521 W_CacheLine(w, dx, dy - (mtorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
522 dx, dy + (mtorp_width / 2), torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
523 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
524 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
525
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
526 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
527 cz->x = dx - (mtorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
528 cz->y = dy - (mtorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
529 cz->width = mtorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
530 cz->height = mtorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
531 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
532 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
533 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
534
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
535 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
536 draw_one_thingy(k)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
537 struct thingy *k;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
538 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
539 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
540 int view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
541 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
542 view = SCALE * WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
543
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
544 if (k->t_shape == SHP_BLANK)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
545 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
546 /* printf("%d,%d - %d,%d\n", me->p_x, me->p_y, k->t_x, k->t_y); */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
547 dx = k->t_x - me->p_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
548 dy = k->t_y - me->p_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
549 if (ABS(dx) > view || ABS(dy) > view) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
550 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
551 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
552 dx = dx / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
553 dy = dy / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
554 switch (k->t_shape) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
555 case SHP_BOOM:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
556 k->t_fuse--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
557 if (k->t_fuse <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
558 k->t_shape = SHP_BLANK;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
559 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
560 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
561 if (k->t_fuse >= NUMDETFRAMES) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
562 k->t_fuse = NUMDETFRAMES - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
563 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
564 W_WriteBitmap(dx - (cloud_width / 2), dy - (cloud_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
565 cloud[k->t_fuse], droneColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
566 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
567 cz->x = dx - (cloud_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
568 cz->y = dy - (cloud_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
569 cz->width = cloud_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
570 cz->height = cloud_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
571 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
572 case SHP_MISSILE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
573 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
574 int dview = (int) (k->t_dir * NDRONEVIEWS + 128) / 256;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
575 if (dview >= NDRONEVIEWS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
576 dview -= NDRONEVIEWS;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
577 W_WriteBitmap
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
578 (dx - (drone_width / 2), dy - (drone_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
579 drone_bm[dview],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
580 droneColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
581 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
582 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
583 cz->x = dx - (drone_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
584 cz->y = dy - (drone_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
585 cz->width = drone_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
586 cz->height = drone_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
587 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
588 case SHP_TORP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
589 if (k->t_owner != me->p_no &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
590 ((k->t_war & idx_to_mask(me->p_teami)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
591 (idx_to_mask(players[k->t_owner].p_teami) & (me->p_hostile | me->p_swar)))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
592 W_CacheLine(w, dx - (etorp_width / 2), dy - (etorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
593 dx + (etorp_width / 2), dy + (etorp_height / 2), torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
594 W_CacheLine(w, dx + (etorp_width / 2), dy - (etorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
595 dx - (etorp_width / 2), dy + (etorp_height / 2), torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
596 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
597 cz->x = dx - (etorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
598 cz->y = dy - (etorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
599 cz->width = etorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
600 cz->height = etorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
601 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
602 W_CacheLine(w, dx - (mtorp_width / 2), dy, dx + (mtorp_width / 2), dy,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
603 torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
604 W_CacheLine(w, dx, dy - (mtorp_width / 2), dx, dy + (mtorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
605 torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
606 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
607 cz->x = dx - (mtorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
608 cz->y = dy - (mtorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
609 cz->width = mtorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
610 cz->height = mtorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
611 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
612 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
613 case SHP_PLASMA:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
614 case SHP_MINE: /* use plasma until I get a nifty bitmap */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
615 if (k->t_owner != me->p_no &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
616 ((k->t_war & idx_to_mask(me->p_teami)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
617 (idx_to_mask(players[k->t_owner].p_teami) & (me->p_hostile | me->p_swar)))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
618 W_WriteBitmap(dx - (eplasmatorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
619 dy - (eplasmatorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
620 eplasmatorp, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
621 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
622 cz->x = dx - (eplasmatorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
623 cz->y = dy - (eplasmatorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
624 cz->width = eplasmatorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
625 cz->height = eplasmatorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
626 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
627 W_WriteBitmap(dx - (mplasmatorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
628 dy - (mplasmatorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
629 mplasmatorp, torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
630 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
631 cz->x = dx - (mplasmatorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
632 cz->y = dy - (mplasmatorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
633 cz->width = mplasmatorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
634 cz->height = mplasmatorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
635 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
636 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
637 case SHP_PBOOM:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
638 k->t_fuse--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
639 if (k->t_fuse <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
640 k->t_shape = SHP_BLANK;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
641 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
642 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
643 if (k->t_fuse >= NUMDETFRAMES) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
644 k->t_fuse = NUMDETFRAMES - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
645 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
646 W_WriteBitmap(dx - (plasmacloud_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
647 dy - (plasmacloud_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
648 plasmacloud[k->t_fuse], torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
649 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
650 cz->x = dx - (plasmacloud_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
651 cz->y = dy - (plasmacloud_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
652 cz->width = plasmacloud_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
653 cz->height = plasmacloud_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
654 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
655 case SHP_FIGHTER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
656 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
657 int fview = (int) (k->t_dir * VIEWS + 128) / 256;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
658 if (fview >= VIEWS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
659 fview -= VIEWS;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
660 W_WriteBitmap(dx - (fighter_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
661 dy - (fighter_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
662 fighter[fview], torpColor(k));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
663 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
664 cz->x = dx - (fighter_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
665 cz->y = dy - (fighter_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
666 cz->width = fighter_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
667 cz->height = fighter_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
668 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
669 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
670 case SHP_WARP_BEACON:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
671 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
672 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
673 cz->x = dx - (warpbeacon_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
674 cz->y = dy - (warpbeacon_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
675 cz->width = warpbeacon_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
676 cz->height = warpbeacon_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
677 W_WriteBitmap(cz->x, cz->y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
678 warpbeacon, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
679 if (k->t_fuse > 4) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
680 W_WriteBitmap(cz->x, cz->y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
681 wbflash, shipCol[1 + mask_to_idx(k->t_owner)]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
682 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
683 if (++(k->t_fuse) > 6)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
684 k->t_fuse = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
685 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
686 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
687 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
688
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
689 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
690 redraw_drones(j)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
691 struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
692 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
693 int i, h;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
694 int count;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
695
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
696 i = j->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
697
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
698 if (!j->p_ndrone)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
699 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
700 count = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
701
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
702 for (h = i * npthingies; h < npthingies * (i + 1); h++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
703 draw_one_thingy(&thingies[h]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
704 if (thingies[h].t_shape != SHP_BLANK)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
705 count++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
706 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
707 j->p_ndrone = count;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
708 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
709
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
710 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
711 redraw_other_drones()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
712 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
713 int h;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
714
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
715 for (h = 0; h < ngthingies; h++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
716 draw_one_thingy(&thingies[nplayers * npthingies + h]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
717 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
718
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
719 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
720 redraw_plasma_torps(j)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
721 struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
722 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
723 int h, i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
724 register struct plasmatorp *pt;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
725 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
726
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
727 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
728 int view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
729
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
730 view = SCALE * WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
731 i = j->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
732
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
733 if (!j->p_nplasmatorp)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
734 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
735 for (h = 0, pt = &plasmatorps[nplasmas * i + h]; h < nplasmas; h++, pt++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
736 if (!pt->pt_status)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
737 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
738 dx = pt->pt_x - me->p_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
739 dy = pt->pt_y - me->p_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
740 if (ABS(dx) > view || ABS(dy) > view)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
741 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
742 dx = dx / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
743 dy = dy / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
744 #ifdef UNIX_SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
745 if ((pt->pt_status == TEXPLODE) && (pt->pt_fuse == 5))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
746 play_sound (SND_TORPHIT); /* Torp Hit used for Plasma Hit */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
747 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
748 if (pt->pt_status == PTEXPLODE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
749 pt->pt_fuse--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
750 if (pt->pt_fuse <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
751 pt->pt_status = PTFREE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
752 j->p_nplasmatorp--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
753 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
754 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
755 if (pt->pt_fuse >= NUMDETFRAMES) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
756 pt->pt_fuse = NUMDETFRAMES - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
757 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
758 W_WriteBitmap(dx - (plasmacloud_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
759 dy - (plasmacloud_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
760 plasmacloud[pt->pt_fuse], plasmatorpColor(pt));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
761 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
762 cz->x = dx - (plasmacloud_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
763 cz->y = dy - (plasmacloud_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
764 cz->width = plasmacloud_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
765 cz->height = plasmacloud_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
766 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
767 /* needmore: if(pt->pt_war & idx_to_mask(me->p_teami)) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
768 else if (pt->pt_owner != me->p_no && ((pt->pt_war & idx_to_mask(me->p_teami)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
769 (idx_to_mask(players[pt->pt_owner].p_teami) & (me->p_hostile | me->p_swar)))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
770 W_WriteBitmap(dx - (eplasmatorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
771 dy - (eplasmatorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
772 eplasmatorp, plasmatorpColor(pt));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
773 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
774 cz->x = dx - (eplasmatorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
775 cz->y = dy - (eplasmatorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
776 cz->width = eplasmatorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
777 cz->height = eplasmatorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
778 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
779 W_WriteBitmap(dx - (mplasmatorp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
780 dy - (mplasmatorp_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
781 mplasmatorp, plasmatorpColor(pt));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
782 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
783 cz->x = dx - (mplasmatorp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
784 cz->y = dy - (mplasmatorp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
785 cz->width = mplasmatorp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
786 cz->height = mplasmatorp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
787 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
788 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
789 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
790
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
791 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
792 void tactical_hockey P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
793 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
794
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
795 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
796 redraw_terrain()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
797 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
798 int i,j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
799 int view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
800 int nx, ny; /* for adjusted coords, based on ship position */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
801 int tx, ty, x; /* terrain grid x and y for 0,0 on the local */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
802 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
803
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
804 view = SCALE * WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
805
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
806 nx = (int) ((me->p_x - view) / SCALE)%terrain_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
807 ny = (int) ((me->p_y - view) / SCALE)%terrain_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
808
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
809 ty = (int) ((me->p_y - view)/(GWIDTH/250));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
810 x = tx = (int) ((me->p_x - view)/(GWIDTH/250));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
811 if (ty < 0) ty = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
812 if (tx < 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
813 tx = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
814 x = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
815 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
816
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
817 if(received_terrain_info) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
818 for (i=0; i < WINSIDE; i += terrain_height) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
819 for (j=0; j < WINSIDE; j += terrain_width) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
820 if ((terrainInfo[tx*250+ty].types & T_ASTEROIDS) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
821 ((tx > 0) && (terrainInfo[(tx-1)*250+ty].types & T_ASTEROIDS)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
822 ((tx < 249) && (terrainInfo[(tx+1)*250+ty].types & T_ASTEROIDS)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
823 ((ty > 0) && (terrainInfo[tx*250+(ty-1)].types & T_ASTEROIDS)) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
824 ((tx < 249) && (terrainInfo[tx*250+(ty+1)].types & T_ASTEROIDS))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
825 W_WriteBitmap(j-nx, i-ny, terrainBitmap(tx,ty), W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
826 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
827 cz->x = j-nx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
828 cz->y = i-ny;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
829 cz->width = terrain_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
830 cz->height = terrain_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
831 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
832 tx++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
833 if (tx >= 250) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
834 tx = x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
835 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
836 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
837 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
838 ty++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
839 if (ty >= 250) break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
840 tx = x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
841 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
842 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
843 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
844
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
845 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
846 redraw_all_planets()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
847 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
848 int view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
849 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
850 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
851 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
852 struct planet *l;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
853 int nplan;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
854
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
855 view = SCALE * WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
856 nplan = paradise ? nplanets : 40;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
857
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
858 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
859 if(hockey) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
860 tactical_hockey();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
861 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
862 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
863 for (i = 0, l = &planets[i]; i < nplan; i++, l++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
864 dx = l->pl_x - me->p_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
865 dy = l->pl_y - me->p_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
866 if (ABS(dx) > view || ABS(dy) > view)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
867 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
868 dx = dx / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
869 dy = dy / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
870 if (PL_TYPE(*l) == PLWHOLE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
871 W_WriteBitmap(dx - (wormhole_width / 2), dy - (wormhole_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
872 planetBitmap(l),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
873 ((paradise) && (PL_TYPE(*l) == PLWHOLE))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
874 ? textColor
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
875 : planetColor(l));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
876 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
877 W_WriteBitmap(dx - (planet_width / 2), dy - (planet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
878 planetBitmap(l),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
879 ((paradise) && (PL_TYPE(*l) == PLSTAR))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
880 ? textColor
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
881 : planetColor(l));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
882 #ifdef SHOW_IND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
883 if (showIND && (l->pl_info & idx_to_mask(me->p_teami)) && (l->pl_owner == NOBODY) && l->pl_flags & PLPLANET)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
884 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
885 W_CacheLine (w, dx - (planet_width / 2), dy - (planet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
886 dx + (planet_width / 2 - 1), dy + (planet_height / 2 - 1),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
887 W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
888 W_CacheLine (w, dx + (planet_width / 2 - 1), dy - (planet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
889 dx - (planet_width / 2), dy + (planet_height / 2 - 1),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
890 W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
891 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
892 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
893 if (namemode) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
894 if (PL_TYPE(*l) != PLWHOLE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
895 W_MaskText(w, dx - l->pl_namelen * W_Textwidth / 2, dy + (planet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
896 ((paradise) && (PL_TYPE(*l) == PLSTAR))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
897 ? textColor
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
898 : planetColor(l),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
899 l->pl_name, l->pl_namelen, planetFont(l));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
900 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
901 cz->x = dx - l->pl_namelen * W_Textwidth / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
902 cz->y = dy + (planet_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
903 cz->width = W_Textwidth * l->pl_namelen;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
904 cz->height = W_Textheight;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
905 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
906 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
907 /* put letters and number next to */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
908 /* planet bitmaps for resources and */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
909 /* armies */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
910 if (paradise && tacPlanetInfo) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
911 if (PL_TYPE(*l) == PLPLANET) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
912 char dspstr[8];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
913 if (tacPlanetInfo & 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
914 sprintf(dspstr, "%d", l->pl_armies);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
915 if ((tacPlanetInfo & 2) && (l->pl_flags & PLREPAIR))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
916 strcat(dspstr, "R");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
917 if ((tacPlanetInfo & 4) && (l->pl_flags & PLFUEL))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
918 strcat(dspstr, "F");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
919 if ((tacPlanetInfo & 8) && (l->pl_flags & PLAGRI))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
920 strcat(dspstr, "A");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
921 if ((tacPlanetInfo & 16) && (l->pl_flags & PLSHIPYARD))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
922 strcat(dspstr, "S");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
923 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
924 cz->x = dx + planet_width/2 + 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
925 cz->y = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
926 cz->width = W_Textwidth * strlen(dspstr);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
927 cz->height = W_Textheight;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
928 W_MaskText(w, cz->x, cz->y,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
929 planetColor(l), dspstr, strlen(dspstr),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
930 planetFont(l));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
931 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
932 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
933
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
934 /*--------draw tactical lock*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
935 if ((showLock & 2) && (me->p_flags & PFPLLOCK) && (me->p_planet == l->pl_no)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
936 W_WriteTriangle(w, dx, dy - (planet_height) / 2 - 6, 5, 0, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
937 cz=new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
938 cz->x=dx-5;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
939 cz->y=dy - (planet_height) / 2 - 12;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
940 cz->width=11;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
941 cz->height=7;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
942 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
943 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
944 if (PL_TYPE(*l) == PLWHOLE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
945 cz->x = dx - (wormhole_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
946 cz->y = dy - (wormhole_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
947 cz->width = wormhole_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
948 cz->height = wormhole_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
949 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
950 cz->x = dx - (planet_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
951 /*cz->y = dy - (planet_height / 2) - 13;*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
952 cz->y = dy - (planet_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
953 cz->width = planet_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
954 /*cz->height = planet_height + 26;*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
955 cz->height = planet_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
956 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
957 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
958 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
959
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
960 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
961 doShowMySpeed(dx, dy, ship_bits, j)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
962 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
963 struct ship_shape *ship_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
964 struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
965 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
966 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
967 char idbuf[5];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
968 int len;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
969 int color;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
970
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
971 sprintf(idbuf, "%c,%d", *(shipnos + j->p_no), me->p_speed);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
972 len = strlen(idbuf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
973 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
974 color the playernum,speed based on warp/afterburn/warpprep state
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
975 [BDyess]
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
976 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
977 switch (me->p_flags & (PFWARP | PFAFTER | PFWARPPREP)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
978 case PFWARP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
979 color = W_Cyan;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
980 me->p_flags &= ~PFWARPPREP;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
981 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
982 case PFAFTER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
983 color = rColor;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
984 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
985 case PFWARPPREP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
986 color = yColor;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
987 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
988 default: /* impulse */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
989 if (me->p_speed > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
990 color = gColor;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
991 } else { /* stopped */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
992 color = textColor;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
993 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
994 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
995 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
996 dx += ship_bits->width / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
997 dy -= ship_bits->height / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
998 /* underline number,speed if warp is suspended [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
999 W_MaskText(w, dx, dy, color, idbuf, len, (me->p_flags & PFWPSUSPENDED) ?
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1000 W_UnderlineFont : shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1001
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1002 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1003 cz->x = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1004 cz->y = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1005 cz->width = len * W_Textwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1006 cz->height = W_Textheight;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1007 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1008
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1009 #ifdef LOCAL_SHIPSTATS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1010 /* show just about anything next to ship on local display
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1011 DSFAPWE - for each letter in statString, show a line for:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1012 Damage, Shields, Fuel, Armies, sPeed, Wtemp, Etemp
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1013
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1014 lower case = reverse length
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1015 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1016 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1017 doLocalShipstats()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1018 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1019 char *sptr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1020 int num=0, len, x=localStatsX, i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1021 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1022 W_Color color;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1023
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1024 for(sptr=statString;*sptr;sptr++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1025 switch(toupper(*sptr)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1026 case 'W':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1027 len=(statHeight*me->p_wtemp) / me->p_ship->s_maxwpntemp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1028 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1029 case 'E':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1030 len=(statHeight*me->p_etemp) / me->p_ship->s_maxegntemp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1031 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1032 case 'P':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1033 len=(statHeight*me->p_speed)/me->p_ship->s_maxspeed;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1034 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1035 case 'D':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1036 len=(statHeight*me->p_damage)/me->p_ship->s_maxdamage;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1037 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1038 case 'S':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1039 len=statHeight - ((statHeight*me->p_shield)/me->p_ship->s_maxshield);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1040 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1041 case 'F':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1042 len=statHeight - ((statHeight*me->p_fuel)/me->p_ship->s_maxfuel);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1043 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1044 case 'A':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1045 len= me->p_ship->s_maxarmies ?
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1046 (statHeight*me->p_armies)/me->p_ship->s_maxarmies : 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1047 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1048 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1049 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1050 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1051 if(islower(*sptr))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1052 len=statHeight - len;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1053 if(len>statHeight)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1054 len=statHeight;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1055
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1056 if(len>2*(statHeight/3) || toupper(*sptr) == 'A')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1057 color=W_Red;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1058 else if(len<(statHeight/3))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1059 color=W_Green;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1060 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1061 color=W_Yellow;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1062 if(len>0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1063 W_CacheLine(w,x+W_Textwidth/2,localStatsY-len,x+W_Textwidth/2,localStatsY,color);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1064 W_MaskText(w,x,localStatsY+1,W_White,sptr,1,W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1065 x+=W_Textwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1066 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1067 if(x>localStatsX) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1068 W_CacheLine(w,localStatsX,localStatsY-statHeight,x,localStatsY-statHeight,W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1069 W_CacheLine(w,localStatsX,localStatsY,x,localStatsY,W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1070 cz=new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1071 cz->x=localStatsX;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1072 cz->y=localStatsY-statHeight+1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1073 cz->width=x-localStatsX;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1074 cz->height=statHeight-2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1075 }
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 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1080 local()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1081 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1082 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1083 register struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1084 register struct phaser *php;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1085 struct _clearzone *cz;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1086
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1087 int dx, dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1088 int view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1089 char idbuf[10];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1090 struct ship_shape *ship_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1091 if (showKitchenSink) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1092 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1093 cz->width = 76;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1094 cz->height = 60;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1095 cz->x = 500 - cz->width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1096 cz->y = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1097 W_WriteBitmap(cz->x, cz->y, kitchenSink, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1098 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1099 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1100 Kludge to try to fix missing ID chars on tactical (short range)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1101 display.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1102 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1103 idbuf[0] = '0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1104 idbuf[1] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1105 /* Draw Terrain */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1106 redraw_terrain();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1107 /* Draw Planets */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1108 redraw_all_planets();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1109 /* Draw ships */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1110 view = SCALE * WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1111 for (i = 0, j = &players[i]; i < nplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1112 int tx, ty;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1113 if (me->p_x < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1114 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1115
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1116 /* more efficient than using a separate loop for this */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1117 redraw_photon_torps(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1118 redraw_drones(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1119 redraw_plasma_torps(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1120
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1121 if ((j->p_status != PALIVE) && (j->p_status != PEXPLODE))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1122 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1123
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1124 #ifdef UNIX_SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1125 if (myPlayer(j) && (j->p_flags & PFCLOAK) &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1126 (j->p_cloakphase == 0)) play_sound (SND_CLOAK);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1127 if (myPlayer(j) && (!(j->p_flags & PFCLOAK)) &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1128 (j->p_cloakphase == 6)) play_sound (SND_CLOAK);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1129 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1130
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1131 if (j->p_flags & PFCLOAK) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1132 if (j->p_cloakphase < (CLOAK_PHASES - 1)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1133 j->p_cloakphase++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1134 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1135 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1136 if (j->p_cloakphase) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1137 j->p_cloakphase--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1138 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1139 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1140 dx = j->p_x - me->p_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1141 dy = j->p_y - me->p_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1142 if (ABS(dx) > view || ABS(dy) > view) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1143 if(j->p_status == PEXPLODE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1144 j->p_explode++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1145 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1146 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1147 dx = dx / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1148 dy = dy / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1149 if (j->p_status == PALIVE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1150
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1151 ship_bits = shape_of_ship(j->p_teami, j->p_ship->s_bitmap);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1152
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1153 if (j->p_flags & PFCLOAK && (j->p_cloakphase == (CLOAK_PHASES - 1))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1154 if (myPlayer(j)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1155 W_WriteBitmap(dx - (cloak_width / 2), dy - (cloak_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1156 cloakicon, myColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1157 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1158 cz->x = dx - (ship_bits->width / 2 + 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1159 cz->y = dy - (ship_bits->height / 2 + 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1160 cz->width = ship_bits->width + 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1161 cz->height = ship_bits->height + 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1162 doShields(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1163 #ifdef VARY_HULL
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1164 doHull(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1165 #endif /* VARY_HULL */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1166 if (showMySpeed)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1167 doShowMySpeed(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1168 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1169 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1170 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1171 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1172 #ifdef BEEPLITE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1173 if (emph_player_seq_n[j->p_no] > 0 &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1174 ((F_beeplite_flags & LITE_PLAYERS_LOCAL) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1175 ((j == me) && (F_beeplite_flags & LITE_SELF)))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1176 int seq_n = emph_player_seq_n[j->p_no] % emph_player_seql_frames;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1177
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1178 cz->x = dx - (emph_player_seql_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1179 cz->y = dy - (emph_player_seql_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1180 cz->width = emph_player_seql_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1181 cz->height = emph_player_seql_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1182
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1183 W_WriteBitmap(dx - (emph_player_seql_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1184 dy - (emph_player_seql_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1185 emph_player_seql[seq_n],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1186 emph_player_color[j->p_no]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1187 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1188 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1189 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1190 cz->x = dx - (ship_bits->width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1191 cz->y = dy - (ship_bits->height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1192 cz->width = ship_bits->width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1193 cz->height = ship_bits->height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1194 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1195 W_WriteBitmap(dx - (ship_bits->width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1196 dy - (ship_bits->height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1197 ship_bits->bmap[rosette((int) j->p_dir,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1198 (int) ship_bits->nviews)], playerColor(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1199 if (j->p_cloakphase > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1200 W_WriteBitmap(dx - (cloak_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1201 dy - (cloak_height / 2), cloakicon, playerColor(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1202 doShields(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1203 if (j == me) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1204 #ifdef VARY_HULL
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1205 doHull(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1206 #endif /* VARY_HULL */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1207 if (showMySpeed)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1208 doShowMySpeed(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1209 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1210 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1211 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1212 if (showLock & 2) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1213 if ((me->p_flags & PFPLOCK) && (me->p_playerl == j->p_no)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1214 W_WriteTriangle(w, dx, dy + (ship_bits->width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1215 4, 1, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1216 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1217 cz->x = dx - 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1218 cz->y = dy + (ship_bits->height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1219 cz->width = 9;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1220 cz->height = 5;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1221 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1222 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1223 doShields(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1224 #ifdef VARY_HULL
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1225 doHull(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1226 #endif /* VARY_HULL */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1227 if (showMySpeed && j == me)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1228 doShowMySpeed(dx, dy, ship_bits, j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1229 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1230 int color = playerColor(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1231 idbuf[0] = *(shipnos + j->p_no);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1232
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1233 W_MaskText(w, dx + (ship_bits->width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1234 dy - (ship_bits->height / 2), color,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1235 idbuf, 1, shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1236
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1237 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1238 cz->x = dx + (ship_bits->width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1239 cz->y = dy - (ship_bits->height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1240 cz->width = W_Textwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1241 cz->height = W_Textheight;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1242 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1243 } else if (j->p_status == PEXPLODE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1244 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1245 i = j->p_explode;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1246 if (i < EX_FRAMES || (i < SBEXPVIEWS && j->p_ship->s_type == STARBASE)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1247
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1248 #ifdef SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1249 if(i==0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1250 S_PlaySound(S_EXPLOSION);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1251 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1252 #ifdef UNIX_SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1253 if (i==0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1254 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1255 if (j->p_ship->s_type == STARBASE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1256 play_sound(SND_EXP_SB); /* Starbase Explode */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1257 else play_sound(SND_EXPLOSION); /* Ship Explosion */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1258 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1259 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1260
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1261 cz = new_czone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1262 if (j->p_ship->s_type == STARBASE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1263 W_WriteBitmap(dx - (sbexp_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1264 dy - (sbexp_height / 2), sbexpview[i],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1265 playerColor(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1266 cz->x = dx - (sbexp_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1267 cz->y = dy - (sbexp_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1268 cz->width = sbexp_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1269 cz->height = sbexp_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1270 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1271 W_WriteBitmap(dx - (ex_width / 2), dy - (ex_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1272 expview[i], playerColor(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1273 cz->x = dx - (ex_width / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1274 cz->y = dy - (ex_height / 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1275 cz->width = ex_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1276 cz->height = ex_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1277 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1278 j->p_explode++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1279 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1280 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1281 /* Now draw his phaser (if it exists) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1282 php = &phasers[j->p_no];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1283 if (php->ph_status != PHFREE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1284 if (php->ph_status == PHMISS) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1285 /* Here I will have to compute end coordinate */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1286 tx = j->p_x + j->p_ship->s_phaserrange * Cos[php->ph_dir];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1287 ty = j->p_y + j->p_ship->s_phaserrange * Sin[php->ph_dir];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1288 tx = (tx - me->p_x) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1289 ty = (ty - me->p_y) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1290 } else if (php->ph_status == PHHIT2) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1291 tx = (php->ph_x - me->p_x) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1292 ty = (php->ph_y - me->p_y) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1293 } else { /* Start point is dx, dy */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1294 tx = (players[php->ph_target].p_x - me->p_x) /
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1295 SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1296 ty = (players[php->ph_target].p_y - me->p_y) /
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1297 SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1298 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1299
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1300
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1301 php->ph_fuse++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1302
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1303 #ifdef CHECK_DROPPED
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1304 if (php->ph_fuse > longest_ph_fuse + 1 && php->ph_status != PHGHOST) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1305 if (reportDroppedPackets)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1306 printf("Dropped phaser free, player %d (fuse)\n", j->p_no);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1307 php->ph_status = PHGHOST;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1308 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1309 if (php->ph_status != PHGHOST) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1310 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1311 #ifdef W_PHASERLINE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1312 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1313 * an old redraw.c I used for the Amiga port(not this port) had this.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1314 * Draws a dashed line instead of solid..different pattern from tractor
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1315 * lines. At least that's what I guessed for amigawindow.c :-) -JR
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1316 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1317
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1318 if (j->p_teami != me->p_teami)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1319 W_MakePhaserLine(w, dx, dy, tx, ty,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1320 (php->ph_fuse % 2 && php->ph_status != PHMISS) ?
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1321 foreColor :
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1322 shipCol[1 + j->p_teami],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1323 php->ph_fuse);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1324 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1325 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1326 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1327 W_Color ph_col;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1328 if (jubileePhasers) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1329
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1330 switch (php->ph_fuse % 4) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1331 case 0:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1332 ph_col = W_Red;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1333 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1334 case 1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1335 ph_col = W_Yellow;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1336 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1337 case 2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1338 ph_col = W_Green;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1339 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1340 case 3:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1341 ph_col = W_Cyan;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1342 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1343 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1344 if (php->ph_status == PHMISS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1345 ph_col = W_White;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1346 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1347 ph_col = (php->ph_fuse % 2 && php->ph_status != PHMISS) ?
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1348 foreColor :
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1349 shipCol[1 + j->p_teami];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1350 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1351 W_CacheLine(w, dx, dy, tx, ty, ph_col);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1352 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1353 clearline[0][clearlcount] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1354 clearline[1][clearlcount] = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1355 clearline[2][clearlcount] = tx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1356 clearline[3][clearlcount] = ty;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1357 clearlcount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1358 #ifdef CHECK_DROPPED
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1359 } /* PHGHOST */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1360 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1361 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1362 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1363
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1364 /* ATM - show tractor/pressor beams (modified by James Collins) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1365 /* showTractorPressor is a variable set by xtrekrc. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1366 /* modified to show all T/P's 1/28/94 [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1367 /* fixed display bug 1/29/94 [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1368 dx = WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1369 dy = WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1370 if (showTractorPressor) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1371 double theta;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1372 unsigned char dir;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1373 int lx[2], ly[2], px, py, target_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1374 struct player *victim = &players[me->p_tractor];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1375 int last;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1376 if (paradise && showAllTractorPressor && allowShowAllTractorPressor) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1377 /* check everybody */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1378 last = nplayers;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1379 j = &players[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1380 i = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1381 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1382 /* only check self */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1383 last = me->p_no + 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1384 j = me;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1385 i = me->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1386 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1387 for (; i < last; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1388 if (!(j->p_flags & (PFTRACT | PFPRESS) && isAlive(j)))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1389 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1390 if (!paradise && RSA_Client > 0 && j != me)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1391 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1392 victim = &players[j->p_tractor];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1393 if (victim->p_flags & PFCLOAK)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1394 break; /* can't see tractors on cloaked opponents */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1395 if (j == me) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1396 dx = dy = WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1397 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1398 dx = (j->p_x - me->p_x) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1399 dy = (j->p_y - me->p_y) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1400 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1401 if (PtOutsideWin(dx, dy))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1402 continue; /* he's off the screen */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1403 px = (victim->p_x - me->p_x) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1404 py = (victim->p_y - me->p_y) / SCALE + WINSIDE / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1405 if (px == dx && py == dy)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1406 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1407 #define XPI 3.1415926
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1408 theta = atan2((double) (px - dx), (double) (dy - py)) + XPI / 2.0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1409 dir = (unsigned char) (theta / XPI * 128.0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1410 target_width = shape_of_ship(victim->p_teami,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1411 victim->p_ship->s_bitmap)->width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1412 if (!(victim->p_flags & PFSHIELD))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1413 target_width /= 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1414 lx[0] = px + (Cos[dir] * (target_width / 2));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1415 ly[0] = py + (Sin[dir] * (target_width / 2));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1416 lx[1] = px - (Cos[dir] * (target_width / 2));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1417 ly[1] = py - (Sin[dir] * (target_width / 2));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1418 #undef XPI
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1419 if (j->p_flags & PFPRESS) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1420 W_MakeTractLine(w, dx, dy, lx[0], ly[0], W_Yellow);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1421 W_MakeTractLine(w, dx, dy, lx[1], ly[1], W_Yellow);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1422 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1423 W_MakeTractLine(w, dx, dy, lx[0], ly[0], W_Green);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1424 W_MakeTractLine(w, dx, dy, lx[1], ly[1], W_Green);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1425 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1426 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1427 keeping track of tractors seperately from other lines allows
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1428 clearing them diffently. Clearing them the same as other
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1429 solid lines caused occasional bits to be left on the screen.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1430 This is the fix. [BDyess]
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1431 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1432 if (tractcurrent == NULL) { /* just starting */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1433 tractcurrent = tracthead = (Tractor *) malloc(sizeof(Tractor));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1434 tracthead->next = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1435 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1436 tractcurrent->sx = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1437 tractcurrent->sy = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1438 tractcurrent->d1x = lx[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1439 tractcurrent->d1y = ly[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1440 tractcurrent->d2x = lx[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1441 tractcurrent->d2y = ly[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1442 /* get ready for the next run through */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1443 if (tractcurrent->next) { /* already malloc'd before */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1444 tractcurrent = tractcurrent->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1445 } else { /* new maximum, create a new struct */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1446 tractcurrent->next = (Tractor *) malloc(sizeof(Tractor));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1447 tractcurrent = tractcurrent->next;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1448 tractcurrent->next = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1449 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1450 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1451 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1452 /* changed torps/drones/plasmas to one call per player, in the above loop */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1453 /* still have leftover drones to draw: */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1454 redraw_other_drones();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1455
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1456 /* Draw Edges */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1457 if (me->p_x < (WINSIDE / 2) * SCALE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1458 int sy, ey;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1459 dx = (WINSIDE / 2) - (me->p_x) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1460 sy = (WINSIDE / 2) + (0 - me->p_y) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1461 ey = (WINSIDE / 2) + (blk_gwidth - me->p_y) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1462 if (sy < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1463 sy = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1464 if (ey > WINSIDE - 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1465 ey = WINSIDE - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1466 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1467 W_CacheLine(w, dx, sy, dx, ey, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1468 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1469 W_MakeLine(w, dx, sy, dx, ey, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1470 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1471 clearline[0][clearlcount] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1472 clearline[1][clearlcount] = sy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1473 clearline[2][clearlcount] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1474 clearline[3][clearlcount] = ey;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1475 clearlcount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1476 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1477 if ((blk_gwidth - me->p_x) < (WINSIDE / 2) * SCALE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1478 int sy, ey;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1479 dx = (WINSIDE / 2) + (blk_gwidth - me->p_x) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1480 sy = (WINSIDE / 2) + (0 - me->p_y) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1481 ey = (WINSIDE / 2) + (blk_gwidth - me->p_y) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1482 if (sy < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1483 sy = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1484 if (ey > WINSIDE - 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1485 ey = WINSIDE - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1486 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1487 W_CacheLine(w, dx, sy, dx, ey, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1488 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1489 W_MakeLine(w, dx, sy, dx, ey, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1490 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1491 clearline[0][clearlcount] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1492 clearline[1][clearlcount] = sy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1493 clearline[2][clearlcount] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1494 clearline[3][clearlcount] = ey;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1495 clearlcount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1496 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1497 if (me->p_y < (WINSIDE / 2) * SCALE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1498 int sx, ex;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1499 dy = (WINSIDE / 2) - (me->p_y) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1500 sx = (WINSIDE / 2) + (0 - me->p_x) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1501 ex = (WINSIDE / 2) + (blk_gwidth - me->p_x) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1502 if (sx < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1503 sx = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1504 if (ex > WINSIDE - 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1505 ex = WINSIDE - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1506 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1507 W_CacheLine(w, sx, dy, ex, dy, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1508 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1509 W_MakeLine(w, sx, dy, ex, dy, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1510 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1511 clearline[0][clearlcount] = sx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1512 clearline[1][clearlcount] = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1513 clearline[2][clearlcount] = ex;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1514 clearline[3][clearlcount] = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1515 clearlcount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1516 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1517 if ((blk_gwidth - me->p_y) < (WINSIDE / 2) * SCALE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1518 int sx, ex;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1519 dy = (WINSIDE / 2) + (blk_gwidth - me->p_y) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1520 sx = (WINSIDE / 2) + (0 - me->p_x) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1521 ex = (WINSIDE / 2) + (blk_gwidth - me->p_x) / SCALE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1522 if (sx < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1523 sx = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1524 if (ex > WINSIDE - 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1525 ex = WINSIDE - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1526 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1527 W_CacheLine(w, sx, dy, ex, dy, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1528 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1529 W_MakeLine(w, sx, dy, ex, dy, warningColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1530 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1531 clearline[0][clearlcount] = sx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1532 clearline[1][clearlcount] = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1533 clearline[2][clearlcount] = ex;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1534 clearline[3][clearlcount] = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1535 clearlcount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1536 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1537 /* Change border color to signify alert status */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1538
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1539 #ifdef UNIX_SOUND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1540 if (oldalert != (me->p_flags & (PFGREEN | PFYELLOW | PFRED)))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1541 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1542 if (me->p_flags & PFRED)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1543 maybe_play_sound (SND_REDALERT); /* Red Alert, play ONLY once */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1544 else sound_completed (SND_REDALERT); /* Done with Red Alert */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1545 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1546 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1547
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1548 if (oldalert != (me->p_flags & (PFGREEN | PFYELLOW | PFRED))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1549 if(paradise && auto_zoom_timer<udcounter && (autoZoom || autoUnZoom)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1550 int old_zoom=blk_zoom;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1551 switch(autoZoom) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1552 case 1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1553 if(me->p_flags & (PFYELLOW | PFRED))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1554 blk_zoom = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1555 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1556 case 2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1557 if(me->p_flags & (PFRED))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1558 blk_zoom = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1559 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1560 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1561 switch(autoUnZoom) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1562 case 1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1563 if(me->p_flags & (PFGREEN))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1564 blk_zoom = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1565 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1566 case 2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1567 if(me->p_flags & (PFYELLOW | PFGREEN))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1568 blk_zoom = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1569 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1570 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1571 if(old_zoom != blk_zoom)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1572 redrawall=1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1573 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1574 oldalert = (me->p_flags & (PFGREEN | PFYELLOW | PFRED));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1575 if (infoIcon && iconified)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1576 drawIcon();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1577 switch (oldalert) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1578 case PFGREEN:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1579 if (extraBorder)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1580 W_ChangeBorder(w, gColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1581 W_ChangeBorder(baseWin, gColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1582 W_ChangeBorder(iconWin, gColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1583 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1584 case PFYELLOW:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1585 if (extraBorder)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1586 W_ChangeBorder(w, yColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1587 W_ChangeBorder(baseWin, yColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1588 W_ChangeBorder(iconWin, yColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1589 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1590 case PFRED:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1591 if (extraBorder)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1592 W_ChangeBorder(w, rColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1593 W_ChangeBorder(baseWin, rColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1594 W_ChangeBorder(iconWin, rColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1595 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1596 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1597 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1598 /* draw stars */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1599
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1600 if (blk_showStars)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1601 drawStars();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1602
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1603 #ifdef LOCAL_SHIPSTATS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1604 if(localShipStats)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1605 doLocalShipstats();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1606 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1607
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1608
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1609 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1610 #define DRAWGRID 4
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1611
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1612 int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1613 zoom_offset(v)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1614 int v;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1615 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1616 if (blk_zoom) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1617 register gwidth, ov;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1618 /* dimension of zoom area */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1619 gwidth = blk_gwidth / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1620 /* offset to bring us into new zoom area */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1621 ov = (v / (int) gwidth) * gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1622 if (blk_zoom > 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1623 return ov;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1624 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1625 /* sector offset into new zoom area */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1626 return ov + (((v - ov) / GRIDSIZE) * GRIDSIZE) - GRIDSIZE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1627 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1628 return v;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1629 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1630
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1631 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1632 void galactic_hockey P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1633 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1634
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1635 #ifndef COW_HAS_IT_WHY_SHOULDNT_WE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1636 static
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1637 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1638 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1639 map()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1640 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1641 int nplan;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1642 register int i, k, tmp = blk_gwidth/250;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1643 register struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1644 register struct planet *l;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1645 register int dx, dy, odx, ody;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1646 static osx = 0, osy = 0; /* old square */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1647 static last_offsetx, last_offsety;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1648 static int grid_fuse; /* TSH */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1649 register int gwidth, offsetx, offsety;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1650 int color, pl = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1651 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1652 last_lock is used to hold the begin/end point for lock line; [0] holds
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1653 me->; [1] holds target lock; lockx[2] holds status of line so we can
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1654 erase if line is there but lock if off
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1655 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1656 static last_lockx[3] = {0, 0, 0}, last_locky[2];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1657 int me_galx, me_galy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1658
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1659 grid_fuse++; /* we only draw the grids every DRAWGRID
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1660 interval */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1661
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1662 /* set number of planets for later */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1663 nplan = (paradise) ? nplanets : 40;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1664
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1665 if (reinitPlanets) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1666 initPlanets();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1667 reinitPlanets = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1668 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1669 /* planets moved so the lines need updating [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1670 if(hockey) hockeyInit();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1671 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1672 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1673
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1674 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1675 galactic_hockey();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1676 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1677
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1678 if (blk_zoom) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1679 gwidth = blk_gwidth / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1680 offsetx = zoom_offset(me->p_x);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1681 offsety = zoom_offset(me->p_y);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1682
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1683 if (offsetx != last_offsetx || offsety != last_offsety)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1684 redrawall = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1685
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1686 last_offsetx = offsetx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1687 last_offsety = offsety;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1688 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1689 gwidth = blk_gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1690 offsetx = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1691 offsety = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1692 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1693
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1694 me_galx = (me->p_x - offsetx) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1695 me_galy = (me->p_y - offsety) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1696
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1697 /* draw asteroid dots -- this is a test only. MDM */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1698 if( received_terrain_info && paradise ){
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1699 /* but avoid that SEGV! */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1700 for( i = 0; i < 250; i++ ){
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1701 for( k = udcounter%10; k < 250; k += 10){
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1702 if(terrainInfo[i*250+k].types & T_ASTEROIDS) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1703 W_DrawPoint( mapw,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1704 (i*tmp - offsetx) * WINSIDE / gwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1705 (k*tmp - offsety) * WINSIDE / gwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1706 W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1707 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1708 if (terrainInfo[i*250+k].types & T_NEBULA) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1709 W_DrawPoint( mapw,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1710 ((i*tmp - offsetx) * WINSIDE / gwidth) + 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1711 ((k*tmp - offsety) * WINSIDE / gwidth) + 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1712 W_Red);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1713 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1714 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1715 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1716 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1717
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1718 if (redrawall)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1719 W_ClearWindow(mapw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1720
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1721 /* draw grid on galactic */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1722 if ((redrawall || (grid_fuse % DRAWGRID) == 0) && (paradise) && (drawgrid)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1723 int x, y, w, h, grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1724 char numbuf[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1725 grid = GRIDSIZE * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1726 for (i = 1; i <= 6 / (blk_zoom ? 2 : 1); i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1727 /* looks nasty but we only have to do it 3 times if blk_zoom */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1728
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1729 /* horizontal line */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1730 x = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1731 y = i * grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1732 w = WINSIDE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1733 numbuf[0] = '0' + (char) i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1734 if (blk_zoom) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1735 /* we might have to clip */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1736 dy = i * GRIDSIZE + offsety;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1737 if (dy >= 0 && dy <= blk_gwidth + 2 * GRIDSIZE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1738 if (offsetx < 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1739 x = grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1740 w = 2 * x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1741 } else if (offsetx + 3 * GRIDSIZE > blk_gwidth) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1742 w = 2 * grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1743 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1744 W_MakeTractLine(mapw, x, y, x + w, y, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1745 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1746 if (sectorNums) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1747 numbuf[0] = '0' + (char) (i + offsety / 33333);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1748 if ((numbuf[0] == '0') || (numbuf[0] == '7'))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1749 numbuf[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1750 if (i == 1) /* so numbers dont overwrite in 1st box */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1751 W_WriteText(mapw, x + 2, y - grid + 11, W_Grey, numbuf, 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1752 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1753 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1754 W_WriteText(mapw, x + 2, y - grid + 2, W_Grey, numbuf, 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1755 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1756 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1757 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1758 W_MakeTractLine(mapw, x, y, x + w, y, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1759 if (sectorNums) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1760 W_WriteText(mapw, x + 2, y - grid + 2, W_Grey, numbuf, 1, W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1761 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1762 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1763 /* vertical line */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1764 x = i * grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1765 y = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1766 h = WINSIDE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1767
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1768 if (blk_zoom) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1769 /* we might have to clip */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1770 dx = i * GRIDSIZE + offsetx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1771 if (dx >= 0 && dx <= blk_gwidth + 2 * GRIDSIZE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1772 if (offsety < 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1773 y = grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1774 h = 2 * y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1775 } else if (offsety + 3 * GRIDSIZE > blk_gwidth) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1776 h = 2 * grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1777 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1778 W_MakeTractLine(mapw, x, y, x, y + h, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1779 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1780 if (sectorNums) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1781 numbuf[0] = '0' + (char) (i + offsetx / 33333);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1782 if ((numbuf[0] == '0') || (numbuf[0] == '7'))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1783 numbuf[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1784 if (i == 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1785 W_WriteText(mapw, x - grid + 11, y + 2, W_Grey, numbuf, 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1786 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1787 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1788 W_WriteText(mapw, x - grid + 2, y + 2, W_Grey, numbuf, 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1789 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1790 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1791 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1792 W_MakeTractLine(mapw, x, y, x, y + h, W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1793 if (sectorNums) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1794 W_WriteText(mapw, x - grid + 2, y + 2, W_Grey, numbuf, 1,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1795 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1796 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1797 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1798 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1799
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1800 dx = ((me->p_x - offsetx) / GRIDSIZE) * GRIDSIZE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1801 dy = ((me->p_y - offsety) / GRIDSIZE) * GRIDSIZE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1802 if (!redrawall && ((osx != dx) || (osy != dy))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1803
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1804 /* clear old sector */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1805 x = osx * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1806 y = osy * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1807 w = h = grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1808
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1809 W_DrawSectorHighlight(mapw, x, y, w, h, backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1810
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1811 osx = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1812 osy = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1813 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1814 /* draw our current sector */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1815 x = dx * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1816 w = h = grid;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1817 y = dy * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1818
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1819 W_DrawSectorHighlight(mapw, x, y, w, h, yColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1820 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1821 /* Erase ships */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1822 for (i = 0, j = &players[i]; i < nplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1823 lastUpdate[i]++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1824 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1825 Erase the guy if: redrawPlayer[i] is set and the mapmode setting
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1826 allows it.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1827 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1828 if (!redrawPlayer[i] || (mapmode == GMAP_INFREQUENT && lastUpdate[i] < 5))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1829 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1830 lastUpdate[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1831 /* Clear his old image... */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1832 if (mclearzone[2][i]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1833 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1834 if (!redrawall) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1835 W_ClearArea(mapw, mclearzone[0][i], mclearzone[1][i],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1836 mclearzone[2][i], mclearzone[3][i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1837 /* Redraw the hole just left next update */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1838 checkRedraw(mclearzone[4][i], mclearzone[5][i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1839 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1840 mclearzone[2][i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1841 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1842 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1843 /* Draw Planets */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1844 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1845 if(! (hockey && cleanHockeyGalactic)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1846 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1847 for (i = 0, l = &planets[i]; i < nplan; i++, l++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1848 char buf[4];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1849 int color;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1850 if (!(l->pl_flags & PLREDRAW) && (!redrawall))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1851 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1852 l->pl_flags &= ~PLREDRAW; /* Turn redraw flag off! */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1853
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1854 dx = (l->pl_x - offsetx) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1855 dy = (l->pl_y - offsety) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1856
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1857 if (PtOutsideWin(dx, dy))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1858 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1859
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1860 if (0 == strncmp(l->pl_name, "New ", 4)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1861 strncpy(buf, l->pl_name + 4, 3);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1862 } else if (0 == strncmp(l->pl_name, "Planet ", 7)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1863 strncpy(buf, l->pl_name + 7, 3);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1864 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1865 strncpy(buf, l->pl_name, 3);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1866
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1867 /* moving planets */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1868 if (pl_update[l->pl_no].plu_update == 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1869 odx = (pl_update[l->pl_no].plu_x - offsetx) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1870 ody = (pl_update[l->pl_no].plu_y - offsety) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1871
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1872 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1873 W_ClearArea(mapw, odx - (mplanet_width / 2), ody - (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1874 mplanet_width, mplanet_height);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1875
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1876 W_WriteText(mapw, odx - (mplanet_width / 2), ody + (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1877 backColor, buf, 3, planetFont(l));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1878
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1879 pl_update[l->pl_no].plu_update = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1880 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1881 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1882 /* not necessary, pl_update is now set whenever a planet needs to be
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1883 * erased. -JR
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1884 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1885 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1886
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1887 /* XFIX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1888 W_ClearArea(mapw, dx - (mplanet_width / 2), dy - (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1889 mplanet_width, mplanet_height);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1890 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1891 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1892 color = ((paradise) && (l->pl_flags & (PLSTAR | PLWHOLE))) ?
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1893 textColor : planetColor(l);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1894 #ifdef BEEPLITE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1895 if (UseLite && emph_planet_seq_n[l->pl_no] > 0 &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1896 (F_beeplite_flags & LITE_PLANETS)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1897 int seq_n = emph_planet_seq_n[l->pl_no] % emph_planet_seq_frames;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1898
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1899 if ((emph_planet_seq_n[l->pl_no] -= 1) > 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1900 W_OverlayBitmap(dx - (emph_planet_seq_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1901 dy - (emph_planet_seq_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1902 emph_planet_seq[seq_n],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1903 emph_planet_color[l->pl_no]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1904 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1905 W_ClearArea(mapw, dx - (emph_planet_seq_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1906 dy - (emph_planet_seq_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1907 emph_planet_seq_width, emph_planet_seq_height);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1908 W_WriteBitmap(dx - (mplanet_width / 2), dy - (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1909 planetmBitmap(l), color);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1910 l->pl_flags |= PLREDRAW; /* Leave redraw on until done
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1911 highlighting */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1912 pl_update[l->pl_no].plu_update = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1913 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1914 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1915 if (!(PL_TYPE(*l) == PLWHOLE)) { /* non wormholes */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1916 W_WriteBitmap(dx - (mplanet_width / 2), dy - (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1917 planetmBitmap(l), color);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1918 W_WriteText(mapw, dx - (mplanet_width / 2), dy + (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1919 color, buf, ((strlen(buf) >= 3) ? 3 : strlen(buf)),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1920 planetFont(l));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1921 #ifdef SHOW_IND
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1922 if (showIND && (l->pl_info & idx_to_mask(me->p_teami)) && (l->pl_owner == NOBODY) && l->pl_flags & PLPLANET)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1923 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1924 W_MakeLine (mapw, dx + (mplanet_width / 2 - 1), dy + (mplanet_height / 2 - 1),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1925 dx - (mplanet_width / 2), dy - (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1926 W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1927 W_MakeLine (mapw, dx - (mplanet_width / 2), dy + (mplanet_height / 2 - 1),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1928 dx + (mplanet_width / 2 - 1), dy - (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1929 W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1930 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1931 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1932 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1933 #ifdef VISIBLE_WORMHOLES
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1934 else { /* wormholes show when scouted [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1935 if(l->pl_info & idx_to_mask(me->p_teami)) { /* have info [BDyess]*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1936 printf("l->pl_info == %d\n",l->pl_info);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1937 W_WriteBitmap(dx - (mplanet_width / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1938 dy - (mplanet_height / 2),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1939 planetmBitmap(l),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1940 color);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1941 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1942 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1943 #endif /*VISIBLE_WORMHOLES*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1944 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1945 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1946 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1947 /* Draw ships */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1948 for (i = 0, j = &players[i]; i < nplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1949 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1950 We draw the guy if redrawall, or we just erased him. Also, we
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1951 redraw if we haven't drawn for 30 frames. (in case he was erased
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1952 by other ships).
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1953 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1954 if (lastUpdate[i] != 0 && (!redrawall) && lastUpdate[i] < 30)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1955 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1956 if (j->p_status != PALIVE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1957 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1958 lastUpdate[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1959 dx = (j->p_x - offsetx) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1960 dy = (j->p_y - offsety) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1961
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1962 if ((showLock & 1) && !(j->p_flags & PFCLOAK)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1963 if ((me->p_flags & PFPLOCK) && (me->p_playerl == j->p_no)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1964 if (lockLine) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1965 if ((last_lockx[0] != me_galx) || (last_locky[0] != me_galx) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1966 (last_lockx[1] != dx) || (last_locky[1] != dy)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1967 W_MakeTractLine(mapw, last_lockx[0], last_locky[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1968 last_lockx[1], last_locky[1], backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1969 last_lockx[0] = me_galx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1970 last_locky[0] = me_galy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1971 last_lockx[1] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1972 last_locky[1] = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1973 last_lockx[2] = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1974 W_MakeTractLine(mapw, last_lockx[0], last_locky[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1975 last_lockx[1], last_locky[1], W_Green);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1976
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1977 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1978 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1979 W_WriteTriangle(mapw, dx, dy + 6, 4, 1, foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1980 pl = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1981 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1982 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1983 if (PtOutsideWin(dx, dy))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1984 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1985
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1986 if (blk_friendlycloak == 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1987 if (j->p_flags & PFCLOAK) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1988 if (myPlayer(j))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1989 color = myColor;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1990 else if (friendlyPlayer(j))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1991 color = playerColor(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1992 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1993 color = unColor;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1994 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1995 color = playerColor(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1996
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1997 pl = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1998 if (j->p_flags & PFCLOAK)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1999 W_WriteText(mapw, dx - W_Textwidth * cloakcharslen / 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2000 dy - W_Textheight / 2, color, cloakchars, cloakcharslen,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2001 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2002 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2003 W_WriteText(mapw, dx - W_Textwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2004 dy - W_Textheight / 2, color, j->p_mapchars, 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2005 shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2006 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2007 if (j->p_flags & PFCLOAK) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2008 W_WriteText(mapw, dx - W_Textwidth * cloakcharslen / 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2009 dy - W_Textheight / 2, unColor, cloakchars, cloakcharslen,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2010 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2011 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2012 W_WriteText(mapw, dx - W_Textwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2013 dy - W_Textheight / 2, playerColor(j), j->p_mapchars, 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2014 shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2015 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2016 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2017
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2018 #ifdef BEEPLITE
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2019 if (UseLite && emph_player_seq_n[i] > 0 &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2020 (F_beeplite_flags & LITE_PLAYERS_MAP)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2021 int seq_n = emph_player_seq_n[i] % emph_player_seq_frames;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2022
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2023 W_WriteBitmap(dx - (emph_player_seq_width / 2 - 1),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2024 dy - (emph_player_seq_height / 2 + 1),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2025 emph_player_seq[seq_n],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2026 emph_player_color[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2027 emph_player_seq_n[i] -= 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2028 mclearzone[0][i] = dx - (emph_player_seq_width / 2 - 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2029 mclearzone[1][i] = dy - (emph_player_seq_height / 2 + 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2030 mclearzone[2][i] = emph_player_seq_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2031 mclearzone[3][i] = emph_player_seq_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2032 mclearzone[4][i] = j->p_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2033 mclearzone[5][i] = j->p_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2034 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2035 Force redraw for this guy no matter what. Even if stationary.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2036 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2037 lastUpdate[i] = 30;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2038 /* Leave redraw on until done highlighting */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2039 redrawPlayer[i] = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2040 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2041 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2042 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2043 if (j->p_flags & PFCLOAK) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2044 mclearzone[0][i] = dx - W_Textwidth * cloakcharslen / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2045 mclearzone[1][i] = dy - W_Textheight / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2046 mclearzone[2][i] = W_Textwidth * cloakcharslen;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2047 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2048 mclearzone[0][i] = dx - W_Textwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2049 mclearzone[1][i] = dy - W_Textheight / 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2050 mclearzone[2][i] = W_Textwidth * 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2051 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2052 if (pl)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2053 mclearzone[3][i] = W_Textheight + 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2054 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2055 mclearzone[3][i] = W_Textheight;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2056 /* Set these so we can checkRedraw() next time */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2057 mclearzone[4][i] = j->p_x;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2058 mclearzone[5][i] = j->p_y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2059 redrawPlayer[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2060 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2061 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2062 /* draw viewBox if wanted [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2063 #define VIEWDIST SCALE * WINSIDE * WINSIDE / (gwidth * 2)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2064 #define REDRAWDIST SCALE * WINSIDE / 2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2065 if (viewBox && allowViewBox) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2066 static int viewx = 0, viewy = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2067
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2068 dx = (me->p_x - offsetx) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2069 dy = (me->p_y - offsety) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2070 if (viewx != dx || viewy != dy || redrawall) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2071 /* clear old dots - placed here for less flicker */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2072 W_DrawPoint(mapw, viewx + VIEWDIST, viewy + VIEWDIST, backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2073 W_DrawPoint(mapw, viewx + VIEWDIST, viewy - VIEWDIST, backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2074 W_DrawPoint(mapw, viewx - VIEWDIST, viewy + VIEWDIST, backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2075 W_DrawPoint(mapw, viewx - VIEWDIST, viewy - VIEWDIST, backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2076 /* redraw any planets they overwrote */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2077 viewx *= gwidth / WINSIDE + offsetx; /* correct from view
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2078 scale */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2079 viewy *= gwidth / WINSIDE + offsety;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2080 checkRedraw(viewx + REDRAWDIST, viewy + REDRAWDIST);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2081 checkRedraw(viewx + REDRAWDIST, viewy - REDRAWDIST);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2082 checkRedraw(viewx - REDRAWDIST, viewy + REDRAWDIST);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2083 checkRedraw(viewx - REDRAWDIST, viewy - REDRAWDIST);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2084 /* draw the new points */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2085 W_DrawPoint(mapw, dx + VIEWDIST, dy + VIEWDIST, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2086 W_DrawPoint(mapw, dx + VIEWDIST, dy - VIEWDIST, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2087 W_DrawPoint(mapw, dx - VIEWDIST, dy + VIEWDIST, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2088 W_DrawPoint(mapw, dx - VIEWDIST, dy - VIEWDIST, W_White);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2089 viewx = dx; /* store the points for later */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2090 viewy = dy; /* clearing */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2091 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2092 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2093 #undef VIEWDIST
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2094 #undef REDRAWDIST
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2095
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2096 if (clearlmcount) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2097 W_WriteTriangle(mapw, clearlmark[0], clearlmark[1], 4, 0, backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2098 clearlmcount--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2099 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2100 if (showLock & 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2101 /* for now draw this everytime */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2102 if ((me->p_flags & PFPLLOCK) && (me->p_status != POBSERVE)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2103 struct planet *l = &planets[me->p_planet];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2104 dx = (l->pl_x - offsetx) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2105 dy = (l->pl_y - offsety) * WINSIDE / gwidth;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2106
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2107 if (lockLine) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2108 if ((last_lockx[0] != me_galx) || (last_locky[0] != me_galx) ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2109 (last_lockx[1] != dx) || (last_locky[1] != dy)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2110 W_MakeTractLine(mapw, last_lockx[0], last_locky[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2111 last_lockx[1], last_locky[1], backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2112 last_lockx[0] = me_galx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2113 last_locky[0] = me_galy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2114 last_lockx[1] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2115 last_locky[1] = dy;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2116 last_lockx[2] = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2117 W_MakeTractLine(mapw, last_lockx[0], last_locky[0],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2118 last_lockx[1], last_locky[1], W_Green);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2119 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2120 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2121 if (!PtOutsideWin(dx, dy)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2122 W_WriteTriangle(mapw, dx, dy - (mplanet_height) / 2 - 4, 4, 0,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2123 foreColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2124 clearlmark[0] = dx;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2125 clearlmark[1] = dy - (mplanet_height) / 2 - 4;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2126 clearlmcount++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2127 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2128 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2129 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2130 /* if lock line is drawn but no lock; erase lock line */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2131 if (lockLine && ((me->p_flags & (PFPLLOCK | PFPLOCK)) == 0) && last_lockx[2]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2132 W_MakeTractLine(mapw, last_lockx[0], last_locky[0], last_lockx[1],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2133 last_locky[1], backColor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2134 last_lockx[2] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2135 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2136 /* redraw warp beacon routes */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2137
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2138 for (i = 0; i < ngthingies; i += 2) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2139 struct thingy *k = &thingies[i + nplayers * npthingies];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2140 if (k[0].t_shape == SHP_WARP_BEACON &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2141 k[1].t_shape == SHP_WARP_BEACON) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2142 W_MakeLine(mapw, (k[0].t_x - offsetx) * WINSIDE / gwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2143 (k[0].t_y - offsety) * WINSIDE / gwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2144 (k[1].t_x - offsetx) * WINSIDE / gwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2145 (k[1].t_y - offsety) * WINSIDE / gwidth,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2146 W_Grey);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2147 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2148 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2149 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2150 redrawall = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2151 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2152
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2153 #define TWODIGIT_L(p, val) \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2154 { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2155 if ((val)<10) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2156 (p)[0] = (val)+'0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2157 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2158 } else { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2159 (p)[0] = (val)/10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2160 (p)[1] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2161 } \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2162 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2163
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2164 #define TWODIGIT_R(p, val) \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2165 { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2166 if ((val)<10) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2167 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2168 (p)[1] = (val)+'0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2169 } else { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2170 (p)[0] = (val)/10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2171 (p)[1] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2172 } \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2173 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2174
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2175 #define THREEDIGIT_C(p, val) \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2176 { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2177 if ((val)<10) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2178 (p)[0] = ' '; (p)[1] = (val)+'0'; (p)[2] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2179 } else if ((val)<100) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2180 (p)[0] = (val)/10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2181 (p)[1] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2182 (p)[2] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2183 } else { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2184 (p)[0] = (val)/100 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2185 (p)[1] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2186 (p)[2] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2187 } \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2188 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2189
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2190 #define THREEDIGIT_R(p, val) \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2191 { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2192 if ((val)<10) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2193 (p)[0] = ' '; (p)[1] = ' '; (p)[2] = (val)+'0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2194 } else if ((val)<100) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2195 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2196 (p)[1] = (val)/10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2197 (p)[2] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2198 } else { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2199 (p)[0] = (val)/100 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2200 (p)[1] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2201 (p)[2] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2202 } \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2203 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2204
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2205 #define FOURDIGIT_R(p, val) \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2206 { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2207 if ((val)<10) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2208 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2209 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2210 (p)[2] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2211 (p)[3] = (val)+'0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2212 } else if ((val)<100) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2213 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2214 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2215 (p)[2] = (val)/10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2216 (p)[3] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2217 } else if ((val)<1000) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2218 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2219 (p)[1] = (val)/100 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2220 (p)[2] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2221 (p)[3] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2222 } else { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2223 (p)[0] = (val)/1000 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2224 (p)[1] = ((val)/100 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2225 (p)[2] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2226 (p)[3] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2227 } \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2228 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2229
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2230 #define SIXDIGIT_R(p, val) \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2231 { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2232 if ((val)<10) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2233 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2234 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2235 (p)[2] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2236 (p)[3] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2237 (p)[4] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2238 (p)[5] = (val)+'0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2239 } else if ((val)<100) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2240 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2241 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2242 (p)[2] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2243 (p)[3] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2244 (p)[4] = (val)/10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2245 (p)[5] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2246 } else if ((val)<1000) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2247 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2248 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2249 (p)[2] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2250 (p)[3] = (val)/100 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2251 (p)[4] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2252 (p)[5] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2253 } else if ((val)<10000) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2254 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2255 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2256 (p)[2] = ((val)/1000 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2257 (p)[3] = ((val)/100 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2258 (p)[4] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2259 (p)[5] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2260 } else if ((val)<100000) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2261 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2262 (p)[1] = ((val)/10000 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2263 (p)[2] = ((val)/1000 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2264 (p)[3] = ((val)/100 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2265 (p)[4] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2266 (p)[5] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2267 } else { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2268 (p)[0] = (val)/100000 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2269 (p)[1] = ((val)/10000 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2270 (p)[2] = ((val)/1000 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2271 (p)[3] = ((val)/100 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2272 (p)[4] = ((val)/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2273 (p)[5] = (val)%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2274 } \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2275 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2276
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2277 #define SIXnTWOf_R(p, val) \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2278 { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2279 (p)[3] = '.'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2280 (p)[4] = ((int) (10*(val))) %10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2281 (p)[5] = ((int) (100*(val))) %10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2282 if ((val)<10) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2283 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2284 (p)[1] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2285 (p)[2] = ((int)(val))+'0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2286 } else if ((val)<100) { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2287 (p)[0] = ' '; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2288 (p)[1] = ((int)(val))/10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2289 (p)[2] = ((int)(val))%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2290 } else { \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2291 (p)[0] = ((int)(val))/100 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2292 (p)[1] = (((int)(val))/10 %10) + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2293 (p)[2] = ((int)(val))%10 + '0'; \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2294 } \
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2295 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2296
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2297 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2298
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2299 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2300 stline(flag)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2301 int flag;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2302 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2303 static char buf1[80];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2304 static char buf2[80];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2305 static char whichbuf = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2306 static int lastnewDashboard;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2307 register char *buf, *oldbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2308 register char *s;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2309 register int i, j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2310 int k;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2311 /* if you don't do something like this, then switching in the options menu
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2312 is 'entertaining' */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2313 if (newDashboard != lastnewDashboard) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2314 lastnewDashboard = newDashboard;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2315 redrawTstats();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2316 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2317 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2318 /* use the new dashboard if we can */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2319
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2320
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2321
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2322
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2323
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2324
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2325 if (newDashboard) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2326 db_redraw(flag);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2327 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2328 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2329 /* Instead of one sprintf, we do all this by hand for optimization */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2330
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2331 if (flag)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2332 whichbuf = 0; /* We must completely refresh */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2333
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2334 if (whichbuf != 2) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2335 buf = buf1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2336 oldbuf = buf2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2337 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2338 buf = buf2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2339 oldbuf = buf1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2340 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2341 buf[0] = (me->p_flags & PFSHIELD ? 'S' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2342 if (me->p_flags & PFGREEN)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2343 buf[1] = 'G';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2344 else if (me->p_flags & PFYELLOW)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2345 buf[1] = 'Y';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2346 else if (me->p_flags & PFRED)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2347 buf[1] = 'R';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2348 buf[2] = (me->p_flags & (PFPLLOCK | PFPLOCK) ? 'L' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2349 buf[3] = (me->p_flags & PFREPAIR ? 'R' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2350 buf[4] = (me->p_flags & PFBOMB ? 'B' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2351 buf[5] = (me->p_flags & PFORBIT ? 'O' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2352 buf[6] = (me->p_flags & PFDOCKOK ? 'D' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2353 /* buf[6] = (me->p_flags & PFDOCK ? 'D' : ' ');*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2354 buf[7] = (me->p_flags & PFCLOAK ? 'C' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2355 buf[8] = (me->p_flags & PFWEP ? 'W' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2356 buf[9] = (me->p_flags & PFENG ? 'E' : ' ');
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2357 if (me->p_flags & PFPRESS)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2358 buf[10] = 'P';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2359 else if (me->p_flags & PFTRACT)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2360 buf[10] = 'T';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2361 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2362 buf[10] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2363 if (me->p_flags & PFBEAMUP)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2364 buf[11] = 'u';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2365 else if (me->p_flags & PFBEAMDOWN)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2366 buf[11] = 'd';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2367 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2368 buf[11] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2369 if (!paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2370 buf[12] = (status->tourn) ? 't' : ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2371 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2372 buf[12] = (status2->tourn) ? 't' : ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2373
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2374 buf[13] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2375
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2376 #if 1
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2377 /* w/i indicator is a kludge - it just guesses based on the speed of
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2378 the ship */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2379 sprintf(buf + 14, "%2d%c %3d %3d %1d %6.2f %3d %6d %4d %4d ",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2380 me->p_speed, (me->p_speed > me->p_ship->s_maxspeed + 2) ? 'w' : 'i',
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2381 me->p_damage, me->p_shield, me->p_ntorp, me->p_kills,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2382 me->p_armies, me->p_fuel, me->p_wtemp, me->p_etemp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2383 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2384 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2385 TWODIGIT_L(&buf[14], me->p_speed);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2386 buf[16] = 'i';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2387 buf[17] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2388 buf[18] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2389 buf[19] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2390 THREEDIGIT_R(&buf[20], me->p_damage);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2391 buf[23] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2392 THREEDIGIT_R(&buf[24], me->p_shield);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2393 buf[27] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2394 TWODIGIT_R(&buf[28], me->p_ntorp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2395 buf[30] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2396 buf[31] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2397 SIXnTWOf_R(&buf[32], me->p_kills);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2398 buf[38] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2399 THREEDIGIT_C(&buf[39], me->p_armies);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2400 buf[42] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2401 SIXDIGIT_R(&buf[43], me->p_fuel);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2402 buf[49] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2403 buf[50] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2404 FOURDIGIT_R(&buf[51], me->p_wtemp / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2405 buf[55] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2406 FOURDIGIT_R(&buf[56], me->p_etemp / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2407 buf[60] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2408 buf[61] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2409 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2410 buf[14] = '0' + ((me->p_speed % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2411 if (buf[14] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2412 buf[14] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2413 buf[15] = '0' + (me->p_speed % 10); /* speed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2414 buf[16] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2415 buf[17] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2416 buf[18] = '0' + (me->p_damage / 100);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2417 if (buf[18] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2418 buf[18] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2419 buf[19] = '0' + ((me->p_damage % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2420 if ((buf[19] == '0') && (me->p_damage < 100))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2421 buf[19] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2422 buf[20] = '0' + (me->p_damage % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2423 buf[21] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2424 buf[22] = '0' + (me->p_shield / 100);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2425 if (buf[22] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2426 buf[22] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2427 buf[23] = '0' + ((me->p_shield % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2428 if ((buf[23] == '0') && (me->p_shield < 100))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2429 buf[23] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2430 buf[24] = '0' + (me->p_shield % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2431 buf[25] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2432 buf[26] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2433 buf[27] = '0' + ((me->p_ntorp % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2434 if (buf[27] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2435 buf[27] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2436 buf[28] = '0' + (me->p_ntorp % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2437 buf[29] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2438 buf[30] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2439 buf[31] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2440 buf[32] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2441 buf[33] = '0' + ((int) (me->p_kills / 10));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2442 if (buf[33] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2443 buf[33] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2444 buf[34] = '0' + (((int) me->p_kills) % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2445 buf[35] = '.';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2446 buf[36] = '0' + (((int) (me->p_kills * 10)) % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2447 buf[37] = '0' + (((int) (me->p_kills * 100)) % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2448 buf[38] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2449 buf[39] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2450 buf[40] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2451 buf[41] = '0' + ((me->p_armies % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2452 if (buf[41] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2453 buf[41] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2454 buf[42] = '0' + (me->p_armies % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2455 buf[43] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2456 buf[44] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2457 buf[45] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2458
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2459 buf[46] = '0' + (me->p_fuel / 100000);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2460 if (buf[46] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2461 buf[46] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2462 buf[47] = '0' + ((me->p_fuel % 100000) / 10000);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2463 if ((buf[47] == '0') && (me->p_fuel < 100000))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2464 buf[47] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2465 buf[48] = '0' + ((me->p_fuel % 10000) / 1000);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2466 if ((buf[48] == '0') && (me->p_fuel < 10000))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2467 buf[48] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2468 buf[49] = '0' + ((me->p_fuel % 1000) / 100);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2469 if ((buf[49] == '0') && (me->p_fuel < 1000))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2470 buf[49] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2471 buf[50] = '0' + ((me->p_fuel % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2472 if ((buf[50] == '0') && (me->p_fuel < 100))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2473 buf[50] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2474 buf[51] = '0' + (me->p_fuel % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2475 buf[52] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2476 buf[53] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2477 buf[54] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2478
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2479 buf[55] = '0' + ((me->p_wtemp / 10) / 100);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2480 if (buf[55] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2481 buf[55] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2482 buf[56] = '0' + (((me->p_wtemp / 10) % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2483 if ((buf[56] == '0') && (me->p_wtemp < 1000))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2484 buf[56] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2485 buf[57] = '0' + ((me->p_wtemp / 10) % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2486
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2487 buf[58] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2488 buf[59] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2489 buf[60] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2490 buf[61] = '0' + ((me->p_etemp / 10) / 1000);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2491 if (buf[61] == '0')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2492 buf[61] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2493 buf[62] = '0' + (((me->p_etemp / 10) % 1000) / 100);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2494 if (buf[62] == '0' && me->p_etemp < 1000)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2495 buf[62] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2496 buf[63] = '0' + (((me->p_etemp / 10) % 100) / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2497 if ((buf[63] == '0') && (me->p_etemp < 1000))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2498 buf[63] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2499 buf[64] = '0' + ((me->p_etemp / 10) % 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2500 buf[65] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2501 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2502 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2503
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2504 if (whichbuf == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2505 /* Draw status line */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2506 W_WriteText(tstatw, TSTATW_BASEX, 16, textColor, buf, 66, W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2507 whichbuf = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2508 } else { /* Hacks to make it print only what is
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2509 necessary */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2510 whichbuf = 3 - whichbuf;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2511 j = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2512 for (i = 0; i < 66; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2513 if (*(buf++) != *(oldbuf++)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2514 /* Different string */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2515 if (j == -1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2516 k = i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2517 s = buf - 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2518 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2519 j = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2520 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2521 /* Same string */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2522 if (j == -1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2523 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2524 j++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2525 if (j == 20) { /* Random number */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2526 W_WriteText(tstatw, TSTATW_BASEX + W_Textwidth * k, 16, textColor,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2527 s, i - k - 19, W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2528 j = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2529 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2530 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2531 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2532 if (j != -1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2533 W_WriteText(tstatw, TSTATW_BASEX + W_Textwidth * k, 16, textColor, s, i - k - j,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2534 W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2535 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2536 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2537 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2538
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2539 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2540 redrawTstats()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2541 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2542 char buf[100];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2543 W_ClearWindow(tstatw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2544 /* use new dashboard if possible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2545 if (newDashboard) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2546 db_redraw(1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2547 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2548 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2549 stline(1); /* This is for refresh. We redraw player
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2550 stats too */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2551 strcpy(buf, "Flags Speed Dam Shd Trp Kills Ams Fuel Wtmp Etmp Special" /* "Flags Warp
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2552 Dam Shd Torps Kills
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2553 Armies Fuel Wtemp
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2554 Etemp" */ );
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2555 W_WriteText(tstatw, TSTATW_BASEX, 5, textColor, buf, strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2556 sprintf(buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2557 "Maximum: %2d %3d %3d 8 %3d %6d %4d %4d ",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2558 me->p_ship->s_maxspeed, me->p_ship->s_maxdamage,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2559 me->p_ship->s_maxshield, me->p_ship->s_maxarmies,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2560 me->p_ship->s_maxfuel, me->p_ship->s_maxwpntemp / 10,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2561 me->p_ship->s_maxegntemp / 10);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2562 W_WriteText(tstatw, TSTATW_BASEX, 27, textColor, buf, strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2563 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2564 #endif