diff UI/UIHouses.cpp @ 2374:802460e60eee

add UIArena.cpp and UIArena.h and other
author Ritor1
date Sun, 01 Jun 2014 18:37:09 +0600
parents bddcaf5d5db2
children 6a7309a847ea
line wrap: on
line diff
--- a/UI/UIHouses.cpp	Sun Jun 01 17:20:22 2014 +0600
+++ b/UI/UIHouses.cpp	Sun Jun 01 18:37:09 2014 +0600
@@ -30,6 +30,8 @@
 #include "..\Game.h"
 #include "..\CastSpellInfo.h"
 
+#include "../Level/Decoration.h"
+
 #include "..\stru159.h"
 int uHouse_ExitPic; // weak
 
@@ -3299,4 +3301,89 @@
     } while ((decode_step<24)&&!break_loop);
   }
 
-}
\ No newline at end of file
+}
+
+//----- (004BD8B5) --------------------------------------------------------
+int HouseDialogPressCloseBtn()
+{
+  if ( pMessageQueue_50CBD0->uNumMessages )
+    pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+  pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
+  pKeyActionMap->ResetKeys();
+  activeLevelDecoration = nullptr;
+  current_npc_text = 0;
+  if ( pDialogueNPCCount == 0)
+    return 0;
+
+  if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && ShopTexture )
+  {
+    ShopTexture->Release();
+    ShopTexture = 0;
+  }
+
+  switch(dialog_menu_id)
+  {
+    case -1:
+      _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1));
+      pVideoPlayer->_4BF5B2();
+      break;
+
+    case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
+    case HOUSE_DIALOGUE_LEARN_SKILLS:
+    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN:
+      pVideoPlayer->_4BF5B2();
+      UI_CreateEndConversationButton();
+      dialog_menu_id = HOUSE_DIALOGUE_MAIN;
+      InitializaDialogueOptions(in_current_building_type);
+      break;
+
+    case HOUSE_DIALOGUE_SHOP_SELL:
+    case HOUSE_DIALOGUE_SHOP_IDENTIFY:
+    case HOUSE_DIALOGUE_SHOP_REPAIR:
+      UI_CreateEndConversationButton();
+      dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT;
+      InitializaDialogueOptions_Shops(in_current_building_type);
+      break;
+
+    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
+    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
+    case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT:
+      pVideoPlayer->_4BF5B2();
+      UI_CreateEndConversationButton();
+      dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN;
+      InitializaDialogueOptions_Tavern(in_current_building_type);
+      break;
+
+    case HOUSE_DIALOGUE_NULL:
+    case HOUSE_DIALOGUE_MAIN:
+      pDialogueNPCCount = 0;
+      pDialogueWindow->Release();
+      dialog_menu_id = HOUSE_DIALOGUE_NULL;
+      pDialogueWindow = 0;
+      pIcons_LOD->SyncLoadedFilesCount();
+
+      if ( uNumDialogueNPCPortraits == 1 )
+        return 0;
+
+      pBtn_ExitCancel = window_SpeakInHouse->pControlsHead;
+      if ( uNumDialogueNPCPortraits > 0 )
+      {
+        for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i )
+        {
+          HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i],
+                                            pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i],
+                                            63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0);
+        }
+      }
+
+      pVideoPlayer->_4BF5B2();
+      break;
+
+    default:
+      pVideoPlayer->_4BF5B2();
+      dialog_menu_id = HOUSE_DIALOGUE_MAIN;
+      InitializaDialogueOptions(in_current_building_type);
+      break;
+  }
+  return 1;
+}