3
|
1 /* $Id: wide_plist.c,v 1.1.1.1 1997/12/06 05:41:31 darius Exp $ */
|
|
2
|
|
3
|
|
4 #ifdef WIDE_PLIST
|
|
5 #define PLIST1
|
|
6 #define PLIST2
|
|
7 #define PLIST
|
|
8 /*
|
|
9 * playerlist.c
|
|
10 *
|
|
11 * Fairly substantial re-write to do variable player lists: Sept 93 DRG
|
|
12 * Paradise shoehorning: 2/13/94 [BDyess]
|
|
13 */
|
|
14 #include "copyright.h"
|
|
15
|
|
16 #include <stdio.h>
|
|
17 #include "Wlib.h"
|
|
18 #include "defs.h"
|
|
19 #include "struct.h"
|
|
20 #include "data.h"
|
|
21 #include "gameconf.h"
|
|
22 #include "proto.h"
|
|
23
|
|
24 static char header[BUFSIZ];
|
|
25 int header_len=0;
|
|
26 char *old_playerList=NULL;
|
|
27 char **slottext=NULL; /* array of strings shown in each slot
|
|
28 [BDyess] */
|
|
29 W_Color *slotcolors=NULL; /* array of colors, one per slot [BDyess] */
|
|
30 int slottext_size=0; /* keep track of the size in case nplayers
|
|
31 changes */
|
|
32
|
|
33 /*===========================================================================*/
|
|
34
|
|
35 int
|
|
36 playerlistnum()
|
|
37 {
|
|
38 int num = 0;
|
|
39 char *ptr;
|
|
40 int i;
|
|
41
|
|
42 ptr = playerList;
|
|
43 header[0] = '\0';
|
|
44 while (ptr[0] != '\0' && ptr[0] != ',') {
|
|
45 switch (ptr[0]) {
|
|
46 case 'n': /* Ship Number */
|
|
47 strcat(header, " No");
|
|
48 num += 3;
|
|
49 break;
|
|
50 case 'T': /* Ship Type */
|
|
51 strcat(header, " Ty");
|
|
52 num += 3;
|
|
53 break;
|
|
54 case 'R': /* Rank */
|
|
55 strcat(header, " Rank ");
|
|
56 num += 11;
|
|
57 break;
|
|
58 case 'N': /* Name */
|
|
59 strcat(header, " Name ");
|
|
60 num += 17;
|
|
61 break;
|
|
62 case 'K': /* Kills */
|
|
63 strcat(header, " Kills");
|
|
64 num += 6;
|
|
65 break;
|
|
66 case 'l': /* Login Name */
|
|
67 strcat(header, " Login ");
|
|
68 num += 17;
|
|
69 break;
|
|
70 case 'O': /* Offense */
|
|
71 strcat(header, " Offse");
|
|
72 num += 6;
|
|
73 break;
|
|
74 case 'W': /* Wins */
|
|
75 strcat(header, " Wins");
|
|
76 num += 6;
|
|
77 break;
|
|
78 case 'D': /* Defense */
|
|
79 strcat(header, " Defse");
|
|
80 num += 6;
|
|
81 break;
|
|
82 case 'L': /* Losses */
|
|
83 strcat(header, " Loss");
|
|
84 num += 6;
|
|
85 break;
|
|
86 case 'S': /* Total Rating (stats) */
|
|
87 strcat(header, " Stats");
|
|
88 num += 6;
|
|
89 break;
|
|
90 case 'r': /* Ratio */
|
|
91 strcat(header, " Ratio");
|
|
92 num += 6;
|
|
93 break;
|
|
94 case 'd': /* Damage Inflicted (DI) */
|
|
95 strcat(header, " DI");
|
|
96 num += 8;
|
|
97 break;
|
|
98 case ' ': /* White Space */
|
|
99 strcat(header, " ");
|
|
100 num += 1;
|
|
101 break;
|
|
102 #ifdef PLIST1
|
|
103 case 'B': /* Bombing */
|
|
104 strcat(header, " Bmbng");
|
|
105 num += 6;
|
|
106 break;
|
|
107 case 'b': /* Armies Bombed */
|
|
108 strcat(header, " Bmbed");
|
|
109 num += 6;
|
|
110 break;
|
|
111 case 'P': /* Planets */
|
|
112 strcat(header, " Plnts");
|
|
113 num += 6;
|
|
114 break;
|
|
115 case 'p': /* Planets Taken */
|
|
116 strcat(header, " Plnts");
|
|
117 num += 6;
|
|
118 break;
|
|
119 case 'G': /* Doosh rating ('oGGing') [BDyess] */
|
|
120 strcat(header, " Dshng");
|
|
121 num += 6;
|
|
122 break;
|
|
123 case 'g': /* number of dooshes [BDyess] */
|
|
124 strcat(header, " Dshed");
|
|
125 num += 6;
|
|
126 break;
|
|
127 case 'F': /* Resource rating [BDyess] */
|
|
128 /* 'F' is from Farming...I'm out of good letters */
|
|
129 strcat(header, " Resrc");
|
|
130 num += 6;
|
|
131 break;
|
|
132 case 'f': /* number of Resources bombed [BDyess] */
|
|
133 strcat(header, " Rsrcs");
|
|
134 num += 6;
|
|
135 break;
|
|
136 case 'Z': /* SB rating [BDyess] */
|
|
137 /* 'Z' is the last letter - a SB is the team anchor. :) */
|
|
138 strcat(header, " SBrat");
|
|
139 num += 6;
|
|
140 break;
|
|
141 case 'z': /* WB rating (small SB) [BDyess] */
|
|
142 strcat(header, " WBrat");
|
|
143 num += 6;
|
|
144 break;
|
|
145 case 'J': /* JS rating - good letter [BDyess] */
|
|
146 strcat(header, " JSrat");
|
|
147 num += 6;
|
|
148 break;
|
|
149 case 'j': /* JS planets [BDyess] */
|
|
150 strcat(header, " JSpls");
|
|
151 num += 6;
|
|
152 break;
|
|
153 case 'C': /* SpeCial ships rating [BDyess] */
|
|
154 strcat(header, " Specl");
|
|
155 num += 6;
|
|
156 break;
|
|
157 case 'E': /* genocides (Endings) [BDyess] */
|
|
158 strcat(header, " Genos");
|
|
159 num += 6;
|
|
160 break;
|
|
161 case 'M': /* Display, Host Machine */
|
|
162 strcat(header, " Host Machine ");
|
|
163 num += 17;
|
|
164 break;
|
|
165 case 'H': /* Hours Played */
|
|
166 strcat(header, " Hours");
|
|
167 num += 7;
|
|
168 break;
|
|
169 case 'k': /* Max Kills */
|
|
170 strcat(header, " Max K");
|
|
171 num += 6;
|
|
172 break;
|
|
173 case 'V': /* Kills per hour */
|
|
174 strcat(header, " KPH");
|
|
175 num += 6;
|
|
176 break;
|
|
177 case 'v': /* Deaths per hour */
|
|
178 strcat(header, " DPH");
|
|
179 num += 6;
|
|
180 break;
|
|
181 #endif
|
|
182 #ifdef PLIST2
|
|
183 case 'w': /* War staus */
|
|
184 strcat(header, " War Stat");
|
|
185 num += 9;
|
|
186 break;
|
|
187 case 's': /* Speed */
|
|
188 strcat(header, " Sp");
|
|
189 num += 3;
|
|
190 break;
|
|
191 #endif
|
|
192 default:
|
|
193 fprintf(stderr, "%c is not an option for the playerlist\n", ptr[0]);
|
|
194 break;
|
|
195 }
|
|
196 ptr++;
|
|
197 }
|
|
198
|
|
199 old_playerList = playerList;
|
|
200 header_len = num;
|
|
201 return (num);
|
|
202 }
|
|
203
|
|
204 /*===========================================================================*/
|
|
205
|
|
206 void
|
|
207 wideplayerlist()
|
|
208 {
|
|
209 int i;
|
|
210 int old_len=header_len;
|
|
211 if (old_playerList != playerList) {
|
|
212 playerlistnum();
|
|
213 if(resizePlayerList)
|
|
214 W_ResizeText(playerw,header_len,W_WindowHeight(playerw));
|
|
215 /* init slottext [BDyess] */
|
|
216 }
|
|
217 for (i = 0; i < nplayers; i++)
|
|
218 slot[i] = -1;
|
|
219
|
|
220 W_ClearWindow(playerw);
|
|
221
|
|
222 if (slottext && ((old_len != header_len) || (slottext_size != nplayers))) {
|
|
223 /* free the old one */
|
|
224 for (i = 0; i < slottext_size; i++) {
|
|
225 free(slottext[i]);
|
|
226 }
|
|
227 free(slottext);
|
|
228 free(slotcolors);
|
|
229 slottext=0;
|
|
230 }
|
|
231 if(!slottext) {
|
|
232 slottext_size = nplayers;
|
|
233 slottext = (char **) malloc(sizeof(char *) * nplayers);
|
|
234 slotcolors = (W_Color *) malloc(sizeof(W_Color) * nplayers);
|
|
235 for (i = 0; i < nplayers; i++) {
|
|
236 /* malloc extra room in case a line runs off the end */
|
|
237 slottext[i] = (char *) malloc(sizeof(char) * header_len + 30);
|
|
238 slottext[i][0] = 0;
|
|
239 slotcolors[i] = -1;
|
|
240 }
|
|
241 }
|
|
242 W_WriteText(playerw, 0, 1, textColor, header, header_len, W_RegularFont);
|
|
243
|
|
244 for (i = 0; i < nplayers; i++) {
|
|
245 updatePlayer[i] = 1;
|
|
246 }
|
|
247
|
|
248 wideplayerlist2();
|
|
249 }
|
|
250
|
|
251 /*===========================================================================*/
|
|
252
|
|
253 void
|
|
254 writeDiffText(window, x, y, color, orig, new, font)
|
|
255 W_Window window;
|
|
256 int x, y;
|
|
257 W_Color color;
|
|
258 char *orig, *new;
|
|
259 W_Font font;
|
|
260 {
|
|
261 /* little routine to print just the chars that are different between orig and
|
|
262 new. [BDyess] */
|
|
263 int i;
|
|
264 char *start;
|
|
265
|
|
266 for (start = new, i = 0; new[i] && orig[i]; i++) {
|
|
267 if (orig[i] != new[i])
|
|
268 continue;
|
|
269 if (start == new + i) {
|
|
270 start++;
|
|
271 continue;
|
|
272 } else {
|
|
273 W_WriteText(window, x + start - new, y, color, start, new + i - start, font);
|
|
274 start = new + i + 1;
|
|
275 }
|
|
276 }
|
|
277 if (start != new + i) {
|
|
278 /* finish up any remaining digits */
|
|
279 W_WriteText(window, x + start - new, y, color, start, new + i - start, font);
|
|
280 }
|
|
281 if (new[i]) {
|
|
282 /* write any text that extends past the old one */
|
|
283 W_WriteText(window, x + i, y, color, new + i, strlen(new + i), font);
|
|
284 } else if (orig[i]) {
|
|
285 /* print spaces to clear to EOL */
|
|
286 char *freeme;
|
|
287 int len;
|
|
288
|
|
289 len = strlen(orig + i);
|
|
290 freeme = (char *) malloc(len);
|
|
291 memset(freeme, ' ', len);
|
|
292 W_WriteText(window, x + i, y, color, freeme, len, font);
|
|
293 }
|
|
294 }
|
|
295
|
|
296 /*===========================================================================*/
|
|
297
|
|
298 void
|
|
299 plist_line(j, pos)
|
|
300 struct player *j;
|
|
301 int pos;
|
|
302 {
|
|
303 char buf[BUFSIZ];
|
|
304 char *ptr;
|
|
305 char tmp[30];
|
|
306 int my_ticks;
|
|
307 struct ratings r;
|
|
308 W_Color color;
|
|
309
|
|
310 get_ratings(j, &r);
|
|
311
|
|
312 if (pos < 2) {
|
|
313 printf("bad line position in playerlist\n");
|
|
314 pos = 2;
|
|
315 }
|
|
316 if (paradise)
|
|
317 my_ticks = j->p_stats2.st_tticks;
|
|
318 else
|
|
319 my_ticks = j->p_stats.st_tticks;
|
|
320
|
|
321 ptr = playerList;
|
|
322 buf[0] = '\0';
|
|
323 while (ptr[0] != '\0' && ptr[0] != ',') {
|
|
324 tmp[0] = '\0';
|
|
325 switch (ptr[0]) {
|
|
326 case 'n': /* Ship Number */
|
|
327 tmp[0] = ' ';
|
|
328 if (j->p_status != PALIVE) {
|
|
329 tmp[1] = ' ';
|
|
330 } else {
|
|
331 tmp[1] = teaminfo[j->p_teami].letter;
|
|
332 }
|
|
333 tmp[2] = shipnos[j->p_no];
|
|
334 tmp[3] = '\0';
|
|
335 strcat(buf, tmp);
|
|
336 break;
|
|
337 case 'T': /* Ship Type */
|
|
338 tmp[0] = ' ';
|
|
339 switch (j->p_status) {
|
|
340 case PALIVE:
|
|
341 tmp[1] = j->p_ship->s_desig[0];
|
|
342 tmp[2] = j->p_ship->s_desig[1];
|
|
343 break;
|
|
344 case PTQUEUE:
|
|
345 tmp[1] = 't';
|
|
346 tmp[2] = 'q';
|
|
347 break;
|
|
348 case POUTFIT:
|
|
349 tmp[1] = '-';
|
|
350 tmp[2] = '-';
|
|
351 break;
|
|
352 case PEXPLODE:
|
|
353 case PDEAD:
|
|
354 tmp[1] = '*';
|
|
355 tmp[2] = '*';
|
|
356 break;
|
|
357 case POBSERVE:
|
|
358 tmp[1] = 'o';
|
|
359 tmp[2] = 'b';
|
|
360 break;
|
|
361 default:
|
|
362 tmp[1] = ' ';
|
|
363 tmp[2] = ' ';
|
|
364 }
|
|
365 tmp[3] = '\0';
|
|
366 strcat(buf, tmp);
|
|
367 break;
|
|
368 case 'R': /* Rank */
|
|
369 tmp[0] = ' ';
|
|
370 sprintf(tmp + 1, "%-10.10s", get_players_rank_name(j));
|
|
371 strcat(buf, tmp);
|
|
372 break;
|
|
373 case 'N': /* Name */
|
|
374 tmp[0] = ' ';
|
|
375 sprintf(tmp + 1, "%-16.16s", j->p_name);
|
|
376 strcat(buf, tmp);
|
|
377 break;
|
|
378 case 'K': /* Kills */
|
|
379 tmp[0] = ' ';
|
|
380 if ((j->p_kills <= 0 &&
|
|
381 (paradise || RSA_Client <= 0) && hideNoKills)
|
|
382 || (j->p_status & ~PALIVE))
|
|
383 strcpy(tmp + 1, " ");
|
|
384 else
|
|
385 sprintf(tmp + 1, "%5.2f", j->p_kills);
|
|
386 strcat(buf, tmp);
|
|
387 break;
|
|
388 case 'l': /* Login Name */
|
|
389 tmp[0] = ' ';
|
|
390 sprintf(tmp + 1, "%-16.16s", j->p_login);
|
|
391 strcat(buf, tmp);
|
|
392 break;
|
|
393 case 'O': /* Offense */
|
|
394 tmp[0] = ' ';
|
|
395 sprintf(tmp + 1, "%5.2f", r.r_offrat);
|
|
396 strcat(buf, tmp);
|
|
397 break;
|
|
398 case 'W': /* Wins */
|
|
399 tmp[0] = ' ';
|
|
400 sprintf(tmp + 1, "%5d", r.r_kills);
|
|
401 strcat(buf, tmp);
|
|
402 break;
|
|
403 case 'D': /* Defense */
|
|
404 tmp[0] = ' ';
|
|
405 sprintf(tmp + 1, "%5.2f", r.r_defrat);
|
|
406 strcat(buf, tmp);
|
|
407 break;
|
|
408 case 'L': /* Losses */
|
|
409 tmp[0] = ' ';
|
|
410 sprintf(tmp + 1, "%5d", r.r_losses);
|
|
411 strcat(buf, tmp);
|
|
412 break;
|
|
413 case 'S': /* Total Rating (stats) */
|
|
414 tmp[0] = ' ';
|
|
415 sprintf(tmp + 1, "%5.2f", r.r_ratings);
|
|
416 strcat(buf, tmp);
|
|
417 break;
|
|
418 case 'r': /* Ratio */
|
|
419 tmp[0] = ' ';
|
|
420 sprintf(tmp + 1, "%5.2f", r.r_ratio);
|
|
421 strcat(buf, tmp);
|
|
422 break;
|
|
423 case 'd': /* Damage Inflicted (DI) */
|
|
424 tmp[0] = ' ';
|
|
425 /*
|
|
426 ftoa (Ratings * (j->p_stats.st_tticks / 36000.0), tmp+1, 0, 4,
|
|
427 2);
|
|
428 */
|
|
429 sprintf(tmp + 1, "%7.2f", r.r_di);
|
|
430 strcat(buf, tmp);
|
|
431 break;
|
|
432 case ' ': /* White Space */
|
|
433 strcat(buf, " ");
|
|
434 break;
|
|
435 #ifdef PLIST1
|
|
436 case 'B': /* Bombing */
|
|
437 tmp[0] = ' ';
|
|
438 sprintf(tmp + 1, "%5.2f", r.r_bombrat);
|
|
439 strcat(buf, tmp);
|
|
440 break;
|
|
441 case 'b': /* Armies Bombed */
|
|
442 tmp[0] = ' ';
|
|
443 sprintf(tmp + 1, "%5d", r.r_armies);
|
|
444 strcat(buf, tmp);
|
|
445 break;
|
|
446 case 'P': /* Planets */
|
|
447 tmp[0] = ' ';
|
|
448 sprintf(tmp + 1, "%5.2f", r.r_planetrat);
|
|
449 strcat(buf, tmp);
|
|
450 break;
|
|
451 case 'p': /* Planets Taken */
|
|
452 tmp[0] = ' ';
|
|
453 sprintf(tmp + 1, "%5d", r.r_planets);
|
|
454 strcat(buf, tmp);
|
|
455 break;
|
|
456 case 'G': /* Doosh rating ('oGGing') [BDyess] */
|
|
457 *tmp = ' ';
|
|
458 sprintf(tmp + 1, "%5.2f", r.r_dooshrat);
|
|
459 strcat(buf, tmp);
|
|
460 break;
|
|
461 case 'g': /* Dooshes [BDyess] */
|
|
462 *tmp = ' ';
|
|
463 sprintf(tmp + 1, "%5d", r.r_dooshes);
|
|
464 strcat(buf, tmp);
|
|
465 break;
|
|
466 case 'F': /* Resource rating [BDyess] */
|
|
467 /* 'F' is from Farming...I'm out of good letters */
|
|
468 *tmp = ' ';
|
|
469 sprintf(tmp + 1, "%5.2f", r.r_resrat);
|
|
470 strcat(buf, tmp);
|
|
471 break;
|
|
472 case 'f': /* number of Resources bombed [BDyess] */
|
|
473 *tmp = ' ';
|
|
474 sprintf(tmp + 1, "%5d", r.r_resources);
|
|
475 strcat(buf, tmp);
|
|
476 break;
|
|
477 case 'Z': /* SB rating [BDyess] */
|
|
478 /* 'Z' is the last letter - a SB is the team anchor. :) */
|
|
479 *tmp = ' ';
|
|
480 sprintf(tmp + 1, "%5.2f", r.r_sbrat);
|
|
481 strcat(buf, tmp);
|
|
482 break;
|
|
483 case 'z': /* WB rating (small SB) [BDyess] */
|
|
484 *tmp = ' ';
|
|
485 sprintf(tmp + 1, "%5.2f", r.r_wbrat);
|
|
486 strcat(buf, tmp);
|
|
487 break;
|
|
488 case 'J': /* JS rating - good letter [BDyess] */
|
|
489 *tmp = ' ';
|
|
490 sprintf(tmp + 1, "%5.2f", r.r_jsrat);
|
|
491 strcat(buf, tmp);
|
|
492 break;
|
|
493 case 'j': /* JS planets [BDyess] */
|
|
494 *tmp = ' ';
|
|
495 sprintf(tmp + 1, "%5d", r.r_jsplanets);
|
|
496 strcat(buf, tmp);
|
|
497 break;
|
|
498 case 'C': /* SpeCial ships rating [BDyess] */
|
|
499 *tmp = ' ';
|
|
500 sprintf(tmp + 1, "%5.2f", r.r_specrat);
|
|
501 strcat(buf, tmp);
|
|
502 break;
|
|
503 case 'E': /* genocides (Endings) [BDyess] */
|
|
504 *tmp = ' ';
|
|
505 sprintf(tmp + 1, "%5d", r.r_genocides);
|
|
506 strcat(buf, tmp);
|
|
507 break;
|
|
508 case 'M': /* Display, Host Machine */
|
|
509 tmp[0] = ' ';
|
|
510 sprintf(tmp + 1, "%-16.16s", j->p_monitor);
|
|
511 strcat(buf, tmp);
|
|
512 break;
|
|
513 case 'H': /* Hours Played */
|
|
514 tmp[0] = ' ';
|
|
515 sprintf(tmp + 1, "%6.2f", my_ticks / 36000.0);
|
|
516 strcat(buf, tmp);
|
|
517 break;
|
|
518 case 'k': /* Max Kills */
|
|
519 tmp[0] = ' ';
|
|
520 sprintf(tmp + 1, "%5.2f", r.r_maxkills);
|
|
521 strcat(buf, tmp);
|
|
522 break;
|
|
523 case 'V': /* Kills Per Hour */
|
|
524 tmp[0] = ' ';
|
|
525 sprintf(tmp + 1, "%5.1f", r.r_killsPerHour);
|
|
526 strcat(buf, tmp);
|
|
527 break;
|
|
528 case 'v': /* Deaths Per Hour */
|
|
529 tmp[0] = ' ';
|
|
530 sprintf(tmp + 1, "%5.1f", r.r_lossesPerHour);
|
|
531 strcat(buf, tmp);
|
|
532 break;
|
|
533 case 'w': /* War staus */
|
|
534 if (j->p_swar & idx_to_mask(me->p_teami))
|
|
535 strcat(buf, " WAR ");
|
|
536 else if (j->p_hostile & idx_to_mask(me->p_teami))
|
|
537 strcat(buf, " HOSTILE ");
|
|
538 else
|
|
539 strcat(buf, " PEACEFUL");
|
|
540 break;
|
|
541 #endif
|
|
542 #ifdef PLIST2
|
|
543 case 's': /* Speed */
|
|
544 tmp[0] = ' ';
|
|
545 sprintf(tmp + 1, "%2d", j->p_speed);
|
|
546 strcat(buf, tmp);
|
|
547 break;
|
|
548 #endif
|
|
549 default:
|
|
550 break;
|
|
551 }
|
|
552 ptr++;
|
|
553 }
|
|
554
|
|
555 color = playerColor(j);
|
|
556 if (slot[pos - 2] == j->p_no && slotcolors[pos - 2] == color) {
|
|
557 /* write the line, skipping chars that haven't changed [BDyess] */
|
|
558 writeDiffText(playerw, 0, pos, color, slottext[pos - 2], buf,
|
|
559 shipFont(j));
|
|
560 } else {
|
|
561 W_WriteText(playerw, 0, pos, color, buf, strlen(buf),
|
|
562 shipFont(j));
|
|
563 }
|
|
564 strcpy(slottext[pos - 2], buf);
|
|
565 slotcolors[pos - 2] = color;
|
|
566 slot[pos - 2] = j->p_no;
|
|
567 }
|
|
568
|
|
569 /*===========================================================================*/
|
|
570
|
|
571 void
|
|
572 Sorted_playerlist2()
|
|
573 {
|
|
574 register int i, h, pos = 1, last, boolflag = 0;
|
|
575 register struct player *j;
|
|
576 static int num;
|
|
577 int numplayers;
|
|
578
|
|
579 /* 20, not 16, is the max for non-paradise! Mostly the extra 4 are */
|
|
580 /* robots, but might as well show them and be safe... -JR*/
|
|
581 numplayers = (paradise) ? nplayers : 20;
|
|
582
|
|
583 /*
|
|
584 if (++num % 21 == 0) { boolflag = 1; num = 0; }
|
|
585 */
|
|
586 /* go through the teams in order */
|
|
587 for (h = 0; h < number_of_teams; h++) {
|
|
588 /* skip my team, I'll come back to it later */
|
|
589 if (me->p_teami == h)
|
|
590 continue;
|
|
591
|
|
592 /* go through all the players looking for those on team h */
|
|
593 for (i = 0, j = &players[0]; i < numplayers; i++, j++) {
|
|
594 if (j->p_teami != h)
|
|
595 continue;
|
|
596
|
|
597 if (j->p_status == PFREE)
|
|
598 continue;
|
|
599
|
|
600 if(j->p_status == POUTFIT && !showDead) /* already know team */
|
|
601 /* is valid.. */
|
|
602 continue;
|
|
603
|
|
604 pos++; /* put this AFTER checking for free slots to
|
|
605 get a */
|
|
606 /* nice compact list... */
|
|
607
|
|
608 if (!updatePlayer[i] && slot[pos - 2] == i)
|
|
609 continue;
|
|
610
|
|
611 updatePlayer[i] = 0;
|
|
612 plist_line(j, pos);
|
|
613 }
|
|
614 }
|
|
615
|
|
616 /* now go through and do my team. Note: ind players haven't been done */
|
|
617 if (me->p_teami >= 0 && me->p_teami < number_of_teams) {
|
|
618 for (i = 0, j = &players[i]; i < numplayers; i++, j++) {
|
|
619 if (j->p_teami != me->p_teami)
|
|
620 continue;
|
|
621
|
|
622 if (j->p_status == PFREE)
|
|
623 continue;
|
|
624
|
|
625 if(j->p_status == POUTFIT && !showDead) /* already know team */
|
|
626 /* is valid.. */
|
|
627 continue;
|
|
628
|
|
629 pos++;
|
|
630 if (!updatePlayer[i] && slot[pos - 2] == i)
|
|
631 continue;
|
|
632
|
|
633 updatePlayer[i] = 0;
|
|
634 plist_line(j, pos);
|
|
635 }
|
|
636 }
|
|
637 #if 0 /* this code displays the ind players from
|
|
638 the bottom up. */
|
|
639 /* not everyone has a 32 line playerlist, so this tends to */
|
|
640 /* make iggy invisible */
|
|
641 last = numplayers + 2;
|
|
642
|
|
643 for (i = numplayers - 1, j = &players[i]; i >= 0; i--, j--) {
|
|
644 if (j->p_teami >=0 && j->p_teami<number_of_teams)
|
|
645 continue;
|
|
646
|
|
647 if (j->p_status == PFREE)
|
|
648 continue;
|
|
649
|
|
650 last--;
|
|
651
|
|
652 if (!updatePlayer[i] && (!boolflag))
|
|
653 continue;
|
|
654
|
|
655 updatePlayer[i] = 0;
|
|
656 plist_line(j, last);
|
|
657 }
|
|
658 #endif /* 0 */
|
|
659
|
|
660 for (i = 0, j = &players[0]; i < numplayers; i++, j++) {
|
|
661 if (j->p_teami >= 0 && j->p_teami < number_of_teams)
|
|
662 continue;
|
|
663
|
|
664 if (j->p_status == PFREE)
|
|
665 continue;
|
|
666
|
|
667 pos++;
|
|
668
|
|
669 if (!updatePlayer[i] && slot[pos - 2] == i)
|
|
670 continue;
|
|
671
|
|
672 updatePlayer[i] = 0;
|
|
673 plist_line(j, pos);
|
|
674 }
|
|
675 /* now continue clearing lines until we get to an empty one */
|
|
676 pos++;
|
|
677 while ((pos - 2) < numplayers && slot[pos - 2] != -1 && slottext[pos - 2][0]) {
|
|
678 W_ClearArea(playerw, 0, pos, header_len, 1);
|
|
679 slot[pos - 2] = -1;
|
|
680 slottext[pos - 2][0] = 0;
|
|
681 pos++;
|
|
682 }
|
|
683
|
|
684 #if 0
|
|
685 if (boolflag && (last > (pos + 1))) {
|
|
686 W_ClearArea(playerw, 0, pos + 1, header_len, last - (pos + 1));
|
|
687 slot[pos - 2] = -1;
|
|
688 }
|
|
689 #endif /* 0 */
|
|
690 }
|
|
691
|
|
692 /*===========================================================================*/
|
|
693
|
|
694 void
|
|
695 wideplayerlist2()
|
|
696 {
|
|
697 register int i;
|
|
698 register struct player *j;
|
|
699 int numplayers;
|
|
700
|
|
701 /* 20, not 16, is the max for non-paradise! Mostly the extra 4 are */
|
|
702 /* robots, but might as well show them and be safe... -JR */
|
|
703 numplayers = (paradise) ? nplayers : 20;
|
|
704
|
|
705 if (old_playerList != playerList) {
|
|
706 wideplayerlist(); /* refresh if playerList changed */
|
|
707 return;
|
|
708 }
|
|
709 if (!W_IsMapped(playerw))
|
|
710 return;
|
|
711
|
|
712 if (sortPlayers) {
|
|
713 Sorted_playerlist2();
|
|
714 return;
|
|
715 }
|
|
716 for (i = 0, j = &players[i]; i < numplayers; i++, j++) {
|
|
717 if (!updatePlayer[i])
|
|
718 continue;
|
|
719
|
|
720 updatePlayer[i] = 0;
|
|
721
|
|
722 if (j->p_status == PFREE) {
|
|
723 W_ClearArea(playerw, 0, i + 2, header_len, 1);
|
|
724 continue;
|
|
725 }
|
|
726 plist_line(j, i + 2);
|
|
727 }
|
|
728 }
|
|
729
|
|
730 #endif /* WIDE_PLIST */
|