MenuScreen.h (51355B)
1 /* 2 =========================================================================== 3 4 Doom 3 BFG Edition GPL Source Code 5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). 8 9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 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. 23 24 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. 25 26 =========================================================================== 27 */ 28 #ifndef __MENUSCREEN_H__ 29 #define __MENUSCREEN_H__ 30 31 #include "../../renderer/tr_local.h" 32 33 enum mainMenuTransition_t { 34 MENU_TRANSITION_INVALID = -1, 35 MENU_TRANSITION_SIMPLE, 36 MENU_TRANSITION_ADVANCE, 37 MENU_TRANSITION_BACK, 38 MENU_TRANSITION_FORCE 39 }; 40 41 enum cursorState_t { 42 CURSOR_NONE, 43 CURSOR_IN_COMBAT, 44 CURSOR_TALK, 45 CURSOR_GRABBER, 46 CURSOR_ITEM, 47 }; 48 49 /* 50 ================================================ 51 idLBRowBlock 52 ================================================ 53 */ 54 class idLBRowBlock { 55 public: 56 idLBRowBlock() : lastTime( 0 ), startIndex( 0 ) {} 57 58 int lastTime; 59 int startIndex; 60 idList< idLeaderboardCallback::row_t > rows; 61 }; 62 63 enum leaderboardFilterMode_t { 64 LEADERBOARD_FILTER_OVERALL = 0, 65 LEADERBOARD_FILTER_MYSCORE = 1, 66 LEADERBOARD_FILTER_FRIENDS = 2 67 }; 68 69 /* 70 ================================================ 71 idLBCache 72 ================================================ 73 */ 74 class idLBCache { 75 public: 76 static const int NUM_ROW_BLOCKS = 5; 77 static const leaderboardFilterMode_t DEFAULT_LEADERBOARD_FILTER = LEADERBOARD_FILTER_OVERALL; 78 79 idLBCache() : 80 def( NULL ), 81 filter( DEFAULT_LEADERBOARD_FILTER ), 82 pendingDef( NULL ), 83 pendingFilter( DEFAULT_LEADERBOARD_FILTER ), 84 requestingRows( false ), 85 loadingNewLeaderboard( false ), 86 numRowsInLeaderboard( 0 ), 87 entryIndex( 0 ), 88 rowOffset( 0 ), 89 localIndex( -1 ), 90 errorCode( LEADERBOARD_DISPLAY_ERROR_NONE ) {} 91 92 void Pump(); 93 void Reset(); 94 void SetLeaderboard( const leaderboardDefinition_t * def_, leaderboardFilterMode_t filter_ = DEFAULT_LEADERBOARD_FILTER ); 95 void CycleFilter(); 96 leaderboardFilterMode_t GetFilter() const { return filter; } 97 idStr GetFilterStrType(); 98 bool Scroll( int amount ); 99 bool ScrollOffset( int amount ); 100 idLBRowBlock * FindFreeRowBlock(); 101 void Update( const idLeaderboardCallback * callback ); 102 const idLeaderboardCallback::row_t * GetLeaderboardRow( int row ); 103 104 const leaderboardDefinition_t * GetLeaderboard() const { return def; } 105 int GetNumRowsInLeaderboard() const { return numRowsInLeaderboard; } 106 107 int GetEntryIndex() const { return entryIndex; } 108 int GetRowOffset() const { return rowOffset; } 109 int GetLocalIndex() const { return localIndex; } 110 leaderboardDisplayError_t GetErrorCode() const { return errorCode; } 111 112 bool IsRequestingRows() const { return requestingRows; } 113 bool IsLoadingNewLeaderboard() const { return loadingNewLeaderboard; } 114 115 void SetEntryIndex( int value ) { entryIndex = value; } 116 void SetRowOffset( int value ) { rowOffset = value; } 117 118 void DisplayGamerCardUI( const idLeaderboardCallback::row_t * row ); 119 120 private: 121 leaderboardDisplayError_t CallbackErrorToDisplayError( leaderboardError_t errorCode ); 122 123 idLBRowBlock rowBlocks[NUM_ROW_BLOCKS]; 124 125 const leaderboardDefinition_t * def; 126 leaderboardFilterMode_t filter; 127 128 // Pending def and filter are simply used to queue up SetLeaderboard calls when the system is currently 129 // busy waiting on results from a previous SetLeaderboard/GetLeaderboardRow call. 130 // This is so we only have ONE request in-flight at any given time. 131 const leaderboardDefinition_t * pendingDef; 132 leaderboardFilterMode_t pendingFilter; 133 134 bool requestingRows; // True while requested rows are in flight 135 bool loadingNewLeaderboard; // True when changing to a new leaderboard (or filter type) 136 137 int numRowsInLeaderboard; // Total rows in this leaderboard (they won't all be cached though) 138 int entryIndex; // Relative row offset (from top of viewing window) 139 int rowOffset; // Absolute row offset 140 int localIndex; // Row for the master local user (-1 means not on leaderboard) 141 142 leaderboardDisplayError_t errorCode; // Error state of the leaderboard 143 }; 144 145 /* 146 ================================================ 147 idMenuScreen 148 ================================================ 149 */ 150 class idMenuScreen : public idMenuWidget { 151 public: 152 153 idMenuScreen(); 154 virtual ~idMenuScreen(); 155 156 virtual void Update(); 157 virtual void UpdateCmds(); 158 virtual void HandleMenu( const mainMenuTransition_t type ); 159 160 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 161 virtual void HideScreen( const mainMenuTransition_t transitionType ); 162 163 virtual void ObserveEvent( const idMenuWidget & widget, const idWidgetEvent & event ); 164 virtual void SetScreenGui( idSWF * gui ) { menuGUI = gui; } 165 166 protected: 167 168 idSWF * menuGUI; 169 mainMenuTransition_t transition; 170 171 }; 172 173 /* 174 ================================================ 175 idMenuScreen_PDA_UserData 176 ================================================ 177 */ 178 class idMenuScreen_PDA_UserData : public idMenuScreen { 179 public: 180 181 idMenuScreen_PDA_UserData() {} 182 183 virtual ~idMenuScreen_PDA_UserData() {} 184 virtual void Initialize( idMenuHandler * data ); 185 virtual void Update(); 186 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 187 virtual void HideScreen( const mainMenuTransition_t transitionType ); 188 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 189 idMenuWidget_PDA_UserData * GetUserData() { return &pdaUserData; } 190 idMenuWidget_PDA_Objective * GetObjective() { return &pdaObjectiveSimple; } 191 idMenuWidget_PDA_AudioFiles * GetAudioFiles() { return &pdaAudioFiles; } 192 193 private: 194 idMenuWidget_PDA_UserData pdaUserData; 195 idMenuWidget_PDA_Objective pdaObjectiveSimple; 196 idMenuWidget_PDA_AudioFiles pdaAudioFiles; 197 }; 198 199 /* 200 ================================================ 201 idMenuScreen_PDA_UserEmails 202 ================================================ 203 */ 204 class idMenuScreen_PDA_UserEmails : public idMenuScreen { 205 public: 206 idMenuScreen_PDA_UserEmails() : 207 readingEmails( false ), 208 scrollEmailInfo( false ) { 209 } 210 211 virtual ~idMenuScreen_PDA_UserEmails() { 212 } 213 214 virtual void Update(); 215 virtual void Initialize( idMenuHandler * data ); 216 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 217 virtual void HideScreen( const mainMenuTransition_t transitionType ); 218 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 219 virtual void ObserveEvent( const idMenuWidget & widget, const idWidgetEvent & event ); 220 idMenuWidget_PDA_EmailInbox & GetInbox() { return pdaInbox; } 221 222 bool ScrollCorrectList( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget ); 223 void ShowEmail( bool show ); 224 void UpdateEmail(); 225 private: 226 idMenuWidget_PDA_EmailInbox pdaInbox; 227 idMenuWidget_InfoBox emailInfo; 228 idMenuWidget_ScrollBar emailScrollbar; 229 bool readingEmails; 230 bool scrollEmailInfo; 231 }; 232 233 /* 234 ================================================ 235 idMenuScreen_PDA_UserData 236 ================================================ 237 */ 238 class idMenuScreen_PDA_VideoDisks : public idMenuScreen { 239 public: 240 idMenuScreen_PDA_VideoDisks() : 241 activeVideo( NULL ) { 242 } 243 244 virtual ~idMenuScreen_PDA_VideoDisks() { 245 } 246 247 virtual void Initialize( idMenuHandler * data ); 248 virtual void Update(); 249 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 250 virtual void HideScreen( const mainMenuTransition_t transitionType ); 251 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 252 253 void ToggleVideoDiskPlay(); 254 void UpdateVideoDetails(); 255 void SelectedVideoToPlay( int index ); 256 void ClearActiveVideo() { activeVideo = NULL; } 257 const idDeclVideo * GetActiveVideo() { return activeVideo; } 258 private: 259 idMenuWidget_ScrollBar scrollbar; 260 idMenuWidget_DynamicList pdaVideoList; 261 idMenuWidget_PDA_VideoInfo videoDetails; 262 idList< idList< idStr, TAG_IDLIB_LIST_MENU>, TAG_IDLIB_LIST_MENU > videoItems; 263 const idDeclVideo * activeVideo; 264 }; 265 266 /* 267 ================================================ 268 idMenuScreen_PDA_UserData 269 ================================================ 270 */ 271 class idMenuScreen_PDA_Inventory : public idMenuScreen { 272 public: 273 idMenuScreen_PDA_Inventory() { 274 } 275 virtual void Initialize( idMenuHandler * data ); 276 virtual void Update(); 277 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 278 virtual void HideScreen( const mainMenuTransition_t transitionType ); 279 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 280 281 void EquipWeapon(); 282 const char * GetWeaponName( int index ); 283 bool IsVisibleWeapon( int index ); 284 285 private: 286 idMenuWidget_Carousel itemList; 287 idMenuWidget_InfoBox infoBox; 288 }; 289 290 //* 291 //================================================ 292 //idMenuScreen_Shell_Root 293 //================================================ 294 //*/ 295 class idMenuScreen_Shell_Root : public idMenuScreen { 296 public: 297 idMenuScreen_Shell_Root() : 298 options( NULL ), 299 helpWidget( NULL ) { 300 } 301 virtual void Initialize( idMenuHandler * data ); 302 virtual void Update(); 303 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 304 virtual void HideScreen( const mainMenuTransition_t transitionType ); 305 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 306 307 void HandleExitGameBtn(); 308 int GetRootIndex(); 309 void SetRootIndex( int index ); 310 idMenuWidget_Help * GetHelpWidget() { return helpWidget; } 311 312 private: 313 idMenuWidget_DynamicList * options; 314 idMenuWidget_Help * helpWidget; 315 }; 316 317 //* 318 //================================================ 319 //idMenuScreen_Shell_Pause 320 //================================================ 321 //*/ 322 class idMenuScreen_Shell_Pause : public idMenuScreen { 323 public: 324 idMenuScreen_Shell_Pause() : 325 options( NULL ), 326 isMpPause( false ) { 327 } 328 virtual void Initialize( idMenuHandler * data ); 329 virtual void Update(); 330 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 331 virtual void HideScreen( const mainMenuTransition_t transitionType ); 332 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 333 334 void HandleExitGameBtn(); 335 void HandleRestartBtn(); 336 337 private: 338 idMenuWidget_DynamicList * options; 339 bool isMpPause; 340 }; 341 342 //* 343 //================================================ 344 //idMenuScreen_Shell_PressStart 345 //================================================ 346 //*/ 347 class idMenuScreen_Shell_PressStart : public idMenuScreen { 348 public: 349 idMenuScreen_Shell_PressStart() : 350 startButton( NULL ), 351 options( NULL ), 352 itemList( NULL ), 353 doomCover( NULL ), 354 doom2Cover( NULL ), 355 doom3Cover( NULL ) { 356 } 357 virtual void Initialize( idMenuHandler * data ); 358 virtual void Update(); 359 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 360 virtual void HideScreen( const mainMenuTransition_t transitionType ); 361 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 362 private: 363 idMenuWidget_Button * startButton; 364 idMenuWidget_DynamicList * options; 365 idMenuWidget_Carousel * itemList; 366 const idMaterial * doomCover; 367 const idMaterial * doom2Cover; 368 const idMaterial * doom3Cover; 369 }; 370 371 //* 372 //================================================ 373 //idMenuScreen_Shell_PressStart 374 //================================================ 375 //*/ 376 class idMenuScreen_Shell_GameSelect : public idMenuScreen { 377 public: 378 idMenuScreen_Shell_GameSelect() : 379 startButton( NULL ), 380 options( NULL ), 381 itemList( NULL ), 382 doomCover( NULL ), 383 doom2Cover( NULL ), 384 doom3Cover( NULL ) { 385 } 386 virtual void Initialize( idMenuHandler * data ); 387 virtual void Update(); 388 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 389 virtual void HideScreen( const mainMenuTransition_t transitionType ); 390 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 391 private: 392 idMenuWidget_Button * startButton; 393 idMenuWidget_DynamicList * options; 394 idMenuWidget_Carousel * itemList; 395 const idMaterial * doomCover; 396 const idMaterial * doom2Cover; 397 const idMaterial * doom3Cover; 398 }; 399 400 //* 401 //================================================ 402 //idMenuScreen_Shell_Singleplayer 403 //================================================ 404 //*/ 405 class idMenuScreen_Shell_Singleplayer : public idMenuScreen { 406 public: 407 idMenuScreen_Shell_Singleplayer() : 408 options( NULL ), 409 btnBack( NULL ), 410 canContinue( false ) { 411 } 412 virtual void Initialize( idMenuHandler * data ); 413 virtual void Update(); 414 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 415 virtual void HideScreen( const mainMenuTransition_t transitionType ); 416 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 417 418 void SetCanContinue( bool valid ) { canContinue = valid; } 419 void ContinueGame(); 420 private: 421 bool canContinue; 422 idMenuWidget_DynamicList * options; 423 idMenuWidget_Button * btnBack; 424 }; 425 426 //* 427 //================================================ 428 //idMenuScreen_Shell_Settings 429 //================================================ 430 //*/ 431 class idMenuScreen_Shell_Settings : public idMenuScreen { 432 public: 433 idMenuScreen_Shell_Settings() : 434 options( NULL ), 435 btnBack( NULL ) { 436 } 437 virtual void Initialize( idMenuHandler * data ); 438 virtual void Update(); 439 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 440 virtual void HideScreen( const mainMenuTransition_t transitionType ); 441 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 442 private: 443 idMenuWidget_DynamicList * options; 444 idMenuWidget_Button * btnBack; 445 }; 446 447 struct creditInfo_t { 448 449 creditInfo_t() { 450 type = -1; 451 entry = ""; 452 } 453 454 creditInfo_t( int t, const char * val ) { 455 type = t; 456 entry = val; 457 } 458 459 int type; 460 idStr entry; 461 }; 462 463 //* 464 //================================================ 465 //idMenuScreen_Shell_Credits 466 //================================================ 467 //*/ 468 class idMenuScreen_Shell_Credits : public idMenuScreen { 469 public: 470 idMenuScreen_Shell_Credits() : 471 btnBack( NULL ), 472 creditIndex( 0 ) { 473 } 474 virtual void Initialize( idMenuHandler * data ); 475 virtual void Update(); 476 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 477 virtual void HideScreen( const mainMenuTransition_t transitionType ); 478 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 479 480 void SetupCreditList(); 481 void UpdateCredits(); 482 483 private: 484 idMenuWidget_Button * btnBack; 485 idList< creditInfo_t > creditList; 486 int creditIndex; 487 }; 488 489 //* 490 //================================================ 491 //idMenuScreen_Shell_Resolution 492 //================================================ 493 //*/ 494 class idMenuScreen_Shell_Resolution : public idMenuScreen { 495 public: 496 idMenuScreen_Shell_Resolution() : 497 options( NULL ), 498 btnBack( NULL ) { 499 } 500 virtual void Initialize( idMenuHandler * data ); 501 virtual void Update(); 502 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 503 virtual void HideScreen( const mainMenuTransition_t transitionType ); 504 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 505 506 private: 507 struct optionData_t { 508 optionData_t() { 509 fullscreen = -1; 510 vidmode = -1; 511 } 512 optionData_t( int f, int v ) { 513 fullscreen = f; 514 vidmode = v; 515 } 516 optionData_t( const optionData_t & other ) { 517 fullscreen = other.fullscreen; 518 vidmode = other.vidmode; 519 } 520 const optionData_t & operator=( const optionData_t & other ) { 521 fullscreen = other.fullscreen; 522 vidmode = other.vidmode; 523 return *this; 524 } 525 bool operator==( const optionData_t & other ) const { 526 return ( fullscreen == other.fullscreen ) && ( ( vidmode == other.vidmode ) || ( fullscreen == 0 ) ); 527 } 528 int fullscreen; 529 int vidmode; 530 }; 531 idList<optionData_t> optionData; 532 533 optionData_t originalOption; 534 535 idMenuWidget_DynamicList * options; 536 idMenuWidget_Button * btnBack; 537 }; 538 539 //* 540 //================================================ 541 //idMenuScreen_Shell_Difficulty 542 //================================================ 543 //*/ 544 class idMenuScreen_Shell_Difficulty : public idMenuScreen { 545 public: 546 idMenuScreen_Shell_Difficulty() : 547 options( NULL ), 548 btnBack( NULL ), 549 nightmareUnlocked( false ) { 550 } 551 virtual void Initialize( idMenuHandler * data ); 552 virtual void Update(); 553 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 554 virtual void HideScreen( const mainMenuTransition_t transitionType ); 555 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 556 private: 557 bool nightmareUnlocked; 558 idMenuWidget_DynamicList * options; 559 idMenuWidget_Button * btnBack; 560 }; 561 562 //* 563 //================================================ 564 //idMenuScreen_Shell_Playstation 565 //================================================ 566 //*/ 567 class idMenuScreen_Shell_Playstation : public idMenuScreen { 568 public: 569 idMenuScreen_Shell_Playstation() : 570 options( NULL ), 571 btnBack( NULL ) { 572 } 573 virtual void Initialize( idMenuHandler * data ); 574 virtual void Update(); 575 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 576 virtual void HideScreen( const mainMenuTransition_t transitionType ); 577 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 578 private: 579 idMenuWidget_DynamicList * options; 580 idMenuWidget_Button * btnBack; 581 }; 582 583 //* 584 //================================================ 585 //idMenuScreen_Shell_ModeSelect 586 //================================================ 587 //*/ 588 class idMenuScreen_Shell_ModeSelect : public idMenuScreen { 589 public: 590 idMenuScreen_Shell_ModeSelect() : 591 options( NULL ), 592 btnBack( NULL ) { 593 } 594 virtual void Initialize( idMenuHandler * data ); 595 virtual void Update(); 596 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 597 virtual void HideScreen( const mainMenuTransition_t transitionType ); 598 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 599 private: 600 idMenuWidget_DynamicList * options; 601 idMenuWidget_Button * btnBack; 602 }; 603 604 //* 605 //================================================ 606 //idMenuScreen_GameBrowser 607 //================================================ 608 //*/ 609 class idMenuScreen_Shell_GameBrowser : public idMenuScreen { 610 public: 611 idMenuScreen_Shell_GameBrowser() : 612 listWidget( NULL ), 613 btnBack( NULL ) { 614 } 615 616 virtual void Initialize( idMenuHandler * data ); 617 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 618 virtual void HideScreen( const mainMenuTransition_t transitionType ); 619 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandle = false ); 620 621 void UpdateServerList(); 622 void OnServerListReady(); 623 void DescribeServer( const serverInfo_t & server, const int index ); 624 625 private: 626 idMenuWidget_GameBrowserList * listWidget; 627 idMenuWidget_Button * btnBack; 628 }; 629 630 //* 631 //================================================ 632 //idMenuScreen_Shell_Leaderboards 633 //================================================ 634 //*/ 635 class idMenuScreen_Shell_Leaderboards : public idMenuScreen { 636 public: 637 idMenuScreen_Shell_Leaderboards() : 638 options( NULL ), 639 btnBack( NULL ), 640 refreshLeaderboard( false ), 641 refreshWhenMasterIsOnline( false ), 642 lbIndex( 0 ), 643 btnPrev( NULL ), 644 btnNext( NULL ), 645 lbHeading( NULL ), 646 btnPageDwn( NULL ), 647 btnPageUp( NULL ) { 648 } 649 650 virtual ~idMenuScreen_Shell_Leaderboards(); 651 652 virtual void Initialize( idMenuHandler * data ); 653 virtual void Update(); 654 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 655 virtual void HideScreen( const mainMenuTransition_t transitionType ); 656 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 657 658 void UpdateLeaderboard( const idLeaderboardCallback * callback ); 659 void PumpLBCache(); 660 void RefreshLeaderboard(); 661 void ShowMessage( bool show, idStr message, bool spinner ); 662 void ClearLeaderboard(); 663 void SetLeaderboardIndex(); 664 665 protected: 666 667 struct doomLeaderboard_t { 668 doomLeaderboard_t() : lb(NULL) { } 669 doomLeaderboard_t( const leaderboardDefinition_t * _lb, idStr _name ) { lb=_lb; name=_name; } 670 const leaderboardDefinition_t * lb; 671 idStr name; 672 }; 673 674 idList< doomLeaderboard_t > leaderboards; 675 676 idMenuWidget_DynamicList * options; 677 idMenuWidget_Button * btnBack; 678 idMenuWidget_Button * btnPrev; 679 idMenuWidget_Button * btnNext; 680 idMenuWidget_Button * btnPageDwn; 681 idMenuWidget_Button * btnPageUp; 682 idLBCache * lbCache; 683 idSWFTextInstance * lbHeading; 684 int lbIndex; 685 bool refreshLeaderboard; 686 bool refreshWhenMasterIsOnline; 687 }; 688 689 //* 690 //================================================ 691 //idMenuScreen_Shell_Bindings 692 //================================================ 693 //*/ 694 class idMenuScreen_Shell_Bindings : public idMenuScreen { 695 public: 696 idMenuScreen_Shell_Bindings() : 697 options( NULL ), 698 btnBack( NULL ), 699 blinder( NULL ), 700 restoreDefault( NULL ), 701 txtBlinder( NULL ), 702 bindingsChanged( false ) { 703 } 704 virtual void Initialize( idMenuHandler * data ); 705 virtual void Update(); 706 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 707 virtual void HideScreen( const mainMenuTransition_t transitionType ); 708 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 709 710 void SetBinding( int keyNum ); 711 void UpdateBindingDisplay(); 712 void ToggleWait( bool wait ); 713 void SetBindingChanged( bool changed ) { bindingsChanged = changed; } 714 715 protected: 716 void HandleRestoreDefaults(); 717 718 idMenuWidget_DynamicList * options; 719 idMenuWidget_Button * restoreDefault; 720 idSWFSpriteInstance * blinder; 721 idSWFSpriteInstance * txtBlinder; 722 idMenuWidget_Button * btnBack; 723 bool bindingsChanged; 724 }; 725 726 //* 727 //================================================ 728 //idMenuScreen_Shell_Dev 729 //================================================ 730 //*/ 731 class idMenuScreen_Shell_Dev : public idMenuScreen { 732 public: 733 734 struct devOption_t { 735 devOption_t() { 736 map = ""; 737 name = ""; 738 }; 739 740 devOption_t( const char * m, const char * n ) { 741 map = m; 742 name = n; 743 } 744 745 const char * map; 746 const char * name; 747 }; 748 749 idMenuScreen_Shell_Dev() : 750 options( NULL ), 751 btnBack( NULL ) { 752 } 753 virtual void Initialize( idMenuHandler * data ); 754 virtual void Update(); 755 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 756 virtual void HideScreen( const mainMenuTransition_t transitionType ); 757 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 758 759 void SetupDevOptions(); 760 761 private: 762 idMenuWidget_DynamicList * options; 763 idMenuWidget_Button * btnBack; 764 idList< devOption_t, TAG_IDLIB_LIST_MENU > devOptions; 765 }; 766 767 //* 768 //================================================ 769 //idMenuScreen_Shell_NewGame 770 //================================================ 771 //*/ 772 class idMenuScreen_Shell_NewGame : public idMenuScreen { 773 public: 774 idMenuScreen_Shell_NewGame() : 775 options( NULL ), 776 btnBack( NULL ) { 777 } 778 virtual void Initialize( idMenuHandler * data ); 779 virtual void Update(); 780 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 781 virtual void HideScreen( const mainMenuTransition_t transitionType ); 782 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 783 private: 784 idMenuWidget_DynamicList * options; 785 idMenuWidget_Button * btnBack; 786 }; 787 788 //* 789 //================================================ 790 //idMenuScreen_Shell_Load 791 //================================================ 792 //*/ 793 class idMenuScreen_Shell_Load : public idMenuScreen { 794 public: 795 idMenuScreen_Shell_Load() : 796 options( NULL ), 797 btnBack( NULL ), 798 btnDelete( NULL ), 799 saveInfo( NULL ) { 800 } 801 virtual void Initialize( idMenuHandler * data ); 802 virtual void Update(); 803 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 804 virtual void HideScreen( const mainMenuTransition_t transitionType ); 805 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 806 807 void UpdateSaveEnumerations(); 808 void LoadDamagedGame( int index ); 809 void LoadGame( int index ); 810 void DeleteGame( int index ); 811 saveGameDetailsList_t GetSortedSaves() const { return sortedSaves; } 812 813 private: 814 idMenuWidget_DynamicList * options; 815 idMenuWidget_Shell_SaveInfo * saveInfo; 816 idMenuWidget_Button * btnBack; 817 idMenuWidget_Button * btnDelete; 818 saveGameDetailsList_t sortedSaves; 819 }; 820 821 //* 822 //================================================ 823 //idMenuScreen_Shell_Save 824 //================================================ 825 //*/ 826 class idMenuScreen_Shell_Save : public idMenuScreen { 827 public: 828 idMenuScreen_Shell_Save() : 829 options( NULL ), 830 btnBack( NULL ), 831 btnDelete( NULL ), 832 saveInfo( NULL ) { 833 } 834 virtual void Initialize( idMenuHandler * data ); 835 virtual void Update(); 836 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 837 virtual void HideScreen( const mainMenuTransition_t transitionType ); 838 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 839 saveGameDetailsList_t GetSortedSaves() const { return sortedSaves; } 840 841 void UpdateSaveEnumerations(); 842 void SaveGame( int index ); 843 void DeleteGame( int index ); 844 845 private: 846 idMenuWidget_Button * btnBack; 847 idMenuWidget_DynamicList * options; 848 idMenuWidget_Shell_SaveInfo * saveInfo; 849 idMenuWidget_Button * btnDelete; 850 saveGameDetailsList_t sortedSaves; 851 }; 852 853 //* 854 //================================================ 855 //idMenuScreen_Shell_GameOptions 856 //================================================ 857 //*/ 858 class idMenuScreen_Shell_GameOptions : public idMenuScreen { 859 public: 860 861 /* 862 ================================================ 863 idMenuDataSource_GameSettings 864 ================================================ 865 */ 866 class idMenuDataSource_GameSettings : public idMenuDataSource { 867 public: 868 enum gameSettingFields_t { 869 GAME_FIELD_FOV, 870 GAME_FIELD_CHECKPOINTS, 871 GAME_FIELD_AUTO_SWITCH, 872 GAME_FIELD_AUTO_RELOAD, 873 GAME_FIELD_AIM_ASSIST, 874 GAME_FIELD_ALWAYS_SPRINT, 875 GAME_FIELD_FLASHLIGHT_SHADOWS, 876 MAX_GAME_FIELDS 877 }; 878 879 idMenuDataSource_GameSettings(); 880 881 // loads data 882 virtual void LoadData(); 883 884 // submits data 885 virtual void CommitData(); 886 887 // says whether something changed with the data 888 virtual bool IsDataChanged() const; 889 890 // retrieves a particular field for reading or updating 891 virtual idSWFScriptVar GetField( const int fieldIndex ) const { return fields[ fieldIndex ]; } 892 893 virtual void AdjustField( const int fieldIndex, const int adjustAmount ); 894 895 private: 896 idStaticList< idSWFScriptVar, MAX_GAME_FIELDS > fields; 897 idStaticList< idSWFScriptVar, MAX_GAME_FIELDS > originalFields; 898 }; 899 900 idMenuScreen_Shell_GameOptions() : 901 options( NULL ), 902 btnBack( NULL ) { 903 } 904 virtual void Initialize( idMenuHandler * data ); 905 virtual void Update(); 906 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 907 virtual void HideScreen( const mainMenuTransition_t transitionType ); 908 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 909 private: 910 idMenuWidget_DynamicList * options; 911 idMenuDataSource_GameSettings systemData; 912 idMenuWidget_Button * btnBack; 913 }; 914 915 //* 916 //================================================ 917 //idMenuScreen_Shell_GameOptions 918 //================================================ 919 //*/ 920 class idMenuScreen_Shell_MatchSettings : public idMenuScreen { 921 public: 922 923 /* 924 ================================================ 925 idMenuDataSource_MatchSettings 926 ================================================ 927 */ 928 class idMenuDataSource_MatchSettings : public idMenuDataSource { 929 public: 930 enum matchSettingFields_t { 931 MATCH_FIELD_MODE, 932 MATCH_FIELD_MAP, 933 MATCH_FIELD_TIME, 934 MATCH_FIELD_SCORE, 935 MAX_MATCH_FIELDS 936 }; 937 938 idMenuDataSource_MatchSettings(); 939 940 // loads data 941 virtual void LoadData(); 942 943 // submits data 944 virtual void CommitData(); 945 946 // says whether something changed with the data 947 virtual bool IsDataChanged() const; 948 949 // retrieves a particular field for reading or updating 950 virtual idSWFScriptVar GetField( const int fieldIndex ) const { return fields[ fieldIndex ]; } 951 952 virtual void AdjustField( const int fieldIndex, const int adjustAmount ); 953 954 bool MapChanged() { return updateMap; } 955 void ClearMapChanged() { updateMap = false; } 956 957 private: 958 959 void GetModeName( int index, idStr & name ); 960 void GetMapName( int index, idStr & name ); 961 962 idStaticList< idSWFScriptVar, MAX_MATCH_FIELDS > fields; 963 idStaticList< idSWFScriptVar, MAX_MATCH_FIELDS > originalFields; 964 bool updateMap; 965 }; 966 967 idMenuScreen_Shell_MatchSettings() : 968 options( NULL ), 969 btnBack( NULL ) { 970 } 971 virtual void Initialize( idMenuHandler * data ); 972 virtual void Update(); 973 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 974 virtual void HideScreen( const mainMenuTransition_t transitionType ); 975 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 976 private: 977 idMenuWidget_DynamicList * options; 978 idMenuDataSource_MatchSettings matchData; 979 idMenuWidget_Button * btnBack; 980 }; 981 982 //* 983 //================================================ 984 //idMenuScreen_Shell_Controls 985 //================================================ 986 //*/ 987 class idMenuScreen_Shell_Controls : public idMenuScreen { 988 public: 989 990 /* 991 ================================================ 992 idMenuDataSource_ControlSettings 993 ================================================ 994 */ 995 class idMenuDataSource_ControlSettings : public idMenuDataSource { 996 public: 997 enum controlSettingFields_t { 998 CONTROLS_FIELD_INVERT_MOUSE, 999 CONTROLS_FIELD_GAMEPAD_ENABLED, 1000 CONTROLS_FIELD_MOUSE_SENS, 1001 MAX_CONTROL_FIELDS 1002 }; 1003 1004 idMenuDataSource_ControlSettings(); 1005 1006 // loads data 1007 virtual void LoadData(); 1008 1009 // submits data 1010 virtual void CommitData(); 1011 1012 // says whether something changed with the data 1013 virtual bool IsDataChanged() const; 1014 1015 // retrieves a particular field for reading or updating 1016 virtual idSWFScriptVar GetField( const int fieldIndex ) const { return fields[ fieldIndex ]; } 1017 1018 virtual void AdjustField( const int fieldIndex, const int adjustAmount ); 1019 1020 private: 1021 idStaticList< idSWFScriptVar, MAX_CONTROL_FIELDS > fields; 1022 idStaticList< idSWFScriptVar, MAX_CONTROL_FIELDS > originalFields; 1023 }; 1024 1025 idMenuScreen_Shell_Controls() : 1026 options( NULL ), 1027 btnBack( NULL ) { 1028 } 1029 virtual void Initialize( idMenuHandler * data ); 1030 virtual void Update(); 1031 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1032 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1033 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1034 private: 1035 idMenuWidget_DynamicList * options; 1036 idMenuDataSource_ControlSettings controlData; 1037 idMenuWidget_Button * btnBack; 1038 }; 1039 1040 //* 1041 //================================================ 1042 //idMenuScreen_Shell_Controls 1043 //================================================ 1044 //*/ 1045 class idMenuScreen_Shell_Gamepad : public idMenuScreen { 1046 public: 1047 1048 /* 1049 ================================================ 1050 idMenuDataSource_ControlSettings 1051 ================================================ 1052 */ 1053 class idMenuDataSource_GamepadSettings : public idMenuDataSource { 1054 public: 1055 enum controlSettingFields_t { 1056 GAMEPAD_FIELD_LEFTY, 1057 GAMEPAD_FIELD_INVERT, 1058 GAMEPAD_FIELD_VIBRATE, 1059 GAMEPAD_FIELD_HOR_SENS, 1060 GAMEPAD_FIELD_VERT_SENS, 1061 GAMEPAD_FIELD_ACCELERATION, 1062 GAMEPAD_FIELD_THRESHOLD, 1063 MAX_GAMEPAD_FIELDS 1064 }; 1065 1066 idMenuDataSource_GamepadSettings(); 1067 1068 // loads data 1069 virtual void LoadData(); 1070 1071 // submits data 1072 virtual void CommitData(); 1073 1074 // says whether something changed with the data 1075 virtual bool IsDataChanged() const; 1076 1077 // retrieves a particular field for reading or updating 1078 virtual idSWFScriptVar GetField( const int fieldIndex ) const { return fields[ fieldIndex ]; } 1079 1080 virtual void AdjustField( const int fieldIndex, const int adjustAmount ); 1081 1082 private: 1083 idStaticList< idSWFScriptVar, MAX_GAMEPAD_FIELDS > fields; 1084 idStaticList< idSWFScriptVar, MAX_GAMEPAD_FIELDS > originalFields; 1085 }; 1086 1087 idMenuScreen_Shell_Gamepad() : 1088 options( NULL ), 1089 btnBack( NULL ) { 1090 } 1091 virtual void Initialize( idMenuHandler * data ); 1092 virtual void Update(); 1093 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1094 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1095 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1096 private: 1097 idMenuWidget_DynamicList * options; 1098 idMenuDataSource_GamepadSettings gamepadData; 1099 idMenuWidget_Button * btnBack; 1100 }; 1101 1102 //* 1103 //================================================ 1104 //idMenuScreen_Shell_ControllerLayout 1105 //================================================ 1106 //*/ 1107 class idMenuScreen_Shell_ControllerLayout : public idMenuScreen { 1108 public: 1109 1110 /* 1111 ================================================ 1112 idMenuDataSource_ControlSettings 1113 ================================================ 1114 */ 1115 class idMenuDataSource_LayoutSettings : public idMenuDataSource { 1116 public: 1117 enum controlSettingFields_t { 1118 LAYOUT_FIELD_LAYOUT, 1119 MAX_LAYOUT_FIELDS, 1120 }; 1121 1122 idMenuDataSource_LayoutSettings(); 1123 1124 // loads data 1125 virtual void LoadData(); 1126 1127 // submits data 1128 virtual void CommitData(); 1129 1130 // says whether something changed with the data 1131 virtual bool IsDataChanged() const; 1132 1133 // retrieves a particular field for reading or updating 1134 virtual idSWFScriptVar GetField( const int fieldIndex ) const { return fields[ fieldIndex ]; } 1135 1136 virtual void AdjustField( const int fieldIndex, const int adjustAmount ); 1137 1138 private: 1139 idStaticList< idSWFScriptVar, MAX_LAYOUT_FIELDS > fields; 1140 idStaticList< idSWFScriptVar, MAX_LAYOUT_FIELDS > originalFields; 1141 }; 1142 1143 idMenuScreen_Shell_ControllerLayout() : 1144 btnBack( NULL ), 1145 options( NULL ) { 1146 } 1147 virtual void Initialize( idMenuHandler * data ); 1148 virtual void Update(); 1149 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1150 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1151 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1152 1153 void UpdateBindingInfo(); 1154 private: 1155 1156 idMenuDataSource_LayoutSettings layoutData; 1157 idMenuWidget_DynamicList * options; 1158 idMenuWidget_Button * btnBack; 1159 }; 1160 1161 //* 1162 //================================================ 1163 //idMenuScreen_Shell_SystemOptions 1164 //================================================ 1165 //*/ 1166 class idMenuScreen_Shell_SystemOptions : public idMenuScreen { 1167 public: 1168 1169 /* 1170 ================================================ 1171 idMenuDataSource_SystemSettings 1172 ================================================ 1173 */ 1174 class idMenuDataSource_SystemSettings : public idMenuDataSource { 1175 public: 1176 enum systemSettingFields_t { 1177 SYSTEM_FIELD_FULLSCREEN, 1178 SYSTEM_FIELD_FRAMERATE, 1179 SYSTEM_FIELD_VSYNC, 1180 SYSTEM_FIELD_ANTIALIASING, 1181 SYSTEM_FIELD_MOTIONBLUR, 1182 SYSTEM_FIELD_LODBIAS, 1183 SYSTEM_FIELD_BRIGHTNESS, 1184 SYSTEM_FIELD_VOLUME, 1185 MAX_SYSTEM_FIELDS 1186 }; 1187 1188 idMenuDataSource_SystemSettings(); 1189 1190 // loads data 1191 virtual void LoadData(); 1192 1193 // submits data 1194 virtual void CommitData(); 1195 1196 // says whether something changed with the data 1197 virtual bool IsDataChanged() const; 1198 1199 // retrieves a particular field for reading 1200 virtual idSWFScriptVar GetField( const int fieldIndex ) const; 1201 1202 // updates a particular field value 1203 virtual void AdjustField( const int fieldIndex, const int adjustAmount ); 1204 1205 bool IsRestartRequired() const; 1206 1207 private: 1208 int originalFramerate; 1209 int originalAntialias; 1210 int originalMotionBlur; 1211 int originalVsync; 1212 float originalBrightness; 1213 float originalVolume; 1214 1215 idList<vidMode_t> modeList; 1216 }; 1217 1218 idMenuScreen_Shell_SystemOptions() : 1219 options( NULL ), 1220 btnBack( NULL ) { 1221 } 1222 virtual void Initialize( idMenuHandler * data ); 1223 virtual void Update(); 1224 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1225 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1226 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1227 1228 private: 1229 idMenuWidget_DynamicList * options; 1230 idMenuDataSource_SystemSettings systemData; 1231 idMenuWidget_Button * btnBack; 1232 1233 }; 1234 1235 //* 1236 //================================================ 1237 //idMenuScreen_Shell_Stereoscopics 1238 //================================================ 1239 //*/ 1240 class idMenuScreen_Shell_Stereoscopics : public idMenuScreen { 1241 public: 1242 1243 /* 1244 ================================================ 1245 idMenuDataSource_StereoSettings 1246 ================================================ 1247 */ 1248 class idMenuDataSource_StereoSettings : public idMenuDataSource { 1249 public: 1250 enum stereoSettingFields_t { 1251 STEREO_FIELD_ENABLE, 1252 STEREO_FIELD_SEPERATION, 1253 STEREO_FIELD_SWAP_EYES, 1254 MAX_STEREO_FIELDS 1255 }; 1256 1257 idMenuDataSource_StereoSettings(); 1258 1259 // loads data 1260 virtual void LoadData(); 1261 1262 // submits data 1263 virtual void CommitData(); 1264 1265 // says whether something changed with the data 1266 virtual bool IsDataChanged() const; 1267 1268 // retrieves a particular field for reading or updating 1269 virtual idSWFScriptVar GetField( const int fieldIndex ) const; 1270 1271 virtual void AdjustField( const int fieldIndex, const int adjustAmount ); 1272 1273 bool IsRestartRequired() const; 1274 1275 private: 1276 idStaticList< idSWFScriptVar, MAX_STEREO_FIELDS > fields; 1277 idStaticList< idSWFScriptVar, MAX_STEREO_FIELDS > originalFields; 1278 }; 1279 1280 idMenuScreen_Shell_Stereoscopics() : 1281 options( NULL ), 1282 btnBack( NULL ), 1283 leftEyeMat( NULL ), 1284 rightEyeMat( NULL ) { 1285 } 1286 virtual void Initialize( idMenuHandler * data ); 1287 virtual void Update(); 1288 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1289 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1290 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1291 private: 1292 idMenuWidget_DynamicList * options; 1293 idMenuDataSource_StereoSettings stereoData; 1294 idMenuWidget_Button * btnBack; 1295 const idMaterial * leftEyeMat; 1296 const idMaterial * rightEyeMat; 1297 }; 1298 1299 //* 1300 //================================================ 1301 //idMenuScreen_Shell_PartyLobby 1302 //================================================ 1303 //*/ 1304 class idMenuScreen_Shell_PartyLobby : public idMenuScreen { 1305 public: 1306 idMenuScreen_Shell_PartyLobby() : 1307 options( NULL ), 1308 lobby( NULL ), 1309 isHost( false ), 1310 isPeer( false ), 1311 btnBack( NULL ), 1312 inParty( false ) { 1313 } 1314 1315 virtual void Initialize( idMenuHandler * data ); 1316 virtual void Update(); 1317 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1318 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1319 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1320 1321 void UpdateOptions(); 1322 void UpdateLobby(); 1323 bool CanKickSelectedPlayer( lobbyUserID_t & luid ); 1324 void ShowLeaderboards(); 1325 1326 private: 1327 1328 bool isHost; 1329 bool isPeer; 1330 bool inParty; 1331 idMenuWidget_DynamicList * options; 1332 idMenuWidget_LobbyList * lobby; 1333 idMenuWidget_Button * btnBack; 1334 idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions; 1335 }; 1336 1337 //* 1338 //================================================ 1339 //idMenuScreen_Shell_GameLobby 1340 //================================================ 1341 //*/ 1342 class idMenuScreen_Shell_GameLobby : public idMenuScreen { 1343 public: 1344 idMenuScreen_Shell_GameLobby() : 1345 options( NULL ), 1346 lobby( NULL ), 1347 longCountdown( 0 ), 1348 shortCountdown( 0 ), 1349 longCountRemaining( 0 ), 1350 isPeer( false ), 1351 isHost( false ), 1352 privateGameLobby( true ), 1353 btnBack( NULL ) { 1354 } 1355 1356 virtual void Initialize( idMenuHandler * data ); 1357 virtual void Update(); 1358 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1359 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1360 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1361 void UpdateLobby(); 1362 bool CanKickSelectedPlayer( lobbyUserID_t & luid ); 1363 1364 private: 1365 1366 int longCountdown; 1367 int longCountRemaining; 1368 int shortCountdown; 1369 1370 bool isHost; 1371 bool isPeer; 1372 bool privateGameLobby; 1373 1374 idMenuWidget_DynamicList * options; 1375 idMenuWidget_LobbyList * lobby; 1376 idMenuWidget_Button * btnBack; 1377 idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions; 1378 }; 1379 1380 //* 1381 //================================================ 1382 //idMenuScreen_HUD 1383 //================================================ 1384 //*/ 1385 class idMenuScreen_HUD : public idMenuScreen { 1386 public: 1387 1388 idMenuScreen_HUD() : 1389 weaponInfo( NULL ), 1390 playerInfo( NULL ), 1391 audioLog( NULL ), 1392 communication( NULL ), 1393 oxygen( NULL ), 1394 stamina( NULL ), 1395 weaponName( NULL ), 1396 weaponImg( NULL ), 1397 weaponPills( NULL ), 1398 locationName( NULL ), 1399 downloadPda( NULL ), 1400 downloadVideo( NULL ), 1401 newPDA( NULL ), 1402 newVideo( NULL ), 1403 objective( NULL ), 1404 objectiveComplete( NULL ), 1405 tipInfo( NULL ), 1406 healthBorder( NULL ), 1407 healthPulse( NULL ), 1408 armorFrame( NULL ), 1409 security( NULL ), 1410 securityText( NULL ), 1411 newPDADownload( NULL ), 1412 newPDAHeading( NULL ), 1413 newPDAName( NULL ), 1414 newVideoDownload( NULL ), 1415 newVideoHeading( NULL ), 1416 audioLogPrevTime( 0 ), 1417 commPrevTime( 0 ), 1418 oxygenComm( false ), 1419 inVaccuum( false ), 1420 ammoInfo( NULL ), 1421 newWeapon( NULL ), 1422 pickupInfo( NULL ), 1423 cursorState( CURSOR_NONE ), 1424 cursorInCombat( 0 ), 1425 cursorTalking( 0 ), 1426 cursorItem( 0 ), 1427 cursorGrabber( 0 ), 1428 cursorNone( 0 ), 1429 talkCursor( NULL ), 1430 combatCursor( NULL ), 1431 grabberCursor( NULL ), 1432 bsInfo( NULL ), 1433 soulcubeInfo( NULL ), 1434 mpInfo( NULL ), 1435 mpHitInfo( NULL ), 1436 mpTime( NULL ), 1437 mpMessage( NULL ), 1438 mpChat( NULL ), 1439 mpWeapons( NULL ), 1440 newItem( NULL ), 1441 respawnMessage( NULL ), 1442 flashlight( NULL ), 1443 mpChatObject( NULL ), 1444 showSoulCubeInfoOnLoad( false ), 1445 mpConnection( NULL ) { 1446 } 1447 1448 virtual void Initialize( idMenuHandler * data ); 1449 virtual void Update(); 1450 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1451 virtual void HideScreen( const mainMenuTransition_t transitionType ); 1452 1453 void UpdateHealthArmor( idPlayer * player ); 1454 void UpdateStamina( idPlayer * player ); 1455 void UpdateLocation( idPlayer * player ); 1456 void UpdateWeaponInfo( idPlayer * player ); 1457 void UpdateWeaponStates( idPlayer * player, bool weaponChanged ); 1458 void ShowTip( const char * title, const char * tip ); 1459 void HideTip(); 1460 void DownloadVideo(); 1461 void DownloadPDA( const idDeclPDA * pda, bool newSecurity ); 1462 void UpdatedSecurity(); 1463 void ToggleNewVideo( bool show ); 1464 void ClearNewPDAInfo(); 1465 void ToggleNewPDA( bool show ); 1466 void UpdateAudioLog( bool show ); 1467 void UpdateCommunication( bool show, idPlayer * player ); 1468 void UpdateOxygen( bool show, int val = 0 ); 1469 void SetupObjective( const idStr & title, const idStr & desc, const idMaterial * screenshot ); 1470 void SetupObjectiveComplete( const idStr & title ); 1471 void ShowObjective( bool complete ); 1472 void HideObjective( bool complete ); 1473 void GiveWeapon( idPlayer * player, int weaponIndex ); 1474 void UpdatePickupInfo( int index, const idStr & name ); 1475 bool IsPickupListReady(); 1476 void ShowPickups(); 1477 void SetCursorState( idPlayer * player, cursorState_t state, int set ); 1478 void SetCursorText( const idStr & action, const idStr & focus ); 1479 void UpdateCursorState(); 1480 void CombatCursorFlash(); 1481 void UpdateSoulCube( bool ready ); 1482 void ShowRespawnMessage( bool show ); 1483 void SetShowSoulCubeOnLoad( bool show ) { showSoulCubeInfoOnLoad = show; } 1484 1485 // MULTIPLAYER 1486 1487 void ToggleMPInfo( bool show, bool showTeams, bool isCTF = false ); 1488 void SetFlagState( int team, int state ); 1489 void SetTeamScore( int team, int score ); 1490 void SetTeam( int team ); 1491 void TriggerHitTarget( bool show, const idStr & target, int color = 0 ); 1492 void ToggleLagged( bool show ); 1493 void UpdateGameTime( const char * time ); 1494 void UpdateMessage( bool show, const idStr & message ); 1495 void ShowNewItem( const char * name, const char * icon ); 1496 void UpdateFlashlight( idPlayer * player ); 1497 void UpdateChattingHud( idPlayer * player ); 1498 1499 private: 1500 1501 idSWFScriptObject * weaponInfo; 1502 idSWFScriptObject * playerInfo; 1503 idSWFScriptObject * stamina; 1504 idSWFScriptObject * weaponName; 1505 idSWFScriptObject * weaponPills; 1506 idSWFScriptObject * downloadPda; 1507 idSWFScriptObject * downloadVideo; 1508 idSWFScriptObject * tipInfo; 1509 idSWFScriptObject * mpChat; 1510 idSWFScriptObject * mpWeapons; 1511 1512 idSWFSpriteInstance * healthBorder; 1513 idSWFSpriteInstance * healthPulse; 1514 idSWFSpriteInstance * armorFrame; 1515 idSWFSpriteInstance * security; 1516 idSWFSpriteInstance * newPDADownload; 1517 idSWFSpriteInstance * newVideoDownload; 1518 idSWFSpriteInstance * newPDA; 1519 idSWFSpriteInstance * newVideo; 1520 idSWFSpriteInstance * audioLog; 1521 idSWFSpriteInstance * communication; 1522 idSWFSpriteInstance * oxygen; 1523 idSWFSpriteInstance * objective; 1524 idSWFSpriteInstance * objectiveComplete; 1525 idSWFSpriteInstance * ammoInfo; 1526 idSWFSpriteInstance * weaponImg; 1527 idSWFSpriteInstance * newWeapon; 1528 idSWFSpriteInstance * pickupInfo; 1529 idSWFSpriteInstance * talkCursor; 1530 idSWFSpriteInstance * combatCursor; 1531 idSWFSpriteInstance * grabberCursor; 1532 idSWFSpriteInstance * bsInfo; 1533 idSWFSpriteInstance * soulcubeInfo; 1534 idSWFSpriteInstance * newItem; 1535 idSWFSpriteInstance * respawnMessage; 1536 idSWFSpriteInstance * flashlight; 1537 idSWFSpriteInstance * mpChatObject; 1538 idSWFSpriteInstance * mpConnection; 1539 1540 idSWFSpriteInstance * mpInfo; 1541 idSWFSpriteInstance * mpHitInfo; 1542 1543 idSWFTextInstance * locationName; 1544 idSWFTextInstance * securityText; 1545 idSWFTextInstance * newPDAName; 1546 idSWFTextInstance * newPDAHeading; 1547 idSWFTextInstance * newVideoHeading; 1548 1549 idSWFTextInstance * mpMessage; 1550 idSWFTextInstance * mpTime; 1551 1552 int audioLogPrevTime; 1553 int commPrevTime; 1554 1555 bool oxygenComm; 1556 bool inVaccuum; 1557 1558 idStr objTitle; 1559 idStr objDesc; 1560 const idMaterial * objScreenshot; 1561 idStr objCompleteTitle; 1562 1563 cursorState_t cursorState; 1564 int cursorInCombat; 1565 int cursorTalking; 1566 int cursorItem; 1567 int cursorGrabber; 1568 int cursorNone; 1569 idStr cursorAction; 1570 idStr cursorFocus; 1571 1572 bool showSoulCubeInfoOnLoad; 1573 }; 1574 1575 //* 1576 //================================================ 1577 //idMenuScreen_Scoreboard 1578 //================================================ 1579 //*/ 1580 class idMenuScreen_Scoreboard : public idMenuScreen { 1581 public: 1582 1583 idMenuScreen_Scoreboard() : 1584 playerList( NULL ) { 1585 1586 } 1587 1588 virtual void Initialize( idMenuHandler * data ); 1589 virtual void Update(); 1590 virtual void ShowScreen( const mainMenuTransition_t transitionType ); 1591 virtual bool HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled = false ); 1592 1593 virtual void SetPlayerData( idList< scoreboardInfo_t, TAG_IDLIB_LIST_MENU > data ); 1594 virtual void UpdateTeamScores( int r, int b ); 1595 virtual void UpdateGameInfo( idStr gameInfo ); 1596 virtual void UpdateSpectating( idStr spectating, idStr follow ); 1597 virtual void UpdateHighlight(); 1598 1599 protected: 1600 idMenuWidget_ScoreboardList * playerList; 1601 1602 }; 1603 1604 //* 1605 //================================================ 1606 //idMenuScreen_Scoreboard_CTF 1607 //================================================ 1608 //*/ 1609 class idMenuScreen_Scoreboard_CTF : public idMenuScreen_Scoreboard { 1610 public: 1611 virtual void Initialize( idMenuHandler * data ); 1612 }; 1613 1614 //* 1615 //================================================ 1616 //idMenuScreen_Scoreboard_Team 1617 //================================================ 1618 //*/ 1619 class idMenuScreen_Scoreboard_Team : public idMenuScreen_Scoreboard { 1620 public: 1621 virtual void Initialize( idMenuHandler * data ); 1622 }; 1623 1624 1625 /* 1626 ======================== 1627 InvitePartyOrFriends 1628 1629 Invites the master local user's party, if he's in one and the party isn't in the lobby already. 1630 Otherwise brings up the invite friends system menu. 1631 ======================== 1632 */ 1633 inline void InvitePartyOrFriends() { 1634 const idLocalUser * const user = session->GetSignInManager().GetMasterLocalUser(); 1635 if ( user != NULL && user->IsInParty() && user->GetPartyCount() > 1 && !session->IsPlatformPartyInLobby() ) { 1636 session->InviteParty(); 1637 } else { 1638 session->InviteFriends(); 1639 } 1640 } 1641 1642 #endif