diff mm7_2.cpp @ 169:d1dde383af89

Merge
author Nomad
date Thu, 14 Feb 2013 14:03:17 +0200
parents ee11772d0ad2 572d821561f3
children 91fa025e6ca6 27573ee0d434
line wrap: on
line diff
--- a/mm7_2.cpp	Thu Feb 14 13:58:34 2013 +0200
+++ b/mm7_2.cpp	Thu Feb 14 14:03:17 2013 +0200
@@ -4400,20 +4400,8 @@
         v3 = byte_591180;
         do
         {
-          array_5913D8[v2 + 7] = (NPCData *)ptr_507BC0->CreateButton(
-                                              *(&_4E5E50_transui_x + v2 + 6 * v1 - 6),
-                                              *(&_4E5EE0_transui_y + v2 + 6 * v1 - 6),
-                                              0x3Fu,
-                                              0x49u,
-                                              1,
-                                              0,
-                                              0x19Au,
-                                              v2,
-                                              0,
-                                              v3,
-                                              0,
-                                              0,
-                                              0);
+          array_5913D8[v2 + 7] = (NPCData *)ptr_507BC0->CreateButton(*(&pNPCPortraits_x + v2 + 6 * v1 - 6), *(&pNPCPortraits_y + v2 + 6 * v1 - 6),
+                                              0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, v3, 0, 0, 0);
           v1 = uNumDialogueNPCPortraits;
           ++v2;
           v3 += 100;
@@ -4518,7 +4506,7 @@
 
   v0 = pPlayers[uActiveCharacter];
   v77 = pPlayers[uActiveCharacter];
-  if ( pCurrentScreen == 14 )
+  if ( pCurrentScreen == SCREEN_E )
     goto LABEL_73;
   if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
   {
@@ -5101,7 +5089,7 @@
   pRenderer->ClearBlack();
   pRenderer->EndScene();
   pRenderer->Present();
-  pVideoPlayer->field_40 = 0;
+  pVideoPlayer->pResetflag = 0;
   _449B57_test_bit(pParty->_award_bits, 99);
   _this.Load("winbg.pcx", 2);
   pRenderer->BeginScene();
@@ -11439,7 +11427,7 @@
   GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
   GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B);
   pRenderer->BeginScene();
-  if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOAD )
+  if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOADINGPROC )
   {
     pRenderer->DrawTextureIndexed(8, 8, uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0);
     if ( a4 )
@@ -11542,7 +11530,7 @@
     if ( pGUIWindow_CurrentMenu->field_40 == 3 )
       pGUIWindow_CurrentMenu->field_40 = 0;
   }
-  if (GetCurrentMenuID() == MENU_LOAD)
+  if (GetCurrentMenuID() == MENU_LOADINGPROC)
   {
     //v18 = pGlobalTXT_LocalizationStrings[135];
     v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка"
@@ -12038,7 +12026,7 @@
   GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27
   GUIWindow *pWindow; // [sp+4h] [bp-38h]@11
   
-  pCurrentScreen = 0; // окно Главное меню
+  pCurrentScreen = SCREEN_GAME;
   if (pAsyncMouse)
     pAsyncMouse->Resume();
   if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
@@ -12049,8 +12037,8 @@
   ++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); // создание кнопок
+  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);
@@ -12072,21 +12060,21 @@
     POINT pt;
     pMouse->GetCursorPos(&pt);
     pWindow = pWindow_MainMenu;
-    if ( GetCurrentMenuID() == MENU_SAVELOAD)//если меню загрузки
-    {
-      if ( pCurrentScreen != 12 )//если не окно загрузки игры
+    if ( GetCurrentMenuID() == MENU_SAVELOAD)
+    {
+      if ( pCurrentScreen != SCREEN_LOADGAME )
       {
         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 = SCREEN_LOADGAME;
+        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);
@@ -12103,18 +12091,18 @@
       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_LOADINGPROC)
         {
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
           pGUIWindow_CurrentMenu = 0;
-          pCurrentScreen = 0;
+          pCurrentScreen = SCREEN_GAME;
           viewparams->bRedrawGameUI = 1;
         }
       }
@@ -12497,7 +12485,7 @@
           goto LABEL_104;
         }
         if ( pCurrentScreen
-          && pCurrentScreen != 21 )
+          && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
           return 0;
       }
       if ( !viewparams->field_4C )
@@ -13485,6 +13473,7 @@
   
 
   pParty = new Party;
+  memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings));
   pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile);
   pParty->uDefaultEyelevel = GetPrivateProfileIntW(L"party", L"eyelevel", 160, pMM6IniFile);
   pParty->sEyelevel = pParty->uDefaultEyelevel;
@@ -13978,54 +13967,59 @@
     Log::Warning(L"MM: entering main loop");
     while ( 1 )
     {
-      MainMenu_Loop(); // прорисовка Главного меню и тут же прорисовка меню Загрузка
+      MainMenu_Loop();
       uGameState = 0;
 //LABEL_21:
       while ( 1 )
       {
         switch (uGameState)
         {
-          case GAME_FINISHED: // выход из игры
+          case GAME_FINISHED:
             pGame->Deinitialize();
-            return true; // выход из функции MM_Main в Win_Main
-        }
-        if (GetCurrentMenuID() == MENU_FINISHED) // меню Выход
+            return true;
+        }
+        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();
-            break;// выход из цикла
+            break;
           }
           DeleteCCharFont();
           bFlashQuestBook = true;
-          pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);       //заставка
-          Autosave();                                       //автосохранение
-          //goto LABEL_48;
-          pGame->Loop(); // процесс игры
-          break; // выход из цикла
-        }
-        if (GetCurrentMenuID() == MENU_CREDITS) // меню Создатели
+          pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);
+          Autosave();
+          pGame->Loop();
+          if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU )
+          {
+            SetCurrentMenuID(MENU_NEWGAME);
+            uGameState = 0;
+            continue;
+          }
+          break;
+        }
+        if (GetCurrentMenuID() == MENU_CREDITS)
         {
          if ( pAudioPlayer->hAILRedbook )
-          AIL_redbook_stop(pAudioPlayer->hAILRedbook);// отключить звук
+          AIL_redbook_stop(pAudioPlayer->hAILRedbook);
          extern MENU_STATE __cdecl CreditsMenu__Loop();
-         CreditsMenu__Loop(); // процесс воспроизведения окна Создатели
+         CreditsMenu__Loop();
          break;
         }
-        if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOAD) //??? неизвестно что это
+        if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOADINGPROC)
         {
           uGameState = 0;
         }
@@ -14061,7 +14055,7 @@
             pAsyncKeyboard->Resume();
         }*/
 //LABEL_48:
-        pGame->Loop(); //game
+        pGame->Loop();
 LABEL_49:
         if ( uGameState == 3 )
           __debugbreak();
@@ -14072,7 +14066,7 @@
           uGameState = 0;
           continue;
         }*/
-        if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU )//press NewGame button out GameMenu window
+        if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU )
         {
           SetCurrentMenuID(MENU_NEWGAME);
           uGameState = 0;
@@ -14374,10 +14368,11 @@
     case MENU_FINISHED:    return L"MENU_FINISHED";
     case MENU_5:           return L"MENU_5";
     case MENU_CREATEPARTY: return L"MENU_CREATEPARTY";
-    case MENU_7:           return L"MENU_7";
-    case MENU_Credits:     return L"MENU_Credits";
-    case MENU_LOAD:        return L"MENU_LOAD";
+    case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC";
+    case MENU_CREDITSPROC: return L"MENU_CREDITSPROC";
+    case MENU_LOADINGPROC: return L"MENU_LOADINGPROC";
     case MENU_10:          return L"MENU_10";
+    case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE";
     default:               return L"unk";
   };
 };
@@ -14991,7 +14986,7 @@
 }
 
 //----- (00467FB6) --------------------------------------------------------
-char __cdecl sub_467FB6()
+char __cdecl CreateScrollWindow()
 {
   unsigned int v0; // eax@1
   char *v1; // ST18_4@3
@@ -15821,7 +15816,7 @@
       }
       if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 )
         return 1;
-      if ( pCurrentScreen != 19 )
+      if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
         goto LABEL_13;
       break;
   }
@@ -16345,7 +16340,7 @@
       UI_CreateTravelDialogue();
     }
   }
-  //UpdateActors_ODM();Ritor1: it's temporarily
+  UpdateActors_ODM();
   _46CC4B_check_event_triggers();
 }