MenuScreen_Shell_Root.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #pragma hdrstop
  21. #include "../../idLib/precompiled.h"
  22. #include "../Game_local.h"
  23. extern idCVar g_demoMode;
  24. const static int NUM_MAIN_OPTIONS = 6;
  25. /*
  26. ========================
  27. idMenuScreen_Shell_Root::Initialize
  28. ========================
  29. */
  30. void idMenuScreen_Shell_Root::Initialize( idMenuHandler * data ) {
  31. idMenuScreen::Initialize( data );
  32. if ( data != NULL ) {
  33. menuGUI = data->GetGUI();
  34. }
  35. SetSpritePath( "menuMain" );
  36. options = new (TAG_SWF) idMenuWidget_DynamicList();
  37. options->SetNumVisibleOptions( NUM_MAIN_OPTIONS );
  38. options->SetSpritePath( GetSpritePath(), "info", "options" );
  39. options->Initialize( data );
  40. options->SetWrappingAllowed( true );
  41. AddChild( options );
  42. helpWidget = new ( TAG_SWF ) idMenuWidget_Help();
  43. helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" );
  44. AddChild( helpWidget );
  45. while ( options->GetChildren().Num() < NUM_MAIN_OPTIONS ) {
  46. idMenuWidget_Button * const buttonWidget = new (TAG_SWF) idMenuWidget_Button();
  47. buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() );
  48. buttonWidget->Initialize( data );
  49. buttonWidget->RegisterEventObserver( helpWidget );
  50. options->AddChild( buttonWidget );
  51. }
  52. options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) );
  53. options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) );
  54. options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
  55. options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
  56. options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) );
  57. options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) );
  58. options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) );
  59. options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );
  60. AddEventAction( WIDGET_EVENT_SCROLL_RIGHT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT ) );
  61. AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_RELEASE ) );
  62. AddEventAction( WIDGET_EVENT_SCROLL_LEFT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT ) );
  63. AddEventAction( WIDGET_EVENT_SCROLL_LEFT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_RELEASE ) );
  64. AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, 0 );
  65. }
  66. /*
  67. ========================
  68. idMenuScreen_Shell_Root::Update
  69. ========================
  70. */
  71. void idMenuScreen_Shell_Root::Update() {
  72. if ( menuData != NULL ) {
  73. idMenuWidget_CommandBar * cmdBar = menuData->GetCmdBar();
  74. if ( cmdBar != NULL ) {
  75. cmdBar->ClearAllButtons();
  76. idMenuWidget_CommandBar::buttonInfo_t * buttonInfo;
  77. if ( !g_demoMode.GetBool() ) {
  78. buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
  79. if ( menuData->GetPlatform() != 2 ) {
  80. buttonInfo->label = "#str_00395";
  81. }
  82. buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
  83. }
  84. buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
  85. if ( menuData->GetPlatform() != 2 ) {
  86. buttonInfo->label = "#str_SWF_SELECT";
  87. }
  88. buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
  89. }
  90. }
  91. idMenuScreen::Update();
  92. }
  93. enum rootMenuCmds_t {
  94. ROOT_CMD_START_DEMO,
  95. ROOT_CMD_START_DEMO2,
  96. ROOT_CMD_SETTINGS,
  97. ROOT_CMD_QUIT,
  98. ROOT_CMD_DEV,
  99. ROOT_CMD_CAMPAIGN,
  100. ROOT_CMD_MULTIPLAYER,
  101. ROOT_CMD_PLAYSTATION,
  102. ROOT_CMD_CREDITS
  103. };
  104. /*
  105. ========================
  106. idMenuScreen_Shell_Root::ShowScreen
  107. ========================
  108. */
  109. void idMenuScreen_Shell_Root::ShowScreen( const mainMenuTransition_t transitionType ) {
  110. if ( menuData != NULL && menuData->GetPlatform() != 2 ) {
  111. idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions;
  112. idList< idStr > option;
  113. int index = 0;
  114. if ( g_demoMode.GetBool() ) {
  115. idMenuWidget_Button * buttonWidget = NULL;
  116. option.Append( "START DEMO" ); // START DEMO
  117. menuOptions.Append( option );
  118. options->GetChildByIndex( index ).ClearEventActions();
  119. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_START_DEMO );
  120. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  121. if ( buttonWidget != NULL ) {
  122. buttonWidget->SetDescription( "Launch the demo" );
  123. }
  124. index++;
  125. if ( g_demoMode.GetInteger() == 2 ) {
  126. option.Clear();
  127. option.Append( "START PRESS DEMO" ); // START DEMO
  128. menuOptions.Append( option );
  129. options->GetChildByIndex( index ).ClearEventActions();
  130. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_START_DEMO2 );
  131. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  132. if ( buttonWidget != NULL ) {
  133. buttonWidget->SetDescription( "Launch the press demo" );
  134. }
  135. index++;
  136. }
  137. option.Clear();
  138. option.Append( "#str_swf_settings" ); // settings
  139. menuOptions.Append( option );
  140. options->GetChildByIndex( index ).ClearEventActions();
  141. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_SETTINGS );
  142. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  143. if ( buttonWidget != NULL ) {
  144. buttonWidget->SetDescription( "#str_02206" );
  145. }
  146. index++;
  147. option.Clear();
  148. option.Append( "#str_swf_quit" ); // quit
  149. menuOptions.Append( option );
  150. options->GetChildByIndex( index ).ClearEventActions();
  151. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_QUIT );
  152. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  153. if ( buttonWidget != NULL ) {
  154. buttonWidget->SetDescription( "#str_01976" );
  155. }
  156. index++;
  157. } else {
  158. idMenuWidget_Button * buttonWidget = NULL;
  159. #if !defined ( ID_RETAIL )
  160. option.Append( "DEV" ); // DEV
  161. menuOptions.Append( option );
  162. options->GetChildByIndex( index ).ClearEventActions();
  163. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_DEV );
  164. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  165. if ( buttonWidget != NULL ) {
  166. buttonWidget->SetDescription( "View a list of maps available for play" );
  167. }
  168. index++;
  169. #endif
  170. option.Clear();
  171. option.Append( "#str_swf_campaign" ); // singleplayer
  172. menuOptions.Append( option );
  173. options->GetChildByIndex( index ).ClearEventActions();
  174. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_CAMPAIGN );
  175. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  176. if ( buttonWidget != NULL ) {
  177. buttonWidget->SetDescription( "#str_swf_campaign_desc" );
  178. }
  179. index++;
  180. option.Clear();
  181. option.Append( "#str_swf_multiplayer" ); // multiplayer
  182. menuOptions.Append( option );
  183. options->GetChildByIndex( index ).ClearEventActions();
  184. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_MULTIPLAYER );
  185. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  186. if ( buttonWidget != NULL ) {
  187. buttonWidget->SetDescription( "#str_02215" );
  188. }
  189. index++;
  190. option.Clear();
  191. option.Append( "#str_swf_settings" ); // settings
  192. menuOptions.Append( option );
  193. options->GetChildByIndex( index ).ClearEventActions();
  194. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_SETTINGS );
  195. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  196. if ( buttonWidget != NULL ) {
  197. buttonWidget->SetDescription( "#str_02206" );
  198. }
  199. index++;
  200. option.Clear();
  201. option.Append( "#str_swf_credits" ); // credits
  202. menuOptions.Append( option );
  203. options->GetChildByIndex( index ).ClearEventActions();
  204. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_CREDITS );
  205. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  206. if ( buttonWidget != NULL ) {
  207. buttonWidget->SetDescription( "#str_02219" );
  208. }
  209. index++;
  210. // only add quit option for PC
  211. option.Clear();
  212. option.Append( "#str_swf_quit" ); // quit
  213. menuOptions.Append( option );
  214. options->GetChildByIndex( index ).ClearEventActions();
  215. options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, ROOT_CMD_QUIT );
  216. buttonWidget = dynamic_cast< idMenuWidget_Button * >( &options->GetChildByIndex( index ) );
  217. if ( buttonWidget != NULL ) {
  218. buttonWidget->SetDescription( "#str_01976" );
  219. }
  220. index++;
  221. }
  222. options->SetListData( menuOptions );
  223. } else {
  224. idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions;
  225. options->SetListData( menuOptions );
  226. }
  227. idMenuScreen::ShowScreen( transitionType );
  228. if ( menuData != NULL && menuData->GetPlatform() == 2 ) {
  229. idMenuHandler_Shell * shell = dynamic_cast< idMenuHandler_Shell * >( menuData );
  230. if ( shell != NULL ) {
  231. idMenuWidget_MenuBar * menuBar = shell->GetMenuBar();
  232. if ( menuBar != NULL ) {
  233. menuBar->SetFocusIndex( GetRootIndex() );
  234. }
  235. }
  236. }
  237. }
  238. /*
  239. ========================
  240. idMenuScreen_Shell_Root::HideScreen
  241. ========================
  242. */
  243. void idMenuScreen_Shell_Root::HideScreen( const mainMenuTransition_t transitionType ) {
  244. idMenuScreen::HideScreen( transitionType );
  245. }
  246. /*
  247. ========================
  248. idMenuScreen_Shell_Root::HandleExitGameBtn
  249. ========================
  250. */
  251. void idMenuScreen_Shell_Root::HandleExitGameBtn() {
  252. class idSWFScriptFunction_QuitDialog : public idSWFScriptFunction_RefCounted {
  253. public:
  254. idSWFScriptFunction_QuitDialog( gameDialogMessages_t _msg, int _accept ) {
  255. msg = _msg;
  256. accept = _accept;
  257. }
  258. idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
  259. common->Dialog().ClearDialog( msg );
  260. if ( accept == 1 ) {
  261. common->Quit();
  262. } else if ( accept == -1 ) {
  263. session->MoveToPressStart();
  264. }
  265. return idSWFScriptVar();
  266. }
  267. private:
  268. gameDialogMessages_t msg;
  269. int accept;
  270. };
  271. idStaticList< idSWFScriptFunction *, 4 > callbacks;
  272. idStaticList< idStrId, 4 > optionText;
  273. callbacks.Append( new (TAG_SWF) idSWFScriptFunction_QuitDialog( GDM_QUIT_GAME, 1 ) );
  274. callbacks.Append( new (TAG_SWF) idSWFScriptFunction_QuitDialog( GDM_QUIT_GAME, 0 ) );
  275. callbacks.Append( new (TAG_SWF) idSWFScriptFunction_QuitDialog( GDM_QUIT_GAME, -1 ) );
  276. optionText.Append( idStrId( "#STR_SWF_ACCEPT" ) );
  277. optionText.Append( idStrId( "#STR_SWF_CANCEL" ) );
  278. optionText.Append( idStrId( "#str_swf_change_game" ) );
  279. common->Dialog().AddDynamicDialog( GDM_QUIT_GAME, callbacks, optionText, true, "" );
  280. }
  281. /*
  282. ========================
  283. idMenuScreen_Shell_Root::GetRootIndex
  284. ========================
  285. */
  286. int idMenuScreen_Shell_Root::GetRootIndex() {
  287. if ( options != NULL ) {
  288. return options->GetFocusIndex();
  289. }
  290. return 0;
  291. }
  292. /*
  293. ========================
  294. idMenuScreen_Shell_Root::SetRootIndex
  295. ========================
  296. */
  297. void idMenuScreen_Shell_Root::SetRootIndex( int index ) {
  298. if ( options != NULL ) {
  299. options->SetFocusIndex( index );
  300. }
  301. }
  302. /*
  303. ========================
  304. idMenuScreen_Shell_Root::HandleAction
  305. ========================
  306. */
  307. bool idMenuScreen_Shell_Root::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {
  308. if ( menuData == NULL ) {
  309. return true;
  310. }
  311. if ( menuData->ActiveScreen() != SHELL_AREA_ROOT ) {
  312. return false;
  313. }
  314. widgetAction_t actionType = action.GetType();
  315. const idSWFParmList & parms = action.GetParms();
  316. switch ( actionType ) {
  317. case WIDGET_ACTION_GO_BACK: {
  318. session->MoveToPressStart();
  319. return true;
  320. }
  321. case WIDGET_ACTION_PRESS_FOCUSED: {
  322. if ( menuData->GetPlatform() == 2 ) {
  323. idMenuHandler_Shell * shell = dynamic_cast< idMenuHandler_Shell * >( menuData );
  324. if ( !shell ) {
  325. return true;
  326. }
  327. idMenuWidget_MenuBar * menuBar = shell->GetMenuBar();
  328. if ( !menuBar ) {
  329. return true;
  330. }
  331. const idMenuWidget_MenuButton * buttonWidget = dynamic_cast< idMenuWidget_MenuButton * >( &menuBar->GetChildByIndex( menuBar->GetFocusIndex() ) );
  332. if ( !buttonWidget ) {
  333. return true;
  334. }
  335. idWidgetEvent pressEvent( WIDGET_EVENT_PRESS, 0, NULL, idSWFParmList() );
  336. menuBar->ReceiveEvent( pressEvent );
  337. return true;
  338. }
  339. break;
  340. }
  341. case WIDGET_ACTION_SCROLL_HORIZONTAL: {
  342. if ( menuData->GetPlatform() != 2 ) {
  343. return true;
  344. }
  345. idMenuHandler_Shell * shell = dynamic_cast< idMenuHandler_Shell * >( menuData );
  346. if ( !shell ) {
  347. return true;
  348. }
  349. idMenuWidget_MenuBar * menuBar = shell->GetMenuBar();
  350. if ( !menuBar ) {
  351. return true;
  352. }
  353. int index = menuBar->GetViewIndex();
  354. const int dir = parms[0].ToInteger();
  355. #ifdef ID_RETAIL
  356. const int totalCount = menuBar->GetTotalNumberOfOptions() - 1;
  357. #else
  358. const int totalCount = menuBar->GetTotalNumberOfOptions();
  359. #endif
  360. index += dir;
  361. if ( index < 0 ) {
  362. index = totalCount - 1;
  363. } else if ( index >= totalCount ) {
  364. index = 0;
  365. }
  366. SetRootIndex( index );
  367. menuBar->SetViewIndex( index );
  368. menuBar->SetFocusIndex( index );
  369. return true;
  370. }
  371. case WIDGET_ACTION_COMMAND: {
  372. switch ( parms[0].ToInteger() ) {
  373. case ROOT_CMD_START_DEMO: {
  374. cmdSystem->AppendCommandText( va( "devmap %s %d\n", "demo/enpro_e3_2012", 1 ) );
  375. break;
  376. }
  377. case ROOT_CMD_START_DEMO2: {
  378. cmdSystem->AppendCommandText( va( "devmap %s %d\n", "game/le_hell", 2 ) );
  379. break;
  380. }
  381. case ROOT_CMD_SETTINGS: {
  382. menuData->SetNextScreen( SHELL_AREA_SETTINGS, MENU_TRANSITION_SIMPLE );
  383. break;
  384. }
  385. case ROOT_CMD_QUIT: {
  386. HandleExitGameBtn();
  387. break;
  388. }
  389. case ROOT_CMD_DEV: {
  390. menuData->SetNextScreen( SHELL_AREA_DEV, MENU_TRANSITION_SIMPLE );
  391. break;
  392. }
  393. case ROOT_CMD_CAMPAIGN: {
  394. menuData->SetNextScreen( SHELL_AREA_CAMPAIGN, MENU_TRANSITION_SIMPLE );
  395. break;
  396. }
  397. case ROOT_CMD_MULTIPLAYER: {
  398. const idLocalUser * masterUser = session->GetSignInManager().GetMasterLocalUser();
  399. if ( masterUser == NULL ) {
  400. break;
  401. }
  402. if ( masterUser->GetOnlineCaps() & CAP_BLOCKED_PERMISSION ) {
  403. common->Dialog().AddDialog( GDM_ONLINE_INCORRECT_PERMISSIONS, DIALOG_CONTINUE, NULL, NULL, true, __FUNCTION__, __LINE__, false );
  404. } else if ( !masterUser->CanPlayOnline() ) {
  405. class idSWFScriptFunction_Accept : public idSWFScriptFunction_RefCounted {
  406. public:
  407. idSWFScriptFunction_Accept() { }
  408. idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
  409. common->Dialog().ClearDialog( GDM_PLAY_ONLINE_NO_PROFILE );
  410. session->ShowOnlineSignin();
  411. return idSWFScriptVar();
  412. }
  413. };
  414. class idSWFScriptFunction_Cancel : public idSWFScriptFunction_RefCounted {
  415. public:
  416. idSWFScriptFunction_Cancel() { }
  417. idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
  418. common->Dialog().ClearDialog( GDM_PLAY_ONLINE_NO_PROFILE );
  419. return idSWFScriptVar();
  420. }
  421. };
  422. common->Dialog().AddDialog( GDM_PLAY_ONLINE_NO_PROFILE, DIALOG_ACCEPT_CANCEL, new (TAG_SWF) idSWFScriptFunction_Accept(), new (TAG_SWF) idSWFScriptFunction_Cancel(), false );
  423. } else {
  424. idMatchParameters matchParameters;
  425. matchParameters.matchFlags = DefaultPartyFlags;
  426. session->CreatePartyLobby( matchParameters );
  427. }
  428. break;
  429. }
  430. case ROOT_CMD_PLAYSTATION: {
  431. menuData->SetNextScreen( SHELL_AREA_PLAYSTATION, MENU_TRANSITION_SIMPLE );
  432. break;
  433. }
  434. case ROOT_CMD_CREDITS: {
  435. menuData->SetNextScreen( SHELL_AREA_CREDITS, MENU_TRANSITION_SIMPLE );
  436. break;
  437. }
  438. }
  439. return true;
  440. }
  441. }
  442. return idMenuWidget::HandleAction( action, event, widget, forceHandled );
  443. }