changeset 854:06fc66ceecd6

for Arcomage game
author Ritor1
date Sun, 31 Mar 2013 16:42:11 +0600
parents 7ada14f991f5
children cb0b3badc7f7
files GUIWindow.cpp UIHouses.cpp UIHouses.h Vis.cpp mm7_2.cpp mm7_3.cpp
diffstat 6 files changed, 92 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Sat Mar 30 09:40:15 2013 +0600
+++ b/GUIWindow.cpp	Sun Mar 31 16:42:11 2013 +0600
@@ -1018,76 +1018,97 @@
 //----- (004B3157) --------------------------------------------------------
 void GUIWindow::HouseDialogManager()
 {
-  unsigned __int16 v1; // di@2
-  const char *v2; // edx@4
+  unsigned __int16 pWhiteColor; // di@2
+  const char *pHouseName; // edx@4
   signed int v3; // edx@5
   char *v4; // edi@9
-  int v5; // eax@45
+  int pTextHeight; // eax@45
   int v6; // edi@45
   char *v7; // eax@45
   int v8; // edi@46
   int v9; // eax@50
   unsigned int v10; // [sp-10h] [bp-C8h]@53
-  unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53
+  //unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53
   //unsigned int v12; // [sp-Ch] [bp-C4h]@60
   char *v13; // [sp-8h] [bp-C0h]@50
   //unsigned int v14; // [sp-8h] [bp-C0h]@60
   unsigned int v15; // [sp-4h] [bp-BCh]@50
   //Texture *v16; // [sp-4h] [bp-BCh]@60
-  GUIWindow w; // [sp+Ch] [bp-ACh]@4
-  GUIWindow v18; // [sp+60h] [bp-58h]@2
-  int v19; // [sp+B4h] [bp-4h]@2
+  GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4
+  GUIWindow pWindow; // [sp+60h] [bp-58h]@2
+  int pColor2; // [sp+B4h] [bp-4h]@2
 
   if ( !window_SpeakInHouse )
     return;
-  memcpy(&v18, this, sizeof(v18));
-  v18.uFrameWidth -= 18;
-  v18.uFrameZ -= 18;
-  v1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
+  memcpy(&pWindow, this, sizeof(pWindow));
+  pWindow.uFrameWidth -= 18;
+  pWindow.uFrameZ -= 18;
+  pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+  pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
   pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_507B04]);
   if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic )
   {
-    w.uFrameWidth = 130;
-    w.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight);
+    pDialogWindow.uFrameWidth = 130;
+    pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight);
 
     //v2 = (const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C];
-    v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName;
+    pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName;
 
-    if ( v2 )
+    if ( pHouseName )
     {
-      v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(v2, &w, 0, 0);
+      v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0);
       if ( v3 < 0 )
         v3 = 0;
-      v18.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, v1,
+      pWindow.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, pWhiteColor,
         //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C],
         p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3);
     }
   }
-  v18.uFrameWidth += 8;
-  v18.uFrameZ += 8;
+  pWindow.uFrameWidth += 8;
+  pWindow.uFrameZ += 8;
   if ( !pDialogueNPCCount )
   {
     if ( in_current_building_type == BildingType_Jail )
     {
       JailDialog();
-      goto LABEL_58;
+      if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
+      {
+        pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
+        pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
+      }
+      else
+      {
+        pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
+      }
+      return;
     }
     if ( current_npc_text )
     {
-      w.uFrameWidth = 458;
-      w.uFrameZ = 457;
-      v5 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0);
-      v6 = v5 + 7;
-      pRenderer->_4A6A68(8, 352 - (v5 + 7), &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (v5 + 7));
-      pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428);
-      v7 = FitTextInAWindow(current_npc_text, pFontArrus, &w, 0xDu, 0);
+      pDialogWindow.uFrameWidth = 458;
+      pDialogWindow.uFrameZ = 457;
+      pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0);
+      v6 = pTextHeight + 7;
+      pRenderer->_4A6A68(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather], 
+          pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (pTextHeight + 7));
+      pRenderer->DrawTextureIndexed(8, 347 - v6, pTexture_591428);
+      v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0);
       window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0);
     }
     v8 = 0;
     if ( uNumDialogueNPCPortraits <= 0 )
-      goto LABEL_58;
+    {
+      if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
+      {
+        pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
+        pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
+      }
+      else
+      {
+        pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
+      }
+      return;
+    }
     while ( 1 )
     {
       //pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
@@ -1103,7 +1124,19 @@
 LABEL_57:
       ++v8;
       if ( v8 >= uNumDialogueNPCPortraits )
-        goto LABEL_58;
+        //goto LABEL_58;
+      {
+        if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
+        {
+          pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
+          pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
+        }
+        else
+        {
+          pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
+        }
+       return;
+      }
     }
     if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
     {
@@ -1118,16 +1151,16 @@
         v15 = 3;
         //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C];
         v13 = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle;
-        v18.DrawTitleText(pFontCreate, 0x1E3u, 113, v19, v13, 3);
+        pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, v13, 3);
         goto LABEL_57;
       }
       v15 = 3;
-      v13 = HouseNPCData[v8 - (dword_591080 != 0)]->pName;
+      v13 = HouseNPCData[(v8 +1) - (dword_591080 != 0)]->pName;
       v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
     }
-    v11 = v19;
+    //v11 = pColor2;
     v10 = v9;
-    v18.DrawTitleText(pFontCreate, 0x1E3u, v10, v11, v13, v15);
+    pWindow.DrawTitleText(pFontCreate, 0x1E3u, v10, pColor2, v13, v15);
     goto LABEL_57;
   }
   v4 = (char *)pDialogueNPCCount - 1;
@@ -1136,7 +1169,17 @@
   if ( pCurrentScreen == SCREEN_E )
   {
     CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
-    goto LABEL_58;
+    //goto LABEL_58;
+    if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
+    {
+      pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
+      pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
+    }
+    else
+    {
+      pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
+    }
+    return;
   }
   if ( v4 || !dword_591080 )
   {
@@ -1147,7 +1190,7 @@
     sprintfex( pTmpBuf, pGlobalTXT_LocalizationStrings[429],
       p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName,
       p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle);
-    v18.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v19, pTmpBuf, 3u);
+    pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf, 3);
       switch ( in_current_building_type )
       {
         case BildingType_WeaponShop:
@@ -1203,7 +1246,7 @@
           break;
       }
   }
-LABEL_58:
+//LABEL_58:
   if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
   {
     pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
@@ -1928,7 +1971,7 @@
         else
         {
           if ( v26 || !dword_591080 )
-            v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName;
+            v27 = HouseNPCData[(v26 +1) - (dword_591080 != 0)]->pName;
           else
             //v27 = (char *)p2DEvents_minus1_::08[13 * a4];
             v27 = (char *)p2DEvents[pButton - 1].pProprieterName;
--- a/UIHouses.cpp	Sat Mar 30 09:40:15 2013 +0600
+++ b/UIHouses.cpp	Sun Mar 31 16:42:11 2013 +0600
@@ -2591,9 +2591,8 @@
       break;
     }
 
-    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_102:
+    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
     {
-      __debugbreak();
       pOutString = pFontArrus;
       strcpy(pTmpBuf, pNPCTopics[354].pText);
       dialog_window.uFrameWidth = game_viewport_width;
@@ -2611,9 +2610,8 @@
       window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
       break;
     }
-    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_103:
+    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
     {
-      __debugbreak();
       strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
       dialog_window.uFrameWidth = game_viewport_width;
       dialog_window.uFrameZ = 452;
@@ -2794,7 +2792,7 @@
         pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
         v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138;
         v37 = -pDialogueWindow->pNumPresenceButton < 0;
-        if ( v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
+        if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
         {
           pItemNum = 2;
           pNumString = 0;
@@ -2809,8 +2807,9 @@
             pColorText = pColorYellow;
             if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
               pColorText = pColorWhite;
-            dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, *(const char **)&pOutString->cFirstChar, 3);
+            dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
             pItemNum++;
+            ++pNumString;
             pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
           }
           while ( pItemNum < pNumActiveItem );
--- a/UIHouses.h	Sat Mar 30 09:40:15 2013 +0600
+++ b/UIHouses.h	Sun Mar 31 16:42:11 2013 +0600
@@ -33,8 +33,8 @@
   HOUSE_DIALOGUE_TOWNHALL_99 = 99,
   HOUSE_DIALOGUE_TOWNHALL_100 = 100,
   HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN = 101,
-  HOUSE_DIALOGUE_TAVERN_ARCOMAGE_102 = 102,
-  HOUSE_DIALOGUE_TAVERN_ARCOMAGE_103 = 103,
+  HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES = 102,
+  HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS = 103,
   HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT = 104,
   HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 = 105,
   HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_2 = 106,
--- a/Vis.cpp	Sat Mar 30 09:40:15 2013 +0600
+++ b/Vis.cpp	Sun Mar 31 16:42:11 2013 +0600
@@ -537,7 +537,7 @@
   if (!default_list.uNumPointers)
     return -1;
 
-  return get_object_zbuf_val(default_list.object_pointers[0]);
+  return get_object_zbuf_val(default_list.object_pointers[0]);//Click to the Rat in dragon cave result crash. Maybe object_pointers incorrect
 }
 
 //----- (004C1C0C) --------------------------------------------------------
--- a/mm7_2.cpp	Sat Mar 30 09:40:15 2013 +0600
+++ b/mm7_2.cpp	Sun Mar 31 16:42:11 2013 +0600
@@ -10180,7 +10180,7 @@
       DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3);
   }
   v22 = 0;
-  v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);
+  v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);//wrong pointer
   if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
   {
 	  v2 = (char *)v1 - 50;
--- a/mm7_3.cpp	Sat Mar 30 09:40:15 2013 +0600
+++ b/mm7_3.cpp	Sun Mar 31 16:42:11 2013 +0600
@@ -6104,10 +6104,10 @@
     {
       pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
 
-      array_50AC10[0].vWorldViewProjY = v38_;
+      array_50AC10[0].vWorldViewProjY = v38;
       array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
       array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
-      array_50AC10[3].vWorldViewProjY = v38_;
+      array_50AC10[3].vWorldViewProjY = v38;
 
       pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
       return;