changeset 2553:48708da03b7f

Party Creation UI logic separated from MainMenu
author a.parshin
date Wed, 13 May 2015 02:20:05 +0200
parents ac16f4a3a91e
children f2a8ed07e921
files Build/Visual Studio 2013/World of Might and Magic.vcxproj Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Engine/Engine.cpp GUI/UI/UIPartyCreation.cpp GUI/UI/UIPartyCreation.h Game/CreateParty.cpp Game/CreateParty.h Game/MainMenu.cpp Game/MainMenuLoad.cpp
diffstat 9 files changed, 362 insertions(+), 138 deletions(-) [+]
line wrap: on
line diff
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj	Wed May 13 01:33:20 2015 +0200
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj	Wed May 13 02:20:05 2015 +0200
@@ -151,6 +151,7 @@
     <ClCompile Include="..\..\Engine\TurnEngine\TurnEngine.cpp" />
     <ClCompile Include="..\..\Engine\VectorTypes.cpp" />
     <ClCompile Include="..\..\Engine\ZlibWrapper.cpp" />
+    <ClCompile Include="..\..\Game\CreateParty.cpp" />
     <ClCompile Include="..\..\Game\Game.cpp" />
     <ClCompile Include="..\..\Game\GameOver.cpp" />
     <ClCompile Include="..\..\Game\MainMenu.cpp" />
@@ -331,6 +332,7 @@
     <ClInclude Include="..\..\Engine\TurnEngine\TurnEngine.h" />
     <ClInclude Include="..\..\Engine\VectorTypes.h" />
     <ClInclude Include="..\..\Engine\ZlibWrapper.h" />
+    <ClInclude Include="..\..\Game\CreateParty.h" />
     <ClInclude Include="..\..\Game\Game.h" />
     <ClInclude Include="..\..\Game\GameOver.h" />
     <ClInclude Include="..\..\Game\MainMenu.h" />
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters	Wed May 13 01:33:20 2015 +0200
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters	Wed May 13 02:20:05 2015 +0200
@@ -604,6 +604,9 @@
     <ClCompile Include="..\..\Game\MainMenuLoad.cpp">
       <Filter>Game</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\Game\CreateParty.cpp">
+      <Filter>Game</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\lib\libavcodec\avcodec.h">
@@ -1375,6 +1378,9 @@
     <ClInclude Include="..\..\Game\MainMenuLoad.h">
       <Filter>Game</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\Game\CreateParty.h">
+      <Filter>Game</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\lib\OpenAL\lib\x86\avcodec-55.def">
--- a/Engine/Engine.cpp	Wed May 13 01:33:20 2015 +0200
+++ b/Engine/Engine.cpp	Wed May 13 02:20:05 2015 +0200
@@ -1,76 +1,76 @@
-
-
 #define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
 #include <stdlib.h>
 #include <crtdbg.h>
-
-#define _CRT_SECURE_NO_WARNINGS
+#include <direct.h>
 
 #include "Engine/Engine.h"
-
-#include "Arcomage\Arcomage.h"
-
+#include "Engine/Party.h"
+#include "Engine/Timer.h"
+#include "Engine/LOD.h"
+#include "Engine/Events.h"
+#include "Engine/OurMath.h"
+#include "Engine/texts.h"
+#include "Engine/stru123.h"
+#include "Engine/LuaVM.h"
+#include "Engine/MMT.h"
+#include "Engine/SaveLoad.h"
+#include "Engine/Registry.h"
 #include "Engine/Graphics/Vis.h"
 #include "Engine/Graphics/Weather.h"
 #include "Engine/Graphics/LightmapBuilder.h"
 #include "Engine/Graphics/DecalBuilder.h"
 #include "Engine/Graphics/ParticleEngine.h"
-#include "IO/Mouse.h"
-#include "IO/Keyboard.h"
 #include "Engine/Graphics/GammaControl.h"
-#include "stru6.h"
 #include "Engine/Graphics/stru9.h"
 #include "Engine/Graphics/stru10.h"
-
-#include "Engine/Party.h"
 #include "Engine/Graphics/Viewport.h"
-#include "Engine/Timer.h"
 #include "Engine/Graphics/Outdoor.h"
 #include "Engine/Graphics/Overlays.h"
-#include "Media/Audio/AudioPlayer.h"
-#include "Engine/LOD.h"
-#include "GUI/GUIWindow.h"
+#include "Engine/Graphics/Lights.h"
+#include "Engine/Graphics/Level/Decoration.h"
+#include "Engine/Graphics/PaletteManager.h"
+#include "Engine/Graphics/DecorationList.h"
+#include "Engine/Graphics/RenderD3D11.h"
+#include "Engine/Graphics/Sprites.h"
 #include "Engine/TurnEngine/TurnEngine.h"
-#include "Media/Video/Bink_Smacker.h"
-#include "Engine/Events.h"
-#include "Engine/OurMath.h"
-#include "Engine/texts.h"
-#include "GUI/GUIFont.h"
-#include "Engine/Graphics/Lights.h"
 #include "Engine/Spells/CastSpellInfo.h"
 #include "Engine/Tables/FrameTableInc.h"
 #include "Engine/Objects/Actor.h"
+#include "Engine/Objects/ObjectList.h"
+#include "Engine/Objects/SpriteObject.h"
+#include "Engine/Objects/Chest.h"
+
+#include "Arcomage\Arcomage.h"
+
+#include "IO/Mouse.h"
+#include "IO/Keyboard.h"
+
+#include "GUI/GUIWindow.h"
 #include "GUI/GUIProgressBar.h"
-#include "Engine/Objects/ObjectList.h"
-#include "Engine/Graphics/Level/Decoration.h"
-#include "Engine/Graphics/PaletteManager.h"
+#include "GUI/GUIFont.h"
+#include "GUI/UI/UIGame.h"
 #include "GUI/UI/UIHouses.h"
 #include "GUI/UI/UIShops.h"
 #include "GUI/UI/UIPartyCreation.h"
-#include "Engine/SaveLoad.h"
-#include "Engine/Objects/SpriteObject.h"
-#include "Engine/Graphics/Sprites.h"
-#include "Engine/Registry.h"
-#include "Engine/Objects/Chest.h"
-
-#include "GUI/UI/UIGame.h"
-
-#include "Engine/Graphics/DecorationList.h"
+
+#include "GUI/NewUI/MainMenu.h"
+
+#include "Media/Audio/AudioPlayer.h"
+#include "Media/Video/Bink_Smacker.h"
+
 #include "Engine/Tables/IconFrameTable.h"
 #include "Engine/Tables/PlayerFrameTable.h"
-#include "Engine/MapsLongTimer.h"
 #include "Engine/Tables/StorylineTextTable.h"
 #include "Engine/Tables/FactionTable.h"
-#include "Engine/stru123.h"
-#include "Engine/LuaVM.h"
-#include "Engine/Graphics/RenderD3D11.h"
-#include "Engine/MMT.h"
-#include "GUI/NewUI\MainMenu.h"
+#include "Engine/MapsLongTimer.h"
 
 #include "Game/Game.h"
 #include "Game/MainMenu.h"
-
-#include <direct.h>
+#include "Game/MainMenuLoad.h"
+#include "Game/CreateParty.h"
+
+#include "stru6.h"
 
 
 
@@ -1822,27 +1822,16 @@
                 pEngine->Deinitialize();
                 return true;
             }
-
-            if (GetCurrentMenuID() == MENU_NEWGAME)
+            else if (GetCurrentMenuID() == MENU_SAVELOAD)
             {
-                if (use_music_folder)
-                    alSourceStop(mSourceID);
-                else
-                {
-                    if (pAudioPlayer->hAILRedbook)
-                        AIL_redbook_stop(pAudioPlayer->hAILRedbook);
-                }
-                pParty->Reset();
-                pOtherOverlayList->Reset();
-                strcpy(pCurrentMapName, pStartingMapName);
-                pParty->CreateDefaultParty(0);
-                PlayerCreationUI_Initialize();
-                if (PlayerCreationUI_Loop())
-                {
-                    DeleteCCharFont();
+                MainMenuLoad_Loop();
+                break;
+            }
+            else if (GetCurrentMenuID() == MENU_NEWGAME)
+            {
+                if (!CreateParty_Loop())
                     break;
-                }
-                DeleteCCharFont();
+
                 bFlashQuestBook = true;
                 pMediaPlayer->PlayFullscreenMovie(MOVIE_Emerald, true);
                 SaveNewGame();
--- a/GUI/UI/UIPartyCreation.cpp	Wed May 13 01:33:20 2015 +0200
+++ b/GUI/UI/UIPartyCreation.cpp	Wed May 13 02:20:05 2015 +0200
@@ -1,29 +1,28 @@
 #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/LOD.h"
+#include "Engine/Timer.h"
+#include "Engine/texts.h"
+#include "Engine/MMT.h"
+#include "Engine/Graphics/Render.h"
+#include "Engine/Tables/IconFrameTable.h"
 
-#include "UIPartyCreation.h"
-#include "..\../IO/Mouse.h"
-#include "..\../IO/Keyboard.h"
+#include "IO/Mouse.h"
+#include "IO/Keyboard.h"
+
+#include "GUI/UI/UIPartyCreation.h"
+#include "GUI/GUIFont.h"
+
+#include "Media/Audio/AudioPlayer.h"
 
 #include "Game/Game.h"
 #include "Game/MainMenu.h"
-#include "..\../GUI/GUIWindow.h"
-#include "..\../GUI/GUIFont.h"
-#include "..\../Engine/Party.h"
-#include "..\../Media/Audio/AudioPlayer.h"
-#include "..\../Engine/Graphics/Render.h"
-#include "..\../Engine/LOD.h"
-#include "..\../Engine/Timer.h"
-#include "..\../Engine/Tables/IconFrameTable.h"
-#include "..\../Engine/texts.h"
-
-#include "..\../Engine/MMT.h"
-
+#include "Game/CreateParty.h"
 
 
 //----- (004908DE) --------------------------------------------------------
@@ -78,8 +77,11 @@
     pIcons_LOD->ReloadTexture(pTextures_PlayerFaces[player_id][i], pTmpBuf.data(), 2);
   }
 }
+
+
 //----- (00495B39) --------------------------------------------------------
-void PlayerCreationUI_Draw()
+//void PlayerCreationUI_Draw()
+void GUIWindow_PartyCreation::Update()
 {
   int pTextCenter; // eax@3
   IconFrame *pFrame; // eax@3
@@ -385,8 +387,10 @@
   pRenderer->EndScene();
 }
 
+
 //----- (0049695A) --------------------------------------------------------
-void  PlayerCreationUI_Initialize()
+GUIWindow_PartyCreation::GUIWindow_PartyCreation() :
+    GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
 {
   unsigned int v0; // ebx@5
   signed int uControlParam; // [sp+10h] [bp-Ch]@7
@@ -438,81 +442,84 @@
     pTextures_arrowr[i] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
   }
 
-  pGUIWindow_CurrentMenu = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0);
+  //pGUIWindow_CurrentMenu = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0);
   uControlParam = 0;
   uX = 8;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uX, 120, 145, 25, 1, 0, UIMSG_PlayerCreationChangeName, uControlParam, 0, "", 0);
+    CreateButton(uX, 120, 145, 25, 1, 0, UIMSG_PlayerCreationChangeName, uControlParam, 0, "", 0);
     uX += 158;
     ++uControlParam;
   }
   while ( (signed int)uX < window->GetWidth() );
 
-  pCreationUI_BtnPressLeft[0]   = pGUIWindow_CurrentMenu->CreateButton( 10,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  0, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[1]   = pGUIWindow_CurrentMenu->CreateButton(169,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  1, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[2]   = pGUIWindow_CurrentMenu->CreateButton(327,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  2, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[3]   = pGUIWindow_CurrentMenu->CreateButton(486,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  3, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[0]   = CreateButton( 10,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  0, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[1]   = CreateButton(169,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  1, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[2]   = CreateButton(327,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  2, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[3]   = CreateButton(486,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev,  3, 0, "", pTexture_presleft, 0);
 
-  pCreationUI_BtnPressRight[0]  = pGUIWindow_CurrentMenu->CreateButton( 74,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  0, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight[1]  = pGUIWindow_CurrentMenu->CreateButton(233,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  1, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight[2]  = pGUIWindow_CurrentMenu->CreateButton(391,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  2, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight[3]  = pGUIWindow_CurrentMenu->CreateButton(549,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  3, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[0]  = CreateButton( 74,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  0, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[1]  = CreateButton(233,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  1, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[2]  = CreateButton(391,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  2, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[3]  = CreateButton(549,  32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext,  3, 0, "", pTexture_pressrigh, 0);
 
-  pCreationUI_BtnPressLeft2[0]  = pGUIWindow_CurrentMenu->CreateButton( 10, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 0, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft2[1]  = pGUIWindow_CurrentMenu->CreateButton(169, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 1, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft2[2]  = pGUIWindow_CurrentMenu->CreateButton(327, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 2, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft2[3]  = pGUIWindow_CurrentMenu->CreateButton(486, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 3, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[0]  = CreateButton( 10, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 0, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[1]  = CreateButton(169, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 1, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[2]  = CreateButton(327, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 2, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[3]  = CreateButton(486, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 3, 0, "", pTexture_presleft, 0);
 
-  pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton( 74, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 0, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(233, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 1, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(391, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 2, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(549, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 3, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[0] = CreateButton( 74, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 0, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[1] = CreateButton(233, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 1, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[2] = CreateButton(391, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 2, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[3] = CreateButton(549, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 3, 0, "", pTexture_pressrigh, 0);
 
   uControlParam = 0;
   uX = 8;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uX, 308,          150, v0, 1, 0, UIMSG_48,                            uControlParam, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, v0 + 308,     150, v0, 1, 0, UIMSG_49,                            uControlParam, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, 2 * v0 + 308, 150, v0, 1, 0, UIMSG_PlayerCreationRemoveUpSkill,   uControlParam, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, 3 * v0 + 308, 150, v0, 1, 0, UIMSG_PlayerCreationRemoveDownSkill, uControlParam, 0, "", 0);
+    CreateButton(uX, 308,          150, v0, 1, 0, UIMSG_48,                            uControlParam, 0, "", 0);
+    CreateButton(uX, v0 + 308,     150, v0, 1, 0, UIMSG_49,                            uControlParam, 0, "", 0);
+    CreateButton(uX, 2 * v0 + 308, 150, v0, 1, 0, UIMSG_PlayerCreationRemoveUpSkill,   uControlParam, 0, "", 0);
+    CreateButton(uX, 3 * v0 + 308, 150, v0, 1, 0, UIMSG_PlayerCreationRemoveDownSkill, uControlParam, 0, "", 0);
+
     uX += 158;
     ++uControlParam;
   }
   while ( (signed int)uX < window->GetWidth() );
 
-  pGUIWindow_CurrentMenu->CreateButton(  5, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 0, '1', "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(163, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 1, '2', "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(321, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 2, '3', "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(479, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 3, '4', "", 0);
+  CreateButton(  5, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 0, '1', "", 0);
+  CreateButton(163, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 1, '2', "", 0);
+  CreateButton(321, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 2, '3', "", 0);
+  CreateButton(479, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 3, '4', "", 0);
 
   uX = 23;
   uControlParam = 2;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uX, 169,          120, 20, 1, 0, UIMSG_0, uControlParam - 2, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, v0 + 169,     120, 20, 1, 0, UIMSG_0, uControlParam - 1, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, 2 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, 3 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 1, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, 4 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 2, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, 5 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 3, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uX, 6 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 4, 0, "", 0);
+    CreateButton(uX, 169,          120, 20, 1, 0, UIMSG_0, uControlParam - 2, 0, "", 0);
+    CreateButton(uX, v0 + 169,     120, 20, 1, 0, UIMSG_0, uControlParam - 1, 0, "", 0);
+    CreateButton(uX, 2 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam, 0, "", 0);
+    CreateButton(uX, 3 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 1, 0, "", 0);
+    CreateButton(uX, 4 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 2, 0, "", 0);
+    CreateButton(uX, 5 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 3, 0, "", 0);
+    CreateButton(uX, 6 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParam + 4, 0, "", 0);
+
     uControlParam += 7;
     uX += 158;
   }
   while ( (signed int)uControlParam < 30 );
-  pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(28, 0, 7, 40);
+
+  _41D08F_set_keyboard_control_group(28, 0, 7, 40);
 
-  pGUIWindow_CurrentMenu->CreateButton(323, 417,          65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0,    0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417,     65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0xC,  0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x14, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388, 417,          65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x18, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388, v0 + 417,     65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x1C, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x20, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453, 417,          65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x10, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417,     65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 8,    0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 4,    0, "", 0);
+  CreateButton(323, 417,          65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0,    0, "", 0);
+  CreateButton(323, v0 + 417,     65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0xC,  0, "", 0);
+  CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x14, 0, "", 0);
+  CreateButton(388, 417,          65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x18, 0, "", 0);
+  CreateButton(388, v0 + 417,     65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x1C, 0, "", 0);
+  CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x20, 0, "", 0);
+  CreateButton(453, 417,          65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x10, 0, "", 0);
+  CreateButton(453, v0 + 417,     65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 8,    0, "", 0);
+  CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 4,    0, "", 0);
 
   uControlParam = 0;
   do
@@ -520,20 +527,20 @@
     uX = -5;
     if ( uControlParam <= 3 )
       uX = 0;
-    pGUIWindow_CurrentMenu->CreateButton(100 * (uControlParam / 3) + uX + 17, v0 * (uControlParam % 3) + 417, 100, v0, 1, 0, UIMSG_PlayerCreationSelectActiveSkill,
+    CreateButton(100 * (uControlParam / 3) + uX + 17, v0 * (uControlParam % 3) + 417, 100, v0, 1, 0, UIMSG_PlayerCreationSelectActiveSkill,
       uControlParam, 0, "", 0);
     ++uControlParam;
   }
   while ( uControlParam < 9 );
 
-  pPlayerCreationUI_BtnOK    = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, '\r', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0);
-  pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 'C', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0);
-  pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, '-', "", pTexture_buttminu, 0);
-  pPlayerCreationUI_BtnPlus  = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, '+', "", pTexture_buttplus, 0);
+  pPlayerCreationUI_BtnOK    = CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, '\r', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0);
+  pPlayerCreationUI_BtnReset = CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 'C', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0);
+  pPlayerCreationUI_BtnMinus = CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, '-', "", pTexture_buttminu, 0);
+  pPlayerCreationUI_BtnPlus  = CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, '+', "", pTexture_buttplus, 0);
 
   pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
 }
-// 4E28F8: using guessed type int current_screen_type;
+
 
 //----- (0049750E) --------------------------------------------------------
 void DeleteCCharFont()
@@ -579,8 +586,9 @@
       WaitMessage();
     else
     {
-      PlayerCreationUI_Draw();
-      MainMenu_EventLoop();
+      //PlayerCreationUI_Draw();
+      //MainMenu_EventLoop();
+        CreateParty_EventLoop();
       pRenderer->BeginScene();
       GUI_UpdateWindows();
       pRenderer->EndScene();
@@ -600,7 +608,10 @@
     }
   }
   main_menu_background.Release();
+
   pGUIWindow_CurrentMenu->Release();
+  pGUIWindow_CurrentMenu = nullptr;
+
   pIcons_LOD->RemoveTexturesPackFromTextureList();
 
   memset(v20, 0, 32);
--- a/GUI/UI/UIPartyCreation.h	Wed May 13 01:33:20 2015 +0200
+++ b/GUI/UI/UIPartyCreation.h	Wed May 13 02:20:05 2015 +0200
@@ -1,8 +1,19 @@
 #pragma once
+#include "GUI/GUIWindow.h"
+
+
+
 bool PlayerCreation_Choose4Skills();
 void LoadPlayerPortraintsAndVoices();
 void ReloadPlayerPortraits(int player_id, int face_id);
-void PlayerCreationUI_Draw();
-void PlayerCreationUI_Initialize();
 void DeleteCCharFont();
 bool PlayerCreationUI_Loop();
+
+
+struct GUIWindow_PartyCreation : public GUIWindow
+{
+             GUIWindow_PartyCreation();
+    virtual ~GUIWindow_PartyCreation() {}
+
+    virtual void Update();
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/CreateParty.cpp	Wed May 13 02:20:05 2015 +0200
@@ -0,0 +1,201 @@
+#include "Engine/Engine.h"
+#include "Engine/Party.h"
+#include "Engine/Graphics/Viewport.h"
+#include "Engine/Graphics/Overlays.h"
+
+#include "IO/Keyboard.h"
+
+#include "GUI/UI/UIPartyCreation.h"
+
+#include "Media/Audio/AudioPlayer.h"
+#include "Media/Audio/AIL.h"
+
+void CreateParty_EventLoop()
+{
+    auto pPlayer = pParty->pPlayers.data();
+    while (pMessageQueue_50CBD0->uNumMessages)
+    {
+        UIMessageType msg;
+        int param, param2;
+        pMessageQueue_50CBD0->PopMessage(&msg, &param, &param2);
+
+        switch (msg)
+        {
+            case UIMSG_PlayerCreation_SelectAttribute:
+            {
+                pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
+                    % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * param;
+                uPlayerCreationUI_SelectedCharacter = param;
+                pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
+            }
+            break;
+
+            case UIMSG_PlayerCreation_VoicePrev:
+            {
+                int sex = pParty->pPlayers[param].GetSexByVoice();
+                do
+                {
+                    if (pParty->pPlayers[param].uVoiceID == 0)
+                        pParty->pPlayers[param].uVoiceID = 19;
+                    else --pParty->pPlayers[param].uVoiceID;
+                } while (pParty->pPlayers[param].GetSexByVoice() != sex);
+                auto pButton = pCreationUI_BtnPressLeft2[param];
+
+                new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1);
+                pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
+                pParty->pPlayers[param].PlaySound(SPEECH_PickMe, 0);
+            }
+            break;
+
+            case UIMSG_PlayerCreation_VoiceNext:
+            {
+                int sex = pParty->pPlayers[param].GetSexByVoice();
+                do
+                {
+                    pParty->pPlayers[param].uVoiceID = (pParty->pPlayers[param].uVoiceID + 1) % 20;
+                } while (pParty->pPlayers[param].GetSexByVoice() != sex);
+                auto pButton = pCreationUI_BtnPressRight2[param];
+                new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1);
+                pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
+                pParty->pPlayers[param].PlaySound(SPEECH_PickMe, 0);
+            }
+            break;
+        case UIMSG_PlayerCreation_FacePrev:
+            //pPlayer = &pParty->pPlayers[pParam];
+            if (!pParty->pPlayers[param].uCurrentFace)
+                pParty->pPlayers[param].uCurrentFace = 19;
+            else
+                pParty->pPlayers[param].uCurrentFace -= 1;
+            pParty->pPlayers[param].uVoiceID = pParty->pPlayers[param].uCurrentFace;
+            pParty->pPlayers[param].SetInitialStats();
+            pParty->pPlayers[param].SetSexByVoice();
+            pParty->pPlayers[param].RandomizeName();
+            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
+                % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * param;
+            uPlayerCreationUI_SelectedCharacter = param;
+            new OnButtonClick(pCreationUI_BtnPressLeft[param]->uX, pCreationUI_BtnPressLeft[param]->uY, 0, 0, (int)pCreationUI_BtnPressLeft[param], (char *)1);
+            pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0.0, 0);
+            pParty->pPlayers[param].PlaySound(SPEECH_PickMe, 0);
+            break;
+        case UIMSG_PlayerCreation_FaceNext:
+            //pPlayer = &pParty->pPlayers[pParam];
+            int v20; v20 = (char)((int)pParty->pPlayers[param].uCurrentFace + 1) % 20;
+            pParty->pPlayers[param].uCurrentFace = v20;
+            pParty->pPlayers[param].uVoiceID = v20;
+            pParty->pPlayers[param].SetInitialStats();
+            pParty->pPlayers[param].SetSexByVoice();
+            pParty->pPlayers[param].RandomizeName();
+            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
+                % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * param;
+            uPlayerCreationUI_SelectedCharacter = param;
+            new OnButtonClick(pCreationUI_BtnPressRight[param]->uX, pCreationUI_BtnPressRight[param]->uY, 0, 0, (int)pCreationUI_BtnPressRight[param], (char *)1);
+            pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
+            pParty->pPlayers[param].PlaySound(SPEECH_PickMe, 0);
+            break;
+        case UIMSG_PlayerCreationClickPlus:
+            new OnButtonClick2(613, 393, 0, 0, (int)pPlayerCreationUI_BtnPlus, (char *)1);
+            pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
+            pAudioPlayer->PlaySound(SOUND_ClickMinus, 0, 0, -1, 0, 0, 0, 0);
+            break;
+        case UIMSG_PlayerCreationClickMinus:
+            new OnButtonClick2(523, 393, 0, 0, (int)pPlayerCreationUI_BtnMinus, (char *)1);
+            pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
+            pAudioPlayer->PlaySound(SOUND_ClickPlus, 0, 0, -1, 0, 0, 0, 0);
+            break;
+        case UIMSG_PlayerCreationSelectActiveSkill:
+            if (pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37)
+                pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(param + 4)] = 1;
+            pAudioPlayer->PlaySound(SOUND_ClickSkill, 0, 0, -1, 0, 0, 0, 0);
+            break;
+        case UIMSG_PlayerCreationSelectClass:
+            pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)param);
+            pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
+            break;
+        case UIMSG_PlayerCreationClickOK:
+            new OnButtonClick2(580, 431, 0, 0, (int)pPlayerCreationUI_BtnOK, 0);
+            if (PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills())
+                GameUI_Footer_TimeLeft = GetTickCount() + 4000;
+            else
+                uGameState = GAME_STATE_STARTING_NEW_GAME;
+            break;
+        case UIMSG_PlayerCreationClickReset:
+            new OnButtonClick2(527, 431, 0, 0, (int)pPlayerCreationUI_BtnReset, 0);
+            pParty->Reset();
+            break;
+        case UIMSG_PlayerCreationRemoveUpSkill:
+        {
+            int v4; v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
+            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * param;
+            if (pPlayer[param].GetSkillIdxByOrder(2) != 37)//37 - None(Νες)
+                pParty->pPlayers[param].pActiveSkills[pPlayer[param].GetSkillIdxByOrder(2)] = 0;
+        }
+        break;
+        case UIMSG_PlayerCreationRemoveDownSkill:
+        {
+            int v4; v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
+            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * param;
+            if (pPlayer[param].GetSkillIdxByOrder(3) != 37)//37 - None(Νες)
+                pParty->pPlayers[param].pActiveSkills[pPlayer[param].GetSkillIdxByOrder(3)] = 0;
+        }
+        break;
+        case UIMSG_PlayerCreationChangeName:
+            pAudioPlayer->PlaySound(SOUND_ClickSkill, 0, 0, -1, 0, 0, 0, 0);
+            uPlayerCreationUI_SelectedCharacter = param;
+            pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
+            pGUIWindow_CurrentMenu->ptr_1C = (void *)param;
+            break;
+        case UIMSG_Escape:
+            if (pModalWindow)
+            {
+                pModalWindow->Release();
+                pModalWindow = nullptr;
+                break;
+            }
+            if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_4000))
+                break;
+            viewparams->bRedrawGameUI = true;
+            viewparams->field_48 = 1;
+            if (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_MMT_MAIN_MENU
+                || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC)
+            {
+                //if ( current_screen_type == SCREEN_VIDEO )
+                //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);			  
+                pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
+            }
+            break;
+        case UIMSG_ChangeGameState:
+            uGameState = GAME_FINISHED;
+            break;
+        }
+    }
+}
+
+bool CreateParty_Loop()
+{
+// -------------------------------------------------------
+// 00462C94 bool MM_Main(const wchar_t *pCmdLine) --- part
+    extern bool use_music_folder;
+    if (use_music_folder)
+        alSourceStop(mSourceID);
+    else
+    {
+        if (pAudioPlayer->hAILRedbook)
+            AIL_redbook_stop(pAudioPlayer->hAILRedbook);
+    }
+    pParty->Reset();
+    pOtherOverlayList->Reset();
+    strcpy(pCurrentMapName, pStartingMapName);
+    pParty->CreateDefaultParty(0);
+
+    pGUIWindow_CurrentMenu = new GUIWindow_PartyCreation();//PlayerCreationUI_Initialize();
+    if (PlayerCreationUI_Loop())
+    {
+        DeleteCCharFont();
+        return false;
+    }
+    else
+    {
+        DeleteCCharFont();
+        return true;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/CreateParty.h	Wed May 13 02:20:05 2015 +0200
@@ -0,0 +1,6 @@
+#pragma once
+
+
+
+bool CreateParty_Loop();
+void CreateParty_EventLoop();
\ No newline at end of file
--- a/Game/MainMenu.cpp	Wed May 13 01:33:20 2015 +0200
+++ b/Game/MainMenu.cpp	Wed May 13 02:20:05 2015 +0200
@@ -62,8 +62,7 @@
                 break;
             case UIMSG_MainMenu_ShowLoadWindow:
                 new OnButtonClick2(495, 227, 0, 0, (int)pMainMenu_BtnLoad, 0);
-                //SetCurrentMenuID(MENU_SAVELOAD);
-                MainMenuLoad_Loop();
+                SetCurrentMenuID(MENU_SAVELOAD);
                 break;
             case UIMSG_ShowCredits:
                 new OnButtonClick2(495, 282, 0, 0, (int)pMainMenu_BtnCredits, 0);
@@ -73,7 +72,7 @@
                 new OnButtonClick2(495, 337, 0, 0, (int)pMainMenu_BtnExit, 0);
                 SetCurrentMenuID(MENU_EXIT_GAME);
                 break;
-            case UIMSG_PlayerCreation_SelectAttribute:
+            /*case UIMSG_PlayerCreation_SelectAttribute:
                 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
                     % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
                 uPlayerCreationUI_SelectedCharacter = pParam;
@@ -185,7 +184,7 @@
                 uPlayerCreationUI_SelectedCharacter = pParam;
                 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
                 pGUIWindow_CurrentMenu->ptr_1C = v3;
-                break;
+                break;*/
             case UIMSG_ChangeGameState:
                 uGameState = GAME_FINISHED;
                 break;
--- a/Game/MainMenuLoad.cpp	Wed May 13 01:33:20 2015 +0200
+++ b/Game/MainMenuLoad.cpp	Wed May 13 02:20:05 2015 +0200
@@ -111,7 +111,6 @@
 
 void MainMenuLoad_Loop()
 {
-    SetCurrentMenuID(MENU_SAVELOAD);
     current_screen_type = SCREEN_LOADGAME;
 
     main_menu_background.Release();