‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_menus.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\rank_shared;
5 #using scripts\shared\system_shared;
6 
7 #insert scripts\shared\shared.gsh;
8 
9 #using scripts\mp\gametypes\_globallogic;
10 
11 #using scripts\mp\_util;
12 
13 #precache( "menu", MENU_TEAM );
14 #precache( "menu", MENU_CLASS );
15 #precache( "menu", MENU_CHANGE_CLASS );
16 #precache( "menu", MENU_CONTROLS );
17 #precache( "menu", MENU_OPTIONS );
18 #precache( "menu", MENU_LEAVEGAME );
19 #precache( "menu", MENU_SPECTATE );
20 #precache( "string", "MP_HOST_ENDED_GAME" );
21 #precache( "string", "MP_HOST_ENDGAME_RESPONSE" );
22 #precache( "eventstring", "open_ingame_menu" );
23 
24 #namespace menus;
25 
26 ‪REGISTER_SYSTEM( "menus", &‪__init__, undefined )
27 
28 function ‪__init__()
29 {
32 }
33 
34 function ‪init()
35 {
36  game["menu_start_menu"] = ‪MENU_START_MENU;
37  game["menu_team"] = ‪MENU_TEAM;
38  game["menu_class"] = ‪MENU_CLASS;
39  game["menu_changeclass"] = ‪MENU_CHANGE_CLASS;
40  game["menu_changeclass_offline"] = ‪MENU_CHANGE_CLASS;
41 
42  foreach( team in level.teams )
43  {
44  game["menu_changeclass_" + team ] = ‪MENU_CHANGE_CLASS;
45  }
46 
47  game["menu_controls"] = ‪MENU_CONTROLS;
48  game["menu_options"] = ‪MENU_OPTIONS;
49  game["menu_leavegame"] = ‪MENU_LEAVEGAME;
50 }
51 
53 {
54  self thread ‪on_menu_response();
55 }
56 
58 {
59  self endon("disconnect");
60 
61  for(;;)
62  {
63  self waittill("menuresponse", menu, response);
64 
65  //println( self getEntityNumber() + " menuresponse: " + menu + " " + response );
66 
67  //iprintln("^6", response);
68 
69  if ( response == "back" )
70  {
71  self closeInGameMenu();
72 
73  if ( level.console )
74  {
75  if( menu == game["menu_changeclass"] || menu == game["menu_changeclass_offline"] || menu == game["menu_team"] || menu == game["menu_controls"] )
76  {
77 
78  if( isdefined( level.teams[self.pers["team"]] ) )
79  self openMenu( game[ "menu_start_menu" ] );
80  }
81  }
82  continue;
83  }
84 
85  if(response == "changeteam" && level.allow_teamchange == "1")
86  {
87  self closeInGameMenu();
88  self openMenu(game["menu_team"]);
89  }
90 
91  if(response == "endgame")
92  {
93  // TODO: replace with onSomethingEvent call
94  if(level.splitscreen)
95  {
96  //if ( level.console )
97  // endparty();
98  level.skipVote = true;
99 
100  if ( !level.gameEnded )
101  {
102  level thread ‪globallogic::forceEnd();
103  }
104  }
105 
106  continue;
107  }
108 
109  if(response == "killserverpc")
110  {
111  level thread ‪globallogic::killserverPc();
112 
113  continue;
114  }
115 
116  if ( response == "endround" )
117  {
118  if ( !level.gameEnded )
119  {
121  level thread ‪globallogic::forceEnd();
122  }
123  else
124  {
125  self closeInGameMenu();
126  self iprintln( &"MP_HOST_ENDGAME_RESPONSE" );
127  }
128  continue;
129  }
130 
131  if(menu == game["menu_team"] && level.allow_teamchange == "1")
132  {
133  switch(response)
134  {
135  case "autoassign":
136  self [[level.autoassign]]( true );
137  break;
138 
139  case "spectator":
140  self [[level.spectator]]();
141  break;
142 
143  default:
144  self [[level.teamMenu]](response);
145  break;
146  }
147  } // the only responses remain are change class events
148  else if( menu == game["menu_changeclass"] || menu == game["menu_changeclass_offline"] )
149  {
150  if ( response != "cancel" )
151  {
152  self closeInGameMenu();
153 
154  if( level.rankedMatch && isSubstr(response, "custom") )
155  {
156  if ( self IsItemLocked( rank::GetItemIndex( "feature_cac" ) ) )
157  kick( self getEntityNumber() );
158  }
159 
160  self.selectedClass = true;
161  self [[level.curClass]](response);
162  }
163  }
164  else if ( menu == "spectate" )
165  {
166  player = ‪util::getPlayerFromClientNum( int( response ) );
167  if ( isdefined ( player ) )
168  {
169  self SetCurrentSpectatorClient( player );
170  }
171  }
172  }
173 }
174 
‪MENU_CHANGE_CLASS
‪#define MENU_CHANGE_CLASS
Definition: shared.gsh:461
‪gameHistoryPlayerQuit
‪function gameHistoryPlayerQuit()
Definition: _globallogic.gsc:1423
‪on_menu_response
‪function on_menu_response()
Definition: _menus.gsc:57
‪killserverPc
‪function killserverPc()
Definition: _globallogic.gsc:690
‪forceEnd
‪function forceEnd(hostsucks)
Definition: _globallogic.gsc:643
‪on_start_gametype
‪function on_start_gametype(func, obj)
Definition: callbacks_shared.csc:285
‪MENU_CLASS
‪#define MENU_CLASS
Definition: shared.gsh:460
‪MENU_LEAVEGAME
‪#define MENU_LEAVEGAME
Definition: shared.gsh:465
‪init
‪function init()
Definition: _menus.gsc:34
‪MENU_TEAM
‪#define MENU_TEAM
Definition: shared.gsh:458
‪MENU_START_MENU
‪#define MENU_START_MENU
Definition: shared.gsh:459
‪__init__
‪function __init__()
Definition: _menus.gsc:28
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪on_player_connect
‪function on_player_connect()
Definition: _menus.gsc:52
‪getPlayerFromClientNum
‪function getPlayerFromClientNum(clientNum)
Definition: _util.gsc:678
‪on_connect
‪function on_connect()
Definition: _arena.gsc:20
‪MENU_OPTIONS
‪#define MENU_OPTIONS
Definition: shared.gsh:464
‪MENU_CONTROLS
‪#define MENU_CONTROLS
Definition: shared.gsh:463