changeset 2545:e06a3fe9ad6e

TravelUI init logic moved to GUIWindow_Travel TransitionUI init logic moved to GUIWindow_Transition
author a.parshin
date Mon, 11 May 2015 16:43:46 +0200
parents c674d547cc7c
children 4087cbc62706
files Engine/Events.cpp Engine/Graphics/Outdoor.cpp GUI/GUIWindow.cpp GUI/GUIWindow.h GUI/UI/UIOptions.cpp GUI/UI/UIOptions.h GUI/UI/UIRest.cpp GUI/UI/UIRest.h GUI/UI/UITransition.cpp GUI/UI/UITransition.h
diffstat 10 files changed, 325 insertions(+), 290 deletions(-) [+]
line wrap: on
line diff
--- a/Engine/Events.cpp	Mon May 11 09:51:04 2015 +0200
+++ b/Engine/Events.cpp	Mon May 11 16:43:46 2015 +0200
@@ -8,13 +8,8 @@
 
 #include "Graphics/Weather.h"
 #include "Graphics/Texture.h"
-#include "Media/MediaPlayer.h"
-#include "IO/Mouse.h"
-
 #include "MapInfo.h"
 #include "Graphics/Render.h"
-#include "GUI/GUIWindow.h"
-#include "GUI/GUIProgressBar.h"
 #include "Objects/SpriteObject.h"
 #include "Objects/Chest.h"
 #include "MapsLongTimer.h"
@@ -22,7 +17,6 @@
 #include "Objects/Actor.h"
 #include "Party.h"
 #include "OurMath.h"
-#include "Media/Audio/AudioPlayer.h"
 #include "Graphics/Indoor.h"
 #include "Graphics/Viewport.h"
 #include "texts.h"
@@ -30,11 +24,18 @@
 #include "stru159.h"
 #include "Events.h"
 #include "Events2D.h"
-#include "..\GUI\UI\UIHouses.h"
 #include "Graphics/Level/Decoration.h"
 #include "LuaVM.h"
 #include "Graphics/DecorationList.h"
 
+#include "IO/Mouse.h"
+
+#include "GUI/UI/UITransition.h"
+#include "GUI/GUIProgressBar.h"
+#include "GUI/UI/UIHouses.h"
+
+#include "Media/Audio/AudioPlayer.h"
+#include "Media/MediaPlayer.h"
 
 std::array<EventIndex, 4400> pSomeOtherEVT_Events;
 signed int uSomeOtherEVT_NumEvents;
@@ -1075,7 +1076,7 @@
         if ( _evt->v29 || _evt->v30 )
           {
             pRenderer->Sub01();
-          TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
+            pDialogueWindow = new GUIWindow_Transition(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
           dword_5C3418 = uEventID;
           dword_5C341C = curr_seq_num + 1;
           if ( v133 == 1 )
--- a/Engine/Graphics/Outdoor.cpp	Mon May 11 09:51:04 2015 +0200
+++ b/Engine/Graphics/Outdoor.cpp	Mon May 11 16:43:46 2015 +0200
@@ -1,42 +1,42 @@
 #define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
 #include <stdlib.h>
 #include <crtdbg.h>
 
-#define _CRT_SECURE_NO_WARNINGS
-
 #include "Engine/Engine.h"
+#include "Engine/Party.h"
+#include "Engine/Objects/SpriteObject.h"
+#include "Engine/LOD.h"
+#include "Engine/OurMath.h"
+#include "Engine/Objects/ObjectList.h"
+#include "Engine/Objects/Actor.h"
+#include "Engine/Objects/Chest.h"
+#include "Engine/stru123.h"
+#include "Engine/Timer.h"
+#include "Engine/TurnEngine/TurnEngine.h"
+#include "Engine/Events.h"
+#include "Engine/ZlibWrapper.h"
+#include "Engine/MMT.h"
 
 #include "stru6.h"
 #include "Weather.h"
 #include "Sprites.h"
 #include "LightmapBuilder.h"
 #include "Outdoor.h"
-#include "Engine/Party.h"
-#include "Engine/Objects/SpriteObject.h"
-#include "Engine/LOD.h"
 #include "PaletteManager.h"
-#include "GUI/GUIProgressBar.h"
-#include "Media/Audio/AudioPlayer.h"
 #include "DecorationList.h"
-#include "Engine/OurMath.h"
-#include "Engine/Objects/ObjectList.h"
-#include "Engine/Objects/Actor.h"
-#include "Engine/Objects/Chest.h"
-#include "Engine/stru123.h"
-#include "Engine/Timer.h"
 #include "Viewport.h"
-#include "Engine/Events.h"
 #include "ParticleEngine.h"
-#include "Engine/TurnEngine/TurnEngine.h"
-
 #include "Lights.h"
+#include "Level/Decoration.h"
 
 #include "GUI/GUIWindow.h"
-#include "Level/Decoration.h"
-#include "Engine/ZlibWrapper.h"
-#include "Engine/MMT.h"
-
-MapStartPoint uLevel_StartingPointType; // weak
+#include "GUI/GUIProgressBar.h"
+#include "GUI/UI/UITransition.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+MapStartPoint uLevel_StartingPointType;
 
 OutdoorLocation *pOutdoor = new OutdoorLocation;
 ODMRenderParams *pODMRenderParams;
@@ -2878,7 +2878,7 @@
     else
     {
       pAudioPlayer->StopChannels(-1, -1);
-      TravelUI_Load();
+      pDialogueWindow = new GUIWindow_Travel();//TravelUI_Load();
     }
   }
   UpdateActors_ODM();
--- a/GUI/GUIWindow.cpp	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/GUIWindow.cpp	Mon May 11 16:43:46 2015 +0200
@@ -215,27 +215,6 @@
     }
 }
 
-GUIWindow_Travel::GUIWindow_Travel(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-    GUIWindow(x, y, width, height, button, hint)
-{
-    prev_screen_type = current_screen_type;
-    current_screen_type = SCREEN_CHANGE_LOCATION;
-    pBtn_ExitCancel = CreateButton(566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// Stay in this area / Остаться в этой области
-    pBtn_YES = CreateButton(486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
-    CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', hint, 0, 0, 0);
-    CreateButton(8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, hint, 0);
-}
-
-GUIWindow_Transition::GUIWindow_Transition(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-    GUIWindow(x, y, width, height, button, hint)
-{
-    prev_screen_type = current_screen_type;
-    current_screen_type = SCREEN_INPUT_BLV;
-    pBtn_ExitCancel = CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); // Cancel / Отмена
-    pBtn_YES = CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
-    CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, hint, 0);
-    CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, hint, 0);
-}
 
 GUIWindow_Spellbook::GUIWindow_Spellbook(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
     GUIWindow(x, y, width, height, button, hint)
@@ -426,27 +405,6 @@
     GUIWindow::Release();
 }
 
-void GUIWindow_Travel::Release()
-{
-    pTexture_outside->Release();
-    pTexture_Dialogue_Background->Release();
-    pIcons_LOD->SyncLoadedFilesCount();
-    current_screen_type = prev_screen_type;
-
-    GUIWindow::Release();
-}
-
-void GUIWindow_Transition::Release()
-{
-    //pVideoPlayer->Unload();
-    pTexture_outside->Release();
-    pTexture_Dialogue_Background->Release();
-    pIcons_LOD->SyncLoadedFilesCount();
-    current_screen_type = prev_screen_type;
-
-    GUIWindow::Release();
-}
-
 void GUIWindow_Dialogue::Release()
 {
     if (!dword_591084)
@@ -1672,21 +1630,6 @@
     CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
 }
 
-void GUIWindow_Options::Update()
-{
-    GameMenuUI_Options_Draw();
-}
-
-void GUIWindow_KeymappingOptions::Update()
-{
-    GameMenuUI_DrawKeyBindings();
-}
-
-void GUIWindow_VideoOptions::Update()
-{
-    GameMenuUI_DrawVideoOptions();
-}
-
 void GUIWindow_Book::Update()
 {
     BookUI_Draw((WindowType)(int)ptr_1C);
@@ -1704,21 +1647,6 @@
     GameUI_QuickRef_Draw();
 }
 
-void GUIWindow_Rest::Update()
-{
-    RestUI_Draw();
-}
-
-void GUIWindow_Travel::Update()
-{
-    TravelUI_Draw();
-}
-
-void GUIWindow_Transition::Update()
-{
-    TransitionUI_Draw();
-}
-
 void GUIWindow_Dialogue::Update()
 {
     GameUI_DrawDialogue();
@@ -1813,26 +1741,6 @@
     ModalWindow_ShowHint();
 }
 
-void GUIWindow_RestWindow::Update()
-{
-    __debugbreak(); // doesnt seems to get here, check stack trace & conditions
-    GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133
-    memset(&GUIButton2, 0, sizeof(GUIButton2));
-    GUIButton2.uZ = 197;
-    GUIButton2.uW = 197;
-    GUIButton2.uX = 27;
-    GUIButton2.uY = 161;
-    GUIButton2.uWidth = 171;
-    GUIButton2.uHeight = 37;
-    GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
-    pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
-    pRenderer->DrawTextureIndexed(uFrameX, uFrameY, *((Texture **)ptr_1C + 15));
-    viewparams->bRedrawGameUI = 1;
-    GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0); // Rest & Heal 8 hrs / Отдых и лечение 8 часов
-    GUIButton2.pParent = 0;
-    Release();
-}
-
 void OnButtonClick::Update()
 {
     if (Hint != (char *)1)
--- a/GUI/GUIWindow.h	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/GUIWindow.h	Mon May 11 16:43:46 2015 +0200
@@ -397,33 +397,6 @@
 
     virtual void Update();
 };
-struct GUIWindow_Options : public GUIWindow
-{
-    GUIWindow_Options(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-        GUIWindow(x, y, width, height, button, hint)
-    {}
-    virtual ~GUIWindow_Options() {}
-
-    virtual void Update();
-};
-struct GUIWindow_KeymappingOptions : public GUIWindow
-{
-    GUIWindow_KeymappingOptions(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-        GUIWindow(x, y, width, height, button, hint)
-    {}
-    virtual ~GUIWindow_KeymappingOptions() {}
-
-    virtual void Update();
-};
-struct GUIWindow_VideoOptions : public GUIWindow
-{
-    GUIWindow_VideoOptions(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-        GUIWindow(x, y, width, height, button, hint)
-    {}
-    virtual ~GUIWindow_VideoOptions() {}
-
-    virtual void Update();
-};
 struct GUIWindow_Book : public GUIWindow
 {
     GUIWindow_Book(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
@@ -454,41 +427,6 @@
 
     virtual void Update();
 };
-struct GUIWindow_Rest : public GUIWindow
-{
-    GUIWindow_Rest(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-        GUIWindow(x, y, width, height, button, hint)
-    {}
-    virtual ~GUIWindow_Rest() {}
-
-    virtual void Update();
-};
-struct GUIWindow_RestWindow : public GUIWindow
-{
-    GUIWindow_RestWindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-        GUIWindow(x, y, width, height, button, hint)
-    {}
-    virtual ~GUIWindow_RestWindow() {}
-
-    virtual void Update();
-    virtual void Release();
-};
-struct GUIWindow_Travel : public GUIWindow
-{
-    GUIWindow_Travel(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint);
-    virtual ~GUIWindow_Travel() {}
-
-    virtual void Update();
-    virtual void Release();
-};
-struct GUIWindow_Transition : public GUIWindow
-{
-    GUIWindow_Transition(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint);
-    virtual ~GUIWindow_Transition() {}
-
-    virtual void Update();
-    virtual void Release();
-};
 struct GUIWindow_Dialogue : public GUIWindow
 {
     GUIWindow_Dialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint);
@@ -819,15 +757,9 @@
 
 // game menu ui
 GUIWindow *GameMenuUI_Load();
-
 GUIWindow *GameMenuUI_Options_Load();
-void GameMenuUI_Options_Draw();
-
 GUIWindow *GameMenuUI_OptionsKeymapping_Load();
-void GameMenuUI_DrawKeyBindings();
-
 GUIWindow *GameMenuUI_OptionsVideo_Load();
-void GameMenuUI_DrawVideoOptions();
 
 
 
@@ -877,16 +809,8 @@
 // rest ui
 void PrepareToLoadRestUI();
 GUIWindow *RestUI_Load();
-void RestUI_Draw();
 
 
-// transition & travel ui
-void TransitionUI_Load(uint32_t anim_id, uint32_t exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName);
-void TransitionUI_Draw();
-
-void TravelUI_Load();
-void TravelUI_Draw();
-
 
 
 
--- a/GUI/UI/UIOptions.cpp	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/UI/UIOptions.cpp	Mon May 11 16:43:46 2015 +0200
@@ -5,17 +5,18 @@
 #define _CRT_SECURE_NO_WARNINGS
 
 #include "Engine/Engine.h"
-
-#include "..\../IO/Keyboard.h"
-#include "..\../Engine/Graphics/IndoorCameraD3D.h"
-#include "..\../Engine/Graphics/GammaControl.h"
-#include "..\../Engine/Graphics/Render.h"
+#include "Engine/Graphics/IndoorCameraD3D.h"
+#include "Engine/Graphics/GammaControl.h"
+#include "Engine/Graphics/Render.h"
+#include "Engine/LOD.h"
+#include "Engine/texts.h"
 
-#include "..\../GUI/GUIWindow.h"
-#include "..\../GUI/GUIFont.h"
-#include "..\../Media/Audio/AudioPlayer.h"
-#include "..\../Engine/LOD.h"
-#include "..\../Engine/texts.h"
+#include "IO/Keyboard.h"
+
+#include "GUI/UI/UIOptions.h"
+#include "GUI/GUIFont.h"
+
+#include "Media/Audio/AudioPlayer.h"
 
 
 
@@ -27,6 +28,7 @@
 GUIWindow *GameMenuUI_Load()
 {
     auto wnd = new GUIWindow_GameMenu(0, 0, window->GetWidth(), window->GetHeight(), 0, 0);
+
     uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
     uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
     uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
@@ -34,24 +36,43 @@
     uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
     uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
     uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
-    pBtn_NewGame = wnd->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu,
+
+    pBtn_NewGame = wnd->CreateButton(
+        0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu,
         pGlobalTXT_LocalizationStrings[614],// "New Game"
-        pIcons_LOD->GetTexture(uTextureID_New1), 0);
-    pBtn_SaveGame = wnd->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u,
+        pIcons_LOD->GetTexture(uTextureID_New1),
+        0
+    );
+    pBtn_SaveGame = wnd->CreateButton(
+        0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u,
         pGlobalTXT_LocalizationStrings[615],// "Save Game"
-        pIcons_LOD->GetTexture(uTextureID_Save1), 0);
-    pBtn_LoadGame = wnd->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu,
+        pIcons_LOD->GetTexture(uTextureID_Save1),
+        0
+    );
+    pBtn_LoadGame = wnd->CreateButton(
+        19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu,
         pGlobalTXT_LocalizationStrings[616],// "Load Game"
-        pIcons_LOD->GetTexture(uTextureID_Load1), 0);
-    pBtn_GameControls = wnd->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u,
+        pIcons_LOD->GetTexture(uTextureID_Load1),
+        0
+    );
+    pBtn_GameControls = wnd->CreateButton(
+        241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u,
         pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
-        pIcons_LOD->GetTexture(uTextureID_Controls1), 0);
-    pBtn_QuitGame = wnd->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u,
+        pIcons_LOD->GetTexture(uTextureID_Controls1),
+        0
+    );
+    pBtn_QuitGame = wnd->CreateButton(
+        241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u,
         pGlobalTXT_LocalizationStrings[618],// "Quit"
-        pIcons_LOD->GetTexture(uTextureID_Quit1), 0);
-    pBtn_Resume = wnd->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u,
+        pIcons_LOD->GetTexture(uTextureID_Quit1),
+        0
+    );
+    pBtn_Resume = wnd->CreateButton(
+        241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u,
         pGlobalTXT_LocalizationStrings[619],// "Return to Game"
-        pIcons_LOD->GetTexture(uTextureID_Resume1), 0);
+        pIcons_LOD->GetTexture(uTextureID_Resume1),
+        0
+    );
     wnd->_41D08F_set_keyboard_control_group(6, 1, 0, 0);
 
     return wnd;
@@ -127,9 +148,8 @@
     return wnd;
 }
 
-
 //----- (004142D3) --------------------------------------------------------
-void GameMenuUI_DrawKeyBindings()
+void GUIWindow_KeymappingOptions::Update()
 {
   signed int v4; // ecx@7
   signed int v5; // eax@8
@@ -272,8 +292,9 @@
 }
 
 
+
 //----- (00414D9A) --------------------------------------------------------
-void GameMenuUI_DrawVideoOptions()
+void GUIWindow_VideoOptions::Update()
 {
   GUIWindow msg_window; // [sp+8h] [bp-54h]@3
 
@@ -332,7 +353,7 @@
     options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
     options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
 
-    auto wnd = new GUIWindow_Options(0, 0, window->GetWidth(), window->GetHeight(), 0, 0);
+    auto wnd = new GUIWindow_Options(0, 0, window->GetWidth(), window->GetHeight());
     wnd->CreateButton(22, 270,
         pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
         pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
@@ -382,8 +403,11 @@
     return wnd;
 }
 
+
+
+
 //----- (00414F82) --------------------------------------------------------
-void GameMenuUI_Options_Draw()
+void GUIWindow_Options::Update()
 {
   pRenderer->DrawTextureIndexed(8,   8, pIcons_LOD->GetTexture(uTextureID_Options));
   pRenderer->DrawTextureIndexed(8, 132, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_Background));
--- a/GUI/UI/UIOptions.h	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/UI/UIOptions.h	Mon May 11 16:43:46 2015 +0200
@@ -1,1 +1,36 @@
-#pragma once
\ No newline at end of file
+#pragma once
+#include "GUI/GUIWindow.h"
+
+struct GUIWindow_Options : public GUIWindow
+{
+    GUIWindow_Options(unsigned int x, unsigned int y, unsigned int width, unsigned int height) :
+        GUIWindow(x, y, width, height, 0, nullptr)
+    {}
+    virtual ~GUIWindow_Options() {}
+
+    virtual void Update();
+};
+
+
+
+struct GUIWindow_KeymappingOptions : public GUIWindow
+{
+    GUIWindow_KeymappingOptions(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
+        GUIWindow(x, y, width, height, button, hint)
+    {}
+    virtual ~GUIWindow_KeymappingOptions() {}
+
+    virtual void Update();
+};
+
+
+
+struct GUIWindow_VideoOptions : public GUIWindow
+{
+    GUIWindow_VideoOptions(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
+        GUIWindow(x, y, width, height, button, hint)
+    {}
+    virtual ~GUIWindow_VideoOptions() {}
+
+    virtual void Update();
+};
\ No newline at end of file
--- a/GUI/UI/UIRest.cpp	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/UI/UIRest.cpp	Mon May 11 16:43:46 2015 +0200
@@ -6,16 +6,39 @@
 
 #include "Engine/Engine.h"
 
-#include "..\../GUI/GUIWindow.h"
-#include "..\../GUI/GUIFont.h"
-#include "..\../Engine/Party.h"
-#include "..\../Media/Audio/AudioPlayer.h"
-#include "..\../Engine/Graphics/Outdoor.h"
-#include "..\../Engine/LOD.h"
-#include "..\../Engine/Graphics/Viewport.h"
-#include "..\../Engine/Timer.h"
-#include "..\../Engine/texts.h"
+#include "Engine/Graphics/Outdoor.h"
+#include "Engine/LOD.h"
+#include "Engine/Graphics/Viewport.h"
+#include "Engine/Timer.h"
+#include "Engine/texts.h"
+#include "Engine/Party.h"
+
+#include "GUI/UI/UIRest.h"
+#include "GUI/GUIFont.h"
+
+#include "Media/Audio/AudioPlayer.h"
+
+
 
+void GUIWindow_RestWindow::Update()
+{
+    __debugbreak(); // doesnt seems to get here, check stack trace & conditions
+    GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133
+    memset(&GUIButton2, 0, sizeof(GUIButton2));
+    GUIButton2.uZ = 197;
+    GUIButton2.uW = 197;
+    GUIButton2.uX = 27;
+    GUIButton2.uY = 161;
+    GUIButton2.uWidth = 171;
+    GUIButton2.uHeight = 37;
+    GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
+    pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
+    pRenderer->DrawTextureIndexed(uFrameX, uFrameY, *((Texture **)ptr_1C + 15));
+    viewparams->bRedrawGameUI = 1;
+    GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0); // Rest & Heal 8 hrs / Отдых и лечение 8 часов
+    GUIButton2.pParent = 0;
+    Release();
+}
 
 
 void PrepareToLoadRestUI()
@@ -72,7 +95,7 @@
 
   OutdoorLocation::LoadActualSkyFrame();
 
-  auto wnd = new GUIWindow_Rest(0, 0, window->GetWidth(), window->GetHeight(), 0, 0);
+  auto wnd = new GUIWindow_Rest(0, 0, window->GetWidth(), window->GetHeight());
   pButton_RestUI_Exit =          wnd->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
   pButton_RestUI_Main =          wnd->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
   pButton_RestUI_WaitUntilDawn = wnd->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
@@ -82,8 +105,10 @@
   return wnd;
 }
 
+
+
 //----- (0041FA01) --------------------------------------------------------
-void RestUI_Draw()
+void GUIWindow_Rest::Update()
 {
   int live_characters; // esi@1
   unsigned int v3; // eax@15
--- a/GUI/UI/UIRest.h	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/UI/UIRest.h	Mon May 11 16:43:46 2015 +0200
@@ -1,1 +1,25 @@
-#pragma once
\ No newline at end of file
+#pragma once
+#include "GUI/GUIWindow.h"
+
+
+struct GUIWindow_Rest : public GUIWindow
+{
+    GUIWindow_Rest(unsigned int x, unsigned int y, unsigned int width, unsigned int height) :
+        GUIWindow(x, y, width, height, 0, nullptr)
+    {}
+    virtual ~GUIWindow_Rest() {}
+
+    virtual void Update();
+};
+
+
+struct GUIWindow_RestWindow : public GUIWindow
+{
+    GUIWindow_RestWindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
+        GUIWindow(x, y, width, height, button, hint)
+    {}
+    virtual ~GUIWindow_RestWindow() {}
+
+    virtual void Update();
+    virtual void Release();
+};
\ No newline at end of file
--- a/GUI/UI/UITransition.cpp	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/UI/UITransition.cpp	Mon May 11 16:43:46 2015 +0200
@@ -6,28 +6,54 @@
 #include <io.h>
 
 #include "Engine/Engine.h"
+#include "Engine/Party.h"
+#include "Engine/Graphics/Outdoor.h"
+#include "Engine/LOD.h"
+#include "Engine/Timer.h"
+#include "Engine/stru159.h"
+#include "Engine/Events2D.h"
+#include "Engine/texts.h"
+#include "Engine/MapInfo.h"
 
-#include "..\../Media/MediaPlayer.h"
-#include "..\../Engine/MapInfo.h"
-#include "..\../GUI/GUIWindow.h"
-#include "..\../GUI/GUIFont.h"
-#include "..\../GUI/GUIProgressBar.h"
-#include "..\../Engine/Party.h"
-#include "..\../Media/Audio/AudioPlayer.h"
-#include "..\../Engine/Graphics/Outdoor.h"
-#include "..\../Engine/LOD.h"
-#include "..\../Engine/Timer.h"
-#include "..\../Engine/stru159.h"
-#include "..\../Engine/Events2D.h"
-#include "..\../Engine/texts.h"
-#include "UIHouses.h"
+#include "GUI/UI/UITransition.h"
+#include "GUI/GUIFont.h"
+#include "GUI/GUIProgressBar.h"
+#include "GUI/UI/UIHouses.h"
+
+#include "Media/Audio/AudioPlayer.h"
+#include "Media/MediaPlayer.h"
 
 
 
 
+void GUIWindow_Travel::Release()
+{
+    pTexture_outside->Release();
+    pTexture_Dialogue_Background->Release();
+    pIcons_LOD->SyncLoadedFilesCount();
+    current_screen_type = prev_screen_type;
+
+    GUIWindow::Release();
+}
+
+void GUIWindow_Transition::Release()
+{
+    //pVideoPlayer->Unload();
+    pTexture_outside->Release();
+    pTexture_Dialogue_Background->Release();
+    pIcons_LOD->SyncLoadedFilesCount();
+    current_screen_type = prev_screen_type;
+
+    GUIWindow::Release();
+}
+
+
 //----- (00444839) --------------------------------------------------------
-void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName)
+GUIWindow_Transition::GUIWindow_Transition(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) :
+    GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
 {
+// ----------------------------------
+// 00444839 TransitionUI_Load -- part
   const char *v15; // eax@14
   char pContainer[40]; // [sp+Ch] [bp-2Ch]@1
 
@@ -56,57 +82,73 @@
   {
     if ( !IndoorLocation::GetLocationIndex(pLocationName) )
       pMediaPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1);
+
+    v15 = pLocationName;
+    if (*pLocationName == 48)
+        v15 = pCurrentMapName;
+    if (pMapStats->GetMapInfo(v15))
+    {
+        sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s]
+        if (uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30)
+            pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
+        if (IndoorLocation::GetLocationIndex(pLocationName))
+            uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
+    }
+    else
+    {
+        strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти
+        //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
+        //PlayHouseSound(anim_id, HouseSound_Greeting);
+        if (uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30)
+            pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
+        if (IndoorLocation::GetLocationIndex(pLocationName))
+            uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
+    }
   }
   else if ( !IndoorLocation::GetLocationIndex(pLocationName) )
   {
     if ( pMapStats->GetMapInfo(pCurrentMapName) )
     {
       sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); // "Leave %s"
-      pDialogueWindow = new GUIWindow_Transition(0, 0, window->GetWidth(), window->GetHeight(), 0, sHouseName.data());
       //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
         //PlayHouseSound(anim_id, HouseSound_Greeting);
       if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
         pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
       if ( IndoorLocation::GetLocationIndex(pLocationName) )
         uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
-      return;
     }
-    strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);
-    pDialogueWindow = new GUIWindow_Transition(0, 0, window->GetWidth(), window->GetHeight(), 0, sHouseName.data());
-    //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
-      //PlayHouseSound(anim_id, HouseSound_Greeting);
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
-      pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
-    if ( IndoorLocation::GetLocationIndex(pLocationName) )
-      uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
-    return;
+    else
+    {
+        strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);
+        //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
+        //PlayHouseSound(anim_id, HouseSound_Greeting);
+        if (uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30)
+            pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
+        if (IndoorLocation::GetLocationIndex(pLocationName))
+            uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
+    }
   }
-  v15 = pLocationName;
-  if ( *pLocationName == 48 )
-    v15 = pCurrentMapName;
-  if ( pMapStats->GetMapInfo(v15) )
-  {
-    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s]
-    pDialogueWindow = new GUIWindow_Transition(0, 0, window->GetWidth(), window->GetHeight(), 0, sHouseName.data());
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
-      pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
-    if ( IndoorLocation::GetLocationIndex(pLocationName) )
-      uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
-    return;
-  }
-  strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти
-  pDialogueWindow = new GUIWindow_Transition(0, 0, window->GetWidth(), window->GetHeight(), 0, sHouseName.data());
-  //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
-    //PlayHouseSound(anim_id, HouseSound_Greeting);
-  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
-    pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
-  if ( IndoorLocation::GetLocationIndex(pLocationName) )
-    uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
+
+  auto hint = this->Hint = sHouseName.data();
+
+//
+// --------------------------------
+// 0041C432 GUIWindow c-tor -- part
+  prev_screen_type = current_screen_type;
+  current_screen_type = SCREEN_INPUT_BLV;
+  pBtn_ExitCancel = CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); // Cancel / Отмена
+  pBtn_YES = CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
+  CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, hint, 0);
+  CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, hint, 0);
 }
 
+
 //----- (00444C8F) --------------------------------------------------------
-void TravelUI_Load()
+GUIWindow_Travel::GUIWindow_Travel() :
+    GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
 {
+// ------------------------------
+// 00444C8F TravelUI_Load -- part
   char pContainer[32]; // [sp+0h] [bp-28h]@1
 
   pEventTimer->Pause();
@@ -125,11 +167,41 @@
     sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);// "Leave %s"
   else
     strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit"
-  pDialogueWindow = new GUIWindow_Travel(0, 0, window->GetWidth(), window->GetHeight(), 0, sHouseName.data());
+
+
+
+  auto hint = this->Hint = sHouseName.data();
+
+// --------------------------------
+// 0041C432 GUIWindow c-tor -- part
+  prev_screen_type = current_screen_type;
+  current_screen_type = SCREEN_CHANGE_LOCATION;
+  pBtn_ExitCancel = CreateButton(
+      566, 445, 75, 33, 1, 0,
+      UIMSG_CHANGE_LOCATION_ClickCencelBtn,
+      0,
+      'N',
+      pGlobalTXT_LocalizationStrings[156],
+      pIcons_LOD->GetTexture(uTextureID_BUTTDESC2),
+      0
+  );// Stay in this area / Остаться в этой области
+  pBtn_YES = CreateButton(
+      486, 445, 75, 33, 1, 0,
+      UIMSG_OnTravelByFoot,
+      0,
+      'Y',
+      hint,
+      pIcons_LOD->GetTexture(uTextureID_BUTTYES2),
+      0
+  );
+  CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', hint, 0, 0, 0);
+  CreateButton(8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, hint, 0);
 }
 
+
+
 //----- (00444DCA) --------------------------------------------------------
-void TravelUI_Draw()
+void GUIWindow_Travel::Update()
 {
   GUIWindow travel_window; // [sp+Ch] [bp-78h]@1
   char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1
@@ -163,8 +235,10 @@
   }
 }
 
+
+
 //----- (00444A51) --------------------------------------------------------
-void TransitionUI_Draw()
+void GUIWindow_Transition::Update()
 {
   unsigned int v4; // [sp-10h] [bp-7Ch]@12
   GUIWindow transition_window; // [sp+Ch] [bp-60h]@1
--- a/GUI/UI/UITransition.h	Mon May 11 09:51:04 2015 +0200
+++ b/GUI/UI/UITransition.h	Mon May 11 16:43:46 2015 +0200
@@ -1,1 +1,21 @@
-#pragma once
\ No newline at end of file
+#pragma once
+#include "GUI/GUIWindow.h"
+
+struct GUIWindow_Travel : public GUIWindow
+{
+    GUIWindow_Travel();
+    virtual ~GUIWindow_Travel() {}
+
+    virtual void Update();
+    virtual void Release();
+};
+
+
+struct GUIWindow_Transition : public GUIWindow
+{
+    GUIWindow_Transition(uint32_t anim_id, uint32_t exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName);
+    virtual ~GUIWindow_Transition() {}
+
+    virtual void Update();
+    virtual void Release();
+};
\ No newline at end of file