changeset 2098:7810cb3a5fb7

Popup window in MainMenu not shown
author Ritor1
date Fri, 13 Dec 2013 16:10:36 +0600
parents 2b39f6b451f9
children 7edf389d49fc
files GUIProgressBar.cpp IconFrameTable.cpp Mouse.cpp Render.cpp UI/UIPopup.cpp mm7_2.cpp
diffstat 6 files changed, 112 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/GUIProgressBar.cpp	Fri Dec 13 11:51:51 2013 +0600
+++ b/GUIProgressBar.cpp	Fri Dec 13 16:10:36 2013 +0600
@@ -177,10 +177,6 @@
 //----- (00443670) --------------------------------------------------------
 void GUIProgressBar::Draw()
 {
-  IconFrame *v3; // eax@10
-  float v4; // ST2C_4@10
-
-  //v1 = this;
   pRenderer->BeginScene();
   if (uType != TYPE_Fullscreen)
   {
@@ -191,19 +187,15 @@
         if (!pRenderer->bWindowMode)
           pRenderer->_49FD3A();
       }
-      pRenderer->DrawTextureIndexed(0x50u, 0x7Au, &pBardata);
-      v3 = pIconsFrameTable->GetFrame(uIconID_TurnHour, 0);
-      pRenderer->DrawTextureTransparent(0x64u, 0x92u, &pIcons_LOD->pTextures[v3->uTextureID]);
-      v4 = (double)(113 * uProgressCurrent) / (double)uProgressMax;
-      pRenderer->FillRectFast(
-        174,
-        164,
-        floorf(v4 + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
-        16,
-        pRenderer->uTargetRMask);
-        pRenderer->EndScene();
-		pRenderer->Present();
-		return;
+      pRenderer->DrawTextureIndexed(80, 122, &pBardata);//прогрессбар для данжей
+      pRenderer->DrawTextureTransparent(100, 146, &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->uTextureID]);
+      //pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
+        //16, pRenderer->uTargetRMask);
+      pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
+        16, 0xF800);
+      pRenderer->EndScene();
+      pRenderer->Present();
+      return;
     }
     pRenderer->EndScene();
     return;
@@ -211,16 +203,14 @@
 
   if (!pLoadingBg.pPixels)
   {
-	pRenderer->EndScene();
+    pRenderer->EndScene();
     return;
   }
 
   pRenderer->DrawTextureRGB(0, 0, &pLoadingBg);
-  pRenderer->SetRasterClipRect(0, 0, 0x27Fu, 0x1DFu);
-  pRenderer->SetTextureClipRect(0xACu, 0x1CBu,
-    15 * (signed int)(signed __int64)((double)(300 * uProgressCurrent) / (double)uProgressMax) / 15 + 172,
-    0x1D7u);
-  pRenderer->DrawTextureTransparent(0xACu, 0x1CBu, &pLoadingProgress);
+  pRenderer->SetRasterClipRect(0, 0, 639, 479);
+  pRenderer->SetTextureClipRect(172, 459, 15 * (signed int)(signed __int64)((double)(300 * uProgressCurrent) / (double)uProgressMax) / 15 + 172, 471);
+  pRenderer->DrawTextureTransparent(172, 459, &pLoadingProgress);
   pRenderer->ResetTextureClipRect();
   pRenderer->EndScene();
   pRenderer->Present();
--- a/IconFrameTable.cpp	Fri Dec 13 11:51:51 2013 +0600
+++ b/IconFrameTable.cpp	Fri Dec 13 16:10:36 2013 +0600
@@ -36,34 +36,32 @@
 //----- (00494F70) --------------------------------------------------------
 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID)
 {
-  IconFrame *v3; // edi@1
+  //IconFrame *v3; // edi@1
   IconFrame *v4; // ecx@1
-  __int16 v5; // dx@2
+  //__int16 v5; // dx@2
   int v6; // edx@3
-  unsigned int v7; // eax@3
+  //unsigned int v7; // eax@3
   char *i; // ecx@3
   int v9; // esi@5
   IconFrame *result; // eax@6
 
-  v3 = this->pIcons;
-  v4 = &v3[uIconID];
-  if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 )
+  v4 = &this->pIcons[uIconID];
+  if ( v4->uFlags & 1 && v4->uAnimLength != 0 )
   {
-    v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5;
-    v7 = uIconID;
+    v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v4->uAnimLength;
     for ( i = (char *)&v4->uAnimTime; ; i += 32 )
     {
       v9 = *(short *)i;
       if ( v6 <= v9 )
         break;
       v6 -= v9;
-      ++v7;
+      ++uIconID;
     }
-    result = &v3[v7];
+    result = &this->pIcons[uIconID];
   }
   else
   {
-    result = &v3[uIconID];
+    result = &this->pIcons[uIconID];
   }
   return result;
 }
--- a/Mouse.cpp	Fri Dec 13 11:51:51 2013 +0600
+++ b/Mouse.cpp	Fri Dec 13 16:10:36 2013 +0600
@@ -144,27 +144,27 @@
 //----- (00469BA3) --------------------------------------------------------
 void Mouse::ClearCursor()
 {
-  Mouse *v1; // esi@1
-  void *v2; // eax@1
-  void **v3; // esi@5
+  //Mouse *v1; // esi@1
+  //void *v2; // eax@1
+  //void **v3; // esi@5
 
-  v1 = this;
-  v2 = this->pCursorBitmap_sysmem;
+  //v1 = this;
+  //v2 = this->pCursorBitmap_sysmem;
   this->bActive = 0;
-  if ( v2 )
+  if ( this->pCursorBitmap_sysmem )
   {
-    free(v2);
-    v1->pCursorBitmap_sysmem = 0;
+    free(this->pCursorBitmap_sysmem);
+    this->pCursorBitmap_sysmem = 0;
   }
-  if ( v1->pCursorBitmap2_sysmem )
+  if ( this->pCursorBitmap2_sysmem )
   {
-    free(v1->pCursorBitmap2_sysmem);
-    v1->pCursorBitmap2_sysmem = 0;
+    free(this->pCursorBitmap2_sysmem);
+    this->pCursorBitmap2_sysmem = 0;
   }
-  v3 = &v1->ptr_90;
-  if ( *v3 )
-    free(*v3);
-  *v3 = 0;
+  //v3 = &this->ptr_90;
+  if ( this->ptr_90 )
+    free(this->ptr_90);
+  this->ptr_90 = 0;
 }
 
 //----- (00469BE6) --------------------------------------------------------
@@ -468,34 +468,27 @@
 //----- (004175C0) --------------------------------------------------------
 void UI_OnMouseLeftClick(int *pXY)
 {
-  int *pXY_; // esi@1
   signed int y; // eax@7
   signed int x; // ecx@7
-  signed int v4; // eax@11
   signed int v5; // eax@17
-  signed int v6; // esi@19
-  int v7; // esi@30
-  GUIWindow *v8; // edx@31
-  GUIButton *i; // esi@37
+  GUIButton *control; // esi@37
   signed int v10; // eax@50
   int v11; // ecx@52
   unsigned int pX; // [sp+14h] [bp-8h]@7
   unsigned int pY; // [sp+18h] [bp-4h]@7
 
-  pXY_ = pXY;
-  if ( pCurrentScreen == SCREEN_VIDEO
-    || sub_4637E0_is_there_popup_onscreen() )
+  if ( pCurrentScreen == SCREEN_VIDEO || sub_4637E0_is_there_popup_onscreen() )
     return;
   if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 )
   {
     sub_4452BB();
     return;
   }
-  if ( pXY_ )
+  if ( pXY )
   {
-    x = *pXY_;
-    y = pXY_[1];
-    pX = *pXY_;
+    x = *pXY;
+    y = pXY[1];
+    pX = *pXY;
     pY = y;
   }
   else
@@ -506,81 +499,83 @@
   }
 
   extern bool _507B98_ctrl_pressed;
-  if ( pCurrentScreen != SCREEN_GAME || !_507B98_ctrl_pressed ) // stealing cursor
-    goto LABEL_30;
-  v4 = GetCurrentMenuID();
   x = pX;
-  if ( v4 != -1
-    || (signed int)pX < (signed int)pViewport->uViewportTL_X
-    || (signed int)pX > (signed int)pViewport->uViewportBR_X )
+  if ( GetCurrentMenuID() != -1 || pCurrentScreen != SCREEN_GAME || !_507B98_ctrl_pressed // stealing cursor
+      || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X
+      || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y)
   {
     y = pY;
-LABEL_30:
-    v7 = uNumVisibleWindows;
-    if ( uNumVisibleWindows < 0 )
-      return;
-    while ( 1 )
-    {
-      //v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]];
-      v8 = &pWindowList[pVisibleWindowsIdxs[v7] - 1];
-      if ( x >= (signed int)v8->uFrameX )
-      {
-        if ( x <= (signed int)v8->uFrameZ && y >= (signed int)v8->uFrameY && y <= (signed int)v8->uFrameW )
-          break;
-      }
-      --v7;
-      if ( v7 < 0 )
-        return;
-    }
-    for ( i = v8->pControlsHead; ; i = i->pNext )
+    for ( int i = uNumVisibleWindows; i >= 0; --i )
     {
-      if ( !i )
-        return;
-      if ( i->uButtonType == 1 )
-        goto LABEL_41;
-      if ( i->uButtonType != 2 )
-        break;
-      if ( (signed int)(signed __int64)sqrt((double)((x - i->uX) * (x - i->uX) + (y - i->uY) * (y - i->uY))) < (signed int)i->uWidth )
-        goto LABEL_50;
-      y = pY;
-      x = pX;
-LABEL_45:
-      ;
+      if ( x >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameX && x <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameZ
+        && y >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameY && y <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameW )
+      {
+        for ( control = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; control; control = control->pNext )
+        {
+          if ( control->uButtonType == 1 )
+          {
+            if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW )
+            {
+              control->field_2C_is_pushed = 1;
+              v10 = pMessageQueue_50CBD0->uNumMessages;
+              if ( pMessageQueue_50CBD0->uNumMessages )
+              {
+                v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+                pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+              }
+              pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0);
+              return;
+            }
+            continue;
+          }
+          if ( control->uButtonType == 2 )//когда нажимаешь на партреты персов
+          {
+            if ( (signed int)(signed __int64)sqrt((double)((x - control->uX) * (x - control->uX) + (y - control->uY) * (y - control->uY))) < (signed int)control->uWidth )
+            {
+              control->field_2C_is_pushed = 1;
+              v10 = pMessageQueue_50CBD0->uNumMessages;
+              if ( pMessageQueue_50CBD0->uNumMessages )
+              {
+                v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+                pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+              }
+              pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0);
+              return;
+            }
+            continue;
+          }
+          if ( control->uButtonType == 3 )//когда нажимаешь на скиллы
+          {
+            if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW )
+            {
+              control->field_2C_is_pushed = 1;
+              v10 = pMessageQueue_50CBD0->uNumMessages;
+              if ( pMessageQueue_50CBD0->uNumMessages )
+              {
+                v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+                pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+              }
+              pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0);
+              return;
+            }
+            continue;
+          }
+          y = pY;
+          x = pX;
+        }
+      }
     }
-    if ( i->uButtonType != 3 )
-      goto LABEL_45;
-LABEL_41:
-    if ( x >= (signed int)i->uX && x <= (signed int)i->uZ && y >= (signed int)i->uY && y <= (signed int)i->uW )
-    {
-LABEL_50:
-      i->field_2C_is_pushed = 1;
-      v10 = pMessageQueue_50CBD0->uNumMessages;
-      if ( pMessageQueue_50CBD0->uNumMessages )
-      {
-        v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-        pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-      }
-      //v11 = i->uControlParam;
-      pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0);
-      return;
-    }
-    goto LABEL_45;
+    return;
   }
   y = pY;
-  if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y )
-    goto LABEL_30;
   if ( pRenderer->pRenderD3D )
     v5 = pGame->pVisInstance->get_picked_object_zbuf_val();
   else
     v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
-  v6 = (unsigned __int16)v5;
 
-  uint type = PID_TYPE(v6);
-  if (type == OBJECT_Actor
-    && uActiveCharacter
-    && v5 < 0x2000000
-    && pPlayers[uActiveCharacter]->CanAct()
-    && pPlayers[uActiveCharacter]->CanSteal() )
+  uint type = PID_TYPE((unsigned __int16)v5);
+  if (type == OBJECT_Actor && uActiveCharacter && v5 < 0x2000000
+    && pPlayers[uActiveCharacter]->CanAct() && pPlayers[uActiveCharacter]->CanSteal() )
   {
     /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
     {
@@ -589,7 +584,7 @@
       *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
       ++pMessageQueue_50CBD0->uNumMessages;
     }*/
-    pMessageQueue_50CBD0->AddMessage(UIMSG_STEALFROMACTOR, PID_ID(v6), 0);
+    pMessageQueue_50CBD0->AddMessage(UIMSG_STEALFROMACTOR, PID_ID((unsigned __int16)v5), 0);
 
     if ( pParty->bTurnBasedModeOn == 1 )
     {
--- a/Render.cpp	Fri Dec 13 11:51:51 2013 +0600
+++ b/Render.cpp	Fri Dec 13 16:10:36 2013 +0600
@@ -7084,7 +7084,7 @@
     void *pDst = (char *)pTargetSurface + (FORCE_16_BITS ? 2 : 4) * (uX + (y + uY) * uTargetSurfacePitch);
 
     memset32(pDst,
-             FORCE_16_BITS ? twoColors : 0xFF000000 |Color32(uColor16),  // two colors per int (16bit) or 1 (32bit)
+             FORCE_16_BITS ? twoColors : 0xFF000000 | Color32(uColor16),  // two colors per int (16bit) or 1 (32bit)
              uWidth / (FORCE_16_BITS ? 2 : 1));                      // two pixels per int (16bit) or 1 (32bit)
 
     if (FORCE_16_BITS && uWidth & 1) // we may miss one pixel for 16bit
--- a/UI/UIPopup.cpp	Fri Dec 13 11:51:51 2013 +0600
+++ b/UI/UIPopup.cpp	Fri Dec 13 16:10:36 2013 +0600
@@ -1298,7 +1298,7 @@
   unsigned int pX; // [sp+70h] [bp-8h]@3
   unsigned int pY; // [sp+74h] [bp-4h]@3
 
-  if ( pCurrentScreen == SCREEN_VIDEO )
+  if ( pCurrentScreen == SCREEN_VIDEO || GetCurrentMenuID() == MENU_MAIN )
     return;
   if ( _this )
   {
--- a/mm7_2.cpp	Fri Dec 13 11:51:51 2013 +0600
+++ b/mm7_2.cpp	Fri Dec 13 16:10:36 2013 +0600
@@ -4392,8 +4392,7 @@
       uGameState = GAME_STATE_PLAYING;
       while ( 1 )
       {
-        if (uGameState == GAME_FINISHED ||
-            GetCurrentMenuID() == MENU_EXIT_GAME)
+        if (uGameState == GAME_FINISHED || GetCurrentMenuID() == MENU_EXIT_GAME)
         {
           pGame->Deinitialize();
           return true;