/* =============== UI_TeamOrdersMenu_Init =============== */ static void UI_TeamOrdersMenu_Init( void ) { UI_TeamOrdersMenu_Cache(); memset( &teamOrdersMenuInfo, 0, sizeof(teamOrdersMenuInfo) ); teamOrdersMenuInfo.menu.fullscreen = qfalse; teamOrdersMenuInfo.menu.key = UI_TeamOrdersMenu_Key; UI_TeamOrdersMenu_BuildBotList(); teamOrdersMenuInfo.banner.generic.type = MTYPE_BTEXT; teamOrdersMenuInfo.banner.generic.x = 320; teamOrdersMenuInfo.banner.generic.y = 16; teamOrdersMenuInfo.banner.string = "TEAM ORDERS"; teamOrdersMenuInfo.banner.color = text_banner_color; teamOrdersMenuInfo.banner.style = UI_CENTER; teamOrdersMenuInfo.frame.generic.type = MTYPE_BITMAP; teamOrdersMenuInfo.frame.generic.flags = QMF_INACTIVE; teamOrdersMenuInfo.frame.generic.name = ART_FRAME; teamOrdersMenuInfo.frame.generic.x = 320-233; teamOrdersMenuInfo.frame.generic.y = 240-166; teamOrdersMenuInfo.frame.width = 466; teamOrdersMenuInfo.frame.height = 332; teamOrdersMenuInfo.list.generic.type = MTYPE_SCROLLLIST; teamOrdersMenuInfo.list.generic.flags = QMF_PULSEIFFOCUS; teamOrdersMenuInfo.list.generic.ownerdraw = UI_TeamOrdersMenu_ListDraw; teamOrdersMenuInfo.list.generic.callback = UI_TeamOrdersMenu_ListEvent; teamOrdersMenuInfo.list.generic.x = 320-64; teamOrdersMenuInfo.list.generic.y = 120; teamOrdersMenuInfo.back.generic.type = MTYPE_BITMAP; teamOrdersMenuInfo.back.generic.name = ART_BACK0; teamOrdersMenuInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; teamOrdersMenuInfo.back.generic.callback = UI_TeamOrdersMenu_BackEvent; teamOrdersMenuInfo.back.generic.x = 0; teamOrdersMenuInfo.back.generic.y = 480-64; teamOrdersMenuInfo.back.width = 128; teamOrdersMenuInfo.back.height = 64; teamOrdersMenuInfo.back.focuspic = ART_BACK1; Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.banner ); Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.frame ); Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.list ); Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.back ); teamOrdersMenuInfo.list.generic.left = 220; teamOrdersMenuInfo.list.generic.top = teamOrdersMenuInfo.list.generic.y; teamOrdersMenuInfo.list.generic.right = 420; UI_TeamOrdersMenu_SetList( ID_LIST_BOTS ); }
/* =============== UI_TeamOrdersMenu_ListEvent =============== */ static void UI_TeamOrdersMenu_ListEvent(void *ptr, int event) { int id; int selection; char message[256]; if (event != QM_ACTIVATED) return; id = ((menulist_s *)ptr)->generic.id; selection = ((menulist_s *)ptr)->curvalue; if (id == ID_LIST_BOTS) { teamOrdersMenuInfo.selectedBot = selection; if (teamOrdersMenuInfo.gametype == GT_CTF || teamOrdersMenuInfo.gametype == GT_INVASION) { UI_TeamOrdersMenu_SetList(ID_LIST_CTF_ORDERS); } else { UI_TeamOrdersMenu_SetList(ID_LIST_TEAM_ORDERS); } return; } if (id == ID_LIST_CTF_ORDERS) { Com_sprintf(message, sizeof(message), ctfMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot]); } else { Com_sprintf(message, sizeof(message), teamMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot]); } trap_Cmd_ExecuteText(EXEC_APPEND, va("say_team \"%s\"\n", message)); UI_PopMenu(); }
/* =============== UI_TeamOrdersMenu_ListEvent =============== */ static void UI_TeamOrdersMenu_ListEvent( void *ptr, int event ) { int id; int selection; char message[256]; #ifdef MISSIONPACK const char **voiceChats; const char **buttons; #endif if (event != QM_ACTIVATED) return; id = ((menulist_s *)ptr)->generic.id; selection = ((menulist_s *)ptr)->curvalue; if( id == ID_LIST_BOTS ) { teamOrdersMenuInfo.selectedBot = selection; if( teamOrdersMenuInfo.gametype > GT_TEAM ) { UI_TeamOrdersMenu_SetList( ID_LIST_CTF_ORDERS ); } else { UI_TeamOrdersMenu_SetList( ID_LIST_TEAM_ORDERS ); } return; } if( id == ID_LIST_CTF_ORDERS ) { Com_sprintf( message, sizeof(message), ctfMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] ); #ifdef MISSIONPACK voiceChats = ctfVoiceChats; buttons = ctfButtons; #endif } else { Com_sprintf( message, sizeof(message), teamMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] ); #ifdef MISSIONPACK voiceChats = teamVoiceChats; buttons = teamButtons; #endif } #ifdef MISSIONPACK if (teamOrdersMenuInfo.selectedBot == 0) // Everyone { if (voiceChats[selection] != NULL && buttons[selection] != NULL) trap_Cmd_ExecuteText( EXEC_APPEND, va( "cmd vsay_team %s; +button%s; wait; -button%s", voiceChats[selection], buttons[selection], buttons[selection] )); else if (voiceChats[selection] != NULL) trap_Cmd_ExecuteText( EXEC_APPEND, va( "cmd vsay_team %s", voiceChats[selection] ) ); else trap_Cmd_ExecuteText( EXEC_APPEND, va( "say_team \"%s\"\n", message ) ); } else { if (voiceChats[selection] != NULL && buttons[selection] != NULL) trap_Cmd_ExecuteText( EXEC_APPEND, va( "cmd vtell %s %s; +button%s; wait; -button%s", teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot], voiceChats[selection], buttons[selection], buttons[selection] ) ); else if (voiceChats[selection] != NULL) trap_Cmd_ExecuteText( EXEC_APPEND, va( "cmd vtell %s", voiceChats[selection] ) ); else trap_Cmd_ExecuteText( EXEC_APPEND, va( "say_team \"%s\"\n", message ) ); } #else trap_Cmd_ExecuteText( EXEC_APPEND, va( "say_team \"%s\"\n", message ) ); #endif UI_PopMenu(); }