home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 80 / XENIATGM80.iso / Goodies / Blood 2 / Source / data.z / MenuMain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-02  |  2.6 KB  |  109 lines

  1. // MenuMain.cpp: implementation of the CMenuMain class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4.  
  5. #include "MenuBase.h"
  6. #include "MenuMain.h"
  7. #include "MainMenus.h"
  8. #include "MenuCommands.h"
  9. #include "BloodClientShell.h"
  10. #include "Splash.h"
  11. #include "VKDefs.h"
  12. #include "ClientRes.h"
  13.  
  14. //////////////////////////////////////////////////////////////////////
  15. // Construction/Destruction
  16. //////////////////////////////////////////////////////////////////////
  17.  
  18. CMenuMain::CMenuMain()
  19. {
  20.  
  21. }
  22.  
  23. CMenuMain::~CMenuMain()
  24. {
  25.  
  26. }
  27.  
  28. // Build the menu
  29. void CMenuMain::Build()
  30. {
  31.     // Make sure to call the base class
  32.     CMenuBase::Build();
  33.  
  34.     CreateTitle("interface\\mainmenus\\mainmenu.pcx", IDS_MENU_TITLE_MAINMENU, m_pMainMenus->GetTitlePos());    
  35.     SetOptionPos(m_pMainMenus->GetOptionsPos());
  36.     SetItemSpacing(0);    
  37.  
  38.     AddLargeTextItemOption(IDS_MENU_MAIN_SINGLEPLAYER,    MENU_CMD_SINGLE_PLAYER);
  39.     AddLargeTextItemOption(IDS_MENU_MAIN_BLOODBATH,        MENU_CMD_BLOODBATH);
  40.     AddLargeTextItemOption(IDS_MENU_MAIN_OPTIONS,        MENU_CMD_OPTIONS);
  41.  
  42. #ifdef _DEMO
  43.     AddLargeTextItemOption(IDS_MENU_MAIN_PRIMEGIBS,        MENU_CMD_CREDITS);
  44. #else
  45.     AddLargeTextItemOption(IDS_MENU_MAIN_CREDITS,        MENU_CMD_CREDITS);
  46. #endif
  47.  
  48.     AddLargeTextItemOption(IDS_MENU_MAIN_QUIT,            MENU_CMD_QUIT);
  49. }
  50.  
  51. DDWORD CMenuMain::OnCommand(DDWORD dwCommand, DDWORD dwParam1, DDWORD dwParam2)
  52. {    
  53.     switch(dwCommand)
  54.     {
  55.     case MENU_CMD_SINGLE_PLAYER:
  56.         {
  57.             m_pMainMenus->SetCurrentMenu(MENU_ID_SINGLEPLAYER);
  58.             break;
  59.         }
  60.     case MENU_CMD_BLOODBATH:
  61.         {
  62. #ifdef _DEMO
  63.             Splash_SetState(m_pClientDE, "\\screens\\bloodbath.pcx");
  64. #else
  65.             m_pMainMenus->SetCurrentMenu(MENU_ID_BLOODBATH);
  66. #endif
  67.             break;
  68.         }
  69.     case MENU_CMD_OPTIONS:
  70.         {
  71.             m_pMainMenus->SetCurrentMenu(MENU_ID_OPTIONS);
  72.             break;
  73.         }
  74.     case MENU_CMD_CREDITS:
  75.         {
  76. #ifdef _DEMO
  77.             Splash_SetState(m_pClientDE, "\\screens\\info.pcx");
  78. #else
  79.             g_pBloodClientShell->MenuCredits();
  80. #endif
  81.             break;
  82.         }
  83.     case MENU_CMD_QUIT:
  84.         {
  85. #ifdef _DEMO
  86.             Splash_SetState(m_pClientDE, "\\screens\\info.pcx", DTRUE);
  87. #else                    
  88.             // Show the confirmation dialogbox
  89.             m_pMainMenus->DoMessageBox(IDS_MENU_MESSAGE_QUIT, this);
  90.             m_pMainMenus->AddMessageKey(m_pMainMenus->GetYesVKeyCode(), MENU_CMD_EXIT);
  91.             m_pMainMenus->AddMessageKey(m_pMainMenus->GetNoVKeyCode(), MENU_CMD_KILL_MESSAGEBOX);
  92.             m_pMainMenus->AddMessageKey(VK_ESCAPE, MENU_CMD_KILL_MESSAGEBOX);                        
  93. #endif
  94.             break;
  95.         }
  96.     case MENU_CMD_EXIT:
  97.         {
  98.             m_pMainMenus->KillMessageBox();
  99.             g_pBloodClientShell->MenuQuit();
  100.             break;
  101.         }
  102.     case MENU_CMD_KILL_MESSAGEBOX:
  103.         {
  104.             m_pMainMenus->KillMessageBox();
  105.             break;
  106.         }
  107.     }
  108.     return 0;
  109. }