changeset 207:8e3fea954768

10.01.13(MainMenu)
author Ritor1
date Thu, 10 Jan 2013 18:03:33 +0600
parents c38d2f00e3ad
children af624eaf2fc5
files Game.cpp mm7_2.cpp mm7_5.cpp
diffstat 3 files changed, 99 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Wed Jan 09 17:32:10 2013 +0600
+++ b/Game.cpp	Thu Jan 10 18:03:33 2013 +0600
@@ -718,7 +718,7 @@
   if (pMouse)
     pMouse->Deactivate();
 
-  pAudioPlayer->Release();
+  pAudioPlayer->Release();//error
   pNew_LOD->FreeSubIndexAndIO();
   pGames_LOD->FreeSubIndexAndIO();
   ClipCursor(0);
--- a/mm7_2.cpp	Wed Jan 09 17:32:10 2013 +0600
+++ b/mm7_2.cpp	Thu Jan 10 18:03:33 2013 +0600
@@ -12049,7 +12049,7 @@
   GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27
   GUIWindow *pWindow; // [sp+4h] [bp-38h]@11
   
-  pCurrentScreen = 0;
+  pCurrentScreen = 0; // окно Главное меню
   if (pAsyncMouse)
     pAsyncMouse->Resume();
   if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
@@ -12060,16 +12060,19 @@
   ++pIcons_LOD->uTexturePacksCount;
   if ( !pIcons_LOD->uNumPrevLoadedFiles )
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-  pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
-  auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 78, "", pNew, 0);
+  pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); // создание окна
+  auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); // создание кнопок
+  pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, 
+                                                    UIMSG_MainMenu_ShowPartyCreationWnd, 0, 78, "", pNew, 0);
   auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow,
-                                                    1, 76, "", pLoad, 0);
+  pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, 
+                                                     UIMSG_MainMenu_ShowLoadWindow, 1, 76, "", pLoad, 0);
   auto pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 67, "", pCredits, 0);
+  pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, 
+                                                         UIMSG_ShowCredits, 2, 67, "", pCredits, 0);
   auto pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0);
+  pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, 
+                                                        UIMSG_ExitToWindows, 3, 0, "", pExit, 0);
   pTexture_PCX.Release();
   pTexture_PCX.Load("title.pcx", 0);
   SetCurrentMenuID(MENU_MAIN);
@@ -12080,21 +12083,21 @@
     POINT pt;
     pMouse->GetCursorPos(&pt);
     pWindow = pWindow_MainMenu;
-    if ( GetCurrentMenuID() == MENU_SAVELOAD)
-    {
-      if ( pCurrentScreen != 12 )
+    if ( GetCurrentMenuID() == MENU_SAVELOAD)//если меню загрузки
+    {
+      if ( pCurrentScreen != 12 )//если не окно загрузки игры
       {
         pTexture_PCX.Release();
         pTexture_PCX.Load("lsave640.pcx", 0);
         pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
-        pCurrentScreen = 12;
-        GameUI_DrawLoadMenu(0);
+        pCurrentScreen = 12; //окно загрузки игры
+        GameUI_DrawLoadMenu(0);//процесс прорисовки окна Загрузка
       }
       pWindow = pGUIWindow_CurrentMenu;
     }
 
     MSG msg;
-    while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) )
+    while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) )//ожидание сообщения из внешнего источника
     {
       if (msg.message == WM_QUIT)
         Game_DeinitializeAndTerminate(0);
@@ -12111,13 +12114,13 @@
       pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
       if (pAsyncMouse)
         pAsyncMouse->_46B736_consume_click_lists(1);
-      GUI_MainMenuMessageProc();
+      GUI_MainMenuMessageProc();//процедура проверки сообщений поступающих из внешних устройств для всей группы вступительных окон
       GUI_UpdateWindows();
       if (pAsyncMouse)
         pAsyncMouse->_46B736_consume_click_lists(1);
-      if (GetCurrentMenuID() != MENU_MAIN)
-      {
-        if (GetCurrentMenuID() == MENU_LOAD)
+      if (GetCurrentMenuID() != MENU_MAIN)// если не Главное меню
+      {
+        if (GetCurrentMenuID() == MENU_LOAD)// если меню Загрузка
         {
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
@@ -12138,25 +12141,25 @@
                 && pWindow == pWindow_MainMenu )
            {
             pControlParam = pButton->uControlParam;
-            switch (pControlParam)
-			{
-			 case 0:
-			  pTexture = pNew;
+            switch (pControlParam) // подсветка кнопок
+            {
+              case 0:
+              pTexture = pNew;
               pY = 172;
-			  break;
-			 case 1:
-			  pTexture = pLoad;
+              break;
+              case 1:
+              pTexture = pLoad;
               pY = 227;
-			  break;
-			 case 2:
-			  pTexture = pCredits;
+              break;
+              case 2:
+              pTexture = pCredits;
               pY = 282;
-			  break;
-			 case 3:
-			  pTexture = pExit;
+              break;
+              case 3:
+              pTexture = pExit;
               pY = 337;
-			  break;
-			}
+              break;
+            }
             pRenderer->DrawTextureIndexed(495, pY, pTexture); //подсветка кнопок
            }
           }
@@ -12166,12 +12169,12 @@
       pRenderer->Present();
     }
   }
-  GUI_MainMenuMessageProc();
+  /*GUI_MainMenuMessageProc(); //Ritor1: unknow
   pRenderer->BeginScene();
   GUI_UpdateWindows();
   pRenderer->EndScene();
   pRenderer->Present();
-  pTexture_PCX.Release();
+  pTexture_PCX.Release();*/
   if ( pGUIWindow2 )
   {
     pGUIWindow2->Release();
@@ -13982,54 +13985,61 @@
     Log::Warning(L"MM: entering main loop");
     while ( 1 )
     {
-      MainMenu_Loop();
-LABEL_21:
+      MainMenu_Loop(); // прорисовка Главного меню и тут же прорисовка меню Загрузка
       uGameState = 0;
+//LABEL_21:
       while ( 1 )
       {
         switch (uGameState)
         {
-          case GAME_FINISHED:
+          case GAME_FINISHED: // выход из игры
             pGame->Deinitialize();
-            return true;
-        }
-
-        if (GetCurrentMenuID() == MENU_FINISHED)
+            return true; // выход из функции MM_Main в Win_Main
+        }
+        if (GetCurrentMenuID() == MENU_FINISHED) // меню Выход
         {
           uGameState = GAME_FINISHED;
-          continue;
-        }
-        if (GetCurrentMenuID() == MENU_NEWGAME)
+          continue; // в начало цикла
+        }
+        if (GetCurrentMenuID() == MENU_NEWGAME)                // меню Новая игра
         {
           if ( pAudioPlayer->hAILRedbook )
-            AIL_redbook_stop(pAudioPlayer->hAILRedbook);
-          pParty->Reset();
-
+            AIL_redbook_stop(pAudioPlayer->hAILRedbook);      // остановить музыку
+          pParty->Reset();                                    // сброс группы
           for (uint k = 0; k < 50; ++k)
             pOtherOverlayList->pOverlays[k].Reset();
-
-          strcpy(pCurrentMapName, pStartingMapName);
-          pParty->CreateDefaultParty(0);
+          strcpy(pCurrentMapName, pStartingMapName);         // текущая карта
+          pParty->CreateDefaultParty(0);                     // создать группу по умолчанию
           PlayerCreationUI_Initialize();
-          if ( PlayerCreationUI_Loop() )
+          if ( PlayerCreationUI_Loop() )                    //процесс создания группы
           {
             DeleteCCharFont();
-            goto LABEL_53;
+            break;// выход из цикла
           }
           DeleteCCharFont();
           bFlashQuestBook = true;
-          pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);
-          Autosave();
-          goto LABEL_48;
-        }
-        if (GetCurrentMenuID() == MENU_CREDITS)
-          break;
-        if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOAD)
-        {
+          pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);       //заставка
+          Autosave();                                       //автосохранение
+          //goto LABEL_48;
+          pGame->Loop(); // процесс игры
+          break; // выход из цикла
+        }
+        if (GetCurrentMenuID() == MENU_CREDITS) // меню Создатели
+        {
+         if ( pAudioPlayer->hAILRedbook )
+          AIL_redbook_stop(pAudioPlayer->hAILRedbook);// отключить звук
+         extern MENU_STATE __cdecl CreditsMenu__Loop();
+         CreditsMenu__Loop(); // процесс воспроизведения окна Создатели
+         break;
+        }
+        if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOAD) //??? неизвестно что это
+          __debugbreak();
+        /*{
           uGameState = 0;
-        }
+        }*/
         else
-        {
+         __debugbreak();
+        /*{
           if (GetCurrentMenuID() != MENU_10)
             goto LABEL_49;
           pMouse->Activate(0);
@@ -14048,7 +14058,7 @@
               pAsyncMouse->Resume();
             if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
               pAsyncKeyboard->Resume();
-            goto LABEL_53;
+            break;
           }
           _chdir("..\\");
           strcpy(pCurrentMapName, ofn.lpstrFileTitle);
@@ -14058,40 +14068,38 @@
           if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
             pAsyncKeyboard->Resume();
         }
-LABEL_48:
-        pGame->Loop();
-LABEL_49:
+//LABEL_48:
+//        pGame->Loop(); //game
+LABEL_49:*/
         if ( uGameState == 3 )
-        {
+          __debugbreak();
+        /*{
           v12 = 5;
-          //goto LABEL_57;
-		  SetCurrentMenuID((MENU_STATE)v12);
-          goto LABEL_21;
-        }
+          SetCurrentMenuID((MENU_STATE)v12);
+          //goto LABEL_21;
+          uGameState = 0;
+          continue;
+        }*/
         if ( uGameState == 4 )
-        {
+          __debugbreak();
+        /*{
           v12 = 1;
-//LABEL_57:
           SetCurrentMenuID((MENU_STATE)v12);
-          goto LABEL_21;
-        }
+          //goto LABEL_21;
+          uGameState = 0;
+          continue;
+        }*/
         if ( uGameState == 7 )
-        {
+          __debugbreak();
+        /*{
           pAudioPlayer->StopChannels(-1, -1);
           uGameState = 0;
-          goto LABEL_53;
-        }
-      }
-      if ( pAudioPlayer->hAILRedbook )
-        AIL_redbook_stop(pAudioPlayer->hAILRedbook);
-
-      extern MENU_STATE __cdecl CreditsMenu__Loop();
-      CreditsMenu__Loop();
-
-LABEL_53:
+          break;
+        }*/
+      }
       if (!bNoSound && pAudioPlayer->hAILRedbook)
       {
-        pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
+        pAudioPlayer->SetMusicVolume((pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
         AIL_redbook_stop(pAudioPlayer->hAILRedbook);
         unsigned int end_ms;
         AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms);
@@ -14100,8 +14108,7 @@
     }
   }
   else
-    Log::Warning(L"MM init: failed");
-
+  Log::Warning(L"MM init: failed");
   pGame->Deinitialize();
 }
 
--- a/mm7_5.cpp	Wed Jan 09 17:32:10 2013 +0600
+++ b/mm7_5.cpp	Thu Jan 10 18:03:33 2013 +0600
@@ -3388,7 +3388,7 @@
             pSex = pCurrentPlayer->GetSexByVoice();
             do
             {
-              v12 = ((pCurrentPlayer->uVoiceID-- - 1) & 0x80000000u) != 0;
+              v12 = (/*(*/pCurrentPlayer->uVoiceID-- - 1/*) & 0x80000000u */) != 0;
               if ( v12 )
                 pCurrentPlayer->uVoiceID = 19;
               v13 = pCurrentPlayer->GetSexByVoice();