| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
Copyright (C) 1999-2005 Id Software, Inc. |
| 4 |
|
| 5 |
This file is part of Quake III Arena source code. |
| 6 |
|
| 7 |
Quake III Arena source code is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of the GNU General Public License as |
| 9 |
published by the Free Software Foundation; either version 2 of the License, |
| 10 |
or (at your option) any later version. |
| 11 |
|
| 12 |
Quake III Arena source code is distributed in the hope that it will be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Quake III Arena source code; if not, write to the Free Software |
| 19 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
=========================================================================== |
| 21 |
*/ |
| 22 |
// |
| 23 |
/* |
| 24 |
======================================================================= |
| 25 |
|
| 26 |
TEAM ORDERS MENU |
| 27 |
|
| 28 |
======================================================================= |
| 29 |
*/ |
| 30 |
|
| 31 |
|
| 32 |
#include "ui_local.h" |
| 33 |
|
| 34 |
|
| 35 |
#define ART_FRAME "menu/art_blueish/addbotframe" |
| 36 |
#define ART_BACK0 "menu/art_blueish/back_0" |
| 37 |
#define ART_BACK1 "menu/art_blueish/back_1" |
| 38 |
|
| 39 |
#define ID_LIST_BOTS 10 |
| 40 |
#define ID_LIST_CTF_ORDERS 11 |
| 41 |
#define ID_LIST_CTF1F_ORDERS 12 |
| 42 |
#define ID_LIST_BASE_ORDERS 13 |
| 43 |
#define ID_LIST_TEAM_ORDERS 14 |
| 44 |
#define ID_LIST_DD_ORDERS 15 |
| 45 |
|
| 46 |
|
| 47 |
typedef struct { |
| 48 |
menuframework_s menu; |
| 49 |
|
| 50 |
menutext_s banner; |
| 51 |
menubitmap_s frame; |
| 52 |
|
| 53 |
menulist_s list; |
| 54 |
|
| 55 |
menubitmap_s back; |
| 56 |
|
| 57 |
int gametype; |
| 58 |
int numBots; |
| 59 |
int selectedBot; |
| 60 |
char *bots[9]; |
| 61 |
char botNames[9][16]; |
| 62 |
} teamOrdersMenuInfo_t; |
| 63 |
|
| 64 |
static teamOrdersMenuInfo_t teamOrdersMenuInfo; |
| 65 |
|
| 66 |
#define NUM_CTF_ORDERS 7 |
| 67 |
static const char *ctfOrders[] = { |
| 68 |
"I Am the Leader", |
| 69 |
"Defend the Base", |
| 70 |
"Follow Me", |
| 71 |
"Get Enemy Flag", |
| 72 |
"Camp Here", |
| 73 |
"Report", |
| 74 |
"I Relinquish Command", |
| 75 |
NULL |
| 76 |
}; |
| 77 |
static const char *ctfMessages[] = { |
| 78 |
"i am the leader", |
| 79 |
"%s defend the base", |
| 80 |
"%s follow me", |
| 81 |
"%s get the enemy flag", |
| 82 |
"%s camp here", |
| 83 |
"%s report", |
| 84 |
"i stop being the leader", |
| 85 |
NULL |
| 86 |
}; |
| 87 |
|
| 88 |
#define NUM_CTF1F_ORDERS 7 |
| 89 |
static const char *ctf1fOrders[] = { |
| 90 |
"I Am the Leader", |
| 91 |
"Defend the Base", |
| 92 |
"Follow Me", |
| 93 |
"Get The Flag", |
| 94 |
"Camp Here", |
| 95 |
"Report", |
| 96 |
"I Relinquish Command", |
| 97 |
NULL |
| 98 |
}; |
| 99 |
static const char *ctf1fMessages[] = { |
| 100 |
"i am the leader", |
| 101 |
"%s defend the base", |
| 102 |
"%s follow me", |
| 103 |
"%s get the flag", |
| 104 |
"%s camp here", |
| 105 |
"%s report", |
| 106 |
"i stop being the leader", |
| 107 |
NULL |
| 108 |
}; |
| 109 |
|
| 110 |
#define NUM_BASE_ORDERS 7 |
| 111 |
static const char *baseOrders[] = { |
| 112 |
"I Am the Leader", |
| 113 |
"Defend the Base", |
| 114 |
"Follow Me", |
| 115 |
"Attack the Enemy Base", |
| 116 |
"Camp Here", |
| 117 |
"Report", |
| 118 |
"I Relinquish Command", |
| 119 |
NULL |
| 120 |
}; |
| 121 |
static const char *baseMessages[] = { |
| 122 |
"i am the leader", |
| 123 |
"%s defend the base", |
| 124 |
"%s follow me", |
| 125 |
"%s attack the base", |
| 126 |
"%s camp here", |
| 127 |
"%s report", |
| 128 |
"i stop being the leader", |
| 129 |
NULL |
| 130 |
}; |
| 131 |
|
| 132 |
#define NUM_TEAM_ORDERS 6 |
| 133 |
static const char *teamOrders[] = { |
| 134 |
"I Am the Leader", |
| 135 |
"Follow Me", |
| 136 |
"Roam", |
| 137 |
"Camp Here", |
| 138 |
"Report", |
| 139 |
"I Relinquish Command", |
| 140 |
NULL |
| 141 |
}; |
| 142 |
static const char *teamMessages[] = { |
| 143 |
"i am the leader", |
| 144 |
"%s follow me", |
| 145 |
"%s roam", |
| 146 |
"%s camp here", |
| 147 |
"%s report", |
| 148 |
"i stop being the leader", |
| 149 |
NULL |
| 150 |
}; |
| 151 |
|
| 152 |
#define NUM_DD_ORDERS 8 |
| 153 |
static const char *ddOrders[] = { |
| 154 |
"I Am the Leader", |
| 155 |
"Follow Me", |
| 156 |
"Roam", |
| 157 |
"Dominate Point A", |
| 158 |
"Dominate Point B", |
| 159 |
"Camp Here", |
| 160 |
"Report", |
| 161 |
"I Relinquish Command", |
| 162 |
NULL |
| 163 |
}; |
| 164 |
static const char *ddMessages[] = { |
| 165 |
"i am the leader", |
| 166 |
"%s follow me", |
| 167 |
"%s roam", |
| 168 |
"%s dominate point A", |
| 169 |
"%s dominate point B", |
| 170 |
"%s camp here", |
| 171 |
"%s report", |
| 172 |
"i stop being the leader", |
| 173 |
NULL |
| 174 |
}; |
| 175 |
|
| 176 |
/* |
| 177 |
=============== |
| 178 |
UI_TeamOrdersMenu_BackEvent |
| 179 |
=============== |
| 180 |
*/ |
| 181 |
static void UI_TeamOrdersMenu_BackEvent( void *ptr, int event ) { |
| 182 |
if( event != QM_ACTIVATED ) { |
| 183 |
return; |
| 184 |
} |
| 185 |
UI_PopMenu(); |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
/* |
| 190 |
=============== |
| 191 |
UI_TeamOrdersMenu_SetList |
| 192 |
=============== |
| 193 |
*/ |
| 194 |
static void UI_TeamOrdersMenu_SetList( int id ) { |
| 195 |
switch( id ) { |
| 196 |
default: |
| 197 |
case ID_LIST_BOTS: |
| 198 |
teamOrdersMenuInfo.list.generic.id = id; |
| 199 |
teamOrdersMenuInfo.list.numitems = teamOrdersMenuInfo.numBots; |
| 200 |
teamOrdersMenuInfo.list.itemnames = (const char **)teamOrdersMenuInfo.bots; |
| 201 |
break; |
| 202 |
|
| 203 |
case ID_LIST_CTF_ORDERS: |
| 204 |
teamOrdersMenuInfo.list.generic.id = id; |
| 205 |
teamOrdersMenuInfo.list.numitems = NUM_CTF_ORDERS; |
| 206 |
teamOrdersMenuInfo.list.itemnames = ctfOrders; |
| 207 |
break; |
| 208 |
|
| 209 |
case ID_LIST_CTF1F_ORDERS: |
| 210 |
teamOrdersMenuInfo.list.generic.id = id; |
| 211 |
teamOrdersMenuInfo.list.numitems = NUM_CTF1F_ORDERS; |
| 212 |
teamOrdersMenuInfo.list.itemnames = ctf1fOrders; |
| 213 |
break; |
| 214 |
|
| 215 |
case ID_LIST_BASE_ORDERS: |
| 216 |
teamOrdersMenuInfo.list.generic.id = id; |
| 217 |
teamOrdersMenuInfo.list.numitems = NUM_BASE_ORDERS; |
| 218 |
teamOrdersMenuInfo.list.itemnames = baseOrders; |
| 219 |
break; |
| 220 |
|
| 221 |
case ID_LIST_TEAM_ORDERS: |
| 222 |
teamOrdersMenuInfo.list.generic.id = id; |
| 223 |
teamOrdersMenuInfo.list.numitems = NUM_TEAM_ORDERS; |
| 224 |
teamOrdersMenuInfo.list.itemnames = teamOrders; |
| 225 |
break; |
| 226 |
|
| 227 |
case ID_LIST_DD_ORDERS: |
| 228 |
teamOrdersMenuInfo.list.generic.id = id; |
| 229 |
teamOrdersMenuInfo.list.numitems = NUM_DD_ORDERS; |
| 230 |
teamOrdersMenuInfo.list.itemnames = ddOrders; |
| 231 |
break; |
| 232 |
} |
| 233 |
|
| 234 |
teamOrdersMenuInfo.list.generic.bottom = teamOrdersMenuInfo.list.generic.top + teamOrdersMenuInfo.list.numitems * PROP_HEIGHT; |
| 235 |
} |
| 236 |
|
| 237 |
|
| 238 |
/* |
| 239 |
================= |
| 240 |
UI_TeamOrdersMenu_Key |
| 241 |
================= |
| 242 |
*/ |
| 243 |
sfxHandle_t UI_TeamOrdersMenu_Key( int key ) { |
| 244 |
menulist_s *l; |
| 245 |
int x; |
| 246 |
int y; |
| 247 |
int index; |
| 248 |
|
| 249 |
l = (menulist_s *)Menu_ItemAtCursor( &teamOrdersMenuInfo.menu ); |
| 250 |
if( l != &teamOrdersMenuInfo.list ) { |
| 251 |
return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key ); |
| 252 |
} |
| 253 |
|
| 254 |
switch( key ) { |
| 255 |
case K_MOUSE1: |
| 256 |
x = l->generic.left; |
| 257 |
y = l->generic.top; |
| 258 |
if( UI_CursorInRect( x, y, l->generic.right - x, l->generic.bottom - y ) ) { |
| 259 |
index = (uis.cursory - y) / PROP_HEIGHT; |
| 260 |
l->oldvalue = l->curvalue; |
| 261 |
l->curvalue = index; |
| 262 |
|
| 263 |
if( l->generic.callback ) { |
| 264 |
l->generic.callback( l, QM_ACTIVATED ); |
| 265 |
return menu_move_sound; |
| 266 |
} |
| 267 |
} |
| 268 |
return menu_null_sound; |
| 269 |
|
| 270 |
case K_KP_UPARROW: |
| 271 |
case K_UPARROW: |
| 272 |
l->oldvalue = l->curvalue; |
| 273 |
|
| 274 |
if( l->curvalue == 0 ) { |
| 275 |
l->curvalue = l->numitems - 1; |
| 276 |
} |
| 277 |
else { |
| 278 |
l->curvalue--; |
| 279 |
} |
| 280 |
return menu_move_sound; |
| 281 |
|
| 282 |
case K_KP_DOWNARROW: |
| 283 |
case K_DOWNARROW: |
| 284 |
l->oldvalue = l->curvalue; |
| 285 |
|
| 286 |
if( l->curvalue == l->numitems - 1 ) { |
| 287 |
l->curvalue = 0;; |
| 288 |
} |
| 289 |
else { |
| 290 |
l->curvalue++; |
| 291 |
} |
| 292 |
return menu_move_sound; |
| 293 |
} |
| 294 |
|
| 295 |
return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key ); |
| 296 |
} |
| 297 |
|
| 298 |
|
| 299 |
/* |
| 300 |
================= |
| 301 |
UI_TeamOrdersMenu_ListDraw |
| 302 |
================= |
| 303 |
*/ |
| 304 |
static void UI_TeamOrdersMenu_ListDraw( void *self ) { |
| 305 |
menulist_s *l; |
| 306 |
int x; |
| 307 |
int y; |
| 308 |
int i; |
| 309 |
float *color; |
| 310 |
qboolean hasfocus; |
| 311 |
int style; |
| 312 |
|
| 313 |
l = (menulist_s *)self; |
| 314 |
|
| 315 |
hasfocus = (l->generic.parent->cursor == l->generic.menuPosition); |
| 316 |
|
| 317 |
x = 320;//l->generic.x; |
| 318 |
y = l->generic.y; |
| 319 |
for( i = 0; i < l->numitems; i++ ) { |
| 320 |
style = UI_LEFT|UI_SMALLFONT|UI_CENTER; |
| 321 |
if( i == l->curvalue ) { |
| 322 |
color = color_yellow; |
| 323 |
if( hasfocus ) { |
| 324 |
style |= UI_PULSE; |
| 325 |
} |
| 326 |
} |
| 327 |
else { |
| 328 |
color = color_orange; |
| 329 |
} |
| 330 |
|
| 331 |
UI_DrawProportionalString( x, y, l->itemnames[i], style, color ); |
| 332 |
y += PROP_HEIGHT; |
| 333 |
} |
| 334 |
} |
| 335 |
|
| 336 |
|
| 337 |
/* |
| 338 |
=============== |
| 339 |
UI_TeamOrdersMenu_ListEvent |
| 340 |
=============== |
| 341 |
*/ |
| 342 |
static void UI_TeamOrdersMenu_ListEvent( void *ptr, int event ) { |
| 343 |
int id; |
| 344 |
int selection; |
| 345 |
char message[256]; |
| 346 |
|
| 347 |
if (event != QM_ACTIVATED) |
| 348 |
return; |
| 349 |
|
| 350 |
id = ((menulist_s *)ptr)->generic.id; |
| 351 |
selection = ((menulist_s *)ptr)->curvalue; |
| 352 |
|
| 353 |
if( id == ID_LIST_BOTS ) { |
| 354 |
teamOrdersMenuInfo.selectedBot = selection; |
| 355 |
if( teamOrdersMenuInfo.gametype == GT_CTF || teamOrdersMenuInfo.gametype == GT_CTF_ELIMINATION ) { |
| 356 |
UI_TeamOrdersMenu_SetList( ID_LIST_CTF_ORDERS ); |
| 357 |
} |
| 358 |
if( teamOrdersMenuInfo.gametype == GT_1FCTF ) { |
| 359 |
UI_TeamOrdersMenu_SetList( ID_LIST_CTF1F_ORDERS ); |
| 360 |
} |
| 361 |
if( teamOrdersMenuInfo.gametype == GT_OBELISK || teamOrdersMenuInfo.gametype == GT_HARVESTER ) { |
| 362 |
UI_TeamOrdersMenu_SetList( ID_LIST_BASE_ORDERS ); |
| 363 |
} |
| 364 |
if( teamOrdersMenuInfo.gametype == GT_TEAM || teamOrdersMenuInfo.gametype == GT_ELIMINATION || teamOrdersMenuInfo.gametype == GT_DOMINATION ) { |
| 365 |
UI_TeamOrdersMenu_SetList( ID_LIST_TEAM_ORDERS ); |
| 366 |
} |
| 367 |
if( teamOrdersMenuInfo.gametype == GT_DOUBLE_D ) { |
| 368 |
UI_TeamOrdersMenu_SetList( ID_LIST_DD_ORDERS ); |
| 369 |
} |
| 370 |
|
| 371 |
return; |
| 372 |
} |
| 373 |
|
| 374 |
if( id == ID_LIST_CTF_ORDERS ) { |
| 375 |
Com_sprintf( message, sizeof(message), ctfMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] ); |
| 376 |
} |
| 377 |
if( id == ID_LIST_CTF1F_ORDERS ) { |
| 378 |
Com_sprintf( message, sizeof(message), ctf1fMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] ); |
| 379 |
} |
| 380 |
if( id == ID_LIST_BASE_ORDERS ) { |
| 381 |
Com_sprintf( message, sizeof(message), baseMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] ); |
| 382 |
} |
| 383 |
if( id == ID_LIST_TEAM_ORDERS ) { |
| 384 |
Com_sprintf( message, sizeof(message), teamMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] ); |
| 385 |
} |
| 386 |
if( id == ID_LIST_DD_ORDERS ) { |
| 387 |
Com_sprintf( message, sizeof(message), ddMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] ); |
| 388 |
} |
| 389 |
|
| 390 |
trap_Cmd_ExecuteText( EXEC_APPEND, va( "say_team \"%s\"\n", message ) ); |
| 391 |
UI_PopMenu(); |
| 392 |
} |
| 393 |
|
| 394 |
|
| 395 |
/* |
| 396 |
=============== |
| 397 |
UI_TeamOrdersMenu_BuildBotList |
| 398 |
=============== |
| 399 |
*/ |
| 400 |
static void UI_TeamOrdersMenu_BuildBotList( void ) { |
| 401 |
uiClientState_t cs; |
| 402 |
int numPlayers; |
| 403 |
int isBot; |
| 404 |
int n; |
| 405 |
char playerTeam = '3'; |
| 406 |
char botTeam; |
| 407 |
char info[MAX_INFO_STRING]; |
| 408 |
|
| 409 |
for( n = 0; n < 9; n++ ) { |
| 410 |
teamOrdersMenuInfo.bots[n] = teamOrdersMenuInfo.botNames[n]; |
| 411 |
} |
| 412 |
|
| 413 |
trap_GetClientState( &cs ); |
| 414 |
|
| 415 |
Q_strncpyz( teamOrdersMenuInfo.botNames[0], "Everyone", 16 ); |
| 416 |
teamOrdersMenuInfo.numBots = 1; |
| 417 |
|
| 418 |
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ); |
| 419 |
numPlayers = atoi( Info_ValueForKey( info, "sv_maxclients" ) ); |
| 420 |
teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) ); |
| 421 |
|
| 422 |
for( n = 0; n < numPlayers && teamOrdersMenuInfo.numBots < 9; n++ ) { |
| 423 |
trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING ); |
| 424 |
|
| 425 |
if( n == cs.clientNum ) { |
| 426 |
playerTeam = *Info_ValueForKey( info, "t" ); |
| 427 |
continue; |
| 428 |
} |
| 429 |
|
| 430 |
isBot = atoi( Info_ValueForKey( info, "skill" ) ); |
| 431 |
if( !isBot ) { |
| 432 |
continue; |
| 433 |
} |
| 434 |
|
| 435 |
botTeam = *Info_ValueForKey( info, "t" ); |
| 436 |
if( botTeam != playerTeam ) { |
| 437 |
continue; |
| 438 |
} |
| 439 |
|
| 440 |
Q_strncpyz( teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.numBots], Info_ValueForKey( info, "n" ), 16 ); |
| 441 |
Q_CleanStr( teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.numBots] ); |
| 442 |
teamOrdersMenuInfo.numBots++; |
| 443 |
} |
| 444 |
} |
| 445 |
|
| 446 |
|
| 447 |
/* |
| 448 |
=============== |
| 449 |
UI_TeamOrdersMenu_Init |
| 450 |
=============== |
| 451 |
*/ |
| 452 |
static void UI_TeamOrdersMenu_Init( void ) { |
| 453 |
UI_TeamOrdersMenu_Cache(); |
| 454 |
|
| 455 |
memset( &teamOrdersMenuInfo, 0, sizeof(teamOrdersMenuInfo) ); |
| 456 |
teamOrdersMenuInfo.menu.fullscreen = qfalse; |
| 457 |
teamOrdersMenuInfo.menu.key = UI_TeamOrdersMenu_Key; |
| 458 |
|
| 459 |
UI_TeamOrdersMenu_BuildBotList(); |
| 460 |
|
| 461 |
teamOrdersMenuInfo.banner.generic.type = MTYPE_BTEXT; |
| 462 |
teamOrdersMenuInfo.banner.generic.x = 320; |
| 463 |
teamOrdersMenuInfo.banner.generic.y = 16; |
| 464 |
teamOrdersMenuInfo.banner.string = "TEAM ORDERS"; |
| 465 |
teamOrdersMenuInfo.banner.color = color_white; |
| 466 |
teamOrdersMenuInfo.banner.style = UI_CENTER; |
| 467 |
|
| 468 |
teamOrdersMenuInfo.frame.generic.type = MTYPE_BITMAP; |
| 469 |
teamOrdersMenuInfo.frame.generic.flags = QMF_INACTIVE; |
| 470 |
teamOrdersMenuInfo.frame.generic.name = ART_FRAME; |
| 471 |
teamOrdersMenuInfo.frame.generic.x = 320-233; |
| 472 |
teamOrdersMenuInfo.frame.generic.y = 240-166; |
| 473 |
teamOrdersMenuInfo.frame.width = 466; |
| 474 |
teamOrdersMenuInfo.frame.height = 332; |
| 475 |
|
| 476 |
teamOrdersMenuInfo.list.generic.type = MTYPE_SCROLLLIST; |
| 477 |
teamOrdersMenuInfo.list.generic.flags = QMF_PULSEIFFOCUS; |
| 478 |
teamOrdersMenuInfo.list.generic.ownerdraw = UI_TeamOrdersMenu_ListDraw; |
| 479 |
teamOrdersMenuInfo.list.generic.callback = UI_TeamOrdersMenu_ListEvent; |
| 480 |
teamOrdersMenuInfo.list.generic.x = 320-64; |
| 481 |
teamOrdersMenuInfo.list.generic.y = 120; |
| 482 |
|
| 483 |
teamOrdersMenuInfo.back.generic.type = MTYPE_BITMAP; |
| 484 |
teamOrdersMenuInfo.back.generic.name = ART_BACK0; |
| 485 |
teamOrdersMenuInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 486 |
teamOrdersMenuInfo.back.generic.callback = UI_TeamOrdersMenu_BackEvent; |
| 487 |
teamOrdersMenuInfo.back.generic.x = 0; |
| 488 |
teamOrdersMenuInfo.back.generic.y = 480-64; |
| 489 |
teamOrdersMenuInfo.back.width = 128; |
| 490 |
teamOrdersMenuInfo.back.height = 64; |
| 491 |
teamOrdersMenuInfo.back.focuspic = ART_BACK1; |
| 492 |
|
| 493 |
Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.banner ); |
| 494 |
Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.frame ); |
| 495 |
Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.list ); |
| 496 |
Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.back ); |
| 497 |
|
| 498 |
teamOrdersMenuInfo.list.generic.left = 220; |
| 499 |
teamOrdersMenuInfo.list.generic.top = teamOrdersMenuInfo.list.generic.y; |
| 500 |
teamOrdersMenuInfo.list.generic.right = 420; |
| 501 |
UI_TeamOrdersMenu_SetList( ID_LIST_BOTS ); |
| 502 |
} |
| 503 |
|
| 504 |
|
| 505 |
/* |
| 506 |
================= |
| 507 |
UI_TeamOrdersMenu_Cache |
| 508 |
================= |
| 509 |
*/ |
| 510 |
void UI_TeamOrdersMenu_Cache( void ) { |
| 511 |
trap_R_RegisterShaderNoMip( ART_FRAME ); |
| 512 |
trap_R_RegisterShaderNoMip( ART_BACK0 ); |
| 513 |
trap_R_RegisterShaderNoMip( ART_BACK1 ); |
| 514 |
} |
| 515 |
|
| 516 |
|
| 517 |
/* |
| 518 |
=============== |
| 519 |
UI_TeamOrdersMenu |
| 520 |
=============== |
| 521 |
*/ |
| 522 |
void UI_TeamOrdersMenu( void ) { |
| 523 |
UI_TeamOrdersMenu_Init(); |
| 524 |
UI_PushMenu( &teamOrdersMenuInfo.menu ); |
| 525 |
} |
| 526 |
|
| 527 |
|
| 528 |
/* |
| 529 |
=============== |
| 530 |
UI_TeamOrdersMenu_f |
| 531 |
=============== |
| 532 |
*/ |
| 533 |
void UI_TeamOrdersMenu_f( void ) { |
| 534 |
uiClientState_t cs; |
| 535 |
char info[MAX_INFO_STRING]; |
| 536 |
int team; |
| 537 |
|
| 538 |
// make sure it's a team game |
| 539 |
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ); |
| 540 |
teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) ); |
| 541 |
if( teamOrdersMenuInfo.gametype < GT_TEAM || teamOrdersMenuInfo.gametype!=GT_LMS) { |
| 542 |
return; |
| 543 |
} |
| 544 |
|
| 545 |
// not available to spectators |
| 546 |
trap_GetClientState( &cs ); |
| 547 |
trap_GetConfigString( CS_PLAYERS + cs.clientNum, info, MAX_INFO_STRING ); |
| 548 |
team = atoi( Info_ValueForKey( info, "t" ) ); |
| 549 |
if( team == TEAM_SPECTATOR ) { |
| 550 |
return; |
| 551 |
} |
| 552 |
|
| 553 |
UI_TeamOrdersMenu(); |
| 554 |
} |