# HG changeset patch
# User Ritor1
# Date 1431526152 -21600
# Node ID 5d6fb8eb023c065ef2c6c5551b71b6f275270588
# Parent bbef1435eb8d2c764110ead70d8046f9a247e043# Parent f2a8ed07e921515aed74647c2681f5d5b32795d6
Слияние
diff -r bbef1435eb8d -r 5d6fb8eb023c Build/Visual Studio 2013/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj Wed May 13 20:09:00 2015 +0600
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj Wed May 13 20:09:12 2015 +0600
@@ -151,9 +151,12 @@
+
+
+
@@ -330,9 +333,12 @@
+
+
+
diff -r bbef1435eb8d -r 5d6fb8eb023c Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Wed May 13 20:09:00 2015 +0600
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj.filters Wed May 13 20:09:12 2015 +0600
@@ -601,6 +601,15 @@
GUI\UI
+
+ Game
+
+
+ Game
+
+
+ Game
+
@@ -1369,6 +1378,15 @@
GUI\UI
+
+ Game
+
+
+ Game
+
+
+ Game
+
diff -r bbef1435eb8d -r 5d6fb8eb023c Build/Visual Studio 2013/World of Might and Magic.vcxproj.user
--- a/Build/Visual Studio 2013/World of Might and Magic.vcxproj.user Wed May 13 20:09:00 2015 +0600
+++ b/Build/Visual Studio 2013/World of Might and Magic.vcxproj.user Wed May 13 20:09:12 2015 +0600
@@ -4,6 +4,6 @@
$(OutDir)$(TargetName)$(TargetExt)
$(OutDir)
WindowsLocalDebugger
- -nomarg -window -nointro -nologo
+ -nomarg -window -nointro -nologo -nocd
\ No newline at end of file
diff -r bbef1435eb8d -r 5d6fb8eb023c Engine/Engine.cpp
--- a/Engine/Engine.cpp Wed May 13 20:09:00 2015 +0600
+++ b/Engine/Engine.cpp Wed May 13 20:09:12 2015 +0600
@@ -1,76 +1,76 @@
-
-
#define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
#include
#include
-
-#define _CRT_SECURE_NO_WARNINGS
+#include
#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
+#include "Game/MainMenuLoad.h"
+#include "Game/CreateParty.h"
+
+#include "stru6.h"
@@ -1811,8 +1811,8 @@
Log::Warning(L"MM: entering main loop");
while (1)
{
- MainMenuWindow *main_menu_window = MainMenuWindow::Create();
- window->AddControl(main_menu_window);
+ //MainMenuWindow *main_menu_window = MainMenuWindow::Create();
+ //window->AddControl(main_menu_window);
MainMenu_Loop();
uGameState = GAME_STATE_PLAYING;
while (1)
@@ -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();
@@ -2456,7 +2445,7 @@
if (pGUIWindow_ScrollWindow)
free_book_subwindow();
- if (!current_screen_type && !pGUIWindow_Settings)
+ if (!current_screen_type && !pGUIWindow_CastTargetedSpell)
pEventTimer->Resume();
viewparams->bRedrawGameUI = 1;
}
diff -r bbef1435eb8d -r 5d6fb8eb023c Engine/Objects/Player.cpp
--- a/Engine/Objects/Player.cpp Wed May 13 20:09:00 2015 +0600
+++ b/Engine/Objects/Player.cpp Wed May 13 20:09:12 2015 +0600
@@ -7604,11 +7604,11 @@
enchantedItemPos = this->GetItemIDAtInventoryIndex(&invMatrixIndex);
if ( enchantedItemPos )
{
- /* *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;
- *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
- *((int *)pGUIWindow_Settings->ptr_1C + 3) = enchantedItemPos - 1;
- *((short *)pGUIWindow_Settings->ptr_1C + 3) = invMatrixIndex;*/
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ /* *((char *)pGUIWindow_CastTargetedSpell->ptr_1C + 8) &= 0x7Fu;
+ *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 2) = uActiveCharacter - 1;
+ *((int *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = enchantedItemPos - 1;
+ *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = invMatrixIndex;*/
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
pSpellInfo->uFlags &= 0x7F;
pSpellInfo->uPlayerID_2 = uActiveCharacter - 1;
pSpellInfo->spell_target_pid = enchantedItemPos - 1;
diff -r bbef1435eb8d -r 5d6fb8eb023c Engine/SaveLoad.cpp
--- a/Engine/SaveLoad.cpp Wed May 13 20:09:00 2015 +0600
+++ b/Engine/SaveLoad.cpp Wed May 13 20:09:12 2015 +0600
@@ -179,7 +179,11 @@
}
}
- pGUIWindow_CurrentMenu->Release();
+ if (pGUIWindow_CurrentMenu)
+ {
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = nullptr;
+ }
current_screen_type = SCREEN_GAME;
viewparams->bRedrawGameUI = true;
diff -r bbef1435eb8d -r 5d6fb8eb023c Engine/Spells/CastSpellInfo.cpp
--- a/Engine/Spells/CastSpellInfo.cpp Wed May 13 20:09:00 2015 +0600
+++ b/Engine/Spells/CastSpellInfo.cpp Wed May 13 20:09:12 2015 +0600
@@ -3284,8 +3284,8 @@
if (pCastSpellInfo[i].uSpellID && pCastSpellInfo[i].uFlags & 0x3CA)
{
pCastSpellInfo[i].uSpellID = 0;
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = nullptr;
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
_50C9A0_IsEnchantingInProgress = 0;
@@ -3487,8 +3487,8 @@
spell->uSpellID = 0;
if (spell->uFlags & 0x3CA)
{
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = nullptr;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = nullptr;
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
_50C9A0_IsEnchantingInProgress = 0;
@@ -3501,44 +3501,44 @@
{
if ( a5 & 2 )
{
- if ( pGUIWindow_Settings )
+ if ( pGUIWindow_CastTargetedSpell )
return;
- pGUIWindow_Settings = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
- pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0);
- pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0);
- pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0);
- pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0);
+ pGUIWindow_CastTargetedSpell = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0);
pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
return;
}
if ( a5 & 8 )
{
- if ( pGUIWindow_Settings )
+ if ( pGUIWindow_CastTargetedSpell )
return;
- pGUIWindow_Settings = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
- pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0);
+ pGUIWindow_CastTargetedSpell = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0);
pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
return;
}
if ( a5 & 0x40 )
{
- if ( pGUIWindow_Settings )
+ if ( pGUIWindow_CastTargetedSpell )
return;
- pGUIWindow_Settings = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
- pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Telekinesis, 0, 0, "", 0);
+ pGUIWindow_CastTargetedSpell = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Telekinesis, 0, 0, "", 0);
pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
return;
}
if ( (char)a5 < 0 )
{
- if ( pGUIWindow_Settings )
+ if ( pGUIWindow_CastTargetedSpell )
return;
++pIcons_LOD->uTexturePacksCount;
if ( !pIcons_LOD->uNumPrevLoadedFiles )
pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
- pGUIWindow_Settings = pCastSpellInfo[result].GetCastSpellInInventoryWindow();
+ pGUIWindow_CastTargetedSpell = pCastSpellInfo[result].GetCastSpellInInventoryWindow();
_50C9A0_IsEnchantingInProgress = 1;
some_active_character = uActiveCharacter;
pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
@@ -3546,31 +3546,31 @@
}
if ( HIBYTE(a5) & 1 )
{
- if ( pGUIWindow_Settings )
+ if ( pGUIWindow_CastTargetedSpell )
return;
- pGUIWindow_Settings = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
- pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0);
- pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0);
- pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0);
- pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0);
- pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL);
+ pGUIWindow_CastTargetedSpell = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL);
pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
}
- if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings )
+ if ( HIBYTE(a5) & 2 && !pGUIWindow_CastTargetedSpell )
{
- pGUIWindow_Settings = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
- pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178,
+ pGUIWindow_CastTargetedSpell = new OnCastTargetedSpell(0, 0, window->GetWidth(), window->GetHeight(), (int)&pCastSpellInfo[result], 0);
+ pBtn_NPCLeft = pGUIWindow_CastTargetedSpell->CreateButton(469, 178,
pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth,
pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight,
1, 0, UIMSG_ScrollNPCPanel, 0, 0, "",
pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0);
- pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178,
+ pBtn_NPCRight = pGUIWindow_CastTargetedSpell->CreateButton(626, 178,
pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth,
pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight,
1, 0, UIMSG_ScrollNPCPanel, 1, 0, "",
pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0);
- pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0);
- pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0);
+ pGUIWindow_CastTargetedSpell->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0);
}
}
}
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/GUIButton.cpp
--- a/GUI/GUIButton.cpp Wed May 13 20:09:00 2015 +0600
+++ b/GUI/GUIButton.cpp Wed May 13 20:09:12 2015 +0600
@@ -85,7 +85,7 @@
struct GUIWindow *ptr_507BC8;
struct GUIWindow *pGUIWindow_CurrentMenu;
struct GUIWindow *ptr_507BD0;
-struct GUIWindow *pGUIWindow_Settings;
+struct GUIWindow *pGUIWindow_CastTargetedSpell;
struct GUIWindow *pModalWindow;
struct GUIWindow *pGUIWindow_EscMessageWindow;
struct GUIWindow *pBooksButtonOverlay;
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/GUIWindow.cpp
--- a/GUI/GUIWindow.cpp Wed May 13 20:09:00 2015 +0600
+++ b/GUI/GUIWindow.cpp Wed May 13 20:09:12 2015 +0600
@@ -64,7 +64,7 @@
enum WindowType current_character_screen_window;
struct GUIWindow *pWindow_MMT_MainMenu;
struct GUIWindow *pWindow_MainMenu;
-std::array pWindowList;
+std::array pWindowList;
struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue;
struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue;
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/GUIWindow.h
--- a/GUI/GUIWindow.h Wed May 13 20:09:00 2015 +0600
+++ b/GUI/GUIWindow.h Wed May 13 20:09:12 2015 +0600
@@ -37,7 +37,7 @@
UIMSG_MainMenu_ShowLoadWindow = 55,
UIMSG_ShowCredits = 56,
UIMSG_ExitToWindows = 57,
- UIMSG_3A = 58,
+ UIMSG_DebugBlv = 58,
UIMSG_PlayerCreationChangeName = 60,
@@ -134,7 +134,7 @@
UIMSG_PlayerCreation_FacePrev = 171,
UIMSG_PlayerCreation_FaceNext = 172,
UIMSG_AD = 173,
- UIMSG_AE = 174,
+ UIMSG_DebugBlv2 = 174,
UIMSG_ClickNPCTopic = 175,
UIMSG_CycleCharacters = 176,
UIMSG_OnCastLloydsBeacon = 177,
@@ -606,7 +606,7 @@
extern enum WindowType current_character_screen_window;
extern struct GUIWindow *pWindow_MMT_MainMenu;
extern struct GUIWindow *pWindow_MainMenu;
-extern std::array pWindowList;
+extern std::array pWindowList;
@@ -830,7 +830,7 @@
extern struct GUIWindow *ptr_507BC8;
extern struct GUIWindow *pGUIWindow_CurrentMenu;
extern struct GUIWindow *ptr_507BD0;
-extern struct GUIWindow *pGUIWindow_Settings;
+extern struct GUIWindow *pGUIWindow_CastTargetedSpell;
extern struct GUIWindow *pModalWindow;
extern struct GUIWindow *pGUIWindow_EscMessageWindow;
extern struct GUIWindow *pBooksButtonOverlay;
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/UI/UICharacter.cpp
--- a/GUI/UI/UICharacter.cpp Wed May 13 20:09:00 2015 +0600
+++ b/GUI/UI/UICharacter.cpp Wed May 13 20:09:12 2015 +0600
@@ -2743,11 +2743,11 @@
}
if ( _50C9A0_IsEnchantingInProgress )//
{
- /* *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;//CastSpellInfo
- *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
- *((int *)pGUIWindow_Settings->ptr_1C + 3) = v36;
- *((short *)pGUIWindow_Settings->ptr_1C + 3) = pEquipType;*/
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ /* *((char *)pGUIWindow_CastTargetedSpell->ptr_1C + 8) &= 0x7Fu;//CastSpellInfo
+ *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 2) = uActiveCharacter - 1;
+ *((int *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = v36;
+ *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = pEquipType;*/
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
pSpellInfo->uFlags &= 0x7F;
pSpellInfo->uPlayerID_2 = uActiveCharacter - 1;
pSpellInfo->spell_target_pid = v34 - 1;
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/UI/UIMainMenu.cpp
--- a/GUI/UI/UIMainMenu.cpp Wed May 13 20:09:00 2015 +0600
+++ b/GUI/UI/UIMainMenu.cpp Wed May 13 20:09:12 2015 +0600
@@ -56,8 +56,8 @@
POINT pt;
pMouse->GetCursorPos(&pt);
GUIWindow *pWindow = this;//pWindow_MainMenu;
- if (GetCurrentMenuID() == MENU_SAVELOAD)
- pWindow = pGUIWindow_CurrentMenu;
+ //if (GetCurrentMenuID() == MENU_SAVELOAD)
+ // pWindow = pGUIWindow_CurrentMenu;
if (GetCurrentMenuID() == MENU_MAIN)
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/UI/UIPartyCreation.cpp
--- a/GUI/UI/UIPartyCreation.cpp Wed May 13 20:09:00 2015 +0600
+++ b/GUI/UI/UIPartyCreation.cpp Wed May 13 20:09:12 2015 +0600
@@ -1,29 +1,28 @@
#define _CRTDBG_MAP_ALLOC
+#define _CRT_SECURE_NO_WARNINGS
#include
#include
-#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);
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/UI/UIPartyCreation.h
--- a/GUI/UI/UIPartyCreation.h Wed May 13 20:09:00 2015 +0600
+++ b/GUI/UI/UIPartyCreation.h Wed May 13 20:09:12 2015 +0600
@@ -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
diff -r bbef1435eb8d -r 5d6fb8eb023c GUI/UI/UiGame.cpp
--- a/GUI/UI/UiGame.cpp Wed May 13 20:09:00 2015 +0600
+++ b/GUI/UI/UiGame.cpp Wed May 13 20:09:12 2015 +0600
@@ -44,8 +44,6 @@
int uTextureID_GameUI_CharSelectionFrame; // 50C98C
-
-
GUIWindow_GameMenu::GUIWindow_GameMenu() :
GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
{
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/CreateParty.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/CreateParty.cpp Wed May 13 20:09:12 2015 +0600
@@ -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, ¶m, ¶m2);
+
+ 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
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/CreateParty.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/CreateParty.h Wed May 13 20:09:12 2015 +0600
@@ -0,0 +1,6 @@
+#pragma once
+
+
+
+bool CreateParty_Loop();
+void CreateParty_EventLoop();
\ No newline at end of file
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/Game.cpp
--- a/Game/Game.cpp Wed May 13 20:09:00 2015 +0600
+++ b/Game/Game.cpp Wed May 13 20:09:12 2015 +0600
@@ -53,6 +53,7 @@
#include "GUI/UI/Books/JournalBook.h"
#include "Game/Game.h"
+#include "Game/GameMenu.h"
void DoThatMessageThing()
@@ -111,58 +112,38 @@
}
-void Game_StartNewGameWhilePlaying(bool force_start)
+
+void Game_CloseTargetedSpellWindow()
{
- if (dword_6BE138 == 124 || force_start)
+ if (pGUIWindow_CastTargetedSpell)
{
- pIcons_LOD->SyncLoadedFilesCount();
- pIcons_LOD->RemoveTexturesPackFromTextureList();
- DoThatMessageThing();
- pGUIWindow_CurrentMenu->Release();
- uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU;
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = 1;
+ if (current_screen_type == SCREEN_CHARACTERS)
+ pMouse->SetCursorBitmap("MICON2");
+ else
+ {
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = nullptr;
+ pMouse->SetCursorBitmap("MICON1");
+ GameUI_Footer_TimeLeft = 0;
+ _50C9A0_IsEnchantingInProgress = 0;
+ back_to_game();
+ }
}
- else
- {
- ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game"
- pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0);
- dword_6BE138 = 124;
- }
- stru_506E40.Release();
}
-void Game_QuitGameWhilePlaying(bool force_quit)
+void Game_OnEscape()
{
- if (dword_6BE138 == 132 || force_quit)
- {
- pIcons_LOD->SyncLoadedFilesCount();
- pIcons_LOD->RemoveTexturesPackFromTextureList();
- DoThatMessageThing();
- pGUIWindow_CurrentMenu->Release();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = 1;
- pAudioPlayer->PlaySound(SOUND_WoodDoorClosing, 0, 0, -1, 0, 0, 0, 0);
- uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU;
- }
- else
- {
- ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit"
- pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0);
- dword_6BE138 = 132;
- }
- stru_506E40.Release();
-}
-
-void Game_OpenLoadGameDialog()
-{
- pIcons_LOD->SyncLoadedFilesCount();
- pIcons_LOD->RemoveTexturesPackFromTextureList();
- DoThatMessageThing();
+ Game_CloseTargetedSpellWindow();
+ if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
+ uActiveCharacter = pParty->GetNextActiveCharacter();
pGUIWindow_CurrentMenu->Release();
-
- //LoadUI_Load(1);
- pGUIWindow_CurrentMenu = new GUIWindow_Load(true);
+ if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
+ window_SpeakInHouse = 0;
+ pGUIWindow_CurrentMenu = 0;
+ pEventTimer->Resume();
+ current_screen_type = SCREEN_GAME;
+ viewparams->bRedrawGameUI = true;
+ pIcons_LOD->RemoveTexturesFromTextureList();
}
@@ -334,9 +315,9 @@
case UIMSG_SelectShopDialogueOption: OnSelectShopDialogueOption(uMessageParam); continue;
case UIMSG_SelectNPCDialogueOption: OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam); continue;
case UIMSG_ClickHouseNPCPortrait: _4B4224_UpdateNPCTopics(uMessageParam); continue;
- case UIMSG_StartNewGame: Game_StartNewGameWhilePlaying(uMessageParam); continue;
- case UIMSG_Game_OpenLoadGameDialog: Game_OpenLoadGameDialog(); continue;
- case UIMSG_Quit: Game_QuitGameWhilePlaying(uMessageParam); continue;
+ //case UIMSG_StartNewGame: Game_StartNewGameWhilePlaying(uMessageParam); continue;
+ //case UIMSG_Game_OpenLoadGameDialog: Game_OpenLoadGameDialog(); continue;
+ //case UIMSG_Quit: Game_QuitGameWhilePlaying(uMessageParam); continue;
case UIMSG_80:
__debugbreak();
pIcons_LOD->SyncLoadedFilesCount();
@@ -345,7 +326,7 @@
current_screen_type = SCREEN_OPTIONS;
__debugbreak();//pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_8, 0, 0);
continue;
- case UIMSG_ArrowUp:
+ /*case UIMSG_ArrowUp:
--pSaveListPosition;
if (pSaveListPosition < 0)
pSaveListPosition = 0;
@@ -356,11 +337,11 @@
if (pSaveListPosition >= uMessageParam)
pSaveListPosition = uMessageParam - 1;
new OnButtonClick2(215, 323, 17, 17, (int)pBtnDownArrow, 0);
- continue;
+ continue;*/
case UIMSG_Cancel:
new OnCancel(350, 302, 106, 42, (int)pBtnCancel, 0);
continue;
- case UIMSG_SaveLoadBtn:
+ /*case UIMSG_SaveLoadBtn:
new OnSaveLoad(241, 302, 106, 42, (int)pBtnLoadSlot, 0);
continue;
case UIMSG_SelectLoadSlot:
@@ -405,6 +386,8 @@
case UIMSG_Game_OpenSaveGameDialog:
{
pGUIWindow_CurrentMenu->Release();
+
+ current_screen_type = SCREEN_SAVEGAME;
pGUIWindow_CurrentMenu = new GUIWindow_Save(); //SaveUI_Load(current_screen_type = SCREEN_SAVEGAME);
continue;
}
@@ -664,27 +647,27 @@
continue;
case UIMSG_SetGraphicsMode:
- /*if ( !bUseLoResSprites )
- {
- byte_6BE388_graphicsmode = uMessageParam;
- MM7Initialization();
- continue;
- }
- if ( uMessageParam )
- {
- if ( uMessageParam == 1 )
- {
- byte_6BE388_graphicsmode = 0;
- }
- else
- {
- if ( uMessageParam != 2 )
- continue;
- byte_6BE388_graphicsmode = 1;
- }
- MM7Initialization();
- continue;
- }*/
+ //if ( !bUseLoResSprites )
+ //{
+ // byte_6BE388_graphicsmode = uMessageParam;
+ // MM7Initialization();
+ // continue;
+ //}
+ //if ( uMessageParam )
+ //{
+ // if ( uMessageParam == 1 )
+ // {
+ // byte_6BE388_graphicsmode = 0;
+ // }
+ // else
+ // {
+ // if ( uMessageParam != 2 )
+ // continue;
+ // byte_6BE388_graphicsmode = 1;
+ // }
+ // MM7Initialization();
+ // continue;
+ //}
pModalWindow = new GUIWindow_Modal(pNPCTopics[453].pText, UIMSG_0);
__debugbreak(); // Nomad: graphicsmode as it was now removed
continue;
@@ -695,7 +678,7 @@
current_screen_type = SCREEN_GAME;
viewparams->bRedrawGameUI = 1;
stru_506E40.Release();
- continue;
+ continue;*/
case UIMSG_OpenQuestBook:
DoThatMessageThing();
if (current_screen_type != SCREEN_GAME)
@@ -753,42 +736,142 @@
}
break;
}
- if (!pModalWindow)
+ if (pModalWindow)
{
+ pModalWindow->Release();
+ pModalWindow = nullptr;
+ continue;
+ }
pRenderer->ClearZBuffer(0, 479);
- viewparams->bRedrawGameUI = 1;
+ viewparams->bRedrawGameUI = true;
viewparams->field_48 = 1;
- if (current_screen_type != SCREEN_GAME)
+ if (current_screen_type == SCREEN_GAME)
+ {
+ if (!pGUIWindow_CastTargetedSpell)//Draw Menu
+ {
+ dword_6BE138 = -1;
+ new OnButtonClick2(0x25Au, 0x1C2u, 0, 0, (int)pBtn_GameSettings, (char *)1);
+
+ DoThatMessageThing();
+ GameMenu_Loop();
+ }
+ else
+ {
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = 0;
+ pMouse->SetCursorBitmap("MICON1");
+ GameUI_Footer_TimeLeft = 0;
+ _50C9A0_IsEnchantingInProgress = 0;
+ back_to_game();
+ }
+ continue;
+ }
+ else if (current_screen_type == SCREEN_MENU)
+ {/*
+ pIcons_LOD->SyncLoadedFilesCount();
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ pIcons_LOD->SyncLoadedFilesCount();
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ stru_506E40.Release();
+ Game_OnEscape();*/
+ break;
+ }
+ else if (current_screen_type == SCREEN_SAVEGAME || current_screen_type == SCREEN_LOADGAME)
+ {/*
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ //crt_deconstruct_ptr_6A0118();
+ stru_506E40.Release();
+ Game_OnEscape();*/
+ break;
+ }
+ else if (current_screen_type == SCREEN_OPTIONS)
+ {/*
+ options_menu_skin.Relaease();
+ pIcons_LOD->SyncLoadedFilesCount();
+ WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
+ WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
+ WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
+ WriteWindowsRegistryInt("WalkSound", bWalkSound);
+ WriteWindowsRegistryInt("ShowDamage", bShowDamage);
+ //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
+ WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
+ WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
+ if (uTurnSpeed == 0)
+ WriteWindowsRegistryInt("TurnDelta", 3);
+ else if (uTurnSpeed == 64)
+ WriteWindowsRegistryInt("TurnDelta", 2);
+ else if (uTurnSpeed == 128)
+ WriteWindowsRegistryInt("TurnDelta", 1);
+ stru_506E40.Release();
+ Game_OnEscape();*/
+ break;
+ }
+ else if (current_screen_type == SCREEN_VIDEO_OPTIONS)
+ {/*
+ //if ( pRenderer->pRenderD3D )
+ {
+ WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights);
+ WriteWindowsRegistryInt("Tinting", pRenderer->bTinting);
+ WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pEngine->uFlags2) >> 5) & 1);
+ }
+
+ stru_506E40.Release();
+ Game_OnEscape();*/
+ break;
+ }
+ else if (current_screen_type == SCREEN_KEYBOARD_OPTIONS)
+ {
+ /*v197 = 1;
+ pKeyBindingFlag = false;
+ for (uint i = 0; i < 28; ++i)
+ {
+ if (GameMenuUI_InvaligKeyBindingsFlags[i])
+ pKeyBindingFlag = true;
+ }
+ if (!pKeyBindingFlag)
+ {
+ for (uint i = 0; i < 5; i++)
+ {
+ if (uTextureID_Optkb[i])
+ pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release();
+ }
+ memset(&uTextureID_Optkb, 0, 20);
+ pIcons_LOD->SyncLoadedFilesCount();
+ for (uint i = 0; i < 28; ++i)
+ {
+ if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i])
+ {
+ if (v197)
+ {
+ GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1);
+ v197 = 0;
+ }
+ else
+ GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0);
+ }
+ if (i > 3 && i != 25 && i != 26)
+ pKeyToggleType = TOGGLE_OneTimePress;
+ else
+ pKeyToggleType = TOGGLE_Continuously;
+ pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType);
+ }
+ pKeyActionMap->StoreMappings();
+ stru_506E40.Release();
+ }
+ else
+ pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
+
+ Game_OnEscape();*/
+ break;
+ }
+ else
{
if (current_screen_type > SCREEN_67)
{
if (current_screen_type == SCREEN_QUICK_REFERENCE)
{
pIcons_LOD->RemoveTexturesPackFromTextureList();
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = 1;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ Game_OnEscape();
continue;
}
}
@@ -817,67 +900,15 @@
_50C9A8_item_enchantment_timer = 0;
ptr_50C9A4_ItemToEnchant = nullptr;
}
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = 1;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ Game_OnEscape();
continue;
case SCREEN_BOOKS:
pBooksButtonOverlay->Release();
//crt_deconstruct_ptr_6A0118();
pBooksButtonOverlay = 0;
pEventTimer->Resume();
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = 1;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ Game_OnEscape();
continue;
- case SCREEN_SAVEGAME:
- case SCREEN_LOADGAME:
- pIcons_LOD->RemoveTexturesPackFromTextureList();
- //crt_deconstruct_ptr_6A0118();
- stru_506E40.Release();
- break;
case SCREEN_CHEST_INVENTORY:
current_screen_type = SCREEN_CHEST;
continue;
@@ -898,96 +929,6 @@
viewparams->bRedrawGameUI = 1;
pEventTimer->Resume();
continue;
- case SCREEN_OPTIONS://Close
- options_menu_skin.Relaease();
- pIcons_LOD->SyncLoadedFilesCount();
- WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
- WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
- WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
- WriteWindowsRegistryInt("WalkSound", bWalkSound);
- WriteWindowsRegistryInt("ShowDamage", bShowDamage);
- //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
- WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
- WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
- if (!uTurnSpeed)
- {
- WriteWindowsRegistryInt("TurnDelta", 3);
- stru_506E40.Release();
- break;
- }
- if (uTurnSpeed == 64)
- {
- WriteWindowsRegistryInt("TurnDelta", 2);
- stru_506E40.Release();
- break;
- }
- if (uTurnSpeed != 128)
- {
- stru_506E40.Release();
- break;
- }
- WriteWindowsRegistryInt("TurnDelta", 1);
- stru_506E40.Release();
- break;
- case SCREEN_MENU:
- pIcons_LOD->SyncLoadedFilesCount();
- pIcons_LOD->RemoveTexturesPackFromTextureList();
- pIcons_LOD->SyncLoadedFilesCount();
- pIcons_LOD->RemoveTexturesPackFromTextureList();
- stru_506E40.Release();
- break;
- case SCREEN_VIDEO_OPTIONS:
- //if ( pRenderer->pRenderD3D )
- {
- WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights);
- WriteWindowsRegistryInt("Tinting", pRenderer->bTinting);
- WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pEngine->uFlags2) >> 5) & 1);
- }
-
- stru_506E40.Release();
- break;
-
- case SCREEN_KEYBOARD_OPTIONS://Return to game
- v197 = 1;
- pKeyBindingFlag = false;
- for (uint i = 0; i < 28; ++i)
- {
- if (GameMenuUI_InvaligKeyBindingsFlags[i])
- pKeyBindingFlag = true;
- }
- if (!pKeyBindingFlag)
- {
- for (uint i = 0; i < 5; i++)
- {
- if (uTextureID_Optkb[i])
- pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release();
- }
- memset(&uTextureID_Optkb, 0, 20);
- pIcons_LOD->SyncLoadedFilesCount();
- for (uint i = 0; i < 28; ++i)
- {
- if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i])
- {
- if (v197)
- {
- GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1);
- v197 = 0;
- }
- else
- GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0);
- }
- if (i > 3 && i != 25 && i != 26)
- pKeyToggleType = TOGGLE_OneTimePress;
- else
- pKeyToggleType = TOGGLE_Continuously;
- pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType);
- }
- pKeyActionMap->StoreMappings();
- stru_506E40.Release();
- break;
- }
- pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
- break;
case SCREEN_REST://close rest screen
if (_506F14_resting_stage)
{
@@ -1010,30 +951,7 @@
}
_506F18_num_minutes_to_sleep = 0;
_506F14_resting_stage = 0;
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = 1;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ Game_OnEscape();
continue;
case SCREEN_E:
__debugbreak();
@@ -1058,30 +976,7 @@
pAudioPlayer->PlaySound(SOUND_WoodDoorClosing, 814, 0, -1, 0, 0, 0, 0);
pMediaPlayer->Unload();
pGUIWindow_CurrentMenu = window_SpeakInHouse;
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = true;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ Game_OnEscape();
continue;
case SCREEN_INPUT_BLV://click escape
if (uCurrentHouse_Animation == 153)
@@ -1140,146 +1035,26 @@
CharacterUI_ReleaseButtons();
ReleaseAwardsScrollBar();
pIcons_LOD->RemoveTexturesPackFromTextureList();
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = true;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ Game_OnEscape();
continue;
default:
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = 1;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ __debugbreak(); // which GAME_MENU is this?
+ Game_OnEscape();
continue;
}
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = true;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ __debugbreak(); // which GAME_MENU is this?
+ Game_OnEscape();
continue;
}
+ __debugbreak(); // which GAME_MENU is this?
CharacterUI_ReleaseButtons();
ReleaseAwardsScrollBar();
pIcons_LOD->RemoveTexturesPackFromTextureList();
}
- if (pGUIWindow_Settings)
- {
- if (current_screen_type == SCREEN_CHARACTERS)
- pMouse->SetCursorBitmap("MICON2");
- else
- {
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- }
- }
- if ((signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4)
- uActiveCharacter = pParty->GetNextActiveCharacter();
- pGUIWindow_CurrentMenu->Release();
- if (pGUIWindow_CurrentMenu == window_SpeakInHouse)
- window_SpeakInHouse = 0;
- pGUIWindow_CurrentMenu = 0;
- pEventTimer->Resume();
- current_screen_type = SCREEN_GAME;
- viewparams->bRedrawGameUI = true;
- pIcons_LOD->RemoveTexturesFromTextureList();
+ __debugbreak(); // which GAME_MENU is this?
+ Game_OnEscape();
continue;
}
- if (!pGUIWindow_Settings)//Draw Menu
- {
- dword_6BE138 = -1;
- new OnButtonClick2(0x25Au, 0x1C2u, 0, 0, (int)pBtn_GameSettings, (char *)1);
- pEventTimer->Pause();
- pAudioPlayer->StopChannels(-1, -1);
- current_screen_type = SCREEN_MENU;
-
- ++pIcons_LOD->uTexturePacksCount;
- if (!pIcons_LOD->uNumPrevLoadedFiles)
- pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-
- pGUIWindow_CurrentMenu = new GUIWindow_GameMenu();
-
- viewparams->field_48 = 1;
-
- stru_506E40.Release();
- pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
- stru_506E40.LoadPCXFile("gamma.pcx", 0);
-
- continue;
- }
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
- pMouse->SetCursorBitmap("MICON1");
- GameUI_Footer_TimeLeft = 0;
- _50C9A0_IsEnchantingInProgress = 0;
- back_to_game();
- continue;
- }
- pModalWindow->Release();
- pModalWindow = nullptr;
continue;
case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel
@@ -1501,13 +1276,13 @@
v47 = pActors[v46].uAIState == Dead;
if (!v47)
continue;
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
pSpellInfo->uFlags &= ~0x40u;
pSpellInfo->uPlayerID_2 = uMessageParam;
pSpellInfo->spell_target_pid = v44;
pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = 0;
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
_50C9A0_IsEnchantingInProgress = 0;
@@ -1519,13 +1294,13 @@
v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0;
if (!v47)
continue;
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
pSpellInfo->uFlags &= ~0x40u;
pSpellInfo->uPlayerID_2 = uMessageParam;
pSpellInfo->spell_target_pid = v44;
pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = 0;
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
_50C9A0_IsEnchantingInProgress = 0;
@@ -1546,13 +1321,13 @@
if (!pODMFace->Clickable() || !pODMFace->sCogTriggeredID)
continue;
v44 = uNumSeconds;
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
pSpellInfo->uFlags &= ~0x40u;
pSpellInfo->uPlayerID_2 = uMessageParam;
pSpellInfo->spell_target_pid = v44;
pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = 0;
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
_50C9A0_IsEnchantingInProgress = 0;
@@ -1566,13 +1341,13 @@
}
if (v48)
continue;
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
pSpellInfo->uFlags &= ~0x40u;
pSpellInfo->uPlayerID_2 = uMessageParam;
pSpellInfo->spell_target_pid = v44;
pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = 0;
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
_50C9A0_IsEnchantingInProgress = 0;
@@ -1589,9 +1364,9 @@
}
else
{
- if (pGUIWindow_Settings)
+ if (pGUIWindow_CastTargetedSpell)
{
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
switch (uMessage)
{
case UIMSG_CastSpell_Character_Big_Improvement:
@@ -1606,8 +1381,8 @@
}
pSpellInfo->uPlayerID_2 = uMessageParam;
pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = 0;
pEventTimer->Resume();
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
@@ -2056,7 +1831,7 @@
v84 = v83 >> 16;
if (PID_TYPE(v44) != 3 || v84 >= 5120)
continue;
- pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+ pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
if (uMessage == UIMSG_CastSpell_Shoot_Monster)
{
pSpellInfo->uFlags &= ~0x08;
@@ -2071,8 +1846,8 @@
pSpellInfo->uPlayerID_2 = uMessageParam;
pSpellInfo->spell_target_pid = v44;
pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
- pGUIWindow_Settings->Release();
- pGUIWindow_Settings = 0;
+ pGUIWindow_CastTargetedSpell->Release();
+ pGUIWindow_CastTargetedSpell = 0;
pMouse->SetCursorBitmap("MICON1");
GameUI_Footer_TimeLeft = 0;
_50C9A0_IsEnchantingInProgress = 0;
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/GameMenu.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/GameMenu.cpp Wed May 13 20:09:12 2015 +0600
@@ -0,0 +1,637 @@
+#include "Engine/Engine.h"
+#include "Engine/Timer.h"
+#include "Engine/LOD.h"
+#include "Engine/Party.h"
+#include "Engine/SaveLoad.h"
+#include "Engine/Registry.h"
+#include "Engine/texts.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+
+#include "IO/Keyboard.h"
+#include "IO/Mouse.h"
+
+#include "GUI/UI/UIGame.h"
+#include "GUI/UI/UISaveLoad.h"
+#include "GUI/UI/UIModal.h"
+
+#include "Media/Audio/AudioPlayer.h"
+#include "Media/Audio/AIL.h"
+
+
+
+extern void DoThatMessageThing();
+
+
+void Game_StartNewGameWhilePlaying(bool force_start)
+{
+ if (dword_6BE138 == 124 || force_start)
+ {
+ pIcons_LOD->SyncLoadedFilesCount();
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ DoThatMessageThing();
+ //pGUIWindow_CurrentMenu->Release();
+ uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU;
+ current_screen_type = SCREEN_GAME;
+ viewparams->bRedrawGameUI = 1;
+ }
+ else
+ {
+ ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game"
+ pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0);
+ dword_6BE138 = 124;
+ }
+}
+
+void Game_QuitGameWhilePlaying(bool force_quit)
+{
+ if (dword_6BE138 == 132 || force_quit)
+ {
+ pIcons_LOD->SyncLoadedFilesCount();
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ DoThatMessageThing();
+ //pGUIWindow_CurrentMenu->Release();
+ current_screen_type = SCREEN_GAME;
+ viewparams->bRedrawGameUI = 1;
+ pAudioPlayer->PlaySound(SOUND_WoodDoorClosing, 0, 0, -1, 0, 0, 0, 0);
+ uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU;
+ }
+ else
+ {
+ ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit"
+ pAudioPlayer->PlaySound(SOUND_quest, 0, 0, -1, 0, 0, 0, 0);
+ dword_6BE138 = 132;
+ }
+}
+
+void Game_OpenLoadGameDialog()
+{
+ pIcons_LOD->SyncLoadedFilesCount();
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+
+ DoThatMessageThing();
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = nullptr;
+
+ //LoadUI_Load(1);
+ current_screen_type = SCREEN_LOADGAME;
+ pGUIWindow_CurrentMenu = new GUIWindow_Load(true);
+}
+
+
+
+
+void GameMenu_EventLoop()
+{
+ while (pMessageQueue_50CBD0->uNumMessages)
+ {
+ UIMessageType msg;
+ int param, param2;
+ pMessageQueue_50CBD0->PopMessage(&msg, ¶m, ¶m2);
+
+ switch (msg)
+ {
+ case UIMSG_StartNewGame: Game_StartNewGameWhilePlaying(param); continue;
+ case UIMSG_Quit: Game_QuitGameWhilePlaying(param); continue;
+ case UIMSG_Game_OpenLoadGameDialog: Game_OpenLoadGameDialog(); continue;
+
+ case UIMSG_ArrowUp:
+ --pSaveListPosition;
+ if (pSaveListPosition < 0)
+ pSaveListPosition = 0;
+ new OnButtonClick2(215, 199, 17, 17, (int)pBtnArrowUp, 0);
+ continue;
+
+ case UIMSG_DownArrow:
+ ++pSaveListPosition;
+ if (pSaveListPosition >= param)
+ pSaveListPosition = param - 1;
+ new OnButtonClick2(215, 323, 17, 17, (int)pBtnDownArrow, 0);
+ continue;
+
+ case UIMSG_Cancel:
+ new OnCancel(350, 302, 106, 42, (int)pBtnCancel, 0);
+ continue;
+
+ case UIMSG_SaveLoadBtn:
+ new OnSaveLoad(241, 302, 106, 42, (int)pBtnLoadSlot, 0);
+ continue;
+ case UIMSG_SelectLoadSlot:
+ {
+ if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
+ pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
+
+ int v10 = pSaveListPosition + param;
+ if (current_screen_type != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != v10)
+ {
+ if (dword_6BE138 == pSaveListPosition + param)
+ {
+ pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0);
+ pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
+ }
+ uLoadGameUI_SelectedSlot = v10;
+ dword_6BE138 = v10;
+ }
+ else
+ {
+ pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
+ if (strcmp(pSavegameHeader[uLoadGameUI_SelectedSlot].pName, pGlobalTXT_LocalizationStrings[72]))// "Empty"
+ strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
+ pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
+ }
+ }
+ continue;
+ case UIMSG_LoadGame:
+ if (pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
+ {
+ LoadGame(uLoadGameUI_SelectedSlot);
+ uGameState = GAME_STATE_LOADING_GAME;
+ }
+ continue;
+ case UIMSG_SaveGame:
+ if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
+ {
+ pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
+ strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pKeyActionMap->pPressedKeysBuffer);
+ }
+ DoSavegame(uLoadGameUI_SelectedSlot);
+ continue;
+ case UIMSG_Game_OpenSaveGameDialog:
+ {
+ pGUIWindow_CurrentMenu->Release();
+
+ current_screen_type = SCREEN_SAVEGAME;
+ pGUIWindow_CurrentMenu = new GUIWindow_Save(); //SaveUI_Load(current_screen_type = SCREEN_SAVEGAME);
+ continue;
+ }
+ case UIMSG_Game_OpenOptionsDialog://Open
+ {
+ DoThatMessageThing();
+
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = new GUIWindow_GameOptions();//GameMenuUI_Options_Load();
+
+ viewparams->field_48 = 1;
+ current_screen_type = SCREEN_OPTIONS;
+
+ continue;
+ }
+
+ case UIMSG_OpenKeyMappingOptions://Open
+ {
+ DoThatMessageThing();
+
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = new GUIWindow_GameKeyBindings();//GameMenuUI_OptionsKeymapping_Load();
+
+ viewparams->field_48 = 1;
+ current_screen_type = SCREEN_KEYBOARD_OPTIONS;
+
+ continue;
+ }
+
+ case UIMSG_ChangeKeyButton:
+ {
+ if (uGameMenuUI_CurentlySelectedKeyIdx != -1)
+ {
+ pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
+ }
+ else
+ {
+ uGameMenuUI_CurentlySelectedKeyIdx = param;
+ if (KeyboardPageNum != 1)
+ uGameMenuUI_CurentlySelectedKeyIdx += 14;
+ pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
+ }
+ continue;
+ }
+
+ case UIMSG_ResetKeyMapping:
+ {
+ int v197 = 1;
+ pKeyActionMap->SetDefaultMapping();
+ for (uint i = 0; i < 28; i++)
+ {
+ if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i])
+ {
+ if (v197)
+ {
+ GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 1);
+ v197 = 0;
+ }
+ else
+ GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 0);
+ }
+ pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i);
+ GameMenuUI_InvaligKeyBindingsFlags[i] = false;
+ }
+ pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0);
+ continue;
+ }
+
+ case UIMSG_SelectKeyPage1:
+ KeyboardPageNum = 1;
+ continue;
+ case UIMSG_SelectKeyPage2:
+ KeyboardPageNum = 2;
+ continue;
+
+ case UIMSG_OpenVideoOptions:
+ {
+ DoThatMessageThing();
+
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = new GUIWindow_GameVideoOptions();//GameMenuUI_OptionsVideo_Load();
+ viewparams->field_48 = 1;
+ current_screen_type = SCREEN_VIDEO_OPTIONS;
+
+ continue;
+ }
+
+ case UIMSG_1A9:
+ __debugbreak();
+ if (param == 4)
+ {
+ //--uGammaPos;
+ if ((uGammaPos-- - 1) < 0)
+ {
+ uGammaPos = 0;
+ pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
+ continue;
+ }
+ double v19 = (double)(signed int)uGammaPos * 0.1 + 0.6;
+ //pEngine->pGammaController->Initialize(v19);
+ new OnButtonClick2(21, 161, 0, 0, (int)pBtn_SliderLeft, (char *)1);
+ pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
+ continue;
+ }
+ if (param == 5)
+ {
+ ++uGammaPos;
+ if ((signed int)uGammaPos <= 9)
+ {
+ double v21 = (double)(signed int)uGammaPos * 0.1 + 0.6;
+ //pEngine->pGammaController->Initialize(v21);
+ new OnButtonClick2(213, 161, 0, 0, (int)pBtn_SliderRight, (char *)1);
+ pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
+ continue;
+ }
+ uGammaPos = 9;
+ }
+ else
+ {
+ POINT a2;
+ uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17;
+ double v22 = (double)(signed int)uGammaPos * 0.1 + 0.6;
+ //pEngine->pGammaController->Initialize(v22);
+ }
+ pAudioPlayer->PlaySound(SOUND_ClickMovingSelector, 0, 0, -1, 0, 0, 0, 0);
+ continue;
+ case UIMSG_ToggleBloodsplats:
+ pEngine->ToggleFlags2(0x20u);
+ continue;
+ case UIMSG_ToggleColoredLights:
+ pRenderer->ToggleColoredLights();
+ continue;
+ case UIMSG_ToggleTint:
+ pRenderer->ToggleTint();
+ continue;
+ case UIMSG_ChangeMusicVolume:
+ extern bool use_music_folder;
+ if (param == 4)//-
+ {
+ --uMusicVolimeMultiplier;
+ if ((char)uMusicVolimeMultiplier < 1)
+ uMusicVolimeMultiplier = 0;
+ new OnButtonClick2(243, 216, 0, 0, (int)pBtn_SliderLeft, (char *)1);
+ if (uMusicVolimeMultiplier)
+ pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
+
+ if (use_music_folder)
+ alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
+ else
+ pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
+
+ continue;
+ }
+ if (param == 5)//+
+ {
+ ++uMusicVolimeMultiplier;
+ if ((char)uMusicVolimeMultiplier > 9)
+ uMusicVolimeMultiplier = 9;
+ new OnButtonClick2(435, 216, 0, 0, (int)pBtn_SliderRight, (char *)1);
+ if (uMusicVolimeMultiplier)
+ pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
+ if (use_music_folder)
+ alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
+ else
+ pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
+ continue;
+ }
+
+ POINT v202;
+ uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//for mouse
+ if ((char)uMusicVolimeMultiplier > 9)
+ uMusicVolimeMultiplier = 9;
+ if (uMusicVolimeMultiplier)
+ pAudioPlayer->PlaySound(SOUND_hurp, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
+ if (use_music_folder)
+ alSourcef(mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
+ else
+ pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
+ continue;
+ case UIMSG_ChangeSoundVolume:
+ if (param == 4)//reduce sound level button left
+ {
+ --uSoundVolumeMultiplier;
+ if ((char)uSoundVolumeMultiplier < 1)
+ uSoundVolumeMultiplier = 0;
+ new OnButtonClick2(243, 162, 0, 0, (int)pBtn_SliderLeft, (char *)1);
+ pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
+ pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0);
+ int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook);
+ //v = v+1;
+ if (v)
+ __debugbreak();
+ continue;
+ }
+ if (param == 5)//Increase sound level button right
+ {
+ ++uSoundVolumeMultiplier;
+ if ((char)uSoundVolumeMultiplier > 8)
+ uSoundVolumeMultiplier = 9;
+ //v168 = 1;
+ //v154 = (int)pBtn_SliderRight;
+ new OnButtonClick2(435, 162, 0, 0, (int)pBtn_SliderRight, (char *)1);
+ pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
+ pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0);
+ continue;
+ }
+
+ POINT v207;
+ uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17;
+ if ((char)uSoundVolumeMultiplier > 8)
+ uSoundVolumeMultiplier = 9;
+ pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
+ pAudioPlayer->PlaySound(SOUND_church, -1, 0, -1, 0, 0, 0, 0);
+ continue;
+ case UIMSG_ToggleFlipOnExit:
+ bFlipOnExit = bFlipOnExit == 0;
+ continue;
+ case UIMSG_ToggleAlwaysRun:
+ bAlwaysRun = bAlwaysRun == 0;
+ continue;
+ case UIMSG_ToggleWalkSound:
+ bWalkSound = bWalkSound == 0;
+ continue;
+ case UIMSG_ToggleShowDamage:
+ bShowDamage = bShowDamage == 0;
+ continue;
+ case UIMSG_ChangeVoiceVolume:
+ if (param == 4)
+ {
+ --uVoicesVolumeMultiplier;
+ if ((char)uVoicesVolumeMultiplier < 1)
+ uVoicesVolumeMultiplier = 0;
+ new OnButtonClick2(243, 270, 0, 0, (int)pBtn_SliderLeft, (char *)1);
+ if (!uVoicesVolumeMultiplier)
+ continue;
+ pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
+ continue;
+ }
+ if (param == 5)
+ {
+ ++uVoicesVolumeMultiplier;
+ if ((char)uVoicesVolumeMultiplier > 8)
+ uVoicesVolumeMultiplier = 9;
+ new OnButtonClick2(435, 270, 0, 0, (int)pBtn_SliderRight, (char *)1);
+ if (!uVoicesVolumeMultiplier)
+ continue;
+ pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
+ continue;
+ }
+
+ POINT v205;
+ uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17;
+ if ((char)uVoicesVolumeMultiplier > 8)
+ uVoicesVolumeMultiplier = 9;
+ if (!uVoicesVolumeMultiplier)
+ continue;
+ pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
+ continue;
+ case UIMSG_SetTurnSpeed:
+ if (param)
+ pParty->sRotationY = param * pParty->sRotationY / param;
+ uTurnSpeed = param;
+ continue;
+
+ case UIMSG_SetGraphicsMode:
+ //if ( !bUseLoResSprites )
+ //{
+ // byte_6BE388_graphicsmode = uMessageParam;
+ // MM7Initialization();
+ // continue;
+ //}
+ //if ( uMessageParam )
+ //{
+ // if ( uMessageParam == 1 )
+ // {
+ // byte_6BE388_graphicsmode = 0;
+ // }
+ // else
+ // {
+ // if ( uMessageParam != 2 )
+ // continue;
+ // byte_6BE388_graphicsmode = 1;
+ // }
+ // MM7Initialization();
+ // continue;
+ //}
+ pModalWindow = new GUIWindow_Modal(pNPCTopics[453].pText, UIMSG_0);
+ __debugbreak(); // Nomad: graphicsmode as it was now removed
+ continue;
+
+ case UIMSG_GameMenu_ReturnToGame:
+ //pGUIWindow_CurrentMenu->Release();
+ pEventTimer->Resume();
+ current_screen_type = SCREEN_GAME;
+ viewparams->bRedrawGameUI = true;
+ continue;
+
+
+
+
+ case UIMSG_Escape:
+ if (pModalWindow)
+ {
+ pModalWindow->Release();
+ pModalWindow = nullptr;
+ continue;
+ }
+ pRenderer->ClearZBuffer(0, 479);
+ viewparams->bRedrawGameUI = true;
+ viewparams->field_48 = 1;
+
+ if (current_screen_type == SCREEN_MENU)
+ {
+ pIcons_LOD->SyncLoadedFilesCount();
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ pIcons_LOD->SyncLoadedFilesCount();
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+
+ current_screen_type = SCREEN_GAME;
+ }
+ else if (current_screen_type == SCREEN_SAVEGAME || current_screen_type == SCREEN_LOADGAME)
+ {
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ //crt_deconstruct_ptr_6A0118();
+
+ pGUIWindow_CurrentMenu->Release();
+ current_screen_type = SCREEN_MENU;
+ pGUIWindow_CurrentMenu = new GUIWindow_GameMenu();
+ }
+ else if (current_screen_type == SCREEN_OPTIONS)
+ {
+ options_menu_skin.Relaease();
+ pIcons_LOD->SyncLoadedFilesCount();
+ WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
+ WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
+ WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
+ WriteWindowsRegistryInt("WalkSound", bWalkSound);
+ WriteWindowsRegistryInt("ShowDamage", bShowDamage);
+ //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
+ WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
+ WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
+ if (!uTurnSpeed)
+ WriteWindowsRegistryInt("TurnDelta", 3);
+ else if (uTurnSpeed == 64)
+ WriteWindowsRegistryInt("TurnDelta", 2);
+ else if (uTurnSpeed == 128)
+ WriteWindowsRegistryInt("TurnDelta", 1);
+
+ pGUIWindow_CurrentMenu->Release();
+ current_screen_type = SCREEN_MENU;
+ pGUIWindow_CurrentMenu = new GUIWindow_GameMenu();
+ }
+ else if (current_screen_type == SCREEN_VIDEO_OPTIONS)
+ {
+ //if ( pRenderer->pRenderD3D )
+ {
+ WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights);
+ WriteWindowsRegistryInt("Tinting", pRenderer->bTinting);
+ WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pEngine->uFlags2) >> 5) & 1);
+ }
+
+ pGUIWindow_CurrentMenu->Release();
+ current_screen_type = SCREEN_MENU;
+ pGUIWindow_CurrentMenu = new GUIWindow_GameMenu();
+ }
+ else if (current_screen_type == SCREEN_KEYBOARD_OPTIONS)
+ {
+ KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287
+ int v197 = 1;
+ bool pKeyBindingFlag = false;
+
+ for (uint i = 0; i < 28; ++i)
+ {
+ if (GameMenuUI_InvaligKeyBindingsFlags[i])
+ pKeyBindingFlag = true;
+ }
+ if (!pKeyBindingFlag)
+ {
+ for (uint i = 0; i < 5; i++)
+ {
+ if (uTextureID_Optkb[i])
+ pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release();
+ }
+ memset(uTextureID_Optkb.data(), 0, 20);
+ pIcons_LOD->SyncLoadedFilesCount();
+ for (uint i = 0; i < 28; ++i)
+ {
+ if (pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i])
+ {
+ if (v197)
+ {
+ GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1);
+ v197 = 0;
+ }
+ else
+ GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0);
+ }
+ if (i > 3 && i != 25 && i != 26)
+ pKeyToggleType = TOGGLE_OneTimePress;
+ else
+ pKeyToggleType = TOGGLE_Continuously;
+ pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType);
+ }
+ pKeyActionMap->StoreMappings();
+ }
+ else
+ pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
+
+ pGUIWindow_CurrentMenu->Release();
+ current_screen_type = SCREEN_MENU;
+ pGUIWindow_CurrentMenu = new GUIWindow_GameMenu();
+ }
+ continue;
+ }
+ }
+}
+
+void GameMenu_Loop()
+{
+ pEventTimer->Pause();
+ pAudioPlayer->StopChannels(-1, -1);
+ current_screen_type = SCREEN_MENU;
+
+ ++pIcons_LOD->uTexturePacksCount;
+ if (!pIcons_LOD->uNumPrevLoadedFiles)
+ pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
+
+ pGUIWindow_CurrentMenu = new GUIWindow_GameMenu();
+
+ viewparams->field_48 = 1;
+
+ stru_506E40.Release();
+ pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
+ stru_506E40.LoadPCXFile("gamma.pcx", 0);
+
+ while (uGameState == GAME_STATE_PLAYING
+ && (
+ current_screen_type == SCREEN_MENU
+ || current_screen_type == SCREEN_SAVEGAME
+ || current_screen_type == SCREEN_LOADGAME
+ || current_screen_type == SCREEN_OPTIONS
+ || current_screen_type == SCREEN_VIDEO_OPTIONS
+ || current_screen_type == SCREEN_KEYBOARD_OPTIONS
+ )
+ )
+ {
+ MSG msg;
+ while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
+ {
+ if (msg.message == WM_QUIT)
+ Engine_DeinitializeAndTerminate(0);
+ TranslateMessage(&msg);
+ DispatchMessageW(&msg);
+ }
+ if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
+ {
+ WaitMessage();
+ continue;
+ }
+
+ pRenderer->BeginScene();
+ {
+ GameMenu_EventLoop();
+ GUI_UpdateWindows();
+ }
+ pRenderer->EndScene();
+ pRenderer->Present();
+ }
+
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = nullptr;
+
+ stru_506E40.Release();
+}
\ No newline at end of file
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/GameMenu.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/GameMenu.h Wed May 13 20:09:12 2015 +0600
@@ -0,0 +1,3 @@
+#pragma once
+
+void GameMenu_Loop();
\ No newline at end of file
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/MainMenu.cpp
--- a/Game/MainMenu.cpp Wed May 13 20:09:00 2015 +0600
+++ b/Game/MainMenu.cpp Wed May 13 20:09:12 2015 +0600
@@ -17,6 +17,7 @@
#include "Media/Audio/AudioPlayer.h"
#include "Game/MainMenu.h"
+#include "Game/MainMenuLoad.h"
RGBTexture main_menu_background;
@@ -71,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;
@@ -183,17 +184,18 @@
uPlayerCreationUI_SelectedCharacter = pParam;
pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
pGUIWindow_CurrentMenu->ptr_1C = v3;
- break;
+ break;*/
case UIMSG_ChangeGameState:
uGameState = GAME_FINISHED;
break;
case UIMSG_ChangeCursor:
pMouse->SetCursorBitmap("MICON2");
break;
- case UIMSG_3A:
+ case UIMSG_DebugBlv:
+ __debugbreak();//some debugging tool
SetCurrentMenuID(MENU_DebugBLVLevel);
break;
- case UIMSG_LoadGame:
+ /*case UIMSG_LoadGame:
if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
break;
SetCurrentMenuID(MENU_LoadingProcInMainMenu);
@@ -233,22 +235,24 @@
pSaveListPosition = 0;
pWindow = pGUIWindow_CurrentMenu;
new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (int)pBtnDownArrow, 0);
- break;
+ break;*/
case UIMSG_Cancel:
new OnCancel3(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnCancel, 0);
break;
- case UIMSG_ArrowUp:
+ /*case UIMSG_ArrowUp:
--pSaveListPosition;
if (pSaveListPosition < 0)
pSaveListPosition = 0;
pWindow = pGUIWindow_CurrentMenu;
new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (int)pBtnArrowUp, 0);
- break;
+ break;*/
case UIMSG_AD:
+ __debugbreak();//some debugging tool
new OnButtonClick2(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (int)pMainMenu_BtnNew, 0);
SetCurrentMenuID(MENU_LoadingProcInMainMenu);
break;
- case UIMSG_AE:
+ case UIMSG_DebugBlv2:
+ __debugbreak();//some debugging tool
new OnButtonClick2(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (int)pMainMenu_BtnExit, 0);
SetCurrentMenuID(MENU_DebugBLVLevel);
break;
@@ -283,7 +287,7 @@
pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
break;
}
- if (GetCurrentMenuID() == MENU_CREDITSPROC && !current_screen_type)
+ if (GetCurrentMenuID() == MENU_CREDITSPROC && current_screen_type == SCREEN_GAME)
{
//if ( current_screen_type == SCREEN_VIDEO )
//pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);
@@ -300,7 +304,7 @@
pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
break;
}
- if (current_screen_type == SCREEN_LOADGAME)
+ /*if (current_screen_type == SCREEN_LOADGAME)
{
pIcons_LOD->RemoveTexturesPackFromTextureList();
//crt_deconstruct_ptr_6A0118();
@@ -315,7 +319,7 @@
current_screen_type = SCREEN_GAME;
viewparams->bRedrawGameUI = v15;
break;
- }
+ }*/
if (current_screen_type == SCREEN_VIDEO)
{
//pVideoPlayer->Unload();
@@ -323,10 +327,17 @@
else
{
if (current_screen_type != SCREEN_1B)
- {
- pGUIWindow_CurrentMenu->Release();
- pGUIWindow2->Release();
- pGUIWindow2 = 0;
+ { // MENU_CREDITSCLOSE for example
+ if (pGUIWindow_CurrentMenu)
+ {
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = nullptr;
+ }
+ if (pGUIWindow2)
+ {
+ pGUIWindow2->Release();
+ pGUIWindow2 = 0;
+ }
pEventTimer->Resume();
current_screen_type = SCREEN_GAME;
viewparams->bRedrawGameUI = v15;
@@ -368,12 +379,14 @@
SetCurrentMenuID(MENU_MAIN);
SetForegroundWindow(window->GetApiHandle());
SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
- while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD)
+
+ //while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD)
+ while (GetCurrentMenuID() == MENU_MAIN)
{
POINT pt;
pMouse->GetCursorPos(&pt);
pWindow = pWindow_MainMenu;
- if (GetCurrentMenuID() == MENU_SAVELOAD)
+ /*if (GetCurrentMenuID() == MENU_SAVELOAD)
{
if (current_screen_type != SCREEN_LOADGAME)
{
@@ -385,7 +398,7 @@
pGUIWindow_CurrentMenu = new GUIWindow_Load(false);
}
pWindow = pGUIWindow_CurrentMenu;
- }
+ }*/
while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
{
@@ -417,11 +430,11 @@
pRenderer->EndScene();
pRenderer->Present();
main_menu_background.Release();
- if (pGUIWindow2)
+ /*if (pGUIWindow2)
{
pGUIWindow2->Release();
pGUIWindow2 = 0;
- }
+ }*/
pWindow_MainMenu->Release();
pIcons_LOD->RemoveTexturesPackFromTextureList();
}
\ No newline at end of file
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/MainMenuLoad.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/MainMenuLoad.cpp Wed May 13 20:09:12 2015 +0600
@@ -0,0 +1,151 @@
+#include "Engine/Engine.h"
+#include "Engine/SaveLoad.h"
+#include "Engine/LOD.h"
+#include "Engine/Timer.h"
+#include "Engine/Graphics/IRender.h"
+#include "Engine/Graphics/Viewport.h"
+
+#include "IO/Keyboard.h"
+
+#include "GUI/UI/UISaveLoad.h"
+
+#include "Game/MainMenu.h"
+#include "Game/MainMenuLoad.h"
+
+void MainMenuLoad_EventLoop()
+{
+ while (pMessageQueue_50CBD0->uNumMessages)
+ {
+ UIMessageType msg;
+ int param, param2;
+ pMessageQueue_50CBD0->PopMessage(&msg, ¶m, ¶m2);
+
+ switch (msg)
+ {
+ case UIMSG_LoadGame:
+ {
+ if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
+ break;
+ SetCurrentMenuID(MENU_LoadingProcInMainMenu);
+ }
+ break;
+
+ case UIMSG_SelectLoadSlot:
+ {
+ //main menu save/load wnd clicking on savegame lines
+ if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
+ pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
+ if (current_screen_type != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != param + pSaveListPosition)
+ {
+ //load clicked line
+ int v26 = param + pSaveListPosition;
+ if (dword_6BE138 == v26)
+ {
+ pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0);
+ pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
+ }
+ uLoadGameUI_SelectedSlot = v26;
+ dword_6BE138 = v26;
+ }
+ else
+ {
+ //typing in the line
+ pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
+ strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
+ pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
+ }
+ }
+ break;
+
+ case UIMSG_SaveLoadBtn:
+ new OnSaveLoad(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnLoadSlot, 0);
+ break;
+
+
+ case UIMSG_DownArrow:
+ {
+ ++pSaveListPosition;
+ if (pSaveListPosition >= param)
+ pSaveListPosition = param - 1;
+ if (pSaveListPosition < 1)
+ pSaveListPosition = 0;
+ new OnButtonClick2(pGUIWindow_CurrentMenu->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (int)pBtnDownArrow, 0);
+ }
+ break;
+
+
+ case UIMSG_ArrowUp:
+ {
+ --pSaveListPosition;
+ if (pSaveListPosition < 0)
+ pSaveListPosition = 0;
+ new OnButtonClick2(pGUIWindow_CurrentMenu->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (int)pBtnArrowUp, 0);
+ }
+ break;
+
+ case UIMSG_Cancel:
+ new OnCancel3(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnCancel, 0);
+ break;
+
+
+ case UIMSG_Escape:
+ {
+ viewparams->field_48 = 1;
+ //if (current_screen_type == SCREEN_LOADGAME)
+ {
+ pIcons_LOD->RemoveTexturesPackFromTextureList();
+ //crt_deconstruct_ptr_6A0118();
+ main_menu_background.Release();
+ main_menu_background.Load("title.pcx", 0);
+ SetCurrentMenuID(MENU_MAIN);
+ current_screen_type = SCREEN_GAME;
+ pEventTimer->Resume();
+ viewparams->bRedrawGameUI = true;
+ break;
+ }
+ }
+ break;
+ }
+ }
+}
+
+void MainMenuLoad_Loop()
+{
+ current_screen_type = SCREEN_LOADGAME;
+
+ main_menu_background.Release();
+ main_menu_background.Load("lsave640.pcx", 0);
+
+ //LoadUI_Load(0);
+ pGUIWindow_CurrentMenu = new GUIWindow_Load(false);
+
+
+ while (GetCurrentMenuID() == MENU_SAVELOAD && current_screen_type == SCREEN_LOADGAME)
+ {
+ MSG msg;
+ while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
+ {
+ if (msg.message == WM_QUIT)
+ Engine_DeinitializeAndTerminate(0);
+ TranslateMessage(&msg);
+ DispatchMessageW(&msg);
+ }
+ if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
+ {
+ WaitMessage();
+ continue;
+ }
+
+ pRenderer->BeginScene();
+ pRenderer->DrawTextureNew(0, 0, &main_menu_background);
+
+ MainMenuLoad_EventLoop();
+ GUI_UpdateWindows();
+
+ pRenderer->EndScene();
+ pRenderer->Present();
+ }
+
+ pGUIWindow_CurrentMenu->Release();
+ pGUIWindow_CurrentMenu = nullptr;
+}
\ No newline at end of file
diff -r bbef1435eb8d -r 5d6fb8eb023c Game/MainMenuLoad.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/MainMenuLoad.h Wed May 13 20:09:12 2015 +0600
@@ -0,0 +1,5 @@
+#pragma once
+
+
+void MainMenuLoad_Loop();
+void MainMenuLoad_EventLoop();
\ No newline at end of file