annotate playerlist.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1 /* $Id: playerlist.c,v 1.1.1.1 1997/12/06 05:41:30 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 * playerlist.c
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 * modified to sort by teams by Bill Dyess on 9/23/93
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 #include "copyright.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 #include <stdio.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 "proto.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15 #include "gameconf.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 #include "packets.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 /* Prototypes */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 static void dofulllist P((struct player * pptr, int vpos));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 /* static char *get_players_rank_name P((struct player *j));*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21 void getdesig P((struct player * j, char *desig));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 struct teamstruct {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 short teamnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 short totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 short outfitnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 short row;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 short outfitrow;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 };
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 int lastsortPlayers, lasthnk, lastspl, lastshowDead;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34 playerlist()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 char buf[100];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 if (slot == NULL) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40 if ((slot = (short *) malloc(sizeof(short) * 33)) == NULL) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41 perror("out of memory?!?\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 exit(-1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45 if (*playerList != 0 && *playerList != ',') { /* do the wide thing
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 wideplayerlist();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50 for (i = 0; i < 33; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51 slot[i] = -2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52 lastsortPlayers = sortPlayers;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 lasthnk = hideNoKills;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54 lastspl = showPreLogins;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 lastshowDead = showDead;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57 W_ClearWindow(playerw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59 (void) strcpy(buf, " Type Rank Name Kills Type Rank Name Kills");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60 W_WriteText(playerw, 0, 1, textColor, buf, strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 if (!paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 (void) strcpy(buf, " Type Rank Name Kills Win Loss Ratio Offense Defense DI");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 (void) strcpy(buf, " Type Rank Name Kills Win Loss Ratio Battle Strategy DI");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67 W_WriteText(playerw, 0, 20, textColor, buf, strlen(buf), W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69 for (i = 0; i < nplayers; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 updatePlayer[i] |= ALL_UPDATE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72 playerlist2();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 playerlist2()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 register int i, k, z;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 char buf[100];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 short extra = 0, outfitextra = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82 struct teamstruct teams[4];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83 struct teamstruct *quadrant[4], *tempquad; /* topleft, topright,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84 bottomleft, bottomright */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85 register struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 static short sequentialSort = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 char *rname;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88 char desig[3];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 short currentSlot;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90 static int usingWide = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 if (*playerList != 0 && *playerList != ',') { /* do the wide thing
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93 [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 if (slot == NULL) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 playerlist();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98 wideplayerlist2();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99 usingWide = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102 /* keeps the playerlist from being drawn when not allowed [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103 if (!allowPlayerlist)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 if (slot == NULL || lastsortPlayers != sortPlayers ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 lasthnk != hideNoKills ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 lastspl != showPreLogins ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109 lastshowDead != showDead ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110 usingWide) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 usingWide = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112 if(resizePlayerList)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 W_ResizeText(playerw,83,W_WindowHeight(playerw));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 playerlist();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 if (!W_IsMapped(playerw))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119 if (updatePlayer[me->p_no] & LARGE_UPDATE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120 dofulllist(me, 21);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121 if (blk_bozolist >= 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 if (updatePlayer[blk_bozolist] & LARGE_UPDATE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 dofulllist(&players[blk_bozolist], 22);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 if sortPlayers is on: the players team goes in the top left (top right
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 if robSort: on), the next-largest team in the top right, the third
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 largest in the bottom left, and everything else in the bottom right
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 if (sortPlayers) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 bzero(teams, sizeof(teams));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 for (i = 0; i < 4; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132 teams[i].teamnum = i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 /* figure out how many players on each team */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134 for (i = 0, j = &players[i]; i < nplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 if (j->p_status != PFREE && !(j->p_status == POUTFIT && j->p_teami < 0)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 if (j->p_teami < 0 || j->p_teami == number_of_teams) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137 if (!showDead)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 extra++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140 if (j->p_status == POUTFIT && sortOutfitting)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141 outfitextra++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142 } else if (j->p_teami == number_of_teams) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143 if (!showPreLogins)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145 extra++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 if (j->p_status == POUTFIT && sortOutfitting)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147 outfitextra++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 teams[j->p_teami].totalnum++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 if (j->p_status == POUTFIT && showDead && sortOutfitting)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 teams[j->p_teami].outfitnum++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 printf("player %d is on team %d with status %d\n",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 i,j->p_teami,j->p_status);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 for (i = 0; i < 4; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161 quadrant[i] = &teams[i];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162 if (me->p_teami >= 0 && me->p_teami < number_of_teams)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 teams[me->p_teami].totalnum += 10000;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 for (i = 3; i > 0; i--) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 for (k = 0; k < i; k++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166 if (quadrant[k]->totalnum < quadrant[k + 1]->totalnum) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 tempquad = quadrant[k];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 quadrant[k] = quadrant[k + 1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 quadrant[k + 1] = tempquad;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173 if (me->p_teami >= 0 && me->p_teami < number_of_teams) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 teams[me->p_teami].totalnum -= 10000;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 if (robsort) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 quadrant[0] = quadrant[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 quadrant[1] = &teams[me->p_teami];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 quadrant[3]->totalnum += extra;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 quadrant[3]->outfitnum += outfitextra;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 if (quadrant[0]->totalnum > 16 || quadrant[1]->totalnum > 16) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185 if one team is so huge as to not fit on just one side, then
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186 just list all the players sequentially, but still team sorted.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 For now, set a flag and clear any freshly empty space.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189 if (sequentialSort == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190 sequentialSort = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 playerlist();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 quadrant[0]->row = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195 quadrant[1]->row = quadrant[0]->totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 quadrant[2]->row = quadrant[1]->row + quadrant[1]->totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 quadrant[3]->row = quadrant[2]->row + quadrant[2]->totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198 /* wipe out the blank sections */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 for (i = quadrant[3]->row + quadrant[3]->totalnum; i < 32; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 if (slot[i] != -1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 if we get here, it's not possible to have players
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203 blank on the left side
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205 W_ClearArea(playerw, 44, i - 16 + 1, 41, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 slot[i] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 if (sequentialSort == 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 sequentialSort = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 playerlist();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 quadrant[0]->row = quadrant[1]->row = 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 if (quadrant[0]->totalnum + quadrant[2]->totalnum <= 16) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217 quadrant[2]->row = 18 - quadrant[2]->totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219 quadrant[2]->row = 2 + quadrant[0]->totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 quadrant[3]->totalnum += quadrant[0]->totalnum + quadrant[2]->totalnum - 16;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222 if (quadrant[1]->totalnum + quadrant[3]->totalnum <= 16) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 quadrant[3]->row = 18 - quadrant[3]->totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 quadrant[3]->row = 2 + quadrant[1]->totalnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 quadrant[2]->row -= quadrant[1]->totalnum + quadrant[3]->totalnum - 16;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 for (i = 0; i < 4; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230 quadrant[i]->outfitrow = quadrant[i]->row + quadrant[i]->totalnum -
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 quadrant[i]->outfitnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 /* wipe out the blank sections */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 for (i = 2 + quadrant[0]->totalnum; i < quadrant[2]->row; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234 if (slot[i - 2] != -1 || players[slot[i - 2]].p_status != POUTFIT) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235 W_ClearArea(playerw, 0, i, 41, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236 slot[i - 2] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 for (i = 2 + quadrant[1]->totalnum; i < quadrant[3]->row; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 if (slot[16 + i - 2] != -1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241 W_ClearArea(playerw, 44, i, 41, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242 slot[16 + i - 2] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247 /* update the display for each player */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 for (i = 0, j = &players[i]; i < nplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250 if (!updatePlayer[i] && !sortPlayers && slot[i] == j->p_no)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253 getdesig(j, desig);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 if (!desig[0]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255 if (!sortPlayers)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256 W_ClearArea(playerw, (i > 15) ? 44 : 0, (i > 15) ? i - 16 + 2 : i + 2, 41, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257 continue; /* don't display this guy, he's toast */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 rname = get_players_rank_name(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260 (void) sprintf(buf, "%c%c %2.2s %-9.9s %-15.15s",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 teaminfo[j->p_teami].letter,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262 shipnos[j->p_no],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 desig,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264 rname,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265 j->p_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 replace 0.00 kills with spaces if not alive and paradise or not
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 RSA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 /* this is optional with the hideNoKills option */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271 if ((j->p_kills <= 0 &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 (paradise || RSA_Client <= 0) && hideNoKills)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273 || (j->p_status & ~PALIVE))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274 strcat(buf, " ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276 sprintf(buf + strlen(buf), "%6.2f", j->p_kills);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277 if (!sortPlayers) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 #ifdef PLPROF
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279 printf("Updating player %d\n", j->p_no);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280 #endif /* PLPROF */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 W_WriteText(playerw, (i > 15) ? 44 : 0,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 (i > 15) ? i - 16 + 2 : i + 2, playerColor(j), buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 strlen(buf), shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 slot[i] = j->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285 } else if (!sequentialSort) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286 /* find out which quadrant he should be in */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 for (z = 0; j->p_teami != quadrant[z]->teamnum && z < 3; z++);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288 if (j->p_status == POUTFIT && sortOutfitting)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289 k = quadrant[z]->outfitrow++ - quadrant[z]->row;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291 k = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 if (quadrant[z]->row + k > 18) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 z += 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294 if (z > 3)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295 z -= 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297 currentSlot = (z % 2) * 16 + quadrant[z]->row - 2 + k;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 if (slot[currentSlot] != j->p_no || updatePlayer[j->p_no] & SMALL_UPDATE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299 slot[currentSlot] = j->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300 #ifdef PLPROF
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 printf("Updating %d, currentslot = %d, updatePlayer = %d\n",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 j->p_no, currentSlot, updatePlayer[j->p_no]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 #endif /* PLPROF */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 W_WriteText(playerw, 44 * (z % 2), k + quadrant[z]->row,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305 playerColor(j), buf, strlen(buf), shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307 if (!k)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 quadrant[z]->row++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309 } else { /* do sequential sort placement */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310 /* find out which quadrant he should be in */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311 for (z = 0; j->p_teami != quadrant[z]->teamnum && z < 3; z++);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312 currentSlot = quadrant[z]->row++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 if (slot[currentSlot] != j->p_no || updatePlayer[j->p_no] & SMALL_UPDATE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314 if (currentSlot >= 16) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 W_WriteText(playerw, 44, currentSlot - 16 + 2, playerColor(j),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 buf, strlen(buf), shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 W_WriteText(playerw, 0, currentSlot + 2, playerColor(j), buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319 strlen(buf), shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 if (slot[currentSlot] != j->p_no || updatePlayer[j->p_no] & SMALL_UPDATE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 slot[currentSlot] = j->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 #ifdef PLPROF
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 printf("Updating %d\n", j->p_no);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 #endif /* PLPROF */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330 W_WriteText(playerw, currentSlot >= 16 ? 44 : 0,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331 currentSlot >= 16 ? currentSlot + 2 - 16 : currentSlot + 2,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332 playerColor(j), buf, strlen(buf), shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 #endif /* 0 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
336 updatePlayer[j->p_no] = NO_UPDATE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
337 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
338 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
339
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
340 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
341 getdesig(j, desig)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
342 struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
343 char *desig;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
344 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
345 switch (j->p_status) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
346 case PALIVE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
347 strncpy(desig, j->p_ship->s_desig, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
348 j->p_ship->s_desig[2] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
349 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
350 case PTQUEUE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
351 strcpy(desig, "tq");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
352 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
353 case POUTFIT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
354 if ((j->p_teami < 0) || !showDead)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
355 desig[0] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
356 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
357 strcpy(desig, "--");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
358 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
359 case PEXPLODE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
360 case PDEAD:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
361 if (showDead)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
362 strcpy(desig, "**");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
363 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
364 desig[0] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
365 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
366 case POBSERVE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
367 strcpy(desig, "ob");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
368 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
369 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
370 desig[0] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
371 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
372 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
373 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
374 if (!*desig) j->p_teami = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
375 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
376 if (j->p_teami == number_of_teams && !showPreLogins)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
377 desig[0] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
378 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
379
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
380 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
381 dofulllist(pptr, vpos)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
382 struct player *pptr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
383 int vpos;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
384 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
385 char buf[100];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
386 char *rname;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
387 char desig[3];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
388 struct ratings r;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
389
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
390 if (!W_IsMapped(playerw))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
391 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
392
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
393 getdesig(pptr, desig);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
394 if (!desig[0]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
395 if (pptr->p_no == blk_bozolist)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
396 blk_bozolist = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
397 W_ClearArea(playerw, 0, vpos, 83, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
398 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
399 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
400 get_ratings(pptr, &r);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
401
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
402 rname = get_players_rank_name(pptr);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
403 if (!paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
404 sprintf(buf, "%c%c %2.2s %-9.9s %-16.16s%5.2f %5d %5d %6.2f %5.2f %5.2f %8.2f ",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
405 teaminfo[pptr->p_teami].letter,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
406 shipnos[pptr->p_no],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
407 desig /* pptr->p_ship->s_desig */ ,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
408 rname,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
409 pptr->p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
410 pptr->p_kills,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
411 r.r_kills,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
412 r.r_losses,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
413 r.r_ratio,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
414 r.r_offrat,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
415 r.r_defrat,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
416 r.r_di);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
417 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
418 sprintf(buf, "%c%c %2.2s %-9.9s %-16.16s%5.2f %5d %5d %6.2f %5.2f %5.2f %8.2f ",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
419 teaminfo[pptr->p_teami].letter,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
420 shipnos[pptr->p_no],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
421 desig /* pptr->p_ship->s_desig */ ,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
422 rname,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
423 pptr->p_name,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
424 pptr->p_kills,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
425 r.r_kills,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
426 r.r_losses,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
427 r.r_ratio,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
428 r.r_batrat,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
429 r.r_stratrat,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
430 r.r_di);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
431
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
432 #ifdef PLPROF
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
433 printf("Updating %d\n", pptr->p_no);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
434 #endif /* PLPROF */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
435 W_WriteText(playerw, 0, vpos, playerColor(pptr), buf, strlen(buf),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
436 shipFont(pptr));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
437 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
438
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
439 char *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
440 get_players_rank_name(j)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
441 struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
442 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
443 char *r;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
444 if (j->p_stats.st_rank < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
445 j->p_stats.st_rank = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
446 if (!paradise) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
447 r = ranks[j->p_stats.st_rank].name;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
448 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
449 if (j->p_stats2.st_royal == 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
450 r = ranks2[j->p_stats2.st_rank].name;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
451 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
452 r = royal[j->p_stats2.st_royal].name;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
453 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
454 return (r);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
455 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
456
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
457 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
458 playerwEvent(data)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
459 W_Event *data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
460 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
461 int key;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
462 struct obtype *target;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
463
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
464 key = doKeymap(data);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
465 if (key == -1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
466 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
467 switch (key) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
468 case 'l': /* lock on [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
469 target = gettarget(data->Window, data->x, data->y, TARG_PLAYER);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
470 sendPlaylockReq(target->o_num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
471 me->p_playerl = target->o_num;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
472 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
473 case 'i':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
474 case 'I':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
475 if (!infomapped)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
476 inform(data->Window, data->x, data->y, key);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
477 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
478 destroyInfo();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
479 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
480 case 'X':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
481 macroState = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
482 warning("Macro mode");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
483 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
484 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
485 warning("Invalid key");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
486 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
487 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
488
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
489 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
490 selectblkbozo(data)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
491 W_Event *data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
492 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
493 int width, slotnum;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
494
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
495 if (*playerList
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
496 && *playerList != ',')
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
497 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
498 width = W_WindowWidth(data->Window);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
499 if (data->key == W_RBUTTON || data->key == W_LBUTTON || data->key == W_MBUTTON)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
500 if (data->y > W_Textheight * 2 + 1 && data->y < W_Textheight * 19) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
501 W_TranslatePoints(data->Window, &data->x, &data->y);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
502 slotnum = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
503 if (data->x > width / 2)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
504 slotnum += 16;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
505 /* only look for players in the slotspace */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
506 if (data->y <= (16 + 1)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
507 slotnum += data->y - 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
508 if (slot[slotnum] != me->p_no)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
509 blk_bozolist = slot[slotnum];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
510 if (blk_bozolist >= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
511 updatePlayer[blk_bozolist] |= LARGE_UPDATE;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
512 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
513 blk_bozolist = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
514 W_ClearArea(playerw, 0, 22, 83, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
515 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
516 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
517 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
518 }