Mercurial > mm7
changeset 2501:0ff6a9e9bf7f
GUI folger
line wrap: on
line diff
--- a/Arcomage/Arcomage.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/Arcomage/Arcomage.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -18,7 +18,7 @@ #include "../Engine/texts.h" #include <windef.h> #include "../Engine/mm7_data.h" -#include "UI/UIHouses.h" +#include "GUI\UI/UIHouses.h"
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj Fri Sep 19 03:00:21 2014 +0600 +++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj Fri Sep 19 04:21:12 2014 +0600 @@ -159,6 +159,26 @@ <ClCompile Include="..\..\GUIFont.cpp" /> <ClCompile Include="..\..\GUIProgressBar.cpp" /> <ClCompile Include="..\..\GUIWindow.cpp" /> + <ClCompile Include="..\..\GUI\NewUI\Core\UIControlModule_wrap.cxx" /> + <ClCompile Include="..\..\GUI\NewUI\MainMenu.cpp" /> + <ClCompile Include="..\..\GUI\UI\Books\UIMapBook.cpp" /> + <ClCompile Include="..\..\GUI\UI\Books\UINotesBooks.cpp" /> + <ClCompile Include="..\..\GUI\UI\Books\UISpellBook.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIArena.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIBooks.cpp" /> + <ClCompile Include="..\..\GUI\UI\UICharacter.cpp" /> + <ClCompile Include="..\..\GUI\UI\UiGame.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIGuilds.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIHouses.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIMainMenu.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIMsgProc.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIOptions.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIPartyCreation.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIPopup.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIRest.cpp" /> + <ClCompile Include="..\..\GUI\UI\UISaveLoad.cpp" /> + <ClCompile Include="..\..\GUI\UI\UIShops.cpp" /> + <ClCompile Include="..\..\GUI\UI\UITransition.cpp" /> <ClCompile Include="..\..\Keyboard.cpp" /> <ClCompile Include="..\..\lib\libpng\png.c" /> <ClCompile Include="..\..\lib\libpng\pngerror.c" /> @@ -223,29 +243,9 @@ <ClCompile Include="..\..\lib\zlib\zutil.c" /> <ClCompile Include="..\..\MediaPlayer.cpp" /> <ClCompile Include="..\..\Mouse.cpp" /> - <ClCompile Include="..\..\NewUI\Core\UIControlModule_wrap.cxx" /> - <ClCompile Include="..\..\NewUI\MainMenu.cpp" /> <ClCompile Include="..\..\OSAPI.cpp" /> <ClCompile Include="..\..\OSWindow.cpp" /> <ClCompile Include="..\..\stru6.cpp" /> - <ClCompile Include="..\..\UI\Books\UIMapBook.cpp" /> - <ClCompile Include="..\..\UI\Books\UINotesBooks.cpp" /> - <ClCompile Include="..\..\UI\Books\UISpellBook.cpp" /> - <ClCompile Include="..\..\UI\UIArena.cpp" /> - <ClCompile Include="..\..\UI\UIBooks.cpp" /> - <ClCompile Include="..\..\UI\UICharacter.cpp" /> - <ClCompile Include="..\..\UI\UiGame.cpp" /> - <ClCompile Include="..\..\UI\UIGuilds.cpp" /> - <ClCompile Include="..\..\UI\UIHouses.cpp" /> - <ClCompile Include="..\..\UI\UIMainMenu.cpp" /> - <ClCompile Include="..\..\UI\UIMsgProc.cpp" /> - <ClCompile Include="..\..\UI\UIOptions.cpp" /> - <ClCompile Include="..\..\UI\UIPartyCreation.cpp" /> - <ClCompile Include="..\..\UI\UIPopup.cpp" /> - <ClCompile Include="..\..\UI\UIRest.cpp" /> - <ClCompile Include="..\..\UI\UISaveLoad.cpp" /> - <ClCompile Include="..\..\UI\UIShops.cpp" /> - <ClCompile Include="..\..\UI\UITransition.cpp" /> <ClCompile Include="..\..\_deleted.cpp" /> </ItemGroup> <ItemGroup> @@ -331,6 +331,26 @@ <ClInclude Include="..\..\GUIFont.h" /> <ClInclude Include="..\..\GUIProgressBar.h" /> <ClInclude Include="..\..\GUIWindow.h" /> + <ClInclude Include="..\..\GUI\NewUI\Core\UIControl.h" /> + <ClInclude Include="..\..\GUI\NewUI\MainMenu.h" /> + <ClInclude Include="..\..\GUI\UI\Books\UIMapBook.h" /> + <ClInclude Include="..\..\GUI\UI\Books\UINotesBooks.h" /> + <ClInclude Include="..\..\GUI\UI\Books\UISpellBook.h" /> + <ClInclude Include="..\..\GUI\UI\UIArena.h" /> + <ClInclude Include="..\..\GUI\UI\UIBooks.h" /> + <ClInclude Include="..\..\GUI\UI\UICharacter.h" /> + <ClInclude Include="..\..\GUI\UI\UIGame.h" /> + <ClInclude Include="..\..\GUI\UI\UIGuilds.h" /> + <ClInclude Include="..\..\GUI\UI\UIHouses.h" /> + <ClInclude Include="..\..\GUI\UI\UIMainMenu.h" /> + <ClInclude Include="..\..\GUI\UI\UIMsgProc.h" /> + <ClInclude Include="..\..\GUI\UI\UIOptions.h" /> + <ClInclude Include="..\..\GUI\UI\UIPartyCreation.h" /> + <ClInclude Include="..\..\GUI\UI\UIPopup.h" /> + <ClInclude Include="..\..\GUI\UI\UIRest.h" /> + <ClInclude Include="..\..\GUI\UI\UISaveLoad.h" /> + <ClInclude Include="..\..\GUI\UI\UIShops.h" /> + <ClInclude Include="..\..\GUI\UI\UITransition.h" /> <ClInclude Include="..\..\Keyboard.h" /> <ClInclude Include="..\..\lib\legacy_dx\d3d.h" /> <ClInclude Include="..\..\lib\legacy_dx\d3dcaps.h" /> @@ -475,41 +495,16 @@ <ClInclude Include="..\..\lib\zlib\zutil.h" /> <ClInclude Include="..\..\MediaPlayer.h" /> <ClInclude Include="..\..\Mouse.h" /> - <ClInclude Include="..\..\NewUI\Core\UIControl.h" /> - <ClInclude Include="..\..\NewUI\MainMenu.h" /> <ClInclude Include="..\..\OpenALSoundProvider.h" /> <ClInclude Include="..\..\OSAPI.h" /> <ClInclude Include="..\..\OSInfo.h" /> <ClInclude Include="..\..\OSWindow.h" /> <ClInclude Include="..\..\stru6.h" /> - <ClInclude Include="..\..\UI\Books\UIMapBook.h" /> - <ClInclude Include="..\..\UI\Books\UINotesBooks.h" /> - <ClInclude Include="..\..\UI\Books\UISpellBook.h" /> - <ClInclude Include="..\..\UI\UIArena.h" /> - <ClInclude Include="..\..\UI\UIBooks.h" /> - <ClInclude Include="..\..\UI\UICharacter.h" /> - <ClInclude Include="..\..\UI\UIGame.h" /> - <ClInclude Include="..\..\UI\UIGuilds.h" /> - <ClInclude Include="..\..\UI\UIHouses.h" /> - <ClInclude Include="..\..\UI\UIMainMenu.h" /> - <ClInclude Include="..\..\UI\UIMsgProc.h" /> - <ClInclude Include="..\..\UI\UIOptions.h" /> - <ClInclude Include="..\..\UI\UIPartyCreation.h" /> - <ClInclude Include="..\..\UI\UIPopup.h" /> - <ClInclude Include="..\..\UI\UIRest.h" /> - <ClInclude Include="..\..\UI\UISaveLoad.h" /> - <ClInclude Include="..\..\UI\UIShops.h" /> - <ClInclude Include="..\..\UI\UITransition.h" /> </ItemGroup> <ItemGroup> <None Include="..\..\Engine\Objects\Player.swig" /> + <None Include="..\..\GUI\NewUI\Core\UIControlModule.swig" /> <None Include="..\..\lib\legacy_dx\d3dvec.inl" /> - <CustomBuild Include="..\..\NewUI\Core\UIControlModule.swig"> - <FileType>Document</FileType> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">call "../../lib/swig" "%(FileName)" %(RelativeDir) "%(FileName)%(Extension)" "%(FullPath)" "$(SolutionDir)" %(Filename)_wrap.cxx</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename)_wrap.cxx</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).swig</Message> - </CustomBuild> <None Include="..\..\lib\OpenAL\lib\x86\avcodec-55.def" /> <None Include="..\..\lib\OpenAL\lib\x86\avdevice-55.def" /> <None Include="..\..\lib\OpenAL\lib\x86\avfilter-3.def" />
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Fri Sep 19 03:00:21 2014 +0600 +++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Fri Sep 19 04:21:12 2014 +0600 @@ -321,66 +321,6 @@ <ClCompile Include="..\..\GUIWindow.cpp"> <Filter>GUI</Filter> </ClCompile> - <ClCompile Include="..\..\NewUI\MainMenu.cpp"> - <Filter>GUI\NewUI</Filter> - </ClCompile> - <ClCompile Include="..\..\NewUI\Core\UIControlModule_wrap.cxx"> - <Filter>GUI\NewUI\Core</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIArena.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIBooks.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UICharacter.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UiGame.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIGuilds.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIHouses.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIMainMenu.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIMsgProc.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIOptions.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIPartyCreation.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIPopup.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIRest.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UISaveLoad.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UIShops.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\UITransition.cpp"> - <Filter>GUI\UI</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\Books\UIMapBook.cpp"> - <Filter>GUI\UI\Books</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\Books\UINotesBooks.cpp"> - <Filter>GUI\UI\Books</Filter> - </ClCompile> - <ClCompile Include="..\..\UI\Books\UISpellBook.cpp"> - <Filter>GUI\UI\Books</Filter> - </ClCompile> <ClCompile Include="..\..\Arcomage\Arcomage.cpp"> <Filter>Arcomage</Filter> </ClCompile> @@ -568,6 +508,66 @@ <Filter>Engine</Filter> </ClCompile> <ClCompile Include="..\..\stru6.cpp" /> + <ClCompile Include="..\..\GUI\NewUI\Core\UIControlModule_wrap.cxx"> + <Filter>GUI\NewUI\Core</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\NewUI\MainMenu.cpp"> + <Filter>GUI\NewUI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\Books\UISpellBook.cpp"> + <Filter>GUI\UI\Books</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\Books\UIMapBook.cpp"> + <Filter>GUI\UI\Books</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\Books\UINotesBooks.cpp"> + <Filter>GUI\UI\Books</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIGuilds.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIHouses.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIMainMenu.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIMsgProc.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIOptions.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIPartyCreation.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIPopup.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIRest.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UISaveLoad.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIShops.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UITransition.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIArena.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UIBooks.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UICharacter.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> + <ClCompile Include="..\..\GUI\UI\UiGame.cpp"> + <Filter>GUI\UI</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\lib\libavcodec\avcodec.h"> @@ -1029,66 +1029,6 @@ <ClInclude Include="..\..\GUIWindow.h"> <Filter>GUI</Filter> </ClInclude> - <ClInclude Include="..\..\NewUI\MainMenu.h"> - <Filter>GUI\NewUI</Filter> - </ClInclude> - <ClInclude Include="..\..\NewUI\Core\UIControl.h"> - <Filter>GUI\NewUI\Core</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIArena.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIBooks.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UICharacter.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIGame.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIGuilds.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIHouses.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIMainMenu.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIMsgProc.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIOptions.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIPartyCreation.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIPopup.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIRest.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UISaveLoad.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UIShops.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\UITransition.h"> - <Filter>GUI\UI</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\Books\UIMapBook.h"> - <Filter>GUI\UI\Books</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\Books\UINotesBooks.h"> - <Filter>GUI\UI\Books</Filter> - </ClInclude> - <ClInclude Include="..\..\UI\Books\UISpellBook.h"> - <Filter>GUI\UI\Books</Filter> - </ClInclude> <ClInclude Include="..\..\Arcomage\Arcomage.h"> <Filter>Arcomage</Filter> </ClInclude> @@ -1315,6 +1255,66 @@ <Filter>Engine</Filter> </ClInclude> <ClInclude Include="..\..\stru6.h" /> + <ClInclude Include="..\..\GUI\NewUI\Core\UIControl.h"> + <Filter>GUI\NewUI\Core</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\NewUI\MainMenu.h"> + <Filter>GUI\NewUI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\Books\UISpellBook.h"> + <Filter>GUI\UI\Books</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\Books\UIMapBook.h"> + <Filter>GUI\UI\Books</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\Books\UINotesBooks.h"> + <Filter>GUI\UI\Books</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIGame.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIGuilds.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIHouses.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIMainMenu.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIMsgProc.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIOptions.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIPartyCreation.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIPopup.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIRest.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UISaveLoad.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIShops.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UITransition.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIArena.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UIBooks.h"> + <Filter>GUI\UI</Filter> + </ClInclude> + <ClInclude Include="..\..\GUI\UI\UICharacter.h"> + <Filter>GUI\UI</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="..\..\lib\OpenAL\lib\x86\avcodec-55.def"> @@ -1350,6 +1350,9 @@ <None Include="..\..\Engine\Objects\Player.swig"> <Filter>Engine\Objects</Filter> </None> + <None Include="..\..\GUI\NewUI\Core\UIControlModule.swig"> + <Filter>GUI\NewUI\Core</Filter> + </None> </ItemGroup> <ItemGroup> <Library Include="..\..\lib\OpenAL\lib\OpenAL\OpenAL32.lib"> @@ -1385,7 +1388,4 @@ <Library Include="..\..\lib\legacy_dx\lib\dinput8.lib" /> <Library Include="..\..\lib\legacy_dx\lib\dxguid.lib" /> </ItemGroup> - <ItemGroup> - <CustomBuild Include="..\..\NewUI\Core\UIControlModule.swig" /> - </ItemGroup> </Project> \ No newline at end of file
--- a/Engine/Events.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/Engine/Events.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -6,38 +6,38 @@ #include "ErrorHandling.h" -#include "Engine/Graphics/Weather.h" -#include "Engine/Graphics/Texture.h" +#include "Graphics/Weather.h" +#include "Graphics/Texture.h" #include "mm7_data.h" #include "MediaPlayer.h" #include "Mouse.h" #include "MapInfo.h" #include "Game.h" -#include "Engine/Graphics/Render.h" +#include "Graphics/Render.h" #include "GUIWindow.h" #include "GUIProgressBar.h" -#include "Engine/Objects/SpriteObject.h" -#include "Engine/Objects/Chest.h" +#include "Objects/SpriteObject.h" +#include "Objects/Chest.h" #include "MapsLongTimer.h" #include "LOD.h" -#include "Engine/Objects/Actor.h" +#include "Objects/Actor.h" #include "Party.h" #include "OurMath.h" #include "AudioPlayer.h" -#include "Engine/Graphics/Indoor.h" -#include "Engine/Graphics/Viewport.h" +#include "Graphics/Indoor.h" +#include "Graphics/Viewport.h" #include "texts.h" #include "stru123.h" #include "stru159.h" #include "Events.h" #include "Events2D.h" -#include "UI\UIHouses.h" +#include "..\GUI\UI\UIHouses.h" #include "MM7.h" -#include "Engine/Graphics/Level/Decoration.h" +#include "Graphics/Level/Decoration.h" #include "LuaVM.h" #include "Log.h" -#include "Engine/Graphics/DecorationList.h" +#include "Graphics/DecorationList.h" std::array<EventIndex, 4400> pSomeOtherEVT_Events;
--- a/Engine/Game.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/Engine/Game.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -27,43 +27,43 @@ #include "AudioPlayer.h" #include "LOD.h" #include "GUIWindow.h" -#include "Engine/TurnEngine/TurnEngine.h" +#include "TurnEngine/TurnEngine.h" #include "Bink_Smacker.h" -#include "Engine/Events.h" +#include "Events.h" #include "texts.h" #include "GUIFont.h" #include "Log.h" -#include "Engine/Graphics/Lights.h" -#include "Engine/Spells/CastSpellInfo.h" -#include "Engine/Tables/FrameTableInc.h" -#include "Engine/Objects/Actor.h" +#include "Graphics/Lights.h" +#include "Spells/CastSpellInfo.h" +#include "Tables/FrameTableInc.h" +#include "Objects/Actor.h" #include "GUIProgressBar.h" -#include "Engine/Objects/ObjectList.h" -#include "Engine/Graphics/Level/Decoration.h" -#include "Engine/Graphics/PaletteManager.h" -#include "UI\UIHouses.h" -#include "UI\UIShops.h" -#include "UI\UIPartyCreation.h" +#include "Objects/ObjectList.h" +#include "Graphics/Level/Decoration.h" +#include "Graphics/PaletteManager.h" +#include "..\GUI\UI\UIHouses.h" +#include "..\GUI\UI\UIShops.h" +#include "..\GUI\UI\UIPartyCreation.h" #include "SaveLoad.h" #include "Engine/Objects/SpriteObject.h" #include "mm7.h" -#include "Engine/Graphics/Sprites.h" +#include "Graphics/Sprites.h" #include "Registry.h" -#include "Engine/Objects/Chest.h" - -#include "UI\UIGame.h" - -#include "Engine/Graphics/DecorationList.h" -#include "Engine/Tables/IconFrameTable.h" -#include "Engine/Tables/PlayerFrameTable.h" +#include "Objects/Chest.h" + +#include "..\GUI\UI\UIGame.h" + +#include "Graphics/DecorationList.h" +#include "Tables/IconFrameTable.h" +#include "Tables/PlayerFrameTable.h" #include "MapsLongTimer.h" -#include "Engine/Tables/StorylineTextTable.h" -#include "Engine/Tables/FactionTable.h" +#include "Tables/StorylineTextTable.h" +#include "Tables/FactionTable.h" #include "stru123.h" #include "LuaVM.h" -#include "Engine/Graphics/RenderD3D11.h" +#include "Graphics/RenderD3D11.h" #include "MMT.h" -#include "NewUI\MainMenu.h" +#include "../GUI/NewUI\MainMenu.h" #include <direct.h>
--- a/Engine/Objects/Items.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/Engine/Objects/Items.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -5,7 +5,7 @@ #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <string> -#include "UI\UIHouses.h" +#include "..\..\GUI\UI\UIHouses.h" #include "GUIButton.h" #include "../ErrorHandling.h"
--- a/Engine/Objects/NPC.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/Engine/Objects/NPC.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -11,7 +11,7 @@ #include "NPC.h" #include "GUIWindow.h" #include "../Events.h" -#include "UI\UIHouses.h" +#include "..\..\GUI\UI\UIHouses.h" #include "../Graphics/Indoor.h" #include "../MapInfo.h" #include "Actor.h"
--- a/Engine/Objects/Player.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/Engine/Objects/Player.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -34,7 +34,7 @@ #include "../Graphics/DecalBuilder.h" #include "../Spells/CastSpellInfo.h" #include "../OurMath.h" -#include "UI\UIPartyCreation.h" +#include "..\..\GUI\UI\UIPartyCreation.h"
--- a/Engine/Spells/CastSpellInfo.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/Engine/Spells/CastSpellInfo.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -28,7 +28,7 @@ #include "../LOD.h" #include "../Graphics/Level/Decoration.h" -#include "UI\UIPartyCreation.h" +#include "..\..\GUI\UI\UIPartyCreation.h" const size_t CastSpellInfoCount = 10; std::array<CastSpellInfo, CastSpellInfoCount> pCastSpellInfo;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/NewUI/Core/UIControl.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,88 @@ +#pragma once +#include <list> +#include <algorithm> + +class UIControl +{ + public: + virtual void Show() = 0; + + virtual bool Focused() = 0; + + // Events + virtual bool OnKey(int key) {return DefaultOnKey(key);} + virtual bool OnMouseLeftClick(int x, int y) {return DefaultOnMouseLeftClick(x, y);} + virtual bool OnMouseRightClick(int x, int y) {return DefaultOnMouseRightClick(x, y);} + virtual bool OnMouseEnter() {return DefaultOnMouseEnter();} + virtual bool OnMouseLeave() {return DefaultOnMouseLeave();} + + // Container + virtual bool AddControl(UIControl *ctrl) + { + if (std::find(children.begin(), children.end(), ctrl) == children.end()) + { + children.push_back(ctrl); + ctrl->parent = this; + return true; + } + return false; + } + + virtual bool RemoveControl(UIControl *ctrl) + { + auto i = std::find(children.begin(), children.end(), ctrl); + + children.remove(ctrl); + if (i != children.end()) + { + ctrl->parent = nullptr; + return true; + } + return false; + } + + protected: + UIControl *parent; + std::list<UIControl *> children; + + + bool DefaultOnKey(int key) + { + for (auto i = children.begin(); i != children.end(); ++i) + if ((*i)->OnKey(key)) + return true; + return false; + } + + bool DefaultOnMouseLeftClick(int x, int y) + { + for (auto i = children.begin(); i != children.end(); ++i) + if ((*i)->OnMouseLeftClick(x, y)) + return true; + return false; + } + + bool DefaultOnMouseRightClick(int x, int y) + { + for (auto i = children.begin(); i != children.end(); ++i) + if ((*i)->OnMouseRightClick(x, y)) + return true; + return false; + } + + bool DefaultOnMouseEnter() + { + for (auto i = children.begin(); i != children.end(); ++i) + if ((*i)->OnMouseEnter()) + return true; + return false; + } + + bool DefaultOnMouseLeave() + { + for (auto i = children.begin(); i != children.end(); ++i) + if ((*i)->OnMouseLeave()) + return true; + return false; + } +}; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/NewUI/Core/UIControlModule.swig Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,6 @@ +%module UIControl +%{ +#include "UIControl.h" +%} + +%include "../../../NewUI/Core/UIControl.h" \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/NewUI/Core/UIControlModule_wrap.cxx Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,2523 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.11 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGLUA +#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA +#define SWIG_LUA_MODULE_GLOBAL + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template<typename T> class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template <typename T> T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return an integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if (<obj is ok>) { + if (<need new object>) { + *ptr = <ptr to new allocated object>; + return SWIG_NEWOBJ; + } else { + *ptr = <ptr to old object>; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast(r) (r) +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class<int>" == "Class<int >", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (equiv != 0 && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = SWIG_TypeNameComp(nb, ne, tb, te); + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; +} + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + register size_t l = 0; + register size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + register size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + register int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + register size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + register const unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + register unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register char d = *(c++); + register unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = ((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = ((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* ----------------------------------------------------------------------------- + * luarun.swg + * + * This file contains the runtime support for Lua modules + * and includes code for managing global variables and pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +#include "lib/lua/lua.h" +#ifdef __cplusplus +extern "C" { +#endif + +//#include "lua.h" +//#include "lauxlib.h" +#include <stdlib.h> /* for malloc */ +#include <assert.h> /* for a few sanity tests */ + +/* ----------------------------------------------------------------------------- + * Lua flavors + * ----------------------------------------------------------------------------- */ + +#define SWIG_LUA_FLAVOR_LUA 1 +#define SWIG_LUA_FLAVOR_ELUA 2 +#define SWIG_LUA_FLAVOR_ELUAC 3 + +#if !defined(SWIG_LUA_TARGET) +# error SWIG_LUA_TARGET not defined +#endif + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) +# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C) +# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C) +# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C) +# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C) +#else /* SWIG_LUA_FLAVOR_LUA */ +# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0 +# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0 +# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0 +# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0 +#endif + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) +# define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING} +# define LSTRVAL LRO_STRVAL +#endif + +/* ----------------------------------------------------------------------------- + * compatibility defines + * ----------------------------------------------------------------------------- */ + +/* History of Lua C API length functions: In Lua 5.0 (and before?) + there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen", + but a compatibility define of "lua_strlen" was added. In Lua 5.2, + this function was again renamed, to "lua_rawlen" (to emphasize that + it doesn't call the "__len" metamethod), and the compatibility + define of lua_strlen was removed. All SWIG uses have been updated + to "lua_rawlen", and we add our own defines of that here for older + versions of Lua. */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 +# define lua_rawlen lua_strlen +#elif LUA_VERSION_NUM == 501 +# define lua_rawlen lua_objlen +#endif + + +/* lua_pushglobaltable is the recommended "future-proof" way to get + the global table for Lua 5.2 and later. Here we define + lua_pushglobaltable ourselves for Lua versions before 5.2. */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 +# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX) +#endif + + +/* -------------------------------------------------------------------------- + * Helper functions for error handling + * -------------------------------------------------------------------------- */ + +/* Push the string STR on the Lua stack, like lua_pushstring, but + prefixed with the the location of the innermost Lua call-point + (as formated by luaL_where). */ +SWIGRUNTIME void +SWIG_Lua_pusherrstring (lua_State *L, const char *str) +{ + luaL_where (L, 1); + lua_pushstring (L, str); + lua_concat (L, 2); +} + +/* Push a formatted string generated from FMT and following args on + the Lua stack, like lua_pushfstring, but prefixed with the the + location of the innermost Lua call-point (as formated by luaL_where). */ +SWIGRUNTIME void +SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...) +{ + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); +} + + +/* ----------------------------------------------------------------------------- + * global swig types + * ----------------------------------------------------------------------------- */ +/* Constant table */ +#define SWIG_LUA_INT 1 +#define SWIG_LUA_FLOAT 2 +#define SWIG_LUA_STRING 3 +#define SWIG_LUA_POINTER 4 +#define SWIG_LUA_BINARY 5 +#define SWIG_LUA_CHAR 6 + +/* Structure for variable linking table */ +typedef struct { + const char *name; + lua_CFunction get; + lua_CFunction set; +} swig_lua_var_info; + +/* Constant information structure */ +typedef struct { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_lua_const_info; + +typedef struct { + const char *name; + lua_CFunction method; +} swig_lua_method; + +typedef struct { + const char *name; + lua_CFunction getmethod; + lua_CFunction setmethod; +} swig_lua_attribute; + +// Can be used to create namespaces. Currently used to +// wrap class static methods/variables/constants +typedef struct { + const char *name; + swig_lua_method *ns_methods; + swig_lua_attribute *ns_attributes; + swig_lua_const_info *ns_constants; +} swig_lua_namespace; + +typedef struct swig_lua_class { + const char *name; + swig_type_info **type; + lua_CFunction constructor; + void (*destructor)(void *); + swig_lua_method *methods; + swig_lua_attribute *attributes; + swig_lua_namespace cls_static; + struct swig_lua_class **bases; + const char **base_names; +} swig_lua_class; + +/* this is the struct for wrapping all pointers in SwigLua +*/ +typedef struct { + swig_type_info *type; + int own; /* 1 if owned & must be destroyed */ + void *ptr; +} swig_lua_userdata; + +/* this is the struct for wrapping arbitrary packed binary data +(currently it is only used for member function pointers) +the data ordering is similar to swig_lua_userdata, but it is currently not possible +to tell the two structures apart within SWIG, other than by looking at the type +*/ +typedef struct { + swig_type_info *type; + int own; /* 1 if owned & must be destroyed */ + char data[1]; /* arbitary amount of data */ +} swig_lua_rawdata; + +/* Common SWIG API */ +#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) +#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) +#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty) +#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type) + +/* Runtime API */ +#define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata)) +#define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer) +#define SWIG_MODULE_CLIENTDATA_TYPE lua_State* + +/* Contract support */ +#define SWIG_contract_assert(expr, msg) \ + if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else + + +/* helper #defines */ +#define SWIG_fail {goto fail;} +#define SWIG_fail_arg(func_name,argnum,type) \ + {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\ + func_name,argnum,type,SWIG_Lua_typename(L,argnum));\ + goto fail;} +#define SWIG_fail_ptr(func_name,argnum,type) \ + SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*") +#define SWIG_check_num_args(func_name,a,b) \ + if (lua_gettop(L)<a || lua_gettop(L)>b) \ + {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\ + goto fail;} + + +#define SWIG_Lua_get_table(L,n) \ + (lua_pushstring(L, n), lua_rawget(L,-2)) + +#define SWIG_Lua_add_function(L,n,f) \ + (lua_pushstring(L, n), \ + lua_pushcfunction(L, f), \ + lua_rawset(L,-3)) + +/* special helper for allowing 'nil' for usertypes */ +#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I)) + +#ifdef __cplusplus +/* Special helper for member function pointers +it gets the address, casts it, then dereferences it */ +//#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) +#endif + +/* storing/access of swig_module_info */ +SWIGRUNTIME swig_module_info * +SWIG_Lua_GetModule(lua_State* L) { + swig_module_info *ret = 0; + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_rawget(L,LUA_REGISTRYINDEX); + if (lua_islightuserdata(L,-1)) + ret=(swig_module_info*)lua_touserdata(L,-1); + lua_pop(L,1); /* tidy */ + return ret; +} + +SWIGRUNTIME void +SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { + /* add this all into the Lua registry: */ + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_pushlightuserdata(L,(void*)module); + lua_rawset(L,LUA_REGISTRYINDEX); +} + +/* ----------------------------------------------------------------------------- + * global variable support code: modules + * ----------------------------------------------------------------------------- */ + +/* this function is called when trying to set an immutable. +default action is to print an error. +This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */ +SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L) +{ +/* there should be 1 param passed in: the new value */ +#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE + lua_pop(L,1); /* remove it */ + luaL_error(L,"This variable is immutable"); +#endif + return 0; /* should not return anything */ +} + +/* the module.get method used for getting linked data */ +SWIGINTERN int SWIG_Lua_module_get(lua_State* L) +{ +/* there should be 2 params passed in + (1) table (not the meta table) + (2) string name of the attribute + printf("SWIG_Lua_module_get %p(%s) '%s'\n", + lua_topointer(L,1),lua_typename(L,lua_type(L,1)), + lua_tostring(L,2)); +*/ + /* get the metatable */ +#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) + assert(lua_isrotable(L,1)); /* just in case */ +#else + assert(lua_istable(L,1)); /* default Lua action */ +#endif + lua_getmetatable(L,1); /* get the metatable */ +#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) + assert(lua_isrotable(L,-1)); /* just in case */ +#else + assert(lua_istable(L,-1)); +#endif + SWIG_Lua_get_table(L,".get"); /* get the .get table */ + lua_remove(L,3); /* remove metatable */ +#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) + if (lua_isrotable(L,-1)) +#else + if (lua_istable(L,-1)) +#endif + { + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,3); /* remove .get */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_call(L,0,1); + return 1; + } + lua_pop(L,1); /* remove the top */ + } + lua_pop(L,1); /* remove the .get */ + lua_pushnil(L); /* return a nil */ + return 1; +} + +/* the module.set method used for setting linked data */ +SWIGINTERN int SWIG_Lua_module_set(lua_State* L) +{ +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value +*/ + /* get the metatable */ +#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) + assert(lua_isrotable(L,1)); /* just in case */ +#else + assert(lua_istable(L,1)); /* default Lua action */ +#endif + lua_getmetatable(L,1); /* get the metatable */ +#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) + assert(lua_isrotable(L,-1)); /* just in case */ +#else + assert(lua_istable(L,-1)); +#endif + SWIG_Lua_get_table(L,".set"); /* get the .set table */ + lua_remove(L,4); /* remove metatable */ +#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) + if (lua_isrotable(L,-1)) +#else + if (lua_istable(L,-1)) +#endif + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,4); /* remove .set */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,3); /* value */ + lua_call(L,1,0); + return 0; + } +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) + else { + return 0; // Exits stoically if an invalid key is initialized. + } +#endif + } + lua_settop(L,3); /* reset back to start */ + /* we now have the table, key & new value, so just set directly */ + lua_rawset(L,1); /* add direct */ + return 0; +} + +#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) +/* registering a module in lua. Pushes the module table on the stack. */ +SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name) +{ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushstring(L,name); + lua_newtable(L); /* the table */ + /* add meta table */ + lua_newtable(L); /* the meta table */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set); + lua_pushstring(L,".get"); + lua_newtable(L); /* the .get table */ + lua_rawset(L,-3); /* add .get into metatable */ + lua_pushstring(L,".set"); + lua_newtable(L); /* the .set table */ + lua_rawset(L,-3); /* add .set into metatable */ + lua_setmetatable(L,-2); /* sets meta table in module */ +#ifdef SWIG_LUA_MODULE_GLOBAL + /* If requested, install the module directly into the global namespace. */ + lua_rawset(L,-3); /* add module into parent */ + SWIG_Lua_get_table(L,name); /* get the table back out */ +#else + /* Do not install the module table as global name. The stack top has + the module table with the name below. We pop the top and replace + the name with it. */ + lua_replace(L,-2); +#endif +} + +/* ending the register */ +SWIGINTERN void SWIG_Lua_module_end(lua_State* L) +{ + lua_pop(L,1); /* tidy stack (remove module) */ +} + +/* adding a linked variable to the module */ +SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) +{ + assert(lua_istable(L,-1)); /* just in case */ + lua_getmetatable(L,-1); /* get the metatable */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* should be a table: */ + SWIG_Lua_add_function(L,name,getFn); + lua_pop(L,1); /* tidy stack (remove table) */ + if (setFn) /* if there is a set fn */ + { + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + assert(lua_istable(L,-1)); /* should be a table: */ + SWIG_Lua_add_function(L,name,setFn); + lua_pop(L,1); /* tidy stack (remove table) */ + } + lua_pop(L,1); /* tidy stack (remove meta) */ +} +#endif + +/* adding a function module */ +SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn) +{ + SWIG_Lua_add_function(L,name,fn); +} + +/* ----------------------------------------------------------------------------- + * global variable support code: namespaces + * ----------------------------------------------------------------------------- */ + +SWIGINTERN int SWIG_Lua_namespace_get(lua_State* L) +{ +/* there should be 2 params passed in + (1) table (not the meta table) + (2) string name of the attribute +*/ + assert(lua_istable(L,-2)); /* just in case */ + lua_getmetatable(L,-2); + assert(lua_istable(L,-1)); + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,-2); /* stack tidy, remove .get table */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* ok, so try the .fn table */ + SWIG_Lua_get_table(L,".fn"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* look for the fn */ + lua_remove(L,-2); /* stack tidy, remove .fn table */ + if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */ + { /* found it so return the fn & let lua call it */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + return 0; +} + +SWIGINTERN int SWIG_Lua_namespace_set(lua_State* L) +{ +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value +*/ + + assert(lua_istable(L,1)); + lua_getmetatable(L,1); /* get the meta table */ + assert(lua_istable(L,-1)); + + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,3); /* value */ + lua_call(L,1,0); + return 0; + } + lua_pop(L,1); /* remove the value */ + } + lua_pop(L,1); /* remove the value .set table */ + return 0; +} + +SWIGINTERN void SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]); // forward declaration +SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn); // forward declaration + +/* helper function - register namespace methods and attributes into namespace */ +SWIGINTERN void SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* ns) +{ + int i = 0; + assert(lua_istable(L,-1)); + /* There must be table at the top of the stack */ + SWIG_Lua_InstallConstants(L, ns->ns_constants); + + lua_getmetatable(L,-1); + + /* add fns */ + for(i=0;ns->ns_attributes[i].name;i++){ + SWIG_Lua_add_class_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod); + } + + /* add methods to the metatable */ + SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ + assert(lua_istable(L,-1)); /* just in case */ + for(i=0;ns->ns_methods[i].name;i++){ + SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].method); + } + lua_pop(L,1); + + /* clear stack - remove metatble */ + lua_pop(L,1); + +} + +/* helper function. creates namespace table and add it to module table */ +SWIGINTERN void SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns) +{ + assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table */ + lua_checkstack(L,5); + lua_pushstring(L, ns->name); + lua_newtable(L); /* namespace itself */ + lua_newtable(L); /* metatable for namespace */ + + /* add a table called ".get" */ + lua_pushstring(L,".get"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".set" */ + lua_pushstring(L,".set"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".fn" */ + lua_pushstring(L,".fn"); + lua_newtable(L); + lua_rawset(L,-3); + + /* add accessor fns for using the .get,.set&.fn */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set); + + lua_setmetatable(L,-2); /* set metatable */ + lua_rawset(L,-3); /* add namespace to module table */ +} +/* ----------------------------------------------------------------------------- + * global variable support code: classes + * ----------------------------------------------------------------------------- */ + +/* the class.get method, performs the lookup of class attributes */ +SWIGINTERN int SWIG_Lua_class_get(lua_State* L) +{ +/* there should be 2 params passed in + (1) userdata (not the meta table) + (2) string name of the attribute +*/ + assert(lua_isuserdata(L,-2)); /* just in case */ + lua_getmetatable(L,-2); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,-2); /* stack tidy, remove .get table */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* ok, so try the .fn table */ + SWIG_Lua_get_table(L,".fn"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* look for the fn */ + lua_remove(L,-2); /* stack tidy, remove .fn table */ + if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */ + { /* found it so return the fn & let lua call it */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* NEW: looks for the __getitem() fn + this is a user provided get fn */ + SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_pushvalue(L,2); /* the parameter */ + lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + return 0; /* sorry not known */ +} + +/* the class.set method, performs the lookup of class attributes */ +SWIGINTERN int SWIG_Lua_class_set(lua_State* L) +{ +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value +printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n", + lua_topointer(L,1),lua_typename(L,lua_type(L,1)), + lua_tostring(L,2), + lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/ + + assert(lua_isuserdata(L,1)); /* just in case */ + lua_getmetatable(L,1); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* userdata */ + lua_pushvalue(L,3); /* value */ + lua_call(L,2,0); + return 0; + } + lua_pop(L,1); /* remove the value */ + } + lua_pop(L,1); /* remove the value .set table */ + /* NEW: looks for the __setitem() fn + this is a user provided set fn */ + SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_pushvalue(L,2); /* the parameter */ + lua_pushvalue(L,3); /* the value */ + lua_call(L,3,0); /* 3 values in ,0 out */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + return 0; +} + +/* the class.destruct method called by the interpreter */ +SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L) +{ +/* there should be 1 params passed in + (1) userdata (not the meta table) */ + swig_lua_userdata* usr; + swig_lua_class* clss; + assert(lua_isuserdata(L,-1)); /* just in case */ + usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ + /* if must be destroyed & has a destructor */ + if (usr->own) /* if must be destroyed */ + { + clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ + if (clss && clss->destructor) /* there is a destroy fn */ + { + clss->destructor(usr->ptr); /* bye bye */ + } + } + return 0; +} + +/* the class.__tostring method called by the interpreter and print */ +SWIGINTERN int SWIG_Lua_class_tostring(lua_State* L) +{ +/* there should be 1 param passed in + (1) userdata (not the metatable) */ + assert(lua_isuserdata(L,1)); /* just in case */ + unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */ + lua_getmetatable(L,1); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + + lua_getfield(L, -1, ".type"); + const char* className = lua_tostring(L, -1); + + char output[256]; + sprintf(output, "<%s userdata: %lX>", className, userData); + + lua_pushstring(L, (const char*)output); + return 1; +} + +/* to manually disown some userdata */ +SWIGINTERN int SWIG_Lua_class_disown(lua_State* L) +{ +/* there should be 1 params passed in + (1) userdata (not the meta table) */ + swig_lua_userdata* usr; + assert(lua_isuserdata(L,-1)); /* just in case */ + usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ + + usr->own = 0; /* clear our ownership */ + return 0; +} + +/* Constructor proxy. Used when class name entry in module is not class constructor, +but special table instead. */ +SWIGINTERN int SWIG_Lua_constructor_proxy(lua_State* L) +{ + /* unlimited number of parameters + First one is our proxy table and we should remove it + Other we should pass to real constructor + */ + assert(lua_istable(L,1)); + lua_pushstring(L,".constructor"); + lua_rawget(L,1); + assert(!lua_isnil(L,-1)); + lua_replace(L,1); /* replace our table with real constructor */ + lua_call(L,lua_gettop(L)-1,1); + return 1; +} + +/* gets the swig class registry (or creates it) */ +SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L) +{ + /* add this all into the swig registry: */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ + if (!lua_istable(L,-1)) /* not there */ + { /* must be first time, so add it */ + lua_pop(L,1); /* remove the result */ + lua_pushstring(L,"SWIG"); + lua_newtable(L); + lua_rawset(L,LUA_REGISTRYINDEX); + /* then get it */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); + } +} + +/* helper fn to get the classes metatable from the register */ +SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname) +{ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,cname); /* get the name */ + lua_rawget(L,-2); /* get it */ + lua_remove(L,-2); /* tidy up (remove registry) */ +} + +/* helper add a variable to a registered class */ +SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) +{ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,getFn); + lua_pop(L,1); /* tidy stack (remove table) */ + if (setFn) + { + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,setFn); + lua_pop(L,1); /* tidy stack (remove table) */ + } +} + +/* helper to recursively add class static details (static attributes, operations and constants) */ +SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State* L, swig_lua_class* clss) +{ + int i = 0; + /* The class namespace table must be on the top of the stack */ + assert(lua_istable(L,-1)); + /* call all the base classes first: we can then override these later: */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_add_class_static_details(L,clss->bases[i]); + } + + SWIG_Lua_add_namespace_details(L, &clss->cls_static); +} + +/* helper to recursively add class details (attributes & operations) */ +SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss) +{ + int i; + /* call all the base classes first: we can then override these later: */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_add_class_details(L,clss->bases[i]); + } + /* add fns */ + for(i=0;clss->attributes[i].name;i++){ + SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); + } + /* add methods to the metatable */ + SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ + assert(lua_istable(L,-1)); /* just in case */ + for(i=0;clss->methods[i].name;i++){ + SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); + } + lua_pop(L,1); /* tidy stack (remove table) */ + /* add operator overloads + these look ANY method which start with "__" and assume they + are operator overloads & add them to the metatable + (this might mess up is someone defines a method __gc (the destructor)*/ + for(i=0;clss->methods[i].name;i++){ + if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){ + SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); + } + } +} + +/* set up the base classes pointers. +Each class structure has a list of pointers to the base class structures. +This function fills them. +It cannot be done at compile time, as this will not work with hireachies +spread over more than one swig file. +Therefore it must be done at runtime, querying the SWIG type system. +*/ +SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss) +{ + int i=0; + swig_module_info* module=SWIG_GetModule(L); + for(i=0;clss->base_names[i];i++) + { + if (clss->bases[i]==0) /* not found yet */ + { + /* lookup and cache the base class */ + swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]); + if (info) clss->bases[i] = (swig_lua_class *) info->clientdata; + } + } +} + +/* Register class static methods,attributes etc as well as constructor proxy */ +SWIGINTERN void SWIG_Lua_class_register_static(lua_State* L, swig_lua_class* clss) +{ + lua_checkstack(L,5); /* just in case */ + assert(lua_istable(L,-1)); /* just in case */ + assert(strcmp(clss->name, clss->cls_static.name) == 0); /* in class those 2 must be equal */ + + SWIG_Lua_namespace_register(L,&clss->cls_static); + + SWIG_Lua_get_table(L,clss->name); // Get namespace table back + assert(lua_istable(L,-1)); /* just in case */ + + /* add its constructor to module with the name of the class + so you can do MyClass(...) as well as new_MyClass(...) + BUT only if a constructor is defined + (this overcomes the problem of pure virtual classes without constructors)*/ + if (clss->constructor) + { + SWIG_Lua_add_function(L,".constructor", clss->constructor); + lua_getmetatable(L,-1); + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,"__call", SWIG_Lua_constructor_proxy); + lua_pop(L,1); + } + + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_class_static_details(L, clss); + + /* clear stack */ + lua_pop(L,1); +} + +/* performs the entire class registration process */ +SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss) +{ + SWIG_Lua_class_register_static(L,clss); + + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,clss->name); /* get the name */ + lua_newtable(L); /* create the metatable */ + /* add string of class name called ".type" */ + lua_pushstring(L,".type"); + lua_pushstring(L,clss->name); + lua_rawset(L,-3); + /* add a table called ".get" */ + lua_pushstring(L,".get"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".set" */ + lua_pushstring(L,".set"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".fn" */ + lua_pushstring(L,".fn"); + lua_newtable(L); + /* add manual disown method */ + SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown); + lua_rawset(L,-3); + /* add accessor fns for using the .get,.set&.fn */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); + SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); + /* add tostring method for better output */ + SWIG_Lua_add_function(L,"__tostring",SWIG_Lua_class_tostring); + /* add it */ + lua_rawset(L,-3); /* metatable into registry */ + lua_pop(L,1); /* tidy stack (remove registry) */ + + SWIG_Lua_get_class_metatable(L,clss->name); + SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */ + lua_pop(L,1); /* tidy stack (remove class metatable) */ +} + +/* ----------------------------------------------------------------------------- + * Class/structure conversion fns + * ----------------------------------------------------------------------------- */ + +/* helper to add metatable to new lua object */ +SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type) +{ + if (type->clientdata) /* there is clientdata: so add the metatable */ + { + SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name); + if (lua_istable(L,-1)) + { + lua_setmetatable(L,-2); + } + else + { + lua_pop(L,1); + } + } +} + +/* pushes a new object into the lua stack */ +SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own) +{ + swig_lua_userdata* usr; + if (!ptr){ + lua_pushnil(L); + return; + } + usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ + usr->ptr=ptr; /* set the ptr */ + usr->type=type; + usr->own=own; +#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) + _SWIG_Lua_AddMetatable(L,type); /* add metatable */ +#endif +} + +/* takes a object from the lua stack & converts it into an object of the correct type + (if possible) */ +SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags) +{ + swig_lua_userdata* usr; + swig_cast_info *cast; + if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */ + usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ + if (usr) + { + if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ + { + usr->own=0; + } + if (!type) /* special cast void*, no casting fn */ + { + *ptr=usr->ptr; + return SWIG_OK; /* ok */ + } + cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ + if (cast) + { + int newmemory = 0; + *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + return SWIG_OK; /* ok */ + } + } + return SWIG_ERROR; /* error */ +} + +SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags, + int argnum,const char* func_name){ + void* result; + if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){ + luaL_error (L,"Error in %s, expected a %s at argument number %d\n", + func_name,(type && type->str)?type->str:"void*",argnum); + } + return result; +} + +/* pushes a packed userdata. user for member fn pointers only */ +SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type) +{ + swig_lua_rawdata* raw; + assert(ptr); /* not acceptable to pass in a NULL value */ + raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */ + raw->type=type; + raw->own=0; + memcpy(raw->data,ptr,size); /* copy the data */ + _SWIG_Lua_AddMetatable(L,type); /* add metatable */ +} + +/* converts a packed userdata. user for member fn pointers only */ +SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type) +{ + swig_lua_rawdata* raw; + raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */ + if (!raw) return SWIG_ERROR; /* error */ + if (type==0 || type==raw->type) /* void* or identical type */ + { + memcpy(ptr,raw->data,size); /* copy it */ + return SWIG_OK; /* ok */ + } + return SWIG_ERROR; /* error */ +} + +/* a function to get the typestring of a piece of data */ +SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) +{ + swig_lua_userdata* usr; + if (lua_isuserdata(L,tp)) + { + usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */ + if (usr && usr->type && usr->type->str) + return usr->type->str; + return "userdata (unknown type)"; + } + return lua_typename(L,lua_type(L,tp)); +} + +/* lua callable function to get the userdata's type */ +SWIGRUNTIME int SWIG_Lua_type(lua_State* L) +{ + lua_pushstring(L,SWIG_Lua_typename(L,1)); + return 1; +} + +/* lua callable function to compare userdata's value +the issue is that two userdata may point to the same thing +but to lua, they are different objects */ +SWIGRUNTIME int SWIG_Lua_equal(lua_State* L) +{ + int result; + swig_lua_userdata *usr1,*usr2; + if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ + return 0; /* nil reply */ + usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ + /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/ + result=(usr1->ptr==usr2->ptr); + lua_pushboolean(L,result); + return 1; +} + +/* ----------------------------------------------------------------------------- + * global variable support code: class/struct typemap functions + * ----------------------------------------------------------------------------- */ + +#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) +/* Install Constants */ +SWIGINTERN void +SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { + int i; + for (i = 0; constants[i].type; i++) { + switch(constants[i].type) { + case SWIG_LUA_INT: + lua_pushstring(L,constants[i].name); + lua_pushnumber(L,(lua_Number)constants[i].lvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_FLOAT: + lua_pushstring(L,constants[i].name); + lua_pushnumber(L,(lua_Number)constants[i].dvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_CHAR: + lua_pushstring(L,constants[i].name); + lua_pushfstring(L,"%c",(char)constants[i].lvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_STRING: + lua_pushstring(L,constants[i].name); + lua_pushstring(L,(char *) constants[i].pvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_POINTER: + lua_pushstring(L,constants[i].name); + SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0); + lua_rawset(L,-3); + break; + case SWIG_LUA_BINARY: + lua_pushstring(L,constants[i].name); + SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype); + lua_rawset(L,-3); + break; + default: + break; + } + } +} +#endif + +/* ----------------------------------------------------------------------------- + * executing lua code from within the wrapper + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */ +#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S) +#endif +/* Executes a C string in Lua which is a really simple way of calling lua from C +Unfortunately lua keeps changing its APIs, so we need a conditional compile +In lua 5.0.X its lua_dostring() +In lua 5.1.X its luaL_dostring() +*/ +SWIGINTERN int +SWIG_Lua_dostring(lua_State *L, const char* str) { + int ok,top; + if (str==0 || str[0]==0) return 0; /* nothing to do */ + top=lua_gettop(L); /* save stack */ +#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501)) + ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */ +#else + ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */ +#endif + if (ok!=0) { + SWIG_DOSTRING_FAIL(lua_tostring(L,-1)); + } + lua_settop(L,top); /* restore the stack */ + return ok; +} + +#ifdef __cplusplus +} +#endif + +/* ------------------------------ end luarun.swg ------------------------------ */ + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_UIControl swig_types[0] +static swig_type_info *swig_types[2]; +static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#define SWIG_name "UIControl" +#define SWIG_init luaopen_UIControl +#define SWIG_init_user luaopen_UIControl_user + +#define SWIG_LUACODE luaopen_UIControl_luacode + +namespace swig { +typedef struct{} LANGUAGE_OBJ; +} + + +#include "UIControl.h" + +#ifdef __cplusplus +extern "C" { +#endif +static int _wrap_UIControl_Show(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + + SWIG_check_num_args("UIControl::Show",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Show",1,"UIControl *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_Show",1,SWIGTYPE_p_UIControl); + } + + (arg1)->Show(); + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_Focused(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + bool result; + + SWIG_check_num_args("UIControl::Focused",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Focused",1,"UIControl *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_Focused",1,SWIGTYPE_p_UIControl); + } + + result = (bool)(arg1)->Focused(); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_OnKey(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + int arg2 ; + bool result; + + SWIG_check_num_args("UIControl::OnKey",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnKey",1,"UIControl *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnKey",2,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_OnKey",1,SWIGTYPE_p_UIControl); + } + + arg2 = (int)lua_tonumber(L, 2); + result = (bool)(arg1)->OnKey(arg2); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_OnMouseLeftClick(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + int arg2 ; + int arg3 ; + bool result; + + SWIG_check_num_args("UIControl::OnMouseLeftClick",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeftClick",1,"UIControl *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseLeftClick",2,"int"); + if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseLeftClick",3,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_OnMouseLeftClick",1,SWIGTYPE_p_UIControl); + } + + arg2 = (int)lua_tonumber(L, 2); + arg3 = (int)lua_tonumber(L, 3); + result = (bool)(arg1)->OnMouseLeftClick(arg2,arg3); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_OnMouseRightClick(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + int arg2 ; + int arg3 ; + bool result; + + SWIG_check_num_args("UIControl::OnMouseRightClick",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseRightClick",1,"UIControl *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseRightClick",2,"int"); + if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseRightClick",3,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_OnMouseRightClick",1,SWIGTYPE_p_UIControl); + } + + arg2 = (int)lua_tonumber(L, 2); + arg3 = (int)lua_tonumber(L, 3); + result = (bool)(arg1)->OnMouseRightClick(arg2,arg3); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_OnMouseEnter(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + bool result; + + SWIG_check_num_args("UIControl::OnMouseEnter",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseEnter",1,"UIControl *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_OnMouseEnter",1,SWIGTYPE_p_UIControl); + } + + result = (bool)(arg1)->OnMouseEnter(); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_OnMouseLeave(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + bool result; + + SWIG_check_num_args("UIControl::OnMouseLeave",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeave",1,"UIControl *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_OnMouseLeave",1,SWIGTYPE_p_UIControl); + } + + result = (bool)(arg1)->OnMouseLeave(); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_AddControl(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + UIControl *arg2 = (UIControl *) 0 ; + bool result; + + SWIG_check_num_args("UIControl::AddControl",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::AddControl",1,"UIControl *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::AddControl",2,"UIControl *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_AddControl",1,SWIGTYPE_p_UIControl); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_AddControl",2,SWIGTYPE_p_UIControl); + } + + result = (bool)(arg1)->AddControl(arg2); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_UIControl_RemoveControl(lua_State* L) { + int SWIG_arg = 0; + UIControl *arg1 = (UIControl *) 0 ; + UIControl *arg2 = (UIControl *) 0 ; + bool result; + + SWIG_check_num_args("UIControl::RemoveControl",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::RemoveControl",1,"UIControl *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::RemoveControl",2,"UIControl *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_RemoveControl",1,SWIGTYPE_p_UIControl); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){ + SWIG_fail_ptr("UIControl_RemoveControl",2,SWIGTYPE_p_UIControl); + } + + result = (bool)(arg1)->RemoveControl(arg2); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static void swig_delete_UIControl(void *obj) { +UIControl *arg1 = (UIControl *) obj; +delete arg1; +} +static swig_lua_method swig_UIControl_methods[] = { + {"Show", _wrap_UIControl_Show}, + {"Focused", _wrap_UIControl_Focused}, + {"OnKey", _wrap_UIControl_OnKey}, + {"OnMouseLeftClick", _wrap_UIControl_OnMouseLeftClick}, + {"OnMouseRightClick", _wrap_UIControl_OnMouseRightClick}, + {"OnMouseEnter", _wrap_UIControl_OnMouseEnter}, + {"OnMouseLeave", _wrap_UIControl_OnMouseLeave}, + {"AddControl", _wrap_UIControl_AddControl}, + {"RemoveControl", _wrap_UIControl_RemoveControl}, + {0,0} +}; +static swig_lua_attribute swig_UIControl_attributes[] = { + {0,0,0} +}; +static swig_lua_attribute swig_UIControl_cls_attributes[] = { + {0,0,0} +}; +static swig_lua_method swig_UIControl_cls_methods[] = { + {0,0} +}; +static swig_lua_const_info swig_UIControl_cls_constants[] = { + {0,0,0,0,0,0} +}; +static swig_lua_class *swig_UIControl_bases[] = {0}; +static const char *swig_UIControl_base_names[] = {0}; +static swig_lua_class _wrap_class_UIControl = { "UIControl", &SWIGTYPE_p_UIControl,0, swig_delete_UIControl, swig_UIControl_methods, swig_UIControl_attributes, { "UIControl", swig_UIControl_cls_methods, swig_UIControl_cls_attributes, swig_UIControl_cls_constants }, swig_UIControl_bases, swig_UIControl_base_names }; + +#ifdef __cplusplus +} +#endif + +static const struct luaL_Reg swig_commands[] = { + {0,0} +}; + +static swig_lua_var_info swig_variables[] = { + {0,0,0} +}; + +static swig_lua_const_info swig_constants[] = { + {0,0,0,0,0,0} +}; + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static swig_type_info _swigt__p_UIControl = {"_p_UIControl", "UIControl *", 0, 0, (void*)&_wrap_class_UIControl, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_UIControl, +}; + +static swig_cast_info _swigc__p_UIControl[] = { {&_swigt__p_UIControl, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_UIControl, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned staticly to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int found, init; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + module_head = &swig_module; + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + found=0; + iter=module_head; + do { + if (iter==&swig_module) { + found=1; + break; + } + iter=iter->next; + } while (iter!= module_head); + + /* if the is found in the list, then all is done and we may leave */ + if (found) return; + /* otherwise we must add out module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpreters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ /* c-mode */ +#endif +} +#endif + + + +/* Forward declaration of where the user's %init{} gets inserted */ +void SWIG_init_user(lua_State* L ); + +#ifdef __cplusplus +extern "C" { +#endif +/* this is the initialization function + added at the very end of the code + the function is always called SWIG_init, but an earlier #define will rename it +*/ +#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) +LUALIB_API int SWIG_init(lua_State* L) +#else +SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */ +#endif +{ +#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */ + int i; + /* start with global table */ + lua_pushglobaltable (L); + /* SWIG's internal initalisation */ + SWIG_InitializeModule((void*)L); + SWIG_PropagateClientData(); +#endif + +#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) + /* add a global fn */ + SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type); + SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal); + /* begin the module (its a table with the same name as the module) */ + SWIG_Lua_module_begin(L,SWIG_name); + /* add commands/functions */ + for (i = 0; swig_commands[i].name; i++){ + SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func); + } + /* add variables */ + for (i = 0; swig_variables[i].name; i++){ + SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set); + } +#endif + +#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) + /* set up base class pointers (the hierarchy) */ + for (i = 0; swig_types[i]; i++){ + if (swig_types[i]->clientdata){ + SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata)); + } + } + /* additional registration structs & classes in lua */ + for (i = 0; swig_types[i]; i++){ + if (swig_types[i]->clientdata){ + SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata)); + } + } +#endif + +#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) + /* constants */ + SWIG_Lua_InstallConstants(L,swig_constants); +#endif + +#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) + /* invoke user-specific initialization */ + SWIG_init_user(L); + /* end module */ + /* Note: We do not clean up the stack here (Lua will do this for us). At this + point, we have the globals table and out module table on the stack. Returning + one value makes the module table the result of the require command. */ + return 1; +#else + return 0; +#endif +} + +#ifdef __cplusplus +} +#endif + + +const char* SWIG_LUACODE= + ""; + +void SWIG_init_user(lua_State* L) +{ + /* exec Lua code if applicable */ + SWIG_Lua_dostring(L,SWIG_LUACODE); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/NewUI/MainMenu.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,51 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "MainMenu.h" +#include "..\..\Engine/LOD.h" + +bool MainMenuWindow::OnMouseLeftClick(int x, int y) +{ + if (UIControl::OnMouseLeftClick(x, y)) + return true; + return false; +} + +bool MainMenuWindow::OnMouseRightClick(int x, int y) +{ + if (UIControl::OnMouseRightClick(x, y)) + return true; + return false; +} + +bool MainMenuWindow::OnKey(int key) +{ + if (UIControl::OnKey(key)) + return true; + return false; +} + + +void MainMenuWindow::Show() {} +bool MainMenuWindow::Focused() {return false;} + +bool MainMenuWindow::Initialize() +{ + RGBTexture* background_texture = new RGBTexture; + background_texture->Load("mm6title.pcx", 0); + return true; +} + +MainMenuWindow *MainMenuWindow::Create() +{ + MainMenuWindow* window = new MainMenuWindow; + if (window) + if (!window->Initialize()) + { + delete window; + window = nullptr; + } + return window; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/NewUI/MainMenu.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,32 @@ +#pragma once +#include "Core/UIControl.h" +#include "..\..\Engine/Graphics/Render.h" + + +class MainMenuWindow: public UIControl +{ + public: + static MainMenuWindow *Create(); + + bool Initialize(); + + // UIControl + virtual void Show() override; + + // UIControl + virtual bool Focused() override; + + // UIControl + virtual bool OnKey(int key) override; + // UIControl + virtual bool OnMouseLeftClick(int x, int y) override; + // UIControl + virtual bool OnMouseRightClick(int x, int y) override; + // UIControl + //virtual bool OnMouseEnter() override; + // UIControl + //virtual bool OnMouseLeave() override; + + private: + RGBTexture *background_texture; +}; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/Books/UIMapBook.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,710 @@ +#define _CRT_SECURE_NO_WARNINGS +#include "UIMapBook.h" +#include "..\..\..\Engine/Events.h" +#include "..\..\..\Engine/MM7.h" +#include "..\..\..\Engine/Graphics/Render.h" +#include "..\..\..\Mouse.h" +#include "..\UIBooks.h" +#include "..\..\..\Engine/MapInfo.h" +#include "..\..\..\GUIWindow.h" +#include "..\..\..\GUIFont.h" +#include "..\..\..\Engine/Party.h" +#include "..\..\..\AudioPlayer.h" +#include "..\..\..\Engine/Graphics/Outdoor.h" +#include "..\..\..\Engine/LOD.h" +#include "..\..\..\Engine/Graphics/Viewport.h" +#include "..\..\..\Engine/OurMath.h" +#include "..\..\..\Engine/texts.h" +#include "..\..\..\Engine/Graphics/Level/Decoration.h" +// +#include "..\..\..\Engine/mm7_data.h" + + + +std::array<__int16, 6> pTownPortalBook_xs = {{260, 324, 147, 385, 390, 19}}; +std::array<__int16, 6> pTownPortalBook_ys = {{206, 84, 182, 239, 17, 283}}; + +std::array<unsigned int, 5> pLloydsBeaconsPreviewXs = {{61, 281, 61, 281, 171}}; // 004E249C +std::array<unsigned int, 5> pLloydsBeaconsPreviewYs = {{84, 84, 228, 228, 155}}; +std::array<unsigned int, 5> pLloydsBeacons_SomeXs = {{59, 279, 59, 279, 169}}; +std::array<unsigned int, 5> pLloydsBeacons_SomeYs = {{82, 82, 226, 226, 153}}; + + + + +//----- (00411150) -------------------------------------------------------- +void BookUI_DrawTownPortalMap() +{ + int v3; // edi@17 + GUIWindow TownPortalWindow; // [sp+Ch] [bp-64h]@1 + POINT a2; // [sp+68h] [bp-8h]@17 + + pRenderer->ClearZBuffer(0, 479); + pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook); + pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); + + TownPortalWindow.uFrameX = game_viewport_x; + TownPortalWindow.uFrameY = game_viewport_y; + TownPortalWindow.uFrameWidth = game_viewport_width; + TownPortalWindow.uFrameHeight = game_viewport_height; + TownPortalWindow.uFrameZ = game_viewport_z; + TownPortalWindow.uFrameW = game_viewport_w; + + const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE, + PARTY_QUEST_FOUNTAIN_PIERPONT, + PARTY_QUEST_FOUNTAIN_NIGHON, + PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE, + PARTY_QUEST_FOUNTAIN_CELESTIA, + PARTY_QUEST_FOUNTAIN_THE_PIT}; + for (uint i = 0; i < 6; ++i) + { + + if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i])) + pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i], + pTownPortalBook_ys[i], + pTexture_TownPortalIcons[i], i + 1); + } + + pMouse->GetCursorPos(&a2); + v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; + + if (v3) + { + if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1])) + pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]); + } + TownPortalWindow.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); +} + +//----- (00410DEC) -------------------------------------------------------- +unsigned int DrawLloydBeaconsScreen() +{ + Player *pPlayer; // esi@1 + const char *pText; // eax@1 + int pTextHeight; // eax@14 + int RemainingTime; // kr08_8@14 + unsigned int pHours; // esi@14 + unsigned int pDays; // eax@14 + const char *pSelectionText; // eax@19 + Texture *v19; // [sp-4h] [bp-8Ch]@4 + GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1 + char *Str; // [sp+74h] [bp-14h]@14 + int BeaconID; // [sp+78h] [bp-10h]@11 + int uNumMaxBeacons; // [sp+84h] [bp-4h]@6 + + pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid]; + pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]); + pText = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon + pWindow.uFrameX = game_viewport_x; + pWindow.uFrameY = game_viewport_y; + pWindow.uFrameWidth = 428; + pWindow.uFrameHeight = game_viewport_height; + pWindow.uFrameZ = 435; + pWindow.uFrameW = game_viewport_w; + if ( !bRecallingBeacon ) + pText = pGlobalTXT_LocalizationStrings[375]; // Set Beacon + sprintf(pTmpBuf.data(), "%s", pText); + pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3); + if ( bRecallingBeacon ) + { + pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on); + v19 = pTex_book_button1_off; + } + else + { + pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off); + v19 = pTex_book_button1_on; + } + pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); + uNumMaxBeacons = 1; + if ( HIBYTE(pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) & 1 || (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x80u) != 0 ) + { + uNumMaxBeacons = 5; + } + else + { + if ( pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x40 ) + uNumMaxBeacons = 3; + } + if ( uNumMaxBeacons > 0 ) + { + for ( BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++ ) + { + pWindow.uFrameWidth = 92; + pWindow.uFrameHeight = 68; + pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID]; + pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID]; + pWindow.uFrameW = pWindow.uFrameY + 67; + pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91; + //if ( pSavegameThumbnails[BeaconID].pPixels != 0 ) + if ( pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0 ) + { + pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook); + pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]); + Str = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName; + pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0); + pWindow.uFrameY += -6 - pTextHeight; + pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3); + RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed; + pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60; + pDays = pHours / 24; + if ( pDays ) + { + sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days + pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; + pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); + continue; + } + else + { + if ( pHours + 1 <= 23 ) + { + if ( pHours < 1 ) + pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour + else + pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours + sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText); + pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; + pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); + continue; + } + } + sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day + pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; + pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); + continue; + } + if ( !bRecallingBeacon ) + { + pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook); + pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0); + pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно + } + } + } + if ( byte_506360 ) + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); + return BeaconID; +} + +//----- (00413980) -------------------------------------------------------- +void BookUI_Map_Draw() +{ + unsigned int map_id; // eax@35 + char party_coord[120]; // [sp+Ch] [bp-CCh]@37 + GUIWindow map_window; // [sp+84h] [bp-54h]@35 + + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); + if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); + + if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + + if ( Book_PageBtn3_flag )//Button 3 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + + if ( Book_PageBtn4_flag )//Button 4 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + + if ( Book_PageBtn5_flag )//Button 5 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + + if ( Book_PageBtn6_flag )//Button 6 + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + + if ( BtnDown_flag ) + viewparams->CenterOnParty2(); + if ( BtnUp_flag ) + viewparams->CenterOnParty(); + if ( Book_PageBtn3_flag ) + viewparams->_443219(); + if ( Book_PageBtn4_flag ) + viewparams->_443231(); + if ( Book_PageBtn5_flag ) + viewparams->_44323D(); + if ( Book_PageBtn6_flag ) + viewparams->_443225(); + + if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag ) + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + BtnUp_flag = 0; + BtnDown_flag = 0; + Book_PageBtn6_flag = 0; + Book_PageBtn5_flag = 0; + Book_PageBtn4_flag = 0; + Book_PageBtn3_flag = 0; + DrawBook_Map_sub(97, 49, 361, 313, 0); + pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr); + map_window.uFrameWidth = game_viewport_width; + map_window.uFrameHeight = game_viewport_height; + map_window.uFrameX = game_viewport_x; + map_window.uFrameY = game_viewport_y; + map_window.uFrameZ = game_viewport_z; + map_window.uFrameW = game_viewport_w; + map_id = pMapStats->GetMapInfo(pCurrentMapName); + if ( map_id ) + map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3); + + map_window.uFrameX = 0; + sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d" + map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0); +} + +//----- (00442955) -------------------------------------------------------- +void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) +{ + int v20; // eax@16 + int v26; // ecx@21 + unsigned __int16 *v27; // edi@21 + int v28; // edx@21 + int v29; // eax@21 + double v30; // st7@23 +// signed __int64 v31; // qax@23 +// unsigned short *v32; // edx@23 + int textr_width; // esi@23 +// signed int v34; // eax@23 +// signed int v35; // ecx@23 +// int v36; // esi@27 +// int v37; // ecx@27 +// int v38; // edx@31 +// unsigned int v39; // eax@33 +// short *v40; // esi@33 +// short *v41; // edi@33 +// unsigned __int8 v42; // cf@33 +// unsigned int v43; // ecx@33 +// short *v44; // edi@33 +// short *v45; // esi@33 +// int v46; // ecx@33 + signed int v47; // esi@38 + signed int v48; // ecx@38 + int v49; // eax@38 + signed int v50; // edx@55 + unsigned int v51; // ecx@55 +// int result; // eax@72 + int v54; // esi@75 + int v55; // eax@75 +// __int16 v56; // si@85 + double v57; // st7@85 +// int v58; // ebx@85 +// signed __int64 v59; // qax@85 + signed int v60; // edi@85 +// signed __int64 v61; // qax@85 + signed int v62; // ebx@85 + signed int v63; // esi@85 + int v64; // eax@87 +// unsigned int v65; // ebx@95 +// unsigned short *v66; // edx@95 +// unsigned __int16 *v67; // esi@96 +// int v68; // edi@98 +// unsigned __int16 v69; // cx@99 +// signed int v73; // [sp-4h] [bp-48068h]@59 +// unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 + //unsigned short map_texture_16[320 * 460 + 256]; // [sp+Ch] [bp-48058h]@23 +// int v76; // [sp+4800Ch] [bp-58h]@23 + //unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 + unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 + int map_tile_X; // [sp+48020h] [bp-44h]@23 + //unsigned __int16* render16_data; + unsigned char* texture8_data; + unsigned char* curr_line; + int scale_increment; + int scaled_posX; + int scaled_posY; + int stepX_r; + int stepY_r; + unsigned int teal; // [sp+48028h] [bp-3Ch]@8 + int pCenterY; // [sp+4802Ch] [bp-38h]@1 + int screenCenter_X; // [sp+48030h] [bp-34h]@1 + int pCenterX; // [sp+48034h] [bp-30h]@1 + int v87; // [sp+48038h] [bp-2Ch]@16 + unsigned int v88; // [sp+4803Ch] [bp-28h]@16 + int black; // [sp+48040h] [bp-24h]@8 + int screenCenterY; // [sp+48044h] [bp-20h]@1 + unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16 + unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 + signed int screenWidth; // [sp+48054h] [bp-10h]@8 + unsigned int v95; // [sp+48058h] [bp-Ch]@16 + int map_tile_Y; // [sp+4805Ch] [bp-8h]@10 + const void *v97; // [sp+48060h] [bp-4h]@16 +// unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 + //int a5a; // [sp+48070h] [bp+Ch]@86 + + screenCenter_X = (signed int)(tl_x + br_x) / 2; + screenCenterY = (signed int)(tl_y + br_y) / 2; + pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); + pCenterX = viewparams->sViewCenterX; + pCenterY = viewparams->sViewCenterY; + if ( viewparams->uMapBookMapZoom != 384 ) + { + if ( viewparams->uMapBookMapZoom == 768 ) + { + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) + viewparams->uMapBookMapZoom = 680; + } + } + else + { + viewparams->sViewCenterX = viewparams->indoor_center_x; + pCenterX = viewparams->indoor_center_x; + pCenterY = viewparams->indoor_center_y; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) + viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34; + } + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) + { + screenWidth = br_x - tl_x + 1; + screenHeight = br_y - tl_y + 1; + //render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; + texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; + pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; + scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; + + v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); + + teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16; + + textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; + stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16; + black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30); + + scaled_posY = stepY_r >> 16; + //nearest neiborhood scaling + if ( texture8_data) + { + for( uint i = 0; i < screenHeight; ++i ) + { + curr_line = &texture8_data[scaled_posY*textr_width]; + stepX_r = teal; + for( uint j = 0; j < screenWidth; ++j ) + { + scaled_posX = stepX_r>>16; + //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; + pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line+scaled_posX)]); + stepX_r += scale_increment; + } + stepY_r+=scale_increment; + scaled_posY=stepY_r>>16; + } + } + + /*//move visible square to render + for( uint i = 0; i < screenHeight; ++i ) + { + if ( screenWidth > 0 ) + memcpy((void*)&render16_data[pRenderer->uTargetSurfacePitch * i],(void*)&map_texture_16[i*screenWidth], screenWidth*2); + }*/ + } + else + { + black = Color16(0, 0, 0); + teal = Color16(0, 0xFFu, 0xFFu); + uNumBlueFacesInBLVMinimap = 0; + if ( pIndoor->pMapOutlines->uNumOutlines ) + { + for ( uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i ) + { + if ( !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].Invisible() + || (pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].Invisible()) )) + { + if ( !(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) ) + { + if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4) + && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) )) + { + pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1; + pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); + } + } + if ( (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) + && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4) + && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) )) + || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) + { + v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX); + screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY; + v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY; + v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX; + + v88 = fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom); + v87 = fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom); + v93 = (unsigned __int16 *)(fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)); + screenHeight = fixpoint_mul(v20, viewparams->uMapBookMapZoom); + pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87, + screenCenter_X + (fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)), screenCenterY - screenHeight, black); + } + } + } + } + if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) + { + for ( uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j ) + { + v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x; + v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX); + v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY; + v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY; + + v87 = fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom); + v88 = fixpoint_mul(v28, viewparams->uMapBookMapZoom); + uint i = fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom); + v95 = fixpoint_mul(v29, viewparams->uMapBookMapZoom); + pRenderer->RasterLine2D(screenCenter_X + (fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom)), + screenCenterY - v88, screenCenter_X + (fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom)), screenCenterY - v95, teal); + } + viewparams->sViewCenterX = pCenterX; + } + } + v47 = (fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 3; + v97 = (const void *)(fixpoint_mul((pParty->vPosition.y - pCenterY), viewparams->uMapBookMapZoom)); + v48 = 1; + v49 = screenCenterY - (int)v97 - 3; + if ( v47 >= (signed int)tl_x ) + { + if ( v47 > (signed int)br_x ) + { + if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 6) > (signed int)br_x ) + v48 = 0; + v47 = br_x; + } + } + else + { + if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X) < (signed int)tl_x ) + v48 = 0; + v47 = tl_x; + } + if ( v49 >= (signed int)tl_y ) + { + if ( v49 > br_y ) + { + if ( screenCenterY - (signed int)v97 - 6 > br_y ) + v48 = 0; + v49 = br_y; + } + } + else + { + if ( screenCenterY - (signed int)v97 < (signed int)tl_y ) + v48 = 0; + v49 = tl_y; + } + if ( v48 == 1 ) + { + v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; + if ( (signed int)v51 <= 1920 ) + v50 = 6; + if ( (signed int)v51 < 1664 ) + v50 = 5; + if ( (signed int)v51 <= 1408 ) + v50 = 4; + if ( (signed int)v51 < 1152 ) + v50 = 3; + if ( (signed int)v51 <= 896 ) + v50 = 2; + if ( (signed int)v51 < 640 ) + v50 = 1; + if ( (signed int)v51 <= 384 ) + v50 = 0; + if ( (signed int)v51 < 128 || (signed int)v51 > 1920 ) + v50 = 7; + pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); + } + if ( (signed int)uNumLevelDecorations > 0 ) + { + for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i ) + { + if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP) + { + screenHeight = pLevelDecorations[i].vPosition.y - pCenterY; + v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX); + v54 = (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X; + v97 = (const void *)(fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom)); + v55 = screenCenterY - (int)v97; + //if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z + // && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) + { + if ( viewparams->uMapBookMapZoom > 512 ) + { + pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); + pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); + pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); + } + else + pRenderer->RasterLine2D(v54, screenCenterY - (int)v97, + (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X, + screenCenterY - (int)v97, Color16(0xFFu, 0xFFu, 0xFFu)); + } + } + } + } + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) + { + screenCenterY = br_x - tl_x + 1; + v95 = br_y - tl_y + 1; + //v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; + black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; + v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); + v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16; + teal = v60 >> 16; + pPalette_16 = (unsigned __int16 *)(v60 >> 16); + v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16); + v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16; + v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)); + + + for (int y = 0; y < (signed int)v95; ++y) + { + map_tile_Y = (v63 - 80) / 4; + v64 = teal; + for (int x = 0; x < screenCenterY; ++x) + { + map_tile_X = (v64 - 80) / 4; + if ( !pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) ) + { + if ( pOutdoor->IsMapCellPartiallyRevealed(map_tile_X, map_tile_Y) ) + { + if ( !((x + screenCenter_X) % 2) ) + //*a4a = Color16(12, 12, 12); + pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(12, 12, 12)); + } + else + //*a4a = 0; + pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(0, 0, 0)); + } + v97 = (char *)v97 + black; + v64 = (signed int)v97 >> 16; + } + + v62 += black; + v97 = (const void *)v60; + v63 = v62 >> 16; + teal = (unsigned int)pPalette_16; + } + /*a4a = map_texture_16; + for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X ) + { + if ( screenCenterY > 0 ) + { + map_tile_Y = (v63 - 80) / 4; + v64 = teal; + for ( a5a = 0; a5a < screenCenterY; ++a5a ) + { + map_tile_X = (v64 - 80) / 4; + if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) ) + { + if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) ) + { + if ( !((a5a + screenCenter_X) % 2) ) + *a4a = Color16(0xCu, 0xCu, 0xCu); + } + else + *a4a = 0; + } + ++a4a; + v97 = (char *)v97 + black; + v64 = (signed int)v97 >> 16; + } + } + v62 += black; + v97 = (const void *)v60; + a4a += screenCenterY - a5a; + v63 = v62 >> 16; + teal = (unsigned int)pPalette_16; + } + + v66 = map_texture_16; + if ( (signed int)v95 > 0 ) + { + v67 = v77; + result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY); + for ( v65 = v95; v65; --v65 ) + { + if ( screenCenterY > 0 ) + { + for ( v68 = screenCenterY; v68; --v68 ) + { + v69 = *(short *)v66; + if ( !*(short *)v66 || v69 == (short)result ) + *v67 = v69; + ++v66; + ++v67; + } + } + v67 = (unsigned __int16 *)((char *)v67 + result); + } + }*/ + } +} + +//----- (00444564) -------------------------------------------------------- +const char * GetMapBookHintText() +{ + int v20; + int v21; // [sp+14h] [bp-Ch]@1 + double v0; // st7@3 + unsigned int pX; // [sp+1Ch] [bp-4h]@3 + unsigned int pY; // [sp+8h] [bp-18h]@3 + int global_coord_X; // ebx@3 + int global_coord_Y; + int map_tile_X; // edi@3 + int map_tile_Y; // eax@3 + const char *result; // eax@15 + + v20 = viewparams->sViewCenterX; + v21 = viewparams->sViewCenterY; + if ( viewparams->uMapBookMapZoom == 384 ) + { + v20 = viewparams->indoor_center_x; + v21 = viewparams->indoor_center_y; + } + pMouse->GetClickPos(&pX, &pY); + v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789); + + global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20); + global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0); + + result = 0; + map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме) + map_tile_Y = abs(global_coord_Y - 22528) / 512; + if ( pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0 ) + { + for(int i = 0; i < pOutdoor->uNumBModels && !result; i++) + { + if ( int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X), + abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius ) + { + if ( pOutdoor->pBModels[i].uNumFaces > 0 ) + { + for( int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++ ) + { + if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID ) + { + if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & FACE_HAS_EVENT) ) + { + if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) ) + { + if ( _stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "") ) + result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID); + } + } + } + } + } + } + } + } + return result; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/Books/UIMapBook.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,3 @@ + +void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb +const char *GetMapBookHintText();//sub_444564 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/Books/UINotesBooks.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,447 @@ +#define _CRT_SECURE_NO_WARNINGS +#include "..\..\..\Engine/MM7.h" +#include "..\..\..\Engine/Graphics/Render.h" +#include "..\..\..\Mouse.h" +#include "..\UIBooks.h" +#include "..\..\..\Engine/MapInfo.h" +#include "..\..\..\GUIWindow.h" +#include "..\..\..\GUIFont.h" +#include "..\..\..\Engine/Party.h" +#include "..\..\..\AudioPlayer.h" +#include "..\..\..\Engine/LOD.h" +#include "..\..\..\Engine/Graphics/Viewport.h" +#include "..\..\..\Engine/Awards.h" +#include "..\..\..\Engine/Autonotes.h" +#include "..\..\..\Engine/Tables/StorylineTextTable.h" +#include "..\..\..\Engine/texts.h" +#include "..\..\..\Engine/mm7_data.h" + +//----- (00413D3C) -------------------------------------------------------- +static const char *GetDayPart() +{ + if ( pParty->uCurrentHour > 5 && pParty->uCurrentHour < 20 ) + return pGlobalTXT_LocalizationStrings[56]; // "Day" + else if ( pParty->uCurrentHour == 5 ) + return pGlobalTXT_LocalizationStrings[55]; // "Dawn" + else if ( pParty->uCurrentHour == 20 ) + return pGlobalTXT_LocalizationStrings[566]; // "Dusk" + else + return pGlobalTXT_LocalizationStrings[567]; // "Night" +} + +//----- (00413D6F) -------------------------------------------------------- +void BookUI_Calendar_Draw() +{ + int am; // ecx@5 + char *pMapName; // eax@6 + GUIWindow calendar_window; // [sp+Ch] [bp-60h]@5 + unsigned int pMapID; // [sp+60h] [bp-Ch]@1 + unsigned int pHour; + + static unsigned int pDayMoonPhase[28] = // 4E1B18 + { + 0, 0, 0, + 1, 1, 1, 1, + 2, 2, 2, + 3, 3, 3, 3, + 4, 4, 4, + 3, 3, 3, 3, + 2, 2, 2, + 1, 1, 1, 1 + }; + + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); + pHour = pParty->uCurrentHour; + if ( (signed int)pHour >= 12 ) + { + pHour -= 12; + if ( !pHour ) + pHour = 12; + am = 1; + } + else + am = 0; + + calendar_window.uFrameX = game_viewport_x; + calendar_window.uFrameY = game_viewport_y; + calendar_window.uFrameWidth = game_viewport_width; + calendar_window.uFrameHeight = game_viewport_height; + calendar_window.uFrameZ = game_viewport_z; + calendar_window.uFrameW = game_viewport_w; + calendar_window.DrawTitleText(pBook2Font, 0, 22, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia" + + sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s", pGlobalTXT_LocalizationStrings[526], // "Time" + pHour, pParty->uCurrentMinute, aAMPMNames[am], GetDayPart()); + calendar_window.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0); + + sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[56], // "Day" + pParty->uDaysPlayed + 1, aDayNames[pParty->uDaysPlayed % 7]); + calendar_window.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0); + + sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[146], // "Month" + pParty->uCurrentMonth + 1, aMonthNames[pParty->uCurrentMonth]); + calendar_window.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0); + + sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year" + calendar_window.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0); + + sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon" + calendar_window.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0); + + pMapID = pMapStats->GetMapInfo(pCurrentMapName); + if ( pMapID ) + pMapName = pMapStats->pInfos[pMapID].pName; + else + pMapName = "Unknown"; + sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], pMapName); // "Location" + calendar_window.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0); +} + +//----- (00413126) -------------------------------------------------------- +void BookUI_Questbook_Draw() +{ + int pTextHeight; // eax@19 + GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9 + + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); + if ( BtnUp_flag || !books_primary_item_per_page )//Bookmark Up(Закладка вверх) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); + + if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )//Bookmark Down(Закладка вниз) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + + //for title + questbook_window.uFrameWidth = game_viewport_width; + questbook_window.uFrameHeight = game_viewport_height; + questbook_window.uFrameX = game_viewport_x; + questbook_window.uFrameY = game_viewport_y; + questbook_window.uFrameZ = game_viewport_z; + questbook_window.uFrameW = game_viewport_w; + questbook_window.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests" + + //for other text + questbook_window.uFrameX = 48; + questbook_window.uFrameY = 70; + questbook_window.uFrameWidth = 360; + questbook_window.uFrameHeight = 264; + questbook_window.uFrameZ = 407; + questbook_window.uFrameW = 333; + if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Click Bookmark Down(нажатие закладки вниз) + { + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + books_primary_item_per_page += num_achieved_awards; + books_num_items_per_page[books_page_number++] = num_achieved_awards; + } + if ( BtnUp_flag && books_page_number )//Click Bookmark Up(Нажатие закладки вверх) + { + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + --books_page_number; + books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; + } + if ( !num_achieved_awards || !books_primary_item_per_page ) + { + books_page_number = 0; + books_primary_item_per_page = 0; + } + BtnDown_flag = 0; + BtnUp_flag = 0; + num_achieved_awards = 0; + for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) + { + ++num_achieved_awards; + questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); + pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0); + if ( (signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight ) + break; + pRenderer->DrawTextureTransparent(100, (questbook_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); + questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24; + } +} + +//----- (0041338E) -------------------------------------------------------- +void BookUI_Autonotes_Draw() +{ + int pTextHeight; // eax@65 + bool change_flag; // [sp+10h] [bp-58h]@1 + GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 + + change_flag = false; + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); + if ( BtnUp_flag || !books_primary_item_per_page ) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); + + if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + + if ( Book_PageBtn3_flag )//Potions_page_flag + { + if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again(повторное нажатие) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + else//press(нажатие) + { + change_flag = true; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + _506568_autonote_type = AUTONOTE_POTION_RECEPIE; + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + } + } + else + { + if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); + else//Potions_page not active(вкладка снадобья не активна) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); + } + + if ( Book_PageBtn4_flag )//Fontains_page_flag + { + if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + else + { + change_flag = true; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + _506568_autonote_type = AUTONOTE_STAT_HINT; + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + } + } + else + { + if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); + } + + if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag + { + if ( _506568_autonote_type == AUTONOTE_OBELISK) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + else + { + change_flag = true; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + _506568_autonote_type = AUTONOTE_OBELISK; + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + } + } + else + { + if ( _506568_autonote_type == AUTONOTE_OBELISK) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); + } + + if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag + { + if ( _506568_autonote_type == AUTONOTE_SEER) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + else + { + change_flag = true; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + _506568_autonote_type = AUTONOTE_SEER; + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + } + } + else + { + if ( _506568_autonote_type == AUTONOTE_SEER) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); + } + + if ( Autonotes_Misc_page_flag ) + { + if ( _506568_autonote_type == AUTONOTE_MISC) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); + else + { + change_flag = true; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + _506568_autonote_type = AUTONOTE_MISC; + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); + } + } + else + { + if ( _506568_autonote_type == AUTONOTE_MISC) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off); + } + + if ( Autonotes_Instructors_page_flag ) + { + if ( _506568_autonote_type == AUTONOTE_TEACHER) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); + else + { + change_flag = true; + pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); + _506568_autonote_type = AUTONOTE_TEACHER; + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); + } + } + else + { + if ( _506568_autonote_type == AUTONOTE_TEACHER) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off); + } + + //for title + autonotes_window.uFrameWidth = game_viewport_width; + autonotes_window.uFrameHeight = game_viewport_height; + autonotes_window.uFrameX = game_viewport_x; + autonotes_window.uFrameY = game_viewport_y; + autonotes_window.uFrameZ = game_viewport_z; + autonotes_window.uFrameW = game_viewport_w; + autonotes_window.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes" + + //for other text + autonotes_window.uFrameX = 48; + autonotes_window.uFrameY = 70; + autonotes_window.uFrameWidth = 360; + autonotes_window.uFrameHeight = 264; + autonotes_window.uFrameZ = 407; + autonotes_window.uFrameW = 333; + if ( change_flag )//change bookmark(смена закладки) + { + full_num_items_in_book = 0; + books_primary_item_per_page = 0; + books_page_number = 0; + num_achieved_awards = 0; + for ( uint i = 1; i <= 195; ++i ) + { + if ( pAutonoteTxt[i].eType == _506568_autonote_type ) + { + if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText ) + achieved_awards[num_achieved_awards++] = (AwardType)i; + } + } + full_num_items_in_book = num_achieved_awards; + } + else//not change bookmark(не меняется закладка) + { + if ( BtnDown_flag )// press Down bookmark(нажатие закладки пролистать дальше) + { + if ( num_achieved_awards + books_primary_item_per_page < full_num_items_in_book ) + { + books_num_items_per_page[books_page_number++] = num_achieved_awards; + books_primary_item_per_page = num_achieved_awards + books_primary_item_per_page; + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + } + } + if ( BtnUp_flag && books_page_number )// press Up bookmark(нажатие закладки пролистать назад) + { + --books_page_number; + books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + } + if ( !num_achieved_awards || !books_primary_item_per_page )//количество записей 0 или номер первой страницы 0 + { + books_primary_item_per_page = 0; + books_page_number = 0; + } + } + BtnUp_flag = 0; + BtnDown_flag = 0; + Book_PageBtn3_flag = 0;//Potions_page_flag + Book_PageBtn4_flag = 0;//Fontains_page_flag + Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag + Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag + Autonotes_Misc_page_flag = 0; + Autonotes_Instructors_page_flag = 0; + num_achieved_awards = 0; + for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) + { + ++num_achieved_awards; + autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[achieved_awards[i]].pText, 0, 0, 0); + pTextHeight = pAutonoteFont->CalcTextHeight(pAutonoteTxt[achieved_awards[i]].pText, &autonotes_window, 1, 0); + if ( (signed int)(autonotes_window.uFrameY + pTextHeight) > (signed int)autonotes_window.uFrameHeight ) + break; + pRenderer->DrawTextureTransparent(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); + autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; + } +} + + //----- (00412E85) -------------------------------------------------------- +void BookUI_Journal_Draw() +{ + char *pDialogueString; // eax@21 + char* pStringOnPage; // eax@22 + GUIWindow journal_window; // [sp+8h] [bp-54h]@10 + + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); + if ( BtnUp_flag || !books_primary_item_per_page ) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); + + if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); + else + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); + + if ( !Journal_limitation_factor[books_primary_item_per_page] )//for title + { + journal_window.uFrameWidth = game_viewport_width; + journal_window.uFrameX = game_viewport_x; + journal_window.uFrameY = game_viewport_y; + journal_window.uFrameHeight = game_viewport_height; + journal_window.uFrameZ = game_viewport_z; + journal_window.uFrameW = game_viewport_w; + if ( pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle ) + journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); + } + + //for other text + journal_window.uFrameX = 48; + journal_window.uFrameY = 70; + journal_window.uFrameWidth = 360; + journal_window.uFrameHeight = 264; + journal_window.uFrameZ = 407; + journal_window.uFrameW = journal_window.uFrameHeight + 69; + if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Press bookmark next page + { + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + books_primary_item_per_page += num_achieved_awards; + books_num_items_per_page[books_page_number++] = num_achieved_awards; + } + if ( BtnUp_flag && books_page_number )//Press bookmark previous page + { + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + --books_page_number; + books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; + } + if ( !num_achieved_awards || books_primary_item_per_page < 1 ) + { + books_primary_item_per_page = 0; + books_page_number = 0; + } + BtnDown_flag = 0; + BtnUp_flag = 0; + num_achieved_awards = 0; + if ( achieved_awards[books_primary_item_per_page] ) + { + int index = ((int)achieved_awards[books_primary_item_per_page] - 1); + pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1, + 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]); + pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]); + journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, pStringOnPage, 0, + journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow); + ++num_achieved_awards; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/Books/UISpellBook.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,154 @@ +#define _CRT_SECURE_NO_WARNINGS +#include "..\..\..\Engine/MM7.h" +#include "..\..\..\Engine/Graphics/Render.h" +#include "..\..\..\Mouse.h" +#include "..\UIBooks.h" +#include "..\..\..\GUIWindow.h" +#include "..\..\..\GUIFont.h" +#include "..\..\..\Engine/Party.h" +#include "..\..\..\AudioPlayer.h" +#include "..\..\..\Engine/LOD.h" +#include "..\..\..\Engine/Graphics/Viewport.h" +#include "..\..\..\Engine/texts.h" +#include "..\..\..\Engine/mm7_data.h" + +std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak + +//----- (00411300) -------------------------------------------------------- +void LoadSpellbook(unsigned int spell_school) +{ + char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 + + byte_506550 = 0; + if ( pPlayers[uActiveCharacter]->uQuickSpell && (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 == spell_school ) + quick_spell_at_page = (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell - 11 * spell_school; + else + quick_spell_at_page = 0; + + for (uint i = 1; i <= 11; ++i) + { + if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) + { + sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); + SBPageSSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + + sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); + SBPageCSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + } + } +} + +//----- (00411597) -------------------------------------------------------- +void OnCloseBook() +{ + free(pSpellFont); + pSpellFont = nullptr; + free(pBookFont); + pBookFont = nullptr; + free(pBook2Font); + pBook2Font = nullptr; + free(pAutonoteFont); + pAutonoteFont = nullptr; + pTexture_mapbordr->Release(); + pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); + pIcons_LOD->RemoveTexturesPackFromTextureList(); + dword_506364 = 0; +} + +//----- (00412AF9) -------------------------------------------------------- +static void BookUI_Spellbook_DrawCurrentSchoolBackground() +{ + int pTexID = 0; + if ( uActiveCharacter ) + pTexID = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage; + pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[pTexID]); + pRenderer->DrawTextureIndexed(476, 450, pSBQuickSpellBtnTextr); + pRenderer->DrawTextureIndexed(561, 450, pSpellBookCloseBtnTextr); +} + +//----- (00412B58) -------------------------------------------------------- +void DrawSpellBookContent(Player *player) +{ + Texture *PendingTexture; // edi@1 + Texture *pTexture; // edx@5 + int v10; // eax@13 + unsigned int pX_coord; // esi@18 + unsigned int pY_coord; // edi@18 + Texture *pPageTexture; // eax@21 +// signed int v22; // [sp-4h] [bp-24h]@22 + POINT a2; // [sp+18h] [bp-8h]@13 + + static unsigned int texture_tab_coord1[9][2]= + {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} }; + + static unsigned int texture_tab_coord0[9][2]= + {{415, 10}, {415, 46}, {415, 83}, {415,121}, {415,158}, {416, 196}, {416, 234}, {416, 271}, {416,307} }; + + BookUI_Spellbook_DrawCurrentSchoolBackground(); + + PendingTexture = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); + pRenderer->ClearZBuffer(0, 479); + if ( (11 * player->lastOpenedSpellbookPage) || ((11 * player->lastOpenedSpellbookPage) + 11) )//??? maybe structure need fix + { + for ( uint i = 1; i <= 11; ++i ) + { + if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] ) + { + if ( SBPageSSpellsTextureList[i] != PendingTexture ) + { + if ( quick_spell_at_page == i ) + pTexture = SBPageCSpellsTextureList[i]; + else + pTexture = SBPageSSpellsTextureList[i]; + if ( pTexture->pLevelOfDetail0_prolly_alpha_mask ) + { + pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos; + pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos; + if ( pTexture->pBits & 0x200 ) + pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pTexture); + else + pRenderer->DrawTextureIndexed(pX_coord, pY_coord, pTexture); + pRenderer->DrawMaskToZBuffer(pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos, + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos, pTexture, i); + } + } + } + } + } + + pMouse->GetCursorPos(&a2); + v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; + if ( v10 ) + { + if ( SBPageCSpellsTextureList[v10]->pLevelOfDetail0_prolly_alpha_mask ) + { + pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Xpos; + pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Ypos; + if ( SBPageCSpellsTextureList[v10]->pBits & 0x200 ) + pRenderer->DrawTextureTransparent(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); + else + pRenderer->DrawTextureIndexed(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); + } + } + //pX_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; + //pY_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; + for ( uint i = 0; i < 9; i++ ) + { + if ( player->pActiveSkills[PLAYER_SKILL_FIRE + i] ) + { + if ( player->lastOpenedSpellbookPage == i ) + { + pPageTexture = pTextures_tabs[i][1]; + pX_coord = texture_tab_coord1[i][0]; + pY_coord = texture_tab_coord1[i][1]; + } + else + { + pPageTexture = pTextures_tabs[i][0]; + pX_coord = texture_tab_coord0[i][0]; + pY_coord = texture_tab_coord0[i][1]; + } + pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pPageTexture); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIArena.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,314 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS + +#include "../../Engine/mm7_data.h" +#include "../../Engine/Graphics/Sprites.h" + +#include "../../GUIWindow.h" +#include "../../GUIFont.h" +#include "../../Engine/Party.h" +#include "../../AudioPlayer.h" +#include "../../Engine/Graphics/Outdoor.h" +#include "../../Engine/LOD.h" +#include "../../Engine/Objects/Actor.h" +#include "../../Engine/Events.h" +#include "../../Engine/Graphics/Viewport.h" +#include "../../Engine/texts.h" +#include "../../Engine/MM7.h" + +std::array<Vec2_int_, 20> pMonsterArenaPlacements = + {{ + Vec2_int_(1524, 8332), + Vec2_int_(2186, 8844), + Vec2_int_(3219, 9339), + Vec2_int_(4500, 9339), + Vec2_int_(5323, 9004), + Vec2_int_(0x177D, 0x2098), + Vec2_int_(0x50B, 0x1E15), + Vec2_int_(0x18FF, 0x1E15), + Vec2_int_(0x50B, 0xD69), + Vec2_int_(0x18FF, 0x1B15), + Vec2_int_(0x50B, 0x1021), + Vec2_int_(0x18FF, 0x1848), + Vec2_int_(0x50B, 0x12D7), + Vec2_int_(0x18FF, 0x15A3), + Vec2_int_(0x50B, 0x14DB), + Vec2_int_(0x18FF, 0x12D7), + Vec2_int_(0x50B, 0x1848), + Vec2_int_(0x18FF, 0x1021), + Vec2_int_(0x50B, 0x1B15), + Vec2_int_(0x18FF, 0xD69), + }} +; + +//----- (004BBCDD) -------------------------------------------------------- +void Arena_SelectionFightLevel() +{ + signed int v0; // ebp@3 + GUIButton *v5; // eax@18 + GUIButton *v6; // esi@19 + + if ( pParty->field_7B5_in_arena_quest ) + { + if ( pParty->field_7B5_in_arena_quest == -1 ) + { + uDialogueType = DIALOGUE_ARENA_ALREADY_WON; + } + else + { + v0 = 0; + for (size_t i = 0; i < uNumActors; i++ ) + { + if ( pActors[i].uAIState == Dead + || pActors[i].uAIState == Removed + || pActors[i].uAIState == Disabled + || pActors[i].uSummonerID != 0 && PID_TYPE(pActors[i].uSummonerID) == OBJECT_Player) + ++v0; + } + if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) + { + uDialogueType = DIALOGUE_ARENA_REWARD; + ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1);//Ritor1:I dont know + for ( uint i= 0; i < 4; i++ ) + pParty->pPlayers[i].SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); + pParty->PartyFindsGold(gold_transaction_amount, 0); + pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); + pParty->field_7B5_in_arena_quest = -1; + } + else + { + uDialogueType = DIALOGUE_ARENA_WELCOME; + pParty->vPosition.x = 3849; + pParty->vPosition.y = 5770; + pParty->vPosition.z = 1; + pParty->uFallStartY = 1; + pParty->sRotationY = 512; + pParty->sRotationX = 0; + pParty->uFallSpeed = 0; + pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); + } + } + } + else + { + uDialogueType = DIALOGUE_ARENA_WELCOME; + v5 = pDialogueWindow->pControlsHead; + if ( v5 ) + { + do + { + v6 = v5->pNext; + free(v5); + v5 = v6; + } + while ( v6 ); + } + pDialogueWindow->pControlsHead = 0; + pDialogueWindow->pControlsTail = 0; + pDialogueWindow->uNumControls = 0; + pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, + pGlobalTXT_LocalizationStrings[79], //Close, Закрыть + pIcons_LOD->GetTexture(uExitCancelTextureId), 0); + pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 85, 0, "", 0); + pDialogueWindow->CreateButton(480, 190, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 86, 0, "", 0); + pDialogueWindow->CreateButton(480, 220, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 87, 0, "", 0); + pDialogueWindow->CreateButton(480, 250, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 88, 0, "", 0); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); + } +} + + +//----- (004BC109) -------------------------------------------------------- +void ArenaFight() +{ + int v0; // edi@1 + char *v1; // eax@7 + int v3; // eax@10 + signed int v4; // esi@10 + signed int v6; // ebx@34 + signed int v13; // eax@49 + int v14; // esi@49 + int v15; // edx@50 + int v16; // eax@51 + signed int v17; // ecx@51 + int v18; // edx@53 + int i; // edi@55 + signed int v22; // [sp-4h] [bp-144h]@51 + __int16 v23[100]; // [sp+Ch] [bp-134h]@39 + GUIWindow window; // [sp+D4h] [bp-6Ch]@1 + __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 + int v26; // [sp+134h] [bp-Ch]@1 + int num_monsters; // [sp+13Ch] [bp-4h]@17 + + v26 = 0; + pParty->field_7B5_in_arena_quest = uDialogueType; + memcpy(&window, pDialogueWindow, sizeof(window)); + window.uFrameWidth = game_viewport_width; + window.uFrameZ = 452; + v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7;// Пожалуйста, подождите пока я вызываю существ. Удачи. + pRenderer->BeginSceneD3D(); + + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + pIndoor->Draw(); + else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) + pOutdoor->Draw(); + + pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); + pRenderer->BeginScene(); + //if ( pRenderer->pRenderD3D ) + pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, + pViewport->uViewportBR_X - pViewport->uViewportTL_X, + pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, + 0x7FF); + + Texture* pTex = pIcons_LOD->GetTexture(uTextureID_Leather); + pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0); + + pRenderer->DrawTextureIndexed(8, 347 - v0, pTexture_591428); + v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);//Пожалуйста, подождите пока я вызываю существ. Удачи. + pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); + pRenderer->EndScene(); + pRenderer->Present(); + pParty->vPosition.x = 3849; + pParty->vPosition.y = 5770; + pParty->vPosition.z = 1; + pParty->uFallStartY = 1; + pParty->sRotationY = 512; + pParty->sRotationX = 0; + pParty->uFallSpeed = 0; + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + //v2 = pParty->pPlayers.data(); + for ( uint i = 0; i < 4; i++ ) + { + v3 = pParty->pPlayers[i].GetActualLevel(); + v4 = v26; + if ( v3 > v26 ) + { + v26 = pParty->pPlayers[i].GetActualLevel(); + v4 = pParty->pPlayers[i].GetActualLevel(); + } + //++v2; + } + //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); + if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) + { + num_monsters = v4; + v4 /= 2; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) + { + //v5 = (signed __int64)((double)v26 * 1.5); + num_monsters = (int)((double)v26 * 1.5); + v4 /= 2; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) + { + //LODWORD(v5) = 2 * v4; + num_monsters = 2 * v4; + v4 /= 2; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) + { + num_monsters = 2 * v4; + v4 /= 2; + } + if ( v4 < 1 ) + v4 = 1; + if ( v4 > 100 ) + v4 = 100; + if ( num_monsters > 100 ) + num_monsters = 100; + if ( v4 < 2 ) + v4 = 2; + if ( num_monsters < 2 ) + num_monsters = 2; + v6 = 0; + //v27 = 1; + //v7 = (char *)&pMonsterStats->pInfos[1].uLevel; + for ( uint i = 1; i <= 258; i++ ) + { + if ( pMonsterStats->pInfos[i].uAIType != 1 )//if ( v7[8] != 1 ) + { + if ( !MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8) ) //!MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) + { + //v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel; + if ( pMonsterStats->pInfos[i].uLevel >= v4 ) + { + if ( pMonsterStats->pInfos[i].uLevel <= num_monsters ) + v23[v6++] = i; + } + } + } + // ++v27; + //v7 += 88; + } + //while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); + num_monsters = 6; + if ( v6 < 6 ) + num_monsters = v6; + //v9 = 0; + if ( num_monsters > 0 ) + { + for ( uint i = 0; i < num_monsters; i++ ) + { + //v10 = rand(); + //++v9; + //v12 = __OFSUB__(v9, num_monsters); + //v11 = v9 - num_monsters < 0; + //*((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6]; + monster_ids[i] = v23[rand() % v6]; + } + //while ( v11 ^ v12 ); + } + if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) + { + v16 = rand(); + v17 = 3; + v22 = 50; + v18 = v16 % v17; + v13 = v22; + v14 = v18 + 6; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) + { + v16 = rand(); + v17 = 7; + v22 = 100; + v18 = v16 % v17; + v13 = v22; + v14 = v18 + 6; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) + { + v15 = rand() % 11; + v13 = 200; + v14 = v15 + 10; + } + else + { + if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) + { + v13 = 500; + v14 = 20; + } + //else + //{ + //v14 = v27; + //v13 = gold_transaction_amount; + //} + } + gold_transaction_amount = v26 * v13; + for ( i = 0; i < v14; ++i ) + Actor::Arena_summon_actor(monster_ids[rand() % num_monsters], pMonsterArenaPlacements[i].x, pMonsterArenaPlacements[i].y, 1); + pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIArena.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,9 @@ +#pragma once +#include "../../Engine/VectorTypes.h" +#include <array> + + +extern std::array<Vec2_int_, 20> pMonsterArenaPlacements; + +void Arena_SelectionFightLevel(); +void ArenaFight(); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIBooks.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,118 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "..\../Engine/MM7.h" +#include "UIBooks.h" +#include "..\../Engine/Graphics/Render.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/LOD.h" + +#include "..\../Engine/mm7_data.h" + +//----- (00413CC6) -------------------------------------------------------- +void BookUI_Draw(WindowType book) +{ + pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); + switch (book) + { + case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; + case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; + case WINDOW_MapsBook: BookUI_Map_Draw(); break; + case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; + case WINDOW_JournalBook: BookUI_Journal_Draw(); break; + + case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; + case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break; + } +} + +//----- (0041192C) -------------------------------------------------------- +void InitializeBookTextures() +{ + pAudioPlayer->StopChannels(-1, -1); + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); + pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); + pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); + pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); + pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); + + static const char *texNames[9] = // 004E24EC + { + "SBFB00", "SBAB00", "SBWB00", "SBEB00", + "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" + }; + + pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); + for ( uint i = 0; i < 9; ++i ) + { + pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); + sprintf(pTmpBuf.data(), "tab%da", i + 1); + pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + sprintf(pTmpBuf.data(), "tab%db", i + 1); + pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + } +} + +//----- (00411AAA) -------------------------------------------------------- +void InitializeBookFonts() +{ + pAudioPlayer->StopChannels(-1, -1); + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); + pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); + pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); + pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); + pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); + pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); +} + +//----- (0041140B) -------------------------------------------------------- +void OnCloseSpellBookPage() +{ + GUIButton *pNextButton; // esi@4 + for ( uint i = 1; i <= 11; i++ ) + { + SBPageCSpellsTextureList[i]->Release(); + SBPageSSpellsTextureList[i]->Release(); + } + pIcons_LOD->SyncLoadedFilesCount(); + if ( pGUIWindow_CurrentMenu->pControlsHead ) + { + do + { + pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext; + free(pGUIWindow_CurrentMenu->pControlsHead); + pGUIWindow_CurrentMenu->pControlsHead = pNextButton; + } + while ( pNextButton ); + } + pGUIWindow_CurrentMenu->pControlsHead = 0; + pGUIWindow_CurrentMenu->pControlsTail = 0; + pGUIWindow_CurrentMenu->uNumControls = 0; +} + +//----- (00411473) -------------------------------------------------------- +void OnCloseSpellBook() +{ + pTexture_pagemask->Release(); + pSpellBookCloseBtnTextr->Release(); + pSBQuickSpellBtnTextr->Release(); + for ( uint i = 0; i < 9; ++i ) + { + pSpellBookPagesTextr[i]->Release(); + pTextures_tabs[i][0]->Release(); + pTextures_tabs[i][1]->Release(); + } + pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); + pIcons_LOD->RemoveTexturesPackFromTextureList(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIBooks.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,12 @@ +#pragma once + + + +extern std::array<__int16, 6> pTownPortalBook_xs; +extern std::array<__int16, 6> pTownPortalBook_ys; + +extern std::array<std::array<unsigned char, 12>, 9> pSpellbookSpellIndices; // 4E2430 from pSpellbookSpellIndices[9][12] +extern std::array<unsigned int, 5> pLloydsBeaconsPreviewXs; // 004E249C +extern std::array<unsigned int, 5> pLloydsBeaconsPreviewYs; +extern std::array<unsigned int, 5> pLloydsBeacons_SomeXs; +extern std::array<unsigned int, 5> pLloydsBeacons_SomeYs; // idb \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UICharacter.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,2696 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include <algorithm> +#include "UICharacter.h" +#include "..\../Engine/MM7.h" +#include "..\../Engine/MapInfo.h" +#include "..\../Engine/Game.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../GUIProgressBar.h" +#include "..\../Engine/Party.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/Graphics/Render.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/Graphics/Viewport.h" +#include "..\../Engine/Timer.h" +#include "..\../Engine/Awards.h" +#include "..\../Engine/Spells/CastSpellInfo.h" +#include "..\../Engine/texts.h" +#include "..\../Mouse.h" + +#include "..\../Engine/mm7_data.h" + +int bRingsShownInCharScreen; // 5118E0 + +unsigned int ui_mainmenu_copyright_color; + +unsigned int ui_character_tooltip_header_default_color; +unsigned int ui_character_default_text_color; +unsigned int ui_character_skill_highlight_color; +unsigned int ui_character_header_text_color; +unsigned int ui_character_bonus_text_color; +unsigned int ui_character_bonus_text_color_neg; +unsigned int ui_character_skill_upgradeable_color; +unsigned int ui_character_skill_default_color; +unsigned int ui_character_stat_default_color; +unsigned int ui_character_stat_buffed_color; +unsigned int ui_character_stat_debuffed_color; +unsigned int ui_character_skillinfo_can_learn; +unsigned int ui_character_skillinfo_can_learn_gm; +unsigned int ui_character_skillinfo_cant_learn; +unsigned int ui_character_condition_normal_color; +unsigned int ui_character_condition_light_color; +unsigned int ui_character_condition_moderate_color; +unsigned int ui_character_condition_severe_color; +std::array<unsigned int, 6> ui_character_award_color; + +unsigned int ui_game_minimap_outline_color; +unsigned int ui_game_minimap_actor_friendly_color; +unsigned int ui_game_minimap_actor_hostile_color; +unsigned int ui_game_minimap_actor_corpse_color; +unsigned int ui_game_minimap_decoration_color_1; +unsigned int ui_game_minimap_projectile_color; +unsigned int ui_game_minimap_treasure_color; +std::array<unsigned int, 24> ui_game_character_record_playerbuff_colors; + +unsigned int ui_gamemenu_video_gamma_title_color; +unsigned int ui_gamemenu_keys_action_name_color; +unsigned int ui_gamemenu_keys_key_selection_blink_color_1; +unsigned int ui_gamemenu_keys_key_selection_blink_color_2; +unsigned int ui_gamemenu_keys_key_default_color; + +unsigned int ui_book_quests_title_color; +unsigned int ui_book_quests_text_color; +unsigned int ui_book_autonotes_title_color; +unsigned int ui_book_autonotes_text_color; +unsigned int ui_book_map_title_color; +unsigned int ui_book_map_coordinates_color; + +unsigned int ui_book_calendar_title_color; +unsigned int ui_book_calendar_time_color; +unsigned int ui_book_calendar_day_color; +unsigned int ui_book_calendar_month_color; +unsigned int ui_book_calendar_year_color; +unsigned int ui_book_calendar_moon_color; +unsigned int ui_book_calendar_location_color; + +unsigned int ui_book_journal_title_color; +unsigned int ui_book_journal_text_color; +unsigned int ui_book_journal_text_shadow; + +unsigned int ui_game_dialogue_npc_name_color; +unsigned int ui_game_dialogue_option_highlight_color; +unsigned int ui_game_dialogue_option_normal_color; + +unsigned int ui_house_player_cant_interact_color; + + +void set_default_ui_skin() +{ + ui_mainmenu_copyright_color = Color16(255, 255, 255); + + ui_character_tooltip_header_default_color = Color16(255, 255, 155); + ui_character_default_text_color = Color16(255, 255, 255); + ui_character_header_text_color = Color16(255, 255, 155); + ui_character_bonus_text_color = Color16(0, 255, 0); + ui_character_bonus_text_color_neg = Color16(255, 0, 0); + + ui_character_skill_upgradeable_color = Color16(0, 175, 255); + ui_character_skill_default_color = Color16(255, 0, 0); + ui_character_skill_highlight_color = Color16(255, 0, 0); + + ui_character_stat_default_color = Color16(255, 255, 255); + ui_character_stat_buffed_color = Color16(0, 255, 0); + ui_character_stat_debuffed_color = Color16(255, 35, 0); + + ui_character_skillinfo_can_learn = Color16(255, 255, 255); + ui_character_skillinfo_can_learn_gm = Color16(255, 255, 0); + ui_character_skillinfo_cant_learn = Color16(255, 0, 0); + + ui_character_condition_normal_color = Color16(255, 255, 255); + ui_character_condition_light_color = Color16(0, 255, 0); + ui_character_condition_moderate_color = Color16(225, 205, 35); + ui_character_condition_severe_color = Color16(255, 35, 0); + + ui_character_award_color[0] = Color16(248, 108, 160); + ui_character_award_color[1] = Color16(112, 220, 248); + ui_character_award_color[2] = Color16(192, 192, 240); + ui_character_award_color[3] = Color16( 64, 244, 96); + ui_character_award_color[4] = Color16(232, 244, 96); + ui_character_award_color[5] = Color16(240, 252, 192); + + ui_game_minimap_outline_color = Color16(0, 0, 255); + ui_game_minimap_actor_friendly_color = Color16(0, 255, 0); + ui_game_minimap_actor_hostile_color = Color16(255, 0, 0); + ui_game_minimap_actor_corpse_color = Color16(255, 255, 0); + ui_game_minimap_decoration_color_1 = Color16(255, 255, 255); + ui_game_minimap_projectile_color = Color16(255, 0, 0); + ui_game_minimap_treasure_color = Color16(0, 0, 255); + + ui_game_character_record_playerbuff_colors[0] = Color16(150, 212, 255); + ui_game_character_record_playerbuff_colors[1] = Color16(225, 225, 225); + ui_game_character_record_playerbuff_colors[2] = Color16(255, 128, 0); + ui_game_character_record_playerbuff_colors[3] = Color16(128, 128, 128); + ui_game_character_record_playerbuff_colors[4] = Color16(225, 225, 225); + ui_game_character_record_playerbuff_colors[5] = Color16(255, 85, 0); + ui_game_character_record_playerbuff_colors[6] = Color16(255, 128, 0); + ui_game_character_record_playerbuff_colors[7] = Color16(255, 85, 0); + ui_game_character_record_playerbuff_colors[8] = Color16(225, 225, 225); + ui_game_character_record_playerbuff_colors[9] = Color16(235, 15, 255); + ui_game_character_record_playerbuff_colors[10] = Color16(192, 192, 240); + ui_game_character_record_playerbuff_colors[11] = Color16(225, 225, 225); + ui_game_character_record_playerbuff_colors[12] = Color16(255, 128, 0); + ui_game_character_record_playerbuff_colors[13] = Color16(150, 212, 255); + ui_game_character_record_playerbuff_colors[14] = Color16(128, 128, 128); + ui_game_character_record_playerbuff_colors[15] = Color16(255, 255, 155); + ui_game_character_record_playerbuff_colors[16] = Color16(255, 255, 155); + ui_game_character_record_playerbuff_colors[17] = Color16(255, 255, 155); + ui_game_character_record_playerbuff_colors[18] = Color16(255, 255, 155); + ui_game_character_record_playerbuff_colors[19] = Color16(255, 255, 155); + ui_game_character_record_playerbuff_colors[20] = Color16(255, 255, 155); + ui_game_character_record_playerbuff_colors[21] = Color16(255, 255, 155); + ui_game_character_record_playerbuff_colors[22] = Color16(0, 128, 255); + ui_game_character_record_playerbuff_colors[23] = Color16(0, 128, 255); + + ui_gamemenu_video_gamma_title_color = Color16(255, 255, 155); + ui_gamemenu_keys_action_name_color = Color16(255, 255, 255); + ui_gamemenu_keys_key_selection_blink_color_1 = Color16(50, 0, 0); + ui_gamemenu_keys_key_selection_blink_color_2 = Color16(225, 205, 35); + ui_gamemenu_keys_key_default_color = Color16(255, 255, 255); + + ui_book_quests_title_color = Color16(255, 255, 255); + ui_book_quests_text_color = Color16(255, 255, 255); + ui_book_autonotes_title_color = Color16(255, 255, 255); + ui_book_autonotes_text_color = Color16(255, 255, 255); + ui_book_map_title_color = Color16(255, 255, 255); + ui_book_map_coordinates_color = Color16(255, 255, 255); + + ui_book_calendar_title_color = Color16(255, 255, 255); + ui_book_calendar_time_color = Color16(75, 75, 75); + ui_book_calendar_day_color = Color16(75, 75, 75); + ui_book_calendar_month_color = Color16(75, 75, 75); + ui_book_calendar_year_color = Color16(75, 75, 75); + ui_book_calendar_moon_color = Color16(75, 75, 75); + ui_book_calendar_location_color = Color16(75, 75, 75); + + ui_book_journal_title_color = Color16(255, 255, 255); + ui_book_journal_text_color = Color16(255, 255, 255); + ui_book_journal_text_shadow = Color16(0, 0, 0); + + ui_game_dialogue_npc_name_color = Color16(21, 153, 233); + ui_game_dialogue_option_highlight_color = Color16(225, 205, 35); + ui_game_dialogue_option_normal_color = Color16(255, 255, 255); + + ui_house_player_cant_interact_color = Color16(255, 255, 155); +} + +std::array<unsigned int, 16> papredoll_dbrds; +unsigned int papredoll_drhs[4]; +unsigned int papredoll_dlhus[4]; +unsigned int papredoll_dlhs[4]; +unsigned int papredoll_dbods[5]; +int paperdoll_armor_texture[4][17][3];//0x511294 +//int paperdoll_array_51132C[165]; +unsigned int papredoll_dlaus[5]; +unsigned int papredoll_dlads[4]; +int papredoll_flying_feet[22]; // 005115E0 +int paperdoll_boots_texture[4][6];//511638 +int paperdoll_cloak_collar_texture[4][10]; // weak +int paperdoll_cloak_texture[4][10]; +int paperdoll_helm_texture[2][16]; //511698 +int paperdoll_belt_texture[4][7]; //511718 + +const int paperdoll_Weapon[4][16][2] = {//4E4C30 + {{128, 205}, {30, 144}, {88, 85}, {0, 0}, {0, 0}, {0, 0}, {17, 104}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{131, 201}, {38, 158}, {98, 87}, {0, 0}, {0, 0}, {0, 0}, {21, 100}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{131, 216}, {29, 186}, {88, 119}, {0, 0}, {0, 0}, {0, 0}, { 0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + {{123, 216}, {35, 184}, {98, 119}, {0, 0}, {0, 0}, {0, 0}, { 0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + }; + +const int paperdoll_Boot[4][7][2] = //4E5490 + { + 0xE, 0x11D, 0xD, 0x11D, 0xC, 0x10A, 0xA, 0xFF, 0xD, 0xF9, 0xD, 0x137, 0xC, 0x10E, + 0x14, 0x125, 0x13, 0x122, 0x15, 0x120, 0x15, 0x114, 0x13, 0x10A, 0x11, 0x13E, 0x11, 0x116, + 0x1D, 0x121, 0x1C, 0x11F, 0x1B, 0x11B, 0x1C, 0x117, 0x16, 0x116, 0x1B, 0x137, 0x1B, 0x11B, + 0x1F, 0x127, 0x1F, 0x122, 0x1B, 0x11B, 0x1D, 0x117, 0x1D, 0x116, 0x1D, 0x137, 0x1B, 0x11F, + }; +const int paperdoll_Cloak[4][10][2] = //4E5570 + { + 0x11, 0x68, 0xF, 0x68, 0x14, 0x71, 0x19, 0x6B, 0x21, 0x6F, 0x5, 0x68, 0x5, 0x68, 0x14, 0x71, 0x3, 0x6B, 0xF, 0x6F, + 0x15, 0x64, 0xB, 0x6B, 0xE, 0x67, 0x15, 0x6B, 0x1B, 0x6F, 0x3, 0x6B, 0, 0x6B, 0xE, 0x67, 0, 0x6B, 0x3, 0x6F, + 0x10, 0x8A, 0x9, 0x8B, 0x18, 0x98, 0x25, 0x91, 0x29, 0x90, 0x8, 0x8A, 0x9, 0x8B, 0x18, 0x98, 0x3, 0x91, 0x3, 0x90, + 0x14, 0x92, 0x10, 0x92, 0x15, 0x98, 0x1F, 0x91, 0x22, 0x90, 0x8, 0x92, 0xC, 0x92, 0x15, 0x98, 0x3, 0x91, 0x3, 0x90, + }; +const int paperdoll_CloakCollar[4][10][2] = //4E56B0 + { + 0x11, 0x68, 0x34, 0x64, 0x21, 0x69, 0x1D, 0x67, 0x20, 0x67, 0x21, 0x68, 0x34, 0x64, 0x21, 0x69, 0x1D, 0x67, 0x1F, 0x67, + 0x13, 0x64, 0x35, 0x66, 0x29, 0x68, 0x1F, 0x68, 0x1F, 0x6A, 0x21, 0x6A, 0x2B, 0x66, 0x26, 0x68, 0x1F, 0x68, 0x1F, 0x6A, + 0, 0, 0x30, 0x87, 0x1E, 0x86, 0x1B, 0x86, 0x1C, 0x8A, 0x21, 0x87, 0x30, 0x87, 0x1E, 0x86, 0x1B, 0x86, 0x1C, 0x8A, + 0, 0, 0x38, 0x8A, 0x24, 0x8B, 0x1D, 0x8B, 0x21, 0x8C, 0x27, 0x8A, 0x34, 0x8A, 0x24, 0x8B, 0x25, 0x8B, 0x21, 0x8C, + }; +//int dword_4E56B4; // weak +const int paperdoll_Belt[4][7][2] = //4E57F0 + { + 0x3A, 0xB6, 0x37, 0xB2, 0x34, 0xB9, 0x3A, 0xB9, 0x37, 0xB7, 0x38, 0xAC, 0x37, 0xB7, + 0x3E, 0xAD, 0x3A, 0xAC, 0x37, 0xB0, 0x3A, 0xB1, 0x39, 0xB0, 0x3C, 0xA5, 0x39, 0xB0, + 0x3B, 0xD5, 0x37, 0xD2, 0x31, 0xD5, 0x39, 0xD6, 0x37, 0xD8, 0x37, 0xD1, 0x37, 0xD8, + 0x42, 0xD2, 0x3F, 0xD0, 0x3B, 0xD7, 0x3C, 0xD5, 0x3B, 0xD6, 0x3E, 0xCF, 0x36, 0xD6, + }; +const int paperdoll_Helm[4][16][2] = //4E58D0 + { + 0x3E, 0x1F, 0x41, 0x2C, 0x37, 0x2F, 0x31, 0x32, 0x37, 0x2A, 0x39, 0x28, 0x36, 0x34, 0x41, 0x38, 0x40, 0x31, 0x40, 0x21, 0x40, 0x31, 0x3C, 0x33, 0x3D, 0x24, 0x3A, 0x1A, 0x37, 0x2A, 0x41, 0x48, + 0x41, 0x1E, 0x42, 0x2B, 0x37, 0x2F, 0x34, 0x30, 0x39, 0x29, 0x3A, 0x26, 0x36, 0x34, 0x41, 0x37, 0x42, 0x32, 0x40, 0x21, 0x40, 0x31, 0x40, 0x2F, 0x3E, 0x22, 0x3B, 0x1A, 0x39, 0x29, 0x42, 0x47, + 0x3F, 0x47, 0x41, 0x56, 0x37, 0x59, 0x32, 0x5E, 0x37, 0x58, 0x39, 0x54, 0x34, 0x61, 0x40, 0x61, 0x41, 0x5D, 0x3E, 0x4F, 0x3E, 0x5B, 0x3D, 0x5B, 0x3F, 0x4C, 0x3B, 0x45, 0x37, 0x58, 0x41, 0x74, + 0x45, 0x45, 0x46, 0x54, 0x3A, 0x55, 0x38, 0x58, 0x3C, 0x54, 0x3F, 0x52, 0x39, 0x5B, 0x45, 0x5C, 0x47, 0x5C, 0x44, 0x4B, 0x44, 0x57, 0x43, 0x55, 0x44, 0x4A, 0x3E, 0x45, 0x3C, 0x54, 0x47, 0x70, + }; +const int pPaperdoll_Beards[4] = //4E5AD0 + { + 52, 130, 56, 136, + }; +const int pPaperdoll_LeftHand[4][2] = //4E5AE0 + { + 0x67, 0x6A, + 0x65, 0x6C, + 0x74, 0x8D, + 0x74, 0x93, + }; +const int pPaperdoll_SecondLeftHand[4][2] = //4E5B00 + { + 0x1A, 0x6B, + 0x28, 0x6D, + 0x19, 0x8D, + 0x20, 0x92, + }; +const int pPaperdoll_RightHand[4][2] = //4E5B20 + { + 0x1E, 0x90, + 0x22, 0x9E, + 0x19, 0xBA, + 0x1F, 0xB8, + }; +const int pPaperdollLeftEmptyHand[4][2] = //4E5B40 + { + 0x80, 0xCD, + 0x83, 0xC9, + 0x83, 0xD8, + 0x7B, 0xD8, + }; + +int pPaperdoll_BodyX = 481; // 004E4C28 +int pPaperdoll_BodyY = 0; // 004E4C2C +const int paperdoll_Armor_Coord[4][17][2] = //4E4E30 + { + // X Y + 0x2C, 0x67, 0x30, 0x69, 0x2D, 0x67, 0x2C, 0x64, 0x14, 0x66, 0x22, 0x67, 0x20, 0x66, 0x25, 0x66, 0x12, 0x66,//Human + 0x0A, 0x66, 0x13, 0x64, 0x0E, 0x64, 0x0A, 0x63, 0x14, 0x66, 0x0A, 0x63, 0x0A, 0x66, 0x25, 0x66, + + 0x32, 0x68, 0x32, 0x69, 0x35, 0x69, 0x33, 0x68, 0x24, 0x67, 0x30, 0x69, 0x33, 0x68, 0x31, 0x69, 0x19, 0x69, + 0x19, 0x6A, 0x16, 0x66, 0x16, 0x65, 0x0F, 0x6B, 0x24, 0x67, 0x0F, 0x6B, 0x19, 0x6A, 0x31, 0x69, + + 0x2A, 0x8C, 0x29, 0x8C, 0x2A, 0x89, 0x29, 0x86, 0x12, 0x87, 0x2D, 0x89, 0x2A, 0x88, 0x25, 0x87, 0x12, 0x8B, + 0x12, 0x8B, 0x11, 0x8A, 0x15, 0x87, 0x09, 0x89, 0x12, 0x87, 0x09, 0x89, 0x12, 0x8B, 0x25, 0x87, + + 0x33, 0x90, 0x32, 0x90, 0x34, 0x91, 0x32, 0x8E, 0x21, 0x8B, 0x31, 0x8B, 0x33, 0x8E, 0x2F, 0x8F, 0x16, 0x8D, + 0x18, 0x8C, 0x19, 0x8C, 0x1B, 0x8E, 0x0C, 0x8C, 0x21, 0x8B, 0x0C, 0x8C, 0x18, 0x8C, 0x2F, 0x8F, + }; +const int paperdoll_shoulder_coord[4][17][2] = //4E5050 + { + 0x64, 0x67, 0x61, 0x67, 0x65, 0x68, 0x6E, 0x74, 0x6C, 0x68, 0x61, 0x67, 0x66, 0x68, 0x6C, 0x6A, 0x6E, 0x6D, + 0x67, 0x69, 0x70, 0x67, 0x6E, 0x6D, 0x6C, 0x6F, 0x6C, 0x68, 0x6C, 0x6F, 0x67, 0x69, 0x6C, 0x6A, + + 0x60, 0x6B, 0x60, 0x6C, 0x60, 0x6B, 0x61, 0x6A, 0x60, 0x69, 0x60, 0x6A, 0x60, 0x6A, 0x61, 0x69, 0x63, 0x6A, + 0x64, 0x6A, 0x61, 0x66, 0x66, 0x67, 0x64, 0x6C, 0x60, 0x69, 0x64, 0x6C, 0x64, 0x6A, 0x61, 0x69, + + 0x6D, 0x8C, 0x75, 0x8C, 0, 0, 0x72, 0x8D, 0x6A, 0x89, 0, 0, 0x73, 0x8C, 0x69, 0x8C, 0x6E, 0x8D, + 0x71, 0x8D, 0x70, 0x8D, 0x72, 0x8D, 0x74, 0x8E, 0x6A, 0x89, 0x74, 0x8E, 0x71, 0x8D, 0x69, 0x8C, + + 0x72, 0x91, 0x72, 0x91, 0, 0, 0x6E, 0x92, 0x6F, 0x91, 0, 0, 0, 0, 0x6E, 0x91, 0x71, 0x90, + 0x72, 0x8D, 0x72, 0x90, 0x73, 0x93, 0x73, 0x90, 0x6F, 0x91, 0x73, 0x90, 0x72, 0x8D, 0x6E, 0x91, + }; +const int paperdoll_shoulder_second_coord[4][17][2] = //dword_4E5270 + { + 0, 0, 0x61, 0x67, 0, 0, 0x64, 0x69, 0x64, 0x68, 0, 0, 0, 0, 0x5E, 0x66, 0x5F, 0x69, + 0x55, 0x69, 0x5F, 0x67, 0x5F, 0x68, 0x32, 0x69, 0x64, 0x68, 0x32, 0x69, 0x55, 0x69, 0x5E, 0x66, + + 0, 0, 0x60, 0x6C, 0, 0, 0x60, 0x6C, 0x5E, 0x69, 0, 0, 0, 0, 0x5D, 0x6A, 0x5B, 0x6A, + 0x5B, 0x6A, 0x59, 0x69, 0x56, 0x68, 0x38, 0x6E, 0x5E, 0x69, 0x38, 0x6E, 0x5B, 0x6A, 0x5D, 0x6A, + + 0, 0, 0x75, 0x8C, 0, 0, 0x72, 0x8D, 0x62, 0x89, 0, 0, 0, 0, 0x69, 0x8C, 0x5E, 0x8D, + 0x61, 0x8D, 0x5F, 0x8D, 0x60, 0x8D, 0x2E, 0x8C, 0x62, 0x89, 0x2E, 0x8C, 0x61, 0x8D, 0x69, 0x8C, + + 0, 0, 0x72, 0x91, 0, 0, 0x72, 0x91, 0x67, 0x8F, 0, 0, 0, 0, 0x6E, 0x91, 0x64, 0x93, + 0x65, 0x8C, 0x65, 0x91, 0x67, 0x91, 0x36, 0x90, 0x67, 0x8F, 0x36, 0x90, 0x65, 0x8C, 0x6E, 0x91, + }; + +const char *dlad_texnames_by_face[25] = + { + "pc01lad", "pc02lad", "pc03lad", "pc04lad", "pc05lad", "pc06lad", + "pc07lad", "pc08lad", "pc09lad", "pc10lad", "pc11lad", "pc12lad", + "pc13lad", "pc14lad", "pc15lad", "pc16lad", "pc17lad", "pc18lad", + "pc19lad", "pc20lad", "pc21lad", "pc22lad", "pc23lad", "pc24lad", + "pc25lad" + }; +const char *dlau_texnames_by_face[25] = + { + "pc01lau", "pc02lau", "pc03lau", "pc04lau", "pc05lau", "pc06lau", + "pc07lau", "pc08lau", "pc09lau", "pc10lau", "pc11lau", "pc12lau", + "pc13lau", "pc14lau", "pc15lau", "pc16lau", "pc17lau", "pc18lau", + "pc19lau", "pc20lau", "pc21lau", "pc22lau", "pc23lau", "pc24lau", + "pc25lau" + }; +const char *dbod_texnames_by_face[25] = + { + "pc01bod", "pc02bod", "pc03bod", "pc04bod", "pc05bod", "pc06bod", + "pc07bod", "pc08bod", "pc09bod", "pc10bod", "pc11bod", "pc12bod", + "pc13bod", "pc14bod", "pc15bod", "pc16bod", "pc17bod", "pc18bod", + "pc19bod", "pc20bod", "pc21bod", "pc22bod", "pc23bod", "pc24bod", + "pc25bod" + }; +const char *drh_texnames_by_face[25] = + { + + "pc01rh", "pc02rh", "pc03rh", "pc04rh", "pc05rh", "pc06rh", + "pc07rh", "pc08rh", "pc09rh", "pc10rh", "pc11rh", "pc12rh", + "pc13rh", "pc14rh", "pc15rh", "pc16rh", "pc17rh", "pc18rh", + "pc19rh", "pc20rh", "pc21rh", "pc22rh", "pc23rh", "pc24rh", + "pc25rh" + }; +const char *dlh_texnames_by_face[25] = + { + "pc01lh", "pc02lh", "pc03lh", "pc04lh", "pc05lh", "pc06lh", + "pc07lh", "pc08lh", "pc09lh", "pc10lh", "pc11lh", "pc12lh", + "pc13lh", "pc14lh", "pc15lh", "pc16lh", "pc17lh", "pc18lh", + "pc19lh", "pc20lh", "pc21lh", "pc22lh", "pc23lh", "pc24lh", + "pc25lh" + }; +const char *dlhu_texnames_by_face[25] = + { + "pc01lhu", "pc02lhu", "pc03lhu", "pc04lhu", "pc05lhu", "pc06lhu", + "pc07lhu", "pc08lhu", "pc09lhu", "pc10lhu", "pc11lhu", "pc12lhu", + "pc13lhu", "pc14lhu", "pc15lhu", "pc16lhu", "pc17lhu", "pc18lhu", + "pc19lhu", "pc20lhu", "pc21lhu", "pc22lhu", "pc23lhu", "pc24lhu", + "pc25lhu" + }; + +const int pArmorSkills[5] = {PLAYER_SKILL_LEATHER, PLAYER_SKILL_CHAIN, PLAYER_SKILL_PLATE, PLAYER_SKILL_SHIELD, PLAYER_SKILL_DODGE}; +const int pWeaponSkills[9] = {PLAYER_SKILL_AXE, PLAYER_SKILL_BOW, PLAYER_SKILL_DAGGER, PLAYER_SKILL_MACE, PLAYER_SKILL_SPEAR, + PLAYER_SKILL_STAFF, PLAYER_SKILL_SWORD, PLAYER_SKILL_UNARMED, PLAYER_SKILL_BLASTER}; +const int pMiscSkills[12] = {PLAYER_SKILL_ALCHEMY, PLAYER_SKILL_ARMSMASTER, PLAYER_SKILL_BODYBUILDING, PLAYER_SKILL_ITEM_ID, PLAYER_SKILL_MONSTER_ID, + PLAYER_SKILL_LEARNING, PLAYER_SKILL_TRAP_DISARM, PLAYER_SKILL_MEDITATION, PLAYER_SKILL_MERCHANT, PLAYER_SKILL_PERCEPTION, + PLAYER_SKILL_REPAIR, PLAYER_SKILL_STEALING}; +const int pMagicSkills[9] = {PLAYER_SKILL_FIRE, PLAYER_SKILL_AIR, PLAYER_SKILL_WATER, PLAYER_SKILL_EARTH, PLAYER_SKILL_SPIRIT, + PLAYER_SKILL_MIND, PLAYER_SKILL_BODY, PLAYER_SKILL_LIGHT, PLAYER_SKILL_DARK}; + +//----- (00421626) -------------------------------------------------------- +GUIWindow *CharacterUI_Initialize(unsigned int _this) +{ + GUIWindow *pWindow; // edi@3 + + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + + pEventTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + bRingsShownInCharScreen = false; + CharacterUI_LoadPaperdollTextures(); + pCurrentScreen = _this; + + pWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_CharacterRecord, uActiveCharacter, 0); + pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight, + 1, 0, UIMSG_ClickStatsBtn, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats + pIcons_LOD->GetTexture(papredoll_dbrds[10]), + pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0); + pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight, + 1, 0, UIMSG_ClickSkillsBtn, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills + pIcons_LOD->GetTexture(papredoll_dbrds[8]), + pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0); + pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight, + 1, 0, UIMSG_ClickInventoryBtn, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory + pIcons_LOD->GetTexture(papredoll_dbrds[6]), + pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0); + pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight, + 1, 0, UIMSG_ClickAwardsBtn, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards + pIcons_LOD->GetTexture(papredoll_dbrds[4]), + pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0); + pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight, + 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit + pIcons_LOD->GetTexture(papredoll_dbrds[2]), + pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); + pWindow->CreateButton(0, 0, 476, 345, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); + pCharacterScreen_DetalizBtn = pWindow->CreateButton(600, 300, 30, 30, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); + pCharacterScreen_DollBtn = pWindow->CreateButton(476, 0, 164, 345, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); + + pWindow->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); + FillAwardsData(); + return pWindow; +} + +//----- (004219BE) -------------------------------------------------------- +GUIWindow *CastSpellInfo::GetCastSpellInInventoryWindow() +{ + GUIWindow *CS_inventory_window; // ebx@1 + + pEventTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + bRingsShownInCharScreen = 0; + CharacterUI_LoadPaperdollTextures(); + pCurrentScreen = SCREEN_CASTING; + CS_inventory_window = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_CastSpell_InInventory, (int)this, 0); + pCharacterScreen_ExitBtn = CS_inventory_window->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, + pGlobalTXT_LocalizationStrings[79], // Close + pIcons_LOD->GetTexture(papredoll_dbrds[2]), + pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); + CS_inventory_window->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); + pCharacterScreen_DollBtn = CS_inventory_window->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); + + CS_inventory_window->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + CS_inventory_window->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + CS_inventory_window->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + CS_inventory_window->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + return CS_inventory_window; +} + +static int CharacterUI_SkillsTab_Draw__DrawSkillTable(Player *player, int x, int y, const int *skill_list, int skill_list_size, int right_margin, const char *skill_group_name) +{ + int y_offset = y; + + sprintf(pTmpBuf.data(), "%s\r%03d%s", skill_group_name, right_margin, pGlobalTXT_LocalizationStrings[131]); //"Level" + pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf.data(), 0, 0, 0); + + int num_skills_drawn = 0; + for (int i = 0; i < skill_list_size; ++i) + { + PLAYER_SKILL_TYPE skill = (PLAYER_SKILL_TYPE)skill_list[i]; + for (uint j = 0; j < pGUIWindow_CurrentMenu->uNumControls; ++j) + { + GUIButton* v8 = pGUIWindow_CurrentMenu->pControlsHead; + + for (int v7 = j; v7 > 0; --v7) + v8 = v8->pNext; + + int v9 = v8->field_1C; + if ((short)(v8->field_1C) >= 0) + continue; + if ( (v9 & 0x7FFF) != skill ) + continue; + + ++num_skills_drawn; + y_offset = v8->uY; + + ushort skill_value = player->pActiveSkills[skill]; + int skill_level = skill_value & 0x3F; + + uint skill_color = 0; + uint skill_mastery_color = 0; + if (player->uSkillPoints > skill_level) + skill_color = ui_character_skill_upgradeable_color; + + if (pGUIWindow_CurrentMenu->pCurrentPosActiveItem == j) + { + if (player->uSkillPoints > skill_level) + skill_mastery_color = ui_character_bonus_text_color; + else + skill_mastery_color = ui_character_skill_default_color; + skill_color = skill_mastery_color; + } + + if (SkillToMastery(skill_value) == 1) + { + sprintfex(pTmpBuf.data(), "%s\r%03d%2d", pSkillNames[skill], right_margin, skill_level); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0); + } + else + { + const char *skill_level_str = nullptr; + + switch (SkillToMastery(skill_value)) + { + case 4: skill_level_str = pGlobalTXT_LocalizationStrings[96]; break; // "Grand" + case 3: skill_level_str = pGlobalTXT_LocalizationStrings[432]; break; // Master + case 2: skill_level_str = pGlobalTXT_LocalizationStrings[433]; break; // Expert + } + + if (!skill_mastery_color) + skill_mastery_color = ui_character_header_text_color; + sprintfex(pTmpBuf.data(), "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, skill_level_str, skill_color, right_margin, skill_level); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0); + } + } + } + + if (!num_skills_drawn) + { + y_offset += LOBYTE(pFontLucida->uFontHeight) - 3; + pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, y_offset, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); //"None" + } + + return y_offset; +} + +//----- (00419719) -------------------------------------------------------- +void CharacterUI_SkillsTab_Draw(Player *player) +{ + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_skill", TEXTURE_16BIT_PALETTE)); + + sprintfex(pTmpBuf.data(), "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000", + pGlobalTXT_LocalizationStrings[206], // Skills for + ui_character_header_text_color, + player->pName, + pGlobalTXT_LocalizationStrings[207], // Skill Points + player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, + player->uSkillPoints); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); + + int y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; + y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pWeaponSkills, 9, 400, pGlobalTXT_LocalizationStrings[242]); // "Weapons" + + y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10; + CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pMagicSkills, 9, 400, pGlobalTXT_LocalizationStrings[138]); // "Magic" + + y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; + y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pArmorSkills, 5, 177, pGlobalTXT_LocalizationStrings[11]); // "Armor" + + y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10; + y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pMiscSkills, 12, 177, pGlobalTXT_LocalizationStrings[143]); //"Misc" +} + +//----- (0041A000) -------------------------------------------------------- +void CharacterUI_AwardsTab_Draw(Player *player) +{ + int items_per_page; // eax@1 + char *v6; // ebx@15 + char Source[100]; // [sp+Ch] [bp-C4h]@1 + GUIWindow awards_window; // [sp+70h] [bp-60h]@1 + + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE)); + sprintfex(pTmpBuf.data(), "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color); + sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]); + strcat(pTmpBuf.data(), Source); + strcat(pTmpBuf.data(), "\f00000"); + + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); + items_per_page = books_primary_item_per_page; + awards_window.uFrameX = 12; + awards_window.uFrameY = 48; + awards_window.uFrameWidth = 424; + awards_window.uFrameHeight = 290; + awards_window.uFrameZ = 435; + awards_window.uFrameW = 337; + if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book) + items_per_page = books_primary_item_per_page++ + 1; + if (BtnUp_flag && items_per_page) + { + --items_per_page; + books_primary_item_per_page = items_per_page; + } + + if ( books_page_number < 0 ) + { + items_per_page += num_achieved_awards; + books_primary_item_per_page = items_per_page; + if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book ) + { + items_per_page = full_num_items_in_book - num_achieved_awards; + books_primary_item_per_page = items_per_page; + } + } + else if ( books_page_number > 0 ) + { + items_per_page -= num_achieved_awards; + books_primary_item_per_page = items_per_page; + if ( items_per_page < 0 ) + { + items_per_page = 0; + books_primary_item_per_page = items_per_page; + } + } + BtnDown_flag = 0; + BtnUp_flag = 0; + num_achieved_awards = 0; + books_page_number = 0; + + for ( int i = items_per_page; i < full_num_items_in_book; ++i) + { + v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4]; + pTmpBuf[0] = 0; + switch (achieved_awards[i]) + { + case Award_Arena_PageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaPageWins); break; + case Award_Arena_SquireWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaSquireWins); break; + case Award_Arena_KnightWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaKnightWins); break; + case Award_Arena_LordWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaLordWins); break; + case Award_ArcomageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageWins); break; + case Award_ArcomageLoses: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageLoses); break; + case Award_Deaths: sprintf(pTmpBuf.data(), v6, pParty->uNumDeaths); break; + case Award_BountiesCollected: sprintf(pTmpBuf.data(), v6, pParty->uNumBountiesCollected); break; + case Award_Fine: sprintf(pTmpBuf.data(), v6, pParty->uFine); break; + case Award_PrisonTerms: sprintf(pTmpBuf.data(), v6, pParty->uNumPrisonTerms); break; + } + + if (*pTmpBuf.data()) + v6 = pTmpBuf.data(); + + awards_window.DrawText(pFontArrus, 0, 0, ui_character_award_color[pAwards[achieved_awards[i]].uPriority % 6], v6, 0, 0, 0); + awards_window.uFrameY = pFontArrus->CalcTextHeight(v6, &awards_window, 0, 0) + awards_window.uFrameY + 8; + if (awards_window.uFrameY > awards_window.uFrameHeight) + break; + + ++num_achieved_awards; + } +} + +//----- (0041A2C1) -------------------------------------------------------- +unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) +{ + if ( (signed int)uNumPixels < 14 ) + uNumPixels = 14; + return ((signed int)(uNumPixels - 14) >> 5) + 1; +} + +//----- (0041A556) -------------------------------------------------------- +void draw_leather() +{ + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); +} + +//----- (0041ABFD) -------------------------------------------------------- +void CharacterUI_CharacterScreen_Draw(Player *player) +{ + pRenderer->ClearZBuffer(0, 479); + switch (pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0]) + { + case WINDOW_CharacterWindow_Stats: // stats + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + CharacterUI_StatsTab_Draw(player); + pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX, + pCharacterScreen_StatsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE)); + break; + + case WINDOW_CharacterWindow_Skills: // skills + if (dword_507CC0_activ_ch != uActiveCharacter) + { + CharacterUI_ReleaseButtons(); + CharacterUI_SkillsTab_CreateButtons(); + } + ReleaseAwardsScrollBar(); + CharacterUI_SkillsTab_Draw(player); + pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX, + pCharacterScreen_SkillsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE)); + break; + + case WINDOW_CharacterWindow_Awards: // awards + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + CreateAwardsScrollBar(); + CharacterUI_AwardsTab_Draw(player); + pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX, + pCharacterScreen_AwardsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE)); + break; + + case WINDOW_CharacterWindow_Inventory: // inventory and other + CharacterUI_ReleaseButtons(); + ReleaseAwardsScrollBar(); + CharacterUI_InventoryTab_Draw(player, false); + pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX, + pCharacterScreen_InventoryBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE)); + break; + + default: break; + } + + if (bRingsShownInCharScreen) + CharacterUI_DrawPaperdollWithRingOverlay(player); + else + CharacterUI_DrawPaperdoll(player); +} + +//----- (0043CC7C) -------------------------------------------------------- +void CharacterUI_DrawPaperdoll(Player *player) +{ + ItemGen *item; // edi@38 + int item_X; // ebx@38 + int index; // eax@65 + int v59; // ebx@129 + unsigned int v75; // ebx@170 + int v94; // ebx@214 + unsigned int v127; // ebx@314 + unsigned int v153; // eax@370 + char *v166; // [sp-8h] [bp-54h]@16 + const char *container; // [sp-8h] [bp-54h]@79 + char *v181; // [sp-8h] [bp-54h]@337 + int item_Y; // [sp+10h] [bp-3Ch]@38 + int pBodyComplection; // [sp+24h] [bp-28h]@6 + bool two_handed_left_fist; // [sp+34h] [bp-18h]@361 + signed int IsDwarf; // [sp+40h] [bp-Ch]@4 + + pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); + if (player->GetRace() == CHARACTER_RACE_DWARF) + { + IsDwarf = 1; + pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 2 : 3; + } + else + { + IsDwarf = 0; + pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 0 : 1; + } + + int uPlayerID = 0; + for (uint i = 0; i < 4; ++i) + if (pPlayers[i + 1] == player) + { + uPlayerID = i + 1; + break; + } + + pRenderer->ResetTextureClipRect(); + pRenderer->DrawTextureIndexed(467, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//Подложка + if ( IsPlayerWearingWatersuit[uPlayerID] )//акваланг + { + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); + //Рука не занята или ... + if ( !player->GetItem(&PlayerEquipment::uMainHand) + || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED) + && (player->GetMainHandItem()->GetItemEquipType() != PLAYER_SKILL_SPEAR + || player->GetItem(&PlayerEquipment::uShield)) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], + pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); + //-----------------------------------------------------(Hand/Рука)--------------------------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uMainHand) ) + { + item = player->GetMainHandItem(); + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; + if ( item->uItemID == 64 ) //blaster + v166 = "item64v1"; + else + v166 = item->GetIconName(); + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation(); + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); + else if ( item->uAttributes & ITEM_IDENTIFIED ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), player->pEquipment.uMainHand); + } + } + else// без акваланга + { + //----------------(Bow/ Лук)------------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uBow) ) + { + item = player->GetBowItem(); + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[item->uItemID].uEquipY; + + if ( item->ItemEnchanted() )// применён закл + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation(); + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE),GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); + else if ( !(item->uAttributes & ITEM_IDENTIFIED) )//не опознанный лук зелёный + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); + else // опознанный лук + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)), + player->pEquipment.uBow); + } + //-----------------------------(Cloak/Плащ)--------------------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uCloak) ) + { + item = player->GetCloakItem(); + switch ( item->uItemID ) + { + case ITEM_RELIC_TWILIGHT: + index = 5; + break; + case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP: + index = 6; + break; + case ITEM_RARE_SUN_CLOAK: + index = 7; + break; + case ITEM_RARE_MOON_CLOAK: + index = 8; + break; + case ITEM_RARE_VAMPIRES_CAPE: + index = 9; + break; + default: + index = item->uItemID - 105; + break; + } + if ( index >= 0 && index < 10 ) + { + item_X = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][index][1]; + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation();//~0x000000F0 + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index])); + else + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index])); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index]), + player->pEquipment.uCloak); + } + } + //-------------------------------(Paperdoll/Кукла)------------------------------------------- + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); + //-------------------------------(Armor/Броня)----------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uArmor) ) + { + item = player->GetArmorItem(); + switch ( item->uItemID ) + { + case ITEM_ARTIFACT_GOVERNORS_ARMOR: + index = 15; + break; + case ITEM_ARTIFACT_YORUBA: + index = 14; + break; + case ITEM_RELIC_HARECS_LEATHER: + index = 13; + break; + case ITEM_ELVEN_CHAINMAIL: + index = 16; + break; + default: + index = item->uItemID - 66; + break; + } + if ( index >= 0 && index < 17 ) + { + item_X = pPaperdoll_BodyX + paperdoll_Armor_Coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Armor_Coord[pBodyComplection][index][1]; + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation();//~0x000000F0 + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0])); + else if ( !(item->uAttributes & ITEM_IDENTIFIED) ) + pRenderer->DrawTransparentGreenShade(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]]); + else + pRenderer->DrawTextureTransparent(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]]); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]], + player->pEquipment.uArmor); + } + } + //----------------------------------(Boot/Обувь)-------------------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uBoot) ) + { + item = player->GetBootItem(); + switch ( item->uItemID ) + { + case ITEM_ARTIFACT_HERMES_SANDALS: + index = 5; + v59 = papredoll_flying_feet[player->uCurrentFace]; + break; + case ITEM_ARTIFACT_LEAGUE_BOOTS: + index = 6; + v59 = paperdoll_boots_texture[pBodyComplection][5]; + break; + default: + index = item->uItemID - 115; + v59 = paperdoll_boots_texture[pBodyComplection][index]; + break; + } + if ( index >= 0 && index < 7 ) + { + item_X = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][index][1]; + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation();//~0x000000F0 + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v59), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v59)); + else if ( item->uAttributes & ITEM_IDENTIFIED ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v59)); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v59)); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v59), player->pEquipment.uBoot); + } + } + //--------------------------------------------(Hand/Рука)------------------------------------------------------ + if ( !player->GetItem(&PlayerEquipment::uMainHand) + || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED) + && (player->GetMainHandItem()->GetPlayerSkillType() != PLAYER_SKILL_SPEAR + || player->GetItem(&PlayerEquipment::uShield)) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); + //--------------------------------------------(Belt/Пояс)------------------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uBelt)) + { + item = player->GetBeltItem(); + switch ( item->uItemID ) + { + case ITEM_RILIC_TITANS_BELT: + index = 5; + break; + case ITEM_ARTIFACT_HEROS_BELT: + index = 6; + break; + default: + index = item->uItemID - 100; + break; + } + if ( index >= 0 && index < 7 ) + { + item_X = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][index][1]; + if ( IsDwarf != 1 || index == 5 ) + v75 = paperdoll_belt_texture[pBodyComplection][index]; + else + v75 = paperdoll_belt_texture[pBodyComplection - 2][index]; + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation();//~0x000000F0 + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v75), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v75)); + else if ( item->uAttributes & ITEM_IDENTIFIED ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v75)); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v75)); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v75), player->pEquipment.uBelt); + } + } + //--------------------------------(Shoulder/Плечи)--------------------------------------------- + if (player->GetItem(&PlayerEquipment::uArmor)) + { + item = player->GetArmorItem(); + switch ( item->uItemID ) + { + case ITEM_ARTIFACT_GOVERNORS_ARMOR: + index = 15; + break; + case ITEM_ARTIFACT_YORUBA: + index = 14; + break; + case ITEM_RELIC_HARECS_LEATHER: + index = 13; + break; + case ITEM_ELVEN_CHAINMAIL: + index = 16; + break; + default: + index = item->uItemID - 66; + break; + } + if ( index >= 0 && index < 17 ) + { + if ( player->GetItem(&PlayerEquipment::uMainHand) && (player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED + || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR + && !player->GetItem(&PlayerEquipment::uShield) ))//без щита + { + v94 = paperdoll_armor_texture[pBodyComplection][index][2]; + if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") ) + { + v94 = paperdoll_armor_texture[pBodyComplection][index][1]; + item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1]; + } + else + { + item_X = pPaperdoll_BodyX + paperdoll_shoulder_second_coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder_second_coord[pBodyComplection][index][1]; + } + if ( v94 != pIcons_LOD->FindTextureByName("pending") ) + { + if ( item->ItemEnchanted() ) + { + if ( paperdoll_armor_texture[pBodyComplection][index][2] != pIcons_LOD->FindTextureByName("pending") ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation();//~0x000000F0 + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v94), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); + } + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); + else if ( item->uAttributes & ITEM_IDENTIFIED ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v94)); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); + + } + } + else//без ничего или с щитом + { + //v94 = paperdoll_armor_texture[pBodyComplection][index][1]; + if ( paperdoll_armor_texture[pBodyComplection][index][1] != pIcons_LOD->FindTextureByName("pending") ) + { + item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1]; + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation();//~0x000000F0 + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); + else if ( item->uAttributes & ITEM_IDENTIFIED ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); + + } + } + } + } + //----------------------------------------------(Cloak collar/воротник плаща)------------------------------------- + if ( player->GetItem(&PlayerEquipment::uCloak) ) + { + item = player->GetCloakItem(); + switch ( item->uItemID ) + { + case ITEM_RELIC_TWILIGHT: + index = 5; + break; + case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP: + index = 6; + break; + case ITEM_RARE_SUN_CLOAK: + index = 7; + break; + case ITEM_RARE_MOON_CLOAK: + index = 8; + break; + case ITEM_RARE_VAMPIRES_CAPE: + index = 9; + break; + default: + index = item->uItemID - 105; + } + if ( index >= 0 && index < 10 ) + { + item_X = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][index][1]; + signed int r = pIcons_LOD->FindTextureByName("item325v2a1"); + + if ( paperdoll_cloak_collar_texture[pBodyComplection][index] != pIcons_LOD->FindTextureByName("pending") ) + { + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation();//~0x000000F0 + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index]), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index])); + else + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index])); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index]), + player->pEquipment.uCloak); + } + } + } + //--------------------------------------------(Beards/Борода)------------------------------------------------------- + if ( player->uCurrentFace == 12 || player->uCurrentFace == 13 ) + { + if ( papredoll_dbrds[player->uCurrentFace] != pIcons_LOD->FindTextureByName("Pending") ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * player->uCurrentFace - 24], + pPaperdoll_BodyY + pPaperdoll_Beards[2 * player->uCurrentFace - 23], + pIcons_LOD->GetTexture(papredoll_dbrds[player->uCurrentFace])); + } + //--------------------------------------------(Helm/Шлем)------------------------------------------------------------ + if ( player->GetItem(&PlayerEquipment::uHelm) ) + { + item = player->GetHelmItem(); + switch ( item->uItemID ) + { + case ITEM_RELIC_TALEDONS_HELM: + index = 11; + break; + case ITEM_RELIC_SCHOLARS_CAP: + index = 12; + break; + case ITEM_RELIC_PHYNAXIAN_CROWN: + index = 13; + break; + case ITEM_ARTIFACT_MINDS_EYE: + index = 14; + break; + case ITEM_RARE_SHADOWS_MASK: + index = 15; + break; + default: + index = item->uItemID - 89; + } + if ( index >= 0 && index < 16 ) + { + item_X = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][index][0]; + item_Y = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][index][1]; + if ( IsDwarf != 1 || item->uItemID != 92 ) + v127 = paperdoll_helm_texture[player->GetSexByVoice()][index]; + else + v127 = papredoll_dbrds[11]; + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation(); + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v127), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); + else if ( item->uAttributes & ITEM_IDENTIFIED ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v127)); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v127), player->pEquipment.uHelm); + } + } + //------------------------------------------------(Hand3/Рука3)------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uMainHand) ) + { + item = player->GetMainHandItem(); + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; + if ( item->uItemID == 64 ) + v181 = "item64v1"; + else + v181 = item->GetIconName(); + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation(); + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE)), + pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); + else if ( item->uAttributes & ITEM_IDENTIFIED ) + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); + else + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); + + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE)), + player->pEquipment.uMainHand); + } + //--------------------------------------------------(Shield/Щит)--------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uShield) ) + { + item = player->GetOffHandItem(); + if ( item->GetPlayerSkillType() == PLAYER_SKILL_DAGGER + || item->GetPlayerSkillType() == PLAYER_SKILL_SWORD ) + { + //v151 = item->uItemID - 400; + item_X = 596; + two_handed_left_fist = true; + switch ( item->uItemID ) + { + case 400: + item_Y = 86; + break; + case 403: + item_Y = 28; + break; + case 415: + item_X = 595; + item_Y = 33; + break; + default: + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY; + break; + } + } + else + { + two_handed_left_fist = false; + item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX; + item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY; + } + v153 = pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE); + + if ( item->ItemEnchanted() ) + { + if ( item->AuraEffectRed() ) + container = "sptext01"; + else if ( item->AuraEffectBlue() ) + container = "sp28a"; + else if ( item->AuraEffectGreen() ) + container = "sp30a"; + else if ( item->AuraEffectPurple() ) + container = "sp91a"; + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) + { + _50C9A8_item_enchantment_timer = 0; + item->ResetEnchantAnimation(); + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v153), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), + GetTickCount() * 0.1, 0, 255); + } + else if ( item->uAttributes & ITEM_BROKEN ) + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v153)); + else if ( !(item->uAttributes & ITEM_IDENTIFIED) ) + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v153)); + else + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v153)); + + if ( two_handed_left_fist )//two-handed - left fist/двуручие - левая кисть + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhs[uPlayerID - 1])); + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v153), player->pEquipment.uShield); + } + } + //--------------------------------------------------------(RightHand/Правая кисть)-------------------------------------------------- + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_drhs[uPlayerID - 1])); + //---------------------------------------------(two-handed - hand/Двуручие - рука)-------------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uMainHand) ) + { + if ( player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED + || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR + && !player->GetItem(&PlayerEquipment::uShield) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); + } + //--------------------------------------------------------(two-handed - fist/двуручие - кисть)---------------------------------------------------- + if ( player->GetItem(&PlayerEquipment::uMainHand)) + { + item = player->GetMainHandItem(); + if ( item->GetItemEquipType() == EQUIP_TWO_HANDED + || item->GetPlayerSkillType() == PLAYER_SKILL_SPEAR + && !player->GetItem(&PlayerEquipment::uShield) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], + pIcons_LOD->GetTexture(papredoll_dlhus[uPlayerID - 1])); + } + if ( !bRingsShownInCharScreen )//рисование лупы + pRenderer->DrawTextureTransparent(603, 299, pIcons_LOD->GetTexture(uTextureID_MAGNIF_B)); + pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));//обрамление +} + +//----- (0041A2D1) -------------------------------------------------------- +void CharacterUI_InventoryTab_Draw(Player *player, bool a2) +{ + Texture *pTexture; // esi@6 + unsigned int v17; // edi@15 + unsigned int uCellX; // [sp+30h] [bp-8h]@5 + unsigned int uCellY; // [sp+34h] [bp-4h]@5 + + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground)); + if (a2) + pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE)); + for (uint i = 0; i < 126; ++i) + { + if ( player->pInventoryMatrix[i] <= 0 ) + continue; + if ( !player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID ) + continue; + uCellY = 32 * (i / 14) + 17; + uCellX = 32 * (i % 14) + 14; + uint item_texture_id = pIcons_LOD->LoadTexture(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].GetIconName(), TEXTURE_16BIT_PALETTE); + pTexture = pIcons_LOD->GetTexture(item_texture_id); + if (pTexture->uTextureWidth < 14) + pTexture->uTextureWidth = 14; + if ( (pTexture->uTextureWidth - 14) / 32 == 0 && pTexture->uTextureWidth < 32) + uCellX += (32 - pTexture->uTextureWidth) / 2; + //v13 = pTexture->uTextureWidth - 14; + //LOBYTE(v13) = v13 & 0xE0; + //v15 = v13 + 32; + if (pTexture->uTextureHeight < 14 ) + pTexture->uTextureHeight = 14; + v17 = uCellX + (( (int)((pTexture->uTextureWidth - 14) & 0xE0) + 32 - pTexture->uTextureWidth) / 2) + + pSRZBufferLineOffsets[uCellY + (( (int)((pTexture->uTextureHeight - 14) & 0xFFFFFFE0) - pTexture->uTextureHeight + 32) / 2)]; //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up + if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & ITEM_ENCHANT_ANIMATION) + { + Texture *loadedTextureptr = nullptr; + switch (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & ITEM_ENCHANT_ANIMATION) + { + case ITEM_AURA_EFFECT_RED: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_BLUE: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_GREEN: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_PURPLE: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE); break; + } + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if (_50C9A8_item_enchantment_timer <= 0) + { + _50C9A8_item_enchantment_timer = 0; + LOBYTE(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes) &= 0xF; + ptr_50C9A4_ItemToEnchant = nullptr; + } + + pRenderer->DrawAura(uCellX, uCellY, pTexture, loadedTextureptr, GetTickCount() * 0.1, 0, 255); + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]); + } + else + { + if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].IsIdentified() || pCurrentScreen != SCREEN_HOUSE) + { + if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].IsBroken()) + pRenderer->DrawTransparentRedShade(uCellX, uCellY, pTexture); + else + pRenderer->DrawTextureTransparent(uCellX, uCellY, pTexture); + } + else + pRenderer->DrawTransparentGreenShade(uCellX, uCellY, pTexture); + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]); + continue; + } + } +} + +static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id) +{ + Texture* item_texture = pIcons_LOD->LoadTexturePtr(item->GetIconName(), TEXTURE_16BIT_PALETTE); + + if (item->uAttributes & ITEM_ENCHANT_ANIMATION) // enchant animation + { + Texture *enchantment_texture = nullptr; + switch (item->uAttributes & ITEM_ENCHANT_ANIMATION) + { + case ITEM_AURA_EFFECT_RED: enchantment_texture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_BLUE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_GREEN: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_PURPLE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE); break; + } + + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if (_50C9A8_item_enchantment_timer <= 0) + { + _50C9A8_item_enchantment_timer = 0; + item->uAttributes &= 0xFFFFFF0F; + ptr_50C9A4_ItemToEnchant = nullptr; + } + pRenderer->DrawAura(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255); + } + else + { + if (item->IsBroken()) + pRenderer->DrawTransparentRedShade(x, y, item_texture); + else if (!item->IsIdentified()) + pRenderer->DrawTransparentGreenShade(x, y, item_texture); + else + pRenderer->DrawTextureTransparent(x, y, item_texture); + + pRenderer->ZBuffer_Fill_2(x, y, item_texture, id); + } +} + +//----- (0043E825) -------------------------------------------------------- +void CharacterUI_DrawPaperdollWithRingOverlay(Player *player) +{ + CharacterUI_DrawPaperdoll(player); + pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND)); + pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop)); + pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY, + pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)); + for (uint i = 0; i < 6; ++i) + { + if (!player->pEquipment.uRings[i]) + continue; + static int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248}; + static int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA}; + CharacterUI_DrawItem(pPaperdollRingsX[i], pPaperdollRingsY[i], &player->pInventoryItemList[player->pEquipment.uRings[i] - 1], + player->pEquipment.uRings[i]); + } + if (player->pEquipment.uAmulet) + CharacterUI_DrawItem(493, 91, player->GetAmuletItem(), player->pEquipment.uAmulet); + if (player->pEquipment.uGlove) + CharacterUI_DrawItem(586, 88, player->GetGloveItem(), player->pEquipment.uGlove); +} + +//----- (0043BCA7) -------------------------------------------------------- +void CharacterUI_LoadPaperdollTextures() +{ + int v3; // ebx@10 + Player *pPlayer; // edi@12 + signed int v32; // [sp+10h] [bp-28h]@75 + signed int v33; // [sp+10h] [bp-28h]@77 + int pItemTXTNum; // [sp+14h] [bp-24h]@75 + signed int v38; // [sp+14h] [bp-24h]@79 + char pContainer[128]; // [sp+24h] [bp-14h]@12 + + uTextureID_MAGNIF_B = pIcons_LOD->LoadTexture("MAGNIF-B", TEXTURE_16BIT_PALETTE); + //if ( !pParty->uAlignment || pParty->uAlignment == 1 || pParty->uAlignment == 2 ) + uTextureID_BACKDOLL = pIcons_LOD->LoadTexture("BACKDOLL", TEXTURE_16BIT_PALETTE); + uTextureID_right_panel_loop = uTextureID_right_panel; + uTextureID_BACKHAND = pIcons_LOD->LoadTexture("BACKHAND", TEXTURE_16BIT_PALETTE); + uTextureID_detaliz_close_button = uExitCancelTextureId; + for ( uint i = 0; i < 4; ++i ) + { + if ( pPlayers[i + 1]->HasUnderwaterSuitEquipped() ) + { + if ( pPlayers[i + 1]->GetRace() == CHARACTER_RACE_DWARF ) + v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 3; + else + v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 1; + wsprintfA(pContainer, "pc23v%dBod", v3); + papredoll_dbods[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Body texture + wsprintfA(pContainer, "pc23v%dlad", v3); + papredoll_dlads[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand + wsprintfA(pContainer, "pc23v%dlau", v3); + papredoll_dlaus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand2 + wsprintfA(pContainer, "pc23v%drh", v3); + papredoll_drhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Right Hand + wsprintfA(pContainer, "pc23v%dlh", v3); + papredoll_dlhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Fist + wsprintfA(pContainer, "pc23v%dlhu", v3); + papredoll_dlhus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2 + pPlayer = pPlayers[i + 1]; + if ( pPlayer->uCurrentFace == 12 || pPlayer->uCurrentFace == 13 ) + papredoll_dbrds[(char)pPlayer->uCurrentFace] = 0; + papredoll_flying_feet[pPlayer->uCurrentFace] = 0; + IsPlayerWearingWatersuit[i + 1] = 1; + } + else + { + papredoll_dbods[i] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlads[i] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlaus[i] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_drhs[i] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhs[i] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhus[i] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); + if ( pPlayers[i + 1]->uCurrentFace == 12 || pPlayers[i + 1]->uCurrentFace == 13 ) + { + wsprintfA(pContainer, "pc%02dbrd", pPlayers[i + 1]->uCurrentFace + 1); + papredoll_dbrds[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + wsprintfA(pContainer, "item281pc%02d", pPlayers[i + 1]->uCurrentFace + 1); + papredoll_flying_feet[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + IsPlayerWearingWatersuit[i + 1] = 0; + } + } + + uTextureID_ar_up_up = pIcons_LOD->LoadTexture("ar_up_up", TEXTURE_16BIT_PALETTE); + uTextureID_ar_up_dn = pIcons_LOD->LoadTexture("ar_up_dn", TEXTURE_16BIT_PALETTE); + uTextureID_ar_dn_up = pIcons_LOD->LoadTexture("ar_dn_up", TEXTURE_16BIT_PALETTE); + uTextureID_ar_dn_dn = pIcons_LOD->LoadTexture("ar_dn_dn", TEXTURE_16BIT_PALETTE); + papredoll_dbrds[9] = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE); + papredoll_dbrds[7] = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE); + papredoll_dbrds[5] = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); + papredoll_dbrds[3] = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); + papredoll_dbrds[1] = pIcons_LOD->LoadTexture("ib-cd5-d", TEXTURE_16BIT_PALETTE); + for ( uint i = 0; i < 54; ++i )// test equipment + { + party_has_equipment[i] = 0; + if ( pParty->pPickedItem.uItemID != i + 66 ) + { + for ( uint j = 0; j < 4; ++j) + { + if ( pParty->pPlayers[j].HasItem(i + 66, 0) ) + party_has_equipment[i] = 1; + } + } + } + memset(byte_5111F6_OwnedArtifacts.data(), 0, sizeof(byte_5111F6_OwnedArtifacts)); + for (uint i = 0; i < 4; ++i) + { + Player* player = &pParty->pPlayers[i]; + + if (player->HasItem(ITEM_ARTIFACT_GOVERNORS_ARMOR, 1)) byte_5111F6_OwnedArtifacts[0] = 1; + if (player->HasItem(ITEM_ARTIFACT_YORUBA, 1)) byte_5111F6_OwnedArtifacts[1] = 1; + if (player->HasItem(ITEM_RELIC_HARECS_LEATHER, 1)) byte_5111F6_OwnedArtifacts[2] = 1; + if (player->HasItem(ITEM_ARTIFACT_LEAGUE_BOOTS, 1)) byte_5111F6_OwnedArtifacts[3] = 1; + if (player->HasItem(ITEM_RELIC_TALEDONS_HELM, 1)) byte_5111F6_OwnedArtifacts[4] = 1; + if (player->HasItem(ITEM_RELIC_SCHOLARS_CAP, 1)) byte_5111F6_OwnedArtifacts[5] = 1; + if (player->HasItem(ITEM_RELIC_PHYNAXIAN_CROWN, 1)) byte_5111F6_OwnedArtifacts[6] = 1; + if (player->HasItem(ITEM_ARTIFACT_MINDS_EYE, 1)) byte_5111F6_OwnedArtifacts[7] = 1; + if (player->HasItem(ITEM_RARE_SHADOWS_MASK, 1)) byte_5111F6_OwnedArtifacts[8] = 1; + if (player->HasItem(ITEM_RILIC_TITANS_BELT, 1)) byte_5111F6_OwnedArtifacts[9] = 1; + if (player->HasItem(ITEM_ARTIFACT_HEROS_BELT, 1)) byte_5111F6_OwnedArtifacts[10] = 1; + if (player->HasItem(ITEM_RELIC_TWILIGHT, 1)) byte_5111F6_OwnedArtifacts[11] = 1; + if (player->HasItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, 1)) byte_5111F6_OwnedArtifacts[12] = 1; + if (player->HasItem(ITEM_RARE_SUN_CLOAK, 1)) byte_5111F6_OwnedArtifacts[13] = 1; + if (player->HasItem(ITEM_RARE_MOON_CLOAK, 1)) byte_5111F6_OwnedArtifacts[14] = 1; + if (player->HasItem(ITEM_RARE_VAMPIRES_CAPE, 1)) byte_5111F6_OwnedArtifacts[15] = 1; + if (player->HasItem(ITEM_ELVEN_CHAINMAIL, 1)) byte_5111F6_OwnedArtifacts[16] = 1; + } + + for (uint i = 0; i < 2; ++i) + { + for ( uint j = 0; j < 5; ++j )//Belt + { + GetItemTextureFilename(pContainer, j + 100, i + 1, 0); + paperdoll_belt_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + GetItemTextureFilename(pContainer, 535, i + 1, 0); + paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + for ( uint j = 0; j < 11; ++j )//Helm + { + GetItemTextureFilename(pContainer, j + 89, i + 1, 0); + paperdoll_helm_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + GetItemTextureFilename(pContainer, 521, i + 1, 0); + paperdoll_helm_texture[i][11] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 522, i + 1, 0); + paperdoll_helm_texture[i][12] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 523, i + 1, 0); + paperdoll_helm_texture[i][13] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 532, i + 1, 0); + paperdoll_helm_texture[i][14] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 544, i + 1, 0); + paperdoll_helm_texture[i][15] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + if ( IsDwarfPresentInParty(true) ) //the phynaxian helm uses a slightly different graphic for dwarves + papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE); + } + //v43 = 0; + for (uint i = 0; i < 4; ++i) + { + if ( ShouldLoadTexturesForRaceAndGender(i) ) + { + GetItemTextureFilename(pContainer, 524, i + 1, 0); + paperdoll_belt_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Titans belt + pItemTXTNum = 66; + for ( v32 = 0; v32 < 13; ++v32 )//simple armor + { + GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 0); + paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// armor + GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1); + paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 1 + GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2); + paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 2 + pItemTXTNum++; + } + GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts + paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 516, i + 1, 1); + paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 516, i + 1, 2); + paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 505, i + 1, 0); + paperdoll_armor_texture[i][v32 + 1][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 505, i + 1, 1); + paperdoll_armor_texture[i][v32 + 1][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 505, i + 1, 2); + paperdoll_armor_texture[i][v32 + 1][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 504, i + 1, 0); + paperdoll_armor_texture[i][v32 + 2][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 504, i + 1, 1); + paperdoll_armor_texture[i][v32 + 2][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 504, i + 1, 2); + paperdoll_armor_texture[i][v32 + 2][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 533, i + 1, 0); + paperdoll_armor_texture[i][v32 + 3][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 533, i + 1, 1); + paperdoll_armor_texture[i][v32 + 3][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 533, i + 1, 2); + paperdoll_armor_texture[i][v32 + 3][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + for ( v33 = 0; v33 < 5; ++v33 )//boots + { + GetItemTextureFilename(pContainer, v33 + 115, i + 1, 0); + paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + GetItemTextureFilename(pContainer, 512, i + 1, 0); + paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + for ( v38 = 0; v38 < 5; ++v38 )//Cloak + { + GetItemTextureFilename(pContainer, v38 + 105, i + 1, 0); + paperdoll_cloak_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, v38 + 105, i + 1, 1); + paperdoll_cloak_collar_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + GetItemTextureFilename(pContainer, 525, i + 1, 0); + paperdoll_cloak_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 530, i + 1, 0); + paperdoll_cloak_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 547, i + 1, 0); + paperdoll_cloak_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 548, i + 1, 0); + paperdoll_cloak_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 550, i + 1, 0); + paperdoll_cloak_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 525, i + 1, 1); + paperdoll_cloak_collar_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 530, i + 1, 1); + paperdoll_cloak_collar_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 547, i + 1, 1); + paperdoll_cloak_collar_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 548, i + 1, 1); + paperdoll_cloak_collar_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 550, i + 1, 1); + paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + //else + //{ + //v26 = v43; + //} + //v43 = v26 + 40; + } +} + +//----- (00419401) -------------------------------------------------------- +void CharacterUI_SkillsTab_CreateButtons() +{ + GUIButton *pButton; // eax@3 + unsigned int current_Y; // esi@8 + int buttons_count; // [sp+10h] [bp-14h]@1 + int first_rows; // [sp+14h] [bp-10h]@19 + int skill_id; // [sp+18h] [bp-Ch]@8 + Player *curr_player; // [sp+1Ch] [bp-8h]@8 + int i; + int uCurrFontHeght; + + buttons_count = 0; + if ( dword_507CC0_activ_ch ) + CharacterUI_ReleaseButtons(); + dword_507CC0_activ_ch = uActiveCharacter; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) + { + if ( pButton->msg == UIMSG_InventoryLeftClick ) + { + dword_50698C_uX = pButton->uX; + dword_506988_uY = pButton->uY; + dword_506984_uZ = pButton->uZ; + dword_506980_uW = pButton->uW; + pButton->uW = 0; + pButton->uZ = 0; + pButton->uY = 0; + pButton->uX = 0; + } + } + first_rows = 0; + int a5 = pGUIWindow_CurrentMenu->uNumControls; + curr_player = &pParty->pPlayers[uActiveCharacter-1]; + + uCurrFontHeght=pFontLucida->uFontHeight; + current_Y = 2 *uCurrFontHeght + 13; + for( i = 0; i < 9; ++i ) + { + skill_id = pWeaponSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F ) + { + current_Y += uCurrFontHeght - 3; + ++buttons_count; + ++first_rows; + pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } + if ( !first_rows ) + current_Y += uCurrFontHeght - 3; + current_Y += 2 * uCurrFontHeght - 6; + for ( i = 0; i < 9; ++i ) + { + skill_id = pMagicSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F && buttons_count < 15 ) + { + current_Y += uCurrFontHeght - 3; + ++buttons_count; + pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } + first_rows = 0; + current_Y = 2 * uCurrFontHeght + 13; + for ( i = 0; i < 5; ++i ) + { + skill_id = pArmorSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F ) + { + current_Y+= uCurrFontHeght - 3; + ++buttons_count; + ++first_rows; + pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } + if ( !first_rows ) + current_Y += uCurrFontHeght - 3; + current_Y += 2 * uCurrFontHeght - 6; + for ( i = 0; i < 12; ++i ) + { + skill_id = pMiscSkills[i]; + if ( curr_player->pActiveSkills[skill_id] & 0x3F ) + { + current_Y += uCurrFontHeght - 3; + ++buttons_count; + pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); + } + } + + if ( buttons_count ) + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(buttons_count, 1, 0, a5); +} + +//----- (00418511) -------------------------------------------------------- +void CharacterUI_StatsTab_Draw( Player *player ) +{ + int pY; // ST34_4@4 + const char *pText; // eax@9 + const char *text_format; // [sp+14h] [bp-Ch]@4 + + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE)); + sprintf(pTmpBuf.data(), "\f%05d", ui_character_header_text_color); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s" + strcat(pTmpBuf.data(), pTmpBuf2.data()); + sprintfex(pTmpBuf2.data(), "\f00000\r180%s: \f%05d%d\f00000\n\n\n", + pGlobalTXT_LocalizationStrings[207], // "Skill points" + player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, + player->uSkillPoints); + strcat(pTmpBuf.data(), pTmpBuf2.data()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf.data(), 0, 0, 0); + + //First column(Первая колонка) + pY = 53; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualMight(), player->GetBaseStrength()), + player->GetActualMight(), player->GetBaseStrength());//Might + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualIntelligence(), player->GetBaseIntelligence()), + player->GetActualIntelligence(), player->GetBaseIntelligence());//Intellect + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualWillpower(), player->GetBaseWillpower()), + player->GetActualWillpower(), player->GetBaseWillpower());// + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualEndurance(), player->GetBaseEndurance()), + player->GetActualEndurance(), player->GetBaseEndurance());// + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAccuracy(), player->GetBaseAccuracy()), + player->GetActualAccuracy(), player->GetBaseAccuracy()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualSpeed(), player->GetBaseSpeed()), + player->GetActualSpeed(), player->GetBaseSpeed()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualLuck(), player->GetBaseLuck()), + player->GetActualLuck(), player->GetBaseLuck()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = "%s\f%05u\r424%d\f00000 /\t185%d\n"; + if ( player->GetMaxHealth() >= 1000 ) + text_format = "%s\f%05u\r388%d\f00000 / %d\n"; + pY += 2 * LOBYTE(pFontArrus->uFontHeight) + 5; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[108], + UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()), + player->sHealth, player->GetMaxHealth()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = "%s\f%05u\r424%d\f00000 /\t185%d\n"; + if ( player->GetMaxMana() >= 1000 ) + text_format = "%s\f%05u\r388%d\f00000 / %d\n"; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[212], + UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()), + player->sMana, player->GetMaxMana()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC()), + player->GetActualAC(), player->GetBaseAC()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += 2 * LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], GetConditionDrawColor(player->GetMajorConditionIdx()), + aCharacterConditionNames[player->GetMajorConditionIdx()]);//Состояние + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 26, pY, 0, pTmpBuf.data(), 226, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) + - 1; + pText = pGlobalTXT_LocalizationStrings[153];//Нет + if (player->uQuickSpell) + pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; + sprintf(pTmpBuf.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], pText);//Б. применение + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 26, pY, 0, pTmpBuf.data(), 226, 0); + + //Second column (Вторая колонка) + pY = 50; + text_format = Stat_string_format_2_column_less_100; + if ( player->GetActualAge() > 99 ) + text_format = Stat_string_format_2_column_over_100; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[5], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAge(), player->GetBaseAge()), + player->GetActualAge(), player->GetBaseAge()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = Stat_string_format_2_column_less_100; + if ( player->GetBaseLevel() > 99 ) + text_format = Stat_string_format_2_column_over_100; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[131],//Уров. + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualLevel(), player->GetBaseLevel()), + player->GetActualLevel(), player->GetBaseLevel()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + pText = pGlobalTXT_LocalizationStrings[17]; // "Exp." + if (player->uExperience <= 9999999) + pText = pGlobalTXT_LocalizationStrings[83]; // "Experience" + sprintf(pTmpBuf.data(), "%s\r180\f%05d%lu\f00000\n\n", pText, player->GetExperienceDisplayColor(), LODWORD(player->uExperience)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += 2 * LOBYTE(pFontArrus->uFontHeight); + sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], player->GetActualAttack(false)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], player->GetMeleeDamageString()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], player->GetRangedAttack()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], player->GetRangedDamageString()); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = Stat_string_format_2_column_less_100; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE) > 99 ) + text_format = Stat_string_format_2_column_over_100; + pY += 2 * LOBYTE(pFontArrus->uFontHeight) - 4; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[87], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = Stat_string_format_2_column_less_100; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR) > 99 ) + text_format = Stat_string_format_2_column_over_100; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[6], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = Stat_string_format_2_column_less_100; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER) > 99 ) + text_format = Stat_string_format_2_column_over_100; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[240], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = Stat_string_format_2_column_less_100; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH) > 99 ) + text_format = Stat_string_format_2_column_over_100; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[70], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH)); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = Stat_string_format_2_column_less_100; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) > 99 ) + text_format = Stat_string_format_2_column_over_100; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[142], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND)); + if ( player->classType == PLAYER_CLASS_LICH && player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) == 200 ) + sprintf(pTmpBuf.data(), Stat_string_format_2_column_text, pGlobalTXT_LocalizationStrings[142], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), 200), pGlobalTXT_LocalizationStrings[625]); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); + + text_format = Stat_string_format_2_column_less_100; + if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 ) + text_format = Stat_string_format_2_column_over_100; + pY += LOBYTE(pFontArrus->uFontHeight) - 2; + int it = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); + sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[29], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY)), + player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY)); + if ( player->classType == PLAYER_CLASS_LICH && player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) == 200 ) + sprintf(pTmpBuf.data(), Stat_string_format_2_column_text, pGlobalTXT_LocalizationStrings[29], + UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), 200), pGlobalTXT_LocalizationStrings[625]); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); +} + +bool awardSort (int i, int j) +{ + if (pAwards[i].uPriority == 0) //none + return false; + else if (pAwards[j].uPriority == 0) + return true; + else if(pAwards[i].uPriority == 1) //fines,arena stuff,etc + return false; + else if(pAwards[j].uPriority == 1) + return true; + else if(pAwards[i].uPriority == 5) //joined guilds + return false; + else if(pAwards[j].uPriority == 5) + return true; + else + return (pAwards[i].uPriority < pAwards[j].uPriority); +} + +//----- (00419100) -------------------------------------------------------- +void FillAwardsData() +{ + Player* pPlayer = pPlayers[uActiveCharacter]; + + memset(achieved_awards.data(), 0, 4000); + num_achieved_awards = 0; + + memset(pTmpBuf2.data(), 0, 0x7D0u); + BtnDown_flag = 0; + BtnUp_flag = 0; + books_page_number = 0; + books_primary_item_per_page = 0; + for ( int i = 1; i < 105; ++i ) + { + if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText ) + achieved_awards[num_achieved_awards++] = (AwardType)i; + } + full_num_items_in_book = num_achieved_awards; + num_achieved_awards = 0; + + //sort awards index + + if (full_num_items_in_book>0) + { + for (int i = 0; i< full_num_items_in_book; ++i) + achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16);//случайные значения от 0 до 15 + for (int i = 1; i< full_num_items_in_book; ++i) + { + for (int j = i; j< full_num_items_in_book; ++j) + { + AwardType tmp; + if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority) + { + tmp= achieved_awards[j]; + achieved_awards[j] = achieved_awards[i]; + achieved_awards[i] = tmp; + } + } + } + } + + // if (full_num_items_in_book > 0) + /* { + std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort); + }*/ +} + +//----- (0043EF2B) -------------------------------------------------------- +void WetsuitOn( unsigned int uPlayerID ) +{ + CHARACTER_RACE player_race; // edi@2 + signed int player_sex; // eax@2 + int texture_num; // ecx@5 + char pContainer[20]; // [sp+4h] [bp-1Ch]@7 + + if ( uPlayerID> 0 ) + { + player_race = pPlayers[uPlayerID]->GetRace(); + player_sex = pPlayers[uPlayerID]->GetSexByVoice(); + if ( player_race == CHARACTER_RACE_DWARF ) + texture_num = (player_sex != 0) + 3; + else + texture_num = (player_sex != 0) + 1; + wsprintfA(pContainer, "pc23v%dBod", texture_num); + papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlad", texture_num); + papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlau", texture_num); + papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%drh", texture_num); + papredoll_drhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlh", texture_num); + papredoll_dlhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + wsprintfA(pContainer, "pc23v%dlhu", texture_num); + papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + + if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) + papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = 0; + papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = 0; + IsPlayerWearingWatersuit[uPlayerID] = 1; + } +} + +//----- (0043F0BD) -------------------------------------------------------- +void WetsuitOff( unsigned int uPlayerID ) +{ + char pContainer[20]; // [sp+0h] [bp-18h]@4 + + if (uPlayerID > 0 ) + { + papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_drhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(drh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(dlh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); + + if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) + { + wsprintfA(pContainer, "pc%02dbrd", pPlayers[uPlayerID]->uCurrentFace + 1); + papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + wsprintfA(pContainer, "item281pc%02d", pPlayers[uPlayerID]->uCurrentFace + 1); + papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + IsPlayerWearingWatersuit[uPlayerID] = 0; + } +} + +//----- (00468F8A) -------------------------------------------------------- +void OnPaperdollLeftClick() +{ + int v1; // ecx@1 + unsigned int v2; // edi@1 + unsigned int v3; // edx@4 + unsigned int pSkillType; // esi@5 + unsigned __int16 v5; // ax@7 + int v7; // esi@27 + int v8; // eax@29 + int v17; // eax@44 + //unsigned int v18; // ecx@55 + //unsigned int v19; // eax@55 +// unsigned int v22; // eax@61 + int v23; // eax@62 + int v26; // eax@69 + int v34; // esi@90 + ItemGen _this; // [sp+Ch] [bp-40h]@1 +// unsigned int v48; // [sp+30h] [bp-1Ch]@88 + unsigned int v50; // [sp+38h] [bp-14h]@50 + int v51; // [sp+3Ch] [bp-10h]@1 + int v52; // [sp+40h] [bp-Ch]@5 + ITEM_EQUIP_TYPE pEquipType; + CastSpellInfo *pSpellInfo; + + v51 = 0; + _this.Reset(); + v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; + v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; + if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_TWO_HANDED ) + v51 = v1; + v3 = pParty->pPickedItem.uItemID; + if ( pParty->pPickedItem.uItemID ) + { + pEquipType = pParty->pPickedItem.GetItemEquipType(); + pSkillType = pParty->pPickedItem.GetPlayerSkillType(); + if ( pSkillType == 4 ) + { + if ( v2 ) + { + LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); + if ( (signed int)SkillToMastery(v5) < 3 ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); + return; + } + v3 = pParty->pPickedItem.uItemID; + } + } + else + { + if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) + && v1 + && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetPlayerSkillType() == 4 ) + { + LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); + if ( (signed int)SkillToMastery(v5) < 3 ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); + return; + } + } + } + if ( !pPlayers[uActiveCharacter]->CanEquip_RaceAndAlignmentCheck(v3) ) + { + + pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); + return; + } + if ( pParty->pPickedItem.uItemID == ITEM_WETSUIT ) + { + pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)3); + WetsuitOn(uActiveCharacter); + return; + } + switch ( pEquipType ) + { + case EQUIP_BOW: + case EQUIP_ARMOUR: + case EQUIP_HELMET: + case EQUIP_BELT: + case EQUIP_CLOAK: + case EQUIP_GAUNTLETS: + case EQUIP_BOOTS: + case EQUIP_AMULET: + if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )//нет навыка + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); + return; + } + if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() && (pEquipType != EQUIP_ARMOUR || bUnderwater) ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + pPlayers[uActiveCharacter]->EquipBody(pEquipType); + if ( pParty->pPickedItem.uItemID == ITEM_WETSUIT ) + WetsuitOff(uActiveCharacter); + return; +//------------------------dress rings(одевание колец)---------------------------------- + case EQUIP_RING: + if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + //слоты для колец + v7 = 0; + for ( v52 = 10; (signed int)v52 < 16; ++v52 ) + { + if ( !pPlayers[uActiveCharacter]->pEquipment.uRings[v7] ) + { + v8 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); + if ( v8 >= 0 ) + { + pParty->pPickedItem.uBodyAnchor = v52 + 1; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v8])); + pPlayers[uActiveCharacter]->pEquipment.uRings[v7] = v8 + 1; + pMouse->RemoveHoldingItem(); + break; + } + } + v7++; + } + if ( v52 == 16 )//замещение последнего кольца + { + v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[5] - 1; + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + pPlayers[uActiveCharacter]->pInventoryItemList[v52].uBodyAnchor = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v52]); + _this.uBodyAnchor = 16; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, 0x24u); + pPlayers[uActiveCharacter]->pEquipment.uRings[5] = v52 + 1; + } + return; +//------------------dress shield(одеть щит)------------------------------------------------------ + case EQUIP_SHIELD://Щит + if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() )//в акваланге + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )//нет навыка + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); + return; + } + if ( v2 )//смена щита щитом + { + --v2; + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); + _this.uBodyAnchor = 1; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u); + pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; + if ( v51 == EQUIP_SINGLE_HANDED ) + return; + } + else + { + v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); + if ( v52 < 0 ) + return; + if ( !v51 )// обычная установка щита на пустую руку + { + pParty->pPickedItem.uBodyAnchor = 1; + v17 = v52 + 1; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); + pPlayers[uActiveCharacter]->pEquipment.uShield = v17; + pMouse->RemoveHoldingItem(); + return; + } + v1--;//ставим щит когда держит двуручный меч + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); + _this.uBodyAnchor = 1; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); + pPlayers[uActiveCharacter]->pEquipment.uShield = v52 + 1; + } + pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0; + return; +//-------------------------taken in hand(взять в руку)------------------------------------------- + case EQUIP_SINGLE_HANDED: + case EQUIP_WAND: + if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() + && pParty->pPickedItem.uItemID != 64 + && pParty->pPickedItem.uItemID != 65 ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); + return; + } + v50 = 0; + if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_DAGGER] & 0xFFC0) + || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_SWORD]) >= 3 ) + { + //v18 = pMouse->uMouseClickX; + //v19 = pMouse->uMouseClickY; + if ( (signed int)pMouse->uMouseClickX >= 560 ) + { + if ( !v51 ) + { + if ( v2 ) + { + --v2; + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); + _this.uBodyAnchor = 1; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u); + pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; + if ( pEquipType != EQUIP_WAND ) + return; + v50 = _this.uItemID; + if ( _this.uItemID ) + { + __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v50].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); + } + break; + } + v23 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); + if ( v23 < 0 ) + return; + pParty->pPickedItem.uBodyAnchor = 1; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v23])); + pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; + pMouse->RemoveHoldingItem(); + if ( pEquipType != EQUIP_WAND ) + return; + v50 = pPlayers[uActiveCharacter]->pInventoryItemList[v23].uItemID; + if ( v50 ) + { + __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v50].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); + } + break; + } + } + } + if ( !v1 ) + { + v26 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); + if ( v26 < 0 ) + return; + pParty->pPickedItem.uBodyAnchor = 2; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v26])); + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; + pMouse->RemoveHoldingItem(); + if ( pEquipType != EQUIP_WAND ) + return; + if ( pPlayers[uActiveCharacter]->pInventoryItemList[v26].uItemID ) + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v26].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); + break; + } + --v1; + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); + _this.uBodyAnchor = 2; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24); + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v1 + 1; + if ( pEquipType == EQUIP_WAND ) + v50 = _this.uItemID; + if ( v51 ) + pPlayers[uActiveCharacter]->pEquipment.uShield = 0; + if ( v50 )//взять жезл + { + __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[v50 - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); + } + break; +//---------------------------take two hands(взять двумя руками)--------------------------------- + case EQUIP_TWO_HANDED: + if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); + return; + } + if ( v1 )//взять двуручный меч когда нет щита(замещение оружия) + { + if ( v2 ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + --v1; + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); + _this.uBodyAnchor = 2; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24u); + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v1 + 1; + } + else + { + v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); + if ( v52 >= 0 ) + { + if ( v2 )//взять двуручный меч когда есть щит(замещение щитом) + { + v2--; + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); + _this.uBodyAnchor = 2; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); + pPlayers[uActiveCharacter]->pEquipment.uShield = 0; + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v52 + 1; + } + else + { + pParty->pPickedItem.uBodyAnchor = 2; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v52 + 1; + pMouse->RemoveHoldingItem(); + } + } + } + return; +//------------------------------------------------------------------------------- + default: + pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(uActiveCharacter, 0);//выпить напиток и др. + return; + } + return; + } + + v34 = pRenderer->pActiveZBuffer[pMouse->uMouseClickX + pSRZBufferLineOffsets[pMouse->uMouseClickY]] & 0xFFFF; + if ( v34 ) + { + //v36 = v34 - 1; + //v38 = &pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1]; + pEquipType = pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].GetItemEquipType(); + if ( pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].uItemID == ITEM_WETSUIT ) + { + if ( bUnderwater ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + WetsuitOff(uActiveCharacter); + } + 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; + pSpellInfo->uFlags &= 0x7F; + pSpellInfo->uPlayerID_2 = uActiveCharacter - 1; + pSpellInfo->spell_target_pid = v34 - 1; + pSpellInfo->field_6 = pEquipType; + + ptr_50C9A4_ItemToEnchant = &pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1]; + _50C9A0_IsEnchantingInProgress = 0; + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + pMouse->SetCursorBitmap("MICON1"); + _50C9D4_AfterEnchClickEventSecondParam = 0; + _50C9D0_AfterEnchClickEventId = 113; + _50C9D8_AfterEnchClickEventTimeout = 256; + } + else + { + if ( !ptr_50C9A4_ItemToEnchant )//снять вещь + { + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1]); + pPlayers[uActiveCharacter]->pEquipment.pIndices[pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].uBodyAnchor - 1] = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].Reset(); + } + } + } + else//снять лук + { + if ( pPlayers[uActiveCharacter]->pEquipment.uBow ) + { + _this = pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.uBow - 1]; + pParty->SetHoldingItem(&_this); + _this.Reset(); + pPlayers[uActiveCharacter]->pEquipment.uBow = 0; + } + } +} + +//----- (004196A0) -------------------------------------------------------- +void CharacterUI_ReleaseButtons() +{ + GUIButton *i; // esi@2 + GUIButton *j; // esi@7 + + if ( dword_507CC0_activ_ch ) + { + dword_507CC0_activ_ch = 0; + for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = j ) + { + j = i->pNext; + if ( i->field_1C & 0x8000 ) + { + i->Release(); + free(i); + } + } + for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) + { + if ( j->msg == UIMSG_InventoryLeftClick) + { + j->uX = dword_50698C_uX; + j->uY = dword_506988_uY; + j->uZ = dword_506984_uZ; + j->uW = dword_506980_uW; + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); + } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UICharacter.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,4 @@ +#pragma once +void CharacterUI_LoadPaperdollTextures(); +void WetsuitOn(unsigned int uPlayerID); // idb +void WetsuitOff(unsigned int uPlayerID); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIGame.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,5 @@ +#pragma once +void GameUI_WritePointedObjectStatusString(); +void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb + +__int16 __fastcall sub_441A4E(int a1);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIGuilds.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,273 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "..\../Engine/Objects/Items.h" +#include "..\../GUIWindow.h" +#include "..\../Engine/mm7_data.h" +#include "..\../Engine/texts.h" +#include "UIHouses.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Graphics/Render.h" +#include "..\../Engine/Party.h" +#include "..\../Engine/Graphics/Texture.h" +#include "..\../Mouse.h" +#include "..\../Engine/Events2D.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/LOD.h" + +//----- (004B5D7C) -------------------------------------------------------- +void GuildDialog() +{ + signed int base_teach_price; // ebx@1 + int v6; // esi@13 + signed int v7; // esi@17 + int v8; // esi@22 +// const char *statusbar_string; // ecx@26 + int v13; // ecx@30 + ItemGen *v15; // ST18_4@31 + int v17; // eax@31 + char *v18; // edx@31 + int v26; // ecx@47 + GUIButton *pButton; // eax@49 + int pTextHeight; // eax@55 + unsigned __int16 pTextColor; // ax@55 + POINT cursor; // [sp+26Ch] [bp-80h]@30 + GUIWindow working_window; // [sp+274h] [bp-78h]@1 + int v58; // [sp+2D4h] [bp-18h]@1 + bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 + int v61; // [sp+2E0h] [bp-Ch]@35 + unsigned int v62; // [sp+2E4h] [bp-8h]@13 + int pPrice; // [sp+2E8h] [bp-4h]@1 + int all_text_height; + int pX; + + memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); + working_window.uFrameX = 483; + working_window.uFrameWidth = 148; + working_window.uFrameZ = 334; + base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0); + pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < base_teach_price / 3 ) + pPrice = base_teach_price / 3; + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) + { + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, + guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C - 139]) ) + { //you must me member + pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[121].pText, 3); + pDialogueWindow->pNumPresenceButton = 0; + return; + } + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + return; + } + v61 = 0; + pSkillFlag = false; + all_text_height = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( pDialogueWindow->GetControl(i)->msg_param == 18 ) + { + all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" + v61++; + } + else + { + if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &working_window, 0, 0); + v61++; + pSkillFlag = true; + } + } + } + if ( !v61 ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + return; + } + if ( pSkillFlag ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu" + working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + } + v58 = (149 - all_text_height) / v61; + if ( v58 > 32 ) + v58 = 32; + v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( pButton->msg_param == 18 ) + { + pButton->uY = v58 + v26; + pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); + pButton->uHeight = pTextHeight; + v26 = pButton->uY + pTextHeight - 1; + pButton->uW = v26; + pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells" + } + else + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uY = v58 + v26; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0); + pButton->uHeight = pTextHeight; + v26 = pButton->uY + pTextHeight - 1; + pButton->uW = v26; + pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); + } + else + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + } + } + return; + } + if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v6 = 0; + v62 = 0; + for ( pX = 32; pX < 452; pX += 70 )//расположение в верхнем ряду + { + if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID ) + { + pRenderer->DrawTextureTransparent(pX, 90, ItemsInShopTexture[v6]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); + } + v62 += 280; + ++v6; + } + v62 = 1680; + v7 = 6; + for ( pX = 32; pX < 452; pX += 70 )//расположение в нижнем ряду + { + if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) + { + pRenderer->DrawTextureTransparent(pX, 250, ItemsInShopTexture[v7]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); + } + v62 += 280; + ++v7; + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + v8 = 0; + for ( uint i = 0; i < 12; ++i ) + { + if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID > 0 ) + ++v8; + } + GetAsyncKeyState(VK_CONTROL); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);//"Select the Item to Buy" + if ( !v8 ) + { + working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] - pParty->uTimePlayed);//"Приходите через 14 дней" + return; + } + pMouse->GetCursorPos(&cursor); + v13 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; + if ( v13 ) + { + v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C)); + v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); + v18 = BuildDialogueString(pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), v18, 3); + return; + } + } + return; + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pSkillNames[dialog_menu_id-36]); //"You already know the %s skill" + ShowStatusBarString(pTmpBuf.data(), 2); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + } + else + { + if ( pParty->uNumGold < pPrice ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + } + else + { + Party::TakeGold(pPrice); + pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; + } + } + } + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; +} +//----- (004BC8D5) -------------------------------------------------------- +void SpellBookGenerator()//for GuildDialogs +{ + int pItemNum; // esi@1 + int v4; // esi@7 + + for( int i = 0; i < 12; ++i ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; + else + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 ) + v4 = rand() % 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 ) + v4 = rand() % 3 + 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 ) + v4 = rand() % 2 + 7; + if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400; + } + } + if ( pItemNum == 487 ) + { + if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) + pItemNum = 486; + } + ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; + item_spellbook->Reset(); + pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; + pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].IsIdentified(); + ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE); + } + return; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIGuilds.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,2 @@ +#pragma once +void SpellBookGenerator(); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIHouses.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,3414 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "UIGuilds.h" +#include "UIPartyCreation.h" +#include "UIShops.h" +#include "..\../GUIButton.h" +#include "..\../Engine/SaveLoad.h" +#include "..\../Engine/Graphics/Texture.h" +#include "..\../Engine/mm7_data.h" +#include "..\../Engine/ErrorHandling.h" +#include "UIHouses.h" +#include "..\../Engine/Party.h" +#include "..\../Engine/texts.h" +#include "..\../Engine/Events.h" +#include "..\../Arcomage/Arcomage.h" +#include "..\../Engine/LOD.h" +#include "..\../Mouse.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Graphics/Overlays.h" +#include "..\../Engine/Graphics/Outdoor.h" +#include "..\../AudioPlayer.h" +#include "..\../MediaPlayer.h" +#include "..\../Engine/Objects/Monsters.h" +#include "..\../Engine/Graphics/Viewport.h" +#include "..\../Keyboard.h" +#include "..\../Engine/MapInfo.h" +#include "..\../Engine/Log.h" +#include "..\../Engine/Game.h" +#include "..\../Engine/Spells/CastSpellInfo.h" + +#include "../../Engine/Graphics/Level/Decoration.h" + +#include "..\../Engine/stru159.h" +int uHouse_ExitPic; // weak + +int dword_591080; // weak + +BuildingType in_current_building_type; // 00F8B198 +HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C + +#pragma pack(push, 1) +struct stru365_travel_info +{ + unsigned char uMapInfoID; + unsigned char pSchedule[7]; + unsigned int uTravelTime; + int arrival_x; + int arrival_y; + int arrival_z; + int arrival_rot_y; + unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0 +}; +#pragma pack(pop) +stru365_travel_info transport_schedule[35] = // 004F09B0 +{// location name days x y z + {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 2, -18048, 4636, 833, 1536, 0},//for stable + {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, + {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 2, 4730, -10580, 320, 1024, 0}, + {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, + {MAP_DEYJA, {1, 0, 0, 1, 0, 0, 0}, 3, 7227, -16007, 2625, 640, 0}, + {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 1, 0}, 3, 8923, 17191, 1, 512, 0}, + {MAP_AVLEE, {1, 0, 1, 0, 1, 0, 0}, 3, 17059, 12331, 512, 1152, 0}, + {MAP_DEYJA, {0, 1, 0, 0, 1, 0, 1}, 2, 7227, -16007, 2625, 640, 0}, + {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, + {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 3, -18048, 4636, 833, 1536, 0}, + {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, + {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 1}, 3, -18048, 4636, 833, 1536, 0}, + {MAP_HARMONDALE, {0, 1, 0, 0, 0, 1, 0}, 5, -5692, 11137, 1, 1024, 0}, + {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -18048, 4636, 833, 1536, 0}, + {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 3, -2527, -6773, 1153, 896, 0}, + {MAP_DEYJA, {0, 0, 1, 0, 0, 0, 1}, 5, 7227, -16007, 2625, 640, 0}, + {MAP_TATALIA, {0, 1, 0, 1, 0, 1, 0}, 2, -2183, -6941, 97, 0, 0}, + {MAP_AVLEE, {1, 0, 0, 0, 1, 0, 0}, 4, 7913, 9476, 193, 0, 0}, + {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 7, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, + {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, + {MAP_AVLEE, {0, 1, 0, 1, 0, 1, 0}, 3, 7913, 9476, 193, 0, 0}, + {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, + {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 4, -2183, -6941, 97, 0, 0}, + {MAP_PIERPONT, {0, 0, 0, 0, 0, 1, 0}, 6, -709, -14087, 193, 1024, 0},//for boat + {MAP_STEADWICK, {0, 0, 0, 0, 0, 0, 1}, 6, -10471, 13497, 193, 1536, 0}, + {MAP_EVENMORN_ISLE, {0, 1, 0, 1, 0, 0, 0}, 1, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, + {MAP_BRAKADA_DESERT, {0, 1, 0, 1, 0, 0, 0}, 1, 19171, -19722, 193, 1024, 0}, + {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -10471, 13497, 193, 1536, 0}, + {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 4, 19171, -19722, 193, 1024, 0}, + {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 5, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, + {MAP_AVLEE, {0, 0, 0, 0, 1, 0, 0}, 5, 7913, 9476, 193, 0, 0}, + {MAP_STEADWICK, {0, 1, 0, 0, 0, 1, 0}, 4, -10471, 13497, 193, 1536, 0}, + {MAP_PIERPONT, {1, 0, 1, 0, 1, 0, 0}, 3, -709, -14087, 193, 1024, 0}, + {MAP_TATALIA, {0, 0, 0, 1, 0, 0, 0}, 5, -2183, -6941, 97, 0, 0}, + {MAP_ARENA, {0, 0, 0, 0, 0, 0, 1}, 4, 3844, 2906, 193, 512, 0} +}; + +unsigned char transport_routes[20][4] = +{ + { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE + { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK + { 6, 7, 8, 8}, // HOUSE_STABLES_TULAREAN_FOREST + { 9, 10, 10, 10}, // HOUSE_STABLES_DEYJA + { 11, 11, 12, 12}, // HOUSE_STABLES_BRACADA_DESERT + { 13, 13, 13, 13}, // HOUSE_STABLES_TATALIA + { 14, 14, 15, 15}, // HOUSE_STABLES_AVLEE + {255, 255, 255, 255}, // HOUSE_STABLES_61 + {255, 255, 255, 255}, // HOUSE_STABLES_62 + {255, 255, 255, 255}, // HOUSE_BOATS_EMERALD_ISLE + { 16, 17, 18, 19}, // HOUSE_BOATS_ERATHIA + { 18, 20, 21, 21}, // HOUSE_BOATS_TULAREAN_FOREST + { 22, 23, 24, 25}, // HOUSE_BOATS_BRACADA_DESERT + { 22, 22, 23, 23}, // HOUSE_BOATS_EVENMORN_ISLAND + {255, 255, 255, 255}, // HOUSE_BOATS_68 + { 27, 28, 29, 30}, // HOUSE_BOATS_TATALIA + { 31, 32, 33, 33}, // HOUSE_BOATS_AVLEE + { 24, 24, 24, 24}, // HOUSE_BOATS_71 + {255, 255, 255, 255}, // HOUSE_BOATS_72 + {255, 255, 255, 255} // HOUSE_BOATS_73 +}; + +std::array<const stru159, 196> pAnimatedRooms = //0x4E5F70 +{{ + {"", 0x4, 0x1F4, 0, 0, 0}, + {"Human Armor01", 0x20, 0x2C0, 2, 58, 0}, + {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 }, + {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 }, + {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 }, + {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 }, + {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 }, + {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 }, + {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 }, + {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 }, + {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 }, + {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 }, + {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 }, + {"Human Bank01", 0x6, 0x384, 22, 52, 0 }, + {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 }, + {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 }, + {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 }, + {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 }, + {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 }, + {"Boat01", 0xF, 0x4C, 28, 53, 3 }, + {"Boat01d", 0xF, 0x4C, 28, 53, 3 }, + {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 }, + {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 }, + {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 }, + {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 }, + {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 }, + {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 }, + {"Human Stables01", 0x21, 0x31, 27, 48, 3 }, + {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 }, + {"", 0x21, 0x2F0, 27, 91, 3 }, + {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 }, + {"Warlock Stables", 0x21, 0x181, 27, 77, 3 }, + {"Elf Stables", 0x21, 0x195, 27, 77, 3 }, + {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 }, + {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 }, + {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 }, + {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 }, + {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 }, + {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 }, + {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 }, + {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 }, + {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 }, + {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 }, + {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 }, + {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 }, + {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 }, + {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 }, + {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 }, + {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 }, + {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 }, + {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 }, + {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 }, + {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 }, + {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 }, + {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 }, + {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 }, + {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 }, + {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 }, + {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 }, + {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 }, + {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 }, + {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 }, + {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 }, + {"Air Guild", 0x1D, 0xA4, 6, 1, 3 }, + {"Body Guild", 0x19, 0x3BF, 11, 2, 0 }, + {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 }, + {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 }, + {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 }, + {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 }, + {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 }, + {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 }, + {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 }, + {"Lord And Judge Out01", 1, 0, 29, 39, 0 }, + {"Human Poor House 1", 8, 0, 29, 0, 0 }, + {"Human Poor House 2", 8, 0, 29, 0, 0 }, + {"Human Poor House 3", 8, 0, 29, 0, 0 }, + {"Human Medium House 1", 8, 0, 29, 0, 0 }, + {"Human Medium House 2", 8, 0, 29, 0, 0 }, + {"Human Medium House 3", 8, 0, 29, 0, 0 }, + {"Human Rich House 1", 8, 0, 29, 0, 0 }, + {"Human Rich House 2", 8, 0, 29, 0, 0 }, + {"Human Rich House 3", 8, 0, 29, 0, 0 }, + {"Elven Poor House 1", 8, 0, 29, 0, 0 }, + {"Elven Poor House 2", 8, 0, 29, 0, 0 }, + {"Elven Poor House 3", 8, 0, 29, 0, 0 }, + {"Elven Medium House 1", 8, 0, 29, 0, 0 }, + {"Elven Medium House 2", 8, 0, 29, 0, 0 }, + {"Elven Medium House 3", 8, 0, 29, 0, 0 }, + {"Elven Rich House 1", 8, 0, 29, 0, 0 }, + {"Elven Rich House 2", 8, 0, 29, 0, 0 }, + {"Elven Rich House 3", 8, 0, 29, 0, 0 }, + {"Dwarven Poor House 1", 8, 0, 29, 0, 0 }, + {"Dwarven Poor House 2", 8, 0, 29, 0, 0 }, + {"Dwarven Poor House 3", 8, 0, 29, 0, 0 }, + {"Dwarven Medium House 1", 8, 0, 29, 0, 0 }, + {"Dwarven Medium house 2", 8, 0, 29, 0, 0 }, + {"Dwarven Medium House 3", 8, 0, 29, 0, 0 }, + {"Dwarven Rich House 1", 8, 0, 29, 0, 0 }, + {"Dwarven Rich House 2", 8, 0, 29, 0, 0 }, + {"Dwarven Rich House 3", 8, 0, 29, 0, 0 }, + {"Wizard Poor House 1", 8, 0, 29, 0, 0 }, + {"Wizard Poor House 2", 8, 0, 29, 0, 0 }, + {"Wizard Poor House 3", 8, 0, 29, 0, 0 }, + {"Wizard Medium House 1", 8, 0, 29, 0, 0 }, + {"Wizard Medium House 2", 8, 0, 29, 0, 0 }, + {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 }, + {"Wizard Rich House 1", 8, 0, 29, 0, 0 }, + {"Wizard Rich House 2", 8, 0, 29, 0, 0 }, + {"Wizard Rich House 3", 8, 0, 29, 0, 0 }, + {"Necromancer Poor House 1", 8, 0, 29, 0, 0 }, + {"Necromancer Poor House 2", 8, 0, 29, 0, 0 }, + {"Necromancer Poor House 3", 8, 0, 29, 0, 0 }, + {"Necromancer Medium House 1", 8, 0, 29, 0, 0 }, + {"Necromancer Medium House 2", 8, 0, 29, 0, 0 }, + {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 }, + {"Necromancer Rich House 1", 8, 0, 29, 0, 0 }, + {"Necromancer Rich House 2", 8, 0, 29, 0, 0 }, + {"Necromancer Rich House 3", 8, 0, 29, 0, 0 }, + {"Warlock Poor House 1", 8, 0, 29, 0, 0 }, + {"Warlock Poor House 2", 8, 0, 29, 0, 0 }, + {"Warlock Poor House 3", 8, 0, 29, 0, 0 }, + {"Warlock Medium House 1", 8, 0, 29, 0, 0 }, + {"Warlock Medium House 2", 8, 0, 29, 0, 0 }, + {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 }, + {"Warlock Rich House 1", 8, 0, 29, 0, 0 }, + {"Warlock Rich House 2", 8, 0, 29, 0, 0 }, + {"Warlock Rich House 3", 8, 0, 29, 0, 0 }, + {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 }, + {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 }, + {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 }, + {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 }, + {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 }, + {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 }, + {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 }, + {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 }, + {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 }, + {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 }, + {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 }, + {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 }, + {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 }, + {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 }, + {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 }, + {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 }, + {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 }, + {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 }, + {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 }, + {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 }, + {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 }, + {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 }, + {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 }, + {"Out10 The Maze", 0x24, 0, 25, 0, 0 }, + {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"Out11 Stone City", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 }, + {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 }, + {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 }, + {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 }, + {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 }, + {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 }, + {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 }, + {"Out15 The Linclon", 0x24, 0, 25, 0, 0 }, + {"Jail", 0x24, 0, 31, 0, 0 }, + {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 }, + {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 }, + {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 }, + {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 }, + {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 }, + {"Master Thief", 0x24, 0, 29, 0, 0 }, + {"Dwarven King", 0x24, 0, 20, 0, 0 }, + {"Arms Master", 0x24, 0, 29, 0, 0 }, + {"Warlock", 0x24, 0, 29, 0, 0 }, + {"Lord Markam", 0x24, 0, 20, 0, 0 }, + {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 }, + {"Arbiter Good Town", 0x24, 0, 29, 0, 0 }, + {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 }, + {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"Boat01", 0xF, 0, 29, 53, 3 }, + {"", 0x24, 0, 28, 0, 0 }, + {"", 0x24, 0, 28, 0, 0 }, + {"", 0x24, 0, 28, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 }, + {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, + {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, + {"Player Castle Good", 0x24, 0, 25, 0, 0 }, + {"Player Castle Bad", 0x24, 0, 25, 0, 0} +}}; + + + +//----- (004B3A72) -------------------------------------------------------- +void InitializaDialogueOptions_Tavern(BuildingType type) +{ + int num_buttons; // esi@1 + + num_buttons = 0; + if (type == BuildingType_Tavern) + { + num_buttons = 2; + CreateButtonInColumn(0, 102); + CreateButtonInColumn(1, 103); + if ( pParty->HasItem(651) ) //Arcomage Deck + { + num_buttons = 3; + CreateButtonInColumn(2, 104); + } + } + pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; +} +// F8B1E0: using guessed type int dword_F8B1E0; + +//----- (004B3AD4) -------------------------------------------------------- +void InitializaDialogueOptions_Shops(BuildingType type) +{ + switch (type) + { + case BuildingType_WeaponShop: + case BuildingType_ArmorShop: + case BuildingType_MagicShop: + { + CreateButtonInColumn(0, 3); + CreateButtonInColumn(1, 4); + CreateButtonInColumn(2, 5); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_AlchemistShop: + { + CreateButtonInColumn(0, 3); + CreateButtonInColumn(1, 4); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + } + + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; +} +// F8B1E0: using guessed type int dword_F8B1E0; + +//----- (004B3B42) -------------------------------------------------------- +void InitializaDialogueOptions(BuildingType type) +{ + switch (type) + { + case BuildingType_WeaponShop: + case BuildingType_ArmorShop: + case BuildingType_MagicShop: + case BuildingType_AlchemistShop: + { + CreateButtonInColumn(0, 2); + CreateButtonInColumn(1, 95); + CreateButtonInColumn(2, 94); + CreateButtonInColumn(3, 96); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + + case BuildingType_FireGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 48); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_AirGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 49); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_WaterGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 50); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_EarthGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 51); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_SpiritGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 52); + CreateButtonInColumn(2, 61); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_MindGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 53); + CreateButtonInColumn(2, 61); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_BodyGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 54); + CreateButtonInColumn(2, 61); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_LightGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 55); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_DarkGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 56); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_ElementalGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 48); + CreateButtonInColumn(2, 49); + CreateButtonInColumn(3, 50); + CreateButtonInColumn(4, 51); + pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2); + } + break; + + case BuildingType_SelfGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 52); + CreateButtonInColumn(2, 53); + CreateButtonInColumn(3, 54); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + + case BuildingType_16: + case BuildingType_TownHall: + { + int num_buttons = 1; + CreateButtonInColumn(0, 99); + + if (pParty->uFine) + { + num_buttons++; + CreateButtonInColumn(1, 100); + } + + pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); + } + break; + + case BuildingType_Bank: + { + CreateButtonInColumn(0, 7); + CreateButtonInColumn(1, 8); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_Temple: + { + CreateButtonInColumn(0, 10); + CreateButtonInColumn(1, 11); + CreateButtonInColumn(2, 96); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_Stables: + case BuildingType_Boats: + { + CreateButtonInColumn(0, 105); + CreateButtonInColumn(1, 106); + CreateButtonInColumn(2, 107); + CreateButtonInColumn(3, 108); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + + case BuildingType_Training: + { + CreateButtonInColumn(0, 17); + CreateButtonInColumn(1, 96); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_Tavern: + { + CreateButtonInColumn(0, 0xFu); + CreateButtonInColumn(1, 0x10u); + CreateButtonInColumn(2, 0x60u); + if ( (signed int)window_SpeakInHouse->ptr_1C < 108 || (signed int)window_SpeakInHouse->ptr_1C > 120 ) + { + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + break; + } + CreateButtonInColumn(3, 101); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + + case BuildingType_18: + case BuildingType_19: + case BuildingType_Throne_Room: + case BuildingType_24: + case BuildingType_Unic: + case BuildingType_1A: + case BuildingType_House: + case BuildingType_Jail: + break; + + default: + Error("Invalid enumeration value: %u", type); + } + +/* if ( a1 > 13 ) + { + if ( a1 > 22 ) + { + if ( a1 == 23 ) + { + CreateButtonInColumn(0, 0xAu); + CreateButtonInColumn(1, 0xBu); + v14 = 96; +LABEL_41: + CreateButtonInColumn(2, v14); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 3; + goto LABEL_42; + } + if ( a1 <= 26 ) + goto LABEL_43; + if ( a1 > 28 ) + { + if ( a1 != 30 ) + goto LABEL_43; + CreateButtonInColumn(0, 0x11u); + v16 = 96; + goto LABEL_37; + } + CreateButtonInColumn(0, 0x69u); + CreateButtonInColumn(1, 0x6Au); + CreateButtonInColumn(2, 0x6Bu); + v12 = 108; + } + else + { + if ( a1 == 22 ) + { + CreateButtonInColumn(0, 7u); + v16 = 8; + goto LABEL_37; + } + v1 = a1 - 14; + if ( !v1 ) // == 14 + { + CreateButtonInColumn(0, 0x12u); + CreateButtonInColumn(1, 0x30u); + CreateButtonInColumn(2, 0x31u); + CreateButtonInColumn(3, 0x32u); + CreateButtonInColumn(4, 0x33u); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 5; + goto LABEL_42; + } + v2 = v1 - 1; + if ( v2 ) // > 15 + { + v3 = v2 - 2; + if ( v3 ) // > 17 + { + if ( v3 != 4 ) // 18, 19, 20 + goto LABEL_43; + CreateButtonInColumn(0, 0xFu); // 21 + CreateButtonInColumn(1, 0x10u); + v4 = 3; + CreateButtonInColumn(2, 0x60u); + v5 = (signed int)window_SpeakInHouse->ptr_1C; + if ( v5 < 108 || v5 > 120 ) + goto LABEL_28; + v4 = 4; + v6 = 101; + v7 = 3; + } + else // 16, 17 + { + v4 = 1; + CreateButtonInColumn(0, 0x63u); + if ( !pParty->uFine ) + { +LABEL_28: + v17 = 2; + v11 = 0; + v10 = 1; + v9 = v4; +LABEL_42: + pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); + goto LABEL_43; + } + v4 = 2; + v7 = 1; + v6 = 100; + } + CreateButtonInColumn(v7, v6); + goto LABEL_28; + } + CreateButtonInColumn(0, 0x12u); // 15 + CreateButtonInColumn(1, 0x34u); + CreateButtonInColumn(2, 0x35u); + v12 = 54; + } +LABEL_39: + CreateButtonInColumn(3, v12); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 4; + goto LABEL_42; + } + if ( a1 == 13 ) + { + CreateButtonInColumn(0, 0x12u); + v16 = 56; +LABEL_37: + CreateButtonInColumn(1, v16); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 2; + goto LABEL_42; + } + switch ( a1 ) + { + case 1: + case 2: + case 3: + case 4: + CreateButtonInColumn(0, 2u); + CreateButtonInColumn(1, 0x5Fu); + CreateButtonInColumn(2, 0x5Eu); + v12 = 96; + goto LABEL_39; + case 5: + CreateButtonInColumn(0, 0x12u); + v13 = 48; + goto LABEL_9; + case 6: + CreateButtonInColumn(0, 0x12u); + v13 = 49; + goto LABEL_9; + case 7: + CreateButtonInColumn(0, 0x12u); + v13 = 50; + goto LABEL_9; + case 8: + CreateButtonInColumn(0, 0x12u); + v13 = 51; +LABEL_9: + CreateButtonInColumn(1, v13); + v14 = 72; + goto LABEL_41; + case 9: + CreateButtonInColumn(0, 0x12u); + v15 = 52; + goto LABEL_13; + case 10: + CreateButtonInColumn(0, 0x12u); + v15 = 53; + goto LABEL_13; + case 11: + CreateButtonInColumn(0, 0x12u); + v15 = 54; +LABEL_13: + CreateButtonInColumn(1, v15); + v14 = 61; + goto LABEL_41; + case 12: + CreateButtonInColumn(0, 0x12u); + v16 = 55; + goto LABEL_37; + default: + break; + } +LABEL_43:*/ + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; +} +// F8B1E0: using guessed type int dword_F8B1E0; + + +//----- (004B1784) -------------------------------------------------------- +bool HouseUI_CheckIfPlayerCanInteract() +{ + GUIWindow window; // [sp+4h] [bp-54h]@3 + + if ( pPlayers[uActiveCharacter]->CanAct() ) + { + pDialogueWindow->pNumPresenceButton = dword_F8B1E0; + return true; + } + else + { + pDialogueWindow->pNumPresenceButton = 0; + memcpy(&window, pPrimaryWindow, sizeof(window)); + window.uFrameX = 483; + window.uFrameWidth = 148; + window.uFrameZ = 334; + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, + pGlobalTXT_LocalizationStrings[562]); // "%s is in no condition to %s""do anything" + window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &window, 0, 0)) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3); + return false; + } +} + +//----- (0044622E) -------------------------------------------------------- +bool EnterHouse(enum HOUSE_ID uHouseID) +{ + signed int uOpenTime; // eax@5 + signed int uCloseTime; // esi@5 +// unsigned int v5; // esi@5 +// int v6; // edx@5 + signed int am_pm_flag_open; // ecx@10 + signed int am_pm_flag_close; // eax@10 +// int v9; // esi@10 +// int v11; // ecx@17 +// unsigned int v12; // kr00_4@25 +// int v14; // eax@25 + unsigned int v17; // eax@37 + signed int v18; // edi@37 + signed int v19; // edi@41 + char pContainer[40]; // [sp+Ch] [bp-30h]@32 +// unsigned int v24; // [sp+34h] [bp-8h]@5 + + GameUI_Footer_TimedString[0] = 0; + pFooterString[0] = 0; + ShowStatusBarString("", 2); + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + viewparams->bRedrawGameUI = 1; + uDialogueType = 0; + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); + pKeyActionMap->ResetKeys(); + if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) + { + GameOverMenu(0); + return 0; + } + uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; + uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; + current_npc_text = 0; + dword_F8B1E4 = 0; + memset(byte_F8B1F0.data(), 0, 4); + memset(player_levels.data(), 0, 16); + pRenderer->ClearZBuffer(0, 479); + + if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| + ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) + + { + am_pm_flag_open = 0; + am_pm_flag_close = 0; + if (uOpenTime > 12 ) + { + uOpenTime -= 12; + am_pm_flag_open = 1; + } + if ( uCloseTime > 12 ) + { + uCloseTime -= 12; + am_pm_flag_close = 1; + } + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], + uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" + ShowStatusBarString(pTmpBuf.data(), 2u); + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); + return 0; + } + else + { + //v10 = uHouseID; + if ( (signed int)uHouseID < 53 ) //entering shops and guilds + { + if ( !(pParty->PartyTimes._shop_ban_times[uHouseID]) + || (pParty->PartyTimes._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) + { + pParty->PartyTimes._shop_ban_times[uHouseID] = 0; + } + else + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" + return 0; + } + } + pAudioPlayer->StopChannels(-1, -1); + + uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; + in_current_building_type = (BuildingType)pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; + if ( in_current_building_type == BuildingType_Throne_Room && pParty->uFine ) // going 2 jail + { + uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; + uHouseID = HOUSE_JAIL; + pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000; + in_current_building_type = (BuildingType)pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; + ++pParty->uNumPrisonTerms; + pParty->uFine = 0; + for (uint i = 0; i < 4; ++i) + { + pParty->pPlayers[i].uTimeToRecovery = 0; + pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; + pParty->pPlayers[i].SetVariable(VAR_Award, 87); + } + } + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; + default: Error("Invalid alignment type: %u", pParty->alignment); + } + + v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + pDialogueNPCCount = 0; + pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; + uTextureID_right_panel_loop = uTextureID_right_panel; + PrepareHouse(uHouseID); + v18 = 1; + uTextureID_right_panel_loop = uTextureID_right_panel; + if ( uNumDialogueNPCPortraits == 1 ) + pDialogueNPCCount = 1; + pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + dword_5C35D4 = 1; + if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) + { + if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) ) + { + return 1; + } + } + else + { //guilds + v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags + //v20 = uHouseID; + //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) + if(!_449B57_test_bit(pPlayers[uActiveCharacter]->_achieved_awards_bits,v19)) + { + PlayHouseSound(uHouseID, HouseSound_Greeting_2); + return 1; + } + } + PlayHouseSound(uHouseID, HouseSound_Greeting); + dword_5C35D4 = 1; + return 1; + } + } + +//----- (0044606A) -------------------------------------------------------- +void PrepareHouse(HOUSE_ID house) +{ + __int16 uExitMapID; // ax@2 +// int v7; // ebx@11 +// int v13; // [sp+30h] [bp-30h]@11 + int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1 + int uAnimationID; // [sp+50h] [bp-10h]@1 + + + uAnimationID = p2DEvents[house - 1].uAnimationID; + memset(npc_id_arr, 0, sizeof(npc_id_arr)); + uNumDialogueNPCPortraits = 0; + uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; + if ( uHouse_ExitPic ) + { + uExitMapID = p2DEvents[house - 1]._quest_related; + if ( uExitMapID > 0 ) + { + if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) + { + uHouse_ExitPic = 0; + } + } + } + + dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id; + HouseNPCData[0]=0; + uNumDialogueNPCPortraits = 0; + if ( dword_591080 ) + { + + npc_id_arr[0] = dword_591080; + uNumDialogueNPCPortraits = 1; + } + + for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i) + { + if (pNPCStats->pNewNPCData[i].Location2D == house ) + { + if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80)) + { + HouseNPCData[uNumDialogueNPCPortraits+1-((dword_591080 != 0) ? 1 : 0) ] = &pNPCStats->pNewNPCData[i]; + npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID; + ++uNumDialogueNPCPortraits; + if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2) + ++pNPCStats->pNewNPCData[i].uFlags; + } + } + + } + + for (int i = 0; i < uNumDialogueNPCPortraits; ++i) + { + + char icon_name[128]; + sprintfex(icon_name, "npc%03u", npc_id_arr[i]); + pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); + } + + if (uHouse_ExitPic) + { + pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); + ++uNumDialogueNPCPortraits; + uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; + } +} +//----- (004B1E92) -------------------------------------------------------- +void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) +{ + if ( pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId ) + pAudioPlayer->PlaySound((SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId + 300)), + 806, 0, -1, 0, 0, 0, 0); +} + +//----- (004BCACC) -------------------------------------------------------- +void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) +{ + int experience_for_next_level; // eax@5 + int v16; // eax@32 + __int16 v24; // ax@163 + signed int v36; // esi@227 + int pPrice; // ecx@227 + + if ( !pDialogueWindow->pNumPresenceButton ) + return; + pRenderer->ClearZBuffer(0, 479); + if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( in_current_building_type == BuildingType_Training ) + { + if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) + { + experience_for_next_level = 0; + if ( pPlayers[uActiveCharacter]->uLevel > 0 ) + { + for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) + experience_for_next_level += i + 1; + } + if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && + (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level)//test experience + return; + } + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); + pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); + } + if ( in_current_building_type != BuildingType_Training ) + { + if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && + transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] + || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) + { + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); + pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); + } + else if (uActiveCharacter) + { + if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) + return; + } + } + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + if ( in_current_building_type < BuildingType_19 ) + ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; + } + + //NEW + switch (in_current_building_type) + { + case BuildingType_FireGuild: + case BuildingType_AirGuild: + case BuildingType_WaterGuild: + case BuildingType_EarthGuild: + case BuildingType_SpiritGuild: + case BuildingType_MindGuild: + case BuildingType_BodyGuild: + case BuildingType_LightGuild: + case BuildingType_DarkGuild: + case BuildingType_ElementalGuild: + case BuildingType_SelfGuild: + case BuildingType_16: + { + if ( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] >= (signed __int64)pParty->uTimePlayed ) + { + for ( uint i = 0; i < 12; ++i ) + { + if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID ) + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; + } + } + else//generation new books + { + SpellBookGenerator(); + pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 + * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); + } + break; + } + case BuildingType_TownHall: + { + if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) + { + if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation + { + pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; + pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; + v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); + if ( !v16 ) + { + while ( 1 ) + { + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) + { + if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) + && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) + && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) + break; + } + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 1 ) + { + while ( 1 ) + { + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) + { + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x52u || (unsigned __int16)v24 > 0x54u) + && ((unsigned __int16)v24 < 4 || (unsigned __int16)v24 > 6) + && ((unsigned __int16)v24 < 0x37u || (unsigned __int16)v24 > 0x39u) + && ((unsigned __int16)v24 < 0x3Au || (unsigned __int16)v24 > 0x3Cu) + && ((unsigned __int16)v24 < 0x3Du || (unsigned __int16)v24 > 0x3Fu) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) ) + break; + } + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 2 ) + { + while ( 1 ) + { + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) + { + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x31u || (unsigned __int16)v24 > 0x33u) + && ((unsigned __int16)v24 < 0x34u || (unsigned __int16)v24 > 0x36u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0x1Cu || (unsigned __int16)v24 > 0x1Eu) ) + break; + } + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 3 ) + { + while ( 1 ) + { + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) + { + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) + && ((unsigned __int16)v24 < 0x43u || (unsigned __int16)v24 > 0x45u) + && ((unsigned __int16)v24 < 0x4Fu || (unsigned __int16)v24 > 0x51u) + && ((unsigned __int16)v24 < 0xC1u || (unsigned __int16)v24 > 0xC3u) + && ((unsigned __int16)v24 < 0x13u || (unsigned __int16)v24 > 0x15u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0x6Au || (unsigned __int16)v24 > 0x6Cu) ) + break; + } + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 4 ) + { + while ( 1 ) + { + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) + { + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) + && ((unsigned __int16)v24 < 0x46u || (unsigned __int16)v24 > 0x48u) + && ((unsigned __int16)v24 < 0x100u || (unsigned __int16)v24 > 0x102u) + && ((unsigned __int16)v24 < 0xD9u || (unsigned __int16)v24 > 0xDBu) + && ((unsigned __int16)v24 < 0xC7u || (unsigned __int16)v24 > 0xC9u) + && ((unsigned __int16)v24 < 0xE5u || (unsigned __int16)v24 > 0xE7u) + && ((unsigned __int16)v24 < 0xDFu || (unsigned __int16)v24 > 0xE1u) + && ((unsigned __int16)v24 < 0x5Bu || (unsigned __int16)v24 > 0x5Du) + && ((unsigned __int16)v24 < 0x49u || (unsigned __int16)v24 > 0x4Bu) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0x10u || (unsigned __int16)v24 > 0x12u) ) + break; + } + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; + } + } + } + bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) + { + bountyHunting_text = pNPCTopics[351].pText;//"В этом месяцу назначена награда за голову %s..." + if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) + bountyHunting_text = pNPCTopics[353].pText;//"Кое кто уже приходил в этом месяце за наградой" + } + else + { + if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize + { + pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); + for ( uint i = 0; i < 4; ++i ) + pParty->pPlayers[i].SetVariable(VAR_Award, 86); + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; + pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; + } + bountyHunting_text = pNPCTopics[352].pText;//"Поздравляю! Вы успешно..." + } + } + else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) + pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); + break; + } + case BuildingType_Bank: + { + if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) + pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); + return; + break; + } + case BuildingType_WeaponShop: + case BuildingType_ArmorShop: + case BuildingType_MagicShop: + case BuildingType_AlchemistShop: + case BuildingType_Tavern: + case BuildingType_Temple: + case BuildingType_Training: + { + break; + } + default: + { + return; + break; + } + } + + switch ( uMessageParam ) + { + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + FillAviableSkillsToTeach(in_current_building_type); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + InitializaDialogueOptions_Tavern(in_current_building_type); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: + { + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_PlayArcomage, 0, 0); + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; + break; + } + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + if ( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + { + GenerateStandartShopItems(); + GenerateSpecialShopItems(); + pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); + } + if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) + { + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; + } + } + if ( in_current_building_type == BuildingType_WeaponShop ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) + { + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID) + weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); + } + } + } + } + if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) + { + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; + } + } + if ( in_current_building_type == BuildingType_WeaponShop ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); + } + } + } + } + break; + } + case HOUSE_DIALOGUE_SHOP_SELL: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + case HOUSE_DIALOGUE_SHOP_REPAIR: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); + break; + } + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + InitializaDialogueOptions_Shops(in_current_building_type); + break; + } + default: + { + if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) + { + v36 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPrice = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v36 / 3 ) + pPrice = v36 / 3; + if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam - 36]) + { + if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) + { + if ( pParty->uNumGold < pPrice ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); + if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); + else + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + } + else + { + Party::TakeGold(pPrice); + dword_F8B1E4 = 1; + pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); + } + } + } + } + break; + } + } +} +//----- (004B6943) -------------------------------------------------------- +void TravelByTransport() +{ + signed int v4; // ebx@1 + stru365_travel_info *pTravel; // esi@7 + signed int v12; // esi@13 + signed int v13; // edi@14 + DWORD v14; // eax@26 + DWORD v15; // edi@26 + int pTextHeight; // eax@36 + int pRealTextHeight; // esi@36 + int schedule_id; // esi@39 + GUIButton *pButton; // ebx@39 + signed int v25; // eax@41 + MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 + char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 + GUIWindow travel_window; // [sp+208h] [bp-88h]@1 + int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 + int index; // [sp+27Ch] [bp-14h]@36 + unsigned int pPrice; // [sp+288h] [bp-8h]@1 + int travel_time; // [sp+28Ch] [bp-4h]@48 + enum PlayerSpeech pSpeech; + unsigned int pCurrentButton; + + memcpy(&travel_window, window_SpeakInHouse, sizeof(travel_window)); + travel_window.uFrameX = 483; + travel_window.uFrameWidth = 148; + travel_window.uFrameZ = 334; + + v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50; + v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + + pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( (signed int)pPrice < v4 / 3 ) + pPrice = v4 / 3; + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + index = 0; + strcpy(pTopicArray[4], ""); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], pPrice); // Price: %lu gold + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &travel_window, 0, 0); + pRealTextHeight = pTextHeight + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; + pPrimaryTextHeight = pRealTextHeight; + pCurrentButton = 2; + for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < (unsigned int)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); ++i ) + { + schedule_id = transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][index]; + pButton = pDialogueWindow->GetControl(i); + + if (schedule_id != 255) + { + //if (schedule_id >= 25) + //Log::Warning(L"Transport UI: schedule overflow"); + if ( pCurrentButton >= 6 ) + v25 = true; + else + v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7]; + } + + if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit + || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )//ошибка: рисуется несколько строчек одного направления путешествия + { + //get color for current string(определение цвета текущей строки)---------- + if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) + sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 155)); + else + sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 255)); + //hired NPC premium(премия наёмного НПС)---------------------------------- + travel_time = transport_schedule[schedule_id].uTravelTime; + if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_EMERALD_ISLE ) + { + if ( CheckHiredNPCSpeciality(Sailor) ) + travel_time -= 2; + if ( CheckHiredNPCSpeciality(Navigator) ) + travel_time -= 3; + if ( CheckHiredNPCSpeciality(Pirate) ) + travel_time -= 2; + } + else + { + if ( CheckHiredNPCSpeciality(Horseman) ) + travel_time -= 2; + } + if ( CheckHiredNPCSpeciality(Explorer) ) + --travel_time; + + if ( travel_time < 1 ) + travel_time = 1; + if ( schedule_id != 255 ) + { + memcpy(&pMap, &pMapStats->pInfos[transport_schedule[schedule_id].uMapInfoID], 0x44u); + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s + strcat(pTopicArray[index], pTmpBuf.data()); + strcat(pTopicArray[index], "\n \n"); + pButton->uY = pRealTextHeight; + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pButton->uY + pTextHeight - 1; + pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; + } + } + else + { + strcpy(pTopicArray[index], ""); + if ( pButton ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + } + ++index; + ++pCurrentButton; + } + if ( pRealTextHeight != pPrimaryTextHeight ) + { + sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), pTopicArray[0], pTopicArray[1], pTopicArray[2], pTopicArray[3], pTopicArray[4]); + travel_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); + } + else + { + travel_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &travel_window, 0, 0)) / 2 + 138,//"Извините, приходите в другой день" + Color16(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3); + pAudioPlayer->StopChannels(-1, -1); + } + } + } + else//после нажатия топика + { + if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 ) + { + if ( pParty->uNumGold < pPrice ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + + Party::TakeGold(pPrice); + + pTravel = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]]; + if ( pTravel->pSchedule[pParty->uDaysPlayed % 7] ) + { + if ( _stricmp(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename) ) + { + SaveGame(1, 0); + strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename); + + dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; + _5B65B8_npcdata_hiword_house_or_other = 0; + dword_5B65BC = 0; + _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y; + uGameState = GAME_STATE_CHANGE_LOCATION; + _5B65A8_npcdata_uflags_or_other = pTravel->arrival_x; + _5B65AC_npcdata_fame_or_other = pTravel->arrival_y; + _5B65B0_npcdata_rep_or_other = pTravel->arrival_z; + dword_5B65C0 = pTravel->arrival_x | pTravel->arrival_y | pTravel->arrival_z | pTravel->arrival_rot_y; + } + else + { + pGame->pIndoorCameraD3D->sRotationY = 0; + + pParty->uFlags |= 2u; + pParty->vPosition.x = pTravel->arrival_x; + pParty->vPosition.y = pTravel->arrival_y; + pParty->vPosition.z = pTravel->arrival_z; + pParty->uFallStartY = pParty->vPosition.z; + pParty->sRotationX = 0; + pParty->sRotationY = pTravel->arrival_rot_y; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + v12 = pTravel->uTravelTime; + if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) + { + pSpeech = SPEECH_SetSail; + v13 = 2500; + if ( CheckHiredNPCSpeciality(Sailor) ) + v12 -= 2; + if ( CheckHiredNPCSpeciality(Navigator) ) + v12 -= 3; + if ( CheckHiredNPCSpeciality(Pirate) ) + v12 -= 2; + } + else + { + pSpeech = SPEECH_CarriageReady; + v13 = 1500; + if ( CheckHiredNPCSpeciality(Horseman) ) + v12 -= 2; + } + if ( CheckHiredNPCSpeciality(Explorer) ) + --v12; + if ( v12 < 1 ) + v12 = 1; + RestAndHeal(1440 * v12); + pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0); + v14 = GetTickCount(); + v15 = v14 + v13; + if ( v15 < v14 ) + v15 = v14; + while ( GetTickCount() < v15 ) + sqrt(3.1415926); + while ( HouseDialogPressCloseBtn() ) + ; + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); + return; + } + else + { + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + } + } + } +} +//----- (004B68EA) -------------------------------------------------------- +bool __fastcall IsTravelAvailable(int a1) +{ + for ( uint i = 0; i < 4; ++i ) + { + if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] ) + { + if (!transport_schedule[transport_routes[a1][i]].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[transport_routes[a1][i]].uQuestBit)) + return true; + } + } + return false; +} + +//----- (004B7911) -------------------------------------------------------- +void TownHallDialog() +{ + int v1; // eax@10 + int v2; // esi@10 + signed int pStringSum; // ebx@24 + signed int v16; // ebx@28 + int v17; // ebx@28 + GUIButton *pButton; // eax@30 + int pTextHeight; // eax@30 + unsigned __int16 pTextColor; // ax@30 + GUIWindow window; // [sp+60h] [bp-BCh]@21 + GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 + int v29; // [sp+10Ch] [bp-10h]@28 + int v31; // [sp+114h] [bp-8h]@29 + GUIFont *pOutString; // [sp+118h] [bp-4h]@21 + + memcpy(&townHall_window, window_SpeakInHouse, sizeof(townHall_window)); + townHall_window.uFrameX = 483; + townHall_window.uFrameWidth = 148; + townHall_window.uFrameZ = 334; + sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);//Текущий штраф + townHall_window.DrawTitleText(pFontArrus, 0, 260, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + switch(dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + pStringSum = 1; + pTextHeight = 0; + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[604]);//Охота за вознаграждение + if ( pParty->uFine > 0 ) + { + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[603]);//Заплатить штраф + pStringSum = 2; + } + for ( uint i = 0; i < pStringSum; ++i ) + pTextHeight += pFontArrus->CalcTextHeight(pShopOptions[i], &townHall_window, 0, 0); + v29 = (100 - pTextHeight) / pStringSum; + v16 = 80 - pStringSum * ((100 - pTextHeight) / pStringSum); + v17 = (v16 / 2) - v29 / 2 + 158; + if ( pDialogueWindow->pNumPresenceButton > 0 ) + { + v31 = 2; + uint j = 0; + for ( uint i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v29 + v17; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); + pButton->uHeight = pTextHeight; + v17 = pButton->uY + pTextHeight - 1; + pButton->uW = v17; + pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[j], 3); + ++v31; + ++j; + } + } + break; + } + case HOUSE_DIALOGUE_TOWNHALL_MESSAGE: + { + sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), + pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName, Color16(0xFFu, 0xFFu, 0xFFu)); + sprintf(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].uLevel); + current_npc_text = pTmpBuf2.data(); + memcpy(&window, pDialogueWindow, sizeof(window)); + window.uFrameWidth = 458; + window.uFrameZ = 457; + pOutString = pFontArrus; + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &window, 13, 0) + 7; + if ( 352 - pTextHeight < 8 ) + { + pOutString = pFontCreate; + pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; + } + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); + break; + } + case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: + { + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + { + sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" + townHall_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); + townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); + return; + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + v1 = atoi(pKeyActionMap->pPressedKeysBuffer); + v2 = atoi(pKeyActionMap->pPressedKeysBuffer); + if ( v1 <= 0 ) + { + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 > pParty->uNumGold ) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + v2 = pParty->uNumGold; + } + if ( v2 > pParty->uFine ) + v2 = pParty->uFine; + Party::TakeGold(v2); + pParty->uFine -= v2; + if ( pParty->uFine < 0 ) + pParty->uFine = 0; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) + { + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + } + break; + } + default: + break; + } + return; +} + +//----- (004B7D7E) -------------------------------------------------------- +void BankDialog() +{ + int entered_sum; // eax@19 + unsigned int takes_sum; // esi@19 + unsigned __int16 pColorText; // ax@27 + GUIWindow bank_window; // [sp+Ch] [bp-5Ch]@1 + + memcpy(&bank_window, window_SpeakInHouse, sizeof(bank_window)); + bank_window.uFrameX = 483; + bank_window.uFrameWidth = 148; + bank_window.uFrameZ = 334; + sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);//Баланс + bank_window.DrawTitleText(pFontArrus, 0, 220, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + switch(dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + bank_window.DrawTitleText(pFontArrus, 0, 146, pColorText, pGlobalTXT_LocalizationStrings[60], 3); + pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + bank_window.DrawTitleText(pFontArrus, 0, 176, pColorText, pGlobalTXT_LocalizationStrings[244], 3); + break; + } + case HOUSE_DIALOGUE_BANK_PUT_GOLD: + { + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + { + sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"Положить" "Сколько?" + bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); + bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); + return; + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer); + takes_sum = entered_sum; + if ( !entered_sum ) + { + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + if ( entered_sum > pParty->uNumGold ) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + takes_sum = pParty->uNumGold; + } + if ( takes_sum ) + { + Party::TakeGold(takes_sum); + pParty->uNumGoldInBank += takes_sum; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + } + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) + { + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + } + return; + } + case HOUSE_DIALOGUE_BANK_GET_GOLD: + { + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + { + sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"Снять" "Сколько?" + bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); + bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); + return; + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer); + takes_sum = entered_sum; + if ( entered_sum ) + { + if ( entered_sum > pParty->uNumGoldInBank ) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + takes_sum = pParty->uNumGoldInBank; + } + if ( takes_sum ) + { + Party::SetGold(pParty->uNumGold + takes_sum); + pParty->uNumGoldInBank -= takes_sum; + } + } + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) + { + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + } + return; + } + default: + { + break; + } + } +} +// F8B19C: using guessed type int dword_F8B19C; + +//----- (004B8285) -------------------------------------------------------- +void TavernDialog() +{ + int pPriceRoom; + int pPriceFood; + int pPriceSkill; + int pItemNum; + double v2; // st7@1 + int pNumString; // edi@16 + signed int v9; // esi@16 + unsigned int pColorText; // eax@57 + GUIButton *pButton; // eax@65 + int pSkillCount; + signed int pOptionsCount; // edi@77 + signed int i; // esi@79 +// signed int v53; // edi@81 + int v54; // edi@81 + const char *pText; // [sp-4h] [bp-278h]@93 + char pTopic1[100]; // [sp+Ch] [bp-268h]@55 + char pTopic4[100]; // [sp+70h] [bp-204h]@59 + char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 + char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 + GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 + int v91; // [sp+270h] [bp-4h]@3 + unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 + unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 + unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 + unsigned __int8 pTopic4Height; + int pTextHeight; + int all_text_height; // [sp+260h] [bp-14h]@18 + GUIFont *pOutString; + + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + + pPriceRoom = ((v2 * v2) / 10) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPriceRoom < ((v2 * v2) / 10) / 3 ) + pPriceRoom = ((v2 * v2) / 10) / 3; + if ( pPriceRoom <= 0 ) + pPriceRoom = 1; + + pPriceFood = ((v2 * v2) * v2 / 100) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPriceFood < ((v2 * v2) * v2 / 100) / 3 ) + pPriceFood = ((v2 * v2) * v2 / 100) / 3; + if ( pPriceFood <= 0 ) + pPriceFood = 1; + + + switch(dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + + sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pPriceRoom); // Rent room for %d gold + strcat(pTopic1, pTmpBuf2.data()); + pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); + strcat(pTopic1, "\n \n"); + + sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold + (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, pPriceFood); + strcat(pTopic2, pTmpBuf2.data()); + pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); + strcat(pTopic2, "\n \n"); + + sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); + strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills + pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0); + strcat(pTopic3, "\n \n"); + pTopic4[0] = 0; + if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 ) + { + sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); + strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage + pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); + } + + if ( pDialogueWindow->pNumPresenceButton ) + { + for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; + pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) + { + pButton = pDialogueWindow->GetControl(pItemNum); + if ( pButton->msg_param == 15 ) + { + pButton->uHeight = pTopic1Height; + pButton->uY = 146; + pButton->uW = pTopic1Height + 145; + } + else if ( pButton->msg_param == 16 ) + { + pButton->uHeight = pTopic2Height; + pButton->uY = pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; + pButton->uW = (pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) + pTopic2Height - 1; + } + else if ( pButton->msg_param == 96 ) + { + pButton->uY = pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; + pButton->uHeight = pTopic3Height; + pButton->uW = pTopic3Height + (pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) - 1; + } + else if ( pButton->msg_param == 101 ) + { + pButton->uHeight = pTopic4Height; + pButton->uY = pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146; + pButton->uW = (pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146) + pTopic4Height - 1; + } + } + sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); + dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); + } + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: + { + pOutString = pFontArrus; + strcpy(pTmpBuf.data(), pNPCTopics[354].pText); + dialog_window.uFrameWidth = game_viewport_width; + dialog_window.uFrameZ = 452; + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; + if ( 352 - pTextHeight < 8 ) + { + pOutString = pFontCreate; + pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; + } + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: + { + strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); + dialog_window.uFrameWidth = game_viewport_width; + dialog_window.uFrameZ = 452; + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, + FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: + { + if ( pArcomageGame->bGameInProgress == 1 ) + return; + if ( pArcomageGame->uGameWinner ) + { + if ( pArcomageGame->uGameWinner == 1 ) + pText = pGlobalTXT_LocalizationStrings[640];// You won! + else + pText = pGlobalTXT_LocalizationStrings[641];// You lost! + } + else + { + pText = pGlobalTXT_LocalizationStrings[639];// A tie! + } + strcpy(pTmpBuf.data(), pText); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, + Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + break; + } + case HOUSE_DIALOGUE_TAVERN_REST: + { + if ( pParty->uNumGold >= pPriceRoom ) + { + Party::TakeGold(pPriceRoom); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + dialog_menu_id = HOUSE_DIALOGUE_NULL; + HouseDialogPressCloseBtn(); + GetHouseGoodbyeSpeech(); + pMediaPlayer->Unload(); + /*if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; + pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 + pMessageQueue_50CBD0->pMessages[0].field_8 = 1; + ++pMessageQueue_50CBD0->uNumMessages;*/ + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_RentRoom, (int)window_SpeakInHouse->ptr_1C, 1); + window_SpeakInHouse->Release(); + window_SpeakInHouse = 0; + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + break; + } + + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pSkillCount = 0; + v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPriceSkill = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPriceSkill < v9 / 3 ) + pPriceSkill = v9 / 3; + all_text_height = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + pSkillCount++; + } + } + if ( pSkillCount ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPriceSkill);//Стоимость навыка: %lu + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v91 = (149 - all_text_height) / pSkillCount; + if ( (149 - all_text_height) / pSkillCount > 32 ) + v91 = 32; + v54 = (149 - pSkillCount * v91 - all_text_height) / 2 - v91 / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; i++ ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v91 + v54; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v54 = pTextHeight + pButton->uY - 1; + pButton->uW = v54; + pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); + } + } + return; + } + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,//Советую вам %s %s поискать знания еще где-нибудь + pClassNames[pPlayers[uActiveCharacter]->classType]); + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. + pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + return; + } + + case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: + { + if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);//Вы уже купили еду! + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + if ( pParty->uNumGold >= pPriceFood ) + { + Party::TakeGold(pPriceFood); + pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + break; + } + + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: + { + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + pOptionsCount = 2; + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[620]);//Правила + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[622]);//Условия победы + if ( pParty->HasItem(651) )//651 - Колода для игры в АркоМэйдж в Items.txt + { + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[621]);//Играть + pOptionsCount = 3; + } + for ( i = 0; i < pOptionsCount; ++i ) + all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + all_text_height = (174 - all_text_height) / pOptionsCount; + + v54 = (174 - pOptionsCount * (174 - all_text_height) / pOptionsCount - all_text_height) / 2 - (174 - all_text_height) / pOptionsCount / 2 + 138; + pNumString = 0; + for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; + pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ; pItemNum++ ) + { + pButton = pDialogueWindow->GetControl(pItemNum); + pButton->uY = all_text_height + v54; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v54 = pButton->uY + pTextHeight - 1; + pButton->uW = v54; + pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); + ++pNumString; + } + } + break; + } + default: + { + break; + } + } +} + +//----- (004B705E) -------------------------------------------------------- +void TempleDialog() +{ + int pPrice; // edi@1 + int pTextHeight; // eax@11 + unsigned __int16 pTextColor; // ax@21 + DDM_DLV_Header *v26; // edi@29 + unsigned int v30; // edx@36 + int v35; // edi@50 + GUIButton *pButton; // edi@64 +// int v47; // edi@71 + GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1 + unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64 + int v64; // [sp+1B8h] [bp-Ch]@6 + unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6 + int all_text_height; // [sp+1C0h] [bp-4h]@6 + + memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window)); + tample_window.uFrameX = 483; + tample_window.uFrameWidth = 148; + tample_window.uFrameZ = 334; + pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier); + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) + { + index = 1; + pButton = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); + pButton->uHeight = 0; + pButton->uY = 0; + if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) + { + sprintfex(pTmpBuf.data(), "%s %d %s", pGlobalTXT_LocalizationStrings[104], pPrice, pGlobalTXT_LocalizationStrings[97]);//"Лечить" "Золото" + pShopOptions[0] = pTmpBuf.data(); + index = 0; + } + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[68]);//"Пожертвовать" + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);//"Обучиться навыкам" + all_text_height = 0; + if ( index < pDialogueWindow->pNumPresenceButton ) + { + uint i = index; + for ( uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j ) + { + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); + i++; + } + } + v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index); + if ( v64 > 32 ) + v64 = 32; + all_text_height = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138; + if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + uint i = index; + for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem; + (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem ) + { + pButton = pDialogueWindow->GetControl(pCurrentItem); + pButton->uY = v64 + all_text_height; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pButton->uY + pTextHeight - 1; + all_text_height = pButton->uW; + pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[1 * i], 3); + i++; + index++; + } + } + return; + } + //------------------------------------------------- + if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL ) + { + if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) + return; + if ( pParty->uNumGold < pPrice ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + Party::TakeGold(pPrice); + v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]); + memset(pPlayers[uActiveCharacter], 0, 0xA0u); + pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); + pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); + if ( (signed int)window_SpeakInHouse->ptr_1C != 78 && ((signed int)window_SpeakInHouse->ptr_1C <= 80 || (signed int)window_SpeakInHouse->ptr_1C > 82) ) + { + if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 )// если состояние зомби + { + pPlayers[uActiveCharacter]->uCurrentFace = pPlayers[uActiveCharacter]->uPrevFace; + pPlayers[uActiveCharacter]->uVoiceID = pPlayers[uActiveCharacter]->uPrevVoiceID; + ReloadPlayerPortraits(uActiveCharacter - 1, pPlayers[uActiveCharacter]->uPrevFace); + } + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 ) + LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = v35; + else + { + if ( !pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] + && !pPlayers[uActiveCharacter]->pConditions[Condition_Pertified] && !pPlayers[uActiveCharacter]->pConditions[Condition_Dead] ) + { + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; + pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; + pPlayers[uActiveCharacter]->SetCondition(Condition_Zombie, 1); + pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; + pPlayers[uActiveCharacter]->uCurrentFace = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; + ReloadPlayerPortraits(uActiveCharacter - 1, (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23); + pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; + //v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); + } + //HIDWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = (int)v39; + pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + //--------------------------------------------------- + if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE ) + { + pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + if ( pParty->uNumGold >= (unsigned int)pPrice ) + { + Party::TakeGold((unsigned int)pPrice); + v26 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v26 = &pIndoor->dlv; + if ( v26->uReputation > -5 ) + { + v26->uReputation = v26->uReputation - 1; + if ( v26->uReputation - 1 < -5 ) + v26->uReputation = -5; + } + if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) + { + if ( v26->uReputation <= -5 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -10 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -15 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -20 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -25 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v30, 48, 0); + } + } + ++byte_F8B1EF[uActiveCharacter]; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!" + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + //------------------------------------------------ + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + { + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + all_text_height = 0; + pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100; + if ( v64 < (signed int)pCurrentItem / 3 ) + v64 = (signed int)pCurrentItem / 3; + pCurrentItem = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &tample_window, 0, 0); + ++pCurrentItem; + } + } + if ( pCurrentItem ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); + tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem; + if ( v64 > 32 ) + v64 = 32; + all_text_height = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162; + if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + pCurrentItem = 2; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v64 + all_text_height; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &tample_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pButton->uY + pTextHeight - 1; + all_text_height = pButton->uW; + pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); + } + pCurrentItem++; + } + } + } + else + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//"Советую вам %s %s поискать знания еще где-нибудь" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//"Больше ничего не могу предложить." + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0); + tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + } + } + } + return; +} + +//----- (004B4710) -------------------------------------------------------- +void TrainingDialog() +{ + unsigned __int64 v5; // edi@3 + int v8; // edx@4 + double v9; // st7@6 + signed int v10; // esi@6 + int pPrice; // ecx@6 + signed int v14; // esi@14 +// int v16; // eax@16 + int v19; // ecx@24 + int v33; // eax@36 + unsigned int v36; // eax@38 + unsigned int v42; // eax@46 + int index; + int all_text_height; // eax@68 + int v49; // ebx@69 + GUIButton *pButton; // eax@71 + int pTextHeight; // eax@71 + unsigned __int16 pTextColor; // ax@71 + GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 + int v69; // [sp+70h] [bp-14h]@6 + int v73; // [sp+80h] [bp-4h]@14 + + memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); + training_dialog_window.uFrameX = 483; + training_dialog_window.uFrameWidth = 148; + training_dialog_window.uFrameZ = 334; + v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 + //v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; + if (pPlayers[uActiveCharacter]->uExperience >= v5) + { + v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; + if ( v8 == 4 ) + v8 = 3; + v9 = (double)pPlayers[uActiveCharacter]->uLevel; + v69 = v8; + v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); + pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v10 / 3 ) + pPrice = v10 / 3; + } +//------------------------------------------------------- + all_text_height = 0; + if (HouseUI_CheckIfPlayerCanInteract()) + { + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) + { + if (HouseUI_CheckIfPlayerCanInteract()) + { + index = 0; + pShopOptions[0] = pTmpBuf.data(); + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);// "Learn Skills" + if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) + { + if (pPlayers[uActiveCharacter]->uLevel >= pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]) + sprintfex(pShopOptions[index], "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher." "Sorry, but we are unable to train you." + else + { + if (pPlayers[uActiveCharacter]->uExperience < v5) + sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[538], (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); // "You need %d more experience to train to level %d" + else + sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[537], pPlayers[uActiveCharacter]->uLevel + 1, pPrice); // "Train to level %d for %d gold" + } + } + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); + ++index; + } + } + v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; + if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) + { + index = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = (174 - all_text_height) / 2 + v49; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pTextHeight + pButton->uY - 1; + v49 = pButton->uW; + pTextColor = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(255, 255, 255); + training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); + ++index; + } + } + } + } +//------------------------------------------------------------------ + if ( dialog_menu_id == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) + { + if ( !HouseUI_CheckIfPlayerCanInteract() ) + { + v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); + training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, Color16(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); + pDialogueWindow->pNumPresenceButton = 0; + return; + } + if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] ) + { + if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) + { + if ( pParty->uNumGold >= pPrice) + { + Party::TakeGold(pPrice); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + ++pPlayers[uActiveCharacter]->uLevel; + pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; + pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); + pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); + uint max_level_in_party = player_levels[0]; + for (uint _it = 1; _it < 4; ++_it) + { + if (player_levels[_it] > max_level_in_party) + max_level_in_party = player_levels[_it]; + } + ++player_levels[uActiveCharacter - 1]; + if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level + // feature is broken thou, since this array is always zeroed in EnterHouse + { + v42 = 60 * (_494820_training_time(pParty->uCurrentHour) + 4) - pParty->uCurrentMinute; + if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || + (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) + v42 += 720; + RestAndHeal((signed int)(v42 + 10080)); + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) + pOutdoor->SetFog(); + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0); + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// + // "%s is now Level %lu and has earned %lu Skill Points!" + ShowStatusBarString(pTmpBuf.data(), 2); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// + // "You need %d more experience to train to level %d" + v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 88; + } + else + { + sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// + // ""With your skills, you should be working here as a teacher."" + // ""Sorry, but we are unable to train you."" + v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 101; + } + training_dialog_window.DrawTitleText(pFontArrus, 0, v36, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); + return; + } + } +//------------------------------------------------------------- + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + { + if (HouseUI_CheckIfPlayerCanInteract()) + { + v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPrice = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v14 / 3 ) + pPrice = v14 / 3; + index = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + (signed int)i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &training_dialog_window, 0, 0); + ++index; + } + } + if ( index ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" + training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v73 = (signed int)(149 - all_text_height) / index; + if ( v73 > 32 ) + v73 = 32; + v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + (signed int)i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v73 + v19; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &training_dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pButton->uY + pTextHeight - 1; + v19 = pButton->uY + pTextHeight - 1; + pTextColor = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(255, 255, 255); + training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); + } + } + } + else + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// + // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); + training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); + } + } + } + return; +} + +//----- (004B6478) -------------------------------------------------------- +void sub_4B6478() +{ + unsigned int v2; // eax@1 + signed int v3; // esi@1 + int pPrice; // ebx@1 + unsigned int v5; // esi@5 + int v6; // edi@6 +// int result; // eax@13 + int all_text_height; // eax@20 +// int v13; // eax@21 + GUIButton *pButton; // esi@27 +// unsigned int v16; // eax@28 + int pTextHeight; // eax@29 + unsigned __int16 pTextColor; // ax@29 +// unsigned __int16 v22; // ST14_2@36 + int v27; // [sp-4h] [bp-80h]@8 + GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1 + int v32; // [sp+6Ch] [bp-10h]@1 + int index; // [sp+74h] [bp-8h]@17 + + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + v2 = 52 * (unsigned int)window_SpeakInHouse->ptr_1C; + v32 = (unsigned __int8)(((p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; + v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); + pPrice = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v3 / 3 ) + pPrice = v3 / 3; + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) + { + pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &dialog_window, 0, 0);// + dialog_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3); + pDialogueWindow->pNumPresenceButton = 0; + return; + } + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + all_text_height = 0; + index = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + ++index; + } + } + if ( !index ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + return; + } + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v32 = (149 - all_text_height) / index; + if ( v32 > 32 ) + v32 = 32; + index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162; + if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] ) + { + if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uY = v32 + index; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + pButton->uW = pButton->uY + pTextHeight - 1; + index = pButton->uY + pTextHeight - 1; + pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); + } + } + else + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + } + } + return; + } + + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + v5 = 0; + __debugbreak(); + //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] + __debugbreak(); // whacky condition - fix + if (false + //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) + || (v6 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + dialog_menu_id), *(short *)v6) ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + } + else + { + if ( pParty->uNumGold < pPrice ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота + v27 = 4; + } + else + { + Party::TakeGold(pPrice); + *(short *)v6 = 1; + v27 = 2; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); + } + } + else + { + v5 = 0; + } + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, v5); + return; // void func +} + +//----- (004B2A74) -------------------------------------------------------- +void SimpleHouseDialog() +{ + NPCData *pNPC; // esi@6 + char *v15; // esi@14 + GUIButton *pButton; // eax@15 + char *v29; // esi@42 + int v31; // ST1C_4@42 + int index; // esi@51 + int v36; + signed int all_text_height; // ecx@54 + int v40; // edi@57 + unsigned __int16 pTextColor; // ax@60 + GUIFont *pTextFont; // ebx@64 + int pTextHeight; + GUIWindow w; // [sp+Ch] [bp-110h]@64 + GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13 + GUIWindow house_window; // [sp+B4h] [bp-68h]@1 + char *pInString; // [sp+114h] [bp-8h]@12 + + memcpy(&house_window, pDialogueWindow, sizeof(house_window)); + if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) + { + house_window.uFrameX = 493; + house_window.uFrameWidth = 126; + house_window.uFrameZ = 366; + house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3); + house_window.uFrameX = 483; + house_window.uFrameWidth = 148; + house_window.uFrameZ = 334; + if ( !pTransitionStrings[uHouse_ExitPic] ) + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s] + house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &house_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); + return; + } + house_window.DrawTitleText(pFontCreate, 0, + (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uHouse_ExitPic], &house_window, 0, 0)) / 2 + 101, 0, pTransitionStrings[uHouse_ExitPic], 3); + return; + } + house_window.uFrameWidth -= 10; + house_window.uFrameZ -= 10; + pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 + if ( pNPC->uProfession ) + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s + else + strcpy(pTmpBuf.data(), pNPC->pName); + house_window.DrawTitleText(pFontCreate, 483, 113, Color16(0x15u, 0x99u, 0xE9u), pTmpBuf.data(), 3); + if ( !dword_591080 ) + { + if ( !uDialogueType ) + { + if ( pNPC->greet ) + { + house_window.uFrameWidth = game_viewport_width; + house_window.uFrameZ = 452; + pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)]; + //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); + pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), + pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight + - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); + pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); + pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), + 0, FitTextInAWindow(pInString, pFontArrus, &house_window, 0xDu, 0), 0, 0, 0); + } + } + } + //for right panel + memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window)); + right_panel_window.uFrameX = 483; + right_panel_window.uFrameWidth = 148; + right_panel_window.uFrameZ = 334; + for ( int i = right_panel_window.pStartingPosActiveItem; + i < right_panel_window.pStartingPosActiveItem + right_panel_window.pNumPresenceButton; ++i ) + { + pButton = right_panel_window.GetControl(i); + switch ( pButton->msg_param ) + { + case 19://evt_A + v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 20://evt_B + v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + if ( uDialogueType != 84 ) + { + strcpy(pButton->pButtonName, v15); + continue; + } + sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName); + sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); + current_npc_text = pTmpBuf2.data(); + strcpy(pButton->pButtonName, v15); + continue; + case 21://evt_C + v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 22://evt_D + v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 23://evt_E + v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 24://evt_F + v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic; + if ( !v15 ) + { + pButton->msg_param = 0; + v15 = ""; + } + strcpy(pButton->pButtonName, v15); + continue; + case 76: + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять + continue; + case 77: + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее + continue; + case 79: + strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C)); + continue; + case 82: + strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C)); + continue; + case 83: + v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; + v31 = *(int *)v29; + sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), v31, Color16(0xFFu, 0xFFu, 0xFFu)); + sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); + current_npc_text = pTmpBuf2.data(); + strcpy(pButton->pButtonName, ""); + continue; + } + if ( pButton->msg_param > 0 && pButton->msg_param < 13 ) + { + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить + continue; + } + if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) + { + strcpy(pButton->pButtonName, ""); + continue; + } + if ( pButton->msg_param != 93 ) + { + strcpy(pButton->pButtonName, ""); + continue; + } + } + index = 0; + all_text_height = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); + index++; + } + if ( index ) + { + v36 = (174 - all_text_height) / index; + if ( v36 > 32 ) + v36 = 32; + v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v36 + v40; + pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); + pButton->uHeight = pTextHeight; + v40 = pButton->uY + pTextHeight - 1; + pButton->uW = v40; + pTextColor = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); + } + } + if ( current_npc_text ) + { + w.uFrameWidth = 458; + w.uFrameZ = 457; + pTextFont = pFontArrus; + pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + if ( 352 - pTextHeight < 8 ) + { + pTextFont = pFontCreate; + pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + } + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0); + } +} + +//----- (004B4F4F) -------------------------------------------------------- +void JailDialog() +{ + GUIWindow jail_dialogue_window; // [sp+8h] [bp-54h]@1 + + memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window)); + jail_dialogue_window.uFrameX = 483; + jail_dialogue_window.uFrameWidth = 148; + jail_dialogue_window.uFrameZ = 334; + jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18, + Color16(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"За многочисленные преступления и злодеяния вы были приговорены к одному году заключения." +} + + +//----- (00443801) -------------------------------------------------------- +void InitializeBuildingResidents() +{ + + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + + free(p2DEventsTXT_Raw); + p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); + strtok(p2DEventsTXT_Raw, "\r"); + strtok(NULL, "\r"); + + for (i=0;i<525;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 2: + { + if ( !_strnicmp(test_string, "wea", 3) ) + { + p2DEvents[i].uType = BuildingType_WeaponShop; + break; + } + if ( !_strnicmp(test_string, "arm", 3) ) + { + p2DEvents[i].uType = BuildingType_ArmorShop; + break; + } + if ( !_strnicmp(test_string, "mag", 3) ) + { + p2DEvents[i].uType = BuildingType_MagicShop; + break; + } + if ( !_strnicmp(test_string, "alc", 3) ) + { + p2DEvents[i].uType = BuildingType_AlchemistShop; + break; + } + if ( !_strnicmp(test_string, "sta", 3) ) + { + p2DEvents[i].uType = BuildingType_Stables; + break; + } + if ( !_strnicmp(test_string, "boa", 3) ) + { + p2DEvents[i].uType = BuildingType_Boats; + break; + } + if ( !_strnicmp(test_string, "tem", 3) ) + { + p2DEvents[i].uType = BuildingType_Temple; + break; + } + if ( !_strnicmp(test_string, "tra", 3) ) + { + p2DEvents[i].uType = BuildingType_Training; + break; + } + if ( !_strnicmp(test_string, "tow", 3) ) + { + p2DEvents[i].uType = BuildingType_TownHall; + break; + } + + if ( !_strnicmp(test_string, "tav", 3) ) + { + p2DEvents[i].uType = BuildingType_Tavern; + break; + } + if ( !_strnicmp(test_string, "ban", 3) ) + { + p2DEvents[i].uType = BuildingType_Bank; + break; + } + if ( !_strnicmp(test_string, "fir", 3) ) + { + p2DEvents[i].uType = BuildingType_FireGuild; + break; + } + if ( !_strnicmp(test_string, "air", 3) ) + { + p2DEvents[i].uType = BuildingType_AirGuild; + break; + } + if ( !_strnicmp(test_string, "wat", 3) ) + { + p2DEvents[i].uType = BuildingType_WaterGuild; + break; + } + if ( !_strnicmp(test_string, "ear", 3) ) + { + p2DEvents[i].uType = BuildingType_EarthGuild; + break; + } + if ( !_strnicmp(test_string, "spi", 3) ) + { + p2DEvents[i].uType = BuildingType_SpiritGuild; + break; + } + if ( !_strnicmp(test_string, "min", 3) ) + { + p2DEvents[i].uType = BuildingType_MindGuild; + break; + } + if ( !_strnicmp(test_string, "bod", 3) ) + { + p2DEvents[i].uType = BuildingType_BodyGuild; + break; + } + if ( !_strnicmp(test_string, "lig", 3) ) + { + p2DEvents[i].uType = BuildingType_LightGuild; + break; + } + if ( !_strnicmp(test_string, "dar", 3) ) + { + p2DEvents[i].uType = BuildingType_DarkGuild; + break; + } + if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6 + { + p2DEvents[i].uType = BuildingType_ElementalGuild; + break; + } + if ( !_strnicmp(test_string, "sel", 3) ) + { + p2DEvents[i].uType = BuildingType_SelfGuild; + break; + } + if ( !_strnicmp(test_string, "mir", 3) ) + { + p2DEvents[i].uType = BuildingType_16; + break; + } + if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6 + { + p2DEvents[i].uType = BuildingType_TownHall; + break; + } + p2DEvents[i].uType = BuildingType_18; + } + break; + + case 4: + p2DEvents[i].uAnimationID = atoi(test_string); + break; + case 5: + p2DEvents[i].pName = RemoveQuotes(test_string); + break; + case 6: + p2DEvents[i].pProprieterName = RemoveQuotes(test_string); + break; + case 7: + p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string); + break; + case 8: + p2DEvents[i].field_14 = atoi(test_string); + break; + case 9: + p2DEvents[i]._state = atoi(test_string); + break; + case 10: + p2DEvents[i]._rep = atoi(test_string); + break; + case 11: + p2DEvents[i]._per = atoi(test_string); + break; + case 12: + p2DEvents[i].fPriceMultiplier = atof(test_string); + break; + case 13: + p2DEvents[i].flt_24 = atof(test_string); + break; + case 15: + p2DEvents[i].field_1C = atoi(test_string); + break; + case 18: + p2DEvents[i].uOpenTime = atoi(test_string); + break; + case 19: + p2DEvents[i].uCloseTime = atoi(test_string); + break; + case 20: + p2DEvents[i].uExitPicID = atoi(test_string); + break; + case 21: + p2DEvents[i].uExitMapID = atoi(test_string); + break; + case 22: + p2DEvents[i]._quest_related = atoi(test_string); + break; + case 23: + p2DEvents[i].pEnterText = RemoveQuotes(test_string); + break; + } + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<24)&&!break_loop); + } + +} + +//----- (004BD8B5) -------------------------------------------------------- +int HouseDialogPressCloseBtn() +{ + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); + pKeyActionMap->ResetKeys(); + activeLevelDecoration = nullptr; + current_npc_text = 0; + if ( pDialogueNPCCount == 0) + return 0; + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && ShopTexture ) + { + ShopTexture->Release(); + ShopTexture = 0; + } + + switch(dialog_menu_id) + { + case -1: + _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); + BackToHouseMenu(); + break; + + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + case HOUSE_DIALOGUE_LEARN_SKILLS: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: + BackToHouseMenu(); + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + InitializaDialogueOptions(in_current_building_type); + break; + + case HOUSE_DIALOGUE_SHOP_SELL: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + case HOUSE_DIALOGUE_SHOP_REPAIR: + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; + InitializaDialogueOptions_Shops(in_current_building_type); + break; + + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: + BackToHouseMenu(); + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; + InitializaDialogueOptions_Tavern(in_current_building_type); + break; + + case HOUSE_DIALOGUE_NULL: + case HOUSE_DIALOGUE_MAIN: + pDialogueNPCCount = 0; + pDialogueWindow->Release(); + dialog_menu_id = HOUSE_DIALOGUE_NULL; + pDialogueWindow = 0; + pIcons_LOD->SyncLoadedFilesCount(); + + if ( uNumDialogueNPCPortraits == 1 ) + return 0; + + pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; + if ( uNumDialogueNPCPortraits > 0 ) + { + for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i ) + { + HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i], + pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i], + 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0); + } + } + + BackToHouseMenu(); + break; + + default: + BackToHouseMenu(); + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + InitializaDialogueOptions(in_current_building_type); + break; + } + return 1; +} + +//----- (004BF5B2) -------------------------------------------------------- +void BackToHouseMenu() +{ + pMouse->_469E24(); + if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie_Track)//!this->pSmackerMovie ) + { + bGameoverLoop = true; + HouseDialogPressCloseBtn(); + window_SpeakInHouse->Release(); + pParty->uFlags &= 0xFFFFFFFD; + if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) + { + pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0); + window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 165, 0); + window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1, 0x31, "", 0); + window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2, 0x32, "", 0); + window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3, 0x33, "", 0); + window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4, 0x34, "", 0); + } + bGameoverLoop = 0; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIHouses.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,153 @@ +#pragma once +#include "..\..\Engine/Events2D.h" + +enum HOUSE_DIALOGUE_MENU: __int32 +{ + HOUSE_DIALOGUE_NULL = 0, + HOUSE_DIALOGUE_MAIN = 1, + HOUSE_DIALOGUE_SHOP_BUY_STANDARD = 2, + HOUSE_DIALOGUE_SHOP_SELL = 3, + HOUSE_DIALOGUE_SHOP_IDENTIFY = 4, + HOUSE_DIALOGUE_SHOP_REPAIR = 5, + HOUSE_DIALOGUE_SHOP_6 = 6, + HOUSE_DIALOGUE_BANK_PUT_GOLD = 7, + HOUSE_DIALOGUE_BANK_GET_GOLD = 8, + HOUSE_DIALOGUE_9 = 9, + HOUSE_DIALOGUE_TEMPLE_HEAL = 10, + HOUSE_DIALOGUE_TEMPLE_DONATE = 11, + HOUSE_DIALOGUE_12 = 12, + HOUSE_DIALOGUE_13 = 13, + HOUSE_DIALOGUE_14 = 14, + HOUSE_DIALOGUE_TAVERN_REST = 15, + HOUSE_DIALOGUE_TAVERN_BUY_FOOD = 16, + HOUSE_DIALOGUE_TRAININGHALL_TRAIN = 17, + HOUSE_DIALOGUE_GUILD_BUY_BOOKS = 18, + //... + HOUSE_DIALOGUE_36 = 36, + //.. + HOUSE_DIALOGUE_GUILD_LEARN_SKILL = 72, + //... + HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT = 94, + HOUSE_DIALOGUE_SHOP_BUY_SPECIAL = 95, + HOUSE_DIALOGUE_LEARN_SKILLS = 96, + HOUSE_DIALOGUE_97 = 97, + HOUSE_DIALOGUE_98 = 98, + HOUSE_DIALOGUE_TOWNHALL_MESSAGE = 99, + HOUSE_DIALOGUE_TOWNHALL_PAY_FINE = 100, + HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN = 101, + HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES = 102, + HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS = 103, + HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT = 104, + HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 = 105, + HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_2 = 106, + HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_3 = 107, + HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 = 108, + HOUSE_DIALOGUE_OTHER = -1 +}; + +/* 349 */ +enum HOUSE_ID +{ + HOUSE_SMITH_EMERALD_ISLE = 1, + HOUSE_ARMOURER_EMERALD_ISLE = 15, + HOUSE_MAGE_EMERALD_ISLE = 29, + HOUSE_MAGE_HARMONDALE = 30, + HOUSE_ALCHEMIST_EMERALD_ISLE = 42, + HOUSE_ALCHEMIST_HARMONDALE = 43, + HOUSE_STABLES_HARMONDALE = 54, + HOUSE_STABLES_STEADWICK = 55, + HOUSE_STABLES_TULAREAN_FOREST = 56, + HOUSE_STABLES_DEYJA = 57, + HOUSE_STABLES_BRACADA_DESERT = 58, + HOUSE_STABLES_TATALIA = 59, + HOUSE_STABLES_AVLEE = 60, + HOUSE_STABLES_61 = 61, + HOUSE_STABLES_62 = 62, + HOUSE_BOATS_EMERALD_ISLE = 63, + HOUSE_BOATS_ERATHIA = 64, + HOUSE_BOATS_TULAREAN_FOREST = 65, + HOUSE_BOATS_BRACADA_DESERT = 66, + HOUSE_BOATS_EVENMORN_ISLAND = 67, + HOUSE_BOATS_68 = 68, + HOUSE_BOATS_TATALIA = 69, + HOUSE_BOATS_AVLEE = 70, + HOUSE_BOATS_71 = 71, + HOUSE_BOATS_72 = 72, + HOUSE_BOATS_73 = 73, + HOUSE_TEMPLE_EMERALD_ISLE = 74, + HOUSE_TEMPLE_HARMONDALE = 75, + HOUSE_TRAINING_HALL_EMERALD_ISLE = 89, + HOUSE_TRAINING_HALL_HARMONDALE = 90, + HOUSE_TRAINING_HALL_91 = 91, + HOUSE_TRAINING_HALL_92 = 92, + HOUSE_TRAINING_HALL_93 = 93, + HOUSE_TRAINING_HALL_94 = 94, + HOUSE_TRAINING_HALL_95 = 95, + + HOUSE_TOWNHALL_HARMONDALE = 102, + HOUSE_TAVERN_EMERALD_ISLE = 107, + HOUSE_BANK_HARMONDALE = 128, + HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE = 139, + HOUSE_AIR_GUILD_INITIATE_EMERALD_ISLE = 143, + HOUSE_SPIRIT_GUILD_INITIATE_EMERALD_ISLE = 155, + HOUSE_BODY_GUILD_INITIATE_EMERALD_ISLE = 163, + HOUSE_BODY_GUILD_ERATHIA = 165, + HOUSE_DARK_GUILD_PIT = 170, + HOUSE_LORD_AND_JUDGE_EMERALD_ISLE = 186, + HOUSE_JAIL = 187, + HOUSE_JUDGE_HARMONDALE = 190, + HOUSE_224_EMERALD_ISLE = 224, + HOUSE_225_EMERALD_ISLE = 225, + HOUSE_238_EMERALD_ISLE = 238, + HOUSE_466_HARMONDALE = 466, + HOUSE_467_HARMONDALE = 467, + HOUSE_468_HARMONDALE = 468, + HOUSE_472_HARMONDALE = 472, + HOUSE_488_HARMONDALE = 488, + HOUSE_489_HARMONDALE = 489, + HOUSE_600 = 600,//??? + HOUSE_601 = 601//??? +}; + +enum HouseSoundID: unsigned __int32 +{ + HouseSound_Greeting = 1, // General greeting + HouseSound_NotEnoughMoney_TrainingSuccessful = 2, + HouseSound_Greeting_2 = 3, // Polite Greeting when you're guild member + HouseSound_Goodbye = 4 // farewells when bought something +}; + +bool HouseUI_CheckIfPlayerCanInteract(); +void TrainingDialog(); +void JailDialog(); +void MagicShopDialog(); +void GuildDialog(); +void sub_4B6478(); +bool __fastcall IsTravelAvailable(int a1); +void TravelByTransport(); +void TempleDialog(); +void TownHallDialog(); +void BankDialog(); +void TavernDialog(); +void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound); // idb +void WeaponShopDialog(); +void AlchemistDialog(); +void ArmorShopDialog(); +void SimpleHouseDialog(); +void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); +void PrepareHouse(enum HOUSE_ID house); // idb +bool EnterHouse(enum HOUSE_ID uHouseID); +void BackToHouseMenu(); + + +void InitializaDialogueOptions_Tavern(BuildingType type); // idb +void InitializaDialogueOptions_Shops(BuildingType type); +void InitializaDialogueOptions(BuildingType type); +void InitializeBuildingResidents(); + +extern int uHouse_ExitPic; // weak +extern int dword_591080; // weak +extern BuildingType in_current_building_type; // 00F8B198 +extern HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C + +int HouseDialogPressCloseBtn();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIMainMenu.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,344 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "..\../Mouse.h" +#include "..\../Keyboard.h" +#include "..\../Engine/ErrorHandling.h" + +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/Graphics/Render.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/Graphics/PaletteManager.h" +#include "..\../Engine/Tables/IconFrameTable.h" +#include "..\../Engine/texts.h" +#include "..\../Engine/MMT.h" + +#include "..\../Engine/mm7_data.h" +#include "..\../Engine/Game.h" + + +//----- (0041B578) -------------------------------------------------------- +void MainMenuUI_LoadFontsAndSomeStuff() +{ + //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); + pIcons_LOD->SetupPalettes(5, 6, 5); + //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); + pPaletteManager->SetColorChannelInfo(5, 6, 5); + pPaletteManager->RecalculateAll(); + + for (uint i = 0; i < window->GetHeight(); ++i) + pSRZBufferLineOffsets[i] = window->GetWidth() * i; + + pRenderer->ResetTextureClipRect(); + + uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE); + + pFontArrus = LoadFont("arrus.fnt", "FONTPAL", nullptr); + pFontArrus->field_3 = 0; + + pFontLucida = LoadFont("lucida.fnt", "FONTPAL", nullptr); + pFontLucida->field_3 = 0; + + pFontCreate = LoadFont("create.fnt", "FONTPAL", nullptr); + pFontCreate->field_3 = 0; + + pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", nullptr); + pFontComic = LoadFont("comic.fnt", "FONTPAL", nullptr); + + for (uint i = 0; i < 20; ++i) + pWindowList[i].eWindowType = WINDOW_null; + + uNumVisibleWindows = -1; + memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs)); +} + +//----- (004415C5) -------------------------------------------------------- +static void LoadPartyBuffIcons() +{ + for (uint i = 0; i < 14; ++i) + { + char filename[200]; + sprintf(filename, "isn-%02d", i + 1); + pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); + } + + uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); + uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); +} + +//----- (0041B690) -------------------------------------------------------- +void MainMenuUI_Create() +{ + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB")); + pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA")); + + pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); + + uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); + uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); + uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE); + uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE); + uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE); + uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE); + pTexture_Leather = pIcons_LOD->LoadTexturePtr("ibground", TEXTURE_16BIT_PALETTE); + uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE); + uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE); + uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE); + + pPrimaryWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); + pPrimaryWindow->CreateButton(7, 8, 460, 343, 1, 0, UIMSG_MouseLeftClickInGame, 0, 0, "", 0); + + pPrimaryWindow->CreateButton(61, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);//buttons for portraits + pPrimaryWindow->CreateButton(177, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + pPrimaryWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + pPrimaryWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + pPrimaryWindow->CreateButton(24, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for HP + pPrimaryWindow->CreateButton(139, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); + pPrimaryWindow->CreateButton(255, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); + pPrimaryWindow->CreateButton(370, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); + + pPrimaryWindow->CreateButton(97, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for SP + pPrimaryWindow->CreateButton(212, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); + pPrimaryWindow->CreateButton(328, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); + pPrimaryWindow->CreateButton(443, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); + + uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); + pBtn_Quests = pPrimaryWindow->CreateButton(491, 353, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureHeight, 1, 0, UIMSG_OpenQuestBook, 0, pKeyActionMap->GetActionVKey(INPUT_Quest), + pGlobalTXT_LocalizationStrings[174], pIcons_LOD->GetTexture(uTextureID_ib_td1_A), 0); //Quests + + uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE); + pBtn_Autonotes = pPrimaryWindow->CreateButton(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureHeight, 1, 0, UIMSG_OpenAutonotes, 0, pKeyActionMap->GetActionVKey(INPUT_Autonotes), + pGlobalTXT_LocalizationStrings[154], pIcons_LOD->GetTexture(uTextureID_ib_td2_A), 0);//Autonotes + + uTextureID_ib_td3_A = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE); + pBtn_Maps = pPrimaryWindow->CreateButton(546, 353, pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureHeight, 1, 0, UIMSG_OpenMapBook, 0, pKeyActionMap->GetActionVKey(INPUT_Mapbook), + pGlobalTXT_LocalizationStrings[139], pIcons_LOD->GetTexture(uTextureID_ib_td3_A), 0); //Maps + + uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE); + pBtn_Calendar = pPrimaryWindow->CreateButton(570, 353, pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureHeight, 1, 0, UIMSG_OpenCalendar, 0, pKeyActionMap->GetActionVKey(INPUT_TimeCal), + pGlobalTXT_LocalizationStrings[78], pIcons_LOD->GetTexture(uTextureID_ib_td4_A), 0);//Calendar + + uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE); + pBtn_History = pPrimaryWindow->CreateButton(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureHeight, 1, 0, UIMSG_OpenHistoryBook, 0, 72,//ascii + pGlobalTXT_LocalizationStrings[602], pIcons_LOD->GetTexture(uTextureID_ib_td5_A), 0);//History + + bFlashAutonotesBook = 0; + bFlashQuestBook = 0; + bFlashHistoryBook = 0; + + pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureWidth, + pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureHeight, 2, 0, UIMSG_ClickZoomInBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomIn), + pGlobalTXT_LocalizationStrings[252], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], 0); // Zoom In + + pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureWidth, + pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureHeight, 2, 0, UIMSG_ClickZoomOutBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomOut), + pGlobalTXT_LocalizationStrings[251], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], 0); // Zoom Out + + pPrimaryWindow->CreateButton(481, 0, 153, 67, 1, 92, UIMSG_0, 0, 0, "", 0); + pPrimaryWindow->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_StartHireling1Dialogue, 0, '5', "", 0); + pPrimaryWindow->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_StartHireling2Dialogue, 0, '6', "", 0); + pPrimaryWindow->CreateButton(476, 322, 77, 17, 1, 100, UIMSG_0, 0, 0, "", 0); + pPrimaryWindow->CreateButton(555, 322, 77, 17, 1, 101, UIMSG_0, 0, 0, "", 0); + + pBtn_CastSpell = pPrimaryWindow->CreateButton(476, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureHeight, + 1, 0, UIMSG_SpellBookWindow, 0, 67, pGlobalTXT_LocalizationStrings[38], pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell), 0); + pBtn_Rest = pPrimaryWindow->CreateButton(518, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureHeight, + 1, 0, UIMSG_RestWindow, 0, 82, pGlobalTXT_LocalizationStrings[182], pIcons_LOD->GetTexture(uTextureID_Btn_Rest), 0); + pBtn_QuickReference = pPrimaryWindow->CreateButton(560, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureHeight, + 1, 0, UIMSG_QuickReference, 0, 90, pGlobalTXT_LocalizationStrings[173], pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference), 0); + pBtn_GameSettings = pPrimaryWindow->CreateButton(602, 450, + pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureHeight, + 1, 0, UIMSG_GameMenuButton, 0, 0, pGlobalTXT_LocalizationStrings[93], pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings), 0); + + pBtn_NPCLeft = pPrimaryWindow->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 = pPrimaryWindow->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); + LoadPartyBuffIcons(); +} + + + + +//----- (00452AF3) -------------------------------------------------------- +void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels) +{ + void *v3; // edi@1 + unsigned int v4; // eax@1 + unsigned __int16 *v5; // edi@3 + unsigned int i; // ecx@3 + + if (for_refactoring) + { + MessageBoxA(nullptr, "Nomad: sub operates on 16 bit pixels, we have 32 bits.", "", 0); + __debugbreak(); + } + + v3 = pPixels; + v4 = a1 | (a1 << 16); + if ( (unsigned __int8)pPixels & 2 ) // first 2 pixels + { + *pPixels = v4; + v3 = pPixels + 1; + --uNumPixels; + } + memset32(v3, v4, uNumPixels >> 1); // 4 pixels at once + v5 = (unsigned __int16 *)((char *)v3 + 4 * (uNumPixels >> 1)); + for ( i = uNumPixels & 1; i; --i ) // leftover pixels + { + *v5 = v4; + ++v5; + } +} + +//----- (004979D2) -------------------------------------------------------- +MENU_STATE MainMenuUI_Credits_Loop() +{ + char *cred_texturet; // edi@5 + FILE *pFile; // eax@5 + unsigned int pSize; // esi@7 + MSG Msg; // [sp+84h] [bp-B8h]@10 + GUIWindow credit_window; + int move_Y; // [sp+128h] [bp-14h]@1 + char *pString; // [sp+12Ch] [bp-10h]@9 + GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 + GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 + RGBTexture mm6title_texture; // [sp+54h] [bp-E8h]@1 + RGBTexture cred_texture; // [sp+100h] [bp-3Ch]@1 + Texture pTemporaryTexture; // [sp+Ch] [bp-130h]@5 + + pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); + pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); + + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + //dword_A74C88 = 0;//??? часть дальнейшего кода отсутствует, там использовалась данная переменная + + pAudioPlayer->PlayMusicTrack(MUSIC_Credits); + + mm6title_texture.Load("mm6title.pcx", 0); + cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); + pFile = pEvents_LOD->FindContainer("credits.txt", 0); + if ( !pFile ) + Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. + + // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." + + //для получения размера----------------------- + fread(&pTemporaryTexture, 1, 0x30, pFile); + pSize = pTemporaryTexture.uDecompressedSize; + if ( !pSize ) + pSize = pTemporaryTexture.uTextureSize; + memset(&pTemporaryTexture, 0, 0x48);//обнуление + cred_texturet[pSize] = 0;//конец текста + + credit_window.uFrameWidth = 250; + credit_window.uFrameHeight = 440; + credit_window.uFrameX = 389; + credit_window.uFrameY = 19; + + cred_texture.uWidth = 250; + cred_texture.uHeight = pFontQuick->GetStringHeight2(pFontCChar, cred_texturet, &credit_window, 0, 1) + 2 * credit_window.uFrameHeight; + cred_texture.uNumPixels = cred_texture.uWidth * cred_texture.uHeight; + cred_texture.pPixels = (unsigned __int16 *)malloc(2 * cred_texture.uNumPixels); + fill_pixels_fast(Color16(0, 0xFFu, 0xFFu), cred_texture.pPixels, cred_texture.uNumPixels); + cred_texture._allocation_flags = 0; + + //дать шрифт и цвета тексту + pString = (char *)malloc(2 * pSize); + strncpy(pString, cred_texturet, pSize); + pString[pSize] = 0; + pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, cred_texture.uWidth, + cred_texture.uHeight, Color16(0x70u, 0x8Fu, 0xFEu), Color16(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth); + free(pString); + + pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, cred_texturet); + pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); + pCurrentScreen = SCREEN_CREATORS; + SetCurrentMenuID(MENU_CREDITSPROC); + + move_Y = 0; + do + { + while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) + { + if ( Msg.message == 18 ) + Game_DeinitializeAndTerminate(0); + TranslateMessage(&Msg); + DispatchMessageA(&Msg); + } + if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) + { + WaitMessage(); + } + else + { + pRenderer->BeginScene(); + pRenderer->DrawTextureRGB(0, 0, &mm6title_texture); + pRenderer->SetTextureClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth, + credit_window.uFrameY + credit_window.uFrameHeight); + pRenderer->CreditsTextureScroll(credit_window.uFrameX, credit_window.uFrameY, 0, move_Y, &cred_texture); + pRenderer->ResetTextureClipRect(); + pRenderer->EndScene(); + ++move_Y; + if ( move_Y >= cred_texture.uHeight ) + SetCurrentMenuID(MENU_MAIN); + pRenderer->Present(); + pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() + GUI_MainMenuMessageProc(); + } + } + while ( GetCurrentMenuID() == MENU_CREDITSPROC ); + pAudioPlayer->_4AA258(1); + free(cred_texturet); + free(pFontQuick); + free(pFontCChar); + pWindow_MainMenu->Release(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); + mm6title_texture.Release(); + cred_texture.Release(); + return MENU_MAIN; // return MENU_Main +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIMainMenu.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,1 @@ +#pragma once \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIMsgProc.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,1 @@ +#pragma once \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIOptions.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,249 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "..\../Engine/MM7.h" + +#include "..\../Keyboard.h" +#include "..\../Engine/Graphics/IndoorCameraD3D.h" +#include "..\../Engine/Graphics/GammaControl.h" +#include "..\../Engine/Graphics/Render.h" + +#include "..\../Engine/Game.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/texts.h" + +#include "..\../Engine/mm7_data.h" + + + + +OptionsMenuSkin options_menu_skin; // 507C60 + + +std::array<bool, 28> GameMenuUI_InvaligKeyBindingsFlags; // 506E6C +//----- (00414D24) -------------------------------------------------------- +static unsigned int GameMenuUI_GetKeyBindingColor(int key_index) +{ + if (uGameMenuUI_CurentlySelectedKeyIdx == key_index) + { + if (GetTickCount() % 1000 < 500) + return ui_gamemenu_keys_key_selection_blink_color_1; + else + return ui_gamemenu_keys_key_selection_blink_color_2; + } + else if (GameMenuUI_InvaligKeyBindingsFlags[key_index]) + { + int intensity; + + int time = GetTickCount() % 800; + if (time < 400) + intensity = - 70 + 70 * time / 400; + else + intensity = + 70 - 70 * time / 800; + + return Color16(185 + intensity, 40 + intensity / 4, 40 + intensity / 4); + } + + return ui_gamemenu_keys_key_default_color; +} + +//----- (004142D3) -------------------------------------------------------- +void GameMenuUI_DrawKeyBindings() +{ + signed int v4; // ecx@7 + signed int v5; // eax@8 + + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + pPrevVirtualCidesMapping[uGameMenuUI_CurentlySelectedKeyIdx] = pKeyActionMap->pPressedKeysBuffer[0]; + memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); + v4 = 0; + do + { + v5 = 0; + do + { + if ( v4 != v5 && pPrevVirtualCidesMapping[v4] == pPrevVirtualCidesMapping[v5] ) + { + GameMenuUI_InvaligKeyBindingsFlags[v4] = true; + GameMenuUI_InvaligKeyBindingsFlags[v5] = true; + } + ++v5; + } + while ( v5 < 28 ); + ++v4; + } + while ( v4 < 28 ); + uGameMenuUI_CurentlySelectedKeyIdx = -1; + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + } + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Optkb[0]));//draw base texture + if ( KeyboardPageNum == 1 ) + { + pRenderer->DrawTextureIndexed(19, 302, pIcons_LOD->GetTexture(uTextureID_Optkb[3])); + + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "ВПЕРЁД", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(0), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "НАЗАД", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(1), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[1]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ВЛЕВО", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(2), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[2]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "ВПРАВО", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(3), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[3]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "КРИК", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(4), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[4]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "ПРЫЖОК", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(5), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[5]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "П.РЕЖИМ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(6), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[6]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "ПРИМ. ЗАКЛ.", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(7), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[7]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "АТАКА", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(8), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[8]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ДЕЙСТВ.", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(9), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[9]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ЗАКЛИН.", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(10), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[10]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "ИГРОК", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(11), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[11]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "СЛЕД. ИГРОК", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(12), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[12]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ЗАДАНИЯ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(13), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[13]), 0, 0, 0); + } + else + { + pRenderer->DrawTextureIndexed(127, 302, pIcons_LOD->GetTexture(uTextureID_Optkb[4])); + + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "Б. СПРАВКА", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(14), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "ОТДЫХ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(15), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[15]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ТЕК. ВРЕМЯ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(16), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[16]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "АВТОЗАМЕТКИ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(17), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[17]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "КАРТА", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(18), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[18]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "БЕЖАТЬ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(19), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[19]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "СМ. ВВЕРХ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(20), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[20]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "СМ. ВНИЗ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(21), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[21]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "СМ. ВПЕРЁД", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(22), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[22]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ПРИБЛИЗ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(23), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[23]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ОТДАЛИТЬ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(24), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[24]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "П. ВВЕРХ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(25), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[25]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "П. ВНИЗ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(26), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[26]), 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ПРИЗЕМЛ", 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(27), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[27]), 0, 0, 0); + } +} + +//----- (00414D9A) -------------------------------------------------------- +void GameMenuUI_DrawVideoOptions() +{ + GUIWindow msg_window; // [sp+8h] [bp-54h]@3 + + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(optvid_base_texture_id));//draw base texture + //if ( !pRenderer->bWindowMode && pRenderer->IsGammaSupported() ) + { + pRenderer->DrawTextureIndexed(17 * uGammaPos + 42, 162, pIcons_LOD->GetTexture(pTextureIDs_GammaPositions[uGammaPos])); + pRenderer->DrawTextureRGB(274, 169, &stru_506E40);//review_window + msg_window.uFrameX = 22; + msg_window.uFrameY = 190; + msg_window.uFrameWidth = 211; + msg_window.uFrameHeight = 79; + msg_window.uFrameZ = 232; + msg_window.uFrameW = 268; + msg_window.DrawTitleText(pFontSmallnum, 0, 0, ui_gamemenu_video_gamma_title_color, pGlobalTXT_LocalizationStrings[226], 3); // "Gamma controls the relative ""brightness"" of the game. May vary depending on your monitor." + } + + /*if (!pRenderer->pRenderD3D) + { + pRenderer->DrawTextureIndexed(20, 281, pIcons_LOD->GetTexture(not_available_bloodsplats_texture_id)); + pRenderer->DrawTextureIndexed(20, 303, pIcons_LOD->GetTexture(not_available_us_colored_lights_texture_id)); + pRenderer->DrawTextureIndexed(20, 325, pIcons_LOD->GetTexture(not_available_tinting_texture_id)); + } + else*/ + { + if (pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS) + pRenderer->DrawTextureIndexed(20, 281, pIcons_LOD->GetTexture(bloodsplats_texture_id)); + if (pRenderer->bUseColoredLights) + pRenderer->DrawTextureIndexed(20, 303, pIcons_LOD->GetTexture(us_colored_lights_texture_id)); + if (pRenderer->bTinting) + pRenderer->DrawTextureIndexed(20, 325, pIcons_LOD->GetTexture(tinting_texture_id)); + } +} + +//----- (00414F82) -------------------------------------------------------- +void GameMenuUI_Options_Draw() +{ + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Options)); + pRenderer->DrawTextureIndexed(8, 132, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_Background)); + + switch (uTurnSpeed) + { + case 64: pRenderer->DrawTextureIndexed(BtnTurnCoord[1], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])); break; + case 128: pRenderer->DrawTextureIndexed(BtnTurnCoord[2], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])); break; + default: pRenderer->DrawTextureIndexed(BtnTurnCoord[0], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])); break; + } + + if (bWalkSound) pRenderer->DrawTextureIndexed( 20, 303, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)); + if (bShowDamage) pRenderer->DrawTextureIndexed(128, 303, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)); + if (bFlipOnExit) pRenderer->DrawTextureIndexed(128, 325, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)); + if (bAlwaysRun) pRenderer->DrawTextureIndexed( 20, 325, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)); + + pRenderer->DrawTextureIndexed(265 + 17 * uSoundVolumeMultiplier, 162, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_SoundLevels[uSoundVolumeMultiplier])); + pRenderer->DrawTextureIndexed(265 + 17 * uMusicVolimeMultiplier, 216, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_SoundLevels[uMusicVolimeMultiplier])); + pRenderer->DrawTextureIndexed(265 + 17 * uVoicesVolumeMultiplier, 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_SoundLevels[uVoicesVolumeMultiplier])); +} + +OptionsMenuSkin::OptionsMenuSkin(): + uTextureID_Background(0), + uTextureID_ArrowLeft(0), + uTextureID_ArrowRight(0), + uTextureID_unused_0(0), uTextureID_unused_1(0), uTextureID_unused_2(0), + uTextureID_FlipOnExit(0), + uTextureID_AlwaysRun(0), + uTextureID_WalkSound(0), + uTextureID_ShowDamage(0) +{ + for (uint i = 0; i < 3; ++i) uTextureID_TurnSpeed[i] = 0; + for (uint i = 0; i < 10; ++i) uTextureID_SoundLevels[i] = 0; +} + +void OptionsMenuSkin::Relaease() +{ + #define RELEASE(id) \ + {\ + if (id)\ + pIcons_LOD->GetTexture(id)->Release();\ + id = 0;\ + } + + RELEASE(uTextureID_Background); + for (uint i = 0; i < 3; ++i) + RELEASE(uTextureID_TurnSpeed[i]); + RELEASE(uTextureID_ArrowLeft); + RELEASE(uTextureID_ArrowRight); + RELEASE(uTextureID_FlipOnExit); + for (uint i = 0; i < 10; ++i) + RELEASE(uTextureID_SoundLevels[i]); + RELEASE(uTextureID_AlwaysRun); + RELEASE(uTextureID_WalkSound); + RELEASE(uTextureID_ShowDamage); + + #undef RELEASE +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIOptions.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,1 @@ +#pragma once \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIPartyCreation.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,736 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "UIPartyCreation.h" +#include "..\../Mouse.h" +#include "..\../Keyboard.h" +#include "..\../Engine/ErrorHandling.h" + +#include "..\../Engine/Game.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Party.h" +#include "..\../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/mm7_data.h" + + + +//----- (004908DE) -------------------------------------------------------- +bool PlayerCreation_Choose4Skills() +{ + signed int skills_count; // edx@2 + + for ( uint j = 0; j < 4; ++j ) + { + skills_count = 0; + for ( uint i = 0; i < 37; ++i ) + { + if ( pParty->pPlayers[j].pActiveSkills[i] ) + ++skills_count; + } + if ( skills_count < 4 ) + return false; + } + return true; +} + +//----- (00491CB5) -------------------------------------------------------- +void LoadPlayerPortraintsAndVoices() +{ + pIcons_LOD->pFacesLock = pIcons_LOD->uNumLoadedFiles; + + for (uint i = 0; i < 4; ++i) + for (uint j = 0; j < 56; ++j) + { + sprintf(pTmpBuf.data(), "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uCurrentFace], j + 1); + pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + } + + pTexture_PlayerFaceEradicated = pIcons_LOD->LoadTexturePtr("ERADCATE", TEXTURE_16BIT_PALETTE); + pTexture_PlayerFaceDead = pIcons_LOD->LoadTexturePtr("DEAD", TEXTURE_16BIT_PALETTE); + pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE); + + if (SoundSetAction[24][0]) + for (uint i = 0; i < 4; ++i) + { + pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998, 0); + pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999, 0); + } +} + +//----- (00491DE7) -------------------------------------------------------- +void ReloadPlayerPortraits(int player_id, int face_id)//the transition from the zombies in the normal state +{ + for ( uint i = 0; i <= 55; ++i ) + { + sprintf(pTmpBuf.data(), "%s%02d", pPlayerPortraitsNames[face_id], i + 1); + pIcons_LOD->ReloadTexture(pTextures_PlayerFaces[player_id][i], pTmpBuf.data(), 2); + } +} +//----- (00495B39) -------------------------------------------------------- +void PlayerCreationUI_Draw() +{ + int pTextCenter; // eax@3 + IconFrame *pFrame; // eax@3 + int pX; // ecx@7 + GUIButton *uPosActiveItem; // edi@12 + int v17; // eax@33 + int uStatLevel; // eax@44 + unsigned int pStatColor; // eax@44 + PLAYER_SKILL_TYPE pSkillsType; // eax@44 + PLAYER_CLASS_TYPE uClassType; // edi@53 + int pColorText; // eax@53 + PLAYER_SKILL_TYPE pSkillId; // edi@72 + size_t pLenText; // eax@72 + signed int v104; // ecx@72 +// int pTextY; // ST08_4@81 + signed int pBonusNum; // edi@82 + const char *uRaceName; // [sp+0h] [bp-170h]@39 + char pText[200]; // [sp+10h] [bp-160h]@14 + GUIWindow message_window; // [sp+D8h] [bp-98h]@83 + int v126; // [sp+148h] [bp-28h]@25 + int pIntervalY; // [sp+150h] [bp-20h]@14 + int pX_Numbers; // [sp+154h] [bp-1Ch]@18 + int uX; // [sp+160h] [bp-10h]@18 + int pIntervalX; + int pCorrective; + + //move sky + pRenderer->BeginScene(); + pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); + uPlayerCreationUI_SkySliderPos = (GetTickCount() % 12800) / 20; + pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY); + pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos - window->GetWidth(), 2, pTexture_MAKESKY); + pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP); + + uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7; + switch (uPlayerCreationUI_SelectedCharacter) + { + case 0: pX = 12; break; + case 1: pX = 171; break; + case 2: pX = 329; break; + case 3: pX = 488; break; + default: + Error("Invalid selected character"); + } + + pTextCenter = pFontCChar->AlignText_Center(window->GetWidth(), pGlobalTXT_LocalizationStrings[51]); + pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, pGlobalTXT_LocalizationStrings[51], 0, 0, 0);//С О З Д А Т Ь О Т Р Я Д + pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uCurrentFace]); + pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uCurrentFace]); + pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uCurrentFace]); + pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uCurrentFace]); + pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime); + + + pRenderer->DrawTextureTransparent(pX, 29, &pIcons_LOD->pTextures[pFrame->uTextureID]); + uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem); + uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25; + pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]); + pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]); + + memset(pText, 0, 200); + strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills" + for ( int i = strlen(pText) - 1; i >= 0; i-- )//??? + pText[i] = toupper((unsigned __int8)pText[i]); + + pIntervalX = 18; + pIntervalY = pFontCreate->uFontHeight - 2; + uX = 32; + pX_Numbers = 493; + + for (int i = 0; i < 4; ++i) + { + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pIntervalX + 73, 100, 0, pClassNames[pParty->pPlayers[i].classType], 0, 0, 0); + pRenderer->DrawTextureTransparent(pIntervalX + 77, 50, pTexture_IC_KNIGHT[pParty->pPlayers[i].classType / 4]); + + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_NONE && pGUIWindow_CurrentMenu->ptr_1C == (void *)i ) + { + switch ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 ) + { + case WINDOW_INPUT_IN_PROGRESS://press name panel + v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, pKeyActionMap->pPressedKeysBuffer, 120, 1); + pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate); + break; + case WINDOW_INPUT_CONFIRMED: // press enter + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + v126 = 0; + for ( int i = 0; i < strlen(pKeyActionMap->pPressedKeysBuffer); ++i )//edit name + { + if ( pKeyActionMap->pPressedKeysBuffer[i] == ' ' ) + ++v126; + } + if ( strlen(pKeyActionMap->pPressedKeysBuffer) && v126 != strlen(pKeyActionMap->pPressedKeysBuffer) ) + strcpy(pParty->pPlayers[i].pName, pKeyActionMap->pPressedKeysBuffer); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0); + pParty->pPlayers[i].field_1988[27] = 1; + break; + case WINDOW_INPUT_CANCELLED: // press escape + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0); + SetCurrentMenuID(MENU_NAMEPANELESC); + break; + } + } + else + { + pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0); + } + + switch (pParty->pPlayers[i].GetRace()) + { + case 0: uRaceName = pGlobalTXT_LocalizationStrings[99]; break; // "Human" + case 1: uRaceName = pGlobalTXT_LocalizationStrings[103]; break; // "Dwarf" + case 2: uRaceName = pGlobalTXT_LocalizationStrings[106]; break; // "Goblin" + case 3: uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Elf" + }; + strcpy(pTmpBuf.data(), uRaceName); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX + 72, pIntervalY + 12, 0, pTmpBuf.data(), 130, 0);//Race Name + + pTextCenter = pFontCreate->AlignText_Center(150, pText); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + uX - 24, 291, Color16(0xD1, 0xBB, 0x61), pText, 0, 0, 0); // Skills + + uStatLevel = pParty->pPlayers[i].GetActualMight(); + sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], pX_Numbers, uStatLevel);// "Might" + pStatColor = pParty->pPlayers[i].GetStatColor(0); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, pStatColor, pTmpBuf.data(), 0, 0, 0); + + uStatLevel = pParty->pPlayers[i].GetActualIntelligence(); + sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], pX_Numbers, uStatLevel);// "Intellect" + pStatColor = pParty->pPlayers[i].GetStatColor(1); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); + + uStatLevel = pParty->pPlayers[i].GetActualWillpower(); + sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], pX_Numbers, uStatLevel);// "Personality" + pStatColor = pParty->pPlayers[i].GetStatColor(2); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); + + uStatLevel = pParty->pPlayers[i].GetActualEndurance(); + sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], pX_Numbers, uStatLevel);// "Endurance" + pStatColor = pParty->pPlayers[i].GetStatColor(3); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 3 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); + + uStatLevel = pParty->pPlayers[i].GetActualAccuracy(); + sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], pX_Numbers, uStatLevel);// "Accuracy" + pStatColor = pParty->pPlayers[i].GetStatColor(4); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); + + uStatLevel = pParty->pPlayers[i].GetActualSpeed(); + sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], pX_Numbers, uStatLevel);// "Speed" + pStatColor = pParty->pPlayers[i].GetStatColor(5); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 5 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); + + uStatLevel = pParty->pPlayers[i].GetActualLuck(); + sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], pX_Numbers, uStatLevel);// "Luck" + pStatColor = pParty->pPlayers[i].GetStatColor(6); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 6 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); + + + pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(0); + pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); + sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, Color16(0xFF, 0xFF, 0xFF), pTmpBuf.data(), 0, 0, 0); + + pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(1); + pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); + sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, pIntervalY + 311, Color16(0xFF, 0xFF, 0xFF), pTmpBuf.data(), 0, 0, 0); + + pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(2); + pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); + sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); + pColorText = Color16(0, 0xFF, 0); + if ( (signed int)pSkillsType >= 37 ) + pColorText = Color16(0, 0xF7, 0xF7); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0); + + pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(3); + pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); + sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); + pColorText = Color16(0, 0xFF, 0); + if ( (signed int)pSkillsType >= 37 ) + pColorText = Color16(0, 0xF7, 0xF7); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 3 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0); + + pIntervalX += 159; + pX_Numbers -= 158; + uX += 158; + } + + strcpy(pText, pGlobalTXT_LocalizationStrings[41]);// "Class" + for ( int i = strlen(pText) - 1; i >= 0; i-- ) + pText[i] = toupper((unsigned __int8)pText[i]); + + uClassType = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].classType; + pTextCenter = pFontCreate->AlignText_Center(193, pText); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 324, 395, Color16(0xD1, 0xBB, 0x61), pText, 0, 0, 0);//Classes + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[0]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 417, pColorText, pClassNames[0], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_PALADIN ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[12]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, pIntervalY + 417, pColorText, pClassNames[12], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_DRUID ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[20]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 2 * pIntervalY + 417, pColorText, pClassNames[20], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_CLERIC ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[24]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 417, pColorText, pClassNames[24], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_DRUID) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[28]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, pIntervalY + 417, pColorText, pClassNames[28], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_SORCERER ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[32]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 2 * pIntervalY + 417, pColorText, pClassNames[32], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_ARCHER ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[16]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 417, pColorText, pClassNames[16], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_MONK ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[8]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, pIntervalY + 417, pColorText, pClassNames[8], 0, 0, 0); + + pColorText = Color16(0, 0xF7, 0xF7); + if ( uClassType != PLAYER_CLASS_THEIF ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[4]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 2 * pIntervalY + 417, pColorText, pClassNames[4], 0, 0, 0); + + pTextCenter = pFontCreate->AlignText_Center(236, pGlobalTXT_LocalizationStrings[20]); // "Available Skills" + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 37, 395, Color16(0xD1, 0xBB, 0x61), pGlobalTXT_LocalizationStrings[20], 0, 0, 0); + for (uint i = 0; i < 9; ++i) + { + pSkillId = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(i + 4); + strcpy(pText, pSkillNames[pSkillId]); + pLenText = strlen(pText); + v104 = 0; + if ( (signed int)pLenText > 0 ) + { + if ( pText[v104] == 32 ) + { + pText[v104] = 0; + } + else + { + while ( pText[v104] != 32 ) + { + ++v104; + if ( v104 >= (signed int)pLenText ) + break; + } + } + } + pCorrective = -10;//-5 + if ( (signed int)pLenText < 8 )//if ( (signed int)v124 > 2 ) + pCorrective = 0; + pColorText = Color16(0, 0xF7, 0xF7); + if ( !pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pSkillId] ) + pColorText = Color16(0xFF, 0xFF, 0xFF); + pTextCenter = pFontCreate->AlignText_Center(100, pText); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 100 * (i / 3) + pTextCenter + pCorrective + 17, pIntervalY * (i % 3) + 417, pColorText, pText, 0, 0, 0); + } + + pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus" + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, Color16(0xD1, 0xBB, 0x61), pGlobalTXT_LocalizationStrings[30], 0, 0, 0); + pBonusNum = PlayerCreation_GetUnspentAttributePointCount(); + sprintf(pTmpBuf.data(), "%d", pBonusNum); + pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf.data()); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, Color16(0xFF, 0xFF, 0xFF), pTmpBuf.data(), 0, 0, 0); + if ( GameUI_Footer_TimeLeft > GetTickCount() ) + { + message_window.Hint = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points." + if ( pBonusNum < 0 ) + message_window.Hint = pGlobalTXT_LocalizationStrings[413];// "You can't spend more than 50 points." + message_window.uFrameWidth = 300; + message_window.uFrameHeight = 100; + message_window.uFrameX = 170; + message_window.uFrameY = 140; + message_window.uFrameZ = 469; + message_window.uFrameW = 239; + message_window.DrawMessageBox(0); + } + pRenderer->EndScene(); +} + +//----- (0049695A) -------------------------------------------------------- +void PlayerCreationUI_Initialize() +{ + unsigned int v0; // ebx@5 + signed int uControlParam; // [sp+10h] [bp-Ch]@7 + signed int uX; // [sp+14h] [bp-8h]@5 + + pMessageQueue_50CBD0->Flush(); + + pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + pCurrentScreen = SCREEN_PARTY_CREATION; + uPlayerCreationUI_ArrowAnim = 0; + uPlayerCreationUI_SkySliderPos = 0; + uPlayerCreationUI_SelectedCharacter = 0; + v0 = LOBYTE(pFontCreate->uFontHeight) - 2; + pTexture_IC_KNIGHT[0] = pIcons_LOD->LoadTexturePtr("IC_KNIGHT", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[1] = pIcons_LOD->LoadTexturePtr("IC_THIEF", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[2] = pIcons_LOD->LoadTexturePtr("IC_MONK", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[3] = pIcons_LOD->LoadTexturePtr("IC_PALAD", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[4] = pIcons_LOD->LoadTexturePtr("IC_ARCH", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[5] = pIcons_LOD->LoadTexturePtr("IC_RANGER", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[6] = pIcons_LOD->LoadTexturePtr("IC_CLER", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[7] = pIcons_LOD->LoadTexturePtr("IC_DRUID", TEXTURE_16BIT_PALETTE); + pTexture_IC_KNIGHT[8] = pIcons_LOD->LoadTexturePtr("IC_SORC", TEXTURE_16BIT_PALETTE); + pTexture_MAKETOP = pIcons_LOD->LoadTexturePtr("MAKETOP", TEXTURE_16BIT_PALETTE); + pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE); + for( uX = 0; uX < 22; ++uX ) // load PlayerPortraits texture + { + sprintf(pTmpBuf.data(), "%s01", pPlayerPortraitsNames[uX]); + pPlayerPortraits[uX] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE)]; + + } + pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE); + pTexture_buttminu = pIcons_LOD->LoadTexturePtr("buttminu", TEXTURE_16BIT_PALETTE); + pTexture_buttplus = pIcons_LOD->LoadTexturePtr("buttplus", TEXTURE_16BIT_PALETTE); + pTexture_pressrigh = pIcons_LOD->LoadTexturePtr("presrigh", TEXTURE_16BIT_PALETTE); + pTexture_presleft = pIcons_LOD->LoadTexturePtr("presleft", TEXTURE_16BIT_PALETTE); + uControlParam = 1; + do + { + sprintf(pTmpBuf.data(), "arrowl%d", uControlParam); + pTextures_arrowl[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + + sprintf(pTmpBuf.data(), "arrowr%d", uControlParam); + pTextures_arrowr[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + } + while ( ++uControlParam < 20 ); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); + uControlParam = 0; + uX = 8; + do + { + pGUIWindow_CurrentMenu->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_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_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_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); + + 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); + 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); + + 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); + uControlParam += 7; + uX += 158; + } + while ( (signed int)uControlParam < 30 ); + pGUIWindow_CurrentMenu->_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); + + uControlParam = 0; + do + { + 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, + 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); + + pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); +} +// 4E28F8: using guessed type int pCurrentScreen; + +//----- (0049750E) -------------------------------------------------------- +void DeleteCCharFont() +{ + free(pFontCChar); + pFontCChar = 0; +} +//----- (00497526) -------------------------------------------------------- +bool PlayerCreationUI_Loop() +{ + LONG uMouseX; // edi@6 + LONG uMouseY; // eax@6 + //GUIButton *pControlsHead; // edx@6 + //int pControlParam; // esi@12 + signed int v8; // edi@30 + int v9; // edx@31 +// char *v10; // ebx@37 + ItemGen item; // [sp+Ch] [bp-74h]@37 + char v20[32]; // [sp+30h] [bp-50h]@29 + MSG Msg; // [sp+50h] [bp-30h]@17 + POINT v25; // [sp+6Ch] [bp-14h]@6 + bool party_not_creation_flag; // [sp+74h] [bp-Ch]@1 + + party_not_creation_flag = false; + pTexture_PCX.Release(); + pTexture_PCX.Load("makeme.pcx", 0); + + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + SetCurrentMenuID(MENU_CREATEPARTY); + while ( GetCurrentMenuID() == MENU_CREATEPARTY ) + { + uMouseX = pMouse->GetCursorPos(&v25)->x; + uMouseY = pMouse->GetCursorPos(&v25)->y; + //pControlsHead = pGUIWindow_CurrentMenu->pControlsHead; + + //does nothing actually + /*if ( pControlsHead != (GUIButton *)v1 ) + { + pNumMessage = pMessageQueue_50CBD0->uNumMessages; + do + { + if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ + && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement + { + pControlParam = pControlsHead->uControlParam; + pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0); + v1 = 0; + } + pControlsHead = pControlsHead->pNext; + } + while ( pControlsHead != (GUIButton *)v1 ); + }*/ + + while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) ) + { + if ( Msg.message == WM_QUIT ) + Game_DeinitializeAndTerminate(0); + TranslateMessage(&Msg); + DispatchMessageA(&Msg); + } + if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) + WaitMessage(); + else + { + PlayerCreationUI_Draw(); + GUI_MainMenuMessageProc(); + pRenderer->BeginScene(); + GUI_UpdateWindows(); + pRenderer->EndScene(); + pRenderer->Present(); + if ( uGameState == GAME_FINISHED )//if click Esc in PlayerCreation Window + { + party_not_creation_flag = true; + SetCurrentMenuID(MENU_MAIN); + continue; + } + if ( uGameState == GAME_STATE_STARTING_NEW_GAME )//if click OK in PlayerCreation Window + { + uGameState = GAME_STATE_PLAYING; + SetCurrentMenuID(MENU_NEWGAME); + continue; + } + } + } + pTexture_PCX.Release(); + pGUIWindow_CurrentMenu->Release(); + pIcons_LOD->RemoveTexturesPackFromTextureList(); + + memset(v20, 0, 32); + for ( int i = 0; i < 32; i++ ) + { + for ( v8 = 0; v8 < 10; ++v8 ) + { + v9 = rand() % 32; + if ( !v20[v9] ) + break; + } + if ( v8 == 10 ) + { + v9 = 0; + if ( v20[0] ) + { + do + ++v9; + while ( v20[v9] ); + } + } + pParty->field_854[i] = v9; + v20[v9] = 1; + } + + item.Reset(); + for (uint i = 0; i < 4; ++i) + { + if (pParty->pPlayers[i].classType == PLAYER_CLASS_KNIGHT) + pParty->pPlayers[i].sResMagicBase = 10; + pParty->pPlayers[i].pPlayerBuffs[22].uExpireTime = 0; + for (uint j = 0; j < 9; j++) + { + if (pParty->pPlayers[i].pActiveSkills[PLAYER_SKILL_FIRE + j]) + { + pParty->pPlayers[i].lastOpenedSpellbookPage = j; + break; + } + } + pItemsTable->GenerateItem(2, 40, &item); + pParty->pPlayers[i].AddItem2(-1, &item); + + pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); + pParty->pPlayers[i].sMana = pParty->pPlayers[i].GetMaxMana(); + for (uint j = 0; j < 37; ++j) + { + if (!pParty->pPlayers[i].pActiveSkills[j]) + continue; + + switch (j) + { + case PLAYER_SKILL_STAFF: pParty->pPlayers[i].AddItem(-1, 61); break; + case PLAYER_SKILL_SWORD: pParty->pPlayers[i].AddItem(-1, 1); break; + case PLAYER_SKILL_DAGGER: pParty->pPlayers[i].AddItem(-1, 15); break; + case PLAYER_SKILL_AXE: pParty->pPlayers[i].AddItem(-1, 23); break; + case PLAYER_SKILL_SPEAR: pParty->pPlayers[i].AddItem(-1, 31); break; + case PLAYER_SKILL_BOW: pParty->pPlayers[i].AddItem(-1, 47); break; + case PLAYER_SKILL_MACE: pParty->pPlayers[i].AddItem(-1, 50); break; + case PLAYER_SKILL_BLASTER: Error("No blasters at startup :p"); + case PLAYER_SKILL_SHIELD: pParty->pPlayers[i].AddItem(-1, 84); break; + case PLAYER_SKILL_LEATHER: pParty->pPlayers[i].AddItem(-1, 66); break; + case PLAYER_SKILL_CHAIN: pParty->pPlayers[i].AddItem(-1, 71); break; + case PLAYER_SKILL_PLATE: pParty->pPlayers[i].AddItem(-1, 76); break; + case PLAYER_SKILL_FIRE: + pParty->pPlayers[i].AddItem(-1, 0x191); + pParty->pPlayers[i].spellbook.pFireSpellbook.bIsSpellAvailable[0] = true; + break; + case PLAYER_SKILL_AIR: + pParty->pPlayers[i].AddItem(-1, 0x19C); + pParty->pPlayers[i].spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; + break; + case PLAYER_SKILL_WATER: + pParty->pPlayers[i].AddItem(-1, 0x1A7); + pParty->pPlayers[i].spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; + break; + case PLAYER_SKILL_EARTH: + pParty->pPlayers[i].AddItem(-1, 0x1B2); + pParty->pPlayers[i].spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; + break; + case PLAYER_SKILL_SPIRIT: + pParty->pPlayers[i].AddItem(-1, 0x1BD); + pParty->pPlayers[i].spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; + break; + case PLAYER_SKILL_MIND: + pParty->pPlayers[i].AddItem(-1, 0x1C8); + pParty->pPlayers[i].spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; + break; + case PLAYER_SKILL_BODY: + pParty->pPlayers[i].AddItem(-1, 0x1D3); + pParty->pPlayers[i].spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; + break; + case PLAYER_SKILL_LIGHT: + case PLAYER_SKILL_DARK: + case PLAYER_SKILL_DIPLOMACY: + Error("No dimoplacy in mm7 (yet)"); + break; + case PLAYER_SKILL_ITEM_ID: + case PLAYER_SKILL_REPAIR: + case PLAYER_SKILL_MEDITATION: + case PLAYER_SKILL_PERCEPTION: + case PLAYER_SKILL_TRAP_DISARM: + case PLAYER_SKILL_LEARNING: + pParty->pPlayers[i].AddItem(-1, 0xDC); + pParty->pPlayers[i].AddItem(-1, 5 * (rand() % 3 + 40)); + break; + case PLAYER_SKILL_DODGE: pParty->pPlayers[i].AddItem(-1, 115); break; + case PLAYER_SKILL_UNARMED: pParty->pPlayers[i].AddItem(-1, 110); break; + default: + break; + } + + for (uint k = 0; k < 138; k++) + { + if (pParty->pPlayers[i].pOwnItems[k].uItemID) + pParty->pPlayers[i].pOwnItems[k].SetIdentified(); + } + } + } + + pAudioPlayer->StopChannels(-1, -1); + return party_not_creation_flag; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIPartyCreation.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,8 @@ +#pragma once +bool PlayerCreation_Choose4Skills(); +void LoadPlayerPortraintsAndVoices(); +void ReloadPlayerPortraits(int player_id, int face_id); +void PlayerCreationUI_Draw(); +void PlayerCreationUI_Initialize(); +void DeleteCCharFont(); +bool PlayerCreationUI_Loop();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIPopup.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,2042 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "UIPopup.h" +#include "Books\UIMapBook.h" +#include "UIShops.h" +#include "..\../Engine/MM7.h" + +#include "..\../Mouse.h" + +#include "..\../Engine/Graphics/Sprites.h" +#include "..\../Engine/Graphics/Vis.h" +#include "..\../Engine/Game.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Party.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/Objects/Actor.h" +#include "..\../Engine/Graphics/Viewport.h" +#include "..\../Engine/Objects/SpriteObject.h" +#include "..\../Engine/Objects/ObjectList.h" +#include "..\../Engine/Objects/Chest.h" +#include "..\../Engine/Graphics/PaletteManager.h" +#include "..\../Engine/Timer.h" +#include "..\../Engine/texts.h" + +#include "..\../Engine/mm7_data.h" +#include "..\../Engine/Events.h" + +static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually + + +//----- (004179BC) -------------------------------------------------------- +void CharacterUI_DrawTooltip(const char *Title, const char *content) +{ + GUIWindow popup_window; // [sp+Ch] [bp-5Ch]@1 + POINT v6; // [sp+60h] [bp-8h]@1 + + memset(&popup_window, 0, 0x54u); + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 256; + popup_window.uFrameX = 128; + popup_window.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; + popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(content, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + popup_window.DrawMessageBox(0); + + popup_window.uFrameX += 12; + popup_window.uFrameWidth -= 24; + popup_window.uFrameY += 12; + popup_window.uFrameHeight -= 12; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, Title); + popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); + popup_window.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, content, 0, 0, 0); +} + +//----- (004151D9) -------------------------------------------------------- +void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight) +{ + unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6 + unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3 + unsigned int coord_y; // [sp+34h] [bp-4h]@5 + + pRenderer->SetTextureClipRect(uX, uY, uX + uWidth, uY + uHeight); + if ( pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth && pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight) + { + uNumTiles = uWidth / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; + if ( uWidth % pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth ) + ++uNumTiles; + coord_y = uY; + for ( uint j = 0; j <= uHeight / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; j++ ) + { + coord_x = uX - pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; + for ( uint i = uNumTiles + 1; i; --i ) + { + coord_x += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; + pRenderer->DrawTextureIndexed(coord_x, coord_y, pIcons_LOD->GetTexture(uTextureID_Parchment)); + } + coord_y += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; + } + pRenderer->DrawTextureTransparent(uX, uY, pIcons_LOD->GetTexture(uTextureID_5076AC)); + pRenderer->DrawTextureTransparent(uX, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4)); + pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY, pIcons_LOD->GetTexture(uTextureID_5076A8)); + pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0)); + if ( uWidth > 64 ) + { + pRenderer->SetTextureClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight); + pRenderer->DrawTextureTransparent(uX + 32, uY, pIcons_LOD->GetTexture(uTextureID_507698)); + pRenderer->DrawTextureTransparent(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); + if ( uWidth > 512 ) + { + pRenderer->DrawTextureTransparent(uX + 544, uY, pIcons_LOD->GetTexture(uTextureID_507698)); + pRenderer->DrawTextureTransparent(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); + } + } + if ( uHeight > 64 ) + { + pRenderer->SetTextureClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32); + pRenderer->DrawTextureTransparent(uX, uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0)); + pRenderer->DrawTextureTransparent(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C)); + } + pRenderer->ResetTextureClipRect(); + } +} + +//----- (0041D895) -------------------------------------------------------- +void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) +{ + unsigned int v2; // eax@3 + const char *v28; // edi@69 + int v34; // esi@81 + const char *pText; // [sp-14h] [bp-28Ch]@110 + char out_text[300]; // [sp+8h] [bp-270h]@40 + char v65[120]; // [sp+134h] [bp-144h]@92 + stru351_summoned_item v67; + int v77; // [sp+200h] [bp-78h]@12 + int v78; // [sp+204h] [bp-74h]@5 + GUIWindow iteminfo_window; // [sp+208h] [bp-70h]@2 + POINT a2; // [sp+25Ch] [bp-1Ch]@2 + int v81; // [sp+264h] [bp-14h]@5 + PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 + char* v84; + int v85; + char *Str; // [sp+270h] [bp-8h]@65 + + int r_mask = 0xF800; + int g_mask = 0x7E0; + int b_mask = 0x1F; + + if (!inspect_item->uItemID) + return; + iteminfo_window.Hint = nullptr; + iteminfo_window.uFrameWidth = 384; + iteminfo_window.uFrameHeight = 180; + iteminfo_window.uFrameY = 40; + if ( pMouse->GetCursorPos(&a2)->x <= 320 ) + v2 = pMouse->GetCursorPos(&a2)->x + 30; + else + v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30; + iteminfo_window.uFrameX = v2; + v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth; + v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight; + if ( v78 > 0 ) + v78 = v78 / 2; + if ( v81 <= 0 ) + v81 = 0; + else + v81 = v81 / 2; + if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St ) + inspect_item->SetIdentified(); + v77 = 0; + if (inspect_item->GetItemEquipType() == EQUIP_GOLD) + v77 = inspect_item->uSpecEnchantmentType; + if ( uActiveCharacter ) + { + //try to identify + if (!inspect_item->IsIdentified()) + { + if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 ) + inspect_item->SetIdentified(); + v83 = SPEECH_9; + if ( !inspect_item->IsIdentified() ) + ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2);//"Identify Failed" + else + { + v83 = SPEECH_8; + if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) + v83 = SPEECH_7; + } + if ( dword_4E455C ) + { + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); + dword_4E455C = 0; + } + } + inspect_item->UpdateTempBonus(pParty->uTimePlayed); + if (inspect_item->IsBroken()) + { + if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 ) + inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1; + v83 = SPEECH_11; + if ( !inspect_item->IsBroken() ) + v83 = SPEECH_10; + else + ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2);//"Repair Failed" + if ( dword_4E455C ) + { + pPlayers[uActiveCharacter]->PlaySound(v83, 0); + dword_4E455C = 0; + } + } + } + if (inspect_item->IsBroken()) + { + iteminfo_window.DrawMessageBox(0); + pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, + iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, + iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); + iteminfo_window.uFrameWidth -= 24; + iteminfo_window.uFrameHeight -= 12; + iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; + iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; + pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); + if ( inspect_item->IsIdentified()) + pText = (char *)inspect_item->GetIdentifiedName(); + else + pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName; + iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3); + iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2, + Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" + pRenderer->ResetTextureClipRect(); + if ( !areWeLoadingTexture ) + { + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->SyncLoadedFilesCount(); + } + return; + } + if (!inspect_item->IsIdentified()) + { + iteminfo_window.DrawMessageBox(0); + pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, + iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); + iteminfo_window.uFrameWidth -= 24; + iteminfo_window.uFrameHeight -= 12; + iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; + iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; + pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); + iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); + iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, + Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" + pRenderer->ResetTextureClipRect(); + if ( !areWeLoadingTexture ) + { + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->SyncLoadedFilesCount(); + } + return; + } + sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s" + out_text[100] = 0; + out_text[200] = 0; + switch (inspect_item->GetItemEquipType()) + { + case EQUIP_SINGLE_HANDED: + case EQUIP_TWO_HANDED: + sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], + (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], + (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage" + if (inspect_item->GetDamageMod()) + { + char mod[16]; + sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); + strcat(out_text + 100, mod); + } + break; + + case EQUIP_BOW: + sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot" + (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage" + (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); + if (inspect_item->GetDamageMod()) + { + char mod[16]; + sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); + strcat(out_text + 100, mod); + } + break; + + case EQUIP_ARMOUR: + case EQUIP_SHIELD: + case EQUIP_HELMET: + case EQUIP_BELT: + case EQUIP_CLOAK: + case EQUIP_GAUNTLETS: + case EQUIP_BOOTS: + case EQUIP_RING: + case EQUIP_AMULET: + if (inspect_item->GetDamageDice()) //"Armor" + sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], + inspect_item->GetDamageDice() + inspect_item->GetDamageMod()); + break; + } + + if ( !v77 ) + { + if (inspect_item->GetItemEquipType() ==EQUIP_POTION) //this is CORRECT! do not move to switch! + { + if ( inspect_item->uEnchantmentType ) + sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" + } + else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT) + sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power" + else if ( inspect_item->uEnchantmentType ) + sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special" + else if ( inspect_item->uSpecEnchantmentType ) + sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement); + else if ( inspect_item->uNumCharges ) + sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges" + } + iteminfo_window.uFrameWidth -= 12; + iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; + iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; + Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); + v84 = &out_text[0]; + for ( uint i = 1; i <= 3; i++ ) + { + if ( *v84 ) + Str += pFontComic->CalcTextHeight(v84, &iteminfo_window, 100, 0) + 3; + v84 += 100; + } + v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; + if ( *v28 ) + Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0); + iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), + TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54; + if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight ) + iteminfo_window.uFrameHeight = (unsigned int)Str; + if ( inspect_item->uAttributes & ITEM_TEMP_BONUS && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) + iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight); + v85 = 0; + if ( pFontArrus->uFontHeight ) + { + iteminfo_window.uFrameWidth -= 24; + if ( pFontArrus->CalcTextHeight(inspect_item->GetIdentifiedName(), &iteminfo_window, 0, 0) / (signed int)pFontArrus->uFontHeight ) + v85 = pFontArrus->uFontHeight; + iteminfo_window.uFrameWidth += 24; + } + iteminfo_window.uFrameWidth += 12; + iteminfo_window.uFrameHeight += (unsigned int)v85; + iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; + iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; + iteminfo_window.DrawMessageBox(0); + pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, + iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); + iteminfo_window.uFrameWidth -= 12; + iteminfo_window.uFrameHeight -= 12; + iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; + iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; + pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, + iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); + + v34 = (int)(v85 + 35); + Str = out_text; + for ( uint i = 1; i <= 3; i++ ) + { + if ( *Str ) + { + iteminfo_window.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0); + v34 += pFontComic->CalcTextHeight(Str, &iteminfo_window, 100, 0) + 3; + } + Str += 100; + } + v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; + if ( *v28 ) + iteminfo_window.DrawText(pFontSmallnum, 100, v34, 0, v28, 0, 0, 0); + iteminfo_window.uFrameX += 12; + iteminfo_window.uFrameWidth -= 24; + iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), inspect_item->GetIdentifiedName(), 3); + iteminfo_window.uFrameWidth += 24; + iteminfo_window.uFrameX -= 12; + if ( v77 ) + { + sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value" + iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); + pRenderer->ResetTextureClipRect(); + } + else + { + if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) + { + init_summoned_item(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); + strcpy(pTmpBuf.data(), "Duration:"); + Str = (char *)(v67.field_18_expire_year - game_starting_year); + if (v67.field_18_expire_year != 1168 ) + { + sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year); + strcat(pTmpBuf.data(), v65); + } + if ( (((v67.field_14_exprie_month || Str) && + ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str) + || v67.field_C_expire_day) + && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || + v67.field_C_expire_day) + || v67.field_8_expire_hour) + && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || + v67.field_C_expire_day || v67.field_8_expire_hour) + || v67.field_4_expire_minute ) + { + sprintf(v65, " %d:mn", v67.field_4_expire_minute); + strcat(pTmpBuf.data(), v65); + } + iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); + } + sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], inspect_item->GetValue()); + iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); + if ( inspect_item->uAttributes & ITEM_STOLEN ) + pText = pGlobalTXT_LocalizationStrings[187]; //"Stolen" + else + { + if ( !(inspect_item->uAttributes & ITEM_HARDENED) ) + { + pRenderer->ResetTextureClipRect(); + if ( !areWeLoadingTexture ) + { + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->SyncLoadedFilesCount(); + } + return; + } + pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened" + } + LOWORD(inspect_item->uAttributes) = r_mask; + iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132, + iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0); + pRenderer->ResetTextureClipRect(); + } + if ( !areWeLoadingTexture ) + { + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->SyncLoadedFilesCount(); + } + return; +} +// 4E455C: using guessed type int dword_4E455C; +// 506128: using guessed type int areWeLoadingTexture; + +//----- (0041E360) -------------------------------------------------------- +void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow) +{ + unsigned __int16 v9; // dx@4 + SpriteFrame *v10; // edi@17 + unsigned int v18; // ecx@19 + unsigned int v19; // eax@21 + int skill_points; // edi@61 + unsigned int skill_level; // eax@61 + int pTextHeight; // edi@90 + PlayerSpeech speech; // [sp-8h] [bp-1F4h]@79 + DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 + DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 + RECT dest_rect; // [sp+ECh] [bp-100h]@26 + const char *string_name[10]; // [sp+FCh] [bp-F0h]@145 + const char *content[11]; // [sp+124h] [bp-C8h]@127 + unsigned char resistances[11]; // [sp+124h] [bp-C8h]@127 + RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 + unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 + bool for_effects; // [sp+1C0h] [bp-2Ch]@3 + bool normal_level; // [sp+1D0h] [bp-1Ch]@18 + bool expert_level; // [sp+1C4h] [bp-28h]@18 + bool master_level; // [sp+1C8h] [bp-24h]@18 + bool grandmaster_level; // [sp+1B4h] [bp-38h]@3 + const char *pText; // [sp+1D4h] [bp-18h]@18 + int pTextColorID; // [sp+1E4h] [bp-8h]@18 + int v115; + + bool monster_full_informations = false; + static Actor pMonsterInfoUI_Doll; + if ( !uActiveCharacter ) // + uActiveCharacter = 1; + + /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) + { + bMonsterInfoUI_bDollInitialized |= 1u; + Actor::Actor(&pMonsterInfoUI_Doll); + atexit(nullsub_3); + }*/ + v106.sParentBillboardID = -1; + v115 = monster_popup_y_offsets[((signed __int16)pActors[uActorID].pMonsterInfo.uID - 1) / 3] - 40; + if ( pActors[uActorID].pMonsterInfo.uID == pMonsterInfoUI_Doll.pMonsterInfo.uID ) + v9 = pMonsterInfoUI_Doll.uCurrentActionLength; + else + { + memcpy(&pMonsterInfoUI_Doll, &pActors[uActorID], sizeof(pMonsterInfoUI_Doll)); + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; + pMonsterInfoUI_Doll.uCurrentActionTime = 0; + v9 = rand() % 256 + 128; + pMonsterInfoUI_Doll.uCurrentActionLength = v9; + } + + if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) + { + pMonsterInfoUI_Doll.uCurrentActionTime = 0; + if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee) + { + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing; + pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128; + } + else + { + //rand(); + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; + if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && + (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) + pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee; + pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActors[uActorID].pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; + } + } + v10 = pSpriteFrameTable->GetFrame( pActors[uActorID].pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); + v106.pTarget = pRenderer->pTargetSurface; + v106.pTargetZ = pRenderer->pActiveZBuffer; + v106.uTargetPitch = pRenderer->uTargetSurfacePitch; + v106.uViewportX = pWindow->uFrameX + 13; + v106.uViewportY = pWindow->uFrameY + 52; + v106.uViewportW = (pWindow->uFrameY + 52) + 128; + v106.uViewportZ = v106.uViewportX + 128; + v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2; + v106._screenspace_x_scaler_packedfloat = 65536; + v106._screenspace_y_scaler_packedfloat = 65536; + v106.uScreenSpaceY = v115 + (pWindow->uFrameY + 52) + pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].uHeight; + v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); + v106.sZValue = 0; + v106.uFlags = 0; + pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1); + pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//горизонтальная верхняя линия + pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//горизонтальная нижняя линия + pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//левая вертикальная линия + pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//правая вертикальная линия + //if ( pRenderer->pRenderD3D ) + { + v106.uScreenSpaceY = v115 + v106.uViewportY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; + + memset(&Dst, 0, sizeof(Dst)); + Dst.dwSize = sizeof(Dst); + Dst.dwFillColor = 0; + + memset(&pDesc, 0, sizeof(pDesc)); + pDesc.dwSize = sizeof(pDesc); + + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->GetSurfaceDesc(&pDesc); + v107 = 0; + uint i = 0; + int dst_x = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2; + int dst_y = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; + uint dst_z = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2 - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth; + uint dst_w = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; + if (dst_x < v106.uViewportX) + { + v18 = v106.uViewportX - dst_x; + dst_x = v106.uViewportX; + v107 = v18; + } + if (dst_y < v106.uViewportY) + { + v19 = v106.uViewportY - dst_y; + dst_y = v106.uViewportY; + i = v19; + } + if (dst_z > v106.uViewportZ) + dst_z = v106.uViewportZ; + if (dst_w > v106.uViewportW) + dst_w = v106.uViewportW; + pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); + pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); + dest_rect.left = v106.uViewportX; + dest_rect.top = v106.uViewportY; + dest_rect.right = v106.uViewportZ; + dest_rect.bottom = v106.uViewportW; + + ErrD3D(pRenderer->pBackBuffer4->Blt(&dest_rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &Dst)); + /*if ( pRenderer->uTargetGBits == 5 ) + { + __debugbreak(); // no monster popup for r5g5b5 will be + memset(&pDesc, 0, 0x7Cu); + pDesc.dwSize = 124; + if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT)) + { + v20 = (char *)dst_y; + v110 = pDesc.lpSurface; + if (dst_y < dst_w) + { + v21 = dst_x; + //v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x]; + ushort* _v22_2 = v22; + v23 = i - dst_y; + v115 = i - dst_y; + while ( 1 ) + { + dst_y = v21; + if ( v21 < dst_z ) + { + v25 = v107 - v21; + v109 = (int)&v20[v23]; + for ( i = v107 - v21; ; v25 = i ) + { + v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight); + v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; + *v22 = *((short *)v110 + (int)v26); + ++v22; + if ( dst_y >= dst_z ) + break; + } + v23 = v115; + } + v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch); + _v22_2 = v22; + v20 = (char *)(dst_y + 1); + v28 = __OFSUB__(dst_y + 1, dst_w); + v27 = (signed int)(dst_y++ + 1 - dst_w) < 0; + if ( !(v27 ^ v28) ) + break; + v21 = dst_x; + } + } + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(0); + } + } + else*/ + { + memset(&pDesc, 0, sizeof(pDesc)); + pDesc.dwSize = sizeof(pDesc); + if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT) ) + { + ushort* src = (unsigned __int16 *)pDesc.lpSurface; + uint num_top_scanlines_above_frame_y = i - dst_y; + for (uint y = dst_y; y < dst_w; ++y) + { + //ushort* dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x]; + + uint src_y = num_top_scanlines_above_frame_y + y; + for (uint x = dst_x; x < dst_z; ++x) + { + uint src_x = v107 - dst_x + x; // num scanlines left to frame_x + current x + + uint idx = pDesc.dwHeight * src_y / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight * (pDesc.lPitch / sizeof(short)) + + pDesc.dwWidth * src_x / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; + uint b = src[idx] & 0x1F; + //*dst++ = b | 2 * (src[idx] & 0xFFE0); + pRenderer->WritePixel16(x, y, b | 2 * (src[idx] & 0xFFE0)); + } + } + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(NULL); + } + } + } + /*else + { + pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0); + if ( v10->pHwSpriteIDs[0] >= 0 ) + pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].DrawSprite_sw(&v106, 0); + }*/ +//name and profession + if ( pActors[uActorID].sNPC_ID ) + { + if (GetNPCData(pActors[uActorID].sNPC_ID)->uProfession) + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], GetNPCData(pActors[uActorID].sNPC_ID)->pName, aNPCProfessionNames[GetNPCData(pActors[uActorID].sNPC_ID)->uProfession]); // "%s the %s" / ^Pi[%s] %s + else + strncpy(pTmpBuf.data(), GetNPCData(pActors[uActorID].sNPC_ID)->pName, 2000); + } + else + { + if ( pActors[uActorID].dword_000334_unique_name ) + strncpy(pTmpBuf.data(), pMonsterStats->pPlaceStrings[pActors[uActorID].dword_000334_unique_name], 2000); + else + strncpy(pTmpBuf.data(), pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].pName, 2000); + } + pWindow->DrawTitleText(pFontComic, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + //health bar + Actor::DrawHealthBar(&pActors[uActorID], pWindow); + + normal_level = 0; + expert_level = 0; + master_level = 0; + grandmaster_level = 0; + for_effects = 0; + pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; + if ( pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) + { + skill_points = (unsigned __int8)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) & 0x3F; + skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) - 1; + if ( skill_level == 0 )//(normal) + { + if ( skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) + normal_level = 1; + } + else if ( skill_level == 1 )//(expert) + { + if ( 2 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) + { + normal_level = 1; + expert_level = 1; + } + } + else if ( skill_level == 2 )//(master) + { + if ( 3 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) + { + normal_level = 1; + expert_level = 1; + master_level = 1; + } + } + else if ( skill_level == 3 )//grandmaster + { + normal_level = 1; + expert_level = 1; + master_level = 1; + grandmaster_level = 1; + } + } + if ( pActors[uActorID].uAIState != Dead + && pActors[uActorID].uAIState != Dying + && !dword_507BF0_is_there_popup_onscreen && pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) + { + if ( normal_level | expert_level | master_level | grandmaster_level ) + { + if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) + speech = SPEECH_IDENTIFY_MONSTER_STRONGER; + else + speech = SPEECH_IDENTIFY_MONSTER_WEAKER; + } + else + speech = SPEECH_IDENTIFY_MONSTER_106; + pPlayers[uActiveCharacter]->PlaySound(speech, 0); + } + + if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter - 1].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) + for_effects = 1; + + if ( monster_full_informations == true ) + { + normal_level = 1;// + expert_level = 1;// + master_level = 1;// + grandmaster_level = 1;// + for_effects = 1; + } + + pWindow->DrawText(pFontSmallnum, 12, 196, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects + if ( !for_effects && false) + pWindow->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? + else + { + pText = ""; + pTextHeight = LOBYTE(pFontSmallnum->uFontHeight) + 193; + for ( uint i = 1; i <= 21; ++i ) + { + if ( pActors[uActorID].pActorBuffs[i].uExpireTime > 0 ) + { + switch ( i ) + { + case ACTOR_BUFF_CHARM: + pTextColorID = 60; + pText = pGlobalTXT_LocalizationStrings[591];//Charmed + break; + case ACTOR_BUFF_SUMMONED: + pTextColorID = 82; + pText = pGlobalTXT_LocalizationStrings[649];//Summoned + break; + case ACTOR_BUFF_SHRINK: + pTextColorID = 92; + pText = pGlobalTXT_LocalizationStrings[592];//Shrunk + break; + case ACTOR_BUFF_AFRAID: + pTextColorID = 63; + pText = pGlobalTXT_LocalizationStrings[4];//Afraid + break; + case ACTOR_BUFF_STONED: + pText = pGlobalTXT_LocalizationStrings[220];//Stoned + pTextColorID = 81; + break; + case ACTOR_BUFF_PARALYZED: + pText = pGlobalTXT_LocalizationStrings[162];//Paralyzed + pTextColorID = 81; + break; + case ACTOR_BUFF_SLOWED: + pText = pGlobalTXT_LocalizationStrings[593];//Slowed + pTextColorID = 35; + break; + case ACTOR_BUFF_BERSERK: + pText = pGlobalTXT_LocalizationStrings[608];//Berserk + pTextColorID = 62; + break; + case ACTOR_BUFF_SOMETHING_THAT_HALVES_AC: + case ACTOR_BUFF_MASS_DISTORTION: + pText = ""; + pTextColorID = 0; + continue; + case ACTOR_BUFF_FATE: + pTextColorID = 47; + pText = pGlobalTXT_LocalizationStrings[221];//Fate + break; + case ACTOR_BUFF_ENSLAVED: + pTextColorID = 66; + pText = pGlobalTXT_LocalizationStrings[607];//Enslaved + break; + case ACTOR_BUFF_DAY_OF_PROTECTION: + pTextColorID = 85; + pText = pGlobalTXT_LocalizationStrings[610];//Day of Protection + break; + case ACTOR_BUFF_HOUR_OF_POWER: + pTextColorID = 86; + pText = pGlobalTXT_LocalizationStrings[609];//Hour of Power + break; + case ACTOR_BUFF_SHIELD: + pTextColorID = 17; + pText = pGlobalTXT_LocalizationStrings[279];//Shield + break; + case ACTOR_BUFF_STONESKIN: + pTextColorID = 38; + pText = pGlobalTXT_LocalizationStrings[442];//Stoneskin + break; + case ACTOR_BUFF_BLESS: + pTextColorID = 46; + pText = pGlobalTXT_LocalizationStrings[443];//Bless + break; + case ACTOR_BUFF_HEROISM: + pTextColorID = 51; + pText = pGlobalTXT_LocalizationStrings[440];//Heroism + break; + case ACTOR_BUFF_HASTE: + pTextColorID = 5; + pText = pGlobalTXT_LocalizationStrings[441];//Haste + break; + case ACTOR_BUFF_PAIN_REFLECTION: + pTextColorID = 95; + pText = pGlobalTXT_LocalizationStrings[229];//Pain Reflection + break; + case ACTOR_BUFF_PAIN_HAMMERHANDS: + pTextColorID = 73; + pText = pGlobalTXT_LocalizationStrings[228];//Hammerhands + break; + default: + pText = ""; + break; + } + if ( _stricmp(pText, "" )) + { + pWindow->DrawText(pFontSmallnum, 28, pTextHeight, GetSpellColor(pTextColorID), pText, 0, 0, 0); + pTextHeight = pTextHeight + *(char *)((int)pFontSmallnum + 5) - 3; + } + } + } + if ( !_stricmp(pText,"" )) + pWindow->DrawText(pFontSmallnum, 28, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);//Нет + } + + if ( normal_level ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, pActors[uActorID].pMonsterInfo.uHP); + pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[12], 0, pActors[uActorID].pMonsterInfo.uAC);//Armor Class + } + else + { + sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark + pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[12], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark + } + pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); + + content[0] = pGlobalTXT_LocalizationStrings[87]; + content[1] = pGlobalTXT_LocalizationStrings[6]; + content[2] = pGlobalTXT_LocalizationStrings[240]; + content[3] = pGlobalTXT_LocalizationStrings[70]; + content[4] = pGlobalTXT_LocalizationStrings[624]; + content[5] = pGlobalTXT_LocalizationStrings[138]; + content[6] = pGlobalTXT_LocalizationStrings[214]; + content[7] = pGlobalTXT_LocalizationStrings[142]; + content[8] = pGlobalTXT_LocalizationStrings[29]; + content[9] = pGlobalTXT_LocalizationStrings[133]; + content[10] = pGlobalTXT_LocalizationStrings[54]; + + if ( expert_level ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, content[pActors[uActorID].pMonsterInfo.uAttack1Type]);//Attack + pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + if ( pActors[uActorID].pMonsterInfo.uAttack1DamageBonus ) + sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53], + 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides, pActors[uActorID].pMonsterInfo.uAttack1DamageBonus); + else + sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53], + 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides); + } + else + { + sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); + pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); + } + pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); + + if ( !master_level ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[630]);//"Spell" "?" + pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + else + { + pText = pGlobalTXT_LocalizationStrings[628];//Spell + if ( pActors[uActorID].pMonsterInfo.uSpell1ID && pActors[uActorID].pMonsterInfo.uSpell2ID ) + pText = pGlobalTXT_LocalizationStrings[629];//Spells + if ( pActors[uActorID].pMonsterInfo.uSpell1ID ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);//"%s\f%05u\t060%s\n" + pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + if ( pActors[uActorID].pMonsterInfo.uSpell2ID ) + { + sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);//"%s\f%05u\t060%s\n" + pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);//"%s\f%05u\t060%s\n" + pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + } + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[626], 0, 0, 0);//Immune + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + + string_name[0] = pGlobalTXT_LocalizationStrings[87];//Fire + string_name[1] = pGlobalTXT_LocalizationStrings[6];//Air + string_name[2] = pGlobalTXT_LocalizationStrings[240]; + string_name[3] = pGlobalTXT_LocalizationStrings[70]; + string_name[4] = pGlobalTXT_LocalizationStrings[142]; + string_name[5] = pGlobalTXT_LocalizationStrings[214]; + string_name[6] = pGlobalTXT_LocalizationStrings[29]; + string_name[7] = pGlobalTXT_LocalizationStrings[133]; + string_name[8] = pGlobalTXT_LocalizationStrings[54]; + string_name[9] = pGlobalTXT_LocalizationStrings[624]; + + resistances[0] = pActors[uActorID].pMonsterInfo.uResFire; + resistances[1] = pActors[uActorID].pMonsterInfo.uResAir; + resistances[2] = pActors[uActorID].pMonsterInfo.uResWater; + resistances[3] = pActors[uActorID].pMonsterInfo.uResEarth; + resistances[4] = pActors[uActorID].pMonsterInfo.uResMind; + resistances[5] = pActors[uActorID].pMonsterInfo.uResSpirit; + resistances[6] = pActors[uActorID].pMonsterInfo.uResBody; + resistances[7] = pActors[uActorID].pMonsterInfo.uResLight; + resistances[8] = pActors[uActorID].pMonsterInfo.uResPhysical; + resistances[9] = pActors[uActorID].pMonsterInfo.uResDark; + + if ( grandmaster_level ) + { + for ( uint i = 0; i < 10; i++ ) + { + if ( resistances[i] == 200 ) + { + pText = pGlobalTXT_LocalizationStrings[625];//Immune + } + else + { + if ( resistances[i] ) + pText = pGlobalTXT_LocalizationStrings[627];//Resistant + else + pText = pGlobalTXT_LocalizationStrings[153];//None + } + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pText); + pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + } + else + { + for ( uint i = 0; i < 10; ++i ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" + pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + } + //cast spell: Detect life + if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 ) + { + sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points + pFontSmallnum->GetLineWidth(pTmpBuf.data()); + pWindow->DrawTitleText(pFontSmallnum, 0, pWindow->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3); + } +} + +//----- (00417BB5) -------------------------------------------------------- +const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) +{ + char a2[1200]; // [sp+Ch] [bp-538h]@7 + char Source[120]; // [sp+4BCh] [bp-88h]@7 + int v35; // [sp+53Ch] [bp-8h]@1 + + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand + + a2[0] = 0; + Source[0] = 0; + strcpy(a2, "%s\n\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 1)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 2)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 3)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 4)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + if ( (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F) == (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) ) + { + sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], // Normal + pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], // Expert + pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], // Master + pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType]); // Grand + } + else + { + sprintf(Source, "\f%05d", Color16(0xFFu, 0xFFu, 0xFFu)); + strcat(a2, Source); + strcat(a2, "%s: +%d"); + sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[623], //Bonus + (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) - (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F)); + } + return static_sub_417BB5_out_string; +} + +//----- (00417FE5) -------------------------------------------------------- +void CharacterUI_SkillsTab_ShowHint() +{ + GUIButton *pButton; // esi@6 + unsigned int pX; // [sp+4h] [bp-8h]@1 + unsigned int pY; // [sp+8h] [bp-4h]@1 + + pMouse->GetClickPos(&pX, &pY); + if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) + { + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) + { + if ( pButton->msg == UIMSG_SkillUp + && (signed int)pX >= (signed int)pButton->uX + && (signed int)pX <= (signed int)pButton->uZ + && (signed int)pY >= (signed int)pButton->uY + && (signed int)pY <= (signed int)pButton->uW ) + { + CharacterUI_DrawTooltip(pSkillNames[pButton->msg_param], CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)pButton->msg_param)); + } + } + } + else + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);//Очки навыков +} + +//----- (00418083) -------------------------------------------------------- +void CharacterUI_StatsTab_ShowHint() +{ + int pStringNum; // edi@1 + signed int pTextColor; // eax@15 + const char *pHourWord; // ecx@17 + const char *pDayWord; // eax@20 + int v15; // ebx@28 + POINT a2; // [sp+Ch] [bp-24h]@1 + int pHour; // [sp+14h] [bp-1Ch]@15 + unsigned int pDay; // [sp+24h] [bp-Ch]@15 + + pMouse->GetCursorPos(&a2); + for ( pStringNum = 0; pStringNum < stat_string_coord.size(); ++pStringNum ) + { + if (a2.x >= stat_string_coord[pStringNum].x && a2.x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width ) + { + if (a2.y >= stat_string_coord[pStringNum].y && a2.y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height ) + break; + } + } + + switch ( pStringNum ) + { + case 0:// Attributes + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] ) + CharacterUI_DrawTooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]); + break; + case 7:// Health Points + if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription); + break; + case 8:// Spell Points + if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription); + break; + case 9:// Armor Class + if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription); + break; + case 10:// Player Condition + strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription); + strcat(pTmpBuf2.data(), "\n"); + extern std::array<unsigned int, 18> pConditionImportancyTable; + for ( uint i = 0; i < 18; ++i ) + { + if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] ) + { + strcat(pTmpBuf2.data(), " \n"); + pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]]; + pHour = (unsigned int)((pHour * 0.234375) / 60 / 60); + pDay = (unsigned int)pHour / 24; + pHour %= 24i64; + pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]); + sprintfex(pTmpBuf.data(), format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]); + strcat(pTmpBuf2.data(), pTmpBuf.data()); + if ( pHour && pHour <= 1 ) + pHourWord = pGlobalTXT_LocalizationStrings[109]; + else + pHourWord = pGlobalTXT_LocalizationStrings[110]; + if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) ) + pDayWord = pGlobalTXT_LocalizationStrings[57]; + sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord); + strcat(pTmpBuf2.data(), pTmpBuf.data()); + } + } + if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data()); + break; + case 11:// Fast Spell + if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription); + break; + case 12:// Player Age + if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription); + break; + case 13:// Player Level + if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription); + break; + case 14://Experience + v15 = pPlayers[uActiveCharacter]->uLevel; + do + { + if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)GetExperienceRequiredForLevel(v15) ) + break; + ++v15; + } + while ( v15 <= 10000 ); + pTmpBuf[0] = 0; + pTmpBuf2[0] = 0; + if ( v15 > pPlayers[uActiveCharacter]->uLevel ) + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience), v15 + 1); + strcat(pTmpBuf.data(), "\n"); + strcat(pTmpBuf.data(), pTmpBuf2.data()); + sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data()); + if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data()); + break; + case 15:// Attack Bonus + if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription); + break; + case 16:// Attack Damage + if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription); + break; + case 17:// Missle Bonus + if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription); + break; + case 18:// Missle Damage + if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription); + break; + case 19:// Fire Resistance + if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription); + break; + case 20:// Air Resistance + if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription); + break; + case 21:// Water Resistance + if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription); + break; + case 22:// Earth Resistance + if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription); + break; + case 23:// Mind Resistance + if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription); + break; + case 24:// Body Resistance + if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription); + break; + case 25: // Skill Points + if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription ) + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); + break; + case 26: // Class description + { + if (pClassDescriptions[pPlayers[uActiveCharacter]->classType] && pClassNames[pPlayers[uActiveCharacter]->classType]) + CharacterUI_DrawTooltip(pClassNames[pPlayers[uActiveCharacter]->classType], pClassDescriptions[pPlayers[uActiveCharacter]->classType]); + } + break; + + default: + break; + } +} + +//----- (00410B28) -------------------------------------------------------- +void DrawSpellDescriptionPopup(int spell_index) +{ + SpellInfo *spell; // esi@1 + unsigned int v3; // eax@2 + LONG v5; // ecx@4 + GUIWindow spell_info_window; // [sp+Ch] [bp-68h]@4 + POINT mouse; // [sp+64h] [bp-10h]@1 + + spell = &pSpellStats->pInfos[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1]; + if ( pMouse->GetCursorPos(&mouse)->y <= 250 ) + v3 = pMouse->GetCursorPos(&mouse)->y + 30; + else + v3 = 30; + spell_info_window.uFrameY = v3; + spell_info_window.uFrameWidth = 328; + spell_info_window.uFrameHeight = 68; + spell_info_window.uFrameX = 90; + spell_info_window.uFrameZ = 417; + spell_info_window.uFrameW = v3 + 67; + spell_info_window.Hint = nullptr; + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); + sprintf(pTmpBuf2.data(), + "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", + spell->pDescription, + pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], v5 + 3, v5 + 10, spell->pBasicSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], v5 + 3, v5 + 10, spell->pExpertSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], v5 + 3, v5 + 10, spell->pMasterSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], v5 + 3, v5 + 10, spell->pGrandmasterSkillDesc); + spell_info_window.uFrameHeight += pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &spell_info_window, 0, 0); + if ( (signed int)spell_info_window.uFrameHeight < 150 ) + spell_info_window.uFrameHeight = 150; + spell_info_window.uFrameWidth = game_viewport_width; + spell_info_window.DrawMessageBox(0); + spell_info_window.uFrameWidth -= 12; + spell_info_window.uFrameHeight -= 12; + spell_info_window.uFrameZ = spell_info_window.uFrameX + spell_info_window.uFrameWidth - 1; + spell_info_window.uFrameW = spell_info_window.uFrameHeight + spell_info_window.uFrameY - 1; + spell_info_window.DrawTitleText(pFontArrus, 0x78u, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), spell->pName, 3); + spell_info_window.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); + spell_info_window.uFrameWidth = 108; + spell_info_window.uFrameZ = spell_info_window.uFrameX + 107; + int skill_level = SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12]); + spell_info_window.DrawTitleText(pFontComic, 12, 75, 0, pSkillNames[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12], 3); + sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], + pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[skill_level - 1]); + spell_info_window.DrawTitleText(pFontComic, 12, spell_info_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); + dword_507B00_spell_info_to_draw_in_popup = 0; +} + // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup; + +//----- (00416D62) -------------------------------------------------------- +void UI_OnMouseRightClick(Vec2_int_ *_this) +{ + int v5; // esi@62 + GUIButton *pButton; // esi@84 + const char *pStr; // edi@85 + const char *pHint; // edx@113 + GUIWindow popup_window; // [sp+4h] [bp-74h]@32 + struct tagPOINT Point; // [sp+60h] [bp-18h]@6 + unsigned int pX; // [sp+70h] [bp-8h]@3 + unsigned int pY; // [sp+74h] [bp-4h]@3 + + if ( pCurrentScreen == SCREEN_VIDEO || GetCurrentMenuID() == MENU_MAIN ) + return; + if ( _this ) + { + pX = _this->x; + pY = _this->y; + } + else + { + pMouse->GetClickPos(&pX, &pY); + } + //if ( pRenderer->bWindowMode ) + { + GetCursorPos(&Point); + ScreenToClient(window->GetApiHandle(), &Point); + if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) + { + back_to_game(); + return; + } + } + if ( pParty->pPickedItem.uItemID )//нажатие на портрет перса правой кнопкой мыши с раствором + { + for ( uint i = 0; i < 4; ++i ) + { + if ( (signed int)pX > RightClickPortraitXmin[i] && (signed int)pX < RightClickPortraitXmax[i] + && (signed int)pY > 375 && (signed int)pY < 466 ) + { + pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(i + 1, 1); + return; + } + } + } + + pEventTimer->Pause(); + switch(pCurrentScreen) + { + case SCREEN_CASTING: + { + Inventory_ItemPopupAndAlchemy(); + break; + } + case SCREEN_CHEST: + { + if ( !pPlayers[uActiveCharacter]->CanAct() ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы + popup_window.Hint = pTmpBuf.data(); + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 180; + popup_window.uFrameY = 40; + if ( (signed int)pX <= 320 ) + popup_window.uFrameX = pX + 30; + else + popup_window.uFrameX = pX - 414; + popup_window.DrawMessageBox(0); + } + else + { + if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF ) + GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF) - 1] - 1]); + } + break; + } + case SCREEN_GAME://In the main menu displays a pop-up window(В главном меню показывает всплывающее окно) + { + if (GetCurrentMenuID() > 0) + break; + if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) + { + popup_window.ptr_1C = (void *)((signed int)pX / 118); + if ( (signed int)pX / 118 < 4 )//portaits zone + { + popup_window.Hint = nullptr; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + GameUI_CharacterQuickRecord_Draw(&popup_window, pPlayers[(int)popup_window.ptr_1C + 1]); + } + } + else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) + { + if ( (signed int)pY >= 130 ) + { + if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )//buff_tooltip zone + { + popup_window.Hint = nullptr; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + popup_window._41D73D_draw_buff_tooltip(); + } + else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )//NPC zone + { + if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) + { + pAudioPlayer->StopChannels(-1, -1); + GameUI_DrawNPCPopup((void *)1);//NPC 2 + } + } + else + { + pAudioPlayer->StopChannels(-1, -1); + GameUI_DrawNPCPopup(0);//NPC 1 + } + } + else//minimap zone + { + popup_window.Hint = (char *)GameUI_GetMinimapHintText(); + popup_window.uFrameWidth = 256; + popup_window.uFrameX = 130; + popup_window.uFrameY = 140; + popup_window.uFrameHeight = 64; + pAudioPlayer->StopChannels(-1, -1); + popup_window.DrawMessageBox(0); + } + } + else//game zone + { + popup_window.Hint = nullptr; + popup_window.uFrameWidth = 320; + popup_window.uFrameHeight = 320; + popup_window.uFrameX = pX - 350; + if ( (signed int)pX <= 320 ) + popup_window.uFrameX = pX + 30; + popup_window.uFrameY = 40; + //if ( pRenderer->pRenderD3D ) + v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); + /*else + v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/ + if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor) + { + /*if ( pRenderer->uNumSceneBegins ) + { + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); + } + else*/ + { + pRenderer->BeginScene(); + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); + pRenderer->EndScene(); + } + } + if (PID_TYPE((unsigned __int16)v5) == OBJECT_Item) + { + if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) ) + { + GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].stru_24); + } + } + } + break; + } + case SCREEN_BOOKS: + { + if ( !dword_506364 + || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X + || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y + || ((popup_window.Hint = (char *)GetMapBookHintText()) == 0) ) + break; + popup_window.uFrameWidth = (pFontArrus->GetLineWidth(popup_window.Hint) + 32) + 0.5f; + popup_window.uFrameX = pX + 5; + popup_window.uFrameY = pY + 5; + popup_window.uFrameHeight = 64; + pAudioPlayer->StopChannels(-1, -1); + popup_window.DrawMessageBox(0); + break; + } + case SCREEN_CHARACTERS: + case SCREEN_E: + case SCREEN_CHEST_INVENTORY: + { + if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) + Inventory_ItemPopupAndAlchemy(); + else if ( (signed int)pY >= 345 ) + break; + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats + CharacterUI_StatsTab_ShowHint(); + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills + CharacterUI_SkillsTab_ShowHint(); + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory + Inventory_ItemPopupAndAlchemy(); + break; + } + case SCREEN_SPELL_BOOK: + { + if ( dword_507B00_spell_info_to_draw_in_popup ) + DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); + break; + } + case SCREEN_HOUSE: + { + if ( (signed int)pY < 345 && (signed int)pX < 469 ) + ShowPopupShopItem(); + break; + } + case SCREEN_PARTY_CREATION: + { + popup_window.Hint = nullptr; + pStr = 0; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) + { + if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ + && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) + { + switch ( pButton->msg ) + { + case UIMSG_0: //stats info + popup_window.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; + pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; + break; + case UIMSG_PlayerCreationClickPlus: //Plus button info + pStr = pGlobalTXT_LocalizationStrings[670];//Добавить + popup_window.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" + break; + case UIMSG_PlayerCreationClickMinus: //Minus button info + pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть + popup_window.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" + break; + case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info + pStr = pSkillNames[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + popup_window.Hint = pSkillDesc[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + break; + case UIMSG_PlayerCreationSelectClass: //Available Class Info + popup_window.Hint = pClassDescriptions[pButton->msg_param]; + pStr = pClassNames[pButton->msg_param]; + break; + case UIMSG_PlayerCreationClickOK: //OK Info + popup_window.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. + pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК + break; + case UIMSG_PlayerCreationClickReset: //Clear info + popup_window.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. + pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить + break; + case UIMSG_PlayerCreation_SelectAttribute: // Character info + pStr = pParty->pPlayers[pButton->msg_param].pName; + popup_window.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; + break; + } + if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info + { + pY = 0; + if ( (signed int)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48) < 37 ) + { + strcpy(pTmpBuf2.data(), CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48))); + popup_window.Hint = pTmpBuf2.data(); + pStr = pSkillNames[pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48)]; + } + } + } + } + if ( popup_window.Hint ) + { + pHint = popup_window.Hint; + popup_window.Hint = nullptr; + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 256; + popup_window.uFrameX = 128; + popup_window.uFrameY = 40; + popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + popup_window.DrawMessageBox(0); + popup_window.uFrameX += 12; + popup_window.uFrameWidth -= 24; + popup_window.uFrameY += 12; + popup_window.uFrameHeight -= 12; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", Color16(0xFF, 0xFF, 0x9B), pStr); + popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); + popup_window.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); + } + break; + } + default: + break; + } + dword_507BF0_is_there_popup_onscreen = 1; + viewparams->bRedrawGameUI = 1; +} +int no_rightlick_in_inventory = false; // 0050CDCC +//----- (00416196) -------------------------------------------------------- +void Inventory_ItemPopupAndAlchemy() +{ + int potion1_id; // edx@25 + unsigned int potion2_id; // edi@25 + signed int potionID; // edx@27 + unsigned int pOut_y; // edx@57 + double v31; // st7@112 + Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 + GUIWindow message_window; // [sp+Ch] [bp-84h]@137 + POINT cursor; // [sp+78h] [bp-18h]@2 + unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 + + if (no_rightlick_in_inventory) + return; + + pMouse->GetCursorPos(&cursor); + int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1; + if (item_pid == -1) //added here to avoid crash + return; + ItemGen* item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; + + if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(вещи вне инвентаря) + { + GameUI_DrawItemInfo(item); + return; + } + + if (!item_pid) + { + int inventory_mouse_x = cursor.x - 14; + int inventory_mouse_y = cursor.y - 17; + + int mouse_cell_x = inventory_mouse_x / 32; + int mouse_cell_y = inventory_mouse_y / 32; + + if (mouse_cell_x + mouse_cell_y < 0) + return; + + int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; + if (inventory_idx > 126) + return; + + if (pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx) == 0) + return; + + item_pid = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); + } +//check character condition(проверка состояния персонажа) + if (!pPlayers[uActiveCharacter]->CanAct()) + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы + message_window.Hint = pTmpBuf.data(); + message_window.uFrameWidth = 384; + message_window.uFrameHeight = 180; + if (cursor.x <= 320 ) + message_window.uFrameX = cursor.x + 30; + else + message_window.uFrameX = cursor.x - 414; + message_window.uFrameY = 40; + message_window.DrawMessageBox(0); + return; + } + + int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; + int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)); + +// for potion bottle(простая бутылка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) + { + GameUI_DrawItemInfo(item); + return; + } +//for recharge potion(зелье перезарядка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) + { + if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions + { + if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + + v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; + if ( v31 < 0.0 ) + v31 = 0.0; + item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); + item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); + + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// for harden potion(зелье закалка) + else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) + { + if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions + { + if (item->IsBroken() || // cant harden broken items + item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts + item->GetItemEquipType() < EQUIP_SINGLE_HANDED || + item->GetItemEquipType() > EQUIP_WAND) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// several potions(несколько зелий) + else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || + pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || + item->uItemID >= ITEM_ARTIFACT_PUCK || + item->IsBroken() || + item->uSpecEnchantmentType || + item->uEnchantmentType || + item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->UpdateTempBonus(pParty->uTimePlayed); + if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + item->uSpecEnchantmentType = 40; // of Slaying + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + else + { + static int _4E2904_enchantment_by_potion_lut[] = + { + 164, 93, 22, + 164, 93, 22, + 11, 5, 13, 7, 59 + }; + item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + + item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; + item->uAttributes = alchemy_skill_level | 0x18; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } + // use reagents(применение реагентов) + if (pParty->pPickedItem.uItemID >= ITEM_REAGENT_WIDOWSWEEP_BERRIES && pParty->pPickedItem.uItemID <= ITEM_REAGENT_PHILOSOPHERS_STONE && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_BOTTLE) + { + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice(); + switch ( pParty->pPickedItem.uItemID ) + { + case 200: + case 201: + case 202: + case 203: + case 204: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222; + break; + case 205: + case 206: + case 207: + case 208: + case 209: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223; + break; + case 210: + case 211: + case 212: + case 213: + case 214: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224; + break; + case 215: + case 216: + case 217: + case 218: + case 219: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221; + break; + default: + break; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + if ( dword_4E455C ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + } + return; + } +//potions mixing(смешивание двух зелий) + if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION) + { + potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS; + potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; + + if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) + potionID = 5; + else + potionID = pItemsTable->potion_data[potion2_id][potion1_id]; + damage_level = 0; + if ( alchemy_skill_points ) + { + if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227 + { + if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239 + damage_level = 2; + if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261 + damage_level = 3; + if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID + damage_level = 4; + } + } + else//no skill(нет навыка) + { + if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 + damage_level = 1; + if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 + damage_level = 2; + if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 + damage_level = 3; + if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 + damage_level = 4; + } + + int pOut_x = item_pid + 1; + for ( uint i = 0; i < 126; ++i ) + { + if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x ) + { + pOut_y = i; + break; + } + } + if ( !potionID ) + { + GameUI_DrawItemInfo(item); + return; + } + if ( damage_level == 1 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 2 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); + pPlayers[uActiveCharacter]->ItemsEnchant(1); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 3 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE); + pPlayers[uActiveCharacter]->ItemsEnchant(5); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 4 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->SetCondition(Condition_Eradicated, 0); + pPlayers[uActiveCharacter]->ItemsEnchant(0); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 0 ) + { + if ( alchemy_skill_points ) + { + if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(катализатор) + { + if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID; + if ( pParty->pPickedItem.uItemID == 221 ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType; + } + else + { + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID; + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2; + pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]); + } + int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//бутылка + if ( bottle ) + pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED; + if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1; + if ( !dword_4E455C ) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + GameUI_DrawItemInfo(item); + return; + } + } + GameUI_DrawItemInfo(item); + return; +} + + +//----- (0045828B) -------------------------------------------------------- +unsigned int __fastcall GetSpellColor(signed int a1) +{ + if ( a1 == 0 ) + return Color16(0, 0, 0); + if ( a1 < 12 ) + return Color16(255, 85, 0); + if ( a1 < 23 ) + return Color16(150, 212, 255); + if ( a1 < 34 ) + return Color16(0, 128, 255); + if ( a1 < 45 ) + return Color16(128, 128, 128); + if ( a1 < 56 ) + return Color16(225, 225, 225); + if ( a1 < 67 ) + return Color16(235, 15, 255); + if ( a1 < 78 ) + return Color16(255, 128, 0); + if ( a1 < 89 ) + return Color16(255, 255, 155); + if ( a1 < 100 ) + return Color16(192, 192, 240); + else + __debugbreak(); +} + +//----- (004B46F8) -------------------------------------------------------- +__int64 GetExperienceRequiredForLevel(int level) +{ + __int64 v1; // eax@1 + int i; // edx@1 + + v1 = 0; + for (i = 0; i < level; ++i) + v1 += i + 1; + return 1000 * v1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIPopup.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,4 @@ +#pragma once + +unsigned int __fastcall GetSpellColor(signed int a1); +__int64 GetExperienceRequiredForLevel(int a1);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIRest.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,169 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Party.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/Graphics/Outdoor.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/Graphics/Viewport.h" +#include "..\../Engine/Timer.h" +#include "..\../Engine/texts.h" + +#include "..\../Engine/mm7_data.h" + + + +//----- (0041F6C1) -------------------------------------------------------- +void RestUI_Load() +{ + if ( !dword_506F14 ) + pAudioPlayer->StopChannels(-1, -1); + if ( pCurrentScreen != SCREEN_GAME) + { + pGUIWindow_CurrentMenu->Release(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = true; + } + pEventTimer->Pause(); + if ( dword_506F14 != 2 ) + GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0); + _506F18_num_minutes_to_sleep = 0; + dword_506F14 = 0; + uRestUI_FoodRequiredToRest = 2; + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) + uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); + if ( PartyHasDragon() ) + { + for ( uint i = 0; i < 4; ++i ) + { + if (pParty->pPlayers[i].classType == PLAYER_CLASS_WARLOCK) + ++uRestUI_FoodRequiredToRest; + } + } + if ( CheckHiredNPCSpeciality(Porter) ) + --uRestUI_FoodRequiredToRest; + if ( CheckHiredNPCSpeciality(QuarterMaster) ) + uRestUI_FoodRequiredToRest -= 2; + if ( CheckHiredNPCSpeciality(Gypsy) ) + --uRestUI_FoodRequiredToRest; + if ( uRestUI_FoodRequiredToRest < 1 ) + uRestUI_FoodRequiredToRest = 1; + if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )//Замок Хармондейл + uRestUI_FoodRequiredToRest = 0; + + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + + pCurrentScreen = SCREEN_REST; + _507CD4_RestUI_hourglass_anim_controller = 0; + uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); + OutdoorLocation::LoadActualSkyFrame(); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0); + pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); + pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); + pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); + pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); + pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); +} + +//----- (0041FA01) -------------------------------------------------------- +void RestUI_Draw() +{ + int live_characters; // esi@1 + unsigned int v3; // eax@15 + GUIButton tmp_button; // [sp+8h] [bp-DCh]@19 + unsigned int am_pm_hours; // [sp+D8h] [bp-Ch]@9 + + live_characters = 0; + for( int i = 1; i < 5; ++i ) + if ( !pPlayers[i]->IsDead() && !pPlayers[i]->IsEradicated() && pPlayers[i]->sHealth > 0 ) + ++live_characters; + + if ( live_characters ) + { + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_RestUI_restmain)); + am_pm_hours = pParty->uCurrentHour; + dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; + if ( (signed int)pParty->uCurrentHour <= 12 ) + { + if ( !am_pm_hours ) + am_pm_hours = 12; + } + else + am_pm_hours -= 12; + pRenderer->DrawTextureIndexed(16, 26, pTexture_RestUI_CurrentSkyFrame); + if ( pTexture_RestUI_CurrentHourglassFrame ) + { + pTexture_RestUI_CurrentHourglassFrame->Release(); + pIcons_LOD->SyncLoadedFilesCount(); + } + v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller; + _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed; + if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 ) + { + v3 = 0; + _507CD4_RestUI_hourglass_anim_controller = 0; + } + hourglass_icon_idx = (int)floorf(((double)v3 / 512.0 * 120.0) + 0.5f) % 256 + 1; + if (hourglass_icon_idx >= 120 ) + hourglass_icon_idx = 1; + + sprintf(pTmpBuf.data(), "hglas%03d", hourglass_icon_idx); + pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(267, 159, pTexture_RestUI_CurrentHourglassFrame); + memset(&tmp_button, 0, sizeof(GUIButton)); + tmp_button.uX = 24; + tmp_button.uY = 154; + tmp_button.uZ = 194; + tmp_button.uW = 190; + tmp_button.uWidth = 171; + tmp_button.uHeight = 37; + tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; + tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Отдых и лечение 8 часов + tmp_button.pParent = 0; + + sprintf(pTmpBuf.data(), "\r408%d", uRestUI_FoodRequiredToRest); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); + + pButton_RestUI_WaitUntilDawn->DrawLabel(pGlobalTXT_LocalizationStrings[237], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать до рассвета + pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать 1 час + pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать 5 минут + pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Закончить отдыхать + memset(&tmp_button, 0, sizeof(GUIButton)); + tmp_button.uX = 45; + tmp_button.uY = 199; + + tmp_button.uZ = 229; + tmp_button.uW = 228; + + tmp_button.uWidth = 185; + tmp_button.uHeight = 30; + + tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; + tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать без лечения + tmp_button.pParent = 0; + sprintf(pTmpBuf.data(), "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute, aAMPMNames[(pParty->uCurrentHour >= 12 && pParty->uCurrentHour < 24)? 1:0]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); + sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);//День + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); + sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);//Месяц + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); + sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);//Год + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); + if ( dword_506F14 ) + Party::Sleep6Hours(); + } + else + GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, + (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest" +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIRest.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,1 @@ +#pragma once \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UISaveLoad.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,330 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include <io.h> + +#include "..\../Engine/MM7.h" +#include "..\../Engine/ErrorHandling.h" + +#include "..\../Keyboard.h" + +#include "..\../Engine/MapInfo.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Graphics/Render.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/SaveLoad.h" +#include "..\../Engine/texts.h" + +#include "..\../Engine/mm7_data.h" + +#include "..\../Engine/Game.h" + + +//----- (004601B7) -------------------------------------------------------- +static void UI_DrawSaveLoad(bool save) +{ +// const char *pSlotName; // edi@36 + GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8 + unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 + unsigned __int64 full_hours; + unsigned __int64 full_days; + int full_weeks; + int full_month; + int current_year; + int current_month; + int current_day; + int current_hour; + int current_minutes; + + pRenderer->BeginScene(); + if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) + { + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + if (save) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up)); + } + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + } + if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) + { + memset(&save_load_window, 0, 0x54); + save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; + save_load_window.uFrameWidth = 220; + save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157; + save_load_window.uFrameZ = save_load_window.uFrameX + 219; + save_load_window.uFrameHeight = pFontSmallnum->uFontHeight; + save_load_window.uFrameW = pFontSmallnum->uFontHeight + save_load_window.uFrameY - 1; + if ( pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels ) + pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); +//Draw map name + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pSavegameHeader[uLoadGameUI_SelectedSlot].pLocationName)].pName, 3); +//Draw date + full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64; + full_days = (unsigned int)full_hours / 24; + full_weeks = (unsigned int)(full_days / 7); + full_month = (unsigned int)full_weeks / 4; + current_year = (full_month / 12) + game_starting_year; + current_month = full_month % 12; + current_day = full_days % 28; + current_hour = full_hours % 24; + current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64); + + save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; + int am; + if ( (signed int)current_hour >= 12 ) + { + current_hour -= 12; + if ( !current_hour ) + current_hour = 12; + am = 1; + } + else + am = 0; + const char* day = aDayNames[full_days % 7]; + const char* ampm = aAMPMNames[am]; + const char* month = aMonthNames[current_month]; + + sprintfex(pTmpBuf.data(), "%s %d:%02d %s\n%d %s %d", day, current_hour, current_minutes, aAMPMNames[am], current_day + 1, month, current_year); + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3); + } + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pKeyActionMap->pPressedKeysBuffer); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); + } + else + { + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) + pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + } + if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) + { + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, + 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, + pSavegameHeader[uLoadGameUI_SelectedSlot].pName) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, + 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите" + } + else + { + if ( save ) + pSaveFiles = 40; + else + pSaveFiles = uNumSavegameFiles; + + int slot_Y = 199; + for ( uint i = pSaveListPosition; i < pSaveFiles; ++i ) + { + if ( slot_Y >= 346 ) + break; + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? Color16(0xFF, 0xFF, 0x64) : 0, pSavegameHeader[i].pName, 185, 0); + else + pGUIWindow_CurrentMenu->DrawFlashingInputCursor(pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? Color16(0xFF, 0xFF, 0x64) : 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1) + 27, + slot_Y, pFontSmallnum); + slot_Y += 21; + } + } + pRenderer->EndScene(); +} +// 6A0C9C: using guessed type int dword_6A0C9C; + +//----- (004606F7) -------------------------------------------------------- +void LoadUI_Draw() +{ + UI_DrawSaveLoad(false); +} + +//----- (004606FE) -------------------------------------------------------- +void SaveUI_Draw() +{ + UI_DrawSaveLoad(true); +} + +//----- (0045E361) -------------------------------------------------------- +void LoadUI_Load(unsigned int uDialogueType) +{ + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 + + dword_6BE138 = -1; + pIcons_LOD->_inlined_sub2(); + + memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); + memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + if ( uDialogueType ) + { + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + if ( pCurrentScreen == SCREEN_SAVEGAME ) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + } + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + } + else + pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); + pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType], saveload_dlg_ys[uDialogueType], saveload_dlg_zs[uDialogueType], + saveload_dlg_ws[uDialogueType], WINDOW_MainMenu_Load, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." + pRenderer->Present(); + pSavegameList->Initialize(0); + if ( pSaveListPosition > (signed int)uNumSavegameFiles ) + { + pSaveListPosition = 0; + uLoadGameUI_SelectedSlot = 0; + } + pLODFile.AllocSubIndicesAndIO(300, 0); + Assert(sizeof(SavegameHeader) == 100); + for (uint i = 0; i < uNumSavegameFiles; ++i) + { + sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); + if (_access(pTmpBuf.data(), 6)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" + continue; + } + pLODFile.LoadFile(pTmpBuf.data(), 1); + if ( pLODFile.FindContainer("header.bin", true) ) + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); + if ( !_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" + if ( !pLODFile.FindContainer("image.pcx", true) ) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); + } + else + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + } + + pLODFile.FreeSubIndexAndIO(); + if ( pCurrentScreen == SCREEN_SAVEGAME ) + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); + } + else + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); + } + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); +} + +//----- (0045E93E) -------------------------------------------------------- +void SaveUI_Load() +{ + char *v3; // eax@7 + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 + + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); + memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + if ( pCurrentScreen == SCREEN_SAVEGAME ) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + } + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) + pRenderer->Present(); + pSavegameList->Initialize(1); + pLODFile.AllocSubIndicesAndIO(300, 0); + for (uint i = 0; i < 40; ++i) + { + v3 = pSavegameList->pFileList[i].pSaveFileName; + if ( !*pSavegameList->pFileList[i].pSaveFileName ) + v3 = "1.mm7"; + sprintf(pTmpBuf.data(), "saves\\%s", v3); + if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) ) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); + } + else + { + pLODFile.LoadFile(pTmpBuf.data(), 1); + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); + if ( pLODFile.FindContainer("image.pcx", 1) ) + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + else + pSavegameUsedSlots[i] = 0; + } + } + pLODFile.FreeSubIndexAndIO(); + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SaveLoadButtons, 0, 0); + pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UISaveLoad.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,1 @@ +#pragma once \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIShops.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,1978 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "UIShops.h" +#include "..\../Engine/Objects/Items.h" +#include "..\../GUIWindow.h" +#include "..\../Engine/mm7_data.h" +#include "..\../Engine/texts.h" +#include "UIHouses.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Graphics/Render.h" +#include "..\../Engine/Party.h" +#include "..\../Engine/Graphics/Texture.h" +#include "..\../Mouse.h" +#include "..\../Engine/Events2D.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/MapInfo.h" +#include "..\../Engine/Graphics/Viewport.h" +#include "..\../Engine/Graphics/Outdoor.h" +#include "..\../Engine/Graphics/Indoor.h" + + + +//----- (004B910F) -------------------------------------------------------- +void WeaponShopDialog() +{ + int phrases_id; // eax@16 + int v19; // edi@25 + GUIButton *pButton; // esi@27 + unsigned int pColorText; // ax@27 + signed int v32; // esi@41 + const char *pText; // ecx@84 + int all_text_height; // esi@96 + ItemGen *item; + int pItemID; + POINT mouse; // [sp+64h] [bp-94h]@8 + GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 + __int32 v103; // [sp+D4h] [bp-24h]@25 + int pPrice; // [sp+ECh] [bp-Ch]@26 + unsigned int v109; + int pNumString; + int item_X; + + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + + switch(dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); + pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); + all_text_height = 0; + for ( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v103 = (174 - all_text_height) / 4; + v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + pNumString = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v103 + v19; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v19; + pColorText = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); + ++pNumString; + } + } + break; + } + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + item_X = 0; + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + { + pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); + } + item_X += 70; + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + uint item_num = 0; + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + ++item_num; + } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет + else + pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки + DrawTextAtStatusBar(pText, 0); + if ( item_num ) + { + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) + { + item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) + { + pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], + uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + else + { + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + } + } + else + dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней + } + break; + } + + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + item_X = 0; + for ( uint i = 0; i < 6; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + { + pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); + } + item_X += 70; + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + uint item_num = 0; + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ++item_num; + } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + pText = pGlobalTXT_LocalizationStrings[185]; + else + pText = pGlobalTXT_LocalizationStrings[196]; + DrawTextAtStatusBar(pText, 0); + if ( item_num ) + { + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) + { + item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) + { + pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], + uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + else + { + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + } + } + else + dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + } + break; + } + + case HOUSE_DIALOGUE_SHOP_SELL: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + v109 = ((mouse.x + 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if( mouse.x <= 13 || mouse.x >= 462 ) + return; + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); + if ( !pItemID ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); + pText = BuildDialogueString(pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + break; + } + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + v109 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if( mouse.x <= 13 || mouse.x >= 462 ) + return; + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); + if ( !pItemID ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + if (!item->IsIdentified()) + { + phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); + pText = BuildDialogueString(pMerchantsIdentifyPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + else + { + pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + break; + } + + case HOUSE_DIALOGUE_SHOP_REPAIR: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); + if ( !HouseUI_CheckIfPlayerCanInteract()) + return; + pMouse->GetCursorPos(&mouse); + v109 = ((mouse.x - 14) >> 5) + 14 * (mouse.y - 17) >> 5; + if( ( mouse.x <= 13) || mouse.x >= 462 ) + return; + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); + if ( !pItemID || (!(pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes & 2)) ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); + pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return; + } + break; + + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);//sell + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);//identify + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);//repair + all_text_height = 0; + for ( int i = 0; i < 3; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v103 = (174 - all_text_height) / 3; + v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; + pNumString = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v103 + v19; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v19; + pColorText = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); + ++pNumString; + } + break; + } + + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + if (!HouseUI_CheckIfPlayerCanInteract()) + return; + uint item_num = 0; + all_text_height = 0; + v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v32 / 3 ) + pPrice = v32 / 3; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + item_num++; + } + } + if ( item_num ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v103 = (149 - all_text_height) / item_num; + if ( (149 - all_text_height) / item_num > 32 ) + v103 = 32; + v19 = (149 - item_num * v103 - all_text_height) / 2 - v103 / 2 + 162; + for ( uint i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v103 + v19; + pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; + pButton->uW = v19; + pColorText = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); + } + } + break; + } + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); + return; + } + default: + { + __debugbreak(); + break; + } + } +} + +//----- (004BA928) -------------------------------------------------------- +void ArmorShopDialog() +{ + int phrases_id; // eax@20 + int all_text_height; // ebx@22 + int v146; // [sp+E4h] [bp-20h]@24 + int v23; // ebx@24 + GUIButton *pButton; // eax@26 + signed int v38; // esi@42 + int v59; // eax@68 + const char *pText; // ecx@91 + ItemGen *selected_item; // ecx@99 + int pNumString; // edx@109 + unsigned __int16 pTextColor; // ax@109 + POINT mouse; // [sp+4Ch] [bp-B8h]@97 + GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 + __int32 pItemCount; // [sp+F0h] [bp-14h]@8 + int item_x; // [sp+100h] [bp-4h]@44 + int pPrice; + unsigned int v153; + + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + switch (dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard" + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special" + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory" + pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); + all_text_height = 0; + for( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = ( 174 - all_text_height ) / 4; + v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; + pNumString = 0; + for (int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v146 + v23; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v23; + pTextColor = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; + } + } + break; + + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка + item_x = 0; + for ( int i = 0; i < 8; ++i )// разместить вещи + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + { + if ( i >= 4 ) //low row + { + pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); + v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; + } + else + { + pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); + v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + window->GetWidth() * (98 - ItemsInShopTexture[i]->uTextureHeight); + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); + } + item_x += 105; + } + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pItemCount = 0; + for ( int i = 0; i < 8; ++i ) + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) + ++pItemCount; + } + if ( GetAsyncKeyState(VK_CONTROL) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) + pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + else + pText = pGlobalTXT_LocalizationStrings[185];//"Steal item" + DrawTextAtStatusBar(pText, 0); + if ( pItemCount ) + { + pMouse->GetCursorPos(&mouse); + if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) + return; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal()) + { + pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], + uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + else + { + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + return; + } + dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + item_x = 0; + for ( int i = 0; i < 8; ++i ) + { + if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) + { + if ( i >= 4 ) + { + pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); + v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; + } + else + { + pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); + v59 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + window->GetWidth() * (98 - ItemsInShopTexture[i]->uTextureHeight); + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); + } + item_x += 105; + } + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pItemCount = 0; + for ( uint i = 0; i < 6; ++i ) + { + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + ++pItemCount; + } + if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) + pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + else + pText = pGlobalTXT_LocalizationStrings[185]; + DrawTextAtStatusBar(pText, 0); + if ( pItemCount ) + { + pMouse->GetCursorPos(&mouse); + if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) + return; + pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; + if ( dialog_menu_id == 2 ) + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + else + selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) + { + pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], + uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + else + { + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);//"Steal %24" + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + return; + } + dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]); //"Sell" + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]); //"Identify" + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]); //"Repair" + all_text_height = 0; + for ( int i = 0; i < 3; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = (174 - all_text_height) / 3; + v23 = (3 * (58 - v146) - all_text_height) / 2 - v146 / 2 + 138; + pNumString = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v146 + v23; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v23; + pTextColor = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; + } + return; + } + break; + + case HOUSE_DIALOGUE_SHOP_SELL: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" + if ( !HouseUI_CheckIfPlayerCanInteract()) + return; + pMouse->GetCursorPos(&mouse); + v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x <= 13 || mouse.x >= 462 ) + return; + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) + return; + selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; + pText = BuildDialogueString(pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)], + uActiveCharacter - 1, selected_item, (char *) window_SpeakInHouse->par1C, 3, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return; + } + break; + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + pMouse->GetCursorPos(&mouse); + v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x > 13 && mouse.x < 462 ) + { + if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) + { + selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153)-1]; + if (selected_item->IsIdentified()) + pText = BuildDialogueString("%24", uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + else + pText = BuildDialogueString(pMerchantsIdentifyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, + (int)window_SpeakInHouse->ptr_1C, 4)], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return; + } + } + } + } + break; + case HOUSE_DIALOGUE_SHOP_REPAIR: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); + if ( !HouseUI_CheckIfPlayerCanInteract()) + return; + pMouse->GetCursorPos(&mouse); + v153 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if( mouse.x <= 13 || mouse.x >= 462 ) + return; + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) + || (!(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1].uAttributes& 2)) ) + return; + selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; + phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1], + BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); + pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return; + } + break; + + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + if (!HouseUI_CheckIfPlayerCanInteract() ) + return; + uint item_num = 0; + v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPrice = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( (signed int)pPrice < v38 / 3 ) + pPrice = v38 / 3; + all_text_height = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + item_num ++; + } + } + if ( item_num ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v146 = (149 - all_text_height) / item_num; + if ( (149 - all_text_height) / item_num > 32 ) + v146 = 32; + v23 = (149 - v146 * item_num - all_text_height) / 2 - v146 / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v146 + v23; + pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + v23 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; + pButton->uW = v23; + pTextColor = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); + } + } + return; + } + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); + return; + } + break; + default: + __debugbreak(); + } +} +//----- (004B9CC6) -------------------------------------------------------- +void AlchemistDialog() +{ + int index; // eax@7 + signed int v5; // esi@9 + int v18; // eax@23 + const char *pText; // edx@29 + unsigned int product_height_1row; // edi@55 + unsigned int product_width_1row; // esi@57 + unsigned int product_height_2row; // edi@67 + unsigned int product_width_2row; // esi@69 + ItemGen *item; // esi@118 + int v71; // eax@123 + int all_text_height; // edi@125 + GUIButton *pButton; // esi@129 + unsigned int pColorText; // ax@129 + POINT mouse; // [sp+2Ch] [bp-ACh]@117 + GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 + int v105; // [sp+B0h] [bp-28h]@19 + int pNumString; // [sp+C8h] [bp-10h]@9 + int item_num; // [sp+D4h] [bp-4h]@11 + int pPrice; + + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + switch(dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); + pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); + all_text_height = 0; + for ( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v18 = (174 - all_text_height) / 4; + v105 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + pNumString = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v18 + v105; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v105; + pColorText = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); + ++pNumString; + } + } + return; + } + + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + { + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + } + } + else if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + } + } + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID ) + { + product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; + if ( (signed int)product_height_2row < 1 ) + product_height_2row = 0; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; + } + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); + } + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + item_num = 0; + for ( uint i = 0; i < 12; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + ++item_num; + } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); + else + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); + if ( !item_num ) + { + dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) + { + item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) + { + v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); + pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + } + else + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return ; + } + } + return; + } + + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + for ( uint i = 0; i < 6; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + { + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; + } + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + } + } + for ( uint i = 0; i < 6; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid + { + product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; + if ( (signed int)product_height_2row < 1 ) + product_height_2row = 0; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; + } + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); + } + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + item_num = 0; + for ( uint i = 0; i < 12; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + ++item_num; + } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); + else + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0); + if ( !item_num ) + { + dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) + { + item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) + { + v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); + pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + } + else + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return; + } + } + return; + } + + case HOUSE_DIALOGUE_SHOP_SELL: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x <= 13 || mouse.x >= 462 ) + return; + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) + return; + v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], + BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); + pText = BuildDialogueString(pMerchantsSellPhrases[v71], uActiveCharacter - 1, &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], + (char *)window_SpeakInHouse->ptr_1C, 3, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return; + } + + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); + if ( HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x <= 13 || mouse.x >= 462 ) + return; + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1]; + if (!item->IsIdentified()) + { + v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); + pText = BuildDialogueString(pMerchantsIdentifyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + } + else + pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); + return; + } + + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]); + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]); + all_text_height = 0; + for ( int i = 0; i < 2; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v18 = (174 - all_text_height) / 2; + v105 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; + pNumString = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v18 + v105; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v105; + pColorText = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); + ++pNumString; + } + return; + } + + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + if (!HouseUI_CheckIfPlayerCanInteract()) + return; + all_text_height = 0; + v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPrice = v5 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v5 / 3 ) + pPrice = v5 / 3; + item_num = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + ++item_num; + } + } + if ( !item_num ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); + return; + } + if ( item_num ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v18 = (149 - all_text_height) / item_num; + if ( (149 - all_text_height) / item_num > 32 ) + v18 = 32; + v105 = (149 - item_num * v18 - all_text_height) / 2 - v18 / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; i++ ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = v18 + v105; + pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + v105 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; + pButton->uW = v105; + pColorText = Color16(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = Color16(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); + } + } + return; + } + } + default: + __debugbreak(); + } +} + +//----- (004B4FCF) -------------------------------------------------------- +void MagicShopDialog() +{ + int all_text_height; // edi@21 + GUIButton *control_button; // esi@25 + int v23; // eax@25 + unsigned __int16 text_color; // ax@25 + char *v30; // edx@35 + signed int v33; // esi@40 + unsigned int product_height_1row; // edi@64 + unsigned int product_width_1row; // esi@66 + unsigned int product_height_2row; // edi@76 + unsigned int product_width_2row; // esi@76 + int v75; // eax@130 + POINT mouse; // [sp+6Ch] [bp-8Ch]@30 + GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 + int item_num; // [sp+E0h] [bp-18h]@8 + int v117; // [sp+E4h] [bp-14h]@40 + int pPrice; // [sp+E8h] [bp-10h]@24 + int one_string; // [sp+ECh] [bp-Ch]@1 + int pSrtingNum; + ItemGen *item; + + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard" + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special" + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory" + pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); + all_text_height = 0; + for ( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + one_string = (174 - all_text_height) / 4; + v23 = (174 - 4 * one_string - all_text_height) / 2 - one_string / 2 + 138; + int pNumString = 0; + for (int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) + { + control_button = pDialogueWindow->GetControl(i); + control_button->uY = one_string + v23; + control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = Color16(225, 205, 35); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + text_color = Color16(255, 255, 255); + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pNumString], 3); + ++pNumString; + } + return; + } + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + { + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; + } + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + } + } + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) + { + product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; + } + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); + } + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + item_num = 0; + for ( uint i = 0; i < 12; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ++item_num; + } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" + else + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);// "Select the Item to Buy" + if ( !item_num ) + { + dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) + { + item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" + else + { + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); + v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + } + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); + return; + } + } + return; + } + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + { + product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + if ( (signed int)product_height_1row < 1 ) + product_height_1row = 0; + product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) + product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_1row < 18 ) + product_width_1row = 18; + } + pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + } + } + for ( uint i = 0; i < 6; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) + { + product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; + if ( (signed int)product_height_2row < 1 ) + product_height_2row = 0; + product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + if ( i ) + { + if ( i == 5 ) + { + if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) + product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + } + } + else + { + if ( (signed int)product_width_2row < 18 ) + product_width_2row = 18; + } + pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); + } + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + item_num = 0; + for ( uint i = 0; i < 12; ++i ) + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + ++item_num; + } + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" + else + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);// "Select the Special Item to Buy" + if ( !item_num ) + { + dialog_window.DrawShops_next_generation_time_string( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) + { + item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) + v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" + else + { + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); + v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + } + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); + return; + } + } + return; + } + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);// "Sell" + pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);// "Identify" + pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);// "Repair" + all_text_height = 0; + for ( uint i = 0; i < 3; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + one_string = ((174 - all_text_height) / 3); + v23 = (3 * (58 - (signed int)one_string) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; + pSrtingNum = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + control_button = pDialogueWindow->GetControl(i); + control_button->uY = one_string + v23; + control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); + v23 = control_button->uHeight + control_button->uY - 1; + control_button->uW = v23; + text_color = Color16(225, 205, 35); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + text_color = Color16(255, 255, 255); + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pSrtingNum], 3); + ++pSrtingNum; + } + return; + } + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x <= 13 || mouse.x >= 462 ) + return; + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); + v30 = BuildDialogueString(pMerchantsSellPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); + return; + } + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + pMouse->GetCursorPos(&mouse); + v117 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x > 13 && mouse.x < 462 ) + { + if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) + { + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; + if ( item->uAttributes & ITEM_IDENTIFIED ) + { + dialog_window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), &dialog_window, 0, 0)) / 2 + 101, + Color16(255, 255, 255), BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), 3); + return; + } + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); + v30 = BuildDialogueString(pMerchantsIdentifyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); + return; + } + } + } + return; + } + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) + { + draw_leather(); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" + if ( !HouseUI_CheckIfPlayerCanInteract() ) + return; + pMouse->GetCursorPos(&mouse); + v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if ( mouse.x <= 13 || mouse.x >= 462 ) + return; + if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) + || !(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)-1].uAttributes& 2) ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1], + BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); + v30 = BuildDialogueString(pMerchantsRepairPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); + return; + } + + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + { + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + all_text_height = 0; + v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPrice = v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v33 / 3 ) + pPrice = v33 / 3; + item_num = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) + { + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + ++item_num; + } + } + if ( !item_num ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// + // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(225, 205, 35), pTmpBuf.data(), 3); + return; + } + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + one_string = (149 - all_text_height) / item_num; + if ( one_string > 32 ) + one_string = 32; + v23 = (149 - item_num * one_string - all_text_height) / 2 - one_string / 2 + 162; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i) + { + control_button = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][control_button->msg_param - 36] + || pPlayers[uActiveCharacter]->pActiveSkills[control_button->msg_param - 36] ) + { + control_button->uW = 0; + control_button->uHeight = 0; + control_button->uY = 0; + } + else + { + control_button->uY = one_string + v23; + control_button->uHeight = pFontArrus->CalcTextHeight(pSkillNames[control_button->msg_param - 36], &dialog_window, 0, 0); + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = Color16(225, 205, 35); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + text_color = Color16(255, 255, 255); + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pSkillNames[control_button->msg_param - 36], 3); + } + } + } + return; + } + return; +} +//----- (004BDB56) -------------------------------------------------------- +void UIShop_Buy_Identify_Repair() +{ + int v8; // eax@15 + unsigned int pItemID; // esi@20 + ItemGen *item; // esi@21 + unsigned int v15; // eax@33 + POINT *pCursorPos; // esi@37 + int v18; // ecx@37 + float pPriceMultiplier; // ST1C_4@38 + int taken_item; // eax@40 + ItemGen *bought_item; // esi@51 + int party_reputation; // eax@55 + int v39; // eax@63 + int v42; // esi@74 + signed int v43; // ebx@74 + unsigned __int16 *pSkill; // esi@77 + int v55; // [sp+0h] [bp-B4h]@26 + POINT cursor; // [sp+40h] [bp-74h]@37 + int a6; // [sp+98h] [bp-1Ch]@57 + int a3; // [sp+9Ch] [bp-18h]@53 + unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 + unsigned int v79; // [sp+A8h] [bp-Ch]@9 + int uPriceItemService; // [sp+ACh] [bp-8h]@12 + + if ( pCurrentScreen == SCREEN_E ) + { + pPlayers[uActiveCharacter]->OnInventoryLeftClick(); + return; + } + if ( !HouseUI_CheckIfPlayerCanInteract() ) + { + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + return; + } + + switch(dialog_menu_id) + { + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + pPlayers[uActiveCharacter]->OnInventoryLeftClick(); + break; + } + case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: + { + pMouse->GetCursorPos(&cursor); + v18 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; + if ( !v18 ) + return; + bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); + pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); + GetAsyncKeyState(VK_CONTROL); + if ( pParty->uNumGold < uPriceItemService ) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); + return; + } + taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); + if ( taken_item ) + { + bought_item->SetIdentified(); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1], bought_item, 0x24u); + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + viewparams->bRedrawGameUI = 1; + bought_item->Reset(); + pRenderer->ClearZBuffer(0, 479); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" + break; + } + case HOUSE_DIALOGUE_SHOP_SELL: + { + v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&cursor)->x <= 13 + || pMouse->GetCursorPos(&cursor)->x >= 462 + || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) + return; + if ( pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1].MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) + { + dword_F8B1E4 = 1; + pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); + viewparams->bRedrawGameUI = 1; + pRenderer->ClearZBuffer(0, 479); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + break; + } + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + { + pMouse->GetCursorPos(&cursor); + v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); + if (cursor.x > 13 && cursor.x < 462) + { + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); + if ( pItemID ) + { + uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + if ( !(item->uAttributes & ITEM_IDENTIFIED) ) + { + if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) + { + if ( pParty->uNumGold >= uPriceItemService ) + { + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + item->uAttributes |= ITEM_IDENTIFIED; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); + return; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + return; + } + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); + return; + } + } + break; + } + case HOUSE_DIALOGUE_SHOP_REPAIR: + { + v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&cursor)->x > 13 ) + { + if ( pMouse->GetCursorPos(&cursor)->x < 462 ) + { + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); + if ( pItemID ) + { + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + ItemGen* _v = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); + if ( item->uAttributes & ITEM_BROKEN ) + { + if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) + { + if ( pParty->uNumGold >= uPriceItemService ) + { + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + v8 = item->uAttributes; + LOBYTE(v8) = item->uAttributes & 0xFD; + item->uAttributes = v8 | 1; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); + return; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + return; + } + pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); + return; + } + } + } + break; + } + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + pCursorPos = pMouse->GetCursorPos(&cursor); + v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; + if ( !v18 ) + return; + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; + else + bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; + uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); + uNumSeconds = 0; + a3 = 0; + if ( pMapStats->GetMapInfo(pCurrentMapName) ) + a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; + party_reputation = pParty->GetPartyReputation(); + if (pPlayers[uActiveCharacter]->CanSteal() && GetAsyncKeyState(VK_CONTROL)) + { + uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); + if ( !uNumSeconds ) + { + sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); + return; + } + } + else if (pParty->uNumGold < uPriceItemService) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" + return; + } + v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); + if ( v39 ) + { + bought_item->SetIdentified(); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); + if (uNumSeconds != 0) + { + pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); + sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); + } + else + { + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + } + viewparams->bRedrawGameUI = 1; + bought_item->Reset(); + pRenderer->ClearZBuffer(0, 479); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); + return; + } + else + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" + return; + } + break; + } + default:// if click video screen in shop + { + __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum + if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) + { + v42 = dialog_menu_id - 36; + //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( uPriceItemService < v43 / 3 ) + uPriceItemService = v43 / 3; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) + { + pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; + if ( !*pSkill ) + { + if ( pParty->uNumGold < uPriceItemService ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" + if ( in_current_building_type == BuildingType_Training ) + v55 = 4; + else + v55 = 2; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); + return; + } + Party::TakeGold(uPriceItemService); + dword_F8B1E4 = 1; + *pSkill = 1; + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); + return; + } + } + } + break; + } + } +} +//----- (004B1A2D) -------------------------------------------------------- +void ShowPopupShopItem() +{ + int v3; // ecx@5 +// unsigned int v6; // eax@13 + ItemGen *v7; // ecx@13 + POINT cursor; // [sp+30h] [bp-1Ch]@17 + + if ( in_current_building_type <= 0 ) + return; + if ( dialog_menu_id < HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + return; + if ( in_current_building_type <= BuildingType_AlchemistShop ) + { + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) + { + pMouse->GetCursorPos(&cursor); + v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; + if ( !v3 ) + return; + v7 = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1]; + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) + v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1]; + GameUI_DrawItemInfo(v7); + return; + } + + if ( dialog_menu_id >= HOUSE_DIALOGUE_SHOP_SELL && dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR + || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) + { + pMouse->GetCursorPos(&cursor); + v3 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); + if ( cursor.x <= 13 || cursor.x >= 462 + || !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) ) + return; + GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) - 1]); + return; + } + } + if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) + { + pMouse->GetCursorPos(&cursor); + v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; + if ( v3 ) + { + unsigned int guildId = (unsigned int)window_SpeakInHouse->ptr_1C - 139; + sub_4B1523_showSpellbookInfo(pParty->SpellBooksInGuilds[guildId][v3].uItemID); + } + } +} + +//----- (004B1523) -------------------------------------------------------- +void sub_4B1523_showSpellbookInfo(int spellItemId) +{ + int spellId; // esi@1 + int spellLevel; // edx@1 + unsigned int v3; // eax@2 + int v4; // eax@4 + LONG v5; // ecx@4 + int v6; // eax@10 + char *v7; // ST44_4@12 + unsigned __int16 v8; // ax@12 + GUIWindow a1; // [sp+Ch] [bp-68h]@4 + unsigned int spellSchool; // [sp+60h] [bp-14h]@1 + POINT a2; // [sp+64h] [bp-10h]@1 + int v13; // [sp+6Ch] [bp-8h]@4 + int v14; // [sp+70h] [bp-4h]@4 + + spellId = spellItemId - 399; + spellLevel = (spellItemId - 400) % 11 + 1; + spellSchool = 4 * (spellItemId - 400) / 11; + // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used + if ( pMouse->GetCursorPos(&a2)->y <= 320 ) + v3 = pMouse->GetCursorPos(&a2)->y + 30; + else + v3 = 30; + a1.Hint = nullptr; + a1.uFrameY = v3; + a1.uFrameWidth = 328; + a1.uFrameHeight = 68; + a1.uFrameX = 90; + a1.uFrameZ = 417; + a1.uFrameW = v3 + 67; + a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); + v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); + v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); + v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); + v5 = a2.y; + if ( v14 > a2.y ) + v5 = v14; + if ( v13 > v5 ) + v5 = v13; + if ( v4 > v5 ) + v5 = v4; + sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", + pSpellStats->pInfos[spellId].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" + v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" + v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" + v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" + v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pGrandmasterSkillDesc); + v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); + a1.uFrameHeight += v6; + if ( (signed int)a1.uFrameHeight < 150 ) + a1.uFrameHeight = 150; + a1.uFrameWidth = game_viewport_width; + a1.DrawMessageBox(0); + a1.uFrameWidth -= 12; + a1.uFrameHeight -= 12; + v7 = pSpellStats->pInfos[spellId].pName; + a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; + a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; + v8 = Color16(0xFFu, 0xFFu, 0x9Bu); + a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); + a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); + a1.uFrameZ = a1.uFrameX + 107; + a1.uFrameWidth = 108; + a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[spellSchool / 4 + 12], 3u); + sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * spellId)); + a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); +} +//----- (004B1D27) -------------------------------------------------------- +void GetHouseGoodbyeSpeech() +{ + signed int v2; // edi@10 + signed int v5; // edi@20 + int v7[4]; // [sp+Ch] [bp-10h]@12 + + if ( in_current_building_type > 0 ) + { + if ( in_current_building_type > BuildingType_MagicShop ) + { + if ( in_current_building_type == BuildingType_Bank ) + { + if ( !dword_F8B1E4 ) + return; + } + else + { + if ( in_current_building_type != BuildingType_Temple ) + return; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); + return; + } + if ( (signed __int64)pParty->PartyTimes._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed ) + { + if ( pParty->uNumGold <= 10000 ) + { + if ( !dword_F8B1E4 ) + return; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); + return; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)(dword_F8B1E4 + 3)); + if ( !dword_F8B1E4 && !_A750D8_player_speech_timer ) + { + v5 = 0; + for ( uint i = 1; i <= 4; ++i ) + { + if ( pPlayers[i]->CanAct() ) + v7[v5++] = i; + } + if ( v5 ) + { + _A750D8_player_speech_timer = 256i64; + PlayerSpeechID = SPEECH_80; + uSpeakingCharacter = v7[rand() % v5]; + return; + } + } + } + else + { + if ( !_A750D8_player_speech_timer ) + { + v2 = 0; + for ( uint i = 1; i <= 4; ++i ) + { + if ( pPlayers[i]->CanAct() ) + v7[v2++] = i; + } + if ( v2 ) + { + _A750D8_player_speech_timer = 256i64; + PlayerSpeechID = SPEECH_80; + uSpeakingCharacter = v7[rand() % v2]; + return; + } + } + } + } +} + +//----- (004B1447) -------------------------------------------------------- +void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd) +{ + signed int v3; // esi@1 + DDM_DLV_Header *v7; // eax@14 + + if (stealingResult == 0 || stealingResult == 1) + { + if (pParty->uFine < 4000000) + { + if (fineToAdd + pParty->uFine < 0) + pParty->uFine = 0; + else if (fineToAdd + pParty->uFine > 4000000) + pParty->uFine = 4000000; + else + pParty->uFine += fineToAdd; + } + if (pParty->uFine) + { + for (uint i = 1; i <= 4; ++i) + { + if (!_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1)) + _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); + } + } + if (stealingResult == 1) + v3 = 2; + else + v3 = 1; + } + else + v3 = 2; + pParty->PartyTimes._shop_ban_times[shopId] = pParty->uTimePlayed + 368640; + pParty->InTheShopFlags[shopId] = 1; + v7 = &pOutdoor->ddm; + if (uCurrentlyLoadedLevelType != LEVEL_Outdoor) + v7 = &pIndoor->dlv; + v7->uReputation += v3; + if (v7->uReputation > 10000) + v7->uReputation = 10000; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UIShops.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,6 @@ +#pragma once +void UIShop_Buy_Identify_Repair(); +void sub_4B1523_showSpellbookInfo(int spellItemId); +void ShowPopupShopItem(); +void GetHouseGoodbyeSpeech(); +void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UITransition.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,208 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include <io.h> + +#include "..\../Engine/ErrorHandling.h" +#include "..\../Engine/mm7_data.h" +#include "..\../MediaPlayer.h" +#include "..\../Engine/MapInfo.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../GUIProgressBar.h" +#include "..\../Engine/Party.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/Graphics/Outdoor.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/Timer.h" +#include "..\../Engine/stru159.h" +#include "..\../Engine/Events2D.h" +#include "..\../Engine/texts.h" +#include "UIHouses.h" + + + + +//----- (00444839) -------------------------------------------------------- +void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) +{ + const char *v15; // eax@14 + char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 + + dword_59117C_teleportx = x; + dword_591178_teleporty = y; + dword_591174_teleportz = z; + dword_591170_teleport_directiony = directiony; + dword_59116C_teleport_directionx = directionx; + dword_591168_teleport_speedz = a8; + dword_591164_teleport_map_name = (char *)pLocationName; + uCurrentHouse_Animation = anim_id; + pEventTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; + default: Error("Invalid alignment: %u", pParty->alignment); + } + + pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)]; + pTexture_outside = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[exit_pic_id], TEXTURE_16BIT_PALETTE); + if (anim_id) + { + if ( !IndoorLocation::GetLocationIndex(pLocationName) ) + pMediaPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1); + } + else if ( !IndoorLocation::GetLocationIndex(pLocationName) ) + { + if ( pMapStats->GetMapInfo(pCurrentMapName) ) + { + sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); // "Leave %s" + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); + //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) + //PlayHouseSound(anim_id, HouseSound_Greeting); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); + if ( IndoorLocation::GetLocationIndex(pLocationName) ) + uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); + return; + } + strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]); + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); + //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) + //PlayHouseSound(anim_id, HouseSound_Greeting); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); + if ( IndoorLocation::GetLocationIndex(pLocationName) ) + uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); + return; + } + v15 = pLocationName; + if ( *pLocationName == 48 ) + v15 = pCurrentMapName; + if ( pMapStats->GetMapInfo(v15) ) + { + sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s] + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); + if ( IndoorLocation::GetLocationIndex(pLocationName) ) + uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); + return; + } + strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); + //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) + //PlayHouseSound(anim_id, HouseSound_Greeting); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); + if ( IndoorLocation::GetLocationIndex(pLocationName) ) + uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); +} + +//----- (00444C8F) -------------------------------------------------------- +void TravelUI_Load() +{ + char pContainer[32]; // [sp+0h] [bp-28h]@1 + + pEventTimer->Pause(); + + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; + default: Error("Invalid alignment: %u", pParty->alignment); + } + + pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); + if ( pMapStats->GetMapInfo(pCurrentMapName) ) + sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);// "Leave %s" + else + strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit" + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_ChangeLocation, 0, sHouseName.data()); +} + +//----- (00444DCA) -------------------------------------------------------- +void TravelUI_Draw() +{ + GUIWindow travel_window; // [sp+Ch] [bp-78h]@1 + char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1 + + memcpy(&travel_window, pPrimaryWindow, sizeof(travel_window)); + pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); + pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureTransparent(468, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); + pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); + pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); + if ( pMapStats->GetMapInfo(pDestinationMapName) ) + { + travel_window.uFrameX = 493; + travel_window.uFrameWidth = 126; + travel_window.uFrameZ = 366; + travel_window.DrawTitleText(pFontCreate, 0, 4, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName, 3); + travel_window.uFrameX = 483; + travel_window.uFrameWidth = 148; + travel_window.uFrameZ = 334; + if ( GetTravelTime() == 1 ) + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[663], 1, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d day to cross to %s." + else + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[128], GetTravelTime(), pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d days to travel to %s." + + strcat(pTmpBuf.data(), "\n \n"); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); + strcat(pTmpBuf.data(), pTmpBuf2.data()); + travel_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); + _unused_5B5924_is_travel_ui_drawn = 1; + } +} + +//----- (00444A51) -------------------------------------------------------- +void TransitionUI_Draw() +{ + unsigned int v4; // [sp-10h] [bp-7Ch]@12 + GUIWindow transition_window; // [sp+Ch] [bp-60h]@1 + unsigned int v9; // [sp+60h] [bp-Ch]@1 + unsigned int map_id; // [sp+64h] [bp-8h]@1 + + memcpy(&transition_window, pPrimaryWindow, sizeof(transition_window)); + v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); + pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); + uTextureID_right_panel_loop = uTextureID_right_panel; + pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); + pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); + pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); + map_id = pMapStats->GetMapInfo(pCurrentMapName); + if ( (pMovie_Track || v9) && *dword_591164_teleport_map_name != ' ' ) + map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name); + transition_window.uFrameX = 493; + transition_window.uFrameWidth = 126; + transition_window.uFrameZ = 366; + transition_window.DrawTitleText(pFontCreate, 0, 5, 0, pMapStats->pInfos[map_id].pName, 3); + transition_window.uFrameX = 483; + transition_window.uFrameWidth = 148; + transition_window.uFrameZ = 334; + + if ( uCurrentHouse_Animation ) + { + v4 = (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uCurrentHouse_Animation], &transition_window, 0, 0)) / 2 + 101; + transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTransitionStrings[uCurrentHouse_Animation], 3); + } + else if ( map_id ) + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapStats->pInfos[map_id].pName);// "Do you wish to leave %s?" + v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &transition_window, 0, 0)) / 2 + 101; + transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3); + } + else Error("Troubles in da house"); + + _unused_5B5924_is_travel_ui_drawn = true; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UITransition.h Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,1 @@ +#pragma once \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UI/UiGame.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -0,0 +1,2260 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "..\../Engine/Events.h" +#include "..\../Engine/Graphics/Texture.h" +#include "..\../Engine/MM7.h" +#include "..\../Engine/ErrorHandling.h" + +#include "..\../Mouse.h" +#include "..\../Keyboard.h" +#include "..\../Engine/mm7_data.h" + +#include "..\../Engine/Graphics/Vis.h" +#include "..\../Engine/MapInfo.h" +#include "..\../Engine/Game.h" +#include "..\../GUIWindow.h" +#include "..\../GUIFont.h" +#include "..\../Engine/Party.h" +#include "..\../AudioPlayer.h" +#include "..\../Engine/Graphics/Outdoor.h" +#include "..\../Engine/LOD.h" +#include "..\../Engine/Objects/Actor.h" +#include "..\../Engine/Graphics/Viewport.h" +#include "..\../Engine/Objects/SpriteObject.h" +#include "..\../Engine/Objects/ObjectList.h" +#include "..\../Engine/Graphics/DecorationList.h" +#include "..\../Engine/Tables/PlayerFrameTable.h" +#include "..\../Engine/stru123.h" +#include "..\../Engine/Timer.h" +#include "..\../Engine/Tables/IconFrameTable.h" +#include "..\../Engine/TurnEngine/TurnEngine.h" +#include "..\../Engine/texts.h" +#include "UIHouses.h" +#include "..\../Engine/Graphics/BSPModel.h" +#include "..\../Engine/OurMath.h" +#include "..\../Engine/Graphics/Level/Decoration.h" +#include "..\../Engine/Objects/Chest.h" +#include "UIGame.h" + +#include "..\../Engine/Graphics/Overlays.h" + +#include "..\../Engine/Graphics/Sprites.h" +#include "..\../Engine/Graphics/PaletteManager.h" + +int uTextureID_GameUI_CharSelectionFrame; // 50C98C + +//----- (00421D00) -------------------------------------------------------- +void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) +{ + Player* player = &pParty->pPlayers[uPlayerID - 1]; + if (pParty->pPickedItem.uItemID) + { + if (int slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) + { + memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u); + viewparams->bRedrawGameUI = true; + pMouse->RemoveHoldingItem(); + return; + } + + if (!player->CanAct()) + { + player = pPlayers[uActiveCharacter]; + } + if( player->CanAct() || !pPlayers[uActiveCharacter]->CanAct() ) + player->PlaySound(SPEECH_NoRoom, 0); + } + + if (pCurrentScreen == SCREEN_GAME) + { + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter != uPlayerID ) + { + if ( pPlayers[uPlayerID]->uTimeToRecovery ) + return; + + uActiveCharacter = uPlayerID; + return; + } + pGUIWindow_CurrentMenu = CharacterUI_Initialize(7); + return; + } + if ( pCurrentScreen == SCREEN_SPELL_BOOK ) + return; + if ( pCurrentScreen == SCREEN_CHEST ) + { + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter == uPlayerID ) + { + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + pCurrentScreen = SCREEN_CHEST_INVENTORY; + uActiveCharacter = uPlayerID; + return; + } + if ( pPlayers[uPlayerID]->uTimeToRecovery ) + return; + uActiveCharacter = uPlayerID; + return; + } + if ( pCurrentScreen != SCREEN_HOUSE ) + { + if ( pCurrentScreen == SCREEN_E ) + { + uActiveCharacter = uPlayerID; + return; + } + if ( pCurrentScreen != SCREEN_CHEST_INVENTORY ) + { + viewparams->bRedrawGameUI = true; + uActiveCharacter = uPlayerID; + if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) + FillAwardsData(); + return; + } + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter == uPlayerID ) + { + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + pCurrentScreen = SCREEN_CHEST_INVENTORY; + uActiveCharacter = uPlayerID; + return; + } + if ( pPlayers[uPlayerID]->uTimeToRecovery ) + return; + uActiveCharacter = uPlayerID; + return; + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + return; + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter != uPlayerID ) + { + uActiveCharacter = uPlayerID; + return; + } + if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) + { + __debugbreak(); // fix indexing + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + pGUIWindow_CurrentMenu = CharacterUI_Initialize(14); + return; + } +} +// 4E28F8: using guessed type int pCurrentScreen; +// F8B19C: using guessed type int dword_F8B19C; + +//----- (00416B01) -------------------------------------------------------- +void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText +{ + int v1; // edi@2 + NPCData *pNPC; // eax@16 + const CHAR *pText; // eax@18 + char *v11; // esi@26 + GUIWindow popup_window; // [sp+Ch] [bp-60h]@23 + int a2; // [sp+60h] [bp-Ch]@16 + LPCSTR lpsz; // [sp+68h] [bp-4h]@6 + + if ( bNoNPCHiring != 1 ) + { + v1 = 0; + /*do + { + if ( v3->pName ) + pTmpBuf[v1++] = v2; + ++v3; + ++v2; + } + while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/ + for (int i = 0; i < 2; ++i) + { + if (pParty->pHirelings[i].pName) + pTmpBuf[v1++] = i; + } + lpsz = 0; + if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) + { + /*v4 = pNPCStats->pNewNPCData; + do + { + if ( v4->uFlags & 0x80 + && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName)) + && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) ) + pTmpBuf[v1++] = (char)lpsz + 2; + ++lpsz; + ++v4; + } + while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ + for ( uint i = 0; i < pNPCStats->uNumNewNPCs; ++i ) + { + if (pNPCStats->pNewNPCData[i].Hired()) + { + if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) + { + if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) + pTmpBuf[v1++] = i + 2; + } + } + } + } + if ( (signed int)((char *)_this + pParty->hirelingScrollPosition) < v1 ) + { + sDialogue_SpeakingActorNPC_ID = -1 - pParty->hirelingScrollPosition - (int)_this; + pNPC = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &a2); + if ( pNPC ) + { + if ( a2 == 57 ) + pText = pNPCTopics[512].pText; // Baby dragon + else + pText = (const CHAR *)pNPCStats->pProfessions[pNPC->uProfession].pBenefits; + lpsz = pText; + if ( !pText ) + { + lpsz = (LPCSTR)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; + if ( !lpsz ) + lpsz = ""; + } + popup_window.Hint = nullptr; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + popup_window.uFrameWidth = 276; + popup_window.uFrameZ = 313; + popup_window.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &popup_window, 0, 0) + 2 * LOBYTE(pFontArrus->uFontHeight) + 24; + if ( (signed int)popup_window.uFrameHeight < 130 ) + popup_window.uFrameHeight = 130; + popup_window.uFrameWidth = 400; + popup_window.uFrameZ = popup_window.uFrameX + 399; + popup_window.DrawMessageBox(0); + sprintfex(pTmpBuf2.data(), "NPC%03d", pNPC->uPortraitID); + pRenderer->DrawTextureIndexed(popup_window.uFrameX + 22, popup_window.uFrameY + 36, + (Texture *)(pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE) != -1 + ? &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE)] : 0)); + if ( pNPC->uProfession ) + { + v11 = pTmpBuf.data(); + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]); + } + else + { + v11 = pTmpBuf.data(); + strcpy(pTmpBuf.data(), pNPC->pName); + } + popup_window.DrawTitleText(pFontArrus, 0, 12, Color16(0xFFu, 0xFFu, 0x9Bu), v11, 3); + popup_window.uFrameWidth -= 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.DrawText(pFontArrus, 100, 36, 0, BuildDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0), 0, 0, 0); + } + } + } +} + +//----- (00445D4A) -------------------------------------------------------- +void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello) +{ + NPCData *pNPCInfo; // ebp@1 + int v9; // esi@8 + int pNumberContacts; // eax@11 + char pContainer[32]; // [sp+14h] [bp-28h]@3 + + dword_A74CDC = -1; + pNPCStats->dword_AE336C_LastMispronouncedNameFirstLetter = -1; + pEventTimer->Pause(); + pMiscTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + uDialogueType = 0; + sDialogue_SpeakingActorNPC_ID = actor->sNPC_ID; + pDialogue_SpeakingActor = actor; + pNPCInfo = GetNPCData(actor->sNPC_ID); + if ( (pNPCInfo->uFlags & 3) != 2 ) + pNPCInfo->uFlags = pNPCInfo->uFlags + 1; + + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; + } + + pDialogueNPCCount = 0; + uNumDialogueNPCPortraits = 1; + pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + sprintfex(pContainer, "npc%03u", pNPCInfo->uPortraitID); + v9 = 0; + pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + dword_591084 = areWeLoadingTexture; + uTextureID_right_panel_loop = uTextureID_right_panel; + if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 ) + { + if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame + || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) ) + { + v9 = 1; + } + else + { + if ( pNumberContacts > 1 ) + { + if ( pNumberContacts == 2 ) + { + v9 = 3; + } + else + { + if ( pNumberContacts != 3 ) + { + if ( pNumberContacts != 4 ) + v9 = 1; + } + else + { + v9 = 2; + } + } + } + else if ( pNPCInfo->rep ) + { + v9 = 2; + } + } + } + if (sDialogue_SpeakingActorNPC_ID < 0) + v9 = 4; + pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3; + if (pNPCInfo->Hired() && !pNPCInfo->bHasUsedTheAbility) + { + if (pNPCInfo->uProfession == 10 || //Healer + pNPCInfo->uProfession == 11 || //Expert Healer + pNPCInfo->uProfession == 12 || //Master Healer + pNPCInfo->uProfession == 33 || //Cook + pNPCInfo->uProfession == 34 || //Chef + pNPCInfo->uProfession == 39 || //Wind Master + pNPCInfo->uProfession == 40 || //Water Master + pNPCInfo->uProfession == 41 || //Gate Master + pNPCInfo->uProfession == 42 || //Chaplain + pNPCInfo->uProfession == 43 || //Piper + pNPCInfo->uProfession == 52 //Fallen Wizard + ) + { + pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); + } + } + + pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired()) + { + if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); + else + pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); + } +} + +//----- (00445350) -------------------------------------------------------- +void GameUI_DrawDialogue() +{ + NPCData *pNPC; // ebx@2 + int pGreetType; // eax@2 + int pTextHeight; // esi@39 + GUIButton *pButton; // eax@43 + int all_text_height; // ebx@93 + signed int index; // esi@99 + int v42; // edi@102 + int v45; + unsigned __int16 pTextColor; // ax@104 + GUIWindow window; // [sp+ACh] [bp-68h]@42 +// GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 + const char *pInString=nullptr; // [sp+110h] [bp-4h]@32 + + if ( !pDialogueWindow ) + return; + + // Window title(Заголовок окна)---- + memcpy(&window, pDialogueWindow, sizeof(window)); + pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); + pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID); + window.uFrameWidth -= 10; + window.uFrameZ -= 10; + pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[0]); + + if (pNPC->uProfession) + { + assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames.data())); // sometimes buffer overflows; errors emerge both here and in dialogue text + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s + } + else if (pNPC->pName) + strcpy(pTmpBuf.data(), pNPC->pName); + + window.DrawTitleText(pFontArrus, 483, 112, ui_game_dialogue_npc_name_color, pTmpBuf.data(), 3); + pParty->GetPartyFame(); + + pInString = nullptr; + switch (uDialogueType) + { + case DIALOGUE_13: + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + break; + + case DIALOGUE_PROFESSION_DETAILS: + { + //auto prof = pNPCStats->pProfessions[pNPC->uProfession]; + + if (dialogue_show_profession_details) + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pBenefits, uActiveCharacter - 1, 0, 0, 0, 0); + else if (pNPC->Hired()) + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); + else + pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + } + break; + + + case DIALOGUE_ARENA_WELCOME: + pInString = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" + break; + + case DIALOGUE_ARENA_FIGHT_NOT_OVER_YET: + pInString = pGlobalTXT_LocalizationStrings[577]; //"Get back in there you wimps:" + break; + + case DIALOGUE_ARENA_REWARD: + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold." + pInString = pTmpBuf.data(); + break; + + case DIALOGUE_ARENA_ALREADY_WON: + pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" + break; + + default: + if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_EVT_E && !byte_5B0938[0]) + { + pInString = (char *)current_npc_text; + } + else if (pGreetType == 1)//QuestNPC_greet + { + if (pNPC->greet) + { + if ((pNPC->uFlags & 3) == 2) + pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting2; + else + pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting1; + } + } + else if (pGreetType == 2)//HiredNPC_greet + { + NPCProfession* prof = &pNPCStats->pProfessions[pNPC->uProfession]; + + if (pNPC->Hired()) + pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); + else + pInString = BuildDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); + } + break; + } + + // Message window(Окно сообщения)---- + if (pInString) + { + window.uFrameWidth = game_viewport_width; + window.uFrameZ = 452; + GUIFont* font = pFontArrus; + pTextHeight = pFontArrus->CalcTextHeight(pInString, &window, 13, 0) + 7; + if ( 352 - pTextHeight < 8 ) + { + font = pFontCreate; + pTextHeight = pFontCreate->CalcTextHeight(pInString, &window, 13, 0) + 7; + } + if (uTextureID_Leather != -1) + pRenderer->GetLeather(8, 352 - pTextHeight, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + pDialogueWindow->DrawText(font, 13, 354 - pTextHeight, 0, FitTextInAWindow(pInString, font, &window, 13, 0), 0, 0, 0); + } + // Right panel(Правая панель)------- + memcpy(&window, pDialogueWindow, sizeof(window)); + window.uFrameX = 483; + window.uFrameWidth = 148; + window.uFrameZ = 334; + for (int i = window.pStartingPosActiveItem; i < window.pStartingPosActiveItem + window.pNumPresenceButton; ++i) + { + pButton = window.GetControl(i); + if ( !pButton ) + break; + + if ( pButton->msg_param > 88 ) + pButton->pButtonName[0] = 0; + else if (pButton->msg_param == 88) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord + else if (pButton->msg_param == 87) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight + else if (pButton->msg_param == 86) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire + else if (pButton->msg_param == 85) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page + else if (pButton->msg_param == 77) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details + else if (pButton->msg_param == 76) + { + if (pNPC->Hired()) + sprintf(pButton->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s + else + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire + } + else if (pButton->msg_param == 24) + { + __debugbreak(); // learn conditions of this event + if (!pNPC->evt_F) + { + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; + } + else + strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_F].pTopic); + } + else if (pButton->msg_param == 9) + strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession)); + else if (pButton->msg_param == 19) // Scavenger Hunt + { + if (!pNPC->evt_A) + { + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; + } + else + strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_A].pTopic); + } + else if (pButton->msg_param == 20) // Scavenger Hunt + { + if (!pNPC->evt_B) + { + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; + } + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_B].pTopic); + } + else if (pButton->msg_param == 21) + { + //__debugbreak(); // learn conditions of this event + if (!pNPC->evt_C) + { + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; + } + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_C].pTopic); + } + else if (pButton->msg_param == 22) + { + //__debugbreak(); // learn conditions of this event + if (!pNPC->evt_D) + { + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; + } + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_D].pTopic); + } + else if (pButton->msg_param == 23) + { + //__debugbreak(); // learn conditions of this event + if (!pNPC->evt_E) + { + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; + } + else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_E].pTopic); + } + else if (pButton->msg_param == 13) + { + if (pNPC->Hired()) + sprintf(pButton->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s + else + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join + } + else + pButton->pButtonName[0] = 0; + + if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1) + { + int num_dead_actors = 0; + pInString = nullptr; + for ( uint i = 0; i < uNumActors; ++i ) + { + if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) + ++num_dead_actors; + else + { + int sumonner_type = PID_TYPE(pActors[i].uSummonerID); + if (sumonner_type == OBJECT_Player) + ++num_dead_actors; + } + } + if (num_dead_actors == uNumActors) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize + } + } + + // Install Buttons(Установка кнопок)-------- + index = 0; + all_text_height = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !pButton ) + break; + all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); + index++; + } + if ( index ) + { + v45 = (174 - all_text_height) / index; + if ( v45 > 32 ) + v45 = 32; + v42 = (174 - v45 * index - all_text_height)/ 2 - v45 / 2 + 138; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + if ( !pButton ) + break; + pButton->uY = (unsigned int)(v45 + v42); + pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); + pButton->uHeight = pTextHeight; + v42 = pButton->uY + pTextHeight - 1; + pButton->uW = v42; + pTextColor = ui_game_dialogue_option_normal_color; + if ( pDialogueWindow->pCurrentPosActiveItem == i ) + pTextColor = ui_game_dialogue_option_highlight_color; + window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); + } + } + pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); +} + +//----- (00444FBE) -------------------------------------------------------- +void GameUI_DrawBranchlessDialogue() +{ + int pTextHeight; // esi@4 + char Str[200]; // [sp+Ch] [bp-120h]@12 + GUIWindow BranchlessDlg_window; // [sp+D4h] [bp-58h]@4 + GUIFont *pFont; // [sp+128h] [bp-4h]@1 + + pFont = pFontArrus; + if ( current_npc_text && !byte_5B0938[0] ) + strcpy(byte_5B0938.data(), current_npc_text); + BranchlessDlg_window.uFrameWidth = game_viewport_width; + BranchlessDlg_window.uFrameZ = 452; + pTextHeight = pFontArrus->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; + if ( 352 - pTextHeight < 8 ) + { + pFont = pFontCreate; + pTextHeight = pFontCreate->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; + } + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + pGUIWindow2->DrawText(pFont, 12, 354 - pTextHeight, 0, FitTextInAWindow(byte_5B0938.data(), pFont, &BranchlessDlg_window, 12, 0), 0, 0, 0); + pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); + if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) + { + if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + strcpy(GameUI_Footer_TimedString.data(), pKeyActionMap->pPressedKeysBuffer); + sub_4452BB(); + return; + } + if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) + return; + pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); + sub_4452BB(); + return; + } + if ( pGUIWindow2->ptr_1C == (void *)26 ) + { + sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer); + pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0); + pGUIWindow2->DrawFlashingInputCursor(pFontLucida->GetLineWidth(Str) + 13, 357, pFontLucida); + return; + } + if ( pKeyActionMap->pPressedKeysBuffer[0] ) + { + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); + memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); + sub_4452BB(); + return; + } +} + +//----- (004443D5) -------------------------------------------------------- +const char *GameUI_GetMinimapHintText() +{ + double v3; // st7@1 + int v7; // eax@4 + const char *v14; // eax@8 + char *result; // eax@12 + unsigned int pMapID; // eax@14 + int global_coord_X; // [sp+10h] [bp-1Ch]@1 + int global_coord_Y; // [sp+14h] [bp-18h]@1 + unsigned int pY; // [sp+1Ch] [bp-10h]@1 + unsigned int pX; // [sp+28h] [bp-4h]@1 + + result = 0; + pMouse->GetClickPos(&pX, &pY); + v3 = 1.0 / (float)((signed int)viewparams->uMinimapZoom * 0.000015258789); + global_coord_X = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); + global_coord_Y = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || pOutdoor->uNumBModels <= 0 ) + { + pMapID = pMapStats->GetMapInfo(pCurrentMapName); + if ( pMapID == 0 ) + result = "No Maze Info for this maze on file!"; + else + result = pMapStats->pInfos[pMapID].pName; + } + else + { + for ( uint j = 0; j < (uint)pOutdoor->uNumBModels; ++j ) + { + v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - global_coord_X), + abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - global_coord_Y), 0); + if ( v7 < 2 * pOutdoor->pBModels[j].sBoundingRadius ) + { + if ( pOutdoor->pBModels[j].uNumFaces ) + { + for ( uint i = 0; i < (uint)pOutdoor->pBModels[j].uNumFaces; ++i ) + { + if ( pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID ) + { + if ( !(pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_HAS_EVENT) ) + { + v14 = GetEventHintString(pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID); + if ( v14 ) + { + if ( _stricmp(v14, "") ) + result = (char *)v14; + } + } + } + } + } + if ( result ) + return result; + } + } + pMapID = pMapStats->GetMapInfo(pCurrentMapName); + if ( pMapID == 0 ) + result = "No Maze Info for this maze on file!"; + else + result = pMapStats->pInfos[pMapID].pName; + return result; + } + return result; +} + +//----- (0041D3B7) -------------------------------------------------------- +void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player) +{ + Texture *v13; // eax@6 + PlayerFrame *v15; // eax@12 + unsigned int pTextColor; // eax@15 + const char *v29; // eax@16 + int v36; // esi@22 + const char *v39; // eax@24 + signed int uFramesetID; // [sp+20h] [bp-8h]@9 + int uFramesetIDa; // [sp+20h] [bp-8h]@18 + + uint numActivePlayerBuffs = 0; + for (uint i = 0; i < 24; ++i) + if (player->pPlayerBuffs[i].uExpireTime > 0) + ++numActivePlayerBuffs; + + window->uFrameHeight = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)); + window->uFrameZ = window->uFrameWidth + window->uFrameX - 1; + window->uFrameW = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)) + window->uFrameY - 1; + window->DrawMessageBox(0); + + if (player->IsEradicated()) + v13 = pTexture_PlayerFaceEradicated; + else if (player->IsDead()) + v13 = pTexture_PlayerFaceDead; + else + { + uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(player->expression); + if ( !uFramesetID ) + uFramesetID = 1; + if ( player->expression == CHARACTER_EXPRESSION_21) + v15 = pPlayerFrameTable->GetFrameBy_y(&player->_expression21_frameset, &player->_expression21_animtime, pMiscTimer->uTimeElapsed); + else + v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, pMiscTimer->Time()); + player->field_1AA2 = v15->uTextureID - 1; + v13 = pTextures_PlayerFaces[(unsigned int)window->ptr_1C][v15->uTextureID - 1]; + } + + pRenderer->DrawTextureTransparent(window->uFrameX + 24, window->uFrameY + 24, v13); + + sprintfex(pTmpBuf.data(), "\f%05d", ui_character_header_text_color); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); // "%s the %s" + strcat(pTmpBuf.data(), pTmpBuf2.data()); + strcat(pTmpBuf.data(), "\f00000\n"); + + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()); + sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[108], // "Hit Points" + pTextColor, player->sHealth, player->GetMaxHealth()); + strcat(pTmpBuf.data(), pTmpBuf2.data()); + + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()); + sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[212], // "Spell Points" + pTextColor, player->sMana, player->GetMaxMana()); + strcat(pTmpBuf.data(), pTmpBuf2.data()); + + pTextColor = player->GetMajorConditionIdx(); + sprintfex(pTmpBuf2.data(), "%s: \f%05d%s\f00000\n", pGlobalTXT_LocalizationStrings[47], // "Condition + GetConditionDrawColor(pTextColor), aCharacterConditionNames[pTextColor]); + strcat(pTmpBuf.data(), pTmpBuf2.data()); + + if ( player->uQuickSpell ) + v29 = pSpellStats->pInfos[player->uQuickSpell].pShortName; + else + v29 = pGlobalTXT_LocalizationStrings[153]; + sprintfex(pTmpBuf2.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v29); // "Quick Spell" + strcat(pTmpBuf.data(), pTmpBuf2.data()); + + window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf.data(), 0, 0, 0); + + uFramesetIDa = 0; + for (uint i = 0; i < 24; ++i) + { + SpellBuff* buff = &player->pPlayerBuffs[i]; + if (buff->uExpireTime > 0) + { + v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134; + window->DrawText(pFontComic, 52, v36, ui_game_character_record_playerbuff_colors[i], aSpellNames[20 + i], 0, 0, 0); + DrawBuff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic); + } + } + + v39 = ""; + if ( uFramesetIDa == 0 ) + v39 = pGlobalTXT_LocalizationStrings[153]; // "None" + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[450], v39); // "Active Spells: %s" + window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf.data(), 0, 0, 0); +} + +//----- (0041A57E) -------------------------------------------------------- +void GameUI_QuickRef_Draw() +{ + unsigned int pTextColor; // eax@7 + unsigned int pX; // [sp+14h] [bp-18h]@2 + unsigned int pY; // edi@9 + int pSkillsCount; // ecx@27 + const char *pText; // eax@38 + int pFontHeight; // [sp+18h] [bp-14h]@1 + + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); + pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1; + for ( uint i = 0; i < 4; ++i ) + { + Player* player = &pParty->pPlayers[i]; + pX = 94 * i + 89; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0); + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 47, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Уров. + sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel()); + if ( player->GetActualLevel() <= player->GetBaseLevel()) + pTextColor = player->GetExperienceDisplayColor(); + else + pTextColor = ui_character_bonus_text_color; + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, 47, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + 47; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pFontHeight + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//Класс + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pClassNames[player->classType], 84, 0); + pY = pFontHeight + pY; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//Здор. + sprintf(pTmpBuf.data(), "%d", player->sHealth); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//Мана + sprintf(pTmpBuf.data(), "%d", player->sMana); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);//Класс брони + sprintf(pTmpBuf.data(), "%d", player->GetActualAC()); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака + sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(false)); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetMeleeDamageString(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять + sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetRangedDamageString(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки + pSkillsCount = 0; + for ( uint j = 0; j <= 36; ++j ) + { + if ( player->pActiveSkills[j] ) + ++pSkillsCount; + } + sprintf(pTmpBuf.data(), "%lu", pSkillsCount); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки + sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, aCharacterConditionNames[player->GetMajorConditionIdx()], 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим. + if (player->uQuickSpell) + pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; + else + pText = pGlobalTXT_LocalizationStrings[153];//Нет + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pText, 84, 0); + } + + if ( pParty->GetPartyReputation() >= 0 ) + { + if ( pParty->GetPartyReputation() <= 5 ) + pTextColor = ui_character_default_text_color; + else + pTextColor = ui_character_bonus_text_color_neg; + } + else + pTextColor = ui_character_bonus_text_color; + + sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], pTextColor, GetReputationString(pParty->GetPartyReputation()));//Reputation + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0); + sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame Слава + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0); +} + +//----- (0041AD6E) -------------------------------------------------------- +void GameUI_DrawRightPanelItems() +{ + if ( (unsigned long long)GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed ) + GameUI_RightPanel_BookFlashTimer = 0; + + if ( pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128 ) + { + GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; + + static bool byte_50697C = false; // 50697C + byte_50697C = !byte_50697C; + if ( byte_50697C && pCurrentScreen != SCREEN_REST ) + { + if (bFlashQuestBook) pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); + if (bFlashAutonotesBook) pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); + if (bFlashHistoryBook) pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); + } + else + { + pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); + GameUI_DrawHiredNPCs(); + } + } +} + +//----- (0041AEBB) -------------------------------------------------------- +void GameUI_DrawFoodAndGold() +{ + int text_y; // esi@2 + + if ( uGameState != GAME_STATE_FINAL_WINDOW ) + { + text_y = _44100D_should_alter_right_panel() != 0 ? 381 : 322; + sprintf(pTmpBuf.data(), "\r087%lu", pParty->uNumFoodRations); + pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow); + sprintf(pTmpBuf.data(), "\r028%lu", pParty->uNumGold); + pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow); + } +} + +//----- (0041B0C9) -------------------------------------------------------- +void GameUI_DrawLifeManaBars() +{ + double v3; // st7@3 + double v7; // st7@25 + Texture *pTextureHealth; // [sp-4h] [bp-30h]@10 + Texture *pTextureMana; // [sp+Ch] [bp-20h]@1 + + pTextureMana = pIcons_LOD->GetTexture(uTextureID_BarBlue); + for (uint i = 0; i < 4; ++i) + { + if (pParty->pPlayers[i].sHealth > 0) + { + int v17 = 0; + if (i == 2 || i == 3) + v17 = 2; + v3 = (double)pParty->pPlayers[i].sHealth / (double)pParty->pPlayers[i].GetMaxHealth(); + if( v3 > 0.5 ) + { + if ( v3 > 1.0 ) + v3 = 1.0; + pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarGreen); + } + else if ( v3 > 0.25 ) + pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarYellow); + else if ( v3 > 0.0 ) + pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarRed); + if( v3 > 0.0 ) + { + pRenderer->SetTextureClipRect(v17 + pHealthBarPos[i], (signed __int64)((1.0 - v3) * pTextureHealth->uTextureHeight) + 402, + v17 + pHealthBarPos[i] + pTextureHealth->uTextureWidth, pTextureHealth->uTextureHeight + 402); + pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[i], 402, pTextureHealth); + pRenderer->ResetTextureClipRect(); + } + } + if (pParty->pPlayers[i].sMana > 0) + { + v7 = pParty->pPlayers[i].sMana / (double)pParty->pPlayers[i].GetMaxMana(); + if ( v7 > 1.0 ) + v7 = 1.0; + int v17 = 0; + if (i == 2) + v17 = 1; + pRenderer->SetTextureClipRect(v17 + pManaBarPos[i], (signed __int64)((1.0 - v7) * pTextureMana->uTextureHeight) + 402, + v17 + pManaBarPos[i] + pTextureMana->uTextureWidth, pTextureMana->uTextureHeight + 402); + pRenderer->DrawTextureIndexed(v17 + pManaBarPos[i], 402, pTextureMana); + pRenderer->ResetTextureClipRect(); + } + } +} + +//----- (0041B3B6) -------------------------------------------------------- +void GameUI_DrawRightPanel() +{ + pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); +} + +//----- (0041B3E2) -------------------------------------------------------- +void GameUI_DrawRightPanelFrames() +{ + pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); + pRenderer->DrawTextureRGB(0, 8, pTexture_LeftFrame); + pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); + pRenderer->DrawTextureRGB(0, 352, pTexture_BottomFrame); + GameUI_DrawFoodAndGold(); + GameUI_DrawRightPanelItems(); +} + +//----- (0041C047) -------------------------------------------------------- +void GameUI_Footer_2() +{ + char *v1; // edx@2 + int v5; // eax@5 + + pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); + if (GameUI_Footer_TimeLeft) + v1 = GameUI_Footer_TimedString.data(); + else + { + if (!pFooterString[0]) + return; + v1 = pFooterString.data(); + } + + v5 = pFontLucida->AlignText_Center(450, v1); + pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); +} + +//----- (0041C0B8) -------------------------------------------------------- +void GameUI_SetFooterString(const char *pStr) +{ + const char *v1; // esi@1 + + v1 = pStr; + if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(pStr, 1) && (*v1 || GameUI_Footer_TimeLeft) ) + { + if ( GameUI_Footer_TimeLeft ) + { + for ( int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) + GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; + } + else + { + strcpy(pFooterString.data(), v1); + for ( int j = pFontLucida->GetLineWidth(pFooterString.data()); j > 450; j = pFontLucida->GetLineWidth(pFooterString.data()) ) + pFooterString[strlen(pFooterString.data()) - 1] = 0; + } + } +} + +//----- (0041C179) -------------------------------------------------------- +void GameUI_Footer() +{ + char *v1; // edi@5 + int v2; // eax@5 + int v6; // eax@9 + char v9; // zf@12 + + if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) + { + pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); + if ( GameUI_Footer_TimeLeft ) + { + v1 = GameUI_Footer_TimedString.data(); + v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); + while ( v2 > 450 ) + { + GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; + v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); + } + } + else + { + v1 = pFooterString.data(); + v6 = pFontLucida->GetLineWidth(pFooterString.data()); + while ( v6 > 450 ) + { + pFooterString[strlen(pFooterString.data()) - 1] = 0; + v6 = pFontLucida->GetLineWidth(pFooterString.data()); + } + } + v9 = *v1 == 0; + bForceDrawFooter = 0; + if ( !v9 ) + pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, v1) + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); + } +} +// 5C35BC: using guessed type int bForceDrawFooter; +//----- (00420EFF) -------------------------------------------------------- +void GameUI_WritePointedObjectStatusString() +{ + GUIWindow *pWindow; // edi@7 + GUIButton *pButton; // ecx@11 + int requiredSkillpoints; // ecx@19 + enum UIMessageType pMessageType1; // esi@24 + int v14; // eax@41 + ItemGen *pItemGen; // ecx@44 + int v16; // ecx@46 + signed int pickedObjectPID; // eax@55 + signed int v18b; + signed int pickedObjectID; // ecx@63 + BLVFace *pFace; // eax@69 + const char *pText; // ecx@79 + enum UIMessageType pMessageType2; // esi@110 + enum UIMessageType pMessageType3; // edx@117 + char Str1[200]; // [sp+Ch] [bp-D4h]@129 + unsigned int pX; // [sp+D4h] [bp-Ch]@1 + unsigned int pY; // [sp+D8h] [bp-8h]@1 + + pMouse->uPointingObjectID = 0; + pMouse->GetClickPos(&pX, &pY); + if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 ) + return; + if ( pCurrentScreen == SCREEN_GAME ) + { + if ( pX <= (window->GetWidth() - 1) * 0.73125 && pY <= (window->GetHeight() - 1) * 0.73125 ) + { + //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 + { + pickedObjectPID = pGame->pVisInstance->get_picked_object_zbuf_val(); + if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X + || pY < (unsigned int)pViewport->uScreen_TL_Y || pY > (unsigned int)pViewport->uScreen_BR_Y ) + pickedObjectPID = -1; + if ( pickedObjectPID == -1 ) + { + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = 0; + return; + } + } + /*else + { + v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; + }*/ + pMouse->uPointingObjectID = (unsigned __int16)pickedObjectPID; + pickedObjectID = (signed)PID_ID(pickedObjectPID); + if ( PID_TYPE(pickedObjectPID) == OBJECT_Item ) + { + if ( pObjectList->pObjects[pSpriteObjects[pickedObjectID].uObjectDescID].uFlags & 0x10 ) + { + pMouse->uPointingObjectID = 0; + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + if ( pickedObjectPID >= 0x2000000u || pParty->pPickedItem.uItemID ) + { + GameUI_SetFooterString(pSpriteObjects[pickedObjectID].stru_24.GetDisplayName()); + } + else + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[pickedObjectID].stru_24.GetDisplayName());// "Get %s" + GameUI_SetFooterString(pTmpBuf.data()); + } //intentional fallthrough + } + else if ( PID_TYPE(pickedObjectPID) == OBJECT_Decoration ) + { + if ( !pLevelDecorations[pickedObjectID].uEventID ) + { + if ( pLevelDecorations[pickedObjectID].IsInteractive() ) + pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[pickedObjectID]._idx_in_stru123 - 75] + 380].pTopic;//неверно для костра + else + pText = pDecorationList->pDecorations[pLevelDecorations[pickedObjectID].uDecorationDescID].field_20; + GameUI_SetFooterString(pText); + } + else + { + char* hintString = GetEventHintString(pLevelDecorations[pickedObjectID].uEventID); + if ( hintString != '\0' ) + { + GameUI_SetFooterString(hintString); + } + } //intentional fallthrough + } + else if ( PID_TYPE(pickedObjectPID) == OBJECT_BModel ) + { + if ( pickedObjectPID < 0x2000000u ) + { + char* newString = nullptr; + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) + { + v18b = (signed int)(unsigned __int16)pickedObjectPID >> 9; + short triggeredId = pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID; + if (triggeredId != 0) + { + newString = GetEventHintString(pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID); + } + } + else + { + pFace = &pIndoor->pFaces[pickedObjectID]; + if ( pFace->uAttributes & FACE_INDICATE ) + { + unsigned short eventId = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; + if (eventId != 0) + { + newString = GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID); + } + } + } + if (newString) + { + GameUI_SetFooterString(newString); + if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = pMouse->uPointingObjectID; + return; + } + } + pMouse->uPointingObjectID = 0; + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + else if ( PID_TYPE(pickedObjectPID) == OBJECT_Actor ) + { + if ( pickedObjectPID >= 0x2000000 ) + { + pMouse->uPointingObjectID = 0; + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = 0; + return; + } + if ( pActors[pickedObjectID].dword_000334_unique_name ) + pText = pMonsterStats->pPlaceStrings[pActors[pickedObjectID].dword_000334_unique_name]; + else + pText = pMonsterStats->pInfos[pActors[pickedObjectID].pMonsterInfo.uID].pName; + GameUI_SetFooterString(pText); //intentional fallthrough + } + if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = pMouse->uPointingObjectID; + return; + } + } + else + { + for (int i = uNumVisibleWindows; i > 0; --i) + { + pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; + if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ + && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) + { + for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) + { + switch ( pButton->uButtonType ) + { + case 1://for dialogue window + if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ + && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) + { + pMessageType1 = (UIMessageType)pButton->field_1C; + if ( pMessageType1 ) + pMessageQueue_50CBD0->AddGUIMessage(pMessageType1, pButton->msg_param, 0); + GameUI_SetFooterString(pButton->pButtonName); + uLastPointedObjectID = 1; + return; + } + break; + case 2://hovering over portraits + if (pButton->uWidth != 0 && pButton->uHeight != 0) + { + uint distW = pX - pButton->uX; + uint distY = pY - pButton->uY; + + double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); + double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); + + if (ratioX + ratioY < 1.0) + { + pMessageType2 = (UIMessageType)pButton->field_1C; + if ( pMessageType2 != 0 ) + pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); + GameUI_SetFooterString(pButton->pButtonName); // for character name + uLastPointedObjectID = 1; + return; + } + } + break; + case 3:// click on skill + if ( pX >= pButton->uX && pX <= pButton->uZ + && pY >= pButton->uY && pY <= pButton->uW ) + { + requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; + if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) + sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" + else + sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" + GameUI_SetFooterString(Str1); + uLastPointedObjectID = 1; + return; + } + break; + } + } + } + if ( pWindow->uFrameHeight == 480 ) + { + //DebugBreak(); //Why is this condition here (in the original too)? Might check fullscreen windows. Let Silvo know if you find out + return; + } + } + //The game never gets to this point even in the original. It's also bugged(neither branch displays anything). + //TODO fix these and move them up before the window check loop. + if ( pCurrentScreen == SCREEN_CHEST ) + { + Chest::ChestUI_WritePointedObjectStatusString(); + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = 0; + return; + } + else if ( pCurrentScreen == SCREEN_HOUSE ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD + || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) + || v16 == -65536 ) + { + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = 0; + return; + } + pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); + GameUI_SetFooterString(pItemGen->GetDisplayName()); + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + if ( pY < 350 ) + { + v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; + if ( v14 == 0 || v14 == -65536 || v14 >= 5000 ) + { + if ( pMouse->uPointingObjectID == 0 ) + { + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + } + uLastPointedObjectID = pMouse->uPointingObjectID; + return; + } + pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; + GameUI_SetFooterString(pItemGen->GetDisplayName()); + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + } + if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ + && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) + { + for ( pButton = pWindowList[0].pControlsHead; pButton != nullptr; pButton = pButton->pNext ) + { + switch (pButton->uButtonType) + { + case 1: + if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ + && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) + { + pMessageType3 = (UIMessageType)pButton->field_1C; + if ( pMessageType3 == 0 ) // For books + { + GameUI_SetFooterString(pButton->pButtonName); + } + else + { + pMessageQueue_50CBD0->AddGUIMessage(pMessageType3, pButton->msg_param, 0); + } + uLastPointedObjectID = 1; + return; + } + break; + case 2://hovering over portraits + if (pButton->uWidth != 0 && pButton->uHeight != 0) + { + uint distW = pX - pButton->uX; + uint distY = pY - pButton->uY; + + double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); + double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); + + if (ratioX + ratioY < 1.0) + { + pMessageType2 = (UIMessageType)pButton->field_1C; + if ( pMessageType2 != 0 ) + pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); + GameUI_SetFooterString(pButton->pButtonName); // for character name + uLastPointedObjectID = 1; + return; + } + } + break; + case 3: + if ( pX >= pButton->uX && pX <= pButton->uZ + && pY >= pButton->uY && pY <= pButton->uW ) + { + requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; + if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) + sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" + else + sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" + GameUI_SetFooterString(Str1); + uLastPointedObjectID = 1; + return; + } + break; + } + } + } + //pMouse->uPointingObjectID = sub_46A99B(); //for software + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = 0; + return; +} + +//----- (0044158F) -------------------------------------------------------- +void GameUI_DrawCharacterSelectionFrame() +{ + if ( uActiveCharacter ) + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380, + pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame)); +} + +//----- (0044162D) -------------------------------------------------------- +void GameUI_DrawPartySpells() +{ + unsigned int v0; // ebp@1 + Texture *spell_texture; // [sp-4h] [bp-1Ch]@12 + //Texture *v9; // [sp-4h] [bp-1Ch]@21 + + v0 = (signed __int64)((double)GetTickCount() * 0.050000001); + //v1 = 0; + for (uint i = 0; i < 14; ++i) + { + //v2 = byte_4E5DD8[v1]; + if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) + { + Texture* tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); + //v3 = pTextureIDs_PartyBuffIcons[i]; + pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], + pPartySpellbuffsUI_XYs[i][1], tex, tex, + v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); + } + //++v1; + } + //while ( v1 < 14 ); + if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE) + { + if (pParty->FlyActive()) + { + if ( pParty->bFlying ) + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); + else + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); + //if ( pRenderer->pRenderD3D ) + pRenderer->DrawTextureIndexed(8, 8, spell_texture); + /*else + pRenderer->DrawTextureTransparent(8, 8, v7);*/ + } + if ( pParty->WaterWalkActive() ) + { + if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); + else + spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); + //if ( pRenderer->pRenderD3D ) + pRenderer->DrawTextureIndexed(396, 8, spell_texture); + /*else + pRenderer->DrawTextureTransparent(396, 8, v9);*/ + } + } + for (uint i = 0; i < 4; ++i) + { + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); + } +} + +//----- (004921C1) -------------------------------------------------------- +void GameUI_DrawPortraits(unsigned int _this) +{ + unsigned int face_expression_ID; // eax@17 + PlayerFrame *pFrame; // eax@21 + int pTextureID; // eax@57 + Texture *pPortrait; // [sp-4h] [bp-1Ch]@27 + + if ( _A750D8_player_speech_timer ) + { + _A750D8_player_speech_timer -= (signed int)pMiscTimer->uTimeElapsed; + if ( _A750D8_player_speech_timer <= 0 ) + { + if ( pPlayers[uSpeakingCharacter]->CanAct() ) + pPlayers[uSpeakingCharacter]->PlaySound(PlayerSpeechID, 0); + _A750D8_player_speech_timer = 0i64; + } + } + + for (uint i = 0; i < 4; ++i) + { + Player* pPlayer = &pParty->pPlayers[i]; + if ( pPlayer->IsEradicated() ) + { + pPortrait = pTexture_PlayerFaceEradicated; + if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) + pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + else + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) + sub_441A4E(i); + continue; + } + if (pPlayer->IsDead()) + { + pPortrait = pTexture_PlayerFaceDead; + if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) + pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + else + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) + sub_441A4E(i); + continue; + } + face_expression_ID = 0; + for ( uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j ) + if ( pPlayerFrameTable->pFrames[j].expression == pPlayer->expression ) + { + face_expression_ID = j; + break; + } + if ( face_expression_ID == 0 ) + face_expression_ID = 1; + if (pPlayer->expression == CHARACTER_EXPRESSION_21) + pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); + else + pFrame = pPlayerFrameTable->GetFrameBy_x(face_expression_ID, pPlayer->uExpressionTimePassed); + if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) + { + pPlayer->field_1AA2 = pFrame->uTextureID - 1; + pPortrait = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID]; + if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) + pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + else + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) + sub_441A4E(i); + continue; + } + } + if ( pParty->bTurnBasedModeOn == 1 ) + { + if ( pTurnEngine->turn_stage != TE_WAIT ) + { + if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) + { + if ( pTurnEngine->uActorQueueSize > 0 ) + { + for (uint i = 0; i < (uint)pTurnEngine->uActorQueueSize; ++i) + { + if (PID_TYPE(pTurnEngine->pQueue[i].uPackedID) != OBJECT_Player) + break; + pTextureID = dword_5079D0; + if ( pParty->uFlags & 0x10 ) + pTextureID = dword_5079CC; + else + { + if ( pParty->uFlags & 0x20 ) + pTextureID = dword_5079C8; + } + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pTurnEngine->pQueue[i].uPackedID)] - 4, 385, pIcons_LOD->GetTexture(pTextureID)); + } + } + } + } + } + else + { + for (uint i = 0; i < 4; ++i) + { + if (pParty->pPlayers[i].CanAct() && !pParty->pPlayers[i].uTimeToRecovery) + { + pTextureID = dword_5079D0; + if ( pParty->uFlags & 0x10 ) + pTextureID = dword_5079CC; + else + { + if ( pParty->uFlags & 0x20 ) + pTextureID = dword_5079C8; + } + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, 385, pIcons_LOD->GetTexture(pTextureID)); + } + } + } +} + +//----- (00441D38) -------------------------------------------------------- +void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap) +{ + int uHeight; // ebx@6 + signed int pW; // ebx@23 + int v15; // eax@23 + double v20; // st7@30 + signed int v27; // eax@37 + //unsigned __int16 *v28; // ecx@37 + signed int v29; // edi@40 + int pPoint_X; // edi@72 + int pPoint_Y; // ebx@72 + unsigned int lPitch; // [sp+20h] [bp-34h]@1 + signed int pY; // [sp+20h] [bp-34h]@23 + signed int pX; // [sp+24h] [bp-30h]@23 + signed int v70; // [sp+24h] [bp-30h]@37 + signed int uBluea; // [sp+28h] [bp-2Ch]@37 + int v73; // [sp+2Ch] [bp-28h]@30 + signed int uCenterY; // [sp+48h] [bp-Ch]@1 + signed int uCenterX; // [sp+4Ch] [bp-8h]@1 + signed int uWidth; // [sp+5Ch] [bp+8h]@30 + signed int pZ; // [sp+60h] [bp+Ch]@23 + float uWb; // [sp+60h] [bp+Ch]@30 + unsigned int pColor; + + uCenterX = (uX + uZ) / 2; + uCenterY = (uY + uW) / 2; + lPitch = pRenderer->uTargetSurfacePitch; + bool bWizardEyeActive = pParty->WizardEyeActive(); + int uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); + if ( CheckHiredNPCSpeciality(Cartographer) ) + { + bWizardEyeActive = true; + uWizardEyeSkillLevel = 2; + } + + if ( wizard_eye ) + { + bWizardEyeActive = true; + uWizardEyeSkillLevel = 3; + } + pRenderer->SetRasterClipRect(uX, uY, uZ - 1, uW - 1); + uHeight = uW - uY; + uWidth = uZ - uX; + + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) + { + uchar* pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; + ushort* pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; + v73 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / (signed int)uZoom; + v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); + uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); + switch (uZoom) + { + case 512: + { + v20 = v20 - (double)(uWidth / 2); + uWb = uWb - (double)(uHeight / 2); + } + break; + case 1024: + { + v20 = v20 - (double)(uWidth / 4); + uWb = uWb - (double)(uHeight / 4); + } + break; + case 2048: + { + v20 = v20 - (double)(uWidth / 8); + uWb = uWb - (double)(uHeight / 8); + } + break; + default: assert(false); + } + + static unsigned __int16 pOdmMinimap[117][137]; + assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short)); + + v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); + uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); + v27 = uBluea >> 16; + //v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; + + if (pMapLod0 && bRedrawOdmMinimap) + { + assert(uWidth == 137 && uHeight == 117); + //auto pMinimap = (unsigned __int16 *)pOdmMinimap; + + ushort mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; + + v29 = v70 >> 16; + for (int y = 0; y < uHeight; ++y) + { + uchar* pMapLod0Line = &pMapLod0[v27 * mapWidth]; + for (int x = 0; x < uWidth; ++x) + { + //*pMinimap++ = pPal[pMapLod0Line[v29]]; + pRenderer->WritePixel16(uX + x, uY + y, pPal[pMapLod0Line[v29]]); + v29 = (v70 + x * v73) >> 16; + } + uBluea += v73; + v27 = uBluea >> 16; + } + + /*v29 = v70 >> 16; + for (int y = 0; y < uHeight; ++y) + { + uchar* pMapLod0Line = &pMapLod0[v27 * mapWidth]; + for (int x = 0; x < uWidth; ++x) + { + //*pMinimap++ = pPal[pMapLod0Line[v29]]; + pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; + v29 = (v70 + x * v73) >> 16; + } + v29 = v70 >> 16; + v28 += 137 - uWidth; + uBluea += v73; + v27 = uBluea >> 16; + }*/ + } + + /*for (int y = 0; y < 117; ++y) + { + for (int x = 0; x < 137; ++x) + { + *v28++ = pOdmMinimap[y][x]; + } + v28 += lPitch - 137; + }*/ + uNumBlueFacesInBLVMinimap = 0; + } + else// uCurrentlyLoadedLevelType == LEVEL_Indoor + { + pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); + uNumBlueFacesInBLVMinimap = 0; + + for (uint i = 0; i < (uint)pIndoor->pMapOutlines->uNumOutlines; ++i) + { + BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[i]; + //BLVFace* pFace1 = &pIndoor->pFaces[pOutline->uFace1ID]; + //BLVFace* pFace2 = &pIndoor->pFaces[pOutline->uFace2ID]; + if (pIndoor->pFaces[pOutline->uFace1ID].Visible() && pIndoor->pFaces[pOutline->uFace2ID].Visible()) + { + if ( pOutline->uFlags & 1 ) + { + if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && + (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && + (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) + { + if (uNumBlueFacesInBLVMinimap < 49) + pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; + } + else + { + pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); + pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); + pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); + pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); + v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; + if ( v15 > 100 ) + v15 = 100; + pRenderer->RasterLine2D(pX, pY, pZ, pW, viewparams->pPalette[-v15 + 200]); + } + continue; + } + if (pIndoor->pFaces[pOutline->uFace1ID].uAttributes & FACE_UNKNOW4 || pIndoor->pFaces[pOutline->uFace2ID].uAttributes & FACE_UNKNOW4) + { + pOutline->uFlags = pOutline->uFlags | 1; + pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); + if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && + (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && + (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) + { + if (uNumBlueFacesInBLVMinimap < 49) + pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; + } + else + { + pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); + pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); + pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); + pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); + v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; + if ( v15 > 100 ) + v15 = 100; + pRenderer->RasterLine2D(pX, pY, pZ, pW, viewparams->pPalette[-v15 + 200]); + } + continue; + } + } + } + + for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) + { + BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; + pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); + pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); + pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); + pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); + pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color); + } + } + + //draw arrow on the minimap(include. Ritor1) + uint arrow_idx; + unsigned int rotate = pParty->sRotationY & stru_5C6E00->uDoublePiMask; + if ( (signed int)rotate <= 1920 ) + arrow_idx = 6; + if ( (signed int)rotate < 1664 ) + arrow_idx = 5; + if ( (signed int)rotate <= 1408 ) + arrow_idx = 4; + if ( (signed int)rotate < 1152 ) + arrow_idx = 3; + if ( (signed int)rotate <= 896 ) + arrow_idx = 2; + if ( (signed int)rotate < 640 ) + arrow_idx = 1; + if ( (signed int)rotate <= 384 ) + arrow_idx = 0; + if ( (signed int)rotate < 128 || (signed int)rotate > 1920 ) + arrow_idx = 7; + pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx]));//стрелка + + //draw objects on the minimap + if ( bWizardEyeActive ) + { + if ( uWizardEyeSkillLevel >= 2 ) + { + for ( uint i = 0; i < uNumSpriteObjects; ++i ) + { + if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID ) + continue; + //if (uWizardEyeSkillLevel == 1 + pPoint_X = uCenterX + fixpoint_mul((pSpriteObjects[i].vPosition.x - pParty->vPosition.x), uZoom); + pPoint_Y = uCenterY - fixpoint_mul((pSpriteObjects[i].vPosition.y - pParty->vPosition.y), uZoom); + //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z && + // pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w) + { + if (pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) + { + pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_projectile_color); + } + else if ( uZoom > 512 ) + { + pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y, pPoint_X - 2, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y, pPoint_X + 2, pPoint_Y + 1, ui_game_minimap_treasure_color); + } + else + { + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, ui_game_minimap_treasure_color); + } + } + } + } + for ( uint i = 0; i < uNumActors; ++i )//draw actors(отрисовка монстров и нпс) + { + if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled + && (pActors[i].uAIState == Dead || pActors[i].ActorNearby()) ) + { + pPoint_X = uCenterX + (fixpoint_mul((pActors[i].vPosition.x - pParty->vPosition.x), uZoom)); + pPoint_Y = uCenterY - (fixpoint_mul((pActors[i].vPosition.y - pParty->vPosition.y), uZoom)); + //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z + // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) + { + pColor = ui_game_minimap_actor_friendly_color; + if ( pActors[i].uAttributes & ACTOR_HOSTILE ) + pColor = ui_game_minimap_actor_hostile_color; + if ( pActors[i].uAIState == Dead) + pColor = ui_game_minimap_actor_corpse_color; + if ( uZoom > 1024 ) + { + pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y - 1, pPoint_X - 2, pPoint_Y + 1, pColor); + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 2, pPoint_X - 1, pPoint_Y + 2, pColor); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 2, pColor); + pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 2, pPoint_X + 1, pPoint_Y + 2, pColor); + pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y - 1, pPoint_X + 2, pPoint_Y + 1, pColor); + } + else + { + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, pColor); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, pColor); + } + } + } + } + for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )//draw items(отрисовка предметов) + { + if ( pLevelDecorations[i].uFlags & 8 ) + { + pPoint_X = uCenterX + (fixpoint_mul((pLevelDecorations[i].vPosition.x - pParty->vPosition.x), uZoom)); + pPoint_Y = uCenterY - (fixpoint_mul((pLevelDecorations[i].vPosition.y - pParty->vPosition.y), uZoom)); + //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z + // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) + { + if ( (signed int)uZoom > 512 ) + { + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y + 1, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); + } + else + pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_decoration_color_1); + } + } + } + } + pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_Minimap_Loop));//draw minimap_loop + pRenderer->SetTextureClipRect(541, 0, 567, 480); + pRenderer->DrawTextureIndexed(floorf(((double)pParty->sRotationY * 0.1171875) + 0.5f) + 285, 136, pIcons_LOD->GetTexture(uTextureID_Compas));//draw compas + pRenderer->ResetTextureClipRect(); +} + +//----- (00441498) -------------------------------------------------------- +void GameUI_DrawTorchlightAndWizardEye() +{ + if (pCurrentScreen == SCREEN_GAME + || pCurrentScreen == SCREEN_MENU + || pCurrentScreen == SCREEN_OPTIONS + || pCurrentScreen == SCREEN_REST + || pCurrentScreen == SCREEN_SPELL_BOOK + || pCurrentScreen == SCREEN_CHEST + || pCurrentScreen == SCREEN_SAVEGAME + || pCurrentScreen == SCREEN_LOADGAME + || pCurrentScreen == SCREEN_CHEST_INVENTORY + || pCurrentScreen == SCREEN_BOOKS + || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) + { + if (pParty->TorchlightActive()) + { + IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); + pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); + } + if (pParty->WizardEyeActive()) + { + IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); + pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); + } + } +} +// 4E28F8: using guessed type int pCurrentScreen; + + +//----- (00491F87) -------------------------------------------------------- +void GameUI_DrawHiredNPCs() +{ + unsigned int v13; // eax@23 + char pContainer[20]; // [sp+Ch] [bp-30h]@18 + signed int uFrameID; // [sp+24h] [bp-18h]@19 + int v22; // [sp+34h] [bp-8h]@2 + unsigned __int8 pNPC_limit_ID; // [sp+3Bh] [bp-1h]@2 + + if ( bNoNPCHiring != 1 ) + { + pNPC_limit_ID = 0; + v22 = 0; + if (pParty->pHirelings[0].pName) + pTmpBuf[v22++] = 0; + if (pParty->pHirelings[1].pName) + pTmpBuf[v22++] = 1; + + for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) + { + if (pNPCStats->pNewNPCData[i].uFlags & 128) + { + if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName)) + { + if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName)) + pTmpBuf[v22++] = i + 2; + } + } + } + + for ( int i = pParty->hirelingScrollPosition; i < v22 && pNPC_limit_ID < 2; i++ ) + { + if ( (unsigned __int8)pTmpBuf[i] >= 2 ) + { + sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)pTmpBuf[i] + 499].uPortraitID); + pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], + pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); + } + else + { + sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].uPortraitID); + pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], + pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); + if ( pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_A == 1 ) + { + uFrameID = pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_B; + v13 = 0; + if (pIconsFrameTable->uNumIcons) + { + for ( v13 = 0; v13 < pIconsFrameTable->uNumIcons; ++v13 ) + { + if ( !_stricmp("spell96", pIconsFrameTable->pIcons[v13].pAnimationName) ) + break; + } + } + pRenderer->DrawTextureTransparent(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], + &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(v13, uFrameID)->uTextureID]); + } + } + ++pNPC_limit_ID; + } + } +} + +//----- (004178FE) -------------------------------------------------------- +unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos) +{ + unsigned __int16 R, G, B; + + if ( current_pos <= base_pos ) + { + if ( current_pos == base_pos )//White + return 0; + if ( 100 * current_pos / base_pos >= 25 )//Yellow( current_pos > 1/4 ) + R = 255, G = 255, B = 100; + else//Red( current_pos < 1/4 ) + R = 255, G = 0, B = 0; + } + else//Green + R = 0, G = 255, B = 0; + return Color16(R, G, B); +} + +//----- (00417939) -------------------------------------------------------- +int GetConditionDrawColor(unsigned int uConditionIdx) +{ + switch (uConditionIdx) + { + case Condition_Zombie: + case Condition_Good: + return ui_character_condition_normal_color; + + case Condition_Cursed: + case Condition_Weak: + case Condition_Fear: + case Condition_Drunk: + case Condition_Insane: + case Condition_Poison_Weak: + case Condition_Disease_Weak: + return ui_character_condition_light_color; + + case Condition_Sleep: + case Condition_Poison_Medium: + case Condition_Disease_Medium: + case Condition_Paralyzed: + case Condition_Unconcious: + return ui_character_condition_moderate_color; + + case Condition_Poison_Severe: + case Condition_Disease_Severe: + case Condition_Dead: + case Condition_Pertified: + case Condition_Eradicated: + return ui_character_condition_severe_color; + } + Error("Invalid condition (%u)", uConditionIdx); +} + +//----- (00495430) -------------------------------------------------------- +const char * GetReputationString(signed int a1) +{ + if (a1 >= 25) + return pGlobalTXT_LocalizationStrings[379]; // Hated + else if (a1 >= 6) + return pGlobalTXT_LocalizationStrings[392]; // Unfriendly + else if (a1 >= -5) + return pGlobalTXT_LocalizationStrings[399]; // Neutral; + else if (a1 >= -24) + return pGlobalTXT_LocalizationStrings[402]; // Friendly + else + return pGlobalTXT_LocalizationStrings[434]; // Respected; +} + +//----- (00441A4E) -------------------------------------------------------- +__int16 __fastcall sub_441A4E(int a1)//for blessing +{ + __int16 result; // ax@1 + int v2; // ebx@1 + // char *v3; // esi@1 + // int v4; // edi@4 + bool v5; // ecx@4 + SpriteFrame *pFrame; // eax@6 + //SpriteFrame *v7; // edi@6 + int v8; // eax@6 + // unsigned __int16 v9; // ax@6 + RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 + int v11; // [sp+5Ch] [bp-Ch]@6 + int v12; // [sp+60h] [bp-8h]@1 + //int v13; // [sp+64h] [bp-4h]@6 + + v10.sParentBillboardID = -1; + v10.pTarget = pRenderer->pTargetSurface; + v10.pTargetZ = pRenderer->pActiveZBuffer; + v10.uTargetPitch = pRenderer->GetRenderWidth(); + result = 0; + v2 = a1; + v10.uViewportX = 0; + v10.uViewportY = 0; + v10.uViewportZ = window->GetWidth() - 1; + v10.uViewportW = window->GetHeight() - 1; + v12 = 0; + //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; + //do + for (uint i = 0; i < 50; ++i) + { + if (pOtherOverlayList->pOverlays[i].field_6 > 0) + { + result = pOtherOverlayList->pOverlays[i].field_0; + if (pOtherOverlayList->pOverlays[i].field_0 >= 300) + { + //v4 = result; + v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 + || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 + || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 + || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; + pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; + if (pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5) + { + if (!pOtherOverlayList->pOverlays[i].field_0) + { + pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, + pOtherOverlayList->pOverlays[i].field_4); + //v7 = v6; + v11 = pOtherOverlayList->pOverlays[i].field_E; + //v13 = pFrame->scale; + //v13 = fixpoint_mul(v11, pFrame->scale); + v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; + v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; + v10._screenspace_x_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); + v10._screenspace_y_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); + v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); + v8 = pOtherOverlayList->pOverlays[i].field_2; + v10.sZValue = 0; + v10.uFlags = 0; + //v9 = pOverlayList->pOverlays[v8].uOverlayType; + if (!pOverlayList->pOverlays[v8].uOverlayType || pOverlayList->pOverlays[v8].uOverlayType == 2) + v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight / 2; + result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); + ++v12; + if (v12 == 5) + break; + } + } + } + } + //v3 += 20; + } + //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); + return result; +}
--- a/GUIWindow.cpp Fri Sep 19 03:00:21 2014 +0600 +++ b/GUIWindow.cpp Fri Sep 19 04:21:12 2014 +0600 @@ -16,8 +16,8 @@ #include "Mouse.h" #include "Engine/Graphics/Viewport.h" #include "Engine/Tables/StorylineTextTable.h" -#include "UI\UIHouses.h" -#include "UI\UIBooks.h" +#include "GUI\UI\UIHouses.h" +#include "GUI\UI\UIBooks.h" #include "Engine/texts.h" #include "Engine/Autonotes.h" #include "Engine/Awards.h" @@ -27,7 +27,7 @@ #include "Engine/Tables/IconFrameTable.h" #include "Engine/Objects/Actor.h" -#include "UI\UIArena.h" +#include "GUI\UI\UIArena.h" #include "Engine/Events.h" #include "Engine/Graphics/Level\Decoration.h"
--- a/NewUI/Core/UIControl.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -#pragma once -#include <list> -#include <algorithm> - -class UIControl -{ - public: - virtual void Show() = 0; - - virtual bool Focused() = 0; - - // Events - virtual bool OnKey(int key) {return DefaultOnKey(key);} - virtual bool OnMouseLeftClick(int x, int y) {return DefaultOnMouseLeftClick(x, y);} - virtual bool OnMouseRightClick(int x, int y) {return DefaultOnMouseRightClick(x, y);} - virtual bool OnMouseEnter() {return DefaultOnMouseEnter();} - virtual bool OnMouseLeave() {return DefaultOnMouseLeave();} - - // Container - virtual bool AddControl(UIControl *ctrl) - { - if (std::find(children.begin(), children.end(), ctrl) == children.end()) - { - children.push_back(ctrl); - ctrl->parent = this; - return true; - } - return false; - } - - virtual bool RemoveControl(UIControl *ctrl) - { - auto i = std::find(children.begin(), children.end(), ctrl); - - children.remove(ctrl); - if (i != children.end()) - { - ctrl->parent = nullptr; - return true; - } - return false; - } - - protected: - UIControl *parent; - std::list<UIControl *> children; - - - bool DefaultOnKey(int key) - { - for (auto i = children.begin(); i != children.end(); ++i) - if ((*i)->OnKey(key)) - return true; - return false; - } - - bool DefaultOnMouseLeftClick(int x, int y) - { - for (auto i = children.begin(); i != children.end(); ++i) - if ((*i)->OnMouseLeftClick(x, y)) - return true; - return false; - } - - bool DefaultOnMouseRightClick(int x, int y) - { - for (auto i = children.begin(); i != children.end(); ++i) - if ((*i)->OnMouseRightClick(x, y)) - return true; - return false; - } - - bool DefaultOnMouseEnter() - { - for (auto i = children.begin(); i != children.end(); ++i) - if ((*i)->OnMouseEnter()) - return true; - return false; - } - - bool DefaultOnMouseLeave() - { - for (auto i = children.begin(); i != children.end(); ++i) - if ((*i)->OnMouseLeave()) - return true; - return false; - } -}; \ No newline at end of file
--- a/NewUI/Core/UIControlModule.swig Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -%module UIControl -%{ -#include "UIControl.h" -%} - -%include "../../../NewUI/Core/UIControl.h" \ No newline at end of file
--- a/NewUI/Core/UIControlModule_wrap.cxx Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2523 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.11 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#define SWIGLUA -#define SWIG_LUA_TARGET SWIG_LUA_FLAVOR_LUA -#define SWIG_LUA_MODULE_GLOBAL - - -#ifdef __cplusplus -/* SwigValueWrapper is described in swig.swg */ -template<typename T> class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); - SwigValueWrapper(const SwigValueWrapper<T>& rhs); -public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -}; - -template <typename T> T SwigValueInit() { - return T(); -} -#endif - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic C API SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the SWIG runtime code. - In 99.9% of the cases, SWIG just needs to declare them as 'static'. - - But only do this if strictly necessary, ie, if you have problems - with your compiler or suchlike. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old versions of SWIG, code such as the following was usually written: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - which is the same really, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as - - int SWIG_ConvertPtr(obj, ptr,...) { - if (<obj is ok>) { - if (<need new object>) { - *ptr = <ptr to new allocated object>; - return SWIG_NEWOBJ; - } else { - *ptr = <ptr to old object>; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() -*/ - -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast(r) (r) -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - -#include <string.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *, int *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store information on one type */ -typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class<int>" == "Class<int >", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCmp(const char *nb, const char *tb) { - int equiv = 1; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (equiv != 0 && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = SWIG_TypeNameComp(nb, ne, tb, te); - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; -} - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - register size_t l = 0; - register size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - register size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - register int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - register size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* ----------------------------------------------------------------------------- - * luarun.swg - * - * This file contains the runtime support for Lua modules - * and includes code for managing global variables and pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -#include "lib/lua/lua.h" -#ifdef __cplusplus -extern "C" { -#endif - -//#include "lua.h" -//#include "lauxlib.h" -#include <stdlib.h> /* for malloc */ -#include <assert.h> /* for a few sanity tests */ - -/* ----------------------------------------------------------------------------- - * Lua flavors - * ----------------------------------------------------------------------------- */ - -#define SWIG_LUA_FLAVOR_LUA 1 -#define SWIG_LUA_FLAVOR_ELUA 2 -#define SWIG_LUA_FLAVOR_ELUAC 3 - -#if !defined(SWIG_LUA_TARGET) -# error SWIG_LUA_TARGET not defined -#endif - -#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) -# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C) -# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C) -# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C) -# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C) -#else /* SWIG_LUA_FLAVOR_LUA */ -# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0 -# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0 -# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0 -# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0 -#endif - -#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) -# define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING} -# define LSTRVAL LRO_STRVAL -#endif - -/* ----------------------------------------------------------------------------- - * compatibility defines - * ----------------------------------------------------------------------------- */ - -/* History of Lua C API length functions: In Lua 5.0 (and before?) - there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen", - but a compatibility define of "lua_strlen" was added. In Lua 5.2, - this function was again renamed, to "lua_rawlen" (to emphasize that - it doesn't call the "__len" metamethod), and the compatibility - define of lua_strlen was removed. All SWIG uses have been updated - to "lua_rawlen", and we add our own defines of that here for older - versions of Lua. */ -#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 -# define lua_rawlen lua_strlen -#elif LUA_VERSION_NUM == 501 -# define lua_rawlen lua_objlen -#endif - - -/* lua_pushglobaltable is the recommended "future-proof" way to get - the global table for Lua 5.2 and later. Here we define - lua_pushglobaltable ourselves for Lua versions before 5.2. */ -#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 -# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX) -#endif - - -/* -------------------------------------------------------------------------- - * Helper functions for error handling - * -------------------------------------------------------------------------- */ - -/* Push the string STR on the Lua stack, like lua_pushstring, but - prefixed with the the location of the innermost Lua call-point - (as formated by luaL_where). */ -SWIGRUNTIME void -SWIG_Lua_pusherrstring (lua_State *L, const char *str) -{ - luaL_where (L, 1); - lua_pushstring (L, str); - lua_concat (L, 2); -} - -/* Push a formatted string generated from FMT and following args on - the Lua stack, like lua_pushfstring, but prefixed with the the - location of the innermost Lua call-point (as formated by luaL_where). */ -SWIGRUNTIME void -SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...) -{ - va_list argp; - va_start(argp, fmt); - luaL_where(L, 1); - lua_pushvfstring(L, fmt, argp); - va_end(argp); - lua_concat(L, 2); -} - - -/* ----------------------------------------------------------------------------- - * global swig types - * ----------------------------------------------------------------------------- */ -/* Constant table */ -#define SWIG_LUA_INT 1 -#define SWIG_LUA_FLOAT 2 -#define SWIG_LUA_STRING 3 -#define SWIG_LUA_POINTER 4 -#define SWIG_LUA_BINARY 5 -#define SWIG_LUA_CHAR 6 - -/* Structure for variable linking table */ -typedef struct { - const char *name; - lua_CFunction get; - lua_CFunction set; -} swig_lua_var_info; - -/* Constant information structure */ -typedef struct { - int type; - char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_lua_const_info; - -typedef struct { - const char *name; - lua_CFunction method; -} swig_lua_method; - -typedef struct { - const char *name; - lua_CFunction getmethod; - lua_CFunction setmethod; -} swig_lua_attribute; - -// Can be used to create namespaces. Currently used to -// wrap class static methods/variables/constants -typedef struct { - const char *name; - swig_lua_method *ns_methods; - swig_lua_attribute *ns_attributes; - swig_lua_const_info *ns_constants; -} swig_lua_namespace; - -typedef struct swig_lua_class { - const char *name; - swig_type_info **type; - lua_CFunction constructor; - void (*destructor)(void *); - swig_lua_method *methods; - swig_lua_attribute *attributes; - swig_lua_namespace cls_static; - struct swig_lua_class **bases; - const char **base_names; -} swig_lua_class; - -/* this is the struct for wrapping all pointers in SwigLua -*/ -typedef struct { - swig_type_info *type; - int own; /* 1 if owned & must be destroyed */ - void *ptr; -} swig_lua_userdata; - -/* this is the struct for wrapping arbitrary packed binary data -(currently it is only used for member function pointers) -the data ordering is similar to swig_lua_userdata, but it is currently not possible -to tell the two structures apart within SWIG, other than by looking at the type -*/ -typedef struct { - swig_type_info *type; - int own; /* 1 if owned & must be destroyed */ - char data[1]; /* arbitary amount of data */ -} swig_lua_rawdata; - -/* Common SWIG API */ -#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) -#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) -#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty) -#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type) - -/* Runtime API */ -#define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata)) -#define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer) -#define SWIG_MODULE_CLIENTDATA_TYPE lua_State* - -/* Contract support */ -#define SWIG_contract_assert(expr, msg) \ - if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else - - -/* helper #defines */ -#define SWIG_fail {goto fail;} -#define SWIG_fail_arg(func_name,argnum,type) \ - {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\ - func_name,argnum,type,SWIG_Lua_typename(L,argnum));\ - goto fail;} -#define SWIG_fail_ptr(func_name,argnum,type) \ - SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*") -#define SWIG_check_num_args(func_name,a,b) \ - if (lua_gettop(L)<a || lua_gettop(L)>b) \ - {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\ - goto fail;} - - -#define SWIG_Lua_get_table(L,n) \ - (lua_pushstring(L, n), lua_rawget(L,-2)) - -#define SWIG_Lua_add_function(L,n,f) \ - (lua_pushstring(L, n), \ - lua_pushcfunction(L, f), \ - lua_rawset(L,-3)) - -/* special helper for allowing 'nil' for usertypes */ -#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I)) - -#ifdef __cplusplus -/* Special helper for member function pointers -it gets the address, casts it, then dereferences it */ -//#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) -#endif - -/* storing/access of swig_module_info */ -SWIGRUNTIME swig_module_info * -SWIG_Lua_GetModule(lua_State* L) { - swig_module_info *ret = 0; - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_rawget(L,LUA_REGISTRYINDEX); - if (lua_islightuserdata(L,-1)) - ret=(swig_module_info*)lua_touserdata(L,-1); - lua_pop(L,1); /* tidy */ - return ret; -} - -SWIGRUNTIME void -SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { - /* add this all into the Lua registry: */ - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_pushlightuserdata(L,(void*)module); - lua_rawset(L,LUA_REGISTRYINDEX); -} - -/* ----------------------------------------------------------------------------- - * global variable support code: modules - * ----------------------------------------------------------------------------- */ - -/* this function is called when trying to set an immutable. -default action is to print an error. -This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */ -SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L) -{ -/* there should be 1 param passed in: the new value */ -#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE - lua_pop(L,1); /* remove it */ - luaL_error(L,"This variable is immutable"); -#endif - return 0; /* should not return anything */ -} - -/* the module.get method used for getting linked data */ -SWIGINTERN int SWIG_Lua_module_get(lua_State* L) -{ -/* there should be 2 params passed in - (1) table (not the meta table) - (2) string name of the attribute - printf("SWIG_Lua_module_get %p(%s) '%s'\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2)); -*/ - /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,1)); /* just in case */ -#else - assert(lua_istable(L,1)); /* default Lua action */ -#endif - lua_getmetatable(L,1); /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,-1)); /* just in case */ -#else - assert(lua_istable(L,-1)); -#endif - SWIG_Lua_get_table(L,".get"); /* get the .get table */ - lua_remove(L,3); /* remove metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - if (lua_isrotable(L,-1)) -#else - if (lua_istable(L,-1)) -#endif - { - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,3); /* remove .get */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_call(L,0,1); - return 1; - } - lua_pop(L,1); /* remove the top */ - } - lua_pop(L,1); /* remove the .get */ - lua_pushnil(L); /* return a nil */ - return 1; -} - -/* the module.set method used for setting linked data */ -SWIGINTERN int SWIG_Lua_module_set(lua_State* L) -{ -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value -*/ - /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,1)); /* just in case */ -#else - assert(lua_istable(L,1)); /* default Lua action */ -#endif - lua_getmetatable(L,1); /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,-1)); /* just in case */ -#else - assert(lua_istable(L,-1)); -#endif - SWIG_Lua_get_table(L,".set"); /* get the .set table */ - lua_remove(L,4); /* remove metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - if (lua_isrotable(L,-1)) -#else - if (lua_istable(L,-1)) -#endif - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,4); /* remove .set */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,3); /* value */ - lua_call(L,1,0); - return 0; - } -#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) - else { - return 0; // Exits stoically if an invalid key is initialized. - } -#endif - } - lua_settop(L,3); /* reset back to start */ - /* we now have the table, key & new value, so just set directly */ - lua_rawset(L,1); /* add direct */ - return 0; -} - -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) -/* registering a module in lua. Pushes the module table on the stack. */ -SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name) -{ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushstring(L,name); - lua_newtable(L); /* the table */ - /* add meta table */ - lua_newtable(L); /* the meta table */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set); - lua_pushstring(L,".get"); - lua_newtable(L); /* the .get table */ - lua_rawset(L,-3); /* add .get into metatable */ - lua_pushstring(L,".set"); - lua_newtable(L); /* the .set table */ - lua_rawset(L,-3); /* add .set into metatable */ - lua_setmetatable(L,-2); /* sets meta table in module */ -#ifdef SWIG_LUA_MODULE_GLOBAL - /* If requested, install the module directly into the global namespace. */ - lua_rawset(L,-3); /* add module into parent */ - SWIG_Lua_get_table(L,name); /* get the table back out */ -#else - /* Do not install the module table as global name. The stack top has - the module table with the name below. We pop the top and replace - the name with it. */ - lua_replace(L,-2); -#endif -} - -/* ending the register */ -SWIGINTERN void SWIG_Lua_module_end(lua_State* L) -{ - lua_pop(L,1); /* tidy stack (remove module) */ -} - -/* adding a linked variable to the module */ -SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) -{ - assert(lua_istable(L,-1)); /* just in case */ - lua_getmetatable(L,-1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) /* if there is a set fn */ - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } - lua_pop(L,1); /* tidy stack (remove meta) */ -} -#endif - -/* adding a function module */ -SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn) -{ - SWIG_Lua_add_function(L,name,fn); -} - -/* ----------------------------------------------------------------------------- - * global variable support code: namespaces - * ----------------------------------------------------------------------------- */ - -SWIGINTERN int SWIG_Lua_namespace_get(lua_State* L) -{ -/* there should be 2 params passed in - (1) table (not the meta table) - (2) string name of the attribute -*/ - assert(lua_istable(L,-2)); /* just in case */ - lua_getmetatable(L,-2); - assert(lua_istable(L,-1)); - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,-2); /* stack tidy, remove .get table */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* ok, so try the .fn table */ - SWIG_Lua_get_table(L,".fn"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); /* look for the fn */ - lua_remove(L,-2); /* stack tidy, remove .fn table */ - if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */ - { /* found it so return the fn & let lua call it */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - return 0; -} - -SWIGINTERN int SWIG_Lua_namespace_set(lua_State* L) -{ -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value -*/ - - assert(lua_istable(L,1)); - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); - - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,3); /* value */ - lua_call(L,1,0); - return 0; - } - lua_pop(L,1); /* remove the value */ - } - lua_pop(L,1); /* remove the value .set table */ - return 0; -} - -SWIGINTERN void SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]); // forward declaration -SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn); // forward declaration - -/* helper function - register namespace methods and attributes into namespace */ -SWIGINTERN void SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* ns) -{ - int i = 0; - assert(lua_istable(L,-1)); - /* There must be table at the top of the stack */ - SWIG_Lua_InstallConstants(L, ns->ns_constants); - - lua_getmetatable(L,-1); - - /* add fns */ - for(i=0;ns->ns_attributes[i].name;i++){ - SWIG_Lua_add_class_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod); - } - - /* add methods to the metatable */ - SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ - assert(lua_istable(L,-1)); /* just in case */ - for(i=0;ns->ns_methods[i].name;i++){ - SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].method); - } - lua_pop(L,1); - - /* clear stack - remove metatble */ - lua_pop(L,1); - -} - -/* helper function. creates namespace table and add it to module table */ -SWIGINTERN void SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns) -{ - assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table */ - lua_checkstack(L,5); - lua_pushstring(L, ns->name); - lua_newtable(L); /* namespace itself */ - lua_newtable(L); /* metatable for namespace */ - - /* add a table called ".get" */ - lua_pushstring(L,".get"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".set" */ - lua_pushstring(L,".set"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".fn" */ - lua_pushstring(L,".fn"); - lua_newtable(L); - lua_rawset(L,-3); - - /* add accessor fns for using the .get,.set&.fn */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set); - - lua_setmetatable(L,-2); /* set metatable */ - lua_rawset(L,-3); /* add namespace to module table */ -} -/* ----------------------------------------------------------------------------- - * global variable support code: classes - * ----------------------------------------------------------------------------- */ - -/* the class.get method, performs the lookup of class attributes */ -SWIGINTERN int SWIG_Lua_class_get(lua_State* L) -{ -/* there should be 2 params passed in - (1) userdata (not the meta table) - (2) string name of the attribute -*/ - assert(lua_isuserdata(L,-2)); /* just in case */ - lua_getmetatable(L,-2); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,-2); /* stack tidy, remove .get table */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* ok, so try the .fn table */ - SWIG_Lua_get_table(L,".fn"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); /* look for the fn */ - lua_remove(L,-2); /* stack tidy, remove .fn table */ - if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */ - { /* found it so return the fn & let lua call it */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* NEW: looks for the __getitem() fn - this is a user provided get fn */ - SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; /* sorry not known */ -} - -/* the class.set method, performs the lookup of class attributes */ -SWIGINTERN int SWIG_Lua_class_set(lua_State* L) -{ -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value -printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2), - lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/ - - assert(lua_isuserdata(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* userdata */ - lua_pushvalue(L,3); /* value */ - lua_call(L,2,0); - return 0; - } - lua_pop(L,1); /* remove the value */ - } - lua_pop(L,1); /* remove the value .set table */ - /* NEW: looks for the __setitem() fn - this is a user provided set fn */ - SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_pushvalue(L,3); /* the value */ - lua_call(L,3,0); /* 3 values in ,0 out */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; -} - -/* the class.destruct method called by the interpreter */ -SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L) -{ -/* there should be 1 params passed in - (1) userdata (not the meta table) */ - swig_lua_userdata* usr; - swig_lua_class* clss; - assert(lua_isuserdata(L,-1)); /* just in case */ - usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ - /* if must be destroyed & has a destructor */ - if (usr->own) /* if must be destroyed */ - { - clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ - if (clss && clss->destructor) /* there is a destroy fn */ - { - clss->destructor(usr->ptr); /* bye bye */ - } - } - return 0; -} - -/* the class.__tostring method called by the interpreter and print */ -SWIGINTERN int SWIG_Lua_class_tostring(lua_State* L) -{ -/* there should be 1 param passed in - (1) userdata (not the metatable) */ - assert(lua_isuserdata(L,1)); /* just in case */ - unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */ - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - - lua_getfield(L, -1, ".type"); - const char* className = lua_tostring(L, -1); - - char output[256]; - sprintf(output, "<%s userdata: %lX>", className, userData); - - lua_pushstring(L, (const char*)output); - return 1; -} - -/* to manually disown some userdata */ -SWIGINTERN int SWIG_Lua_class_disown(lua_State* L) -{ -/* there should be 1 params passed in - (1) userdata (not the meta table) */ - swig_lua_userdata* usr; - assert(lua_isuserdata(L,-1)); /* just in case */ - usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ - - usr->own = 0; /* clear our ownership */ - return 0; -} - -/* Constructor proxy. Used when class name entry in module is not class constructor, -but special table instead. */ -SWIGINTERN int SWIG_Lua_constructor_proxy(lua_State* L) -{ - /* unlimited number of parameters - First one is our proxy table and we should remove it - Other we should pass to real constructor - */ - assert(lua_istable(L,1)); - lua_pushstring(L,".constructor"); - lua_rawget(L,1); - assert(!lua_isnil(L,-1)); - lua_replace(L,1); /* replace our table with real constructor */ - lua_call(L,lua_gettop(L)-1,1); - return 1; -} - -/* gets the swig class registry (or creates it) */ -SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L) -{ - /* add this all into the swig registry: */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ - if (!lua_istable(L,-1)) /* not there */ - { /* must be first time, so add it */ - lua_pop(L,1); /* remove the result */ - lua_pushstring(L,"SWIG"); - lua_newtable(L); - lua_rawset(L,LUA_REGISTRYINDEX); - /* then get it */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); - } -} - -/* helper fn to get the classes metatable from the register */ -SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname) -{ - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,cname); /* get the name */ - lua_rawget(L,-2); /* get it */ - lua_remove(L,-2); /* tidy up (remove registry) */ -} - -/* helper add a variable to a registered class */ -SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) -{ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } -} - -/* helper to recursively add class static details (static attributes, operations and constants) */ -SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State* L, swig_lua_class* clss) -{ - int i = 0; - /* The class namespace table must be on the top of the stack */ - assert(lua_istable(L,-1)); - /* call all the base classes first: we can then override these later: */ - for(i=0;clss->bases[i];i++) - { - SWIG_Lua_add_class_static_details(L,clss->bases[i]); - } - - SWIG_Lua_add_namespace_details(L, &clss->cls_static); -} - -/* helper to recursively add class details (attributes & operations) */ -SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss) -{ - int i; - /* call all the base classes first: we can then override these later: */ - for(i=0;clss->bases[i];i++) - { - SWIG_Lua_add_class_details(L,clss->bases[i]); - } - /* add fns */ - for(i=0;clss->attributes[i].name;i++){ - SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); - } - /* add methods to the metatable */ - SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ - assert(lua_istable(L,-1)); /* just in case */ - for(i=0;clss->methods[i].name;i++){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - lua_pop(L,1); /* tidy stack (remove table) */ - /* add operator overloads - these look ANY method which start with "__" and assume they - are operator overloads & add them to the metatable - (this might mess up is someone defines a method __gc (the destructor)*/ - for(i=0;clss->methods[i].name;i++){ - if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - } -} - -/* set up the base classes pointers. -Each class structure has a list of pointers to the base class structures. -This function fills them. -It cannot be done at compile time, as this will not work with hireachies -spread over more than one swig file. -Therefore it must be done at runtime, querying the SWIG type system. -*/ -SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss) -{ - int i=0; - swig_module_info* module=SWIG_GetModule(L); - for(i=0;clss->base_names[i];i++) - { - if (clss->bases[i]==0) /* not found yet */ - { - /* lookup and cache the base class */ - swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]); - if (info) clss->bases[i] = (swig_lua_class *) info->clientdata; - } - } -} - -/* Register class static methods,attributes etc as well as constructor proxy */ -SWIGINTERN void SWIG_Lua_class_register_static(lua_State* L, swig_lua_class* clss) -{ - lua_checkstack(L,5); /* just in case */ - assert(lua_istable(L,-1)); /* just in case */ - assert(strcmp(clss->name, clss->cls_static.name) == 0); /* in class those 2 must be equal */ - - SWIG_Lua_namespace_register(L,&clss->cls_static); - - SWIG_Lua_get_table(L,clss->name); // Get namespace table back - assert(lua_istable(L,-1)); /* just in case */ - - /* add its constructor to module with the name of the class - so you can do MyClass(...) as well as new_MyClass(...) - BUT only if a constructor is defined - (this overcomes the problem of pure virtual classes without constructors)*/ - if (clss->constructor) - { - SWIG_Lua_add_function(L,".constructor", clss->constructor); - lua_getmetatable(L,-1); - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,"__call", SWIG_Lua_constructor_proxy); - lua_pop(L,1); - } - - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_class_static_details(L, clss); - - /* clear stack */ - lua_pop(L,1); -} - -/* performs the entire class registration process */ -SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss) -{ - SWIG_Lua_class_register_static(L,clss); - - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,clss->name); /* get the name */ - lua_newtable(L); /* create the metatable */ - /* add string of class name called ".type" */ - lua_pushstring(L,".type"); - lua_pushstring(L,clss->name); - lua_rawset(L,-3); - /* add a table called ".get" */ - lua_pushstring(L,".get"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".set" */ - lua_pushstring(L,".set"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".fn" */ - lua_pushstring(L,".fn"); - lua_newtable(L); - /* add manual disown method */ - SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown); - lua_rawset(L,-3); - /* add accessor fns for using the .get,.set&.fn */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); - SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); - /* add tostring method for better output */ - SWIG_Lua_add_function(L,"__tostring",SWIG_Lua_class_tostring); - /* add it */ - lua_rawset(L,-3); /* metatable into registry */ - lua_pop(L,1); /* tidy stack (remove registry) */ - - SWIG_Lua_get_class_metatable(L,clss->name); - SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */ - lua_pop(L,1); /* tidy stack (remove class metatable) */ -} - -/* ----------------------------------------------------------------------------- - * Class/structure conversion fns - * ----------------------------------------------------------------------------- */ - -/* helper to add metatable to new lua object */ -SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type) -{ - if (type->clientdata) /* there is clientdata: so add the metatable */ - { - SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name); - if (lua_istable(L,-1)) - { - lua_setmetatable(L,-2); - } - else - { - lua_pop(L,1); - } - } -} - -/* pushes a new object into the lua stack */ -SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own) -{ - swig_lua_userdata* usr; - if (!ptr){ - lua_pushnil(L); - return; - } - usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ - usr->ptr=ptr; /* set the ptr */ - usr->type=type; - usr->own=own; -#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) - _SWIG_Lua_AddMetatable(L,type); /* add metatable */ -#endif -} - -/* takes a object from the lua stack & converts it into an object of the correct type - (if possible) */ -SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags) -{ - swig_lua_userdata* usr; - swig_cast_info *cast; - if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */ - usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ - if (usr) - { - if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ - { - usr->own=0; - } - if (!type) /* special cast void*, no casting fn */ - { - *ptr=usr->ptr; - return SWIG_OK; /* ok */ - } - cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ - if (cast) - { - int newmemory = 0; - *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; /* ok */ - } - } - return SWIG_ERROR; /* error */ -} - -SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags, - int argnum,const char* func_name){ - void* result; - if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){ - luaL_error (L,"Error in %s, expected a %s at argument number %d\n", - func_name,(type && type->str)?type->str:"void*",argnum); - } - return result; -} - -/* pushes a packed userdata. user for member fn pointers only */ -SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type) -{ - swig_lua_rawdata* raw; - assert(ptr); /* not acceptable to pass in a NULL value */ - raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */ - raw->type=type; - raw->own=0; - memcpy(raw->data,ptr,size); /* copy the data */ - _SWIG_Lua_AddMetatable(L,type); /* add metatable */ -} - -/* converts a packed userdata. user for member fn pointers only */ -SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type) -{ - swig_lua_rawdata* raw; - raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */ - if (!raw) return SWIG_ERROR; /* error */ - if (type==0 || type==raw->type) /* void* or identical type */ - { - memcpy(ptr,raw->data,size); /* copy it */ - return SWIG_OK; /* ok */ - } - return SWIG_ERROR; /* error */ -} - -/* a function to get the typestring of a piece of data */ -SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) -{ - swig_lua_userdata* usr; - if (lua_isuserdata(L,tp)) - { - usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */ - if (usr && usr->type && usr->type->str) - return usr->type->str; - return "userdata (unknown type)"; - } - return lua_typename(L,lua_type(L,tp)); -} - -/* lua callable function to get the userdata's type */ -SWIGRUNTIME int SWIG_Lua_type(lua_State* L) -{ - lua_pushstring(L,SWIG_Lua_typename(L,1)); - return 1; -} - -/* lua callable function to compare userdata's value -the issue is that two userdata may point to the same thing -but to lua, they are different objects */ -SWIGRUNTIME int SWIG_Lua_equal(lua_State* L) -{ - int result; - swig_lua_userdata *usr1,*usr2; - if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ - return 0; /* nil reply */ - usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ - usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ - /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/ - result=(usr1->ptr==usr2->ptr); - lua_pushboolean(L,result); - return 1; -} - -/* ----------------------------------------------------------------------------- - * global variable support code: class/struct typemap functions - * ----------------------------------------------------------------------------- */ - -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) -/* Install Constants */ -SWIGINTERN void -SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { - int i; - for (i = 0; constants[i].type; i++) { - switch(constants[i].type) { - case SWIG_LUA_INT: - lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(lua_Number)constants[i].lvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_FLOAT: - lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(lua_Number)constants[i].dvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_CHAR: - lua_pushstring(L,constants[i].name); - lua_pushfstring(L,"%c",(char)constants[i].lvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_STRING: - lua_pushstring(L,constants[i].name); - lua_pushstring(L,(char *) constants[i].pvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_POINTER: - lua_pushstring(L,constants[i].name); - SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0); - lua_rawset(L,-3); - break; - case SWIG_LUA_BINARY: - lua_pushstring(L,constants[i].name); - SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype); - lua_rawset(L,-3); - break; - default: - break; - } - } -} -#endif - -/* ----------------------------------------------------------------------------- - * executing lua code from within the wrapper - * ----------------------------------------------------------------------------- */ - -#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */ -#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S) -#endif -/* Executes a C string in Lua which is a really simple way of calling lua from C -Unfortunately lua keeps changing its APIs, so we need a conditional compile -In lua 5.0.X its lua_dostring() -In lua 5.1.X its luaL_dostring() -*/ -SWIGINTERN int -SWIG_Lua_dostring(lua_State *L, const char* str) { - int ok,top; - if (str==0 || str[0]==0) return 0; /* nothing to do */ - top=lua_gettop(L); /* save stack */ -#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501)) - ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */ -#else - ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */ -#endif - if (ok!=0) { - SWIG_DOSTRING_FAIL(lua_tostring(L,-1)); - } - lua_settop(L,top); /* restore the stack */ - return ok; -} - -#ifdef __cplusplus -} -#endif - -/* ------------------------------ end luarun.swg ------------------------------ */ - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_UIControl swig_types[0] -static swig_type_info *swig_types[2]; -static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) - -/* -------- TYPES TABLE (END) -------- */ - -#define SWIG_name "UIControl" -#define SWIG_init luaopen_UIControl -#define SWIG_init_user luaopen_UIControl_user - -#define SWIG_LUACODE luaopen_UIControl_luacode - -namespace swig { -typedef struct{} LANGUAGE_OBJ; -} - - -#include "UIControl.h" - -#ifdef __cplusplus -extern "C" { -#endif -static int _wrap_UIControl_Show(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - - SWIG_check_num_args("UIControl::Show",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Show",1,"UIControl *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_Show",1,SWIGTYPE_p_UIControl); - } - - (arg1)->Show(); - - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_Focused(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - bool result; - - SWIG_check_num_args("UIControl::Focused",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::Focused",1,"UIControl *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_Focused",1,SWIGTYPE_p_UIControl); - } - - result = (bool)(arg1)->Focused(); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_OnKey(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - int arg2 ; - bool result; - - SWIG_check_num_args("UIControl::OnKey",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnKey",1,"UIControl *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnKey",2,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_OnKey",1,SWIGTYPE_p_UIControl); - } - - arg2 = (int)lua_tonumber(L, 2); - result = (bool)(arg1)->OnKey(arg2); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_OnMouseLeftClick(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - int arg2 ; - int arg3 ; - bool result; - - SWIG_check_num_args("UIControl::OnMouseLeftClick",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeftClick",1,"UIControl *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseLeftClick",2,"int"); - if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseLeftClick",3,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_OnMouseLeftClick",1,SWIGTYPE_p_UIControl); - } - - arg2 = (int)lua_tonumber(L, 2); - arg3 = (int)lua_tonumber(L, 3); - result = (bool)(arg1)->OnMouseLeftClick(arg2,arg3); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_OnMouseRightClick(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - int arg2 ; - int arg3 ; - bool result; - - SWIG_check_num_args("UIControl::OnMouseRightClick",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseRightClick",1,"UIControl *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("UIControl::OnMouseRightClick",2,"int"); - if(!lua_isnumber(L,3)) SWIG_fail_arg("UIControl::OnMouseRightClick",3,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_OnMouseRightClick",1,SWIGTYPE_p_UIControl); - } - - arg2 = (int)lua_tonumber(L, 2); - arg3 = (int)lua_tonumber(L, 3); - result = (bool)(arg1)->OnMouseRightClick(arg2,arg3); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_OnMouseEnter(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - bool result; - - SWIG_check_num_args("UIControl::OnMouseEnter",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseEnter",1,"UIControl *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_OnMouseEnter",1,SWIGTYPE_p_UIControl); - } - - result = (bool)(arg1)->OnMouseEnter(); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_OnMouseLeave(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - bool result; - - SWIG_check_num_args("UIControl::OnMouseLeave",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::OnMouseLeave",1,"UIControl *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_OnMouseLeave",1,SWIGTYPE_p_UIControl); - } - - result = (bool)(arg1)->OnMouseLeave(); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_AddControl(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - UIControl *arg2 = (UIControl *) 0 ; - bool result; - - SWIG_check_num_args("UIControl::AddControl",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::AddControl",1,"UIControl *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::AddControl",2,"UIControl *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_AddControl",1,SWIGTYPE_p_UIControl); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_AddControl",2,SWIGTYPE_p_UIControl); - } - - result = (bool)(arg1)->AddControl(arg2); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static int _wrap_UIControl_RemoveControl(lua_State* L) { - int SWIG_arg = 0; - UIControl *arg1 = (UIControl *) 0 ; - UIControl *arg2 = (UIControl *) 0 ; - bool result; - - SWIG_check_num_args("UIControl::RemoveControl",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("UIControl::RemoveControl",1,"UIControl *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("UIControl::RemoveControl",2,"UIControl *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_RemoveControl",1,SWIGTYPE_p_UIControl); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_UIControl,0))){ - SWIG_fail_ptr("UIControl_RemoveControl",2,SWIGTYPE_p_UIControl); - } - - result = (bool)(arg1)->RemoveControl(arg2); - lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; - return SWIG_arg; - - if(0) SWIG_fail; - -fail: - lua_error(L); - return SWIG_arg; -} - - -static void swig_delete_UIControl(void *obj) { -UIControl *arg1 = (UIControl *) obj; -delete arg1; -} -static swig_lua_method swig_UIControl_methods[] = { - {"Show", _wrap_UIControl_Show}, - {"Focused", _wrap_UIControl_Focused}, - {"OnKey", _wrap_UIControl_OnKey}, - {"OnMouseLeftClick", _wrap_UIControl_OnMouseLeftClick}, - {"OnMouseRightClick", _wrap_UIControl_OnMouseRightClick}, - {"OnMouseEnter", _wrap_UIControl_OnMouseEnter}, - {"OnMouseLeave", _wrap_UIControl_OnMouseLeave}, - {"AddControl", _wrap_UIControl_AddControl}, - {"RemoveControl", _wrap_UIControl_RemoveControl}, - {0,0} -}; -static swig_lua_attribute swig_UIControl_attributes[] = { - {0,0,0} -}; -static swig_lua_attribute swig_UIControl_cls_attributes[] = { - {0,0,0} -}; -static swig_lua_method swig_UIControl_cls_methods[] = { - {0,0} -}; -static swig_lua_const_info swig_UIControl_cls_constants[] = { - {0,0,0,0,0,0} -}; -static swig_lua_class *swig_UIControl_bases[] = {0}; -static const char *swig_UIControl_base_names[] = {0}; -static swig_lua_class _wrap_class_UIControl = { "UIControl", &SWIGTYPE_p_UIControl,0, swig_delete_UIControl, swig_UIControl_methods, swig_UIControl_attributes, { "UIControl", swig_UIControl_cls_methods, swig_UIControl_cls_attributes, swig_UIControl_cls_constants }, swig_UIControl_bases, swig_UIControl_base_names }; - -#ifdef __cplusplus -} -#endif - -static const struct luaL_Reg swig_commands[] = { - {0,0} -}; - -static swig_lua_var_info swig_variables[] = { - {0,0,0} -}; - -static swig_lua_const_info swig_constants[] = { - {0,0,0,0,0,0} -}; - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_UIControl = {"_p_UIControl", "UIControl *", 0, 0, (void*)&_wrap_class_UIControl, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_UIControl, -}; - -static swig_cast_info _swigc__p_UIControl[] = { {&_swigt__p_UIControl, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_UIControl, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned staticly to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int found, init; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* When multiple interpreters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ /* c-mode */ -#endif -} -#endif - - - -/* Forward declaration of where the user's %init{} gets inserted */ -void SWIG_init_user(lua_State* L ); - -#ifdef __cplusplus -extern "C" { -#endif -/* this is the initialization function - added at the very end of the code - the function is always called SWIG_init, but an earlier #define will rename it -*/ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) -LUALIB_API int SWIG_init(lua_State* L) -#else -SWIGEXPORT int SWIG_init(lua_State* L) /* default Lua action */ -#endif -{ -#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */ - int i; - /* start with global table */ - lua_pushglobaltable (L); - /* SWIG's internal initalisation */ - SWIG_InitializeModule((void*)L); - SWIG_PropagateClientData(); -#endif - -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) - /* add a global fn */ - SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type); - SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal); - /* begin the module (its a table with the same name as the module) */ - SWIG_Lua_module_begin(L,SWIG_name); - /* add commands/functions */ - for (i = 0; swig_commands[i].name; i++){ - SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func); - } - /* add variables */ - for (i = 0; swig_variables[i].name; i++){ - SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set); - } -#endif - -#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) - /* set up base class pointers (the hierarchy) */ - for (i = 0; swig_types[i]; i++){ - if (swig_types[i]->clientdata){ - SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata)); - } - } - /* additional registration structs & classes in lua */ - for (i = 0; swig_types[i]; i++){ - if (swig_types[i]->clientdata){ - SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata)); - } - } -#endif - -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) - /* constants */ - SWIG_Lua_InstallConstants(L,swig_constants); -#endif - -#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) - /* invoke user-specific initialization */ - SWIG_init_user(L); - /* end module */ - /* Note: We do not clean up the stack here (Lua will do this for us). At this - point, we have the globals table and out module table on the stack. Returning - one value makes the module table the result of the require command. */ - return 1; -#else - return 0; -#endif -} - -#ifdef __cplusplus -} -#endif - - -const char* SWIG_LUACODE= - ""; - -void SWIG_init_user(lua_State* L) -{ - /* exec Lua code if applicable */ - SWIG_Lua_dostring(L,SWIG_LUACODE); -} -
--- a/NewUI/MainMenu.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "MainMenu.h" -#include "..\Engine/LOD.h" - -bool MainMenuWindow::OnMouseLeftClick(int x, int y) -{ - if (UIControl::OnMouseLeftClick(x, y)) - return true; - return false; -} - -bool MainMenuWindow::OnMouseRightClick(int x, int y) -{ - if (UIControl::OnMouseRightClick(x, y)) - return true; - return false; -} - -bool MainMenuWindow::OnKey(int key) -{ - if (UIControl::OnKey(key)) - return true; - return false; -} - - -void MainMenuWindow::Show() {} -bool MainMenuWindow::Focused() {return false;} - -bool MainMenuWindow::Initialize() -{ - RGBTexture* background_texture = new RGBTexture; - background_texture->Load("mm6title.pcx", 0); - return true; -} - -MainMenuWindow *MainMenuWindow::Create() -{ - MainMenuWindow* window = new MainMenuWindow; - if (window) - if (!window->Initialize()) - { - delete window; - window = nullptr; - } - return window; -} \ No newline at end of file
--- a/NewUI/MainMenu.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#pragma once -#include "Core/UIControl.h" -#include "..\Engine/Graphics/Render.h" - - -class MainMenuWindow: public UIControl -{ - public: - static MainMenuWindow *Create(); - - bool Initialize(); - - // UIControl - virtual void Show() override; - - // UIControl - virtual bool Focused() override; - - // UIControl - virtual bool OnKey(int key) override; - // UIControl - virtual bool OnMouseLeftClick(int x, int y) override; - // UIControl - virtual bool OnMouseRightClick(int x, int y) override; - // UIControl - //virtual bool OnMouseEnter() override; - // UIControl - //virtual bool OnMouseLeave() override; - - private: - RGBTexture *background_texture; -}; \ No newline at end of file
--- a/OSWindow.h Fri Sep 19 03:00:21 2014 +0600 +++ b/OSWindow.h Fri Sep 19 04:21:12 2014 +0600 @@ -1,6 +1,6 @@ #pragma once #include "OSAPI.h" -#include "NewUI/Core/UIControl.h" +#include "GUI/NewUI/Core/UIControl.h" extern class OSWindow *window;
--- a/UI/Books/UIMapBook.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,710 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include "UIMapBook.h" -#include "..\..\Engine/Events.h" -#include "..\..\Engine/MM7.h" -#include "..\..\Engine/Graphics/Render.h" -#include "..\..\Mouse.h" -#include "..\UIBooks.h" -#include "..\..\Engine/MapInfo.h" -#include "..\..\GUIWindow.h" -#include "..\..\GUIFont.h" -#include "..\..\Engine/Party.h" -#include "..\..\AudioPlayer.h" -#include "..\..\Engine/Graphics/Outdoor.h" -#include "..\..\Engine/LOD.h" -#include "..\..\Engine/Graphics/Viewport.h" -#include "..\..\Engine/OurMath.h" -#include "..\..\Engine/texts.h" -#include "..\..\Engine/Graphics/Level/Decoration.h" -// -#include "..\..\Engine/mm7_data.h" - - - -std::array<__int16, 6> pTownPortalBook_xs = {{260, 324, 147, 385, 390, 19}}; -std::array<__int16, 6> pTownPortalBook_ys = {{206, 84, 182, 239, 17, 283}}; - -std::array<unsigned int, 5> pLloydsBeaconsPreviewXs = {{61, 281, 61, 281, 171}}; // 004E249C -std::array<unsigned int, 5> pLloydsBeaconsPreviewYs = {{84, 84, 228, 228, 155}}; -std::array<unsigned int, 5> pLloydsBeacons_SomeXs = {{59, 279, 59, 279, 169}}; -std::array<unsigned int, 5> pLloydsBeacons_SomeYs = {{82, 82, 226, 226, 153}}; - - - - -//----- (00411150) -------------------------------------------------------- -void BookUI_DrawTownPortalMap() -{ - int v3; // edi@17 - GUIWindow TownPortalWindow; // [sp+Ch] [bp-64h]@1 - POINT a2; // [sp+68h] [bp-8h]@17 - - pRenderer->ClearZBuffer(0, 479); - pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook); - pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); - - TownPortalWindow.uFrameX = game_viewport_x; - TownPortalWindow.uFrameY = game_viewport_y; - TownPortalWindow.uFrameWidth = game_viewport_width; - TownPortalWindow.uFrameHeight = game_viewport_height; - TownPortalWindow.uFrameZ = game_viewport_z; - TownPortalWindow.uFrameW = game_viewport_w; - - const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE, - PARTY_QUEST_FOUNTAIN_PIERPONT, - PARTY_QUEST_FOUNTAIN_NIGHON, - PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE, - PARTY_QUEST_FOUNTAIN_CELESTIA, - PARTY_QUEST_FOUNTAIN_THE_PIT}; - for (uint i = 0; i < 6; ++i) - { - - if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i])) - pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i], - pTownPortalBook_ys[i], - pTexture_TownPortalIcons[i], i + 1); - } - - pMouse->GetCursorPos(&a2); - v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; - - if (v3) - { - if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1])) - pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]); - } - TownPortalWindow.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); -} - -//----- (00410DEC) -------------------------------------------------------- -unsigned int DrawLloydBeaconsScreen() -{ - Player *pPlayer; // esi@1 - const char *pText; // eax@1 - int pTextHeight; // eax@14 - int RemainingTime; // kr08_8@14 - unsigned int pHours; // esi@14 - unsigned int pDays; // eax@14 - const char *pSelectionText; // eax@19 - Texture *v19; // [sp-4h] [bp-8Ch]@4 - GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1 - char *Str; // [sp+74h] [bp-14h]@14 - int BeaconID; // [sp+78h] [bp-10h]@11 - int uNumMaxBeacons; // [sp+84h] [bp-4h]@6 - - pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid]; - pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]); - pText = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon - pWindow.uFrameX = game_viewport_x; - pWindow.uFrameY = game_viewport_y; - pWindow.uFrameWidth = 428; - pWindow.uFrameHeight = game_viewport_height; - pWindow.uFrameZ = 435; - pWindow.uFrameW = game_viewport_w; - if ( !bRecallingBeacon ) - pText = pGlobalTXT_LocalizationStrings[375]; // Set Beacon - sprintf(pTmpBuf.data(), "%s", pText); - pWindow.DrawTitleText(pBook2Font, 0, 22, 0, pTmpBuf.data(), 3); - if ( bRecallingBeacon ) - { - pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_on); - v19 = pTex_book_button1_off; - } - else - { - pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_book_button1_off); - v19 = pTex_book_button1_on; - } - pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); - uNumMaxBeacons = 1; - if ( HIBYTE(pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) & 1 || (pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x80u) != 0 ) - { - uNumMaxBeacons = 5; - } - else - { - if ( pPlayer->pActiveSkills[PLAYER_SKILL_WATER] & 0x40 ) - uNumMaxBeacons = 3; - } - if ( uNumMaxBeacons > 0 ) - { - for ( BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++ ) - { - pWindow.uFrameWidth = 92; - pWindow.uFrameHeight = 68; - pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID]; - pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID]; - pWindow.uFrameW = pWindow.uFrameY + 67; - pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91; - //if ( pSavegameThumbnails[BeaconID].pPixels != 0 ) - if ( pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0 ) - { - pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook); - pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]); - Str = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName; - pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0); - pWindow.uFrameY += -6 - pTextHeight; - pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3); - RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed; - pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60; - pDays = pHours / 24; - if ( pDays ) - { - sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days - pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; - pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); - continue; - } - else - { - if ( pHours + 1 <= 23 ) - { - if ( pHours < 1 ) - pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour - else - pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours - sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText); - pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; - pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); - continue; - } - } - sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day - pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4; - pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); - continue; - } - if ( !bRecallingBeacon ) - { - pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook); - pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0); - pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно - } - } - } - if ( byte_506360 ) - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); - return BeaconID; -} - -//----- (00413980) -------------------------------------------------------- -void BookUI_Map_Draw() -{ - unsigned int map_id; // eax@35 - char party_coord[120]; // [sp+Ch] [bp-CCh]@37 - GUIWindow map_window; // [sp+84h] [bp-54h]@35 - - pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); - if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1 - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); - - if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2 - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); - - if ( Book_PageBtn3_flag )//Button 3 - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); - - if ( Book_PageBtn4_flag )//Button 4 - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); - - if ( Book_PageBtn5_flag )//Button 5 - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); - - if ( Book_PageBtn6_flag )//Button 6 - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); - - if ( BtnDown_flag ) - viewparams->CenterOnParty2(); - if ( BtnUp_flag ) - viewparams->CenterOnParty(); - if ( Book_PageBtn3_flag ) - viewparams->_443219(); - if ( Book_PageBtn4_flag ) - viewparams->_443231(); - if ( Book_PageBtn5_flag ) - viewparams->_44323D(); - if ( Book_PageBtn6_flag ) - viewparams->_443225(); - - if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag ) - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - BtnUp_flag = 0; - BtnDown_flag = 0; - Book_PageBtn6_flag = 0; - Book_PageBtn5_flag = 0; - Book_PageBtn4_flag = 0; - Book_PageBtn3_flag = 0; - DrawBook_Map_sub(97, 49, 361, 313, 0); - pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr); - map_window.uFrameWidth = game_viewport_width; - map_window.uFrameHeight = game_viewport_height; - map_window.uFrameX = game_viewport_x; - map_window.uFrameY = game_viewport_y; - map_window.uFrameZ = game_viewport_z; - map_window.uFrameW = game_viewport_w; - map_id = pMapStats->GetMapInfo(pCurrentMapName); - if ( map_id ) - map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3); - - map_window.uFrameX = 0; - sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d" - map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0); -} - -//----- (00442955) -------------------------------------------------------- -void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) -{ - int v20; // eax@16 - int v26; // ecx@21 - unsigned __int16 *v27; // edi@21 - int v28; // edx@21 - int v29; // eax@21 - double v30; // st7@23 -// signed __int64 v31; // qax@23 -// unsigned short *v32; // edx@23 - int textr_width; // esi@23 -// signed int v34; // eax@23 -// signed int v35; // ecx@23 -// int v36; // esi@27 -// int v37; // ecx@27 -// int v38; // edx@31 -// unsigned int v39; // eax@33 -// short *v40; // esi@33 -// short *v41; // edi@33 -// unsigned __int8 v42; // cf@33 -// unsigned int v43; // ecx@33 -// short *v44; // edi@33 -// short *v45; // esi@33 -// int v46; // ecx@33 - signed int v47; // esi@38 - signed int v48; // ecx@38 - int v49; // eax@38 - signed int v50; // edx@55 - unsigned int v51; // ecx@55 -// int result; // eax@72 - int v54; // esi@75 - int v55; // eax@75 -// __int16 v56; // si@85 - double v57; // st7@85 -// int v58; // ebx@85 -// signed __int64 v59; // qax@85 - signed int v60; // edi@85 -// signed __int64 v61; // qax@85 - signed int v62; // ebx@85 - signed int v63; // esi@85 - int v64; // eax@87 -// unsigned int v65; // ebx@95 -// unsigned short *v66; // edx@95 -// unsigned __int16 *v67; // esi@96 -// int v68; // edi@98 -// unsigned __int16 v69; // cx@99 -// signed int v73; // [sp-4h] [bp-48068h]@59 -// unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 - //unsigned short map_texture_16[320 * 460 + 256]; // [sp+Ch] [bp-48058h]@23 -// int v76; // [sp+4800Ch] [bp-58h]@23 - //unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 - unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 - int map_tile_X; // [sp+48020h] [bp-44h]@23 - //unsigned __int16* render16_data; - unsigned char* texture8_data; - unsigned char* curr_line; - int scale_increment; - int scaled_posX; - int scaled_posY; - int stepX_r; - int stepY_r; - unsigned int teal; // [sp+48028h] [bp-3Ch]@8 - int pCenterY; // [sp+4802Ch] [bp-38h]@1 - int screenCenter_X; // [sp+48030h] [bp-34h]@1 - int pCenterX; // [sp+48034h] [bp-30h]@1 - int v87; // [sp+48038h] [bp-2Ch]@16 - unsigned int v88; // [sp+4803Ch] [bp-28h]@16 - int black; // [sp+48040h] [bp-24h]@8 - int screenCenterY; // [sp+48044h] [bp-20h]@1 - unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16 - unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 - signed int screenWidth; // [sp+48054h] [bp-10h]@8 - unsigned int v95; // [sp+48058h] [bp-Ch]@16 - int map_tile_Y; // [sp+4805Ch] [bp-8h]@10 - const void *v97; // [sp+48060h] [bp-4h]@16 -// unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 - //int a5a; // [sp+48070h] [bp+Ch]@86 - - screenCenter_X = (signed int)(tl_x + br_x) / 2; - screenCenterY = (signed int)(tl_y + br_y) / 2; - pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); - pCenterX = viewparams->sViewCenterX; - pCenterY = viewparams->sViewCenterY; - if ( viewparams->uMapBookMapZoom != 384 ) - { - if ( viewparams->uMapBookMapZoom == 768 ) - { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - viewparams->uMapBookMapZoom = 680; - } - } - else - { - viewparams->sViewCenterX = viewparams->indoor_center_x; - pCenterX = viewparams->indoor_center_x; - pCenterY = viewparams->indoor_center_y; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34; - } - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) - { - screenWidth = br_x - tl_x + 1; - screenHeight = br_y - tl_y + 1; - //render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; - texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; - pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; - scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; - - v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - - teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16; - - textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16; - black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30); - - scaled_posY = stepY_r >> 16; - //nearest neiborhood scaling - if ( texture8_data) - { - for( uint i = 0; i < screenHeight; ++i ) - { - curr_line = &texture8_data[scaled_posY*textr_width]; - stepX_r = teal; - for( uint j = 0; j < screenWidth; ++j ) - { - scaled_posX = stepX_r>>16; - //map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; - pRenderer->WritePixel16(tl_x + j, tl_y + i, pPalette_16[*(curr_line+scaled_posX)]); - stepX_r += scale_increment; - } - stepY_r+=scale_increment; - scaled_posY=stepY_r>>16; - } - } - - /*//move visible square to render - for( uint i = 0; i < screenHeight; ++i ) - { - if ( screenWidth > 0 ) - memcpy((void*)&render16_data[pRenderer->uTargetSurfacePitch * i],(void*)&map_texture_16[i*screenWidth], screenWidth*2); - }*/ - } - else - { - black = Color16(0, 0, 0); - teal = Color16(0, 0xFFu, 0xFFu); - uNumBlueFacesInBLVMinimap = 0; - if ( pIndoor->pMapOutlines->uNumOutlines ) - { - for ( uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i ) - { - if ( !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].Invisible() - || (pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].Invisible()) )) - { - if ( !(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) ) - { - if ( !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4) - && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) )) - { - pIndoor->pMapOutlines->pOutlines[i].uFlags = pIndoor->pMapOutlines->pOutlines[i].uFlags | 1; - pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); - } - } - if ( (!(pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) - && !(!(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace1ID].uAttributes & FACE_UNKNOW4) - && !(pIndoor->pFaces[pIndoor->pMapOutlines->pOutlines[i].uFace2ID].uAttributes & FACE_UNKNOW4) )) - || pIndoor->pMapOutlines->pOutlines[i].uFlags & 1) - { - v93 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX); - screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY; - v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY; - v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX; - - v88 = fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom); - v87 = fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom); - v93 = (unsigned __int16 *)(fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)); - screenHeight = fixpoint_mul(v20, viewparams->uMapBookMapZoom); - pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87, - screenCenter_X + (fixpoint_mul((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)), screenCenterY - screenHeight, black); - } - } - } - } - if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) - { - for ( uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j ) - { - v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x; - v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX); - v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY; - v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY; - - v87 = fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom); - v88 = fixpoint_mul(v28, viewparams->uMapBookMapZoom); - uint i = fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom); - v95 = fixpoint_mul(v29, viewparams->uMapBookMapZoom); - pRenderer->RasterLine2D(screenCenter_X + (fixpoint_mul((signed int)v27, viewparams->uMapBookMapZoom)), - screenCenterY - v88, screenCenter_X + (fixpoint_mul((v26 - pCenterX), viewparams->uMapBookMapZoom)), screenCenterY - v95, teal); - } - viewparams->sViewCenterX = pCenterX; - } - } - v47 = (fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 3; - v97 = (const void *)(fixpoint_mul((pParty->vPosition.y - pCenterY), viewparams->uMapBookMapZoom)); - v48 = 1; - v49 = screenCenterY - (int)v97 - 3; - if ( v47 >= (signed int)tl_x ) - { - if ( v47 > (signed int)br_x ) - { - if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X - 6) > (signed int)br_x ) - v48 = 0; - v47 = br_x; - } - } - else - { - if ( (signed int)((fixpoint_mul((pParty->vPosition.x - viewparams->sViewCenterX), viewparams->uMapBookMapZoom)) + screenCenter_X) < (signed int)tl_x ) - v48 = 0; - v47 = tl_x; - } - if ( v49 >= (signed int)tl_y ) - { - if ( v49 > br_y ) - { - if ( screenCenterY - (signed int)v97 - 6 > br_y ) - v48 = 0; - v49 = br_y; - } - } - else - { - if ( screenCenterY - (signed int)v97 < (signed int)tl_y ) - v48 = 0; - v49 = tl_y; - } - if ( v48 == 1 ) - { - v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; - if ( (signed int)v51 <= 1920 ) - v50 = 6; - if ( (signed int)v51 < 1664 ) - v50 = 5; - if ( (signed int)v51 <= 1408 ) - v50 = 4; - if ( (signed int)v51 < 1152 ) - v50 = 3; - if ( (signed int)v51 <= 896 ) - v50 = 2; - if ( (signed int)v51 < 640 ) - v50 = 1; - if ( (signed int)v51 <= 384 ) - v50 = 0; - if ( (signed int)v51 < 128 || (signed int)v51 > 1920 ) - v50 = 7; - pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); - } - if ( (signed int)uNumLevelDecorations > 0 ) - { - for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i ) - { - if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP) - { - screenHeight = pLevelDecorations[i].vPosition.y - pCenterY; - v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX); - v54 = (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X; - v97 = (const void *)(fixpoint_mul(screenHeight, viewparams->uMapBookMapZoom)); - v55 = screenCenterY - (int)v97; - //if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z - // && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) - { - if ( viewparams->uMapBookMapZoom > 512 ) - { - pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); - pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); - pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, Color16(0xFFu, 0xFFu, 0xFFu)); - } - else - pRenderer->RasterLine2D(v54, screenCenterY - (int)v97, - (fixpoint_mul((signed int)v93, viewparams->uMapBookMapZoom)) + screenCenter_X, - screenCenterY - (int)v97, Color16(0xFFu, 0xFFu, 0xFFu)); - } - } - } - } - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - screenCenterY = br_x - tl_x + 1; - v95 = br_y - tl_y + 1; - //v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; - black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; - v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16; - teal = v60 >> 16; - pPalette_16 = (unsigned __int16 *)(v60 >> 16); - v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16); - v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16; - v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)); - - - for (int y = 0; y < (signed int)v95; ++y) - { - map_tile_Y = (v63 - 80) / 4; - v64 = teal; - for (int x = 0; x < screenCenterY; ++x) - { - map_tile_X = (v64 - 80) / 4; - if ( !pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) ) - { - if ( pOutdoor->IsMapCellPartiallyRevealed(map_tile_X, map_tile_Y) ) - { - if ( !((x + screenCenter_X) % 2) ) - //*a4a = Color16(12, 12, 12); - pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(12, 12, 12)); - } - else - //*a4a = 0; - pRenderer->WritePixel16(tl_x + x, tl_y + y, Color16(0, 0, 0)); - } - v97 = (char *)v97 + black; - v64 = (signed int)v97 >> 16; - } - - v62 += black; - v97 = (const void *)v60; - v63 = v62 >> 16; - teal = (unsigned int)pPalette_16; - } - /*a4a = map_texture_16; - for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X ) - { - if ( screenCenterY > 0 ) - { - map_tile_Y = (v63 - 80) / 4; - v64 = teal; - for ( a5a = 0; a5a < screenCenterY; ++a5a ) - { - map_tile_X = (v64 - 80) / 4; - if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) ) - { - if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) ) - { - if ( !((a5a + screenCenter_X) % 2) ) - *a4a = Color16(0xCu, 0xCu, 0xCu); - } - else - *a4a = 0; - } - ++a4a; - v97 = (char *)v97 + black; - v64 = (signed int)v97 >> 16; - } - } - v62 += black; - v97 = (const void *)v60; - a4a += screenCenterY - a5a; - v63 = v62 >> 16; - teal = (unsigned int)pPalette_16; - } - - v66 = map_texture_16; - if ( (signed int)v95 > 0 ) - { - v67 = v77; - result = 2 * (pRenderer->uTargetSurfacePitch - screenCenterY); - for ( v65 = v95; v65; --v65 ) - { - if ( screenCenterY > 0 ) - { - for ( v68 = screenCenterY; v68; --v68 ) - { - v69 = *(short *)v66; - if ( !*(short *)v66 || v69 == (short)result ) - *v67 = v69; - ++v66; - ++v67; - } - } - v67 = (unsigned __int16 *)((char *)v67 + result); - } - }*/ - } -} - -//----- (00444564) -------------------------------------------------------- -const char * GetMapBookHintText() -{ - int v20; - int v21; // [sp+14h] [bp-Ch]@1 - double v0; // st7@3 - unsigned int pX; // [sp+1Ch] [bp-4h]@3 - unsigned int pY; // [sp+8h] [bp-18h]@3 - int global_coord_X; // ebx@3 - int global_coord_Y; - int map_tile_X; // edi@3 - int map_tile_Y; // eax@3 - const char *result; // eax@15 - - v20 = viewparams->sViewCenterX; - v21 = viewparams->sViewCenterY; - if ( viewparams->uMapBookMapZoom == 384 ) - { - v20 = viewparams->indoor_center_x; - v21 = viewparams->indoor_center_y; - } - pMouse->GetClickPos(&pX, &pY); - v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789); - - global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20); - global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0); - - result = 0; - map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме) - map_tile_Y = abs(global_coord_Y - 22528) / 512; - if ( pOutdoor->IsMapCellFullyRevealed(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0 ) - { - for(int i = 0; i < pOutdoor->uNumBModels && !result; i++) - { - if ( int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X), - abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius ) - { - if ( pOutdoor->pBModels[i].uNumFaces > 0 ) - { - for( int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++ ) - { - if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID ) - { - if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & FACE_HAS_EVENT) ) - { - if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) ) - { - if ( _stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "") ) - result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID); - } - } - } - } - } - } - } - } - return result; -} \ No newline at end of file
--- a/UI/Books/UIMapBook.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ - -void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb -const char *GetMapBookHintText();//sub_444564 \ No newline at end of file
--- a/UI/Books/UINotesBooks.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,447 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include "..\..\Engine/MM7.h" -#include "..\..\Engine/Graphics/Render.h" -#include "..\..\Mouse.h" -#include "..\UIBooks.h" -#include "..\..\Engine/MapInfo.h" -#include "..\..\GUIWindow.h" -#include "..\..\GUIFont.h" -#include "..\..\Engine/Party.h" -#include "..\..\AudioPlayer.h" -#include "..\..\Engine/LOD.h" -#include "..\..\Engine/Graphics/Viewport.h" -#include "..\..\Engine/Awards.h" -#include "..\..\Engine/Autonotes.h" -#include "..\..\Engine/Tables/StorylineTextTable.h" -#include "..\..\Engine/texts.h" -#include "..\..\Engine/mm7_data.h" - -//----- (00413D3C) -------------------------------------------------------- -static const char *GetDayPart() -{ - if ( pParty->uCurrentHour > 5 && pParty->uCurrentHour < 20 ) - return pGlobalTXT_LocalizationStrings[56]; // "Day" - else if ( pParty->uCurrentHour == 5 ) - return pGlobalTXT_LocalizationStrings[55]; // "Dawn" - else if ( pParty->uCurrentHour == 20 ) - return pGlobalTXT_LocalizationStrings[566]; // "Dusk" - else - return pGlobalTXT_LocalizationStrings[567]; // "Night" -} - -//----- (00413D6F) -------------------------------------------------------- -void BookUI_Calendar_Draw() -{ - int am; // ecx@5 - char *pMapName; // eax@6 - GUIWindow calendar_window; // [sp+Ch] [bp-60h]@5 - unsigned int pMapID; // [sp+60h] [bp-Ch]@1 - unsigned int pHour; - - static unsigned int pDayMoonPhase[28] = // 4E1B18 - { - 0, 0, 0, - 1, 1, 1, 1, - 2, 2, 2, - 3, 3, 3, 3, - 4, 4, 4, - 3, 3, 3, 3, - 2, 2, 2, - 1, 1, 1, 1 - }; - - pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); - pHour = pParty->uCurrentHour; - if ( (signed int)pHour >= 12 ) - { - pHour -= 12; - if ( !pHour ) - pHour = 12; - am = 1; - } - else - am = 0; - - calendar_window.uFrameX = game_viewport_x; - calendar_window.uFrameY = game_viewport_y; - calendar_window.uFrameWidth = game_viewport_width; - calendar_window.uFrameHeight = game_viewport_height; - calendar_window.uFrameZ = game_viewport_z; - calendar_window.uFrameW = game_viewport_w; - calendar_window.DrawTitleText(pBook2Font, 0, 22, ui_book_calendar_title_color, pGlobalTXT_LocalizationStrings[186], 3); // "Time in Erathia" - - sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s", pGlobalTXT_LocalizationStrings[526], // "Time" - pHour, pParty->uCurrentMinute, aAMPMNames[am], GetDayPart()); - calendar_window.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0); - - sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[56], // "Day" - pParty->uDaysPlayed + 1, aDayNames[pParty->uDaysPlayed % 7]); - calendar_window.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0); - - sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s", pGlobalTXT_LocalizationStrings[146], // "Month" - pParty->uCurrentMonth + 1, aMonthNames[pParty->uCurrentMonth]); - calendar_window.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0); - - sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year" - calendar_window.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0); - - sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon" - calendar_window.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0); - - pMapID = pMapStats->GetMapInfo(pCurrentMapName); - if ( pMapID ) - pMapName = pMapStats->pInfos[pMapID].pName; - else - pMapName = "Unknown"; - sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], pMapName); // "Location" - calendar_window.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0); -} - -//----- (00413126) -------------------------------------------------------- -void BookUI_Questbook_Draw() -{ - int pTextHeight; // eax@19 - GUIWindow questbook_window; // [sp+Ch] [bp-54h]@9 - - pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); - if ( BtnUp_flag || !books_primary_item_per_page )//Bookmark Up(Закладка вверх) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); - - if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book )//Bookmark Down(Закладка вниз) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); - - //for title - questbook_window.uFrameWidth = game_viewport_width; - questbook_window.uFrameHeight = game_viewport_height; - questbook_window.uFrameX = game_viewport_x; - questbook_window.uFrameY = game_viewport_y; - questbook_window.uFrameZ = game_viewport_z; - questbook_window.uFrameW = game_viewport_w; - questbook_window.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests" - - //for other text - questbook_window.uFrameX = 48; - questbook_window.uFrameY = 70; - questbook_window.uFrameWidth = 360; - questbook_window.uFrameHeight = 264; - questbook_window.uFrameZ = 407; - questbook_window.uFrameW = 333; - if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Click Bookmark Down(нажатие закладки вниз) - { - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - books_primary_item_per_page += num_achieved_awards; - books_num_items_per_page[books_page_number++] = num_achieved_awards; - } - if ( BtnUp_flag && books_page_number )//Click Bookmark Up(Нажатие закладки вверх) - { - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - --books_page_number; - books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; - } - if ( !num_achieved_awards || !books_primary_item_per_page ) - { - books_page_number = 0; - books_primary_item_per_page = 0; - } - BtnDown_flag = 0; - BtnUp_flag = 0; - num_achieved_awards = 0; - for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) - { - ++num_achieved_awards; - questbook_window.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[achieved_awards[i]], 0, 0, 0); - pTextHeight = pAutonoteFont->CalcTextHeight(pQuestTable[achieved_awards[i]], &questbook_window, 1, 0); - if ( (signed int)(questbook_window.uFrameY + pTextHeight) > (signed int)questbook_window.uFrameHeight ) - break; - pRenderer->DrawTextureTransparent(100, (questbook_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); - questbook_window.uFrameY = (questbook_window.uFrameY + pTextHeight) + 24; - } -} - -//----- (0041338E) -------------------------------------------------------- -void BookUI_Autonotes_Draw() -{ - int pTextHeight; // eax@65 - bool change_flag; // [sp+10h] [bp-58h]@1 - GUIWindow autonotes_window; // [sp+14h] [bp-54h]@46 - - change_flag = false; - pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); - if ( BtnUp_flag || !books_primary_item_per_page ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); - - if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); - - if ( Book_PageBtn3_flag )//Potions_page_flag - { - if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)//press again(повторное нажатие) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); - else//press(нажатие) - { - change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - _506568_autonote_type = AUTONOTE_POTION_RECEPIE; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); - } - } - else - { - if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE)// default(по умолчанию при запуске окна) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTex_book_button3_on); - else//Potions_page not active(вкладка снадобья не активна) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 113, pTex_book_button3_off); - } - - if ( Book_PageBtn4_flag )//Fontains_page_flag - { - if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); - else - { - change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - _506568_autonote_type = AUTONOTE_STAT_HINT; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); - } - } - else - { - if ( _506568_autonote_type == AUTONOTE_STAT_HINT ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, pTex_book_button4_on); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 150, pTex_book_button4_off); - } - - if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag - { - if ( _506568_autonote_type == AUTONOTE_OBELISK) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); - else - { - change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - _506568_autonote_type = AUTONOTE_OBELISK; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); - } - } - else - { - if ( _506568_autonote_type == AUTONOTE_OBELISK) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, pTex_book_button5_on); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 188, pTex_book_button5_off); - } - - if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag - { - if ( _506568_autonote_type == AUTONOTE_SEER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); - else - { - change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - _506568_autonote_type = AUTONOTE_SEER; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); - } - } - else - { - if ( _506568_autonote_type == AUTONOTE_SEER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, pTex_book_button6_on); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 226, pTex_book_button6_off); - } - - if ( Autonotes_Misc_page_flag ) - { - if ( _506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); - else - { - change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - _506568_autonote_type = AUTONOTE_MISC; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); - } - } - else - { - if ( _506568_autonote_type == AUTONOTE_MISC) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, pTex_book_button7_on); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 263, pTex_book_button7_off); - } - - if ( Autonotes_Instructors_page_flag ) - { - if ( _506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); - else - { - change_flag = true; - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - _506568_autonote_type = AUTONOTE_TEACHER; - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); - } - } - else - { - if ( _506568_autonote_type == AUTONOTE_TEACHER) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, pTex_book_button8_on); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 302, pTex_book_button8_off); - } - - //for title - autonotes_window.uFrameWidth = game_viewport_width; - autonotes_window.uFrameHeight = game_viewport_height; - autonotes_window.uFrameX = game_viewport_x; - autonotes_window.uFrameY = game_viewport_y; - autonotes_window.uFrameZ = game_viewport_z; - autonotes_window.uFrameW = game_viewport_w; - autonotes_window.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes" - - //for other text - autonotes_window.uFrameX = 48; - autonotes_window.uFrameY = 70; - autonotes_window.uFrameWidth = 360; - autonotes_window.uFrameHeight = 264; - autonotes_window.uFrameZ = 407; - autonotes_window.uFrameW = 333; - if ( change_flag )//change bookmark(смена закладки) - { - full_num_items_in_book = 0; - books_primary_item_per_page = 0; - books_page_number = 0; - num_achieved_awards = 0; - for ( uint i = 1; i <= 195; ++i ) - { - if ( pAutonoteTxt[i].eType == _506568_autonote_type ) - { - if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, i) && (char *)pAutonoteTxt[i].pText ) - achieved_awards[num_achieved_awards++] = (AwardType)i; - } - } - full_num_items_in_book = num_achieved_awards; - } - else//not change bookmark(не меняется закладка) - { - if ( BtnDown_flag )// press Down bookmark(нажатие закладки пролистать дальше) - { - if ( num_achieved_awards + books_primary_item_per_page < full_num_items_in_book ) - { - books_num_items_per_page[books_page_number++] = num_achieved_awards; - books_primary_item_per_page = num_achieved_awards + books_primary_item_per_page; - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - } - } - if ( BtnUp_flag && books_page_number )// press Up bookmark(нажатие закладки пролистать назад) - { - --books_page_number; - books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - } - if ( !num_achieved_awards || !books_primary_item_per_page )//количество записей 0 или номер первой страницы 0 - { - books_primary_item_per_page = 0; - books_page_number = 0; - } - } - BtnUp_flag = 0; - BtnDown_flag = 0; - Book_PageBtn3_flag = 0;//Potions_page_flag - Book_PageBtn4_flag = 0;//Fontains_page_flag - Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag - Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag - Autonotes_Misc_page_flag = 0; - Autonotes_Instructors_page_flag = 0; - num_achieved_awards = 0; - for ( uint i = books_primary_item_per_page; i < full_num_items_in_book; ++i ) - { - ++num_achieved_awards; - autonotes_window.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[achieved_awards[i]].pText, 0, 0, 0); - pTextHeight = pAutonoteFont->CalcTextHeight(pAutonoteTxt[achieved_awards[i]].pText, &autonotes_window, 1, 0); - if ( (signed int)(autonotes_window.uFrameY + pTextHeight) > (signed int)autonotes_window.uFrameHeight ) - break; - pRenderer->DrawTextureTransparent(100, (autonotes_window.uFrameY + pTextHeight) + 12, pSpellBookPagesTextr_10); - autonotes_window.uFrameY = (autonotes_window.uFrameY + pTextHeight) + 24; - } -} - - //----- (00412E85) -------------------------------------------------------- -void BookUI_Journal_Draw() -{ - char *pDialogueString; // eax@21 - char* pStringOnPage; // eax@22 - GUIWindow journal_window; // [sp+8h] [bp-54h]@10 - - pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); - if ( BtnUp_flag || !books_primary_item_per_page ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); - - if ( BtnDown_flag || books_primary_item_per_page + num_achieved_awards >= full_num_items_in_book ) - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 407, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); - else - pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); - - if ( !Journal_limitation_factor[books_primary_item_per_page] )//for title - { - journal_window.uFrameWidth = game_viewport_width; - journal_window.uFrameX = game_viewport_x; - journal_window.uFrameY = game_viewport_y; - journal_window.uFrameHeight = game_viewport_height; - journal_window.uFrameZ = game_viewport_z; - journal_window.uFrameW = game_viewport_w; - if ( pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle ) - journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3); - } - - //for other text - journal_window.uFrameX = 48; - journal_window.uFrameY = 70; - journal_window.uFrameWidth = 360; - journal_window.uFrameHeight = 264; - journal_window.uFrameZ = 407; - journal_window.uFrameW = journal_window.uFrameHeight + 69; - if ( BtnDown_flag && books_primary_item_per_page + num_achieved_awards < full_num_items_in_book )//Press bookmark next page - { - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - books_primary_item_per_page += num_achieved_awards; - books_num_items_per_page[books_page_number++] = num_achieved_awards; - } - if ( BtnUp_flag && books_page_number )//Press bookmark previous page - { - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - --books_page_number; - books_primary_item_per_page -= (unsigned __int8)books_num_items_per_page[books_page_number]; - } - if ( !num_achieved_awards || books_primary_item_per_page < 1 ) - { - books_primary_item_per_page = 0; - books_page_number = 0; - } - BtnDown_flag = 0; - BtnUp_flag = 0; - num_achieved_awards = 0; - if ( achieved_awards[books_primary_item_per_page] ) - { - int index = ((int)achieved_awards[books_primary_item_per_page] - 1); - pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1, - 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]); - pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]); - journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, pStringOnPage, 0, - journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow); - ++num_achieved_awards; - } -}
--- a/UI/Books/UISpellBook.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -#define _CRT_SECURE_NO_WARNINGS -#include "..\..\Engine/MM7.h" -#include "..\..\Engine/Graphics/Render.h" -#include "..\..\Mouse.h" -#include "..\UIBooks.h" -#include "..\..\GUIWindow.h" -#include "..\..\GUIFont.h" -#include "..\..\Engine/Party.h" -#include "..\..\AudioPlayer.h" -#include "..\..\Engine/LOD.h" -#include "..\..\Engine/Graphics/Viewport.h" -#include "..\..\Engine/texts.h" -#include "..\..\Engine/mm7_data.h" - -std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak - -//----- (00411300) -------------------------------------------------------- -void LoadSpellbook(unsigned int spell_school) -{ - char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 - - byte_506550 = 0; - if ( pPlayers[uActiveCharacter]->uQuickSpell && (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 == spell_school ) - quick_spell_at_page = (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell - 11 * spell_school; - else - quick_spell_at_page = 0; - - for (uint i = 1; i <= 11; ++i) - { - if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) - { - sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); - SBPageSSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - - sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); - SBPageCSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - } - } -} - -//----- (00411597) -------------------------------------------------------- -void OnCloseBook() -{ - free(pSpellFont); - pSpellFont = nullptr; - free(pBookFont); - pBookFont = nullptr; - free(pBook2Font); - pBook2Font = nullptr; - free(pAutonoteFont); - pAutonoteFont = nullptr; - pTexture_mapbordr->Release(); - pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); - pIcons_LOD->RemoveTexturesPackFromTextureList(); - dword_506364 = 0; -} - -//----- (00412AF9) -------------------------------------------------------- -static void BookUI_Spellbook_DrawCurrentSchoolBackground() -{ - int pTexID = 0; - if ( uActiveCharacter ) - pTexID = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage; - pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[pTexID]); - pRenderer->DrawTextureIndexed(476, 450, pSBQuickSpellBtnTextr); - pRenderer->DrawTextureIndexed(561, 450, pSpellBookCloseBtnTextr); -} - -//----- (00412B58) -------------------------------------------------------- -void DrawSpellBookContent(Player *player) -{ - Texture *PendingTexture; // edi@1 - Texture *pTexture; // edx@5 - int v10; // eax@13 - unsigned int pX_coord; // esi@18 - unsigned int pY_coord; // edi@18 - Texture *pPageTexture; // eax@21 -// signed int v22; // [sp-4h] [bp-24h]@22 - POINT a2; // [sp+18h] [bp-8h]@13 - - static unsigned int texture_tab_coord1[9][2]= - {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} }; - - static unsigned int texture_tab_coord0[9][2]= - {{415, 10}, {415, 46}, {415, 83}, {415,121}, {415,158}, {416, 196}, {416, 234}, {416, 271}, {416,307} }; - - BookUI_Spellbook_DrawCurrentSchoolBackground(); - - PendingTexture = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); - pRenderer->ClearZBuffer(0, 479); - if ( (11 * player->lastOpenedSpellbookPage) || ((11 * player->lastOpenedSpellbookPage) + 11) )//??? maybe structure need fix - { - for ( uint i = 1; i <= 11; ++i ) - { - if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] ) - { - if ( SBPageSSpellsTextureList[i] != PendingTexture ) - { - if ( quick_spell_at_page == i ) - pTexture = SBPageCSpellsTextureList[i]; - else - pTexture = SBPageSSpellsTextureList[i]; - if ( pTexture->pLevelOfDetail0_prolly_alpha_mask ) - { - pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos; - pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos; - if ( pTexture->pBits & 0x200 ) - pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pTexture); - else - pRenderer->DrawTextureIndexed(pX_coord, pY_coord, pTexture); - pRenderer->DrawMaskToZBuffer(pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos, - pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos, pTexture, i); - } - } - } - } - } - - pMouse->GetCursorPos(&a2); - v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; - if ( v10 ) - { - if ( SBPageCSpellsTextureList[v10]->pLevelOfDetail0_prolly_alpha_mask ) - { - pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Xpos; - pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Ypos; - if ( SBPageCSpellsTextureList[v10]->pBits & 0x200 ) - pRenderer->DrawTextureTransparent(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); - else - pRenderer->DrawTextureIndexed(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); - } - } - //pX_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; - //pY_coord = (unsigned int)&player->pActiveSkills[PLAYER_SKILL_FIRE]; - for ( uint i = 0; i < 9; i++ ) - { - if ( player->pActiveSkills[PLAYER_SKILL_FIRE + i] ) - { - if ( player->lastOpenedSpellbookPage == i ) - { - pPageTexture = pTextures_tabs[i][1]; - pX_coord = texture_tab_coord1[i][0]; - pY_coord = texture_tab_coord1[i][1]; - } - else - { - pPageTexture = pTextures_tabs[i][0]; - pX_coord = texture_tab_coord0[i][0]; - pY_coord = texture_tab_coord0[i][1]; - } - pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pPageTexture); - } - } -} \ No newline at end of file
--- a/UI/UIArena.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,314 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS - -#include "../Engine/mm7_data.h" -#include "../Engine/Graphics/Sprites.h" - -#include "../GUIWindow.h" -#include "../GUIFont.h" -#include "../Engine/Party.h" -#include "../AudioPlayer.h" -#include "../Engine/Graphics/Outdoor.h" -#include "../Engine/LOD.h" -#include "../Engine/Objects/Actor.h" -#include "../Engine/Events.h" -#include "../Engine/Graphics/Viewport.h" -#include "../Engine/texts.h" -#include "../Engine/MM7.h" - -std::array<Vec2_int_, 20> pMonsterArenaPlacements = - {{ - Vec2_int_(1524, 8332), - Vec2_int_(2186, 8844), - Vec2_int_(3219, 9339), - Vec2_int_(4500, 9339), - Vec2_int_(5323, 9004), - Vec2_int_(0x177D, 0x2098), - Vec2_int_(0x50B, 0x1E15), - Vec2_int_(0x18FF, 0x1E15), - Vec2_int_(0x50B, 0xD69), - Vec2_int_(0x18FF, 0x1B15), - Vec2_int_(0x50B, 0x1021), - Vec2_int_(0x18FF, 0x1848), - Vec2_int_(0x50B, 0x12D7), - Vec2_int_(0x18FF, 0x15A3), - Vec2_int_(0x50B, 0x14DB), - Vec2_int_(0x18FF, 0x12D7), - Vec2_int_(0x50B, 0x1848), - Vec2_int_(0x18FF, 0x1021), - Vec2_int_(0x50B, 0x1B15), - Vec2_int_(0x18FF, 0xD69), - }} -; - -//----- (004BBCDD) -------------------------------------------------------- -void Arena_SelectionFightLevel() -{ - signed int v0; // ebp@3 - GUIButton *v5; // eax@18 - GUIButton *v6; // esi@19 - - if ( pParty->field_7B5_in_arena_quest ) - { - if ( pParty->field_7B5_in_arena_quest == -1 ) - { - uDialogueType = DIALOGUE_ARENA_ALREADY_WON; - } - else - { - v0 = 0; - for (size_t i = 0; i < uNumActors; i++ ) - { - if ( pActors[i].uAIState == Dead - || pActors[i].uAIState == Removed - || pActors[i].uAIState == Disabled - || pActors[i].uSummonerID != 0 && PID_TYPE(pActors[i].uSummonerID) == OBJECT_Player) - ++v0; - } - if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) - { - uDialogueType = DIALOGUE_ARENA_REWARD; - ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1);//Ritor1:I dont know - for ( uint i= 0; i < 4; i++ ) - pParty->pPlayers[i].SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); - pParty->PartyFindsGold(gold_transaction_amount, 0); - pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); - pParty->field_7B5_in_arena_quest = -1; - } - else - { - uDialogueType = DIALOGUE_ARENA_WELCOME; - pParty->vPosition.x = 3849; - pParty->vPosition.y = 5770; - pParty->vPosition.z = 1; - pParty->uFallStartY = 1; - pParty->sRotationY = 512; - pParty->sRotationX = 0; - pParty->uFallSpeed = 0; - pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); - } - } - } - else - { - uDialogueType = DIALOGUE_ARENA_WELCOME; - v5 = pDialogueWindow->pControlsHead; - if ( v5 ) - { - do - { - v6 = v5->pNext; - free(v5); - v5 = v6; - } - while ( v6 ); - } - pDialogueWindow->pControlsHead = 0; - pDialogueWindow->pControlsTail = 0; - pDialogueWindow->uNumControls = 0; - pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, - pGlobalTXT_LocalizationStrings[79], //Close, Закрыть - pIcons_LOD->GetTexture(uExitCancelTextureId), 0); - pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 85, 0, "", 0); - pDialogueWindow->CreateButton(480, 190, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 86, 0, "", 0); - pDialogueWindow->CreateButton(480, 220, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 87, 0, "", 0); - pDialogueWindow->CreateButton(480, 250, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 88, 0, "", 0); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); - } -} - - -//----- (004BC109) -------------------------------------------------------- -void ArenaFight() -{ - int v0; // edi@1 - char *v1; // eax@7 - int v3; // eax@10 - signed int v4; // esi@10 - signed int v6; // ebx@34 - signed int v13; // eax@49 - int v14; // esi@49 - int v15; // edx@50 - int v16; // eax@51 - signed int v17; // ecx@51 - int v18; // edx@53 - int i; // edi@55 - signed int v22; // [sp-4h] [bp-144h]@51 - __int16 v23[100]; // [sp+Ch] [bp-134h]@39 - GUIWindow window; // [sp+D4h] [bp-6Ch]@1 - __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 - int v26; // [sp+134h] [bp-Ch]@1 - int num_monsters; // [sp+13Ch] [bp-4h]@17 - - v26 = 0; - pParty->field_7B5_in_arena_quest = uDialogueType; - memcpy(&window, pDialogueWindow, sizeof(window)); - window.uFrameWidth = game_viewport_width; - window.uFrameZ = 452; - v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7;// Пожалуйста, подождите пока я вызываю существ. Удачи. - pRenderer->BeginSceneD3D(); - - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - pIndoor->Draw(); - else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - pOutdoor->Draw(); - - pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); - pRenderer->BeginScene(); - //if ( pRenderer->pRenderD3D ) - pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, - pViewport->uViewportBR_X - pViewport->uViewportTL_X, - pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, - 0x7FF); - - Texture* pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0); - - pRenderer->DrawTextureIndexed(8, 347 - v0, pTexture_591428); - v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);//Пожалуйста, подождите пока я вызываю существ. Удачи. - pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); - pRenderer->EndScene(); - pRenderer->Present(); - pParty->vPosition.x = 3849; - pParty->vPosition.y = 5770; - pParty->vPosition.z = 1; - pParty->uFallStartY = 1; - pParty->sRotationY = 512; - pParty->sRotationX = 0; - pParty->uFallSpeed = 0; - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - //v2 = pParty->pPlayers.data(); - for ( uint i = 0; i < 4; i++ ) - { - v3 = pParty->pPlayers[i].GetActualLevel(); - v4 = v26; - if ( v3 > v26 ) - { - v26 = pParty->pPlayers[i].GetActualLevel(); - v4 = pParty->pPlayers[i].GetActualLevel(); - } - //++v2; - } - //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); - if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) - { - num_monsters = v4; - v4 /= 2; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) - { - //v5 = (signed __int64)((double)v26 * 1.5); - num_monsters = (int)((double)v26 * 1.5); - v4 /= 2; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) - { - //LODWORD(v5) = 2 * v4; - num_monsters = 2 * v4; - v4 /= 2; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) - { - num_monsters = 2 * v4; - v4 /= 2; - } - if ( v4 < 1 ) - v4 = 1; - if ( v4 > 100 ) - v4 = 100; - if ( num_monsters > 100 ) - num_monsters = 100; - if ( v4 < 2 ) - v4 = 2; - if ( num_monsters < 2 ) - num_monsters = 2; - v6 = 0; - //v27 = 1; - //v7 = (char *)&pMonsterStats->pInfos[1].uLevel; - for ( uint i = 1; i <= 258; i++ ) - { - if ( pMonsterStats->pInfos[i].uAIType != 1 )//if ( v7[8] != 1 ) - { - if ( !MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8) ) //!MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) - { - //v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel; - if ( pMonsterStats->pInfos[i].uLevel >= v4 ) - { - if ( pMonsterStats->pInfos[i].uLevel <= num_monsters ) - v23[v6++] = i; - } - } - } - // ++v27; - //v7 += 88; - } - //while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); - num_monsters = 6; - if ( v6 < 6 ) - num_monsters = v6; - //v9 = 0; - if ( num_monsters > 0 ) - { - for ( uint i = 0; i < num_monsters; i++ ) - { - //v10 = rand(); - //++v9; - //v12 = __OFSUB__(v9, num_monsters); - //v11 = v9 - num_monsters < 0; - //*((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6]; - monster_ids[i] = v23[rand() % v6]; - } - //while ( v11 ^ v12 ); - } - if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) - { - v16 = rand(); - v17 = 3; - v22 = 50; - v18 = v16 % v17; - v13 = v22; - v14 = v18 + 6; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) - { - v16 = rand(); - v17 = 7; - v22 = 100; - v18 = v16 % v17; - v13 = v22; - v14 = v18 + 6; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) - { - v15 = rand() % 11; - v13 = 200; - v14 = v15 + 10; - } - else - { - if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) - { - v13 = 500; - v14 = 20; - } - //else - //{ - //v14 = v27; - //v13 = gold_transaction_amount; - //} - } - gold_transaction_amount = v26 * v13; - for ( i = 0; i < v14; ++i ) - Actor::Arena_summon_actor(monster_ids[rand() % num_monsters], pMonsterArenaPlacements[i].x, pMonsterArenaPlacements[i].y, 1); - pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); -} \ No newline at end of file
--- a/UI/UIArena.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#pragma once -#include "../Engine/VectorTypes.h" -#include <array> - - -extern std::array<Vec2_int_, 20> pMonsterArenaPlacements; - -void Arena_SelectionFightLevel(); -void ArenaFight(); \ No newline at end of file
--- a/UI/UIBooks.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "..\Engine/MM7.h" -#include "UIBooks.h" -#include "..\Engine/Graphics/Render.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\AudioPlayer.h" -#include "..\Engine/LOD.h" - -#include "..\Engine/mm7_data.h" - -//----- (00413CC6) -------------------------------------------------------- -void BookUI_Draw(WindowType book) -{ - pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); - switch (book) - { - case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; - case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; - case WINDOW_MapsBook: BookUI_Map_Draw(); break; - case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; - case WINDOW_JournalBook: BookUI_Journal_Draw(); break; - - case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; - case WINDOW_TownPortal: BookUI_DrawTownPortalMap(); break; - } -} - -//----- (0041192C) -------------------------------------------------------- -void InitializeBookTextures() -{ - pAudioPlayer->StopChannels(-1, -1); - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); - pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); - pSpellBookCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); - pSpellBookClickCloseBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); - pSBQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); - - static const char *texNames[9] = // 004E24EC - { - "SBFB00", "SBAB00", "SBWB00", "SBEB00", - "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00" - }; - - pSBClickQuickSpellBtnTextr = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); - for ( uint i = 0; i < 9; ++i ) - { - pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); - sprintf(pTmpBuf.data(), "tab%da", i + 1); - pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - sprintf(pTmpBuf.data(), "tab%db", i + 1); - pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - } -} - -//----- (00411AAA) -------------------------------------------------------- -void InitializeBookFonts() -{ - pAudioPlayer->StopChannels(-1, -1); - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->PlaySound(SOUND_OpenBook, 0, 0, -1, 0, 0, 0, 0); - pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); - pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); - pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); - pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); - pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); -} - -//----- (0041140B) -------------------------------------------------------- -void OnCloseSpellBookPage() -{ - GUIButton *pNextButton; // esi@4 - for ( uint i = 1; i <= 11; i++ ) - { - SBPageCSpellsTextureList[i]->Release(); - SBPageSSpellsTextureList[i]->Release(); - } - pIcons_LOD->SyncLoadedFilesCount(); - if ( pGUIWindow_CurrentMenu->pControlsHead ) - { - do - { - pNextButton = pGUIWindow_CurrentMenu->pControlsHead->pNext; - free(pGUIWindow_CurrentMenu->pControlsHead); - pGUIWindow_CurrentMenu->pControlsHead = pNextButton; - } - while ( pNextButton ); - } - pGUIWindow_CurrentMenu->pControlsHead = 0; - pGUIWindow_CurrentMenu->pControlsTail = 0; - pGUIWindow_CurrentMenu->uNumControls = 0; -} - -//----- (00411473) -------------------------------------------------------- -void OnCloseSpellBook() -{ - pTexture_pagemask->Release(); - pSpellBookCloseBtnTextr->Release(); - pSBQuickSpellBtnTextr->Release(); - for ( uint i = 0; i < 9; ++i ) - { - pSpellBookPagesTextr[i]->Release(); - pTextures_tabs[i][0]->Release(); - pTextures_tabs[i][1]->Release(); - } - pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); - pIcons_LOD->RemoveTexturesPackFromTextureList(); -}
--- a/UI/UIBooks.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#pragma once - - - -extern std::array<__int16, 6> pTownPortalBook_xs; -extern std::array<__int16, 6> pTownPortalBook_ys; - -extern std::array<std::array<unsigned char, 12>, 9> pSpellbookSpellIndices; // 4E2430 from pSpellbookSpellIndices[9][12] -extern std::array<unsigned int, 5> pLloydsBeaconsPreviewXs; // 004E249C -extern std::array<unsigned int, 5> pLloydsBeaconsPreviewYs; -extern std::array<unsigned int, 5> pLloydsBeacons_SomeXs; -extern std::array<unsigned int, 5> pLloydsBeacons_SomeYs; // idb \ No newline at end of file
--- a/UI/UICharacter.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2696 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include <algorithm> -#include "UICharacter.h" -#include "..\Engine/MM7.h" -#include "..\Engine/MapInfo.h" -#include "..\Engine/Game.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\GUIProgressBar.h" -#include "..\Engine/Party.h" -#include "..\AudioPlayer.h" -#include "..\Engine/Graphics/Render.h" -#include "..\Engine/LOD.h" -#include "..\Engine/Graphics/Viewport.h" -#include "..\Engine/Timer.h" -#include "..\Engine/Awards.h" -#include "..\Engine/Spells/CastSpellInfo.h" -#include "..\Engine/texts.h" -#include "..\Mouse.h" - -#include "..\Engine/mm7_data.h" - -int bRingsShownInCharScreen; // 5118E0 - -unsigned int ui_mainmenu_copyright_color; - -unsigned int ui_character_tooltip_header_default_color; -unsigned int ui_character_default_text_color; -unsigned int ui_character_skill_highlight_color; -unsigned int ui_character_header_text_color; -unsigned int ui_character_bonus_text_color; -unsigned int ui_character_bonus_text_color_neg; -unsigned int ui_character_skill_upgradeable_color; -unsigned int ui_character_skill_default_color; -unsigned int ui_character_stat_default_color; -unsigned int ui_character_stat_buffed_color; -unsigned int ui_character_stat_debuffed_color; -unsigned int ui_character_skillinfo_can_learn; -unsigned int ui_character_skillinfo_can_learn_gm; -unsigned int ui_character_skillinfo_cant_learn; -unsigned int ui_character_condition_normal_color; -unsigned int ui_character_condition_light_color; -unsigned int ui_character_condition_moderate_color; -unsigned int ui_character_condition_severe_color; -std::array<unsigned int, 6> ui_character_award_color; - -unsigned int ui_game_minimap_outline_color; -unsigned int ui_game_minimap_actor_friendly_color; -unsigned int ui_game_minimap_actor_hostile_color; -unsigned int ui_game_minimap_actor_corpse_color; -unsigned int ui_game_minimap_decoration_color_1; -unsigned int ui_game_minimap_projectile_color; -unsigned int ui_game_minimap_treasure_color; -std::array<unsigned int, 24> ui_game_character_record_playerbuff_colors; - -unsigned int ui_gamemenu_video_gamma_title_color; -unsigned int ui_gamemenu_keys_action_name_color; -unsigned int ui_gamemenu_keys_key_selection_blink_color_1; -unsigned int ui_gamemenu_keys_key_selection_blink_color_2; -unsigned int ui_gamemenu_keys_key_default_color; - -unsigned int ui_book_quests_title_color; -unsigned int ui_book_quests_text_color; -unsigned int ui_book_autonotes_title_color; -unsigned int ui_book_autonotes_text_color; -unsigned int ui_book_map_title_color; -unsigned int ui_book_map_coordinates_color; - -unsigned int ui_book_calendar_title_color; -unsigned int ui_book_calendar_time_color; -unsigned int ui_book_calendar_day_color; -unsigned int ui_book_calendar_month_color; -unsigned int ui_book_calendar_year_color; -unsigned int ui_book_calendar_moon_color; -unsigned int ui_book_calendar_location_color; - -unsigned int ui_book_journal_title_color; -unsigned int ui_book_journal_text_color; -unsigned int ui_book_journal_text_shadow; - -unsigned int ui_game_dialogue_npc_name_color; -unsigned int ui_game_dialogue_option_highlight_color; -unsigned int ui_game_dialogue_option_normal_color; - -unsigned int ui_house_player_cant_interact_color; - - -void set_default_ui_skin() -{ - ui_mainmenu_copyright_color = Color16(255, 255, 255); - - ui_character_tooltip_header_default_color = Color16(255, 255, 155); - ui_character_default_text_color = Color16(255, 255, 255); - ui_character_header_text_color = Color16(255, 255, 155); - ui_character_bonus_text_color = Color16(0, 255, 0); - ui_character_bonus_text_color_neg = Color16(255, 0, 0); - - ui_character_skill_upgradeable_color = Color16(0, 175, 255); - ui_character_skill_default_color = Color16(255, 0, 0); - ui_character_skill_highlight_color = Color16(255, 0, 0); - - ui_character_stat_default_color = Color16(255, 255, 255); - ui_character_stat_buffed_color = Color16(0, 255, 0); - ui_character_stat_debuffed_color = Color16(255, 35, 0); - - ui_character_skillinfo_can_learn = Color16(255, 255, 255); - ui_character_skillinfo_can_learn_gm = Color16(255, 255, 0); - ui_character_skillinfo_cant_learn = Color16(255, 0, 0); - - ui_character_condition_normal_color = Color16(255, 255, 255); - ui_character_condition_light_color = Color16(0, 255, 0); - ui_character_condition_moderate_color = Color16(225, 205, 35); - ui_character_condition_severe_color = Color16(255, 35, 0); - - ui_character_award_color[0] = Color16(248, 108, 160); - ui_character_award_color[1] = Color16(112, 220, 248); - ui_character_award_color[2] = Color16(192, 192, 240); - ui_character_award_color[3] = Color16( 64, 244, 96); - ui_character_award_color[4] = Color16(232, 244, 96); - ui_character_award_color[5] = Color16(240, 252, 192); - - ui_game_minimap_outline_color = Color16(0, 0, 255); - ui_game_minimap_actor_friendly_color = Color16(0, 255, 0); - ui_game_minimap_actor_hostile_color = Color16(255, 0, 0); - ui_game_minimap_actor_corpse_color = Color16(255, 255, 0); - ui_game_minimap_decoration_color_1 = Color16(255, 255, 255); - ui_game_minimap_projectile_color = Color16(255, 0, 0); - ui_game_minimap_treasure_color = Color16(0, 0, 255); - - ui_game_character_record_playerbuff_colors[0] = Color16(150, 212, 255); - ui_game_character_record_playerbuff_colors[1] = Color16(225, 225, 225); - ui_game_character_record_playerbuff_colors[2] = Color16(255, 128, 0); - ui_game_character_record_playerbuff_colors[3] = Color16(128, 128, 128); - ui_game_character_record_playerbuff_colors[4] = Color16(225, 225, 225); - ui_game_character_record_playerbuff_colors[5] = Color16(255, 85, 0); - ui_game_character_record_playerbuff_colors[6] = Color16(255, 128, 0); - ui_game_character_record_playerbuff_colors[7] = Color16(255, 85, 0); - ui_game_character_record_playerbuff_colors[8] = Color16(225, 225, 225); - ui_game_character_record_playerbuff_colors[9] = Color16(235, 15, 255); - ui_game_character_record_playerbuff_colors[10] = Color16(192, 192, 240); - ui_game_character_record_playerbuff_colors[11] = Color16(225, 225, 225); - ui_game_character_record_playerbuff_colors[12] = Color16(255, 128, 0); - ui_game_character_record_playerbuff_colors[13] = Color16(150, 212, 255); - ui_game_character_record_playerbuff_colors[14] = Color16(128, 128, 128); - ui_game_character_record_playerbuff_colors[15] = Color16(255, 255, 155); - ui_game_character_record_playerbuff_colors[16] = Color16(255, 255, 155); - ui_game_character_record_playerbuff_colors[17] = Color16(255, 255, 155); - ui_game_character_record_playerbuff_colors[18] = Color16(255, 255, 155); - ui_game_character_record_playerbuff_colors[19] = Color16(255, 255, 155); - ui_game_character_record_playerbuff_colors[20] = Color16(255, 255, 155); - ui_game_character_record_playerbuff_colors[21] = Color16(255, 255, 155); - ui_game_character_record_playerbuff_colors[22] = Color16(0, 128, 255); - ui_game_character_record_playerbuff_colors[23] = Color16(0, 128, 255); - - ui_gamemenu_video_gamma_title_color = Color16(255, 255, 155); - ui_gamemenu_keys_action_name_color = Color16(255, 255, 255); - ui_gamemenu_keys_key_selection_blink_color_1 = Color16(50, 0, 0); - ui_gamemenu_keys_key_selection_blink_color_2 = Color16(225, 205, 35); - ui_gamemenu_keys_key_default_color = Color16(255, 255, 255); - - ui_book_quests_title_color = Color16(255, 255, 255); - ui_book_quests_text_color = Color16(255, 255, 255); - ui_book_autonotes_title_color = Color16(255, 255, 255); - ui_book_autonotes_text_color = Color16(255, 255, 255); - ui_book_map_title_color = Color16(255, 255, 255); - ui_book_map_coordinates_color = Color16(255, 255, 255); - - ui_book_calendar_title_color = Color16(255, 255, 255); - ui_book_calendar_time_color = Color16(75, 75, 75); - ui_book_calendar_day_color = Color16(75, 75, 75); - ui_book_calendar_month_color = Color16(75, 75, 75); - ui_book_calendar_year_color = Color16(75, 75, 75); - ui_book_calendar_moon_color = Color16(75, 75, 75); - ui_book_calendar_location_color = Color16(75, 75, 75); - - ui_book_journal_title_color = Color16(255, 255, 255); - ui_book_journal_text_color = Color16(255, 255, 255); - ui_book_journal_text_shadow = Color16(0, 0, 0); - - ui_game_dialogue_npc_name_color = Color16(21, 153, 233); - ui_game_dialogue_option_highlight_color = Color16(225, 205, 35); - ui_game_dialogue_option_normal_color = Color16(255, 255, 255); - - ui_house_player_cant_interact_color = Color16(255, 255, 155); -} - -std::array<unsigned int, 16> papredoll_dbrds; -unsigned int papredoll_drhs[4]; -unsigned int papredoll_dlhus[4]; -unsigned int papredoll_dlhs[4]; -unsigned int papredoll_dbods[5]; -int paperdoll_armor_texture[4][17][3];//0x511294 -//int paperdoll_array_51132C[165]; -unsigned int papredoll_dlaus[5]; -unsigned int papredoll_dlads[4]; -int papredoll_flying_feet[22]; // 005115E0 -int paperdoll_boots_texture[4][6];//511638 -int paperdoll_cloak_collar_texture[4][10]; // weak -int paperdoll_cloak_texture[4][10]; -int paperdoll_helm_texture[2][16]; //511698 -int paperdoll_belt_texture[4][7]; //511718 - -const int paperdoll_Weapon[4][16][2] = {//4E4C30 - {{128, 205}, {30, 144}, {88, 85}, {0, 0}, {0, 0}, {0, 0}, {17, 104}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, - {{131, 201}, {38, 158}, {98, 87}, {0, 0}, {0, 0}, {0, 0}, {21, 100}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, - {{131, 216}, {29, 186}, {88, 119}, {0, 0}, {0, 0}, {0, 0}, { 0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, - {{123, 216}, {35, 184}, {98, 119}, {0, 0}, {0, 0}, {0, 0}, { 0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, - }; - -const int paperdoll_Boot[4][7][2] = //4E5490 - { - 0xE, 0x11D, 0xD, 0x11D, 0xC, 0x10A, 0xA, 0xFF, 0xD, 0xF9, 0xD, 0x137, 0xC, 0x10E, - 0x14, 0x125, 0x13, 0x122, 0x15, 0x120, 0x15, 0x114, 0x13, 0x10A, 0x11, 0x13E, 0x11, 0x116, - 0x1D, 0x121, 0x1C, 0x11F, 0x1B, 0x11B, 0x1C, 0x117, 0x16, 0x116, 0x1B, 0x137, 0x1B, 0x11B, - 0x1F, 0x127, 0x1F, 0x122, 0x1B, 0x11B, 0x1D, 0x117, 0x1D, 0x116, 0x1D, 0x137, 0x1B, 0x11F, - }; -const int paperdoll_Cloak[4][10][2] = //4E5570 - { - 0x11, 0x68, 0xF, 0x68, 0x14, 0x71, 0x19, 0x6B, 0x21, 0x6F, 0x5, 0x68, 0x5, 0x68, 0x14, 0x71, 0x3, 0x6B, 0xF, 0x6F, - 0x15, 0x64, 0xB, 0x6B, 0xE, 0x67, 0x15, 0x6B, 0x1B, 0x6F, 0x3, 0x6B, 0, 0x6B, 0xE, 0x67, 0, 0x6B, 0x3, 0x6F, - 0x10, 0x8A, 0x9, 0x8B, 0x18, 0x98, 0x25, 0x91, 0x29, 0x90, 0x8, 0x8A, 0x9, 0x8B, 0x18, 0x98, 0x3, 0x91, 0x3, 0x90, - 0x14, 0x92, 0x10, 0x92, 0x15, 0x98, 0x1F, 0x91, 0x22, 0x90, 0x8, 0x92, 0xC, 0x92, 0x15, 0x98, 0x3, 0x91, 0x3, 0x90, - }; -const int paperdoll_CloakCollar[4][10][2] = //4E56B0 - { - 0x11, 0x68, 0x34, 0x64, 0x21, 0x69, 0x1D, 0x67, 0x20, 0x67, 0x21, 0x68, 0x34, 0x64, 0x21, 0x69, 0x1D, 0x67, 0x1F, 0x67, - 0x13, 0x64, 0x35, 0x66, 0x29, 0x68, 0x1F, 0x68, 0x1F, 0x6A, 0x21, 0x6A, 0x2B, 0x66, 0x26, 0x68, 0x1F, 0x68, 0x1F, 0x6A, - 0, 0, 0x30, 0x87, 0x1E, 0x86, 0x1B, 0x86, 0x1C, 0x8A, 0x21, 0x87, 0x30, 0x87, 0x1E, 0x86, 0x1B, 0x86, 0x1C, 0x8A, - 0, 0, 0x38, 0x8A, 0x24, 0x8B, 0x1D, 0x8B, 0x21, 0x8C, 0x27, 0x8A, 0x34, 0x8A, 0x24, 0x8B, 0x25, 0x8B, 0x21, 0x8C, - }; -//int dword_4E56B4; // weak -const int paperdoll_Belt[4][7][2] = //4E57F0 - { - 0x3A, 0xB6, 0x37, 0xB2, 0x34, 0xB9, 0x3A, 0xB9, 0x37, 0xB7, 0x38, 0xAC, 0x37, 0xB7, - 0x3E, 0xAD, 0x3A, 0xAC, 0x37, 0xB0, 0x3A, 0xB1, 0x39, 0xB0, 0x3C, 0xA5, 0x39, 0xB0, - 0x3B, 0xD5, 0x37, 0xD2, 0x31, 0xD5, 0x39, 0xD6, 0x37, 0xD8, 0x37, 0xD1, 0x37, 0xD8, - 0x42, 0xD2, 0x3F, 0xD0, 0x3B, 0xD7, 0x3C, 0xD5, 0x3B, 0xD6, 0x3E, 0xCF, 0x36, 0xD6, - }; -const int paperdoll_Helm[4][16][2] = //4E58D0 - { - 0x3E, 0x1F, 0x41, 0x2C, 0x37, 0x2F, 0x31, 0x32, 0x37, 0x2A, 0x39, 0x28, 0x36, 0x34, 0x41, 0x38, 0x40, 0x31, 0x40, 0x21, 0x40, 0x31, 0x3C, 0x33, 0x3D, 0x24, 0x3A, 0x1A, 0x37, 0x2A, 0x41, 0x48, - 0x41, 0x1E, 0x42, 0x2B, 0x37, 0x2F, 0x34, 0x30, 0x39, 0x29, 0x3A, 0x26, 0x36, 0x34, 0x41, 0x37, 0x42, 0x32, 0x40, 0x21, 0x40, 0x31, 0x40, 0x2F, 0x3E, 0x22, 0x3B, 0x1A, 0x39, 0x29, 0x42, 0x47, - 0x3F, 0x47, 0x41, 0x56, 0x37, 0x59, 0x32, 0x5E, 0x37, 0x58, 0x39, 0x54, 0x34, 0x61, 0x40, 0x61, 0x41, 0x5D, 0x3E, 0x4F, 0x3E, 0x5B, 0x3D, 0x5B, 0x3F, 0x4C, 0x3B, 0x45, 0x37, 0x58, 0x41, 0x74, - 0x45, 0x45, 0x46, 0x54, 0x3A, 0x55, 0x38, 0x58, 0x3C, 0x54, 0x3F, 0x52, 0x39, 0x5B, 0x45, 0x5C, 0x47, 0x5C, 0x44, 0x4B, 0x44, 0x57, 0x43, 0x55, 0x44, 0x4A, 0x3E, 0x45, 0x3C, 0x54, 0x47, 0x70, - }; -const int pPaperdoll_Beards[4] = //4E5AD0 - { - 52, 130, 56, 136, - }; -const int pPaperdoll_LeftHand[4][2] = //4E5AE0 - { - 0x67, 0x6A, - 0x65, 0x6C, - 0x74, 0x8D, - 0x74, 0x93, - }; -const int pPaperdoll_SecondLeftHand[4][2] = //4E5B00 - { - 0x1A, 0x6B, - 0x28, 0x6D, - 0x19, 0x8D, - 0x20, 0x92, - }; -const int pPaperdoll_RightHand[4][2] = //4E5B20 - { - 0x1E, 0x90, - 0x22, 0x9E, - 0x19, 0xBA, - 0x1F, 0xB8, - }; -const int pPaperdollLeftEmptyHand[4][2] = //4E5B40 - { - 0x80, 0xCD, - 0x83, 0xC9, - 0x83, 0xD8, - 0x7B, 0xD8, - }; - -int pPaperdoll_BodyX = 481; // 004E4C28 -int pPaperdoll_BodyY = 0; // 004E4C2C -const int paperdoll_Armor_Coord[4][17][2] = //4E4E30 - { - // X Y - 0x2C, 0x67, 0x30, 0x69, 0x2D, 0x67, 0x2C, 0x64, 0x14, 0x66, 0x22, 0x67, 0x20, 0x66, 0x25, 0x66, 0x12, 0x66,//Human - 0x0A, 0x66, 0x13, 0x64, 0x0E, 0x64, 0x0A, 0x63, 0x14, 0x66, 0x0A, 0x63, 0x0A, 0x66, 0x25, 0x66, - - 0x32, 0x68, 0x32, 0x69, 0x35, 0x69, 0x33, 0x68, 0x24, 0x67, 0x30, 0x69, 0x33, 0x68, 0x31, 0x69, 0x19, 0x69, - 0x19, 0x6A, 0x16, 0x66, 0x16, 0x65, 0x0F, 0x6B, 0x24, 0x67, 0x0F, 0x6B, 0x19, 0x6A, 0x31, 0x69, - - 0x2A, 0x8C, 0x29, 0x8C, 0x2A, 0x89, 0x29, 0x86, 0x12, 0x87, 0x2D, 0x89, 0x2A, 0x88, 0x25, 0x87, 0x12, 0x8B, - 0x12, 0x8B, 0x11, 0x8A, 0x15, 0x87, 0x09, 0x89, 0x12, 0x87, 0x09, 0x89, 0x12, 0x8B, 0x25, 0x87, - - 0x33, 0x90, 0x32, 0x90, 0x34, 0x91, 0x32, 0x8E, 0x21, 0x8B, 0x31, 0x8B, 0x33, 0x8E, 0x2F, 0x8F, 0x16, 0x8D, - 0x18, 0x8C, 0x19, 0x8C, 0x1B, 0x8E, 0x0C, 0x8C, 0x21, 0x8B, 0x0C, 0x8C, 0x18, 0x8C, 0x2F, 0x8F, - }; -const int paperdoll_shoulder_coord[4][17][2] = //4E5050 - { - 0x64, 0x67, 0x61, 0x67, 0x65, 0x68, 0x6E, 0x74, 0x6C, 0x68, 0x61, 0x67, 0x66, 0x68, 0x6C, 0x6A, 0x6E, 0x6D, - 0x67, 0x69, 0x70, 0x67, 0x6E, 0x6D, 0x6C, 0x6F, 0x6C, 0x68, 0x6C, 0x6F, 0x67, 0x69, 0x6C, 0x6A, - - 0x60, 0x6B, 0x60, 0x6C, 0x60, 0x6B, 0x61, 0x6A, 0x60, 0x69, 0x60, 0x6A, 0x60, 0x6A, 0x61, 0x69, 0x63, 0x6A, - 0x64, 0x6A, 0x61, 0x66, 0x66, 0x67, 0x64, 0x6C, 0x60, 0x69, 0x64, 0x6C, 0x64, 0x6A, 0x61, 0x69, - - 0x6D, 0x8C, 0x75, 0x8C, 0, 0, 0x72, 0x8D, 0x6A, 0x89, 0, 0, 0x73, 0x8C, 0x69, 0x8C, 0x6E, 0x8D, - 0x71, 0x8D, 0x70, 0x8D, 0x72, 0x8D, 0x74, 0x8E, 0x6A, 0x89, 0x74, 0x8E, 0x71, 0x8D, 0x69, 0x8C, - - 0x72, 0x91, 0x72, 0x91, 0, 0, 0x6E, 0x92, 0x6F, 0x91, 0, 0, 0, 0, 0x6E, 0x91, 0x71, 0x90, - 0x72, 0x8D, 0x72, 0x90, 0x73, 0x93, 0x73, 0x90, 0x6F, 0x91, 0x73, 0x90, 0x72, 0x8D, 0x6E, 0x91, - }; -const int paperdoll_shoulder_second_coord[4][17][2] = //dword_4E5270 - { - 0, 0, 0x61, 0x67, 0, 0, 0x64, 0x69, 0x64, 0x68, 0, 0, 0, 0, 0x5E, 0x66, 0x5F, 0x69, - 0x55, 0x69, 0x5F, 0x67, 0x5F, 0x68, 0x32, 0x69, 0x64, 0x68, 0x32, 0x69, 0x55, 0x69, 0x5E, 0x66, - - 0, 0, 0x60, 0x6C, 0, 0, 0x60, 0x6C, 0x5E, 0x69, 0, 0, 0, 0, 0x5D, 0x6A, 0x5B, 0x6A, - 0x5B, 0x6A, 0x59, 0x69, 0x56, 0x68, 0x38, 0x6E, 0x5E, 0x69, 0x38, 0x6E, 0x5B, 0x6A, 0x5D, 0x6A, - - 0, 0, 0x75, 0x8C, 0, 0, 0x72, 0x8D, 0x62, 0x89, 0, 0, 0, 0, 0x69, 0x8C, 0x5E, 0x8D, - 0x61, 0x8D, 0x5F, 0x8D, 0x60, 0x8D, 0x2E, 0x8C, 0x62, 0x89, 0x2E, 0x8C, 0x61, 0x8D, 0x69, 0x8C, - - 0, 0, 0x72, 0x91, 0, 0, 0x72, 0x91, 0x67, 0x8F, 0, 0, 0, 0, 0x6E, 0x91, 0x64, 0x93, - 0x65, 0x8C, 0x65, 0x91, 0x67, 0x91, 0x36, 0x90, 0x67, 0x8F, 0x36, 0x90, 0x65, 0x8C, 0x6E, 0x91, - }; - -const char *dlad_texnames_by_face[25] = - { - "pc01lad", "pc02lad", "pc03lad", "pc04lad", "pc05lad", "pc06lad", - "pc07lad", "pc08lad", "pc09lad", "pc10lad", "pc11lad", "pc12lad", - "pc13lad", "pc14lad", "pc15lad", "pc16lad", "pc17lad", "pc18lad", - "pc19lad", "pc20lad", "pc21lad", "pc22lad", "pc23lad", "pc24lad", - "pc25lad" - }; -const char *dlau_texnames_by_face[25] = - { - "pc01lau", "pc02lau", "pc03lau", "pc04lau", "pc05lau", "pc06lau", - "pc07lau", "pc08lau", "pc09lau", "pc10lau", "pc11lau", "pc12lau", - "pc13lau", "pc14lau", "pc15lau", "pc16lau", "pc17lau", "pc18lau", - "pc19lau", "pc20lau", "pc21lau", "pc22lau", "pc23lau", "pc24lau", - "pc25lau" - }; -const char *dbod_texnames_by_face[25] = - { - "pc01bod", "pc02bod", "pc03bod", "pc04bod", "pc05bod", "pc06bod", - "pc07bod", "pc08bod", "pc09bod", "pc10bod", "pc11bod", "pc12bod", - "pc13bod", "pc14bod", "pc15bod", "pc16bod", "pc17bod", "pc18bod", - "pc19bod", "pc20bod", "pc21bod", "pc22bod", "pc23bod", "pc24bod", - "pc25bod" - }; -const char *drh_texnames_by_face[25] = - { - - "pc01rh", "pc02rh", "pc03rh", "pc04rh", "pc05rh", "pc06rh", - "pc07rh", "pc08rh", "pc09rh", "pc10rh", "pc11rh", "pc12rh", - "pc13rh", "pc14rh", "pc15rh", "pc16rh", "pc17rh", "pc18rh", - "pc19rh", "pc20rh", "pc21rh", "pc22rh", "pc23rh", "pc24rh", - "pc25rh" - }; -const char *dlh_texnames_by_face[25] = - { - "pc01lh", "pc02lh", "pc03lh", "pc04lh", "pc05lh", "pc06lh", - "pc07lh", "pc08lh", "pc09lh", "pc10lh", "pc11lh", "pc12lh", - "pc13lh", "pc14lh", "pc15lh", "pc16lh", "pc17lh", "pc18lh", - "pc19lh", "pc20lh", "pc21lh", "pc22lh", "pc23lh", "pc24lh", - "pc25lh" - }; -const char *dlhu_texnames_by_face[25] = - { - "pc01lhu", "pc02lhu", "pc03lhu", "pc04lhu", "pc05lhu", "pc06lhu", - "pc07lhu", "pc08lhu", "pc09lhu", "pc10lhu", "pc11lhu", "pc12lhu", - "pc13lhu", "pc14lhu", "pc15lhu", "pc16lhu", "pc17lhu", "pc18lhu", - "pc19lhu", "pc20lhu", "pc21lhu", "pc22lhu", "pc23lhu", "pc24lhu", - "pc25lhu" - }; - -const int pArmorSkills[5] = {PLAYER_SKILL_LEATHER, PLAYER_SKILL_CHAIN, PLAYER_SKILL_PLATE, PLAYER_SKILL_SHIELD, PLAYER_SKILL_DODGE}; -const int pWeaponSkills[9] = {PLAYER_SKILL_AXE, PLAYER_SKILL_BOW, PLAYER_SKILL_DAGGER, PLAYER_SKILL_MACE, PLAYER_SKILL_SPEAR, - PLAYER_SKILL_STAFF, PLAYER_SKILL_SWORD, PLAYER_SKILL_UNARMED, PLAYER_SKILL_BLASTER}; -const int pMiscSkills[12] = {PLAYER_SKILL_ALCHEMY, PLAYER_SKILL_ARMSMASTER, PLAYER_SKILL_BODYBUILDING, PLAYER_SKILL_ITEM_ID, PLAYER_SKILL_MONSTER_ID, - PLAYER_SKILL_LEARNING, PLAYER_SKILL_TRAP_DISARM, PLAYER_SKILL_MEDITATION, PLAYER_SKILL_MERCHANT, PLAYER_SKILL_PERCEPTION, - PLAYER_SKILL_REPAIR, PLAYER_SKILL_STEALING}; -const int pMagicSkills[9] = {PLAYER_SKILL_FIRE, PLAYER_SKILL_AIR, PLAYER_SKILL_WATER, PLAYER_SKILL_EARTH, PLAYER_SKILL_SPIRIT, - PLAYER_SKILL_MIND, PLAYER_SKILL_BODY, PLAYER_SKILL_LIGHT, PLAYER_SKILL_DARK}; - -//----- (00421626) -------------------------------------------------------- -GUIWindow *CharacterUI_Initialize(unsigned int _this) -{ - GUIWindow *pWindow; // edi@3 - - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - - pEventTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - bRingsShownInCharScreen = false; - CharacterUI_LoadPaperdollTextures(); - pCurrentScreen = _this; - - pWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_CharacterRecord, uActiveCharacter, 0); - pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight, - 1, 0, UIMSG_ClickStatsBtn, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats - pIcons_LOD->GetTexture(papredoll_dbrds[10]), - pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0); - pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight, - 1, 0, UIMSG_ClickSkillsBtn, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills - pIcons_LOD->GetTexture(papredoll_dbrds[8]), - pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0); - pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight, - 1, 0, UIMSG_ClickInventoryBtn, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory - pIcons_LOD->GetTexture(papredoll_dbrds[6]), - pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0); - pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight, - 1, 0, UIMSG_ClickAwardsBtn, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards - pIcons_LOD->GetTexture(papredoll_dbrds[4]), - pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0); - pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight, - 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit - pIcons_LOD->GetTexture(papredoll_dbrds[2]), - pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); - pWindow->CreateButton(0, 0, 476, 345, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); - pCharacterScreen_DetalizBtn = pWindow->CreateButton(600, 300, 30, 30, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); - pCharacterScreen_DollBtn = pWindow->CreateButton(476, 0, 164, 345, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); - - pWindow->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - - pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); - FillAwardsData(); - return pWindow; -} - -//----- (004219BE) -------------------------------------------------------- -GUIWindow *CastSpellInfo::GetCastSpellInInventoryWindow() -{ - GUIWindow *CS_inventory_window; // ebx@1 - - pEventTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - bRingsShownInCharScreen = 0; - CharacterUI_LoadPaperdollTextures(); - pCurrentScreen = SCREEN_CASTING; - CS_inventory_window = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_CastSpell_InInventory, (int)this, 0); - pCharacterScreen_ExitBtn = CS_inventory_window->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, - pGlobalTXT_LocalizationStrings[79], // Close - pIcons_LOD->GetTexture(papredoll_dbrds[2]), - pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); - CS_inventory_window->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); - pCharacterScreen_DollBtn = CS_inventory_window->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); - - CS_inventory_window->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - CS_inventory_window->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - CS_inventory_window->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - CS_inventory_window->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - - return CS_inventory_window; -} - -static int CharacterUI_SkillsTab_Draw__DrawSkillTable(Player *player, int x, int y, const int *skill_list, int skill_list_size, int right_margin, const char *skill_group_name) -{ - int y_offset = y; - - sprintf(pTmpBuf.data(), "%s\r%03d%s", skill_group_name, right_margin, pGlobalTXT_LocalizationStrings[131]); //"Level" - pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf.data(), 0, 0, 0); - - int num_skills_drawn = 0; - for (int i = 0; i < skill_list_size; ++i) - { - PLAYER_SKILL_TYPE skill = (PLAYER_SKILL_TYPE)skill_list[i]; - for (uint j = 0; j < pGUIWindow_CurrentMenu->uNumControls; ++j) - { - GUIButton* v8 = pGUIWindow_CurrentMenu->pControlsHead; - - for (int v7 = j; v7 > 0; --v7) - v8 = v8->pNext; - - int v9 = v8->field_1C; - if ((short)(v8->field_1C) >= 0) - continue; - if ( (v9 & 0x7FFF) != skill ) - continue; - - ++num_skills_drawn; - y_offset = v8->uY; - - ushort skill_value = player->pActiveSkills[skill]; - int skill_level = skill_value & 0x3F; - - uint skill_color = 0; - uint skill_mastery_color = 0; - if (player->uSkillPoints > skill_level) - skill_color = ui_character_skill_upgradeable_color; - - if (pGUIWindow_CurrentMenu->pCurrentPosActiveItem == j) - { - if (player->uSkillPoints > skill_level) - skill_mastery_color = ui_character_bonus_text_color; - else - skill_mastery_color = ui_character_skill_default_color; - skill_color = skill_mastery_color; - } - - if (SkillToMastery(skill_value) == 1) - { - sprintfex(pTmpBuf.data(), "%s\r%03d%2d", pSkillNames[skill], right_margin, skill_level); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0); - } - else - { - const char *skill_level_str = nullptr; - - switch (SkillToMastery(skill_value)) - { - case 4: skill_level_str = pGlobalTXT_LocalizationStrings[96]; break; // "Grand" - case 3: skill_level_str = pGlobalTXT_LocalizationStrings[432]; break; // Master - case 2: skill_level_str = pGlobalTXT_LocalizationStrings[433]; break; // Expert - } - - if (!skill_mastery_color) - skill_mastery_color = ui_character_header_text_color; - sprintfex(pTmpBuf.data(), "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, skill_level_str, skill_color, right_margin, skill_level); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0); - } - } - } - - if (!num_skills_drawn) - { - y_offset += LOBYTE(pFontLucida->uFontHeight) - 3; - pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, y_offset, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); //"None" - } - - return y_offset; -} - -//----- (00419719) -------------------------------------------------------- -void CharacterUI_SkillsTab_Draw(Player *player) -{ - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_skill", TEXTURE_16BIT_PALETTE)); - - sprintfex(pTmpBuf.data(), "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000", - pGlobalTXT_LocalizationStrings[206], // Skills for - ui_character_header_text_color, - player->pName, - pGlobalTXT_LocalizationStrings[207], // Skill Points - player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, - player->uSkillPoints); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); - - int y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; - y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pWeaponSkills, 9, 400, pGlobalTXT_LocalizationStrings[242]); // "Weapons" - - y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10; - CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pMagicSkills, 9, 400, pGlobalTXT_LocalizationStrings[138]); // "Magic" - - y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; - y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pArmorSkills, 5, 177, pGlobalTXT_LocalizationStrings[11]); // "Armor" - - y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10; - y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pMiscSkills, 12, 177, pGlobalTXT_LocalizationStrings[143]); //"Misc" -} - -//----- (0041A000) -------------------------------------------------------- -void CharacterUI_AwardsTab_Draw(Player *player) -{ - int items_per_page; // eax@1 - char *v6; // ebx@15 - char Source[100]; // [sp+Ch] [bp-C4h]@1 - GUIWindow awards_window; // [sp+70h] [bp-60h]@1 - - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE)); - sprintfex(pTmpBuf.data(), "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color); - sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]); - strcat(pTmpBuf.data(), Source); - strcat(pTmpBuf.data(), "\f00000"); - - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); - items_per_page = books_primary_item_per_page; - awards_window.uFrameX = 12; - awards_window.uFrameY = 48; - awards_window.uFrameWidth = 424; - awards_window.uFrameHeight = 290; - awards_window.uFrameZ = 435; - awards_window.uFrameW = 337; - if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book) - items_per_page = books_primary_item_per_page++ + 1; - if (BtnUp_flag && items_per_page) - { - --items_per_page; - books_primary_item_per_page = items_per_page; - } - - if ( books_page_number < 0 ) - { - items_per_page += num_achieved_awards; - books_primary_item_per_page = items_per_page; - if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book ) - { - items_per_page = full_num_items_in_book - num_achieved_awards; - books_primary_item_per_page = items_per_page; - } - } - else if ( books_page_number > 0 ) - { - items_per_page -= num_achieved_awards; - books_primary_item_per_page = items_per_page; - if ( items_per_page < 0 ) - { - items_per_page = 0; - books_primary_item_per_page = items_per_page; - } - } - BtnDown_flag = 0; - BtnUp_flag = 0; - num_achieved_awards = 0; - books_page_number = 0; - - for ( int i = items_per_page; i < full_num_items_in_book; ++i) - { - v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4]; - pTmpBuf[0] = 0; - switch (achieved_awards[i]) - { - case Award_Arena_PageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaPageWins); break; - case Award_Arena_SquireWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaSquireWins); break; - case Award_Arena_KnightWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaKnightWins); break; - case Award_Arena_LordWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArenaLordWins); break; - case Award_ArcomageWins: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageWins); break; - case Award_ArcomageLoses: sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageLoses); break; - case Award_Deaths: sprintf(pTmpBuf.data(), v6, pParty->uNumDeaths); break; - case Award_BountiesCollected: sprintf(pTmpBuf.data(), v6, pParty->uNumBountiesCollected); break; - case Award_Fine: sprintf(pTmpBuf.data(), v6, pParty->uFine); break; - case Award_PrisonTerms: sprintf(pTmpBuf.data(), v6, pParty->uNumPrisonTerms); break; - } - - if (*pTmpBuf.data()) - v6 = pTmpBuf.data(); - - awards_window.DrawText(pFontArrus, 0, 0, ui_character_award_color[pAwards[achieved_awards[i]].uPriority % 6], v6, 0, 0, 0); - awards_window.uFrameY = pFontArrus->CalcTextHeight(v6, &awards_window, 0, 0) + awards_window.uFrameY + 8; - if (awards_window.uFrameY > awards_window.uFrameHeight) - break; - - ++num_achieved_awards; - } -} - -//----- (0041A2C1) -------------------------------------------------------- -unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) -{ - if ( (signed int)uNumPixels < 14 ) - uNumPixels = 14; - return ((signed int)(uNumPixels - 14) >> 5) + 1; -} - -//----- (0041A556) -------------------------------------------------------- -void draw_leather() -{ - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); -} - -//----- (0041ABFD) -------------------------------------------------------- -void CharacterUI_CharacterScreen_Draw(Player *player) -{ - pRenderer->ClearZBuffer(0, 479); - switch (pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0]) - { - case WINDOW_CharacterWindow_Stats: // stats - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - CharacterUI_StatsTab_Draw(player); - pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX, - pCharacterScreen_StatsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE)); - break; - - case WINDOW_CharacterWindow_Skills: // skills - if (dword_507CC0_activ_ch != uActiveCharacter) - { - CharacterUI_ReleaseButtons(); - CharacterUI_SkillsTab_CreateButtons(); - } - ReleaseAwardsScrollBar(); - CharacterUI_SkillsTab_Draw(player); - pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX, - pCharacterScreen_SkillsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE)); - break; - - case WINDOW_CharacterWindow_Awards: // awards - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - CreateAwardsScrollBar(); - CharacterUI_AwardsTab_Draw(player); - pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX, - pCharacterScreen_AwardsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE)); - break; - - case WINDOW_CharacterWindow_Inventory: // inventory and other - CharacterUI_ReleaseButtons(); - ReleaseAwardsScrollBar(); - CharacterUI_InventoryTab_Draw(player, false); - pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX, - pCharacterScreen_InventoryBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE)); - break; - - default: break; - } - - if (bRingsShownInCharScreen) - CharacterUI_DrawPaperdollWithRingOverlay(player); - else - CharacterUI_DrawPaperdoll(player); -} - -//----- (0043CC7C) -------------------------------------------------------- -void CharacterUI_DrawPaperdoll(Player *player) -{ - ItemGen *item; // edi@38 - int item_X; // ebx@38 - int index; // eax@65 - int v59; // ebx@129 - unsigned int v75; // ebx@170 - int v94; // ebx@214 - unsigned int v127; // ebx@314 - unsigned int v153; // eax@370 - char *v166; // [sp-8h] [bp-54h]@16 - const char *container; // [sp-8h] [bp-54h]@79 - char *v181; // [sp-8h] [bp-54h]@337 - int item_Y; // [sp+10h] [bp-3Ch]@38 - int pBodyComplection; // [sp+24h] [bp-28h]@6 - bool two_handed_left_fist; // [sp+34h] [bp-18h]@361 - signed int IsDwarf; // [sp+40h] [bp-Ch]@4 - - pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); - if (player->GetRace() == CHARACTER_RACE_DWARF) - { - IsDwarf = 1; - pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 2 : 3; - } - else - { - IsDwarf = 0; - pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 0 : 1; - } - - int uPlayerID = 0; - for (uint i = 0; i < 4; ++i) - if (pPlayers[i + 1] == player) - { - uPlayerID = i + 1; - break; - } - - pRenderer->ResetTextureClipRect(); - pRenderer->DrawTextureIndexed(467, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//Подложка - if ( IsPlayerWearingWatersuit[uPlayerID] )//акваланг - { - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); - //Рука не занята или ... - if ( !player->GetItem(&PlayerEquipment::uMainHand) - || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED) - && (player->GetMainHandItem()->GetItemEquipType() != PLAYER_SKILL_SPEAR - || player->GetItem(&PlayerEquipment::uShield)) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], - pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); - //-----------------------------------------------------(Hand/Рука)--------------------------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uMainHand) ) - { - item = player->GetMainHandItem(); - item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; - item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; - if ( item->uItemID == 64 ) //blaster - v166 = "item64v1"; - else - v166 = item->GetIconName(); - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation(); - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); - else if ( item->uAttributes & ITEM_IDENTIFIED ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE))); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE)), player->pEquipment.uMainHand); - } - } - else// без акваланга - { - //----------------(Bow/ Лук)------------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uBow) ) - { - item = player->GetBowItem(); - item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[item->uItemID].uEquipX; - item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[item->uItemID].uEquipY; - - if ( item->ItemEnchanted() )// применён закл - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation(); - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE),GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); - else if ( !(item->uAttributes & ITEM_IDENTIFIED) )//не опознанный лук зелёный - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); - else // опознанный лук - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)), - player->pEquipment.uBow); - } - //-----------------------------(Cloak/Плащ)--------------------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uCloak) ) - { - item = player->GetCloakItem(); - switch ( item->uItemID ) - { - case ITEM_RELIC_TWILIGHT: - index = 5; - break; - case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP: - index = 6; - break; - case ITEM_RARE_SUN_CLOAK: - index = 7; - break; - case ITEM_RARE_MOON_CLOAK: - index = 8; - break; - case ITEM_RARE_VAMPIRES_CAPE: - index = 9; - break; - default: - index = item->uItemID - 105; - break; - } - if ( index >= 0 && index < 10 ) - { - item_X = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][index][1]; - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation();//~0x000000F0 - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index]), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index])); - else - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index])); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_texture[pBodyComplection][index]), - player->pEquipment.uCloak); - } - } - //-------------------------------(Paperdoll/Кукла)------------------------------------------- - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); - //-------------------------------(Armor/Броня)----------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uArmor) ) - { - item = player->GetArmorItem(); - switch ( item->uItemID ) - { - case ITEM_ARTIFACT_GOVERNORS_ARMOR: - index = 15; - break; - case ITEM_ARTIFACT_YORUBA: - index = 14; - break; - case ITEM_RELIC_HARECS_LEATHER: - index = 13; - break; - case ITEM_ELVEN_CHAINMAIL: - index = 16; - break; - default: - index = item->uItemID - 66; - break; - } - if ( index >= 0 && index < 17 ) - { - item_X = pPaperdoll_BodyX + paperdoll_Armor_Coord[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_Armor_Coord[pBodyComplection][index][1]; - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation();//~0x000000F0 - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0]), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][0])); - else if ( !(item->uAttributes & ITEM_IDENTIFIED) ) - pRenderer->DrawTransparentGreenShade(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]]); - else - pRenderer->DrawTextureTransparent(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]]); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, &pIcons_LOD->pTextures[paperdoll_armor_texture[pBodyComplection][index][0]], - player->pEquipment.uArmor); - } - } - //----------------------------------(Boot/Обувь)-------------------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uBoot) ) - { - item = player->GetBootItem(); - switch ( item->uItemID ) - { - case ITEM_ARTIFACT_HERMES_SANDALS: - index = 5; - v59 = papredoll_flying_feet[player->uCurrentFace]; - break; - case ITEM_ARTIFACT_LEAGUE_BOOTS: - index = 6; - v59 = paperdoll_boots_texture[pBodyComplection][5]; - break; - default: - index = item->uItemID - 115; - v59 = paperdoll_boots_texture[pBodyComplection][index]; - break; - } - if ( index >= 0 && index < 7 ) - { - item_X = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][index][1]; - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation();//~0x000000F0 - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v59), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), - GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v59)); - else if ( item->uAttributes & ITEM_IDENTIFIED ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v59)); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v59)); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v59), player->pEquipment.uBoot); - } - } - //--------------------------------------------(Hand/Рука)------------------------------------------------------ - if ( !player->GetItem(&PlayerEquipment::uMainHand) - || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED) - && (player->GetMainHandItem()->GetPlayerSkillType() != PLAYER_SKILL_SPEAR - || player->GetItem(&PlayerEquipment::uShield)) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], - pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); - //--------------------------------------------(Belt/Пояс)------------------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uBelt)) - { - item = player->GetBeltItem(); - switch ( item->uItemID ) - { - case ITEM_RILIC_TITANS_BELT: - index = 5; - break; - case ITEM_ARTIFACT_HEROS_BELT: - index = 6; - break; - default: - index = item->uItemID - 100; - break; - } - if ( index >= 0 && index < 7 ) - { - item_X = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][index][1]; - if ( IsDwarf != 1 || index == 5 ) - v75 = paperdoll_belt_texture[pBodyComplection][index]; - else - v75 = paperdoll_belt_texture[pBodyComplection - 2][index]; - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation();//~0x000000F0 - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v75), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), - GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v75)); - else if ( item->uAttributes & ITEM_IDENTIFIED ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v75)); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v75)); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v75), player->pEquipment.uBelt); - } - } - //--------------------------------(Shoulder/Плечи)--------------------------------------------- - if (player->GetItem(&PlayerEquipment::uArmor)) - { - item = player->GetArmorItem(); - switch ( item->uItemID ) - { - case ITEM_ARTIFACT_GOVERNORS_ARMOR: - index = 15; - break; - case ITEM_ARTIFACT_YORUBA: - index = 14; - break; - case ITEM_RELIC_HARECS_LEATHER: - index = 13; - break; - case ITEM_ELVEN_CHAINMAIL: - index = 16; - break; - default: - index = item->uItemID - 66; - break; - } - if ( index >= 0 && index < 17 ) - { - if ( player->GetItem(&PlayerEquipment::uMainHand) && (player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED - || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR - && !player->GetItem(&PlayerEquipment::uShield) ))//без щита - { - v94 = paperdoll_armor_texture[pBodyComplection][index][2]; - if ( paperdoll_armor_texture[pBodyComplection][index][2] == pIcons_LOD->FindTextureByName("pending") ) - { - v94 = paperdoll_armor_texture[pBodyComplection][index][1]; - item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1]; - } - else - { - item_X = pPaperdoll_BodyX + paperdoll_shoulder_second_coord[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_shoulder_second_coord[pBodyComplection][index][1]; - } - if ( v94 != pIcons_LOD->FindTextureByName("pending") ) - { - if ( item->ItemEnchanted() ) - { - if ( paperdoll_armor_texture[pBodyComplection][index][2] != pIcons_LOD->FindTextureByName("pending") ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation();//~0x000000F0 - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v94), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), - GetTickCount() * 0.1, 0, 255); - } - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); - else if ( item->uAttributes & ITEM_IDENTIFIED ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v94)); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v94)); - - } - } - else//без ничего или с щитом - { - //v94 = paperdoll_armor_texture[pBodyComplection][index][1]; - if ( paperdoll_armor_texture[pBodyComplection][index][1] != pIcons_LOD->FindTextureByName("pending") ) - { - item_X = pPaperdoll_BodyX + paperdoll_shoulder_coord[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_shoulder_coord[pBodyComplection][index][1]; - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation();//~0x000000F0 - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1]), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); - else if ( item->uAttributes & ITEM_IDENTIFIED ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_armor_texture[pBodyComplection][index][1])); - - } - } - } - } - //----------------------------------------------(Cloak collar/воротник плаща)------------------------------------- - if ( player->GetItem(&PlayerEquipment::uCloak) ) - { - item = player->GetCloakItem(); - switch ( item->uItemID ) - { - case ITEM_RELIC_TWILIGHT: - index = 5; - break; - case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP: - index = 6; - break; - case ITEM_RARE_SUN_CLOAK: - index = 7; - break; - case ITEM_RARE_MOON_CLOAK: - index = 8; - break; - case ITEM_RARE_VAMPIRES_CAPE: - index = 9; - break; - default: - index = item->uItemID - 105; - } - if ( index >= 0 && index < 10 ) - { - item_X = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][index][1]; - signed int r = pIcons_LOD->FindTextureByName("item325v2a1"); - - if ( paperdoll_cloak_collar_texture[pBodyComplection][index] != pIcons_LOD->FindTextureByName("pending") ) - { - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation();//~0x000000F0 - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index]), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index])); - else - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index])); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(paperdoll_cloak_collar_texture[pBodyComplection][index]), - player->pEquipment.uCloak); - } - } - } - //--------------------------------------------(Beards/Борода)------------------------------------------------------- - if ( player->uCurrentFace == 12 || player->uCurrentFace == 13 ) - { - if ( papredoll_dbrds[player->uCurrentFace] != pIcons_LOD->FindTextureByName("Pending") ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * player->uCurrentFace - 24], - pPaperdoll_BodyY + pPaperdoll_Beards[2 * player->uCurrentFace - 23], - pIcons_LOD->GetTexture(papredoll_dbrds[player->uCurrentFace])); - } - //--------------------------------------------(Helm/Шлем)------------------------------------------------------------ - if ( player->GetItem(&PlayerEquipment::uHelm) ) - { - item = player->GetHelmItem(); - switch ( item->uItemID ) - { - case ITEM_RELIC_TALEDONS_HELM: - index = 11; - break; - case ITEM_RELIC_SCHOLARS_CAP: - index = 12; - break; - case ITEM_RELIC_PHYNAXIAN_CROWN: - index = 13; - break; - case ITEM_ARTIFACT_MINDS_EYE: - index = 14; - break; - case ITEM_RARE_SHADOWS_MASK: - index = 15; - break; - default: - index = item->uItemID - 89; - } - if ( index >= 0 && index < 16 ) - { - item_X = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][index][0]; - item_Y = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][index][1]; - if ( IsDwarf != 1 || item->uItemID != 92 ) - v127 = paperdoll_helm_texture[player->GetSexByVoice()][index]; - else - v127 = papredoll_dbrds[11]; - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation(); - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v127), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), - GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); - else if ( item->uAttributes & ITEM_IDENTIFIED ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v127)); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v127), player->pEquipment.uHelm); - } - } - //------------------------------------------------(Hand3/Рука3)------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uMainHand) ) - { - item = player->GetMainHandItem(); - item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item->uItemID].uEquipX; - item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item->uItemID].uEquipY; - if ( item->uItemID == 64 ) - v181 = "item64v1"; - else - v181 = item->GetIconName(); - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation(); - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE)), - pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); - else if ( item->uAttributes & ITEM_IDENTIFIED ) - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); - else - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE))); - - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE)), - player->pEquipment.uMainHand); - } - //--------------------------------------------------(Shield/Щит)--------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uShield) ) - { - item = player->GetOffHandItem(); - if ( item->GetPlayerSkillType() == PLAYER_SKILL_DAGGER - || item->GetPlayerSkillType() == PLAYER_SKILL_SWORD ) - { - //v151 = item->uItemID - 400; - item_X = 596; - two_handed_left_fist = true; - switch ( item->uItemID ) - { - case 400: - item_Y = 86; - break; - case 403: - item_Y = 28; - break; - case 415: - item_X = 595; - item_Y = 33; - break; - default: - item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX; - item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY; - break; - } - } - else - { - two_handed_left_fist = false; - item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX; - item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY; - } - v153 = pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE); - - if ( item->ItemEnchanted() ) - { - if ( item->AuraEffectRed() ) - container = "sptext01"; - else if ( item->AuraEffectBlue() ) - container = "sp28a"; - else if ( item->AuraEffectGreen() ) - container = "sp30a"; - else if ( item->AuraEffectPurple() ) - container = "sp91a"; - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->ResetEnchantAnimation(); - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(v153), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), - GetTickCount() * 0.1, 0, 255); - } - else if ( item->uAttributes & ITEM_BROKEN ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v153)); - else if ( !(item->uAttributes & ITEM_IDENTIFIED) ) - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v153)); - else - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v153)); - - if ( two_handed_left_fist )//two-handed - left fist/двуручие - левая кисть - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0], - pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhs[uPlayerID - 1])); - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(v153), player->pEquipment.uShield); - } - } - //--------------------------------------------------------(RightHand/Правая кисть)-------------------------------------------------- - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_drhs[uPlayerID - 1])); - //---------------------------------------------(two-handed - hand/Двуручие - рука)-------------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uMainHand) ) - { - if ( player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED - || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR - && !player->GetItem(&PlayerEquipment::uShield) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], - pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); - } - //--------------------------------------------------------(two-handed - fist/двуручие - кисть)---------------------------------------------------- - if ( player->GetItem(&PlayerEquipment::uMainHand)) - { - item = player->GetMainHandItem(); - if ( item->GetItemEquipType() == EQUIP_TWO_HANDED - || item->GetPlayerSkillType() == PLAYER_SKILL_SPEAR - && !player->GetItem(&PlayerEquipment::uShield) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], - pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], - pIcons_LOD->GetTexture(papredoll_dlhus[uPlayerID - 1])); - } - if ( !bRingsShownInCharScreen )//рисование лупы - pRenderer->DrawTextureTransparent(603, 299, pIcons_LOD->GetTexture(uTextureID_MAGNIF_B)); - pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));//обрамление -} - -//----- (0041A2D1) -------------------------------------------------------- -void CharacterUI_InventoryTab_Draw(Player *player, bool a2) -{ - Texture *pTexture; // esi@6 - unsigned int v17; // edi@15 - unsigned int uCellX; // [sp+30h] [bp-8h]@5 - unsigned int uCellY; // [sp+34h] [bp-4h]@5 - - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground)); - if (a2) - pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE)); - for (uint i = 0; i < 126; ++i) - { - if ( player->pInventoryMatrix[i] <= 0 ) - continue; - if ( !player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID ) - continue; - uCellY = 32 * (i / 14) + 17; - uCellX = 32 * (i % 14) + 14; - uint item_texture_id = pIcons_LOD->LoadTexture(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].GetIconName(), TEXTURE_16BIT_PALETTE); - pTexture = pIcons_LOD->GetTexture(item_texture_id); - if (pTexture->uTextureWidth < 14) - pTexture->uTextureWidth = 14; - if ( (pTexture->uTextureWidth - 14) / 32 == 0 && pTexture->uTextureWidth < 32) - uCellX += (32 - pTexture->uTextureWidth) / 2; - //v13 = pTexture->uTextureWidth - 14; - //LOBYTE(v13) = v13 & 0xE0; - //v15 = v13 + 32; - if (pTexture->uTextureHeight < 14 ) - pTexture->uTextureHeight = 14; - v17 = uCellX + (( (int)((pTexture->uTextureWidth - 14) & 0xE0) + 32 - pTexture->uTextureWidth) / 2) - + pSRZBufferLineOffsets[uCellY + (( (int)((pTexture->uTextureHeight - 14) & 0xFFFFFFE0) - pTexture->uTextureHeight + 32) / 2)]; //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up - if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & ITEM_ENCHANT_ANIMATION) - { - Texture *loadedTextureptr = nullptr; - switch (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes & ITEM_ENCHANT_ANIMATION) - { - case ITEM_AURA_EFFECT_RED: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break; - case ITEM_AURA_EFFECT_BLUE: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE); break; - case ITEM_AURA_EFFECT_GREEN: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE); break; - case ITEM_AURA_EFFECT_PURPLE: loadedTextureptr = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE); break; - } - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if (_50C9A8_item_enchantment_timer <= 0) - { - _50C9A8_item_enchantment_timer = 0; - LOBYTE(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uAttributes) &= 0xF; - ptr_50C9A4_ItemToEnchant = nullptr; - } - - pRenderer->DrawAura(uCellX, uCellY, pTexture, loadedTextureptr, GetTickCount() * 0.1, 0, 255); - ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]); - } - else - { - if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].IsIdentified() || pCurrentScreen != SCREEN_HOUSE) - { - if (player->pInventoryItemList[player->pInventoryMatrix[i] - 1].IsBroken()) - pRenderer->DrawTransparentRedShade(uCellX, uCellY, pTexture); - else - pRenderer->DrawTextureTransparent(uCellX, uCellY, pTexture); - } - else - pRenderer->DrawTransparentGreenShade(uCellX, uCellY, pTexture); - ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, player->pInventoryMatrix[i]); - continue; - } - } -} - -static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id) -{ - Texture* item_texture = pIcons_LOD->LoadTexturePtr(item->GetIconName(), TEXTURE_16BIT_PALETTE); - - if (item->uAttributes & ITEM_ENCHANT_ANIMATION) // enchant animation - { - Texture *enchantment_texture = nullptr; - switch (item->uAttributes & ITEM_ENCHANT_ANIMATION) - { - case ITEM_AURA_EFFECT_RED: enchantment_texture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break; - case ITEM_AURA_EFFECT_BLUE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE); break; - case ITEM_AURA_EFFECT_GREEN: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE); break; - case ITEM_AURA_EFFECT_PURPLE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE); break; - } - - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if (_50C9A8_item_enchantment_timer <= 0) - { - _50C9A8_item_enchantment_timer = 0; - item->uAttributes &= 0xFFFFFF0F; - ptr_50C9A4_ItemToEnchant = nullptr; - } - pRenderer->DrawAura(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255); - } - else - { - if (item->IsBroken()) - pRenderer->DrawTransparentRedShade(x, y, item_texture); - else if (!item->IsIdentified()) - pRenderer->DrawTransparentGreenShade(x, y, item_texture); - else - pRenderer->DrawTextureTransparent(x, y, item_texture); - - pRenderer->ZBuffer_Fill_2(x, y, item_texture, id); - } -} - -//----- (0043E825) -------------------------------------------------------- -void CharacterUI_DrawPaperdollWithRingOverlay(Player *player) -{ - CharacterUI_DrawPaperdoll(player); - pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND)); - pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop)); - pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY, - pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)); - for (uint i = 0; i < 6; ++i) - { - if (!player->pEquipment.uRings[i]) - continue; - static int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248}; - static int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA}; - CharacterUI_DrawItem(pPaperdollRingsX[i], pPaperdollRingsY[i], &player->pInventoryItemList[player->pEquipment.uRings[i] - 1], - player->pEquipment.uRings[i]); - } - if (player->pEquipment.uAmulet) - CharacterUI_DrawItem(493, 91, player->GetAmuletItem(), player->pEquipment.uAmulet); - if (player->pEquipment.uGlove) - CharacterUI_DrawItem(586, 88, player->GetGloveItem(), player->pEquipment.uGlove); -} - -//----- (0043BCA7) -------------------------------------------------------- -void CharacterUI_LoadPaperdollTextures() -{ - int v3; // ebx@10 - Player *pPlayer; // edi@12 - signed int v32; // [sp+10h] [bp-28h]@75 - signed int v33; // [sp+10h] [bp-28h]@77 - int pItemTXTNum; // [sp+14h] [bp-24h]@75 - signed int v38; // [sp+14h] [bp-24h]@79 - char pContainer[128]; // [sp+24h] [bp-14h]@12 - - uTextureID_MAGNIF_B = pIcons_LOD->LoadTexture("MAGNIF-B", TEXTURE_16BIT_PALETTE); - //if ( !pParty->uAlignment || pParty->uAlignment == 1 || pParty->uAlignment == 2 ) - uTextureID_BACKDOLL = pIcons_LOD->LoadTexture("BACKDOLL", TEXTURE_16BIT_PALETTE); - uTextureID_right_panel_loop = uTextureID_right_panel; - uTextureID_BACKHAND = pIcons_LOD->LoadTexture("BACKHAND", TEXTURE_16BIT_PALETTE); - uTextureID_detaliz_close_button = uExitCancelTextureId; - for ( uint i = 0; i < 4; ++i ) - { - if ( pPlayers[i + 1]->HasUnderwaterSuitEquipped() ) - { - if ( pPlayers[i + 1]->GetRace() == CHARACTER_RACE_DWARF ) - v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 3; - else - v3 = (pPlayers[i + 1]->GetSexByVoice() != 0) + 1; - wsprintfA(pContainer, "pc23v%dBod", v3); - papredoll_dbods[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Body texture - wsprintfA(pContainer, "pc23v%dlad", v3); - papredoll_dlads[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand - wsprintfA(pContainer, "pc23v%dlau", v3); - papredoll_dlaus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand2 - wsprintfA(pContainer, "pc23v%drh", v3); - papredoll_drhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Right Hand - wsprintfA(pContainer, "pc23v%dlh", v3); - papredoll_dlhs[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Fist - wsprintfA(pContainer, "pc23v%dlhu", v3); - papredoll_dlhus[i] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2 - pPlayer = pPlayers[i + 1]; - if ( pPlayer->uCurrentFace == 12 || pPlayer->uCurrentFace == 13 ) - papredoll_dbrds[(char)pPlayer->uCurrentFace] = 0; - papredoll_flying_feet[pPlayer->uCurrentFace] = 0; - IsPlayerWearingWatersuit[i + 1] = 1; - } - else - { - papredoll_dbods[i] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlads[i] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlaus[i] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_drhs[i] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhs[i] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhus[i] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[i + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE); - if ( pPlayers[i + 1]->uCurrentFace == 12 || pPlayers[i + 1]->uCurrentFace == 13 ) - { - wsprintfA(pContainer, "pc%02dbrd", pPlayers[i + 1]->uCurrentFace + 1); - papredoll_dbrds[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - wsprintfA(pContainer, "item281pc%02d", pPlayers[i + 1]->uCurrentFace + 1); - papredoll_flying_feet[pPlayers[i + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - IsPlayerWearingWatersuit[i + 1] = 0; - } - } - - uTextureID_ar_up_up = pIcons_LOD->LoadTexture("ar_up_up", TEXTURE_16BIT_PALETTE); - uTextureID_ar_up_dn = pIcons_LOD->LoadTexture("ar_up_dn", TEXTURE_16BIT_PALETTE); - uTextureID_ar_dn_up = pIcons_LOD->LoadTexture("ar_dn_up", TEXTURE_16BIT_PALETTE); - uTextureID_ar_dn_dn = pIcons_LOD->LoadTexture("ar_dn_dn", TEXTURE_16BIT_PALETTE); - papredoll_dbrds[9] = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE); - papredoll_dbrds[7] = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE); - papredoll_dbrds[5] = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); - papredoll_dbrds[3] = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); - papredoll_dbrds[1] = pIcons_LOD->LoadTexture("ib-cd5-d", TEXTURE_16BIT_PALETTE); - for ( uint i = 0; i < 54; ++i )// test equipment - { - party_has_equipment[i] = 0; - if ( pParty->pPickedItem.uItemID != i + 66 ) - { - for ( uint j = 0; j < 4; ++j) - { - if ( pParty->pPlayers[j].HasItem(i + 66, 0) ) - party_has_equipment[i] = 1; - } - } - } - memset(byte_5111F6_OwnedArtifacts.data(), 0, sizeof(byte_5111F6_OwnedArtifacts)); - for (uint i = 0; i < 4; ++i) - { - Player* player = &pParty->pPlayers[i]; - - if (player->HasItem(ITEM_ARTIFACT_GOVERNORS_ARMOR, 1)) byte_5111F6_OwnedArtifacts[0] = 1; - if (player->HasItem(ITEM_ARTIFACT_YORUBA, 1)) byte_5111F6_OwnedArtifacts[1] = 1; - if (player->HasItem(ITEM_RELIC_HARECS_LEATHER, 1)) byte_5111F6_OwnedArtifacts[2] = 1; - if (player->HasItem(ITEM_ARTIFACT_LEAGUE_BOOTS, 1)) byte_5111F6_OwnedArtifacts[3] = 1; - if (player->HasItem(ITEM_RELIC_TALEDONS_HELM, 1)) byte_5111F6_OwnedArtifacts[4] = 1; - if (player->HasItem(ITEM_RELIC_SCHOLARS_CAP, 1)) byte_5111F6_OwnedArtifacts[5] = 1; - if (player->HasItem(ITEM_RELIC_PHYNAXIAN_CROWN, 1)) byte_5111F6_OwnedArtifacts[6] = 1; - if (player->HasItem(ITEM_ARTIFACT_MINDS_EYE, 1)) byte_5111F6_OwnedArtifacts[7] = 1; - if (player->HasItem(ITEM_RARE_SHADOWS_MASK, 1)) byte_5111F6_OwnedArtifacts[8] = 1; - if (player->HasItem(ITEM_RILIC_TITANS_BELT, 1)) byte_5111F6_OwnedArtifacts[9] = 1; - if (player->HasItem(ITEM_ARTIFACT_HEROS_BELT, 1)) byte_5111F6_OwnedArtifacts[10] = 1; - if (player->HasItem(ITEM_RELIC_TWILIGHT, 1)) byte_5111F6_OwnedArtifacts[11] = 1; - if (player->HasItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, 1)) byte_5111F6_OwnedArtifacts[12] = 1; - if (player->HasItem(ITEM_RARE_SUN_CLOAK, 1)) byte_5111F6_OwnedArtifacts[13] = 1; - if (player->HasItem(ITEM_RARE_MOON_CLOAK, 1)) byte_5111F6_OwnedArtifacts[14] = 1; - if (player->HasItem(ITEM_RARE_VAMPIRES_CAPE, 1)) byte_5111F6_OwnedArtifacts[15] = 1; - if (player->HasItem(ITEM_ELVEN_CHAINMAIL, 1)) byte_5111F6_OwnedArtifacts[16] = 1; - } - - for (uint i = 0; i < 2; ++i) - { - for ( uint j = 0; j < 5; ++j )//Belt - { - GetItemTextureFilename(pContainer, j + 100, i + 1, 0); - paperdoll_belt_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - GetItemTextureFilename(pContainer, 535, i + 1, 0); - paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - for ( uint j = 0; j < 11; ++j )//Helm - { - GetItemTextureFilename(pContainer, j + 89, i + 1, 0); - paperdoll_helm_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - GetItemTextureFilename(pContainer, 521, i + 1, 0); - paperdoll_helm_texture[i][11] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 522, i + 1, 0); - paperdoll_helm_texture[i][12] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 523, i + 1, 0); - paperdoll_helm_texture[i][13] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 532, i + 1, 0); - paperdoll_helm_texture[i][14] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 544, i + 1, 0); - paperdoll_helm_texture[i][15] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - if ( IsDwarfPresentInParty(true) ) //the phynaxian helm uses a slightly different graphic for dwarves - papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE); - } - //v43 = 0; - for (uint i = 0; i < 4; ++i) - { - if ( ShouldLoadTexturesForRaceAndGender(i) ) - { - GetItemTextureFilename(pContainer, 524, i + 1, 0); - paperdoll_belt_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Titans belt - pItemTXTNum = 66; - for ( v32 = 0; v32 < 13; ++v32 )//simple armor - { - GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 0); - paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// armor - GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1); - paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 1 - GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2); - paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// shoulder 2 - pItemTXTNum++; - } - GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts - paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 516, i + 1, 1); - paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 516, i + 1, 2); - paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 505, i + 1, 0); - paperdoll_armor_texture[i][v32 + 1][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 505, i + 1, 1); - paperdoll_armor_texture[i][v32 + 1][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 505, i + 1, 2); - paperdoll_armor_texture[i][v32 + 1][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 504, i + 1, 0); - paperdoll_armor_texture[i][v32 + 2][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 504, i + 1, 1); - paperdoll_armor_texture[i][v32 + 2][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 504, i + 1, 2); - paperdoll_armor_texture[i][v32 + 2][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 533, i + 1, 0); - paperdoll_armor_texture[i][v32 + 3][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 533, i + 1, 1); - paperdoll_armor_texture[i][v32 + 3][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 533, i + 1, 2); - paperdoll_armor_texture[i][v32 + 3][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - for ( v33 = 0; v33 < 5; ++v33 )//boots - { - GetItemTextureFilename(pContainer, v33 + 115, i + 1, 0); - paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - GetItemTextureFilename(pContainer, 512, i + 1, 0); - paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - for ( v38 = 0; v38 < 5; ++v38 )//Cloak - { - GetItemTextureFilename(pContainer, v38 + 105, i + 1, 0); - paperdoll_cloak_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, v38 + 105, i + 1, 1); - paperdoll_cloak_collar_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - GetItemTextureFilename(pContainer, 525, i + 1, 0); - paperdoll_cloak_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 530, i + 1, 0); - paperdoll_cloak_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 547, i + 1, 0); - paperdoll_cloak_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 548, i + 1, 0); - paperdoll_cloak_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 550, i + 1, 0); - paperdoll_cloak_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 525, i + 1, 1); - paperdoll_cloak_collar_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 530, i + 1, 1); - paperdoll_cloak_collar_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 547, i + 1, 1); - paperdoll_cloak_collar_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 548, i + 1, 1); - paperdoll_cloak_collar_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - GetItemTextureFilename(pContainer, 550, i + 1, 1); - paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - //else - //{ - //v26 = v43; - //} - //v43 = v26 + 40; - } -} - -//----- (00419401) -------------------------------------------------------- -void CharacterUI_SkillsTab_CreateButtons() -{ - GUIButton *pButton; // eax@3 - unsigned int current_Y; // esi@8 - int buttons_count; // [sp+10h] [bp-14h]@1 - int first_rows; // [sp+14h] [bp-10h]@19 - int skill_id; // [sp+18h] [bp-Ch]@8 - Player *curr_player; // [sp+1Ch] [bp-8h]@8 - int i; - int uCurrFontHeght; - - buttons_count = 0; - if ( dword_507CC0_activ_ch ) - CharacterUI_ReleaseButtons(); - dword_507CC0_activ_ch = uActiveCharacter; - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) - { - if ( pButton->msg == UIMSG_InventoryLeftClick ) - { - dword_50698C_uX = pButton->uX; - dword_506988_uY = pButton->uY; - dword_506984_uZ = pButton->uZ; - dword_506980_uW = pButton->uW; - pButton->uW = 0; - pButton->uZ = 0; - pButton->uY = 0; - pButton->uX = 0; - } - } - first_rows = 0; - int a5 = pGUIWindow_CurrentMenu->uNumControls; - curr_player = &pParty->pPlayers[uActiveCharacter-1]; - - uCurrFontHeght=pFontLucida->uFontHeight; - current_Y = 2 *uCurrFontHeght + 13; - for( i = 0; i < 9; ++i ) - { - skill_id = pWeaponSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F ) - { - current_Y += uCurrFontHeght - 3; - ++buttons_count; - ++first_rows; - pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } - if ( !first_rows ) - current_Y += uCurrFontHeght - 3; - current_Y += 2 * uCurrFontHeght - 6; - for ( i = 0; i < 9; ++i ) - { - skill_id = pMagicSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F && buttons_count < 15 ) - { - current_Y += uCurrFontHeght - 3; - ++buttons_count; - pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } - first_rows = 0; - current_Y = 2 * uCurrFontHeght + 13; - for ( i = 0; i < 5; ++i ) - { - skill_id = pArmorSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F ) - { - current_Y+= uCurrFontHeght - 3; - ++buttons_count; - ++first_rows; - pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } - if ( !first_rows ) - current_Y += uCurrFontHeght - 3; - current_Y += 2 * uCurrFontHeght - 6; - for ( i = 0; i < 12; ++i ) - { - skill_id = pMiscSkills[i]; - if ( curr_player->pActiveSkills[skill_id] & 0x3F ) - { - current_Y += uCurrFontHeght - 3; - ++buttons_count; - pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0); - } - } - - if ( buttons_count ) - pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(buttons_count, 1, 0, a5); -} - -//----- (00418511) -------------------------------------------------------- -void CharacterUI_StatsTab_Draw( Player *player ) -{ - int pY; // ST34_4@4 - const char *pText; // eax@9 - const char *text_format; // [sp+14h] [bp-Ch]@4 - - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE)); - sprintf(pTmpBuf.data(), "\f%05d", ui_character_header_text_color); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s" - strcat(pTmpBuf.data(), pTmpBuf2.data()); - sprintfex(pTmpBuf2.data(), "\f00000\r180%s: \f%05d%d\f00000\n\n\n", - pGlobalTXT_LocalizationStrings[207], // "Skill points" - player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, - player->uSkillPoints); - strcat(pTmpBuf.data(), pTmpBuf2.data()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf.data(), 0, 0, 0); - - //First column(Первая колонка) - pY = 53; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualMight(), player->GetBaseStrength()), - player->GetActualMight(), player->GetBaseStrength());//Might - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualIntelligence(), player->GetBaseIntelligence()), - player->GetActualIntelligence(), player->GetBaseIntelligence());//Intellect - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualWillpower(), player->GetBaseWillpower()), - player->GetActualWillpower(), player->GetBaseWillpower());// - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualEndurance(), player->GetBaseEndurance()), - player->GetActualEndurance(), player->GetBaseEndurance());// - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAccuracy(), player->GetBaseAccuracy()), - player->GetActualAccuracy(), player->GetBaseAccuracy()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualSpeed(), player->GetBaseSpeed()), - player->GetActualSpeed(), player->GetBaseSpeed()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualLuck(), player->GetBaseLuck()), - player->GetActualLuck(), player->GetBaseLuck()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = "%s\f%05u\r424%d\f00000 /\t185%d\n"; - if ( player->GetMaxHealth() >= 1000 ) - text_format = "%s\f%05u\r388%d\f00000 / %d\n"; - pY += 2 * LOBYTE(pFontArrus->uFontHeight) + 5; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[108], - UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()), - player->sHealth, player->GetMaxHealth()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = "%s\f%05u\r424%d\f00000 /\t185%d\n"; - if ( player->GetMaxMana() >= 1000 ) - text_format = "%s\f%05u\r388%d\f00000 / %d\n"; - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[212], - UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()), - player->sMana, player->GetMaxMana()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC()), - player->GetActualAC(), player->GetBaseAC()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += 2 * LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], GetConditionDrawColor(player->GetMajorConditionIdx()), - aCharacterConditionNames[player->GetMajorConditionIdx()]);//Состояние - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 26, pY, 0, pTmpBuf.data(), 226, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) + - 1; - pText = pGlobalTXT_LocalizationStrings[153];//Нет - if (player->uQuickSpell) - pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; - sprintf(pTmpBuf.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], pText);//Б. применение - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 26, pY, 0, pTmpBuf.data(), 226, 0); - - //Second column (Вторая колонка) - pY = 50; - text_format = Stat_string_format_2_column_less_100; - if ( player->GetActualAge() > 99 ) - text_format = Stat_string_format_2_column_over_100; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[5], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAge(), player->GetBaseAge()), - player->GetActualAge(), player->GetBaseAge()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = Stat_string_format_2_column_less_100; - if ( player->GetBaseLevel() > 99 ) - text_format = Stat_string_format_2_column_over_100; - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[131],//Уров. - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualLevel(), player->GetBaseLevel()), - player->GetActualLevel(), player->GetBaseLevel()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - pText = pGlobalTXT_LocalizationStrings[17]; // "Exp." - if (player->uExperience <= 9999999) - pText = pGlobalTXT_LocalizationStrings[83]; // "Experience" - sprintf(pTmpBuf.data(), "%s\r180\f%05d%lu\f00000\n\n", pText, player->GetExperienceDisplayColor(), LODWORD(player->uExperience)); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += 2 * LOBYTE(pFontArrus->uFontHeight); - sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], player->GetActualAttack(false)); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], player->GetMeleeDamageString()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], player->GetRangedAttack()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], player->GetRangedDamageString()); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = Stat_string_format_2_column_less_100; - if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE) > 99 ) - text_format = Stat_string_format_2_column_over_100; - pY += 2 * LOBYTE(pFontArrus->uFontHeight) - 4; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[87], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE)), - player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE)); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = Stat_string_format_2_column_less_100; - if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR) > 99 ) - text_format = Stat_string_format_2_column_over_100; - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[6], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR)), - player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR)); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = Stat_string_format_2_column_less_100; - if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER) > 99 ) - text_format = Stat_string_format_2_column_over_100; - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[240], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER)), - player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER)); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = Stat_string_format_2_column_less_100; - if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH) > 99 ) - text_format = Stat_string_format_2_column_over_100; - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[70], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH)), - player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH)); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = Stat_string_format_2_column_less_100; - if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) > 99 ) - text_format = Stat_string_format_2_column_over_100; - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[142], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND)), - player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND)); - if ( player->classType == PLAYER_CLASS_LICH && player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND) == 200 ) - sprintf(pTmpBuf.data(), Stat_string_format_2_column_text, pGlobalTXT_LocalizationStrings[142], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND), 200), pGlobalTXT_LocalizationStrings[625]); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); - - text_format = Stat_string_format_2_column_less_100; - if ( player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 || player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) > 99 ) - text_format = Stat_string_format_2_column_over_100; - pY += LOBYTE(pFontArrus->uFontHeight) - 2; - int it = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); - sprintf(pTmpBuf.data(), text_format, pGlobalTXT_LocalizationStrings[29], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY)), - player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY)); - if ( player->classType == PLAYER_CLASS_LICH && player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY) == 200 ) - sprintf(pTmpBuf.data(), Stat_string_format_2_column_text, pGlobalTXT_LocalizationStrings[29], - UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY), 200), pGlobalTXT_LocalizationStrings[625]); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, pY, 0, pTmpBuf.data(), 0, 0, 0); -} - -bool awardSort (int i, int j) -{ - if (pAwards[i].uPriority == 0) //none - return false; - else if (pAwards[j].uPriority == 0) - return true; - else if(pAwards[i].uPriority == 1) //fines,arena stuff,etc - return false; - else if(pAwards[j].uPriority == 1) - return true; - else if(pAwards[i].uPriority == 5) //joined guilds - return false; - else if(pAwards[j].uPriority == 5) - return true; - else - return (pAwards[i].uPriority < pAwards[j].uPriority); -} - -//----- (00419100) -------------------------------------------------------- -void FillAwardsData() -{ - Player* pPlayer = pPlayers[uActiveCharacter]; - - memset(achieved_awards.data(), 0, 4000); - num_achieved_awards = 0; - - memset(pTmpBuf2.data(), 0, 0x7D0u); - BtnDown_flag = 0; - BtnUp_flag = 0; - books_page_number = 0; - books_primary_item_per_page = 0; - for ( int i = 1; i < 105; ++i ) - { - if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText ) - achieved_awards[num_achieved_awards++] = (AwardType)i; - } - full_num_items_in_book = num_achieved_awards; - num_achieved_awards = 0; - - //sort awards index - - if (full_num_items_in_book>0) - { - for (int i = 0; i< full_num_items_in_book; ++i) - achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16);//случайные значения от 0 до 15 - for (int i = 1; i< full_num_items_in_book; ++i) - { - for (int j = i; j< full_num_items_in_book; ++j) - { - AwardType tmp; - if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority) - { - tmp= achieved_awards[j]; - achieved_awards[j] = achieved_awards[i]; - achieved_awards[i] = tmp; - } - } - } - } - - // if (full_num_items_in_book > 0) - /* { - std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort); - }*/ -} - -//----- (0043EF2B) -------------------------------------------------------- -void WetsuitOn( unsigned int uPlayerID ) -{ - CHARACTER_RACE player_race; // edi@2 - signed int player_sex; // eax@2 - int texture_num; // ecx@5 - char pContainer[20]; // [sp+4h] [bp-1Ch]@7 - - if ( uPlayerID> 0 ) - { - player_race = pPlayers[uPlayerID]->GetRace(); - player_sex = pPlayers[uPlayerID]->GetSexByVoice(); - if ( player_race == CHARACTER_RACE_DWARF ) - texture_num = (player_sex != 0) + 3; - else - texture_num = (player_sex != 0) + 1; - wsprintfA(pContainer, "pc23v%dBod", texture_num); - papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlad", texture_num); - papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlau", texture_num); - papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%drh", texture_num); - papredoll_drhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlh", texture_num); - papredoll_dlhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - wsprintfA(pContainer, "pc23v%dlhu", texture_num); - papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - - if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) - papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = 0; - papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = 0; - IsPlayerWearingWatersuit[uPlayerID] = 1; - } -} - -//----- (0043F0BD) -------------------------------------------------------- -void WetsuitOff( unsigned int uPlayerID ) -{ - char pContainer[20]; // [sp+0h] [bp-18h]@4 - - if (uPlayerID > 0 ) - { - papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_drhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(drh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(dlh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE); - - if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 ) - { - wsprintfA(pContainer, "pc%02dbrd", pPlayers[uPlayerID]->uCurrentFace + 1); - papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - } - wsprintfA(pContainer, "item281pc%02d", pPlayers[uPlayerID]->uCurrentFace + 1); - papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - IsPlayerWearingWatersuit[uPlayerID] = 0; - } -} - -//----- (00468F8A) -------------------------------------------------------- -void OnPaperdollLeftClick() -{ - int v1; // ecx@1 - unsigned int v2; // edi@1 - unsigned int v3; // edx@4 - unsigned int pSkillType; // esi@5 - unsigned __int16 v5; // ax@7 - int v7; // esi@27 - int v8; // eax@29 - int v17; // eax@44 - //unsigned int v18; // ecx@55 - //unsigned int v19; // eax@55 -// unsigned int v22; // eax@61 - int v23; // eax@62 - int v26; // eax@69 - int v34; // esi@90 - ItemGen _this; // [sp+Ch] [bp-40h]@1 -// unsigned int v48; // [sp+30h] [bp-1Ch]@88 - unsigned int v50; // [sp+38h] [bp-14h]@50 - int v51; // [sp+3Ch] [bp-10h]@1 - int v52; // [sp+40h] [bp-Ch]@5 - ITEM_EQUIP_TYPE pEquipType; - CastSpellInfo *pSpellInfo; - - v51 = 0; - _this.Reset(); - v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; - v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; - if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_TWO_HANDED ) - v51 = v1; - v3 = pParty->pPickedItem.uItemID; - if ( pParty->pPickedItem.uItemID ) - { - pEquipType = pParty->pPickedItem.GetItemEquipType(); - pSkillType = pParty->pPickedItem.GetPlayerSkillType(); - if ( pSkillType == 4 ) - { - if ( v2 ) - { - LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); - if ( (signed int)SkillToMastery(v5) < 3 ) - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); - return; - } - v3 = pParty->pPickedItem.uItemID; - } - } - else - { - if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) - && v1 - && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetPlayerSkillType() == 4 ) - { - LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); - if ( (signed int)SkillToMastery(v5) < 3 ) - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); - return; - } - } - } - if ( !pPlayers[uActiveCharacter]->CanEquip_RaceAndAlignmentCheck(v3) ) - { - - pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); - return; - } - if ( pParty->pPickedItem.uItemID == ITEM_WETSUIT ) - { - pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)3); - WetsuitOn(uActiveCharacter); - return; - } - switch ( pEquipType ) - { - case EQUIP_BOW: - case EQUIP_ARMOUR: - case EQUIP_HELMET: - case EQUIP_BELT: - case EQUIP_CLOAK: - case EQUIP_GAUNTLETS: - case EQUIP_BOOTS: - case EQUIP_AMULET: - if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )//нет навыка - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); - return; - } - if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() && (pEquipType != EQUIP_ARMOUR || bUnderwater) ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - pPlayers[uActiveCharacter]->EquipBody(pEquipType); - if ( pParty->pPickedItem.uItemID == ITEM_WETSUIT ) - WetsuitOff(uActiveCharacter); - return; -//------------------------dress rings(одевание колец)---------------------------------- - case EQUIP_RING: - if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - //слоты для колец - v7 = 0; - for ( v52 = 10; (signed int)v52 < 16; ++v52 ) - { - if ( !pPlayers[uActiveCharacter]->pEquipment.uRings[v7] ) - { - v8 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); - if ( v8 >= 0 ) - { - pParty->pPickedItem.uBodyAnchor = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v8])); - pPlayers[uActiveCharacter]->pEquipment.uRings[v7] = v8 + 1; - pMouse->RemoveHoldingItem(); - break; - } - } - v7++; - } - if ( v52 == 16 )//замещение последнего кольца - { - v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[5] - 1; - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - pPlayers[uActiveCharacter]->pInventoryItemList[v52].uBodyAnchor = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v52]); - _this.uBodyAnchor = 16; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uRings[5] = v52 + 1; - } - return; -//------------------dress shield(одеть щит)------------------------------------------------------ - case EQUIP_SHIELD://Щит - if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() )//в акваланге - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )//нет навыка - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); - return; - } - if ( v2 )//смена щита щитом - { - --v2; - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); - _this.uBodyAnchor = 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; - if ( v51 == EQUIP_SINGLE_HANDED ) - return; - } - else - { - v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); - if ( v52 < 0 ) - return; - if ( !v51 )// обычная установка щита на пустую руку - { - pParty->pPickedItem.uBodyAnchor = 1; - v17 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); - pPlayers[uActiveCharacter]->pEquipment.uShield = v17; - pMouse->RemoveHoldingItem(); - return; - } - v1--;//ставим щит когда держит двуручный меч - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); - _this.uBodyAnchor = 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); - pPlayers[uActiveCharacter]->pEquipment.uShield = v52 + 1; - } - pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0; - return; -//-------------------------taken in hand(взять в руку)------------------------------------------- - case EQUIP_SINGLE_HANDED: - case EQUIP_WAND: - if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() - && pParty->pPickedItem.uItemID != 64 - && pParty->pPickedItem.uItemID != 65 ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); - return; - } - v50 = 0; - if ( pSkillType == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_DAGGER] & 0xFFC0) - || pSkillType == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_SWORD]) >= 3 ) - { - //v18 = pMouse->uMouseClickX; - //v19 = pMouse->uMouseClickY; - if ( (signed int)pMouse->uMouseClickX >= 560 ) - { - if ( !v51 ) - { - if ( v2 ) - { - --v2; - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); - _this.uBodyAnchor = 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; - if ( pEquipType != EQUIP_WAND ) - return; - v50 = _this.uItemID; - if ( _this.uItemID ) - { - __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v50].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); - } - break; - } - v23 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); - if ( v23 < 0 ) - return; - pParty->pPickedItem.uBodyAnchor = 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v23])); - pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; - pMouse->RemoveHoldingItem(); - if ( pEquipType != EQUIP_WAND ) - return; - v50 = pPlayers[uActiveCharacter]->pInventoryItemList[v23].uItemID; - if ( v50 ) - { - __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v50].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); - } - break; - } - } - } - if ( !v1 ) - { - v26 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); - if ( v26 < 0 ) - return; - pParty->pPickedItem.uBodyAnchor = 2; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v26])); - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; - pMouse->RemoveHoldingItem(); - if ( pEquipType != EQUIP_WAND ) - return; - if ( pPlayers[uActiveCharacter]->pInventoryItemList[v26].uItemID ) - stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v26].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); - break; - } - --v1; - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); - _this.uBodyAnchor = 2; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24); - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v1 + 1; - if ( pEquipType == EQUIP_WAND ) - v50 = _this.uItemID; - if ( v51 ) - pPlayers[uActiveCharacter]->pEquipment.uShield = 0; - if ( v50 )//взять жезл - { - __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[v50 - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); - } - break; -//---------------------------take two hands(взять двумя руками)--------------------------------- - case EQUIP_TWO_HANDED: - if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); - return; - } - if ( v1 )//взять двуручный меч когда нет щита(замещение оружия) - { - if ( v2 ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - --v1; - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); - _this.uBodyAnchor = 2; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v1 + 1; - } - else - { - v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); - if ( v52 >= 0 ) - { - if ( v2 )//взять двуручный меч когда есть щит(замещение щитом) - { - v2--; - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); - _this.uBodyAnchor = 2; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); - pPlayers[uActiveCharacter]->pEquipment.uShield = 0; - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v52 + 1; - } - else - { - pParty->pPickedItem.uBodyAnchor = 2; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v52 + 1; - pMouse->RemoveHoldingItem(); - } - } - } - return; -//------------------------------------------------------------------------------- - default: - pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(uActiveCharacter, 0);//выпить напиток и др. - return; - } - return; - } - - v34 = pRenderer->pActiveZBuffer[pMouse->uMouseClickX + pSRZBufferLineOffsets[pMouse->uMouseClickY]] & 0xFFFF; - if ( v34 ) - { - //v36 = v34 - 1; - //v38 = &pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1]; - pEquipType = pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].GetItemEquipType(); - if ( pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].uItemID == ITEM_WETSUIT ) - { - if ( bUnderwater ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - WetsuitOff(uActiveCharacter); - } - 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; - pSpellInfo->uFlags &= 0x7F; - pSpellInfo->uPlayerID_2 = uActiveCharacter - 1; - pSpellInfo->spell_target_pid = v34 - 1; - pSpellInfo->field_6 = pEquipType; - - ptr_50C9A4_ItemToEnchant = &pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1]; - _50C9A0_IsEnchantingInProgress = 0; - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pMouse->SetCursorBitmap("MICON1"); - _50C9D4_AfterEnchClickEventSecondParam = 0; - _50C9D0_AfterEnchClickEventId = 113; - _50C9D8_AfterEnchClickEventTimeout = 256; - } - else - { - if ( !ptr_50C9A4_ItemToEnchant )//снять вещь - { - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1]); - pPlayers[uActiveCharacter]->pEquipment.pIndices[pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].uBodyAnchor - 1] = 0; - pPlayers[uActiveCharacter]->pInventoryItemList[v34 - 1].Reset(); - } - } - } - else//снять лук - { - if ( pPlayers[uActiveCharacter]->pEquipment.uBow ) - { - _this = pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.uBow - 1]; - pParty->SetHoldingItem(&_this); - _this.Reset(); - pPlayers[uActiveCharacter]->pEquipment.uBow = 0; - } - } -} - -//----- (004196A0) -------------------------------------------------------- -void CharacterUI_ReleaseButtons() -{ - GUIButton *i; // esi@2 - GUIButton *j; // esi@7 - - if ( dword_507CC0_activ_ch ) - { - dword_507CC0_activ_ch = 0; - for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = j ) - { - j = i->pNext; - if ( i->field_1C & 0x8000 ) - { - i->Release(); - free(i); - } - } - for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) - { - if ( j->msg == UIMSG_InventoryLeftClick) - { - j->uX = dword_50698C_uX; - j->uY = dword_506988_uY; - j->uZ = dword_506984_uZ; - j->uW = dword_506980_uW; - pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); - } - } - } -} \ No newline at end of file
--- a/UI/UICharacter.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -#pragma once -void CharacterUI_LoadPaperdollTextures(); -void WetsuitOn(unsigned int uPlayerID); // idb -void WetsuitOff(unsigned int uPlayerID); \ No newline at end of file
--- a/UI/UIGame.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#pragma once -void GameUI_WritePointedObjectStatusString(); -void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb - -__int16 __fastcall sub_441A4E(int a1);
--- a/UI/UIGuilds.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "..\Engine/Objects/Items.h" -#include "..\GUIWindow.h" -#include "..\Engine/mm7_data.h" -#include "..\Engine/texts.h" -#include "UIHouses.h" -#include "..\GUIFont.h" -#include "..\Engine/Graphics/Render.h" -#include "..\Engine/Party.h" -#include "..\Engine/Graphics/Texture.h" -#include "..\Mouse.h" -#include "..\Engine/Events2D.h" -#include "..\AudioPlayer.h" -#include "..\Engine/LOD.h" - -//----- (004B5D7C) -------------------------------------------------------- -void GuildDialog() -{ - signed int base_teach_price; // ebx@1 - int v6; // esi@13 - signed int v7; // esi@17 - int v8; // esi@22 -// const char *statusbar_string; // ecx@26 - int v13; // ecx@30 - ItemGen *v15; // ST18_4@31 - int v17; // eax@31 - char *v18; // edx@31 - int v26; // ecx@47 - GUIButton *pButton; // eax@49 - int pTextHeight; // eax@55 - unsigned __int16 pTextColor; // ax@55 - POINT cursor; // [sp+26Ch] [bp-80h]@30 - GUIWindow working_window; // [sp+274h] [bp-78h]@1 - int v58; // [sp+2D4h] [bp-18h]@1 - bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 - int v61; // [sp+2E0h] [bp-Ch]@35 - unsigned int v62; // [sp+2E4h] [bp-8h]@13 - int pPrice; // [sp+2E8h] [bp-4h]@1 - int all_text_height; - int pX; - - memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); - working_window.uFrameX = 483; - working_window.uFrameWidth = 148; - working_window.uFrameZ = 334; - base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0); - pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < base_teach_price / 3 ) - pPrice = base_teach_price / 3; - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) - { - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, - guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C - 139]) ) - { //you must me member - pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[121].pText, 3); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - return; - } - v61 = 0; - pSkillFlag = false; - all_text_height = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( pDialogueWindow->GetControl(i)->msg_param == 18 ) - { - all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" - v61++; - } - else - { - if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &working_window, 0, 0); - v61++; - pSkillFlag = true; - } - } - } - if ( !v61 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - return; - } - if ( pSkillFlag ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu" - working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - } - v58 = (149 - all_text_height) / v61; - if ( v58 > 32 ) - v58 = 32; - v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( pButton->msg_param == 18 ) - { - pButton->uY = v58 + v26; - pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); - pButton->uHeight = pTextHeight; - v26 = pButton->uY + pTextHeight - 1; - pButton->uW = v26; - pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells" - } - else - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uY = v58 + v26; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0); - pButton->uHeight = pTextHeight; - v26 = pButton->uY + pTextHeight - 1; - pButton->uW = v26; - pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); - } - else - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - } - } - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v6 = 0; - v62 = 0; - for ( pX = 32; pX < 452; pX += 70 )//расположение в верхнем ряду - { - if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID ) - { - pRenderer->DrawTextureTransparent(pX, 90, ItemsInShopTexture[v6]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); - } - v62 += 280; - ++v6; - } - v62 = 1680; - v7 = 6; - for ( pX = 32; pX < 452; pX += 70 )//расположение в нижнем ряду - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) - { - pRenderer->DrawTextureTransparent(pX, 250, ItemsInShopTexture[v7]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); - } - v62 += 280; - ++v7; - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - v8 = 0; - for ( uint i = 0; i < 12; ++i ) - { - if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID > 0 ) - ++v8; - } - GetAsyncKeyState(VK_CONTROL); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);//"Select the Item to Buy" - if ( !v8 ) - { - working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] - pParty->uTimePlayed);//"Приходите через 14 дней" - return; - } - pMouse->GetCursorPos(&cursor); - v13 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; - if ( v13 ) - { - v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C)); - v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); - v18 = BuildDialogueString(pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), v18, 3); - return; - } - } - return; - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pSkillNames[dialog_menu_id-36]); //"You already know the %s skill" - ShowStatusBarString(pTmpBuf.data(), 2); - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - } - else - { - if ( pParty->uNumGold < pPrice ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - } - else - { - Party::TakeGold(pPrice); - pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; - } - } - } - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; -} -//----- (004BC8D5) -------------------------------------------------------- -void SpellBookGenerator()//for GuildDialogs -{ - int pItemNum; // esi@1 - int v4; // esi@7 - - for( int i = 0; i < 12; ++i ) - { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 ) - { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 ) - pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; - else - { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 ) - v4 = rand() % 4; - else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 ) - v4 = rand() % 3 + 4; - else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 ) - v4 = rand() % 2 + 7; - if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 ) - pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400; - } - } - if ( pItemNum == 487 ) - { - if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) - pItemNum = 486; - } - ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; - item_spellbook->Reset(); - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].IsIdentified(); - ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE); - } - return; -} \ No newline at end of file
--- a/UI/UIGuilds.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -#pragma once -void SpellBookGenerator(); \ No newline at end of file
--- a/UI/UIHouses.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3414 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "UIGuilds.h" -#include "UIPartyCreation.h" -#include "UIShops.h" -#include "..\GUIButton.h" -#include "..\Engine/SaveLoad.h" -#include "..\Engine/Graphics/Texture.h" -#include "..\Engine/mm7_data.h" -#include "..\Engine/ErrorHandling.h" -#include "UIHouses.h" -#include "..\Engine/Party.h" -#include "..\Engine/texts.h" -#include "..\Engine/Events.h" -#include "..\Arcomage/Arcomage.h" -#include "..\Engine/LOD.h" -#include "..\Mouse.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\Engine/Graphics/Overlays.h" -#include "..\Engine/Graphics/Outdoor.h" -#include "..\AudioPlayer.h" -#include "..\MediaPlayer.h" -#include "..\Engine/Objects/Monsters.h" -#include "..\Engine/Graphics/Viewport.h" -#include "..\Keyboard.h" -#include "..\Engine/MapInfo.h" -#include "..\Engine/Log.h" -#include "..\Engine/Game.h" -#include "..\Engine/Spells/CastSpellInfo.h" - -#include "../Engine/Graphics/Level/Decoration.h" - -#include "..\Engine/stru159.h" -int uHouse_ExitPic; // weak - -int dword_591080; // weak - -BuildingType in_current_building_type; // 00F8B198 -HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C - -#pragma pack(push, 1) -struct stru365_travel_info -{ - unsigned char uMapInfoID; - unsigned char pSchedule[7]; - unsigned int uTravelTime; - int arrival_x; - int arrival_y; - int arrival_z; - int arrival_rot_y; - unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0 -}; -#pragma pack(pop) -stru365_travel_info transport_schedule[35] = // 004F09B0 -{// location name days x y z - {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 2, -18048, 4636, 833, 1536, 0},//for stable - {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, - {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 2, 4730, -10580, 320, 1024, 0}, - {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, - {MAP_DEYJA, {1, 0, 0, 1, 0, 0, 0}, 3, 7227, -16007, 2625, 640, 0}, - {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 1, 0}, 3, 8923, 17191, 1, 512, 0}, - {MAP_AVLEE, {1, 0, 1, 0, 1, 0, 0}, 3, 17059, 12331, 512, 1152, 0}, - {MAP_DEYJA, {0, 1, 0, 0, 1, 0, 1}, 2, 7227, -16007, 2625, 640, 0}, - {MAP_HARMONDALE, {0, 1, 0, 1, 0, 1, 0}, 2, -5692, 11137, 1, 1024, 0}, - {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 0}, 3, -18048, 4636, 833, 1536, 0}, - {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 2, -2527, -6773, 1153, 896, 0}, - {MAP_STEADWICK, {1, 0, 1, 0, 1, 0, 1}, 3, -18048, 4636, 833, 1536, 0}, - {MAP_HARMONDALE, {0, 1, 0, 0, 0, 1, 0}, 5, -5692, 11137, 1, 1024, 0}, - {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -18048, 4636, 833, 1536, 0}, - {MAP_PIERPONT, {0, 1, 0, 1, 0, 1, 0}, 3, -2527, -6773, 1153, 896, 0}, - {MAP_DEYJA, {0, 0, 1, 0, 0, 0, 1}, 5, 7227, -16007, 2625, 640, 0}, - {MAP_TATALIA, {0, 1, 0, 1, 0, 1, 0}, 2, -2183, -6941, 97, 0, 0}, - {MAP_AVLEE, {1, 0, 0, 0, 1, 0, 0}, 4, 7913, 9476, 193, 0, 0}, - {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 7, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, - {MAP_BRAKADA_DESERT, {0, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, - {MAP_AVLEE, {0, 1, 0, 1, 0, 1, 0}, 3, 7913, 9476, 193, 0, 0}, - {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 6, 19171, -19722, 193, 1024, 0}, - {MAP_TATALIA, {1, 0, 1, 0, 1, 0, 0}, 4, -2183, -6941, 97, 0, 0}, - {MAP_PIERPONT, {0, 0, 0, 0, 0, 1, 0}, 6, -709, -14087, 193, 1024, 0},//for boat - {MAP_STEADWICK, {0, 0, 0, 0, 0, 0, 1}, 6, -10471, 13497, 193, 1536, 0}, - {MAP_EVENMORN_ISLE, {0, 1, 0, 1, 0, 0, 0}, 1, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, - {MAP_BRAKADA_DESERT, {0, 1, 0, 1, 0, 0, 0}, 1, 19171, -19722, 193, 1024, 0}, - {MAP_STEADWICK, {0, 1, 0, 1, 0, 1, 0}, 2, -10471, 13497, 193, 1536, 0}, - {MAP_BRAKADA_DESERT, {1, 0, 1, 0, 0, 0, 0}, 4, 19171, -19722, 193, 1024, 0}, - {MAP_EVENMORN_ISLE, {0, 0, 0, 0, 0, 0, 1}, 5, 15616, 6390, 193, 1536, PARTY_QUEST_EVENMORN_MAP_FOUND}, - {MAP_AVLEE, {0, 0, 0, 0, 1, 0, 0}, 5, 7913, 9476, 193, 0, 0}, - {MAP_STEADWICK, {0, 1, 0, 0, 0, 1, 0}, 4, -10471, 13497, 193, 1536, 0}, - {MAP_PIERPONT, {1, 0, 1, 0, 1, 0, 0}, 3, -709, -14087, 193, 1024, 0}, - {MAP_TATALIA, {0, 0, 0, 1, 0, 0, 0}, 5, -2183, -6941, 97, 0, 0}, - {MAP_ARENA, {0, 0, 0, 0, 0, 0, 1}, 4, 3844, 2906, 193, 512, 0} -}; - -unsigned char transport_routes[20][4] = -{ - { 0, 1, 1, 34}, // HOUSE_STABLES_HARMONDALE - { 2, 3, 4, 5}, // HOUSE_STABLES_STEADWICK - { 6, 7, 8, 8}, // HOUSE_STABLES_TULAREAN_FOREST - { 9, 10, 10, 10}, // HOUSE_STABLES_DEYJA - { 11, 11, 12, 12}, // HOUSE_STABLES_BRACADA_DESERT - { 13, 13, 13, 13}, // HOUSE_STABLES_TATALIA - { 14, 14, 15, 15}, // HOUSE_STABLES_AVLEE - {255, 255, 255, 255}, // HOUSE_STABLES_61 - {255, 255, 255, 255}, // HOUSE_STABLES_62 - {255, 255, 255, 255}, // HOUSE_BOATS_EMERALD_ISLE - { 16, 17, 18, 19}, // HOUSE_BOATS_ERATHIA - { 18, 20, 21, 21}, // HOUSE_BOATS_TULAREAN_FOREST - { 22, 23, 24, 25}, // HOUSE_BOATS_BRACADA_DESERT - { 22, 22, 23, 23}, // HOUSE_BOATS_EVENMORN_ISLAND - {255, 255, 255, 255}, // HOUSE_BOATS_68 - { 27, 28, 29, 30}, // HOUSE_BOATS_TATALIA - { 31, 32, 33, 33}, // HOUSE_BOATS_AVLEE - { 24, 24, 24, 24}, // HOUSE_BOATS_71 - {255, 255, 255, 255}, // HOUSE_BOATS_72 - {255, 255, 255, 255} // HOUSE_BOATS_73 -}; - -std::array<const stru159, 196> pAnimatedRooms = //0x4E5F70 -{{ - {"", 0x4, 0x1F4, 0, 0, 0}, - {"Human Armor01", 0x20, 0x2C0, 2, 58, 0}, - {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 }, - {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 }, - {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 }, - {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 }, - {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 }, - {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 }, - {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 }, - {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 }, - {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 }, - {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 }, - {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 }, - {"Human Bank01", 0x6, 0x384, 22, 52, 0 }, - {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 }, - {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 }, - {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 }, - {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 }, - {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 }, - {"Boat01", 0xF, 0x4C, 28, 53, 3 }, - {"Boat01d", 0xF, 0x4C, 28, 53, 3 }, - {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 }, - {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 }, - {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 }, - {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 }, - {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 }, - {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 }, - {"Human Stables01", 0x21, 0x31, 27, 48, 3 }, - {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 }, - {"", 0x21, 0x2F0, 27, 91, 3 }, - {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 }, - {"Warlock Stables", 0x21, 0x181, 27, 77, 3 }, - {"Elf Stables", 0x21, 0x195, 27, 77, 3 }, - {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 }, - {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 }, - {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 }, - {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 }, - {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 }, - {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 }, - {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 }, - {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 }, - {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 }, - {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 }, - {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 }, - {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 }, - {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 }, - {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 }, - {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 }, - {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 }, - {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 }, - {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 }, - {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 }, - {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 }, - {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 }, - {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 }, - {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 }, - {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 }, - {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 }, - {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 }, - {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 }, - {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 }, - {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 }, - {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 }, - {"Air Guild", 0x1D, 0xA4, 6, 1, 3 }, - {"Body Guild", 0x19, 0x3BF, 11, 2, 0 }, - {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 }, - {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 }, - {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 }, - {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 }, - {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 }, - {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 }, - {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 }, - {"Lord And Judge Out01", 1, 0, 29, 39, 0 }, - {"Human Poor House 1", 8, 0, 29, 0, 0 }, - {"Human Poor House 2", 8, 0, 29, 0, 0 }, - {"Human Poor House 3", 8, 0, 29, 0, 0 }, - {"Human Medium House 1", 8, 0, 29, 0, 0 }, - {"Human Medium House 2", 8, 0, 29, 0, 0 }, - {"Human Medium House 3", 8, 0, 29, 0, 0 }, - {"Human Rich House 1", 8, 0, 29, 0, 0 }, - {"Human Rich House 2", 8, 0, 29, 0, 0 }, - {"Human Rich House 3", 8, 0, 29, 0, 0 }, - {"Elven Poor House 1", 8, 0, 29, 0, 0 }, - {"Elven Poor House 2", 8, 0, 29, 0, 0 }, - {"Elven Poor House 3", 8, 0, 29, 0, 0 }, - {"Elven Medium House 1", 8, 0, 29, 0, 0 }, - {"Elven Medium House 2", 8, 0, 29, 0, 0 }, - {"Elven Medium House 3", 8, 0, 29, 0, 0 }, - {"Elven Rich House 1", 8, 0, 29, 0, 0 }, - {"Elven Rich House 2", 8, 0, 29, 0, 0 }, - {"Elven Rich House 3", 8, 0, 29, 0, 0 }, - {"Dwarven Poor House 1", 8, 0, 29, 0, 0 }, - {"Dwarven Poor House 2", 8, 0, 29, 0, 0 }, - {"Dwarven Poor House 3", 8, 0, 29, 0, 0 }, - {"Dwarven Medium House 1", 8, 0, 29, 0, 0 }, - {"Dwarven Medium house 2", 8, 0, 29, 0, 0 }, - {"Dwarven Medium House 3", 8, 0, 29, 0, 0 }, - {"Dwarven Rich House 1", 8, 0, 29, 0, 0 }, - {"Dwarven Rich House 2", 8, 0, 29, 0, 0 }, - {"Dwarven Rich House 3", 8, 0, 29, 0, 0 }, - {"Wizard Poor House 1", 8, 0, 29, 0, 0 }, - {"Wizard Poor House 2", 8, 0, 29, 0, 0 }, - {"Wizard Poor House 3", 8, 0, 29, 0, 0 }, - {"Wizard Medium House 1", 8, 0, 29, 0, 0 }, - {"Wizard Medium House 2", 8, 0, 29, 0, 0 }, - {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 }, - {"Wizard Rich House 1", 8, 0, 29, 0, 0 }, - {"Wizard Rich House 2", 8, 0, 29, 0, 0 }, - {"Wizard Rich House 3", 8, 0, 29, 0, 0 }, - {"Necromancer Poor House 1", 8, 0, 29, 0, 0 }, - {"Necromancer Poor House 2", 8, 0, 29, 0, 0 }, - {"Necromancer Poor House 3", 8, 0, 29, 0, 0 }, - {"Necromancer Medium House 1", 8, 0, 29, 0, 0 }, - {"Necromancer Medium House 2", 8, 0, 29, 0, 0 }, - {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 }, - {"Necromancer Rich House 1", 8, 0, 29, 0, 0 }, - {"Necromancer Rich House 2", 8, 0, 29, 0, 0 }, - {"Necromancer Rich House 3", 8, 0, 29, 0, 0 }, - {"Warlock Poor House 1", 8, 0, 29, 0, 0 }, - {"Warlock Poor House 2", 8, 0, 29, 0, 0 }, - {"Warlock Poor House 3", 8, 0, 29, 0, 0 }, - {"Warlock Medium House 1", 8, 0, 29, 0, 0 }, - {"Warlock Medium House 2", 8, 0, 29, 0, 0 }, - {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 }, - {"Warlock Rich House 1", 8, 0, 29, 0, 0 }, - {"Warlock Rich House 2", 8, 0, 29, 0, 0 }, - {"Warlock Rich House 3", 8, 0, 29, 0, 0 }, - {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 }, - {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 }, - {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 }, - {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 }, - {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 }, - {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 }, - {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 }, - {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 }, - {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 }, - {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 }, - {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 }, - {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 }, - {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 }, - {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 }, - {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 }, - {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 }, - {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 }, - {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 }, - {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 }, - {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 }, - {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 }, - {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 }, - {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 }, - {"Out10 The Maze", 0x24, 0, 25, 0, 0 }, - {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, - {"", 0x24, 0, 25, 0, 0 }, - {"", 0x24, 0, 25, 0, 0 }, - {"Out11 Stone City", 0x24, 0, 25, 0, 0 }, - {"", 0x24, 0, 25, 0, 0 }, - {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 }, - {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, - {"", 0x24, 0, 25, 0, 0 }, - {"", 0x24, 0, 25, 0, 0 }, - {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 }, - {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 }, - {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 }, - {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 }, - {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 }, - {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 }, - {"Out15 The Linclon", 0x24, 0, 25, 0, 0 }, - {"Jail", 0x24, 0, 31, 0, 0 }, - {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 }, - {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 }, - {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 }, - {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 }, - {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 }, - {"Master Thief", 0x24, 0, 29, 0, 0 }, - {"Dwarven King", 0x24, 0, 20, 0, 0 }, - {"Arms Master", 0x24, 0, 29, 0, 0 }, - {"Warlock", 0x24, 0, 29, 0, 0 }, - {"Lord Markam", 0x24, 0, 20, 0, 0 }, - {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 }, - {"Arbiter Good Town", 0x24, 0, 29, 0, 0 }, - {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 }, - {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 }, - {"", 0x24, 0, 29, 0, 0 }, - {"", 0x24, 0, 29, 0, 0 }, - {"", 0x24, 0, 29, 0, 0 }, - {"", 0x24, 0, 29, 0, 0 }, - {"Boat01", 0xF, 0, 29, 53, 3 }, - {"", 0x24, 0, 28, 0, 0 }, - {"", 0x24, 0, 28, 0, 0 }, - {"", 0x24, 0, 28, 0, 0 }, - {"", 0x24, 0, 29, 0, 0 }, - {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 }, - {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, - {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, - {"Player Castle Good", 0x24, 0, 25, 0, 0 }, - {"Player Castle Bad", 0x24, 0, 25, 0, 0} -}}; - - - -//----- (004B3A72) -------------------------------------------------------- -void InitializaDialogueOptions_Tavern(BuildingType type) -{ - int num_buttons; // esi@1 - - num_buttons = 0; - if (type == BuildingType_Tavern) - { - num_buttons = 2; - CreateButtonInColumn(0, 102); - CreateButtonInColumn(1, 103); - if ( pParty->HasItem(651) ) //Arcomage Deck - { - num_buttons = 3; - CreateButtonInColumn(2, 104); - } - } - pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; -} -// F8B1E0: using guessed type int dword_F8B1E0; - -//----- (004B3AD4) -------------------------------------------------------- -void InitializaDialogueOptions_Shops(BuildingType type) -{ - switch (type) - { - case BuildingType_WeaponShop: - case BuildingType_ArmorShop: - case BuildingType_MagicShop: - { - CreateButtonInColumn(0, 3); - CreateButtonInColumn(1, 4); - CreateButtonInColumn(2, 5); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_AlchemistShop: - { - CreateButtonInColumn(0, 3); - CreateButtonInColumn(1, 4); - pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); - } - break; - } - - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; -} -// F8B1E0: using guessed type int dword_F8B1E0; - -//----- (004B3B42) -------------------------------------------------------- -void InitializaDialogueOptions(BuildingType type) -{ - switch (type) - { - case BuildingType_WeaponShop: - case BuildingType_ArmorShop: - case BuildingType_MagicShop: - case BuildingType_AlchemistShop: - { - CreateButtonInColumn(0, 2); - CreateButtonInColumn(1, 95); - CreateButtonInColumn(2, 94); - CreateButtonInColumn(3, 96); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); - } - break; - - case BuildingType_FireGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 48); - CreateButtonInColumn(2, 72); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_AirGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 49); - CreateButtonInColumn(2, 72); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_WaterGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 50); - CreateButtonInColumn(2, 72); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_EarthGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 51); - CreateButtonInColumn(2, 72); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_SpiritGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 52); - CreateButtonInColumn(2, 61); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_MindGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 53); - CreateButtonInColumn(2, 61); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_BodyGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 54); - CreateButtonInColumn(2, 61); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_LightGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 55); - pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); - } - break; - - case BuildingType_DarkGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 56); - pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); - } - break; - - case BuildingType_ElementalGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 48); - CreateButtonInColumn(2, 49); - CreateButtonInColumn(3, 50); - CreateButtonInColumn(4, 51); - pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2); - } - break; - - case BuildingType_SelfGuild: - { - CreateButtonInColumn(0, 18); - CreateButtonInColumn(1, 52); - CreateButtonInColumn(2, 53); - CreateButtonInColumn(3, 54); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); - } - break; - - case BuildingType_16: - case BuildingType_TownHall: - { - int num_buttons = 1; - CreateButtonInColumn(0, 99); - - if (pParty->uFine) - { - num_buttons++; - CreateButtonInColumn(1, 100); - } - - pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); - } - break; - - case BuildingType_Bank: - { - CreateButtonInColumn(0, 7); - CreateButtonInColumn(1, 8); - pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); - } - break; - - case BuildingType_Temple: - { - CreateButtonInColumn(0, 10); - CreateButtonInColumn(1, 11); - CreateButtonInColumn(2, 96); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - break; - - case BuildingType_Stables: - case BuildingType_Boats: - { - CreateButtonInColumn(0, 105); - CreateButtonInColumn(1, 106); - CreateButtonInColumn(2, 107); - CreateButtonInColumn(3, 108); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); - } - break; - - case BuildingType_Training: - { - CreateButtonInColumn(0, 17); - CreateButtonInColumn(1, 96); - pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); - } - break; - - case BuildingType_Tavern: - { - CreateButtonInColumn(0, 0xFu); - CreateButtonInColumn(1, 0x10u); - CreateButtonInColumn(2, 0x60u); - if ( (signed int)window_SpeakInHouse->ptr_1C < 108 || (signed int)window_SpeakInHouse->ptr_1C > 120 ) - { - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - break; - } - CreateButtonInColumn(3, 101); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); - } - break; - - case BuildingType_18: - case BuildingType_19: - case BuildingType_Throne_Room: - case BuildingType_24: - case BuildingType_Unic: - case BuildingType_1A: - case BuildingType_House: - case BuildingType_Jail: - break; - - default: - Error("Invalid enumeration value: %u", type); - } - -/* if ( a1 > 13 ) - { - if ( a1 > 22 ) - { - if ( a1 == 23 ) - { - CreateButtonInColumn(0, 0xAu); - CreateButtonInColumn(1, 0xBu); - v14 = 96; -LABEL_41: - CreateButtonInColumn(2, v14); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 3; - goto LABEL_42; - } - if ( a1 <= 26 ) - goto LABEL_43; - if ( a1 > 28 ) - { - if ( a1 != 30 ) - goto LABEL_43; - CreateButtonInColumn(0, 0x11u); - v16 = 96; - goto LABEL_37; - } - CreateButtonInColumn(0, 0x69u); - CreateButtonInColumn(1, 0x6Au); - CreateButtonInColumn(2, 0x6Bu); - v12 = 108; - } - else - { - if ( a1 == 22 ) - { - CreateButtonInColumn(0, 7u); - v16 = 8; - goto LABEL_37; - } - v1 = a1 - 14; - if ( !v1 ) // == 14 - { - CreateButtonInColumn(0, 0x12u); - CreateButtonInColumn(1, 0x30u); - CreateButtonInColumn(2, 0x31u); - CreateButtonInColumn(3, 0x32u); - CreateButtonInColumn(4, 0x33u); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 5; - goto LABEL_42; - } - v2 = v1 - 1; - if ( v2 ) // > 15 - { - v3 = v2 - 2; - if ( v3 ) // > 17 - { - if ( v3 != 4 ) // 18, 19, 20 - goto LABEL_43; - CreateButtonInColumn(0, 0xFu); // 21 - CreateButtonInColumn(1, 0x10u); - v4 = 3; - CreateButtonInColumn(2, 0x60u); - v5 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v5 < 108 || v5 > 120 ) - goto LABEL_28; - v4 = 4; - v6 = 101; - v7 = 3; - } - else // 16, 17 - { - v4 = 1; - CreateButtonInColumn(0, 0x63u); - if ( !pParty->uFine ) - { -LABEL_28: - v17 = 2; - v11 = 0; - v10 = 1; - v9 = v4; -LABEL_42: - pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); - goto LABEL_43; - } - v4 = 2; - v7 = 1; - v6 = 100; - } - CreateButtonInColumn(v7, v6); - goto LABEL_28; - } - CreateButtonInColumn(0, 0x12u); // 15 - CreateButtonInColumn(1, 0x34u); - CreateButtonInColumn(2, 0x35u); - v12 = 54; - } -LABEL_39: - CreateButtonInColumn(3, v12); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 4; - goto LABEL_42; - } - if ( a1 == 13 ) - { - CreateButtonInColumn(0, 0x12u); - v16 = 56; -LABEL_37: - CreateButtonInColumn(1, v16); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 2; - goto LABEL_42; - } - switch ( a1 ) - { - case 1: - case 2: - case 3: - case 4: - CreateButtonInColumn(0, 2u); - CreateButtonInColumn(1, 0x5Fu); - CreateButtonInColumn(2, 0x5Eu); - v12 = 96; - goto LABEL_39; - case 5: - CreateButtonInColumn(0, 0x12u); - v13 = 48; - goto LABEL_9; - case 6: - CreateButtonInColumn(0, 0x12u); - v13 = 49; - goto LABEL_9; - case 7: - CreateButtonInColumn(0, 0x12u); - v13 = 50; - goto LABEL_9; - case 8: - CreateButtonInColumn(0, 0x12u); - v13 = 51; -LABEL_9: - CreateButtonInColumn(1, v13); - v14 = 72; - goto LABEL_41; - case 9: - CreateButtonInColumn(0, 0x12u); - v15 = 52; - goto LABEL_13; - case 10: - CreateButtonInColumn(0, 0x12u); - v15 = 53; - goto LABEL_13; - case 11: - CreateButtonInColumn(0, 0x12u); - v15 = 54; -LABEL_13: - CreateButtonInColumn(1, v15); - v14 = 61; - goto LABEL_41; - case 12: - CreateButtonInColumn(0, 0x12u); - v16 = 55; - goto LABEL_37; - default: - break; - } -LABEL_43:*/ - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; -} -// F8B1E0: using guessed type int dword_F8B1E0; - - -//----- (004B1784) -------------------------------------------------------- -bool HouseUI_CheckIfPlayerCanInteract() -{ - GUIWindow window; // [sp+4h] [bp-54h]@3 - - if ( pPlayers[uActiveCharacter]->CanAct() ) - { - pDialogueWindow->pNumPresenceButton = dword_F8B1E0; - return true; - } - else - { - pDialogueWindow->pNumPresenceButton = 0; - memcpy(&window, pPrimaryWindow, sizeof(window)); - window.uFrameX = 483; - window.uFrameWidth = 148; - window.uFrameZ = 334; - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, - pGlobalTXT_LocalizationStrings[562]); // "%s is in no condition to %s""do anything" - window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &window, 0, 0)) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3); - return false; - } -} - -//----- (0044622E) -------------------------------------------------------- -bool EnterHouse(enum HOUSE_ID uHouseID) -{ - signed int uOpenTime; // eax@5 - signed int uCloseTime; // esi@5 -// unsigned int v5; // esi@5 -// int v6; // edx@5 - signed int am_pm_flag_open; // ecx@10 - signed int am_pm_flag_close; // eax@10 -// int v9; // esi@10 -// int v11; // ecx@17 -// unsigned int v12; // kr00_4@25 -// int v14; // eax@25 - unsigned int v17; // eax@37 - signed int v18; // edi@37 - signed int v19; // edi@41 - char pContainer[40]; // [sp+Ch] [bp-30h]@32 -// unsigned int v24; // [sp+34h] [bp-8h]@5 - - GameUI_Footer_TimedString[0] = 0; - pFooterString[0] = 0; - ShowStatusBarString("", 2); - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - viewparams->bRedrawGameUI = 1; - uDialogueType = 0; - pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); - pKeyActionMap->ResetKeys(); - if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) - { - GameOverMenu(0); - return 0; - } - uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; - uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; - current_npc_text = 0; - dword_F8B1E4 = 0; - memset(byte_F8B1F0.data(), 0, 4); - memset(player_levels.data(), 0, 16); - pRenderer->ClearZBuffer(0, 479); - - if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| - ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) - - { - am_pm_flag_open = 0; - am_pm_flag_close = 0; - if (uOpenTime > 12 ) - { - uOpenTime -= 12; - am_pm_flag_open = 1; - } - if ( uCloseTime > 12 ) - { - uCloseTime -= 12; - am_pm_flag_close = 1; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], - uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" - ShowStatusBarString(pTmpBuf.data(), 2u); - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); - return 0; - } - else - { - //v10 = uHouseID; - if ( (signed int)uHouseID < 53 ) //entering shops and guilds - { - if ( !(pParty->PartyTimes._shop_ban_times[uHouseID]) - || (pParty->PartyTimes._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) - { - pParty->PartyTimes._shop_ban_times[uHouseID] = 0; - } - else - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" - return 0; - } - } - pAudioPlayer->StopChannels(-1, -1); - - uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; - in_current_building_type = (BuildingType)pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; - if ( in_current_building_type == BuildingType_Throne_Room && pParty->uFine ) // going 2 jail - { - uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; - uHouseID = HOUSE_JAIL; - pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000; - in_current_building_type = (BuildingType)pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; - ++pParty->uNumPrisonTerms; - pParty->uFine = 0; - for (uint i = 0; i < 4; ++i) - { - pParty->pPlayers[i].uTimeToRecovery = 0; - pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; - pParty->pPlayers[i].SetVariable(VAR_Award, 87); - } - } - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; - default: Error("Invalid alignment type: %u", pParty->alignment); - } - - v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - pDialogueNPCCount = 0; - pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; - uTextureID_right_panel_loop = uTextureID_right_panel; - PrepareHouse(uHouseID); - v18 = 1; - uTextureID_right_panel_loop = uTextureID_right_panel; - if ( uNumDialogueNPCPortraits == 1 ) - pDialogueNPCCount = 1; - pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); - dword_5C35D4 = 1; - if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) - { - if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) ) - { - return 1; - } - } - else - { //guilds - v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags - //v20 = uHouseID; - //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) - if(!_449B57_test_bit(pPlayers[uActiveCharacter]->_achieved_awards_bits,v19)) - { - PlayHouseSound(uHouseID, HouseSound_Greeting_2); - return 1; - } - } - PlayHouseSound(uHouseID, HouseSound_Greeting); - dword_5C35D4 = 1; - return 1; - } - } - -//----- (0044606A) -------------------------------------------------------- -void PrepareHouse(HOUSE_ID house) -{ - __int16 uExitMapID; // ax@2 -// int v7; // ebx@11 -// int v13; // [sp+30h] [bp-30h]@11 - int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1 - int uAnimationID; // [sp+50h] [bp-10h]@1 - - - uAnimationID = p2DEvents[house - 1].uAnimationID; - memset(npc_id_arr, 0, sizeof(npc_id_arr)); - uNumDialogueNPCPortraits = 0; - uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; - if ( uHouse_ExitPic ) - { - uExitMapID = p2DEvents[house - 1]._quest_related; - if ( uExitMapID > 0 ) - { - if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) - { - uHouse_ExitPic = 0; - } - } - } - - dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id; - HouseNPCData[0]=0; - uNumDialogueNPCPortraits = 0; - if ( dword_591080 ) - { - - npc_id_arr[0] = dword_591080; - uNumDialogueNPCPortraits = 1; - } - - for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i) - { - if (pNPCStats->pNewNPCData[i].Location2D == house ) - { - if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80)) - { - HouseNPCData[uNumDialogueNPCPortraits+1-((dword_591080 != 0) ? 1 : 0) ] = &pNPCStats->pNewNPCData[i]; - npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID; - ++uNumDialogueNPCPortraits; - if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2) - ++pNPCStats->pNewNPCData[i].uFlags; - } - } - - } - - for (int i = 0; i < uNumDialogueNPCPortraits; ++i) - { - - char icon_name[128]; - sprintfex(icon_name, "npc%03u", npc_id_arr[i]); - pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); - } - - if (uHouse_ExitPic) - { - pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); - ++uNumDialogueNPCPortraits; - uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; - } -} -//----- (004B1E92) -------------------------------------------------------- -void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) -{ - if ( pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId ) - pAudioPlayer->PlaySound((SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID].uAnimationID].uRoomSoundId + 300)), - 806, 0, -1, 0, 0, 0, 0); -} - -//----- (004BCACC) -------------------------------------------------------- -void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) -{ - int experience_for_next_level; // eax@5 - int v16; // eax@32 - __int16 v24; // ax@163 - signed int v36; // esi@227 - int pPrice; // ecx@227 - - if ( !pDialogueWindow->pNumPresenceButton ) - return; - pRenderer->ClearZBuffer(0, 479); - if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - if ( in_current_building_type == BuildingType_Training ) - { - if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) - { - experience_for_next_level = 0; - if ( pPlayers[uActiveCharacter]->uLevel > 0 ) - { - for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) - experience_for_next_level += i + 1; - } - if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && - (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level)//test experience - return; - } - pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); - } - if ( in_current_building_type != BuildingType_Training ) - { - if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && - transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] - || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) - { - pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 345, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); - } - else if (uActiveCharacter) - { - if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) - return; - } - } - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - if ( in_current_building_type < BuildingType_19 ) - ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; - } - - //NEW - switch (in_current_building_type) - { - case BuildingType_FireGuild: - case BuildingType_AirGuild: - case BuildingType_WaterGuild: - case BuildingType_EarthGuild: - case BuildingType_SpiritGuild: - case BuildingType_MindGuild: - case BuildingType_BodyGuild: - case BuildingType_LightGuild: - case BuildingType_DarkGuild: - case BuildingType_ElementalGuild: - case BuildingType_SelfGuild: - case BuildingType_16: - { - if ( pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] >= (signed __int64)pParty->uTimePlayed ) - { - for ( uint i = 0; i < 12; ++i ) - { - if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID ) - ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; - } - } - else//generation new books - { - SpellBookGenerator(); - pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 - * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); - } - break; - } - case BuildingType_TownHall: - { - if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) - { - if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation - { - pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; - pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); - pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; - v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); - if ( !v16 ) - { - while ( 1 ) - { - v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; - if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) - { - if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) - && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) - && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) - break; - } - pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; - } - } - if ( v16 == 1 ) - { - while ( 1 ) - { - v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; - if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) - { - if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0x52u || (unsigned __int16)v24 > 0x54u) - && ((unsigned __int16)v24 < 4 || (unsigned __int16)v24 > 6) - && ((unsigned __int16)v24 < 0x37u || (unsigned __int16)v24 > 0x39u) - && ((unsigned __int16)v24 < 0x3Au || (unsigned __int16)v24 > 0x3Cu) - && ((unsigned __int16)v24 < 0x3Du || (unsigned __int16)v24 > 0x3Fu) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) - && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) ) - break; - } - pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; - } - } - if ( v16 == 2 ) - { - while ( 1 ) - { - v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) - { - if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0x31u || (unsigned __int16)v24 > 0x33u) - && ((unsigned __int16)v24 < 0x34u || (unsigned __int16)v24 > 0x36u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) - && ((unsigned __int16)v24 < 0x1Cu || (unsigned __int16)v24 > 0x1Eu) ) - break; - } - pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; - } - } - if ( v16 == 3 ) - { - while ( 1 ) - { - v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) - { - if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) - && ((unsigned __int16)v24 < 0x43u || (unsigned __int16)v24 > 0x45u) - && ((unsigned __int16)v24 < 0x4Fu || (unsigned __int16)v24 > 0x51u) - && ((unsigned __int16)v24 < 0xC1u || (unsigned __int16)v24 > 0xC3u) - && ((unsigned __int16)v24 < 0x13u || (unsigned __int16)v24 > 0x15u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) - && ((unsigned __int16)v24 < 0x6Au || (unsigned __int16)v24 > 0x6Cu) ) - break; - } - pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; - } - } - if ( v16 == 4 ) - { - while ( 1 ) - { - v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) - { - if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) - && ((unsigned __int16)v24 < 0x46u || (unsigned __int16)v24 > 0x48u) - && ((unsigned __int16)v24 < 0x100u || (unsigned __int16)v24 > 0x102u) - && ((unsigned __int16)v24 < 0xD9u || (unsigned __int16)v24 > 0xDBu) - && ((unsigned __int16)v24 < 0xC7u || (unsigned __int16)v24 > 0xC9u) - && ((unsigned __int16)v24 < 0xE5u || (unsigned __int16)v24 > 0xE7u) - && ((unsigned __int16)v24 < 0xDFu || (unsigned __int16)v24 > 0xE1u) - && ((unsigned __int16)v24 < 0x5Bu || (unsigned __int16)v24 > 0x5Du) - && ((unsigned __int16)v24 < 0x49u || (unsigned __int16)v24 > 0x4Bu) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) - && ((unsigned __int16)v24 < 0x10u || (unsigned __int16)v24 > 0x12u) ) - break; - } - pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; - } - } - } - bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; - if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) - { - bountyHunting_text = pNPCTopics[351].pText;//"В этом месяцу назначена награда за голову %s..." - if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) - bountyHunting_text = pNPCTopics[353].pText;//"Кое кто уже приходил в этом месяце за наградой" - } - else - { - if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize - { - pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); - for ( uint i = 0; i < 4; ++i ) - pParty->pPlayers[i].SetVariable(VAR_Award, 86); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; - pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; - pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; - } - bountyHunting_text = pNPCTopics[352].pText;//"Поздравляю! Вы успешно..." - } - } - else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) - pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); - break; - } - case BuildingType_Bank: - { - if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) - pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); - return; - break; - } - case BuildingType_WeaponShop: - case BuildingType_ArmorShop: - case BuildingType_MagicShop: - case BuildingType_AlchemistShop: - case BuildingType_Tavern: - case BuildingType_Temple: - case BuildingType_Training: - { - break; - } - default: - { - return; - break; - } - } - - switch ( uMessageParam ) - { - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - FillAviableSkillsToTeach(in_current_building_type); - break; - } - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - InitializaDialogueOptions_Tavern(in_current_building_type); - break; - } - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - break; - } - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: - { - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_PlayArcomage, 0, 0); - dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; - break; - } - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - if ( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] < (signed __int64)pParty->uTimePlayed ) - { - GenerateStandartShopItems(); - GenerateSpecialShopItems(); - pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); - } - if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) - { - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) - { - if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID ) - ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; - } - } - if ( in_current_building_type == BuildingType_WeaponShop ) - { - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) - { - if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID) - weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); - } - } - } - } - if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) - { - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) - { - if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) - ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; - } - } - if ( in_current_building_type == BuildingType_WeaponShop ) - { - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); - } - } - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_SELL: - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); - break; - } - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - InitializaDialogueOptions_Shops(in_current_building_type); - break; - } - default: - { - if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) - { - v36 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pPrice = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < v36 / 3 ) - pPrice = v36 / 3; - if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam - 36]) - { - if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) - { - if ( pParty->uNumGold < pPrice ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - else - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - } - else - { - Party::TakeGold(pPrice); - dword_F8B1E4 = 1; - pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); - } - } - } - } - break; - } - } -} -//----- (004B6943) -------------------------------------------------------- -void TravelByTransport() -{ - signed int v4; // ebx@1 - stru365_travel_info *pTravel; // esi@7 - signed int v12; // esi@13 - signed int v13; // edi@14 - DWORD v14; // eax@26 - DWORD v15; // edi@26 - int pTextHeight; // eax@36 - int pRealTextHeight; // esi@36 - int schedule_id; // esi@39 - GUIButton *pButton; // ebx@39 - signed int v25; // eax@41 - MapInfo pMap; // [sp-3Ch] [bp-2CCh]@62 - char pTopicArray[5][100]; // [sp+14h] [bp-27Ch]@37 - GUIWindow travel_window; // [sp+208h] [bp-88h]@1 - int pPrimaryTextHeight; // [sp+260h] [bp-30h]@36 - int index; // [sp+27Ch] [bp-14h]@36 - unsigned int pPrice; // [sp+288h] [bp-8h]@1 - int travel_time; // [sp+28Ch] [bp-4h]@48 - enum PlayerSpeech pSpeech; - unsigned int pCurrentButton; - - memcpy(&travel_window, window_SpeakInHouse, sizeof(travel_window)); - travel_window.uFrameX = 483; - travel_window.uFrameWidth = 148; - travel_window.uFrameZ = 334; - - v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50; - v4 *= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - - pPrice = v4 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( (signed int)pPrice < v4 / 3 ) - pPrice = v4 / 3; - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - index = 0; - strcpy(pTopicArray[4], ""); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], pPrice); // Price: %lu gold - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &travel_window, 0, 0); - pRealTextHeight = pTextHeight + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; - pPrimaryTextHeight = pRealTextHeight; - pCurrentButton = 2; - for ( uint i = pDialogueWindow->pStartingPosActiveItem; i < (unsigned int)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); ++i ) - { - schedule_id = transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][index]; - pButton = pDialogueWindow->GetControl(i); - - if (schedule_id != 255) - { - //if (schedule_id >= 25) - //Log::Warning(L"Transport UI: schedule overflow"); - if ( pCurrentButton >= 6 ) - v25 = true; - else - v25 = transport_schedule[schedule_id].pSchedule[pParty->uDaysPlayed % 7]; - } - - if (schedule_id != 255 && v25 && (!transport_schedule[schedule_id].uQuestBit - || _449B57_test_bit(pParty->_quest_bits, transport_schedule[schedule_id].uQuestBit)) )//ошибка: рисуется несколько строчек одного направления путешествия - { - //get color for current string(определение цвета текущей строки)---------- - if ( pDialogueWindow->pCurrentPosActiveItem == pCurrentButton ) - sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 155)); - else - sprintf(pTopicArray[index], "\f%05d", Color16(255, 255, 255)); - //hired NPC premium(премия наёмного НПС)---------------------------------- - travel_time = transport_schedule[schedule_id].uTravelTime; - if ( (unsigned int)window_SpeakInHouse->ptr_1C >= HOUSE_BOATS_EMERALD_ISLE ) - { - if ( CheckHiredNPCSpeciality(Sailor) ) - travel_time -= 2; - if ( CheckHiredNPCSpeciality(Navigator) ) - travel_time -= 3; - if ( CheckHiredNPCSpeciality(Pirate) ) - travel_time -= 2; - } - else - { - if ( CheckHiredNPCSpeciality(Horseman) ) - travel_time -= 2; - } - if ( CheckHiredNPCSpeciality(Explorer) ) - --travel_time; - - if ( travel_time < 1 ) - travel_time = 1; - if ( schedule_id != 255 ) - { - memcpy(&pMap, &pMapStats->pInfos[transport_schedule[schedule_id].uMapInfoID], 0x44u); - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], travel_time, pMap.pName); // Time - %d days, destination %s - strcat(pTopicArray[index], pTmpBuf.data()); - strcat(pTopicArray[index], "\n \n"); - pButton->uY = pRealTextHeight; - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0); - pButton->uHeight = pTextHeight; - pButton->uW = pButton->uY + pTextHeight - 1; - pRealTextHeight += (LOBYTE(pFontArrus->uFontHeight) - 3) + pTextHeight; - } - } - else - { - strcpy(pTopicArray[index], ""); - if ( pButton ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - } - ++index; - ++pCurrentButton; - } - if ( pRealTextHeight != pPrimaryTextHeight ) - { - sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), pTopicArray[0], pTopicArray[1], pTopicArray[2], pTopicArray[3], pTopicArray[4]); - travel_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); - } - else - { - travel_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &travel_window, 0, 0)) / 2 + 138,//"Извините, приходите в другой день" - Color16(255, 255, 255), pGlobalTXT_LocalizationStrings[561], 3); - pAudioPlayer->StopChannels(-1, -1); - } - } - } - else//после нажатия топика - { - if ( dialog_menu_id >= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 && dialog_menu_id <= HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 ) - { - if ( pParty->uNumGold < pPrice ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - - Party::TakeGold(pPrice); - - pTravel = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]]; - if ( pTravel->pSchedule[pParty->uDaysPlayed % 7] ) - { - if ( _stricmp(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename) ) - { - SaveGame(1, 0); - strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename); - - dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001; - _5B65B8_npcdata_hiword_house_or_other = 0; - dword_5B65BC = 0; - _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y; - uGameState = GAME_STATE_CHANGE_LOCATION; - _5B65A8_npcdata_uflags_or_other = pTravel->arrival_x; - _5B65AC_npcdata_fame_or_other = pTravel->arrival_y; - _5B65B0_npcdata_rep_or_other = pTravel->arrival_z; - dword_5B65C0 = pTravel->arrival_x | pTravel->arrival_y | pTravel->arrival_z | pTravel->arrival_rot_y; - } - else - { - pGame->pIndoorCameraD3D->sRotationY = 0; - - pParty->uFlags |= 2u; - pParty->vPosition.x = pTravel->arrival_x; - pParty->vPosition.y = pTravel->arrival_y; - pParty->vPosition.z = pTravel->arrival_z; - pParty->uFallStartY = pParty->vPosition.z; - pParty->sRotationX = 0; - pParty->sRotationY = pTravel->arrival_rot_y; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - v12 = pTravel->uTravelTime; - if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) - { - pSpeech = SPEECH_SetSail; - v13 = 2500; - if ( CheckHiredNPCSpeciality(Sailor) ) - v12 -= 2; - if ( CheckHiredNPCSpeciality(Navigator) ) - v12 -= 3; - if ( CheckHiredNPCSpeciality(Pirate) ) - v12 -= 2; - } - else - { - pSpeech = SPEECH_CarriageReady; - v13 = 1500; - if ( CheckHiredNPCSpeciality(Horseman) ) - v12 -= 2; - } - if ( CheckHiredNPCSpeciality(Explorer) ) - --v12; - if ( v12 < 1 ) - v12 = 1; - RestAndHeal(1440 * v12); - pPlayers[uActiveCharacter]->PlaySound(pSpeech, 0); - v14 = GetTickCount(); - v15 = v14 + v13; - if ( v15 < v14 ) - v15 = v14; - while ( GetTickCount() < v15 ) - sqrt(3.1415926); - while ( HouseDialogPressCloseBtn() ) - ; - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); - return; - } - else - { - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - } - } - } -} -//----- (004B68EA) -------------------------------------------------------- -bool __fastcall IsTravelAvailable(int a1) -{ - for ( uint i = 0; i < 4; ++i ) - { - if ( transport_schedule[transport_routes[a1][i]].pSchedule[pParty->uDaysPlayed % 7] ) - { - if (!transport_schedule[transport_routes[a1][i]].uQuestBit || _449B57_test_bit(pParty->_quest_bits, transport_schedule[transport_routes[a1][i]].uQuestBit)) - return true; - } - } - return false; -} - -//----- (004B7911) -------------------------------------------------------- -void TownHallDialog() -{ - int v1; // eax@10 - int v2; // esi@10 - signed int pStringSum; // ebx@24 - signed int v16; // ebx@28 - int v17; // ebx@28 - GUIButton *pButton; // eax@30 - int pTextHeight; // eax@30 - unsigned __int16 pTextColor; // ax@30 - GUIWindow window; // [sp+60h] [bp-BCh]@21 - GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 - int v29; // [sp+10Ch] [bp-10h]@28 - int v31; // [sp+114h] [bp-8h]@29 - GUIFont *pOutString; // [sp+118h] [bp-4h]@21 - - memcpy(&townHall_window, window_SpeakInHouse, sizeof(townHall_window)); - townHall_window.uFrameX = 483; - townHall_window.uFrameWidth = 148; - townHall_window.uFrameZ = 334; - sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);//Текущий штраф - townHall_window.DrawTitleText(pFontArrus, 0, 260, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - pStringSum = 1; - pTextHeight = 0; - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[604]);//Охота за вознаграждение - if ( pParty->uFine > 0 ) - { - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[603]);//Заплатить штраф - pStringSum = 2; - } - for ( uint i = 0; i < pStringSum; ++i ) - pTextHeight += pFontArrus->CalcTextHeight(pShopOptions[i], &townHall_window, 0, 0); - v29 = (100 - pTextHeight) / pStringSum; - v16 = 80 - pStringSum * ((100 - pTextHeight) / pStringSum); - v17 = (v16 / 2) - v29 / 2 + 158; - if ( pDialogueWindow->pNumPresenceButton > 0 ) - { - v31 = 2; - uint j = 0; - for ( uint i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v29 + v17; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); - pButton->uHeight = pTextHeight; - v17 = pButton->uY + pTextHeight - 1; - pButton->uW = v17; - pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - townHall_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[j], 3); - ++v31; - ++j; - } - } - break; - } - case HOUSE_DIALOGUE_TOWNHALL_MESSAGE: - { - sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), - pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName, Color16(0xFFu, 0xFFu, 0xFFu)); - sprintf(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].uLevel); - current_npc_text = pTmpBuf2.data(); - memcpy(&window, pDialogueWindow, sizeof(window)); - window.uFrameWidth = 458; - window.uFrameZ = 457; - pOutString = pFontArrus; - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &window, 13, 0) + 7; - if ( 352 - pTextHeight < 8 ) - { - pOutString = pFontCreate; - pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; - } - pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); - pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); - break; - } - case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: - { - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) - { - sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" - townHall_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); - townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); - return; - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) - { - v1 = atoi(pKeyActionMap->pPressedKeysBuffer); - v2 = atoi(pKeyActionMap->pPressedKeysBuffer); - if ( v1 <= 0 ) - { - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - if ( v1 > pParty->uNumGold ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - v2 = pParty->uNumGold; - } - if ( v2 > pParty->uFine ) - v2 = pParty->uFine; - Party::TakeGold(v2); - pParty->uFine -= v2; - if ( pParty->uFine < 0 ) - pParty->uFine = 0; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) - { - window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - } - break; - } - default: - break; - } - return; -} - -//----- (004B7D7E) -------------------------------------------------------- -void BankDialog() -{ - int entered_sum; // eax@19 - unsigned int takes_sum; // esi@19 - unsigned __int16 pColorText; // ax@27 - GUIWindow bank_window; // [sp+Ch] [bp-5Ch]@1 - - memcpy(&bank_window, window_SpeakInHouse, sizeof(bank_window)); - bank_window.uFrameX = 483; - bank_window.uFrameWidth = 148; - bank_window.uFrameZ = 334; - sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);//Баланс - bank_window.DrawTitleText(pFontArrus, 0, 220, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - bank_window.DrawTitleText(pFontArrus, 0, 146, pColorText, pGlobalTXT_LocalizationStrings[60], 3); - pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - bank_window.DrawTitleText(pFontArrus, 0, 176, pColorText, pGlobalTXT_LocalizationStrings[244], 3); - break; - } - case HOUSE_DIALOGUE_BANK_PUT_GOLD: - { - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) - { - sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"Положить" "Сколько?" - bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); - bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); - return; - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) - { - entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer); - takes_sum = entered_sum; - if ( !entered_sum ) - { - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - if ( entered_sum > pParty->uNumGold ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - takes_sum = pParty->uNumGold; - } - if ( takes_sum ) - { - Party::TakeGold(takes_sum); - pParty->uNumGoldInBank += takes_sum; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - } - window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) - { - window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - } - return; - } - case HOUSE_DIALOGUE_BANK_GET_GOLD: - { - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) - { - sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"Снять" "Сколько?" - bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3); - bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); - return; - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) - { - window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer); - takes_sum = entered_sum; - if ( entered_sum ) - { - if ( entered_sum > pParty->uNumGoldInBank ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - takes_sum = pParty->uNumGoldInBank; - } - if ( takes_sum ) - { - Party::SetGold(pParty->uNumGold + takes_sum); - pParty->uNumGoldInBank -= takes_sum; - } - } - window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) - { - window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - } - return; - } - default: - { - break; - } - } -} -// F8B19C: using guessed type int dword_F8B19C; - -//----- (004B8285) -------------------------------------------------------- -void TavernDialog() -{ - int pPriceRoom; - int pPriceFood; - int pPriceSkill; - int pItemNum; - double v2; // st7@1 - int pNumString; // edi@16 - signed int v9; // esi@16 - unsigned int pColorText; // eax@57 - GUIButton *pButton; // eax@65 - int pSkillCount; - signed int pOptionsCount; // edi@77 - signed int i; // esi@79 -// signed int v53; // edi@81 - int v54; // edi@81 - const char *pText; // [sp-4h] [bp-278h]@93 - char pTopic1[100]; // [sp+Ch] [bp-268h]@55 - char pTopic4[100]; // [sp+70h] [bp-204h]@59 - char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 - char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 - GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 - int v91; // [sp+270h] [bp-4h]@3 - unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 - unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 - unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 - unsigned __int8 pTopic4Height; - int pTextHeight; - int all_text_height; // [sp+260h] [bp-14h]@18 - GUIFont *pOutString; - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - - pPriceRoom = ((v2 * v2) / 10) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPriceRoom < ((v2 * v2) / 10) / 3 ) - pPriceRoom = ((v2 * v2) / 10) / 3; - if ( pPriceRoom <= 0 ) - pPriceRoom = 1; - - pPriceFood = ((v2 * v2) * v2 / 100) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPriceFood < ((v2 * v2) * v2 / 100) / 3 ) - pPriceFood = ((v2 * v2) * v2 / 100) / 3; - if ( pPriceFood <= 0 ) - pPriceFood = 1; - - - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - - sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pPriceRoom); // Rent room for %d gold - strcat(pTopic1, pTmpBuf2.data()); - pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); - strcat(pTopic1, "\n \n"); - - sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold - (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, pPriceFood); - strcat(pTopic2, pTmpBuf2.data()); - pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); - strcat(pTopic2, "\n \n"); - - sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); - strcat(pTopic3, pGlobalTXT_LocalizationStrings[160]); // Learn Skills - pTopic3Height = pFontArrus->CalcTextHeight(pTopic3, &dialog_window, 0, 0); - strcat(pTopic3, "\n \n"); - pTopic4[0] = 0; - if ( (signed int)window_SpeakInHouse->par1C >= 108 && (signed int)window_SpeakInHouse->par1C <= 120 ) - { - sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? Color16(0xFFu, 0xFFu, 0x9Bu) : Color16(0xFFu, 0xFFu, 0xFFu)); - strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage - pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); - } - - if ( pDialogueWindow->pNumPresenceButton ) - { - for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; - pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) - { - pButton = pDialogueWindow->GetControl(pItemNum); - if ( pButton->msg_param == 15 ) - { - pButton->uHeight = pTopic1Height; - pButton->uY = 146; - pButton->uW = pTopic1Height + 145; - } - else if ( pButton->msg_param == 16 ) - { - pButton->uHeight = pTopic2Height; - pButton->uY = pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; - pButton->uW = (pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) + pTopic2Height - 1; - } - else if ( pButton->msg_param == 96 ) - { - pButton->uY = pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; - pButton->uHeight = pTopic3Height; - pButton->uW = pTopic3Height + (pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) - 1; - } - else if ( pButton->msg_param == 101 ) - { - pButton->uHeight = pTopic4Height; - pButton->uY = pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146; - pButton->uW = (pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146) + pTopic4Height - 1; - } - } - sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); - dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); - } - break; - } - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: - { - pOutString = pFontArrus; - strcpy(pTmpBuf.data(), pNPCTopics[354].pText); - dialog_window.uFrameWidth = game_viewport_width; - dialog_window.uFrameZ = 452; - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; - if ( 352 - pTextHeight < 8 ) - { - pOutString = pFontCreate; - pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; - } - pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); - pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); - break; - } - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: - { - strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); - dialog_window.uFrameWidth = game_viewport_width; - dialog_window.uFrameZ = 452; - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; - pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); - pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, - FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); - break; - } - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: - { - if ( pArcomageGame->bGameInProgress == 1 ) - return; - if ( pArcomageGame->uGameWinner ) - { - if ( pArcomageGame->uGameWinner == 1 ) - pText = pGlobalTXT_LocalizationStrings[640];// You won! - else - pText = pGlobalTXT_LocalizationStrings[641];// You lost! - } - else - { - pText = pGlobalTXT_LocalizationStrings[639];// A tie! - } - strcpy(pTmpBuf.data(), pText); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, - Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - break; - } - case HOUSE_DIALOGUE_TAVERN_REST: - { - if ( pParty->uNumGold >= pPriceRoom ) - { - Party::TakeGold(pPriceRoom); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - dialog_menu_id = HOUSE_DIALOGUE_NULL; - HouseDialogPressCloseBtn(); - GetHouseGoodbyeSpeech(); - pMediaPlayer->Unload(); - /*if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; - pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 - pMessageQueue_50CBD0->pMessages[0].field_8 = 1; - ++pMessageQueue_50CBD0->uNumMessages;*/ - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_RentRoom, (int)window_SpeakInHouse->ptr_1C, 1); - window_SpeakInHouse->Release(); - window_SpeakInHouse = 0; - return; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - break; - } - - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pSkillCount = 0; - v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pPriceSkill = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPriceSkill < v9 / 3 ) - pPriceSkill = v9 / 3; - all_text_height = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); - pSkillCount++; - } - } - if ( pSkillCount ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPriceSkill);//Стоимость навыка: %lu - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v91 = (149 - all_text_height) / pSkillCount; - if ( (149 - all_text_height) / pSkillCount > 32 ) - v91 = 32; - v54 = (149 - pSkillCount * v91 - all_text_height) / 2 - v91 / 2 + 162; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; i++ ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] - || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v91 + v54; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v54 = pTextHeight + pButton->uY - 1; - pButton->uW = v54; - pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); - } - } - return; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,//Советую вам %s %s поискать знания еще где-нибудь - pClassNames[pPlayers[uActiveCharacter]->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. - pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - return; - } - - case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: - { - if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);//Вы уже купили еду! - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - if ( pParty->uNumGold >= pPriceFood ) - { - Party::TakeGold(pPriceFood); - pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - break; - } - - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: - { - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - pOptionsCount = 2; - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[620]);//Правила - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[622]);//Условия победы - if ( pParty->HasItem(651) )//651 - Колода для игры в АркоМэйдж в Items.txt - { - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[621]);//Играть - pOptionsCount = 3; - } - for ( i = 0; i < pOptionsCount; ++i ) - all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - all_text_height = (174 - all_text_height) / pOptionsCount; - - v54 = (174 - pOptionsCount * (174 - all_text_height) / pOptionsCount - all_text_height) / 2 - (174 - all_text_height) / pOptionsCount / 2 + 138; - pNumString = 0; - for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; - pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ; pItemNum++ ) - { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = all_text_height + v54; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v54 = pButton->uY + pTextHeight - 1; - pButton->uW = v54; - pColorText = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); - ++pNumString; - } - } - break; - } - default: - { - break; - } - } -} - -//----- (004B705E) -------------------------------------------------------- -void TempleDialog() -{ - int pPrice; // edi@1 - int pTextHeight; // eax@11 - unsigned __int16 pTextColor; // ax@21 - DDM_DLV_Header *v26; // edi@29 - unsigned int v30; // edx@36 - int v35; // edi@50 - GUIButton *pButton; // edi@64 -// int v47; // edi@71 - GUIWindow tample_window; // [sp+13Ch] [bp-88h]@1 - unsigned __int8 index; // [sp+1B7h] [bp-Dh]@64 - int v64; // [sp+1B8h] [bp-Ch]@6 - unsigned int pCurrentItem; // [sp+1BCh] [bp-8h]@6 - int all_text_height; // [sp+1C0h] [bp-4h]@6 - - memcpy(&tample_window, window_SpeakInHouse, sizeof(tample_window)); - tample_window.uFrameX = 483; - tample_window.uFrameWidth = 148; - tample_window.uFrameZ = 334; - pPrice = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[window_SpeakInHouse->par1C - 1].fPriceMultiplier); - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) - { - index = 1; - pButton = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); - pButton->uHeight = 0; - pButton->uY = 0; - if ( pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) - { - sprintfex(pTmpBuf.data(), "%s %d %s", pGlobalTXT_LocalizationStrings[104], pPrice, pGlobalTXT_LocalizationStrings[97]);//"Лечить" "Золото" - pShopOptions[0] = pTmpBuf.data(); - index = 0; - } - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[68]);//"Пожертвовать" - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);//"Обучиться навыкам" - all_text_height = 0; - if ( index < pDialogueWindow->pNumPresenceButton ) - { - uint i = index; - for ( uint j = index; j < pDialogueWindow->pNumPresenceButton; ++j ) - { - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); - i++; - } - } - v64 = (174 - (signed int)all_text_height) / (pDialogueWindow->pNumPresenceButton - index); - if ( v64 > 32 ) - v64 = 32; - all_text_height = (174 - v64 * (pDialogueWindow->pNumPresenceButton - index) - (signed int)all_text_height) / 2 - v64 / 2 + 138; - if ( index + pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - uint i = index; - for ( pCurrentItem = index + pDialogueWindow->pStartingPosActiveItem; - (signed int)pCurrentItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pCurrentItem ) - { - pButton = pDialogueWindow->GetControl(pCurrentItem); - pButton->uY = v64 + all_text_height; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[1 * i], &tample_window, 0, 0); - pButton->uHeight = pTextHeight; - pButton->uW = pButton->uY + pTextHeight - 1; - all_text_height = pButton->uW; - pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != index + 2 ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[1 * i], 3); - i++; - index++; - } - } - return; - } - //------------------------------------------------- - if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_HEAL ) - { - if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) - return; - if ( pParty->uNumGold < pPrice ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - Party::TakeGold(pPrice); - v35 = LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]); - memset(pPlayers[uActiveCharacter], 0, 0xA0u); - pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); - pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); - if ( (signed int)window_SpeakInHouse->ptr_1C != 78 && ((signed int)window_SpeakInHouse->ptr_1C <= 80 || (signed int)window_SpeakInHouse->ptr_1C > 82) ) - { - if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 )// если состояние зомби - { - pPlayers[uActiveCharacter]->uCurrentFace = pPlayers[uActiveCharacter]->uPrevFace; - pPlayers[uActiveCharacter]->uVoiceID = pPlayers[uActiveCharacter]->uPrevVoiceID; - ReloadPlayerPortraits(uActiveCharacter - 1, pPlayers[uActiveCharacter]->uPrevFace); - } - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); - pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 ) - LODWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = v35; - else - { - if ( !pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] - && !pPlayers[uActiveCharacter]->pConditions[Condition_Pertified] && !pPlayers[uActiveCharacter]->pConditions[Condition_Dead] ) - { - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); - pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; - pPlayers[uActiveCharacter]->uPrevVoiceID = pPlayers[uActiveCharacter]->uVoiceID; - pPlayers[uActiveCharacter]->SetCondition(Condition_Zombie, 1); - pPlayers[uActiveCharacter]->uVoiceID = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; - pPlayers[uActiveCharacter]->uCurrentFace = (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23; - ReloadPlayerPortraits(uActiveCharacter - 1, (pPlayers[uActiveCharacter]->GetSexByVoice() != 0) + 23); - pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; - //v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); - } - //HIDWORD(pPlayers[uActiveCharacter]->pConditions[Condition_Zombie]) = (int)v39; - pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] = pParty->uTimePlayed; - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); - pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - //--------------------------------------------------- - if ( dialog_menu_id == HOUSE_DIALOGUE_TEMPLE_DONATE ) - { - pPrice = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - if ( pParty->uNumGold >= (unsigned int)pPrice ) - { - Party::TakeGold((unsigned int)pPrice); - v26 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v26 = &pIndoor->dlv; - if ( v26->uReputation > -5 ) - { - v26->uReputation = v26->uReputation - 1; - if ( v26->uReputation - 1 < -5 ) - v26->uReputation = -5; - } - if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) - { - if ( v26->uReputation <= -5 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); - } - if ( v26->uReputation <= -10 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v30, 48, 0); - } - if ( v26->uReputation <= -15 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v30, 48, 0); - } - if ( v26->uReputation <= -20 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v30, 48, 0); - } - if ( v26->uReputation <= -25 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v30, 48, 0); - } - } - ++byte_F8B1EF[uActiveCharacter]; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!" - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//"У вас не хватает золота" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - //------------------------------------------------ - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) - { - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - all_text_height = 0; - pCurrentItem = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - v64 = (signed int)(pCurrentItem * (100 - pPlayers[uActiveCharacter]->GetMerchant())) / 100; - if ( v64 < (signed int)pCurrentItem / 3 ) - v64 = (signed int)pCurrentItem / 3; - pCurrentItem = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &tample_window, 0, 0); - ++pCurrentItem; - } - } - if ( pCurrentItem ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64); - tample_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v64 = (149 - (signed int)all_text_height) / (signed int)pCurrentItem; - if ( v64 > 32 ) - v64 = 32; - all_text_height = (signed int)(149 - pCurrentItem * v64 - (int)all_text_height) / 2 - v64 / 2 + 162; - if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - pCurrentItem = 2; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] - || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v64 + all_text_height; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &tample_window, 0, 0); - pButton->uHeight = pTextHeight; - pButton->uW = pButton->uY + pTextHeight - 1; - all_text_height = pButton->uW; - pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != pCurrentItem ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - tample_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); - } - pCurrentItem++; - } - } - } - else - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//"Советую вам %s %s поискать знания еще где-нибудь" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//"Больше ничего не могу предложить." - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &tample_window, 0, 0); - tample_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - } - } - } - return; -} - -//----- (004B4710) -------------------------------------------------------- -void TrainingDialog() -{ - unsigned __int64 v5; // edi@3 - int v8; // edx@4 - double v9; // st7@6 - signed int v10; // esi@6 - int pPrice; // ecx@6 - signed int v14; // esi@14 -// int v16; // eax@16 - int v19; // ecx@24 - int v33; // eax@36 - unsigned int v36; // eax@38 - unsigned int v42; // eax@46 - int index; - int all_text_height; // eax@68 - int v49; // ebx@69 - GUIButton *pButton; // eax@71 - int pTextHeight; // eax@71 - unsigned __int16 pTextColor; // ax@71 - GUIWindow training_dialog_window; // [sp+Ch] [bp-78h]@1 - int v69; // [sp+70h] [bp-14h]@6 - int v73; // [sp+80h] [bp-4h]@14 - - memcpy(&training_dialog_window, window_SpeakInHouse, sizeof(training_dialog_window)); - training_dialog_window.uFrameX = 483; - training_dialog_window.uFrameWidth = 148; - training_dialog_window.uFrameZ = 334; - v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 - //v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; - if (pPlayers[uActiveCharacter]->uExperience >= v5) - { - v8 = pPlayers[uActiveCharacter]->classType % 4 + 1; - if ( v8 == 4 ) - v8 = 3; - v9 = (double)pPlayers[uActiveCharacter]->uLevel; - v69 = v8; - v10 = (signed __int64)(v9 * p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * (double)v8); - pPrice = v10 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < v10 / 3 ) - pPrice = v10 / 3; - } -//------------------------------------------------------- - all_text_height = 0; - if (HouseUI_CheckIfPlayerCanInteract()) - { - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN ) - { - if (HouseUI_CheckIfPlayerCanInteract()) - { - index = 0; - pShopOptions[0] = pTmpBuf.data(); - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);// "Learn Skills" - if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( pDialogueWindow->GetControl(i)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) - { - if (pPlayers[uActiveCharacter]->uLevel >= pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]) - sprintfex(pShopOptions[index], "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher." "Sorry, but we are unable to train you." - else - { - if (pPlayers[uActiveCharacter]->uExperience < v5) - sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[538], (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); // "You need %d more experience to train to level %d" - else - sprintfex(pShopOptions[index], pGlobalTXT_LocalizationStrings[537], pPlayers[uActiveCharacter]->uLevel + 1, pPrice); // "Train to level %d for %d gold" - } - } - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); - ++index; - } - } - v49 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; - if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) - { - index = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = (174 - all_text_height) / 2 + v49; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[index], &training_dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - pButton->uW = pTextHeight + pButton->uY - 1; - v49 = pButton->uW; - pTextColor = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(255, 255, 255); - training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[index], 3); - ++index; - } - } - } - } -//------------------------------------------------------------------ - if ( dialog_menu_id == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) - { - if ( !HouseUI_CheckIfPlayerCanInteract() ) - { - v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &training_dialog_window, 0, 0); - training_dialog_window.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, Color16(0xE1u, 0xCDu, 0x23u), pNPCTopics[122].pText, 3); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - if ( pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE] ) - { - if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience >= v5 ) - { - if ( pParty->uNumGold >= pPrice) - { - Party::TakeGold(pPrice); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - ++pPlayers[uActiveCharacter]->uLevel; - pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; - pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); - pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); - uint max_level_in_party = player_levels[0]; - for (uint _it = 1; _it < 4; ++_it) - { - if (player_levels[_it] > max_level_in_party) - max_level_in_party = player_levels[_it]; - } - ++player_levels[uActiveCharacter - 1]; - if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level - // feature is broken thou, since this array is always zeroed in EnterHouse - { - v42 = 60 * (_494820_training_time(pParty->uCurrentHour) + 4) - pParty->uCurrentMinute; - if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || - (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) - v42 += 720; - RestAndHeal((signed int)(v42 + 10080)); - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - pOutdoor->SetFog(); - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0); - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// - // "%s is now Level %lu and has earned %lu Skill Points!" - ShowStatusBarString(pTmpBuf.data(), 2); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// - // "You need %d more experience to train to level %d" - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 88; - } - else - { - sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// - // ""With your skills, you should be working here as a teacher."" - // ""Sorry, but we are unable to train you."" - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0)) / 2 + 101; - } - training_dialog_window.DrawTitleText(pFontArrus, 0, v36, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); - return; - } - } -//------------------------------------------------------------- - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) - { - if (HouseUI_CheckIfPlayerCanInteract()) - { - v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pPrice = v14 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < v14 / 3 ) - pPrice = v14 / 3; - index = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - (signed int)i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &training_dialog_window, 0, 0); - ++index; - } - } - if ( index ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" - training_dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v73 = (signed int)(149 - all_text_height) / index; - if ( v73 > 32 ) - v73 = 32; - v19 = (signed int)(149 - index * v73 - all_text_height) / 2 - v73 / 2 + 162; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - (signed int)i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] - || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v73 + v19; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &training_dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - pButton->uW = pButton->uY + pTextHeight - 1; - v19 = pButton->uY + pTextHeight - 1; - pTextColor = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(255, 255, 255); - training_dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); - } - } - } - else - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &training_dialog_window, 0, 0); - training_dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); - } - } - } - return; -} - -//----- (004B6478) -------------------------------------------------------- -void sub_4B6478() -{ - unsigned int v2; // eax@1 - signed int v3; // esi@1 - int pPrice; // ebx@1 - unsigned int v5; // esi@5 - int v6; // edi@6 -// int result; // eax@13 - int all_text_height; // eax@20 -// int v13; // eax@21 - GUIButton *pButton; // esi@27 -// unsigned int v16; // eax@28 - int pTextHeight; // eax@29 - unsigned __int16 pTextColor; // ax@29 -// unsigned __int16 v22; // ST14_2@36 - int v27; // [sp-4h] [bp-80h]@8 - GUIWindow dialog_window; // [sp+Ch] [bp-70h]@1 - int v32; // [sp+6Ch] [bp-10h]@1 - int index; // [sp+74h] [bp-8h]@17 - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - v2 = 52 * (unsigned int)window_SpeakInHouse->ptr_1C; - v32 = (unsigned __int8)(((p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; - v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - pPrice = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < v3 / 3 ) - pPrice = v3 / 3; - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) - { - pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &dialog_window, 0, 0);// - dialog_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[171].pText, 3); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - all_text_height = 0; - index = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); - ++index; - } - } - if ( !index ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - return; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v32 = (149 - all_text_height) / index; - if ( v32 > 32 ) - v32 = 32; - index = (149 - index * v32 - all_text_height) / 2 - v32 / 2 + 162; - if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i <pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType / 3][pButton->msg_param - 36] ) - { - if ( !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uY = v32 + index; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - pButton->uW = pButton->uY + pTextHeight - 1; - index = pButton->uY + pTextHeight - 1; - pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); - } - } - else - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - } - } - return; - } - - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - v5 = 0; - __debugbreak(); - //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - __debugbreak(); // whacky condition - fix - if (false - //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) - || (v6 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + dialog_menu_id), *(short *)v6) ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - } - else - { - if ( pParty->uNumGold < pPrice ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота - v27 = 4; - } - else - { - Party::TakeGold(pPrice); - *(short *)v6 = 1; - v27 = 2; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); - } - } - else - { - v5 = 0; - } - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, v5); - return; // void func -} - -//----- (004B2A74) -------------------------------------------------------- -void SimpleHouseDialog() -{ - NPCData *pNPC; // esi@6 - char *v15; // esi@14 - GUIButton *pButton; // eax@15 - char *v29; // esi@42 - int v31; // ST1C_4@42 - int index; // esi@51 - int v36; - signed int all_text_height; // ecx@54 - int v40; // edi@57 - unsigned __int16 pTextColor; // ax@60 - GUIFont *pTextFont; // ebx@64 - int pTextHeight; - GUIWindow w; // [sp+Ch] [bp-110h]@64 - GUIWindow right_panel_window; // [sp+60h] [bp-BCh]@13 - GUIWindow house_window; // [sp+B4h] [bp-68h]@1 - char *pInString; // [sp+114h] [bp-8h]@12 - - memcpy(&house_window, pDialogueWindow, sizeof(house_window)); - if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) - { - house_window.uFrameX = 493; - house_window.uFrameWidth = 126; - house_window.uFrameZ = 366; - house_window.DrawTitleText(pFontCreate, 0, 2, 0, pMapStats->pInfos[uHouse_ExitPic].pName, 3); - house_window.uFrameX = 483; - house_window.uFrameWidth = 148; - house_window.uFrameZ = 334; - if ( !pTransitionStrings[uHouse_ExitPic] ) - { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName);//Войти в ^Pv[%s] - house_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &house_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); - return; - } - house_window.DrawTitleText(pFontCreate, 0, - (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uHouse_ExitPic], &house_window, 0, 0)) / 2 + 101, 0, pTransitionStrings[uHouse_ExitPic], 3); - return; - } - house_window.uFrameWidth -= 10; - house_window.uFrameZ -= 10; - pNPC = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 - if ( pNPC->uProfession ) - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s - else - strcpy(pTmpBuf.data(), pNPC->pName); - house_window.DrawTitleText(pFontCreate, 483, 113, Color16(0x15u, 0x99u, 0xE9u), pTmpBuf.data(), 3); - if ( !dword_591080 ) - { - if ( !uDialogueType ) - { - if ( pNPC->greet ) - { - house_window.uFrameWidth = game_viewport_width; - house_window.uFrameZ = 452; - pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)]; - //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); - pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), - pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); - pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); - pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), - 0, FitTextInAWindow(pInString, pFontArrus, &house_window, 0xDu, 0), 0, 0, 0); - } - } - } - //for right panel - memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window)); - right_panel_window.uFrameX = 483; - right_panel_window.uFrameWidth = 148; - right_panel_window.uFrameZ = 334; - for ( int i = right_panel_window.pStartingPosActiveItem; - i < right_panel_window.pStartingPosActiveItem + right_panel_window.pNumPresenceButton; ++i ) - { - pButton = right_panel_window.GetControl(i); - switch ( pButton->msg_param ) - { - case 19://evt_A - v15 = (char *)pNPCTopics[pNPC->evt_A].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 20://evt_B - v15 = (char *)pNPCTopics[pNPC->evt_B].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - if ( uDialogueType != 84 ) - { - strcpy(pButton->pButtonName, v15); - continue; - } - sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xE1u, 0xCDu, 0x23u), pItemsTable->pItems[contract_approved].pUnidentifiedName); - sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); - current_npc_text = pTmpBuf2.data(); - strcpy(pButton->pButtonName, v15); - continue; - case 21://evt_C - v15 = (char *)pNPCTopics[pNPC->evt_C].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 22://evt_D - v15 = (char *)pNPCTopics[pNPC->evt_D].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 23://evt_E - v15 = (char *)pNPCTopics[pNPC->evt_E].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 24://evt_F - v15 = (char *)pNPCTopics[pNPC->evt_F].pTopic; - if ( !v15 ) - { - pButton->msg_param = 0; - v15 = ""; - } - strcpy(pButton->pButtonName, v15); - continue; - case 76: - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]);//Нанять - continue; - case 77: - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]);//Подробнее - continue; - case 79: - strcpy(pButton->pButtonName, _4B254D_SkillMasteryTeacher((int)right_panel_window.ptr_1C)); - continue; - case 82: - strcpy(pButton->pButtonName, ContractSelectText((int)right_panel_window.ptr_1C)); - continue; - case 83: - v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; - v31 = *(int *)v29; - sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", Color16(0xFFu, 0xFFu, 0x9Bu), v31, Color16(0xFFu, 0xFFu, 0xFFu)); - sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); - current_npc_text = pTmpBuf2.data(); - strcpy(pButton->pButtonName, ""); - continue; - } - if ( pButton->msg_param > 0 && pButton->msg_param < 13 ) - { - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]);//Вступить - continue; - } - if ( pButton->msg_param > 13 && pButton->msg_param < 19 ) - { - strcpy(pButton->pButtonName, ""); - continue; - } - if ( pButton->msg_param != 93 ) - { - strcpy(pButton->pButtonName, ""); - continue; - } - } - index = 0; - all_text_height = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); - index++; - } - if ( index ) - { - v36 = (174 - all_text_height) / index; - if ( v36 > 32 ) - v36 = 32; - v40 = (174 - v36 * index - all_text_height) / 2 - v36 / 2 + 138; - for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v36 + v40; - pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &right_panel_window, 0, 0); - pButton->uHeight = pTextHeight; - v40 = pButton->uY + pTextHeight - 1; - pButton->uW = v40; - pTextColor = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - right_panel_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); - } - } - if ( current_npc_text ) - { - w.uFrameWidth = 458; - w.uFrameZ = 457; - pTextFont = pFontArrus; - pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; - if ( 352 - pTextHeight < 8 ) - { - pTextFont = pFontCreate; - pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; - } - pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); - pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0); - } -} - -//----- (004B4F4F) -------------------------------------------------------- -void JailDialog() -{ - GUIWindow jail_dialogue_window; // [sp+8h] [bp-54h]@1 - - memcpy(&jail_dialogue_window, window_SpeakInHouse, sizeof(jail_dialogue_window)); - jail_dialogue_window.uFrameX = 483; - jail_dialogue_window.uFrameWidth = 148; - jail_dialogue_window.uFrameZ = 334; - jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18, - Color16(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"За многочисленные преступления и злодеяния вы были приговорены к одному году заключения." -} - - -//----- (00443801) -------------------------------------------------------- -void InitializeBuildingResidents() -{ - - int i; - char* test_string; - unsigned char c; - bool break_loop; - unsigned int temp_str_len; - char* tmp_pos; - int decode_step; - - free(p2DEventsTXT_Raw); - p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); - strtok(p2DEventsTXT_Raw, "\r"); - strtok(NULL, "\r"); - - for (i=0;i<525;++i) - { - test_string = strtok(NULL, "\r") + 1; - break_loop = false; - decode_step=0; - do - { - c = *(unsigned char*)test_string; - temp_str_len = 0; - while((c!='\t')&&(c>0)) - { - ++temp_str_len; - c=test_string[temp_str_len]; - } - tmp_pos=test_string+temp_str_len; - if (*tmp_pos == 0) - break_loop = true; - *tmp_pos = 0; - if (temp_str_len) - { - switch (decode_step) - { - case 2: - { - if ( !_strnicmp(test_string, "wea", 3) ) - { - p2DEvents[i].uType = BuildingType_WeaponShop; - break; - } - if ( !_strnicmp(test_string, "arm", 3) ) - { - p2DEvents[i].uType = BuildingType_ArmorShop; - break; - } - if ( !_strnicmp(test_string, "mag", 3) ) - { - p2DEvents[i].uType = BuildingType_MagicShop; - break; - } - if ( !_strnicmp(test_string, "alc", 3) ) - { - p2DEvents[i].uType = BuildingType_AlchemistShop; - break; - } - if ( !_strnicmp(test_string, "sta", 3) ) - { - p2DEvents[i].uType = BuildingType_Stables; - break; - } - if ( !_strnicmp(test_string, "boa", 3) ) - { - p2DEvents[i].uType = BuildingType_Boats; - break; - } - if ( !_strnicmp(test_string, "tem", 3) ) - { - p2DEvents[i].uType = BuildingType_Temple; - break; - } - if ( !_strnicmp(test_string, "tra", 3) ) - { - p2DEvents[i].uType = BuildingType_Training; - break; - } - if ( !_strnicmp(test_string, "tow", 3) ) - { - p2DEvents[i].uType = BuildingType_TownHall; - break; - } - - if ( !_strnicmp(test_string, "tav", 3) ) - { - p2DEvents[i].uType = BuildingType_Tavern; - break; - } - if ( !_strnicmp(test_string, "ban", 3) ) - { - p2DEvents[i].uType = BuildingType_Bank; - break; - } - if ( !_strnicmp(test_string, "fir", 3) ) - { - p2DEvents[i].uType = BuildingType_FireGuild; - break; - } - if ( !_strnicmp(test_string, "air", 3) ) - { - p2DEvents[i].uType = BuildingType_AirGuild; - break; - } - if ( !_strnicmp(test_string, "wat", 3) ) - { - p2DEvents[i].uType = BuildingType_WaterGuild; - break; - } - if ( !_strnicmp(test_string, "ear", 3) ) - { - p2DEvents[i].uType = BuildingType_EarthGuild; - break; - } - if ( !_strnicmp(test_string, "spi", 3) ) - { - p2DEvents[i].uType = BuildingType_SpiritGuild; - break; - } - if ( !_strnicmp(test_string, "min", 3) ) - { - p2DEvents[i].uType = BuildingType_MindGuild; - break; - } - if ( !_strnicmp(test_string, "bod", 3) ) - { - p2DEvents[i].uType = BuildingType_BodyGuild; - break; - } - if ( !_strnicmp(test_string, "lig", 3) ) - { - p2DEvents[i].uType = BuildingType_LightGuild; - break; - } - if ( !_strnicmp(test_string, "dar", 3) ) - { - p2DEvents[i].uType = BuildingType_DarkGuild; - break; - } - if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6 - { - p2DEvents[i].uType = BuildingType_ElementalGuild; - break; - } - if ( !_strnicmp(test_string, "sel", 3) ) - { - p2DEvents[i].uType = BuildingType_SelfGuild; - break; - } - if ( !_strnicmp(test_string, "mir", 3) ) - { - p2DEvents[i].uType = BuildingType_16; - break; - } - if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6 - { - p2DEvents[i].uType = BuildingType_TownHall; - break; - } - p2DEvents[i].uType = BuildingType_18; - } - break; - - case 4: - p2DEvents[i].uAnimationID = atoi(test_string); - break; - case 5: - p2DEvents[i].pName = RemoveQuotes(test_string); - break; - case 6: - p2DEvents[i].pProprieterName = RemoveQuotes(test_string); - break; - case 7: - p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string); - break; - case 8: - p2DEvents[i].field_14 = atoi(test_string); - break; - case 9: - p2DEvents[i]._state = atoi(test_string); - break; - case 10: - p2DEvents[i]._rep = atoi(test_string); - break; - case 11: - p2DEvents[i]._per = atoi(test_string); - break; - case 12: - p2DEvents[i].fPriceMultiplier = atof(test_string); - break; - case 13: - p2DEvents[i].flt_24 = atof(test_string); - break; - case 15: - p2DEvents[i].field_1C = atoi(test_string); - break; - case 18: - p2DEvents[i].uOpenTime = atoi(test_string); - break; - case 19: - p2DEvents[i].uCloseTime = atoi(test_string); - break; - case 20: - p2DEvents[i].uExitPicID = atoi(test_string); - break; - case 21: - p2DEvents[i].uExitMapID = atoi(test_string); - break; - case 22: - p2DEvents[i]._quest_related = atoi(test_string); - break; - case 23: - p2DEvents[i].pEnterText = RemoveQuotes(test_string); - break; - } - } - ++decode_step; - test_string=tmp_pos+1; - } while ((decode_step<24)&&!break_loop); - } - -} - -//----- (004BD8B5) -------------------------------------------------------- -int HouseDialogPressCloseBtn() -{ - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); - pKeyActionMap->ResetKeys(); - activeLevelDecoration = nullptr; - current_npc_text = 0; - if ( pDialogueNPCCount == 0) - return 0; - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && ShopTexture ) - { - ShopTexture->Release(); - ShopTexture = 0; - } - - switch(dialog_menu_id) - { - case -1: - _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); - BackToHouseMenu(); - break; - - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - case HOUSE_DIALOGUE_LEARN_SKILLS: - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: - BackToHouseMenu(); - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - InitializaDialogueOptions(in_current_building_type); - break; - - case HOUSE_DIALOGUE_SHOP_SELL: - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - case HOUSE_DIALOGUE_SHOP_REPAIR: - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; - InitializaDialogueOptions_Shops(in_current_building_type); - break; - - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: - BackToHouseMenu(); - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; - InitializaDialogueOptions_Tavern(in_current_building_type); - break; - - case HOUSE_DIALOGUE_NULL: - case HOUSE_DIALOGUE_MAIN: - pDialogueNPCCount = 0; - pDialogueWindow->Release(); - dialog_menu_id = HOUSE_DIALOGUE_NULL; - pDialogueWindow = 0; - pIcons_LOD->SyncLoadedFilesCount(); - - if ( uNumDialogueNPCPortraits == 1 ) - return 0; - - pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; - if ( uNumDialogueNPCPortraits > 0 ) - { - for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i ) - { - HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i], - pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i], - 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0); - } - } - - BackToHouseMenu(); - break; - - default: - BackToHouseMenu(); - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - InitializaDialogueOptions(in_current_building_type); - break; - } - return 1; -} - -//----- (004BF5B2) -------------------------------------------------------- -void BackToHouseMenu() -{ - pMouse->_469E24(); - if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie_Track)//!this->pSmackerMovie ) - { - bGameoverLoop = true; - HouseDialogPressCloseBtn(); - window_SpeakInHouse->Release(); - pParty->uFlags &= 0xFFFFFFFD; - if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) - { - pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0); - window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 165, 0); - window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1, 0x31, "", 0); - window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2, 0x32, "", 0); - window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3, 0x33, "", 0); - window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4, 0x34, "", 0); - } - bGameoverLoop = 0; - } -}
--- a/UI/UIHouses.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -#pragma once -#include "..\Engine/Events2D.h" - -enum HOUSE_DIALOGUE_MENU: __int32 -{ - HOUSE_DIALOGUE_NULL = 0, - HOUSE_DIALOGUE_MAIN = 1, - HOUSE_DIALOGUE_SHOP_BUY_STANDARD = 2, - HOUSE_DIALOGUE_SHOP_SELL = 3, - HOUSE_DIALOGUE_SHOP_IDENTIFY = 4, - HOUSE_DIALOGUE_SHOP_REPAIR = 5, - HOUSE_DIALOGUE_SHOP_6 = 6, - HOUSE_DIALOGUE_BANK_PUT_GOLD = 7, - HOUSE_DIALOGUE_BANK_GET_GOLD = 8, - HOUSE_DIALOGUE_9 = 9, - HOUSE_DIALOGUE_TEMPLE_HEAL = 10, - HOUSE_DIALOGUE_TEMPLE_DONATE = 11, - HOUSE_DIALOGUE_12 = 12, - HOUSE_DIALOGUE_13 = 13, - HOUSE_DIALOGUE_14 = 14, - HOUSE_DIALOGUE_TAVERN_REST = 15, - HOUSE_DIALOGUE_TAVERN_BUY_FOOD = 16, - HOUSE_DIALOGUE_TRAININGHALL_TRAIN = 17, - HOUSE_DIALOGUE_GUILD_BUY_BOOKS = 18, - //... - HOUSE_DIALOGUE_36 = 36, - //.. - HOUSE_DIALOGUE_GUILD_LEARN_SKILL = 72, - //... - HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT = 94, - HOUSE_DIALOGUE_SHOP_BUY_SPECIAL = 95, - HOUSE_DIALOGUE_LEARN_SKILLS = 96, - HOUSE_DIALOGUE_97 = 97, - HOUSE_DIALOGUE_98 = 98, - HOUSE_DIALOGUE_TOWNHALL_MESSAGE = 99, - HOUSE_DIALOGUE_TOWNHALL_PAY_FINE = 100, - HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN = 101, - HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES = 102, - HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS = 103, - HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT = 104, - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1 = 105, - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_2 = 106, - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_3 = 107, - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_4 = 108, - HOUSE_DIALOGUE_OTHER = -1 -}; - -/* 349 */ -enum HOUSE_ID -{ - HOUSE_SMITH_EMERALD_ISLE = 1, - HOUSE_ARMOURER_EMERALD_ISLE = 15, - HOUSE_MAGE_EMERALD_ISLE = 29, - HOUSE_MAGE_HARMONDALE = 30, - HOUSE_ALCHEMIST_EMERALD_ISLE = 42, - HOUSE_ALCHEMIST_HARMONDALE = 43, - HOUSE_STABLES_HARMONDALE = 54, - HOUSE_STABLES_STEADWICK = 55, - HOUSE_STABLES_TULAREAN_FOREST = 56, - HOUSE_STABLES_DEYJA = 57, - HOUSE_STABLES_BRACADA_DESERT = 58, - HOUSE_STABLES_TATALIA = 59, - HOUSE_STABLES_AVLEE = 60, - HOUSE_STABLES_61 = 61, - HOUSE_STABLES_62 = 62, - HOUSE_BOATS_EMERALD_ISLE = 63, - HOUSE_BOATS_ERATHIA = 64, - HOUSE_BOATS_TULAREAN_FOREST = 65, - HOUSE_BOATS_BRACADA_DESERT = 66, - HOUSE_BOATS_EVENMORN_ISLAND = 67, - HOUSE_BOATS_68 = 68, - HOUSE_BOATS_TATALIA = 69, - HOUSE_BOATS_AVLEE = 70, - HOUSE_BOATS_71 = 71, - HOUSE_BOATS_72 = 72, - HOUSE_BOATS_73 = 73, - HOUSE_TEMPLE_EMERALD_ISLE = 74, - HOUSE_TEMPLE_HARMONDALE = 75, - HOUSE_TRAINING_HALL_EMERALD_ISLE = 89, - HOUSE_TRAINING_HALL_HARMONDALE = 90, - HOUSE_TRAINING_HALL_91 = 91, - HOUSE_TRAINING_HALL_92 = 92, - HOUSE_TRAINING_HALL_93 = 93, - HOUSE_TRAINING_HALL_94 = 94, - HOUSE_TRAINING_HALL_95 = 95, - - HOUSE_TOWNHALL_HARMONDALE = 102, - HOUSE_TAVERN_EMERALD_ISLE = 107, - HOUSE_BANK_HARMONDALE = 128, - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE = 139, - HOUSE_AIR_GUILD_INITIATE_EMERALD_ISLE = 143, - HOUSE_SPIRIT_GUILD_INITIATE_EMERALD_ISLE = 155, - HOUSE_BODY_GUILD_INITIATE_EMERALD_ISLE = 163, - HOUSE_BODY_GUILD_ERATHIA = 165, - HOUSE_DARK_GUILD_PIT = 170, - HOUSE_LORD_AND_JUDGE_EMERALD_ISLE = 186, - HOUSE_JAIL = 187, - HOUSE_JUDGE_HARMONDALE = 190, - HOUSE_224_EMERALD_ISLE = 224, - HOUSE_225_EMERALD_ISLE = 225, - HOUSE_238_EMERALD_ISLE = 238, - HOUSE_466_HARMONDALE = 466, - HOUSE_467_HARMONDALE = 467, - HOUSE_468_HARMONDALE = 468, - HOUSE_472_HARMONDALE = 472, - HOUSE_488_HARMONDALE = 488, - HOUSE_489_HARMONDALE = 489, - HOUSE_600 = 600,//??? - HOUSE_601 = 601//??? -}; - -enum HouseSoundID: unsigned __int32 -{ - HouseSound_Greeting = 1, // General greeting - HouseSound_NotEnoughMoney_TrainingSuccessful = 2, - HouseSound_Greeting_2 = 3, // Polite Greeting when you're guild member - HouseSound_Goodbye = 4 // farewells when bought something -}; - -bool HouseUI_CheckIfPlayerCanInteract(); -void TrainingDialog(); -void JailDialog(); -void MagicShopDialog(); -void GuildDialog(); -void sub_4B6478(); -bool __fastcall IsTravelAvailable(int a1); -void TravelByTransport(); -void TempleDialog(); -void TownHallDialog(); -void BankDialog(); -void TavernDialog(); -void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound); // idb -void WeaponShopDialog(); -void AlchemistDialog(); -void ArmorShopDialog(); -void SimpleHouseDialog(); -void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); -void PrepareHouse(enum HOUSE_ID house); // idb -bool EnterHouse(enum HOUSE_ID uHouseID); -void BackToHouseMenu(); - - -void InitializaDialogueOptions_Tavern(BuildingType type); // idb -void InitializaDialogueOptions_Shops(BuildingType type); -void InitializaDialogueOptions(BuildingType type); -void InitializeBuildingResidents(); - -extern int uHouse_ExitPic; // weak -extern int dword_591080; // weak -extern BuildingType in_current_building_type; // 00F8B198 -extern HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C - -int HouseDialogPressCloseBtn();
--- a/UI/UIMainMenu.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,344 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "..\Mouse.h" -#include "..\Keyboard.h" -#include "..\Engine/ErrorHandling.h" - -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\AudioPlayer.h" -#include "..\Engine/Graphics/Render.h" -#include "..\Engine/LOD.h" -#include "..\Engine/Graphics/PaletteManager.h" -#include "..\Engine/Tables/IconFrameTable.h" -#include "..\Engine/texts.h" -#include "..\Engine/MMT.h" - -#include "..\Engine/mm7_data.h" -#include "..\Engine/Game.h" - - -//----- (0041B578) -------------------------------------------------------- -void MainMenuUI_LoadFontsAndSomeStuff() -{ - //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); - pIcons_LOD->SetupPalettes(5, 6, 5); - //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); - pPaletteManager->SetColorChannelInfo(5, 6, 5); - pPaletteManager->RecalculateAll(); - - for (uint i = 0; i < window->GetHeight(); ++i) - pSRZBufferLineOffsets[i] = window->GetWidth() * i; - - pRenderer->ResetTextureClipRect(); - - uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE); - - pFontArrus = LoadFont("arrus.fnt", "FONTPAL", nullptr); - pFontArrus->field_3 = 0; - - pFontLucida = LoadFont("lucida.fnt", "FONTPAL", nullptr); - pFontLucida->field_3 = 0; - - pFontCreate = LoadFont("create.fnt", "FONTPAL", nullptr); - pFontCreate->field_3 = 0; - - pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", nullptr); - pFontComic = LoadFont("comic.fnt", "FONTPAL", nullptr); - - for (uint i = 0; i < 20; ++i) - pWindowList[i].eWindowType = WINDOW_null; - - uNumVisibleWindows = -1; - memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs)); -} - -//----- (004415C5) -------------------------------------------------------- -static void LoadPartyBuffIcons() -{ - for (uint i = 0; i < 14; ++i) - { - char filename[200]; - sprintf(filename, "isn-%02d", i + 1); - pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); - } - - uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); - uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); -} - -//----- (0041B690) -------------------------------------------------------- -void MainMenuUI_Create() -{ - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB")); - pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA")); - - pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); - - uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); - uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); - uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE); - uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE); - uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE); - uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE); - pTexture_Leather = pIcons_LOD->LoadTexturePtr("ibground", TEXTURE_16BIT_PALETTE); - uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE); - uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE); - uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE); - - pPrimaryWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); - pPrimaryWindow->CreateButton(7, 8, 460, 343, 1, 0, UIMSG_MouseLeftClickInGame, 0, 0, "", 0); - - pPrimaryWindow->CreateButton(61, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);//buttons for portraits - pPrimaryWindow->CreateButton(177, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - pPrimaryWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - pPrimaryWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - - pPrimaryWindow->CreateButton(24, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for HP - pPrimaryWindow->CreateButton(139, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); - pPrimaryWindow->CreateButton(255, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); - pPrimaryWindow->CreateButton(370, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); - - pPrimaryWindow->CreateButton(97, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for SP - pPrimaryWindow->CreateButton(212, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); - pPrimaryWindow->CreateButton(328, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); - pPrimaryWindow->CreateButton(443, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); - - uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); - pBtn_Quests = pPrimaryWindow->CreateButton(491, 353, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_ib_td1_A)->uTextureHeight, 1, 0, UIMSG_OpenQuestBook, 0, pKeyActionMap->GetActionVKey(INPUT_Quest), - pGlobalTXT_LocalizationStrings[174], pIcons_LOD->GetTexture(uTextureID_ib_td1_A), 0); //Quests - - uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE); - pBtn_Autonotes = pPrimaryWindow->CreateButton(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_ib_td2_A)->uTextureHeight, 1, 0, UIMSG_OpenAutonotes, 0, pKeyActionMap->GetActionVKey(INPUT_Autonotes), - pGlobalTXT_LocalizationStrings[154], pIcons_LOD->GetTexture(uTextureID_ib_td2_A), 0);//Autonotes - - uTextureID_ib_td3_A = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE); - pBtn_Maps = pPrimaryWindow->CreateButton(546, 353, pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_ib_td3_A)->uTextureHeight, 1, 0, UIMSG_OpenMapBook, 0, pKeyActionMap->GetActionVKey(INPUT_Mapbook), - pGlobalTXT_LocalizationStrings[139], pIcons_LOD->GetTexture(uTextureID_ib_td3_A), 0); //Maps - - uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE); - pBtn_Calendar = pPrimaryWindow->CreateButton(570, 353, pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_ib_td4_A)->uTextureHeight, 1, 0, UIMSG_OpenCalendar, 0, pKeyActionMap->GetActionVKey(INPUT_TimeCal), - pGlobalTXT_LocalizationStrings[78], pIcons_LOD->GetTexture(uTextureID_ib_td4_A), 0);//Calendar - - uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE); - pBtn_History = pPrimaryWindow->CreateButton(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_ib_td5_A)->uTextureHeight, 1, 0, UIMSG_OpenHistoryBook, 0, 72,//ascii - pGlobalTXT_LocalizationStrings[602], pIcons_LOD->GetTexture(uTextureID_ib_td5_A), 0);//History - - bFlashAutonotesBook = 0; - bFlashQuestBook = 0; - bFlashHistoryBook = 0; - - pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureWidth, - pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureHeight, 2, 0, UIMSG_ClickZoomInBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomIn), - pGlobalTXT_LocalizationStrings[252], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], 0); // Zoom In - - pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureWidth, - pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureHeight, 2, 0, UIMSG_ClickZoomOutBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomOut), - pGlobalTXT_LocalizationStrings[251], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], 0); // Zoom Out - - pPrimaryWindow->CreateButton(481, 0, 153, 67, 1, 92, UIMSG_0, 0, 0, "", 0); - pPrimaryWindow->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_StartHireling1Dialogue, 0, '5', "", 0); - pPrimaryWindow->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_StartHireling2Dialogue, 0, '6', "", 0); - pPrimaryWindow->CreateButton(476, 322, 77, 17, 1, 100, UIMSG_0, 0, 0, "", 0); - pPrimaryWindow->CreateButton(555, 322, 77, 17, 1, 101, UIMSG_0, 0, 0, "", 0); - - pBtn_CastSpell = pPrimaryWindow->CreateButton(476, 450, - pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureHeight, - 1, 0, UIMSG_SpellBookWindow, 0, 67, pGlobalTXT_LocalizationStrings[38], pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell), 0); - pBtn_Rest = pPrimaryWindow->CreateButton(518, 450, - pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureHeight, - 1, 0, UIMSG_RestWindow, 0, 82, pGlobalTXT_LocalizationStrings[182], pIcons_LOD->GetTexture(uTextureID_Btn_Rest), 0); - pBtn_QuickReference = pPrimaryWindow->CreateButton(560, 450, - pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureHeight, - 1, 0, UIMSG_QuickReference, 0, 90, pGlobalTXT_LocalizationStrings[173], pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference), 0); - pBtn_GameSettings = pPrimaryWindow->CreateButton(602, 450, - pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureWidth, - pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureHeight, - 1, 0, UIMSG_GameMenuButton, 0, 0, pGlobalTXT_LocalizationStrings[93], pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings), 0); - - pBtn_NPCLeft = pPrimaryWindow->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 = pPrimaryWindow->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); - LoadPartyBuffIcons(); -} - - - - -//----- (00452AF3) -------------------------------------------------------- -void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels) -{ - void *v3; // edi@1 - unsigned int v4; // eax@1 - unsigned __int16 *v5; // edi@3 - unsigned int i; // ecx@3 - - if (for_refactoring) - { - MessageBoxA(nullptr, "Nomad: sub operates on 16 bit pixels, we have 32 bits.", "", 0); - __debugbreak(); - } - - v3 = pPixels; - v4 = a1 | (a1 << 16); - if ( (unsigned __int8)pPixels & 2 ) // first 2 pixels - { - *pPixels = v4; - v3 = pPixels + 1; - --uNumPixels; - } - memset32(v3, v4, uNumPixels >> 1); // 4 pixels at once - v5 = (unsigned __int16 *)((char *)v3 + 4 * (uNumPixels >> 1)); - for ( i = uNumPixels & 1; i; --i ) // leftover pixels - { - *v5 = v4; - ++v5; - } -} - -//----- (004979D2) -------------------------------------------------------- -MENU_STATE MainMenuUI_Credits_Loop() -{ - char *cred_texturet; // edi@5 - FILE *pFile; // eax@5 - unsigned int pSize; // esi@7 - MSG Msg; // [sp+84h] [bp-B8h]@10 - GUIWindow credit_window; - int move_Y; // [sp+128h] [bp-14h]@1 - char *pString; // [sp+12Ch] [bp-10h]@9 - GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 - GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 - RGBTexture mm6title_texture; // [sp+54h] [bp-E8h]@1 - RGBTexture cred_texture; // [sp+100h] [bp-3Ch]@1 - Texture pTemporaryTexture; // [sp+Ch] [bp-130h]@5 - - pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); - pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); - - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - //dword_A74C88 = 0;//??? часть дальнейшего кода отсутствует, там использовалась данная переменная - - pAudioPlayer->PlayMusicTrack(MUSIC_Credits); - - mm6title_texture.Load("mm6title.pcx", 0); - cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); - pFile = pEvents_LOD->FindContainer("credits.txt", 0); - if ( !pFile ) - Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. - - // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." - - //для получения размера----------------------- - fread(&pTemporaryTexture, 1, 0x30, pFile); - pSize = pTemporaryTexture.uDecompressedSize; - if ( !pSize ) - pSize = pTemporaryTexture.uTextureSize; - memset(&pTemporaryTexture, 0, 0x48);//обнуление - cred_texturet[pSize] = 0;//конец текста - - credit_window.uFrameWidth = 250; - credit_window.uFrameHeight = 440; - credit_window.uFrameX = 389; - credit_window.uFrameY = 19; - - cred_texture.uWidth = 250; - cred_texture.uHeight = pFontQuick->GetStringHeight2(pFontCChar, cred_texturet, &credit_window, 0, 1) + 2 * credit_window.uFrameHeight; - cred_texture.uNumPixels = cred_texture.uWidth * cred_texture.uHeight; - cred_texture.pPixels = (unsigned __int16 *)malloc(2 * cred_texture.uNumPixels); - fill_pixels_fast(Color16(0, 0xFFu, 0xFFu), cred_texture.pPixels, cred_texture.uNumPixels); - cred_texture._allocation_flags = 0; - - //дать шрифт и цвета тексту - pString = (char *)malloc(2 * pSize); - strncpy(pString, cred_texturet, pSize); - pString[pSize] = 0; - pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, cred_texture.uWidth, - cred_texture.uHeight, Color16(0x70u, 0x8Fu, 0xFEu), Color16(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth); - free(pString); - - pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, cred_texturet); - pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); - pCurrentScreen = SCREEN_CREATORS; - SetCurrentMenuID(MENU_CREDITSPROC); - - move_Y = 0; - do - { - while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) - { - if ( Msg.message == 18 ) - Game_DeinitializeAndTerminate(0); - TranslateMessage(&Msg); - DispatchMessageA(&Msg); - } - if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) - { - WaitMessage(); - } - else - { - pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &mm6title_texture); - pRenderer->SetTextureClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth, - credit_window.uFrameY + credit_window.uFrameHeight); - pRenderer->CreditsTextureScroll(credit_window.uFrameX, credit_window.uFrameY, 0, move_Y, &cred_texture); - pRenderer->ResetTextureClipRect(); - pRenderer->EndScene(); - ++move_Y; - if ( move_Y >= cred_texture.uHeight ) - SetCurrentMenuID(MENU_MAIN); - pRenderer->Present(); - pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() - GUI_MainMenuMessageProc(); - } - } - while ( GetCurrentMenuID() == MENU_CREDITSPROC ); - pAudioPlayer->_4AA258(1); - free(cred_texturet); - free(pFontQuick); - free(pFontCChar); - pWindow_MainMenu->Release(); - pIcons_LOD->RemoveTexturesPackFromTextureList(); - mm6title_texture.Release(); - cred_texture.Release(); - return MENU_MAIN; // return MENU_Main -}
--- a/UI/UIMainMenu.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#pragma once \ No newline at end of file
--- a/UI/UIMsgProc.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#pragma once \ No newline at end of file
--- a/UI/UIOptions.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "..\Engine/MM7.h" - -#include "..\Keyboard.h" -#include "..\Engine/Graphics/IndoorCameraD3D.h" -#include "..\Engine/Graphics/GammaControl.h" -#include "..\Engine/Graphics/Render.h" - -#include "..\Engine/Game.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\AudioPlayer.h" -#include "..\Engine/LOD.h" -#include "..\Engine/texts.h" - -#include "..\Engine/mm7_data.h" - - - - -OptionsMenuSkin options_menu_skin; // 507C60 - - -std::array<bool, 28> GameMenuUI_InvaligKeyBindingsFlags; // 506E6C -//----- (00414D24) -------------------------------------------------------- -static unsigned int GameMenuUI_GetKeyBindingColor(int key_index) -{ - if (uGameMenuUI_CurentlySelectedKeyIdx == key_index) - { - if (GetTickCount() % 1000 < 500) - return ui_gamemenu_keys_key_selection_blink_color_1; - else - return ui_gamemenu_keys_key_selection_blink_color_2; - } - else if (GameMenuUI_InvaligKeyBindingsFlags[key_index]) - { - int intensity; - - int time = GetTickCount() % 800; - if (time < 400) - intensity = - 70 + 70 * time / 400; - else - intensity = + 70 - 70 * time / 800; - - return Color16(185 + intensity, 40 + intensity / 4, 40 + intensity / 4); - } - - return ui_gamemenu_keys_key_default_color; -} - -//----- (004142D3) -------------------------------------------------------- -void GameMenuUI_DrawKeyBindings() -{ - signed int v4; // ecx@7 - signed int v5; // eax@8 - - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) - { - pPrevVirtualCidesMapping[uGameMenuUI_CurentlySelectedKeyIdx] = pKeyActionMap->pPressedKeysBuffer[0]; - memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); - v4 = 0; - do - { - v5 = 0; - do - { - if ( v4 != v5 && pPrevVirtualCidesMapping[v4] == pPrevVirtualCidesMapping[v5] ) - { - GameMenuUI_InvaligKeyBindingsFlags[v4] = true; - GameMenuUI_InvaligKeyBindingsFlags[v5] = true; - } - ++v5; - } - while ( v5 < 28 ); - ++v4; - } - while ( v4 < 28 ); - uGameMenuUI_CurentlySelectedKeyIdx = -1; - pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - } - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Optkb[0]));//draw base texture - if ( KeyboardPageNum == 1 ) - { - pRenderer->DrawTextureIndexed(19, 302, pIcons_LOD->GetTexture(uTextureID_Optkb[3])); - - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "ВПЕРЁД", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(0), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "НАЗАД", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(1), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[1]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ВЛЕВО", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(2), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[2]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "ВПРАВО", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(3), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[3]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "КРИК", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(4), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[4]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "ПРЫЖОК", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(5), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[5]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "П.РЕЖИМ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(6), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[6]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "ПРИМ. ЗАКЛ.", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(7), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[7]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "АТАКА", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(8), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[8]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ДЕЙСТВ.", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(9), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[9]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ЗАКЛИН.", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(10), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[10]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "ИГРОК", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(11), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[11]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "СЛЕД. ИГРОК", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(12), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[12]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ЗАДАНИЯ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(13), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[13]), 0, 0, 0); - } - else - { - pRenderer->DrawTextureIndexed(127, 302, pIcons_LOD->GetTexture(uTextureID_Optkb[4])); - - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "Б. СПРАВКА", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(14), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "ОТДЫХ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(15), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[15]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ТЕК. ВРЕМЯ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(16), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[16]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "АВТОЗАМЕТКИ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(17), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[17]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "КАРТА", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(18), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[18]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "БЕЖАТЬ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(19), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[19]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "СМ. ВВЕРХ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(20), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[20]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "СМ. ВНИЗ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(21), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[21]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "СМ. ВПЕРЁД", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(22), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[22]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ПРИБЛИЗ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(23), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[23]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ОТДАЛИТЬ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(24), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[24]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "П. ВВЕРХ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(25), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[25]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "П. ВНИЗ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(26), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[26]), 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ПРИЗЕМЛ", 0, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(27), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[27]), 0, 0, 0); - } -} - -//----- (00414D9A) -------------------------------------------------------- -void GameMenuUI_DrawVideoOptions() -{ - GUIWindow msg_window; // [sp+8h] [bp-54h]@3 - - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(optvid_base_texture_id));//draw base texture - //if ( !pRenderer->bWindowMode && pRenderer->IsGammaSupported() ) - { - pRenderer->DrawTextureIndexed(17 * uGammaPos + 42, 162, pIcons_LOD->GetTexture(pTextureIDs_GammaPositions[uGammaPos])); - pRenderer->DrawTextureRGB(274, 169, &stru_506E40);//review_window - msg_window.uFrameX = 22; - msg_window.uFrameY = 190; - msg_window.uFrameWidth = 211; - msg_window.uFrameHeight = 79; - msg_window.uFrameZ = 232; - msg_window.uFrameW = 268; - msg_window.DrawTitleText(pFontSmallnum, 0, 0, ui_gamemenu_video_gamma_title_color, pGlobalTXT_LocalizationStrings[226], 3); // "Gamma controls the relative ""brightness"" of the game. May vary depending on your monitor." - } - - /*if (!pRenderer->pRenderD3D) - { - pRenderer->DrawTextureIndexed(20, 281, pIcons_LOD->GetTexture(not_available_bloodsplats_texture_id)); - pRenderer->DrawTextureIndexed(20, 303, pIcons_LOD->GetTexture(not_available_us_colored_lights_texture_id)); - pRenderer->DrawTextureIndexed(20, 325, pIcons_LOD->GetTexture(not_available_tinting_texture_id)); - } - else*/ - { - if (pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS) - pRenderer->DrawTextureIndexed(20, 281, pIcons_LOD->GetTexture(bloodsplats_texture_id)); - if (pRenderer->bUseColoredLights) - pRenderer->DrawTextureIndexed(20, 303, pIcons_LOD->GetTexture(us_colored_lights_texture_id)); - if (pRenderer->bTinting) - pRenderer->DrawTextureIndexed(20, 325, pIcons_LOD->GetTexture(tinting_texture_id)); - } -} - -//----- (00414F82) -------------------------------------------------------- -void GameMenuUI_Options_Draw() -{ - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Options)); - pRenderer->DrawTextureIndexed(8, 132, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_Background)); - - switch (uTurnSpeed) - { - case 64: pRenderer->DrawTextureIndexed(BtnTurnCoord[1], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])); break; - case 128: pRenderer->DrawTextureIndexed(BtnTurnCoord[2], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])); break; - default: pRenderer->DrawTextureIndexed(BtnTurnCoord[0], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])); break; - } - - if (bWalkSound) pRenderer->DrawTextureIndexed( 20, 303, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)); - if (bShowDamage) pRenderer->DrawTextureIndexed(128, 303, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)); - if (bFlipOnExit) pRenderer->DrawTextureIndexed(128, 325, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)); - if (bAlwaysRun) pRenderer->DrawTextureIndexed( 20, 325, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)); - - pRenderer->DrawTextureIndexed(265 + 17 * uSoundVolumeMultiplier, 162, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_SoundLevels[uSoundVolumeMultiplier])); - pRenderer->DrawTextureIndexed(265 + 17 * uMusicVolimeMultiplier, 216, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_SoundLevels[uMusicVolimeMultiplier])); - pRenderer->DrawTextureIndexed(265 + 17 * uVoicesVolumeMultiplier, 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_SoundLevels[uVoicesVolumeMultiplier])); -} - -OptionsMenuSkin::OptionsMenuSkin(): - uTextureID_Background(0), - uTextureID_ArrowLeft(0), - uTextureID_ArrowRight(0), - uTextureID_unused_0(0), uTextureID_unused_1(0), uTextureID_unused_2(0), - uTextureID_FlipOnExit(0), - uTextureID_AlwaysRun(0), - uTextureID_WalkSound(0), - uTextureID_ShowDamage(0) -{ - for (uint i = 0; i < 3; ++i) uTextureID_TurnSpeed[i] = 0; - for (uint i = 0; i < 10; ++i) uTextureID_SoundLevels[i] = 0; -} - -void OptionsMenuSkin::Relaease() -{ - #define RELEASE(id) \ - {\ - if (id)\ - pIcons_LOD->GetTexture(id)->Release();\ - id = 0;\ - } - - RELEASE(uTextureID_Background); - for (uint i = 0; i < 3; ++i) - RELEASE(uTextureID_TurnSpeed[i]); - RELEASE(uTextureID_ArrowLeft); - RELEASE(uTextureID_ArrowRight); - RELEASE(uTextureID_FlipOnExit); - for (uint i = 0; i < 10; ++i) - RELEASE(uTextureID_SoundLevels[i]); - RELEASE(uTextureID_AlwaysRun); - RELEASE(uTextureID_WalkSound); - RELEASE(uTextureID_ShowDamage); - - #undef RELEASE -} \ No newline at end of file
--- a/UI/UIOptions.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#pragma once \ No newline at end of file
--- a/UI/UIPartyCreation.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,736 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "UIPartyCreation.h" -#include "..\Mouse.h" -#include "..\Keyboard.h" -#include "..\Engine/ErrorHandling.h" - -#include "..\Engine/Game.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\Engine/Party.h" -#include "..\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/mm7_data.h" - - - -//----- (004908DE) -------------------------------------------------------- -bool PlayerCreation_Choose4Skills() -{ - signed int skills_count; // edx@2 - - for ( uint j = 0; j < 4; ++j ) - { - skills_count = 0; - for ( uint i = 0; i < 37; ++i ) - { - if ( pParty->pPlayers[j].pActiveSkills[i] ) - ++skills_count; - } - if ( skills_count < 4 ) - return false; - } - return true; -} - -//----- (00491CB5) -------------------------------------------------------- -void LoadPlayerPortraintsAndVoices() -{ - pIcons_LOD->pFacesLock = pIcons_LOD->uNumLoadedFiles; - - for (uint i = 0; i < 4; ++i) - for (uint j = 0; j < 56; ++j) - { - sprintf(pTmpBuf.data(), "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uCurrentFace], j + 1); - pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - } - - pTexture_PlayerFaceEradicated = pIcons_LOD->LoadTexturePtr("ERADCATE", TEXTURE_16BIT_PALETTE); - pTexture_PlayerFaceDead = pIcons_LOD->LoadTexturePtr("DEAD", TEXTURE_16BIT_PALETTE); - pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE); - - if (SoundSetAction[24][0]) - for (uint i = 0; i < 4; ++i) - { - pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998, 0); - pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999, 0); - } -} - -//----- (00491DE7) -------------------------------------------------------- -void ReloadPlayerPortraits(int player_id, int face_id)//the transition from the zombies in the normal state -{ - for ( uint i = 0; i <= 55; ++i ) - { - sprintf(pTmpBuf.data(), "%s%02d", pPlayerPortraitsNames[face_id], i + 1); - pIcons_LOD->ReloadTexture(pTextures_PlayerFaces[player_id][i], pTmpBuf.data(), 2); - } -} -//----- (00495B39) -------------------------------------------------------- -void PlayerCreationUI_Draw() -{ - int pTextCenter; // eax@3 - IconFrame *pFrame; // eax@3 - int pX; // ecx@7 - GUIButton *uPosActiveItem; // edi@12 - int v17; // eax@33 - int uStatLevel; // eax@44 - unsigned int pStatColor; // eax@44 - PLAYER_SKILL_TYPE pSkillsType; // eax@44 - PLAYER_CLASS_TYPE uClassType; // edi@53 - int pColorText; // eax@53 - PLAYER_SKILL_TYPE pSkillId; // edi@72 - size_t pLenText; // eax@72 - signed int v104; // ecx@72 -// int pTextY; // ST08_4@81 - signed int pBonusNum; // edi@82 - const char *uRaceName; // [sp+0h] [bp-170h]@39 - char pText[200]; // [sp+10h] [bp-160h]@14 - GUIWindow message_window; // [sp+D8h] [bp-98h]@83 - int v126; // [sp+148h] [bp-28h]@25 - int pIntervalY; // [sp+150h] [bp-20h]@14 - int pX_Numbers; // [sp+154h] [bp-1Ch]@18 - int uX; // [sp+160h] [bp-10h]@18 - int pIntervalX; - int pCorrective; - - //move sky - pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); - uPlayerCreationUI_SkySliderPos = (GetTickCount() % 12800) / 20; - pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY); - pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos - window->GetWidth(), 2, pTexture_MAKESKY); - pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP); - - uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7; - switch (uPlayerCreationUI_SelectedCharacter) - { - case 0: pX = 12; break; - case 1: pX = 171; break; - case 2: pX = 329; break; - case 3: pX = 488; break; - default: - Error("Invalid selected character"); - } - - pTextCenter = pFontCChar->AlignText_Center(window->GetWidth(), pGlobalTXT_LocalizationStrings[51]); - pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, pGlobalTXT_LocalizationStrings[51], 0, 0, 0);//С О З Д А Т Ь О Т Р Я Д - pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uCurrentFace]); - pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uCurrentFace]); - pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uCurrentFace]); - pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uCurrentFace]); - pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime); - - - pRenderer->DrawTextureTransparent(pX, 29, &pIcons_LOD->pTextures[pFrame->uTextureID]); - uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem); - uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25; - pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]); - pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]); - - memset(pText, 0, 200); - strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills" - for ( int i = strlen(pText) - 1; i >= 0; i-- )//??? - pText[i] = toupper((unsigned __int8)pText[i]); - - pIntervalX = 18; - pIntervalY = pFontCreate->uFontHeight - 2; - uX = 32; - pX_Numbers = 493; - - for (int i = 0; i < 4; ++i) - { - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pIntervalX + 73, 100, 0, pClassNames[pParty->pPlayers[i].classType], 0, 0, 0); - pRenderer->DrawTextureTransparent(pIntervalX + 77, 50, pTexture_IC_KNIGHT[pParty->pPlayers[i].classType / 4]); - - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_NONE && pGUIWindow_CurrentMenu->ptr_1C == (void *)i ) - { - switch ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 ) - { - case WINDOW_INPUT_IN_PROGRESS://press name panel - v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, pKeyActionMap->pPressedKeysBuffer, 120, 1); - pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate); - break; - case WINDOW_INPUT_CONFIRMED: // press enter - pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - v126 = 0; - for ( int i = 0; i < strlen(pKeyActionMap->pPressedKeysBuffer); ++i )//edit name - { - if ( pKeyActionMap->pPressedKeysBuffer[i] == ' ' ) - ++v126; - } - if ( strlen(pKeyActionMap->pPressedKeysBuffer) && v126 != strlen(pKeyActionMap->pPressedKeysBuffer) ) - strcpy(pParty->pPlayers[i].pName, pKeyActionMap->pPressedKeysBuffer); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0); - pParty->pPlayers[i].field_1988[27] = 1; - break; - case WINDOW_INPUT_CANCELLED: // press escape - pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0); - SetCurrentMenuID(MENU_NAMEPANELESC); - break; - } - } - else - { - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0); - } - - switch (pParty->pPlayers[i].GetRace()) - { - case 0: uRaceName = pGlobalTXT_LocalizationStrings[99]; break; // "Human" - case 1: uRaceName = pGlobalTXT_LocalizationStrings[103]; break; // "Dwarf" - case 2: uRaceName = pGlobalTXT_LocalizationStrings[106]; break; // "Goblin" - case 3: uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Elf" - }; - strcpy(pTmpBuf.data(), uRaceName); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX + 72, pIntervalY + 12, 0, pTmpBuf.data(), 130, 0);//Race Name - - pTextCenter = pFontCreate->AlignText_Center(150, pText); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + uX - 24, 291, Color16(0xD1, 0xBB, 0x61), pText, 0, 0, 0); // Skills - - uStatLevel = pParty->pPlayers[i].GetActualMight(); - sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], pX_Numbers, uStatLevel);// "Might" - pStatColor = pParty->pPlayers[i].GetStatColor(0); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, pStatColor, pTmpBuf.data(), 0, 0, 0); - - uStatLevel = pParty->pPlayers[i].GetActualIntelligence(); - sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], pX_Numbers, uStatLevel);// "Intellect" - pStatColor = pParty->pPlayers[i].GetStatColor(1); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); - - uStatLevel = pParty->pPlayers[i].GetActualWillpower(); - sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], pX_Numbers, uStatLevel);// "Personality" - pStatColor = pParty->pPlayers[i].GetStatColor(2); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); - - uStatLevel = pParty->pPlayers[i].GetActualEndurance(); - sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], pX_Numbers, uStatLevel);// "Endurance" - pStatColor = pParty->pPlayers[i].GetStatColor(3); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 3 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); - - uStatLevel = pParty->pPlayers[i].GetActualAccuracy(); - sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], pX_Numbers, uStatLevel);// "Accuracy" - pStatColor = pParty->pPlayers[i].GetStatColor(4); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); - - uStatLevel = pParty->pPlayers[i].GetActualSpeed(); - sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], pX_Numbers, uStatLevel);// "Speed" - pStatColor = pParty->pPlayers[i].GetStatColor(5); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 5 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); - - uStatLevel = pParty->pPlayers[i].GetActualLuck(); - sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], pX_Numbers, uStatLevel);// "Luck" - pStatColor = pParty->pPlayers[i].GetStatColor(6); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 6 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0); - - - pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(0); - pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); - sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, Color16(0xFF, 0xFF, 0xFF), pTmpBuf.data(), 0, 0, 0); - - pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(1); - pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); - sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, pIntervalY + 311, Color16(0xFF, 0xFF, 0xFF), pTmpBuf.data(), 0, 0, 0); - - pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(2); - pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); - sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); - pColorText = Color16(0, 0xFF, 0); - if ( (signed int)pSkillsType >= 37 ) - pColorText = Color16(0, 0xF7, 0xF7); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0); - - pSkillsType = pParty->pPlayers[i].GetSkillIdxByOrder(3); - pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]); - sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]); - pColorText = Color16(0, 0xFF, 0); - if ( (signed int)pSkillsType >= 37 ) - pColorText = Color16(0, 0xF7, 0xF7); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 3 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0); - - pIntervalX += 159; - pX_Numbers -= 158; - uX += 158; - } - - strcpy(pText, pGlobalTXT_LocalizationStrings[41]);// "Class" - for ( int i = strlen(pText) - 1; i >= 0; i-- ) - pText[i] = toupper((unsigned __int8)pText[i]); - - uClassType = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].classType; - pTextCenter = pFontCreate->AlignText_Center(193, pText); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 324, 395, Color16(0xD1, 0xBB, 0x61), pText, 0, 0, 0);//Classes - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[0]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 417, pColorText, pClassNames[0], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_PALADIN ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[12]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, pIntervalY + 417, pColorText, pClassNames[12], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_DRUID ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[20]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 2 * pIntervalY + 417, pColorText, pClassNames[20], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_CLERIC ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[24]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 417, pColorText, pClassNames[24], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_DRUID) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[28]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, pIntervalY + 417, pColorText, pClassNames[28], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_SORCERER ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[32]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 2 * pIntervalY + 417, pColorText, pClassNames[32], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_ARCHER ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[16]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 417, pColorText, pClassNames[16], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_MONK ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[8]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, pIntervalY + 417, pColorText, pClassNames[8], 0, 0, 0); - - pColorText = Color16(0, 0xF7, 0xF7); - if ( uClassType != PLAYER_CLASS_THEIF ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[4]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 2 * pIntervalY + 417, pColorText, pClassNames[4], 0, 0, 0); - - pTextCenter = pFontCreate->AlignText_Center(236, pGlobalTXT_LocalizationStrings[20]); // "Available Skills" - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 37, 395, Color16(0xD1, 0xBB, 0x61), pGlobalTXT_LocalizationStrings[20], 0, 0, 0); - for (uint i = 0; i < 9; ++i) - { - pSkillId = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(i + 4); - strcpy(pText, pSkillNames[pSkillId]); - pLenText = strlen(pText); - v104 = 0; - if ( (signed int)pLenText > 0 ) - { - if ( pText[v104] == 32 ) - { - pText[v104] = 0; - } - else - { - while ( pText[v104] != 32 ) - { - ++v104; - if ( v104 >= (signed int)pLenText ) - break; - } - } - } - pCorrective = -10;//-5 - if ( (signed int)pLenText < 8 )//if ( (signed int)v124 > 2 ) - pCorrective = 0; - pColorText = Color16(0, 0xF7, 0xF7); - if ( !pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pSkillId] ) - pColorText = Color16(0xFF, 0xFF, 0xFF); - pTextCenter = pFontCreate->AlignText_Center(100, pText); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 100 * (i / 3) + pTextCenter + pCorrective + 17, pIntervalY * (i % 3) + 417, pColorText, pText, 0, 0, 0); - } - - pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus" - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, Color16(0xD1, 0xBB, 0x61), pGlobalTXT_LocalizationStrings[30], 0, 0, 0); - pBonusNum = PlayerCreation_GetUnspentAttributePointCount(); - sprintf(pTmpBuf.data(), "%d", pBonusNum); - pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf.data()); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, Color16(0xFF, 0xFF, 0xFF), pTmpBuf.data(), 0, 0, 0); - if ( GameUI_Footer_TimeLeft > GetTickCount() ) - { - message_window.Hint = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points." - if ( pBonusNum < 0 ) - message_window.Hint = pGlobalTXT_LocalizationStrings[413];// "You can't spend more than 50 points." - message_window.uFrameWidth = 300; - message_window.uFrameHeight = 100; - message_window.uFrameX = 170; - message_window.uFrameY = 140; - message_window.uFrameZ = 469; - message_window.uFrameW = 239; - message_window.DrawMessageBox(0); - } - pRenderer->EndScene(); -} - -//----- (0049695A) -------------------------------------------------------- -void PlayerCreationUI_Initialize() -{ - unsigned int v0; // ebx@5 - signed int uControlParam; // [sp+10h] [bp-Ch]@7 - signed int uX; // [sp+14h] [bp-8h]@5 - - pMessageQueue_50CBD0->Flush(); - - pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pCurrentScreen = SCREEN_PARTY_CREATION; - uPlayerCreationUI_ArrowAnim = 0; - uPlayerCreationUI_SkySliderPos = 0; - uPlayerCreationUI_SelectedCharacter = 0; - v0 = LOBYTE(pFontCreate->uFontHeight) - 2; - pTexture_IC_KNIGHT[0] = pIcons_LOD->LoadTexturePtr("IC_KNIGHT", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[1] = pIcons_LOD->LoadTexturePtr("IC_THIEF", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[2] = pIcons_LOD->LoadTexturePtr("IC_MONK", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[3] = pIcons_LOD->LoadTexturePtr("IC_PALAD", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[4] = pIcons_LOD->LoadTexturePtr("IC_ARCH", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[5] = pIcons_LOD->LoadTexturePtr("IC_RANGER", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[6] = pIcons_LOD->LoadTexturePtr("IC_CLER", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[7] = pIcons_LOD->LoadTexturePtr("IC_DRUID", TEXTURE_16BIT_PALETTE); - pTexture_IC_KNIGHT[8] = pIcons_LOD->LoadTexturePtr("IC_SORC", TEXTURE_16BIT_PALETTE); - pTexture_MAKETOP = pIcons_LOD->LoadTexturePtr("MAKETOP", TEXTURE_16BIT_PALETTE); - pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE); - for( uX = 0; uX < 22; ++uX ) // load PlayerPortraits texture - { - sprintf(pTmpBuf.data(), "%s01", pPlayerPortraitsNames[uX]); - pPlayerPortraits[uX] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE)]; - - } - pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE); - pTexture_buttminu = pIcons_LOD->LoadTexturePtr("buttminu", TEXTURE_16BIT_PALETTE); - pTexture_buttplus = pIcons_LOD->LoadTexturePtr("buttplus", TEXTURE_16BIT_PALETTE); - pTexture_pressrigh = pIcons_LOD->LoadTexturePtr("presrigh", TEXTURE_16BIT_PALETTE); - pTexture_presleft = pIcons_LOD->LoadTexturePtr("presleft", TEXTURE_16BIT_PALETTE); - uControlParam = 1; - do - { - sprintf(pTmpBuf.data(), "arrowl%d", uControlParam); - pTextures_arrowl[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - - sprintf(pTmpBuf.data(), "arrowr%d", uControlParam); - pTextures_arrowr[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - } - while ( ++uControlParam < 20 ); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); - uControlParam = 0; - uX = 8; - do - { - pGUIWindow_CurrentMenu->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_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_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_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); - - 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); - 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); - - 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); - uControlParam += 7; - uX += 158; - } - while ( (signed int)uControlParam < 30 ); - pGUIWindow_CurrentMenu->_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); - - uControlParam = 0; - do - { - 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, - 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); - - pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); -} -// 4E28F8: using guessed type int pCurrentScreen; - -//----- (0049750E) -------------------------------------------------------- -void DeleteCCharFont() -{ - free(pFontCChar); - pFontCChar = 0; -} -//----- (00497526) -------------------------------------------------------- -bool PlayerCreationUI_Loop() -{ - LONG uMouseX; // edi@6 - LONG uMouseY; // eax@6 - //GUIButton *pControlsHead; // edx@6 - //int pControlParam; // esi@12 - signed int v8; // edi@30 - int v9; // edx@31 -// char *v10; // ebx@37 - ItemGen item; // [sp+Ch] [bp-74h]@37 - char v20[32]; // [sp+30h] [bp-50h]@29 - MSG Msg; // [sp+50h] [bp-30h]@17 - POINT v25; // [sp+6Ch] [bp-14h]@6 - bool party_not_creation_flag; // [sp+74h] [bp-Ch]@1 - - party_not_creation_flag = false; - pTexture_PCX.Release(); - pTexture_PCX.Load("makeme.pcx", 0); - - pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - SetCurrentMenuID(MENU_CREATEPARTY); - while ( GetCurrentMenuID() == MENU_CREATEPARTY ) - { - uMouseX = pMouse->GetCursorPos(&v25)->x; - uMouseY = pMouse->GetCursorPos(&v25)->y; - //pControlsHead = pGUIWindow_CurrentMenu->pControlsHead; - - //does nothing actually - /*if ( pControlsHead != (GUIButton *)v1 ) - { - pNumMessage = pMessageQueue_50CBD0->uNumMessages; - do - { - if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ - && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement - { - pControlParam = pControlsHead->uControlParam; - pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0); - v1 = 0; - } - pControlsHead = pControlsHead->pNext; - } - while ( pControlsHead != (GUIButton *)v1 ); - }*/ - - while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) ) - { - if ( Msg.message == WM_QUIT ) - Game_DeinitializeAndTerminate(0); - TranslateMessage(&Msg); - DispatchMessageA(&Msg); - } - if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) - WaitMessage(); - else - { - PlayerCreationUI_Draw(); - GUI_MainMenuMessageProc(); - pRenderer->BeginScene(); - GUI_UpdateWindows(); - pRenderer->EndScene(); - pRenderer->Present(); - if ( uGameState == GAME_FINISHED )//if click Esc in PlayerCreation Window - { - party_not_creation_flag = true; - SetCurrentMenuID(MENU_MAIN); - continue; - } - if ( uGameState == GAME_STATE_STARTING_NEW_GAME )//if click OK in PlayerCreation Window - { - uGameState = GAME_STATE_PLAYING; - SetCurrentMenuID(MENU_NEWGAME); - continue; - } - } - } - pTexture_PCX.Release(); - pGUIWindow_CurrentMenu->Release(); - pIcons_LOD->RemoveTexturesPackFromTextureList(); - - memset(v20, 0, 32); - for ( int i = 0; i < 32; i++ ) - { - for ( v8 = 0; v8 < 10; ++v8 ) - { - v9 = rand() % 32; - if ( !v20[v9] ) - break; - } - if ( v8 == 10 ) - { - v9 = 0; - if ( v20[0] ) - { - do - ++v9; - while ( v20[v9] ); - } - } - pParty->field_854[i] = v9; - v20[v9] = 1; - } - - item.Reset(); - for (uint i = 0; i < 4; ++i) - { - if (pParty->pPlayers[i].classType == PLAYER_CLASS_KNIGHT) - pParty->pPlayers[i].sResMagicBase = 10; - pParty->pPlayers[i].pPlayerBuffs[22].uExpireTime = 0; - for (uint j = 0; j < 9; j++) - { - if (pParty->pPlayers[i].pActiveSkills[PLAYER_SKILL_FIRE + j]) - { - pParty->pPlayers[i].lastOpenedSpellbookPage = j; - break; - } - } - pItemsTable->GenerateItem(2, 40, &item); - pParty->pPlayers[i].AddItem2(-1, &item); - - pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); - pParty->pPlayers[i].sMana = pParty->pPlayers[i].GetMaxMana(); - for (uint j = 0; j < 37; ++j) - { - if (!pParty->pPlayers[i].pActiveSkills[j]) - continue; - - switch (j) - { - case PLAYER_SKILL_STAFF: pParty->pPlayers[i].AddItem(-1, 61); break; - case PLAYER_SKILL_SWORD: pParty->pPlayers[i].AddItem(-1, 1); break; - case PLAYER_SKILL_DAGGER: pParty->pPlayers[i].AddItem(-1, 15); break; - case PLAYER_SKILL_AXE: pParty->pPlayers[i].AddItem(-1, 23); break; - case PLAYER_SKILL_SPEAR: pParty->pPlayers[i].AddItem(-1, 31); break; - case PLAYER_SKILL_BOW: pParty->pPlayers[i].AddItem(-1, 47); break; - case PLAYER_SKILL_MACE: pParty->pPlayers[i].AddItem(-1, 50); break; - case PLAYER_SKILL_BLASTER: Error("No blasters at startup :p"); - case PLAYER_SKILL_SHIELD: pParty->pPlayers[i].AddItem(-1, 84); break; - case PLAYER_SKILL_LEATHER: pParty->pPlayers[i].AddItem(-1, 66); break; - case PLAYER_SKILL_CHAIN: pParty->pPlayers[i].AddItem(-1, 71); break; - case PLAYER_SKILL_PLATE: pParty->pPlayers[i].AddItem(-1, 76); break; - case PLAYER_SKILL_FIRE: - pParty->pPlayers[i].AddItem(-1, 0x191); - pParty->pPlayers[i].spellbook.pFireSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_AIR: - pParty->pPlayers[i].AddItem(-1, 0x19C); - pParty->pPlayers[i].spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_WATER: - pParty->pPlayers[i].AddItem(-1, 0x1A7); - pParty->pPlayers[i].spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_EARTH: - pParty->pPlayers[i].AddItem(-1, 0x1B2); - pParty->pPlayers[i].spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_SPIRIT: - pParty->pPlayers[i].AddItem(-1, 0x1BD); - pParty->pPlayers[i].spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_MIND: - pParty->pPlayers[i].AddItem(-1, 0x1C8); - pParty->pPlayers[i].spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_BODY: - pParty->pPlayers[i].AddItem(-1, 0x1D3); - pParty->pPlayers[i].spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; - break; - case PLAYER_SKILL_LIGHT: - case PLAYER_SKILL_DARK: - case PLAYER_SKILL_DIPLOMACY: - Error("No dimoplacy in mm7 (yet)"); - break; - case PLAYER_SKILL_ITEM_ID: - case PLAYER_SKILL_REPAIR: - case PLAYER_SKILL_MEDITATION: - case PLAYER_SKILL_PERCEPTION: - case PLAYER_SKILL_TRAP_DISARM: - case PLAYER_SKILL_LEARNING: - pParty->pPlayers[i].AddItem(-1, 0xDC); - pParty->pPlayers[i].AddItem(-1, 5 * (rand() % 3 + 40)); - break; - case PLAYER_SKILL_DODGE: pParty->pPlayers[i].AddItem(-1, 115); break; - case PLAYER_SKILL_UNARMED: pParty->pPlayers[i].AddItem(-1, 110); break; - default: - break; - } - - for (uint k = 0; k < 138; k++) - { - if (pParty->pPlayers[i].pOwnItems[k].uItemID) - pParty->pPlayers[i].pOwnItems[k].SetIdentified(); - } - } - } - - pAudioPlayer->StopChannels(-1, -1); - return party_not_creation_flag; -} \ No newline at end of file
--- a/UI/UIPartyCreation.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#pragma once -bool PlayerCreation_Choose4Skills(); -void LoadPlayerPortraintsAndVoices(); -void ReloadPlayerPortraits(int player_id, int face_id); -void PlayerCreationUI_Draw(); -void PlayerCreationUI_Initialize(); -void DeleteCCharFont(); -bool PlayerCreationUI_Loop();
--- a/UI/UIPopup.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2042 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "UIPopup.h" -#include "Books\UIMapBook.h" -#include "UIShops.h" -#include "..\Engine/MM7.h" - -#include "..\Mouse.h" - -#include "..\Engine/Graphics/Sprites.h" -#include "..\Engine/Graphics/Vis.h" -#include "..\Engine/Game.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\Engine/Party.h" -#include "..\AudioPlayer.h" -#include "..\Engine/LOD.h" -#include "..\Engine/Objects/Actor.h" -#include "..\Engine/Graphics/Viewport.h" -#include "..\Engine/Objects/SpriteObject.h" -#include "..\Engine/Objects/ObjectList.h" -#include "..\Engine/Objects/Chest.h" -#include "..\Engine/Graphics/PaletteManager.h" -#include "..\Engine/Timer.h" -#include "..\Engine/texts.h" - -#include "..\Engine/mm7_data.h" -#include "..\Engine/Events.h" - -static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually - - -//----- (004179BC) -------------------------------------------------------- -void CharacterUI_DrawTooltip(const char *Title, const char *content) -{ - GUIWindow popup_window; // [sp+Ch] [bp-5Ch]@1 - POINT v6; // [sp+60h] [bp-8h]@1 - - memset(&popup_window, 0, 0x54u); - popup_window.uFrameWidth = 384; - popup_window.uFrameHeight = 256; - popup_window.uFrameX = 128; - popup_window.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; - popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(content, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; - popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; - popup_window.DrawMessageBox(0); - - popup_window.uFrameX += 12; - popup_window.uFrameWidth -= 24; - popup_window.uFrameY += 12; - popup_window.uFrameHeight -= 12; - popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; - popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; - sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, Title); - popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); - popup_window.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, content, 0, 0, 0); -} - -//----- (004151D9) -------------------------------------------------------- -void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight) -{ - unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6 - unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3 - unsigned int coord_y; // [sp+34h] [bp-4h]@5 - - pRenderer->SetTextureClipRect(uX, uY, uX + uWidth, uY + uHeight); - if ( pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth && pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight) - { - uNumTiles = uWidth / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; - if ( uWidth % pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth ) - ++uNumTiles; - coord_y = uY; - for ( uint j = 0; j <= uHeight / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; j++ ) - { - coord_x = uX - pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; - for ( uint i = uNumTiles + 1; i; --i ) - { - coord_x += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; - pRenderer->DrawTextureIndexed(coord_x, coord_y, pIcons_LOD->GetTexture(uTextureID_Parchment)); - } - coord_y += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; - } - pRenderer->DrawTextureTransparent(uX, uY, pIcons_LOD->GetTexture(uTextureID_5076AC)); - pRenderer->DrawTextureTransparent(uX, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4)); - pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY, pIcons_LOD->GetTexture(uTextureID_5076A8)); - pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0)); - if ( uWidth > 64 ) - { - pRenderer->SetTextureClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight); - pRenderer->DrawTextureTransparent(uX + 32, uY, pIcons_LOD->GetTexture(uTextureID_507698)); - pRenderer->DrawTextureTransparent(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); - if ( uWidth > 512 ) - { - pRenderer->DrawTextureTransparent(uX + 544, uY, pIcons_LOD->GetTexture(uTextureID_507698)); - pRenderer->DrawTextureTransparent(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); - } - } - if ( uHeight > 64 ) - { - pRenderer->SetTextureClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32); - pRenderer->DrawTextureTransparent(uX, uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0)); - pRenderer->DrawTextureTransparent(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C)); - } - pRenderer->ResetTextureClipRect(); - } -} - -//----- (0041D895) -------------------------------------------------------- -void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) -{ - unsigned int v2; // eax@3 - const char *v28; // edi@69 - int v34; // esi@81 - const char *pText; // [sp-14h] [bp-28Ch]@110 - char out_text[300]; // [sp+8h] [bp-270h]@40 - char v65[120]; // [sp+134h] [bp-144h]@92 - stru351_summoned_item v67; - int v77; // [sp+200h] [bp-78h]@12 - int v78; // [sp+204h] [bp-74h]@5 - GUIWindow iteminfo_window; // [sp+208h] [bp-70h]@2 - POINT a2; // [sp+25Ch] [bp-1Ch]@2 - int v81; // [sp+264h] [bp-14h]@5 - PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 - char* v84; - int v85; - char *Str; // [sp+270h] [bp-8h]@65 - - int r_mask = 0xF800; - int g_mask = 0x7E0; - int b_mask = 0x1F; - - if (!inspect_item->uItemID) - return; - iteminfo_window.Hint = nullptr; - iteminfo_window.uFrameWidth = 384; - iteminfo_window.uFrameHeight = 180; - iteminfo_window.uFrameY = 40; - if ( pMouse->GetCursorPos(&a2)->x <= 320 ) - v2 = pMouse->GetCursorPos(&a2)->x + 30; - else - v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30; - iteminfo_window.uFrameX = v2; - v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth; - v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight; - if ( v78 > 0 ) - v78 = v78 / 2; - if ( v81 <= 0 ) - v81 = 0; - else - v81 = v81 / 2; - if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St ) - inspect_item->SetIdentified(); - v77 = 0; - if (inspect_item->GetItemEquipType() == EQUIP_GOLD) - v77 = inspect_item->uSpecEnchantmentType; - if ( uActiveCharacter ) - { - //try to identify - if (!inspect_item->IsIdentified()) - { - if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 ) - inspect_item->SetIdentified(); - v83 = SPEECH_9; - if ( !inspect_item->IsIdentified() ) - ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2);//"Identify Failed" - else - { - v83 = SPEECH_8; - if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) - v83 = SPEECH_7; - } - if ( dword_4E455C ) - { - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0); - dword_4E455C = 0; - } - } - inspect_item->UpdateTempBonus(pParty->uTimePlayed); - if (inspect_item->IsBroken()) - { - if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 ) - inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1; - v83 = SPEECH_11; - if ( !inspect_item->IsBroken() ) - v83 = SPEECH_10; - else - ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2);//"Repair Failed" - if ( dword_4E455C ) - { - pPlayers[uActiveCharacter]->PlaySound(v83, 0); - dword_4E455C = 0; - } - } - } - if (inspect_item->IsBroken()) - { - iteminfo_window.DrawMessageBox(0); - pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, - iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, - iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); - iteminfo_window.uFrameWidth -= 24; - iteminfo_window.uFrameHeight -= 12; - iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; - iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; - pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); - if ( inspect_item->IsIdentified()) - pText = (char *)inspect_item->GetIdentifiedName(); - else - pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName; - iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3); - iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2, - Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" - pRenderer->ResetTextureClipRect(); - if ( !areWeLoadingTexture ) - { - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - return; - } - if (!inspect_item->IsIdentified()) - { - iteminfo_window.DrawMessageBox(0); - pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, - iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); - iteminfo_window.uFrameWidth -= 24; - iteminfo_window.uFrameHeight -= 12; - iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; - iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; - pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); - iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); - iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, - Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" - pRenderer->ResetTextureClipRect(); - if ( !areWeLoadingTexture ) - { - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - return; - } - sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s" - out_text[100] = 0; - out_text[200] = 0; - switch (inspect_item->GetItemEquipType()) - { - case EQUIP_SINGLE_HANDED: - case EQUIP_TWO_HANDED: - sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], - (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], - (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage" - if (inspect_item->GetDamageMod()) - { - char mod[16]; - sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); - strcat(out_text + 100, mod); - } - break; - - case EQUIP_BOW: - sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot" - (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage" - (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); - if (inspect_item->GetDamageMod()) - { - char mod[16]; - sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); - strcat(out_text + 100, mod); - } - break; - - case EQUIP_ARMOUR: - case EQUIP_SHIELD: - case EQUIP_HELMET: - case EQUIP_BELT: - case EQUIP_CLOAK: - case EQUIP_GAUNTLETS: - case EQUIP_BOOTS: - case EQUIP_RING: - case EQUIP_AMULET: - if (inspect_item->GetDamageDice()) //"Armor" - sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], - inspect_item->GetDamageDice() + inspect_item->GetDamageMod()); - break; - } - - if ( !v77 ) - { - if (inspect_item->GetItemEquipType() ==EQUIP_POTION) //this is CORRECT! do not move to switch! - { - if ( inspect_item->uEnchantmentType ) - sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" - } - else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT) - sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power" - else if ( inspect_item->uEnchantmentType ) - sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special" - else if ( inspect_item->uSpecEnchantmentType ) - sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement); - else if ( inspect_item->uNumCharges ) - sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges" - } - iteminfo_window.uFrameWidth -= 12; - iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; - iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; - Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); - v84 = &out_text[0]; - for ( uint i = 1; i <= 3; i++ ) - { - if ( *v84 ) - Str += pFontComic->CalcTextHeight(v84, &iteminfo_window, 100, 0) + 3; - v84 += 100; - } - v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; - if ( *v28 ) - Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0); - iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), - TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54; - if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight ) - iteminfo_window.uFrameHeight = (unsigned int)Str; - if ( inspect_item->uAttributes & ITEM_TEMP_BONUS && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) - iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight); - v85 = 0; - if ( pFontArrus->uFontHeight ) - { - iteminfo_window.uFrameWidth -= 24; - if ( pFontArrus->CalcTextHeight(inspect_item->GetIdentifiedName(), &iteminfo_window, 0, 0) / (signed int)pFontArrus->uFontHeight ) - v85 = pFontArrus->uFontHeight; - iteminfo_window.uFrameWidth += 24; - } - iteminfo_window.uFrameWidth += 12; - iteminfo_window.uFrameHeight += (unsigned int)v85; - iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; - iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; - iteminfo_window.DrawMessageBox(0); - pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, - iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); - iteminfo_window.uFrameWidth -= 12; - iteminfo_window.uFrameHeight -= 12; - iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; - iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; - pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, - iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); - - v34 = (int)(v85 + 35); - Str = out_text; - for ( uint i = 1; i <= 3; i++ ) - { - if ( *Str ) - { - iteminfo_window.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0); - v34 += pFontComic->CalcTextHeight(Str, &iteminfo_window, 100, 0) + 3; - } - Str += 100; - } - v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; - if ( *v28 ) - iteminfo_window.DrawText(pFontSmallnum, 100, v34, 0, v28, 0, 0, 0); - iteminfo_window.uFrameX += 12; - iteminfo_window.uFrameWidth -= 24; - iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), inspect_item->GetIdentifiedName(), 3); - iteminfo_window.uFrameWidth += 24; - iteminfo_window.uFrameX -= 12; - if ( v77 ) - { - sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value" - iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); - pRenderer->ResetTextureClipRect(); - } - else - { - if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) - { - init_summoned_item(&v67, inspect_item->uExpireTime - pParty->uTimePlayed); - strcpy(pTmpBuf.data(), "Duration:"); - Str = (char *)(v67.field_18_expire_year - game_starting_year); - if (v67.field_18_expire_year != 1168 ) - { - sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year); - strcat(pTmpBuf.data(), v65); - } - if ( (((v67.field_14_exprie_month || Str) && - ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str) - || v67.field_C_expire_day) - && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || - v67.field_C_expire_day) - || v67.field_8_expire_hour) - && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || - v67.field_C_expire_day || v67.field_8_expire_hour) - || v67.field_4_expire_minute ) - { - sprintf(v65, " %d:mn", v67.field_4_expire_minute); - strcat(pTmpBuf.data(), v65); - } - iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); - } - sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], inspect_item->GetValue()); - iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); - if ( inspect_item->uAttributes & ITEM_STOLEN ) - pText = pGlobalTXT_LocalizationStrings[187]; //"Stolen" - else - { - if ( !(inspect_item->uAttributes & ITEM_HARDENED) ) - { - pRenderer->ResetTextureClipRect(); - if ( !areWeLoadingTexture ) - { - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - return; - } - pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened" - } - LOWORD(inspect_item->uAttributes) = r_mask; - iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132, - iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0); - pRenderer->ResetTextureClipRect(); - } - if ( !areWeLoadingTexture ) - { - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - return; -} -// 4E455C: using guessed type int dword_4E455C; -// 506128: using guessed type int areWeLoadingTexture; - -//----- (0041E360) -------------------------------------------------------- -void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow) -{ - unsigned __int16 v9; // dx@4 - SpriteFrame *v10; // edi@17 - unsigned int v18; // ecx@19 - unsigned int v19; // eax@21 - int skill_points; // edi@61 - unsigned int skill_level; // eax@61 - int pTextHeight; // edi@90 - PlayerSpeech speech; // [sp-8h] [bp-1F4h]@79 - DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 - DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 - RECT dest_rect; // [sp+ECh] [bp-100h]@26 - const char *string_name[10]; // [sp+FCh] [bp-F0h]@145 - const char *content[11]; // [sp+124h] [bp-C8h]@127 - unsigned char resistances[11]; // [sp+124h] [bp-C8h]@127 - RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 - unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 - bool for_effects; // [sp+1C0h] [bp-2Ch]@3 - bool normal_level; // [sp+1D0h] [bp-1Ch]@18 - bool expert_level; // [sp+1C4h] [bp-28h]@18 - bool master_level; // [sp+1C8h] [bp-24h]@18 - bool grandmaster_level; // [sp+1B4h] [bp-38h]@3 - const char *pText; // [sp+1D4h] [bp-18h]@18 - int pTextColorID; // [sp+1E4h] [bp-8h]@18 - int v115; - - bool monster_full_informations = false; - static Actor pMonsterInfoUI_Doll; - if ( !uActiveCharacter ) // - uActiveCharacter = 1; - - /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) - { - bMonsterInfoUI_bDollInitialized |= 1u; - Actor::Actor(&pMonsterInfoUI_Doll); - atexit(nullsub_3); - }*/ - v106.sParentBillboardID = -1; - v115 = monster_popup_y_offsets[((signed __int16)pActors[uActorID].pMonsterInfo.uID - 1) / 3] - 40; - if ( pActors[uActorID].pMonsterInfo.uID == pMonsterInfoUI_Doll.pMonsterInfo.uID ) - v9 = pMonsterInfoUI_Doll.uCurrentActionLength; - else - { - memcpy(&pMonsterInfoUI_Doll, &pActors[uActorID], sizeof(pMonsterInfoUI_Doll)); - pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; - pMonsterInfoUI_Doll.uCurrentActionTime = 0; - v9 = rand() % 256 + 128; - pMonsterInfoUI_Doll.uCurrentActionLength = v9; - } - - if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) - { - pMonsterInfoUI_Doll.uCurrentActionTime = 0; - if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee) - { - pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing; - pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128; - } - else - { - //rand(); - pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; - if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && - (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) - pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee; - pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActors[uActorID].pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; - } - } - v10 = pSpriteFrameTable->GetFrame( pActors[uActorID].pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); - v106.pTarget = pRenderer->pTargetSurface; - v106.pTargetZ = pRenderer->pActiveZBuffer; - v106.uTargetPitch = pRenderer->uTargetSurfacePitch; - v106.uViewportX = pWindow->uFrameX + 13; - v106.uViewportY = pWindow->uFrameY + 52; - v106.uViewportW = (pWindow->uFrameY + 52) + 128; - v106.uViewportZ = v106.uViewportX + 128; - v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2; - v106._screenspace_x_scaler_packedfloat = 65536; - v106._screenspace_y_scaler_packedfloat = 65536; - v106.uScreenSpaceY = v115 + (pWindow->uFrameY + 52) + pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].uHeight; - v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); - v106.sZValue = 0; - v106.uFlags = 0; - pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1); - pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//горизонтальная верхняя линия - pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//горизонтальная нижняя линия - pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//левая вертикальная линия - pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//правая вертикальная линия - //if ( pRenderer->pRenderD3D ) - { - v106.uScreenSpaceY = v115 + v106.uViewportY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; - - memset(&Dst, 0, sizeof(Dst)); - Dst.dwSize = sizeof(Dst); - Dst.dwFillColor = 0; - - memset(&pDesc, 0, sizeof(pDesc)); - pDesc.dwSize = sizeof(pDesc); - - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->GetSurfaceDesc(&pDesc); - v107 = 0; - uint i = 0; - int dst_x = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2; - int dst_y = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; - uint dst_z = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2 - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth; - uint dst_w = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; - if (dst_x < v106.uViewportX) - { - v18 = v106.uViewportX - dst_x; - dst_x = v106.uViewportX; - v107 = v18; - } - if (dst_y < v106.uViewportY) - { - v19 = v106.uViewportY - dst_y; - dst_y = v106.uViewportY; - i = v19; - } - if (dst_z > v106.uViewportZ) - dst_z = v106.uViewportZ; - if (dst_w > v106.uViewportW) - dst_w = v106.uViewportW; - pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); - pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0x7FF); - dest_rect.left = v106.uViewportX; - dest_rect.top = v106.uViewportY; - dest_rect.right = v106.uViewportZ; - dest_rect.bottom = v106.uViewportW; - - ErrD3D(pRenderer->pBackBuffer4->Blt(&dest_rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &Dst)); - /*if ( pRenderer->uTargetGBits == 5 ) - { - __debugbreak(); // no monster popup for r5g5b5 will be - memset(&pDesc, 0, 0x7Cu); - pDesc.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT)) - { - v20 = (char *)dst_y; - v110 = pDesc.lpSurface; - if (dst_y < dst_w) - { - v21 = dst_x; - //v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x]; - ushort* _v22_2 = v22; - v23 = i - dst_y; - v115 = i - dst_y; - while ( 1 ) - { - dst_y = v21; - if ( v21 < dst_z ) - { - v25 = v107 - v21; - v109 = (int)&v20[v23]; - for ( i = v107 - v21; ; v25 = i ) - { - v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight); - v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; - *v22 = *((short *)v110 + (int)v26); - ++v22; - if ( dst_y >= dst_z ) - break; - } - v23 = v115; - } - v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch); - _v22_2 = v22; - v20 = (char *)(dst_y + 1); - v28 = __OFSUB__(dst_y + 1, dst_w); - v27 = (signed int)(dst_y++ + 1 - dst_w) < 0; - if ( !(v27 ^ v28) ) - break; - v21 = dst_x; - } - } - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(0); - } - } - else*/ - { - memset(&pDesc, 0, sizeof(pDesc)); - pDesc.dwSize = sizeof(pDesc); - if ( pRenderer->LockSurface_DDraw4(pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface, &pDesc, DDLOCK_WAIT) ) - { - ushort* src = (unsigned __int16 *)pDesc.lpSurface; - uint num_top_scanlines_above_frame_y = i - dst_y; - for (uint y = dst_y; y < dst_w; ++y) - { - //ushort* dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x]; - - uint src_y = num_top_scanlines_above_frame_y + y; - for (uint x = dst_x; x < dst_z; ++x) - { - uint src_x = v107 - dst_x + x; // num scanlines left to frame_x + current x - - uint idx = pDesc.dwHeight * src_y / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaHeight * (pDesc.lPitch / sizeof(short)) + - pDesc.dwWidth * src_x / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; - uint b = src[idx] & 0x1F; - //*dst++ = b | 2 * (src[idx] & 0xFFE0); - pRenderer->WritePixel16(x, y, b | 2 * (src[idx] & 0xFFE0)); - } - } - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(NULL); - } - } - } - /*else - { - pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0); - if ( v10->pHwSpriteIDs[0] >= 0 ) - pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].DrawSprite_sw(&v106, 0); - }*/ -//name and profession - if ( pActors[uActorID].sNPC_ID ) - { - if (GetNPCData(pActors[uActorID].sNPC_ID)->uProfession) - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], GetNPCData(pActors[uActorID].sNPC_ID)->pName, aNPCProfessionNames[GetNPCData(pActors[uActorID].sNPC_ID)->uProfession]); // "%s the %s" / ^Pi[%s] %s - else - strncpy(pTmpBuf.data(), GetNPCData(pActors[uActorID].sNPC_ID)->pName, 2000); - } - else - { - if ( pActors[uActorID].dword_000334_unique_name ) - strncpy(pTmpBuf.data(), pMonsterStats->pPlaceStrings[pActors[uActorID].dword_000334_unique_name], 2000); - else - strncpy(pTmpBuf.data(), pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].pName, 2000); - } - pWindow->DrawTitleText(pFontComic, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); - //health bar - Actor::DrawHealthBar(&pActors[uActorID], pWindow); - - normal_level = 0; - expert_level = 0; - master_level = 0; - grandmaster_level = 0; - for_effects = 0; - pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; - if ( pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) - { - skill_points = (unsigned __int8)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) & 0x3F; - skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) - 1; - if ( skill_level == 0 )//(normal) - { - if ( skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - normal_level = 1; - } - else if ( skill_level == 1 )//(expert) - { - if ( 2 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - normal_level = 1; - expert_level = 1; - } - } - else if ( skill_level == 2 )//(master) - { - if ( 3 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - normal_level = 1; - expert_level = 1; - master_level = 1; - } - } - else if ( skill_level == 3 )//grandmaster - { - normal_level = 1; - expert_level = 1; - master_level = 1; - grandmaster_level = 1; - } - } - if ( pActors[uActorID].uAIState != Dead - && pActors[uActorID].uAIState != Dying - && !dword_507BF0_is_there_popup_onscreen && pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) - { - if ( normal_level | expert_level | master_level | grandmaster_level ) - { - if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) - speech = SPEECH_IDENTIFY_MONSTER_STRONGER; - else - speech = SPEECH_IDENTIFY_MONSTER_WEAKER; - } - else - speech = SPEECH_IDENTIFY_MONSTER_106; - pPlayers[uActiveCharacter]->PlaySound(speech, 0); - } - - if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter - 1].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) - for_effects = 1; - - if ( monster_full_informations == true ) - { - normal_level = 1;// - expert_level = 1;// - master_level = 1;// - grandmaster_level = 1;// - for_effects = 1; - } - - pWindow->DrawText(pFontSmallnum, 12, 196, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects - if ( !for_effects && false) - pWindow->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? - else - { - pText = ""; - pTextHeight = LOBYTE(pFontSmallnum->uFontHeight) + 193; - for ( uint i = 1; i <= 21; ++i ) - { - if ( pActors[uActorID].pActorBuffs[i].uExpireTime > 0 ) - { - switch ( i ) - { - case ACTOR_BUFF_CHARM: - pTextColorID = 60; - pText = pGlobalTXT_LocalizationStrings[591];//Charmed - break; - case ACTOR_BUFF_SUMMONED: - pTextColorID = 82; - pText = pGlobalTXT_LocalizationStrings[649];//Summoned - break; - case ACTOR_BUFF_SHRINK: - pTextColorID = 92; - pText = pGlobalTXT_LocalizationStrings[592];//Shrunk - break; - case ACTOR_BUFF_AFRAID: - pTextColorID = 63; - pText = pGlobalTXT_LocalizationStrings[4];//Afraid - break; - case ACTOR_BUFF_STONED: - pText = pGlobalTXT_LocalizationStrings[220];//Stoned - pTextColorID = 81; - break; - case ACTOR_BUFF_PARALYZED: - pText = pGlobalTXT_LocalizationStrings[162];//Paralyzed - pTextColorID = 81; - break; - case ACTOR_BUFF_SLOWED: - pText = pGlobalTXT_LocalizationStrings[593];//Slowed - pTextColorID = 35; - break; - case ACTOR_BUFF_BERSERK: - pText = pGlobalTXT_LocalizationStrings[608];//Berserk - pTextColorID = 62; - break; - case ACTOR_BUFF_SOMETHING_THAT_HALVES_AC: - case ACTOR_BUFF_MASS_DISTORTION: - pText = ""; - pTextColorID = 0; - continue; - case ACTOR_BUFF_FATE: - pTextColorID = 47; - pText = pGlobalTXT_LocalizationStrings[221];//Fate - break; - case ACTOR_BUFF_ENSLAVED: - pTextColorID = 66; - pText = pGlobalTXT_LocalizationStrings[607];//Enslaved - break; - case ACTOR_BUFF_DAY_OF_PROTECTION: - pTextColorID = 85; - pText = pGlobalTXT_LocalizationStrings[610];//Day of Protection - break; - case ACTOR_BUFF_HOUR_OF_POWER: - pTextColorID = 86; - pText = pGlobalTXT_LocalizationStrings[609];//Hour of Power - break; - case ACTOR_BUFF_SHIELD: - pTextColorID = 17; - pText = pGlobalTXT_LocalizationStrings[279];//Shield - break; - case ACTOR_BUFF_STONESKIN: - pTextColorID = 38; - pText = pGlobalTXT_LocalizationStrings[442];//Stoneskin - break; - case ACTOR_BUFF_BLESS: - pTextColorID = 46; - pText = pGlobalTXT_LocalizationStrings[443];//Bless - break; - case ACTOR_BUFF_HEROISM: - pTextColorID = 51; - pText = pGlobalTXT_LocalizationStrings[440];//Heroism - break; - case ACTOR_BUFF_HASTE: - pTextColorID = 5; - pText = pGlobalTXT_LocalizationStrings[441];//Haste - break; - case ACTOR_BUFF_PAIN_REFLECTION: - pTextColorID = 95; - pText = pGlobalTXT_LocalizationStrings[229];//Pain Reflection - break; - case ACTOR_BUFF_PAIN_HAMMERHANDS: - pTextColorID = 73; - pText = pGlobalTXT_LocalizationStrings[228];//Hammerhands - break; - default: - pText = ""; - break; - } - if ( _stricmp(pText, "" )) - { - pWindow->DrawText(pFontSmallnum, 28, pTextHeight, GetSpellColor(pTextColorID), pText, 0, 0, 0); - pTextHeight = pTextHeight + *(char *)((int)pFontSmallnum + 5) - 3; - } - } - } - if ( !_stricmp(pText,"" )) - pWindow->DrawText(pFontSmallnum, 28, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);//Нет - } - - if ( normal_level ) - { - sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, pActors[uActorID].pMonsterInfo.uHP); - pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; - sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[12], 0, pActors[uActorID].pMonsterInfo.uAC);//Armor Class - } - else - { - sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark - pWindow->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; - sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[12], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark - } - pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); - - content[0] = pGlobalTXT_LocalizationStrings[87]; - content[1] = pGlobalTXT_LocalizationStrings[6]; - content[2] = pGlobalTXT_LocalizationStrings[240]; - content[3] = pGlobalTXT_LocalizationStrings[70]; - content[4] = pGlobalTXT_LocalizationStrings[624]; - content[5] = pGlobalTXT_LocalizationStrings[138]; - content[6] = pGlobalTXT_LocalizationStrings[214]; - content[7] = pGlobalTXT_LocalizationStrings[142]; - content[8] = pGlobalTXT_LocalizationStrings[29]; - content[9] = pGlobalTXT_LocalizationStrings[133]; - content[10] = pGlobalTXT_LocalizationStrings[54]; - - if ( expert_level ) - { - sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, content[pActors[uActorID].pMonsterInfo.uAttack1Type]);//Attack - pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - if ( pActors[uActorID].pMonsterInfo.uAttack1DamageBonus ) - sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53], - 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides, pActors[uActorID].pMonsterInfo.uAttack1DamageBonus); - else - sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53], - 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides); - } - else - { - sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); - pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); - } - pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); - - if ( !master_level ) - { - sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[630]);//"Spell" "?" - pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - } - else - { - pText = pGlobalTXT_LocalizationStrings[628];//Spell - if ( pActors[uActorID].pMonsterInfo.uSpell1ID && pActors[uActorID].pMonsterInfo.uSpell2ID ) - pText = pGlobalTXT_LocalizationStrings[629];//Spells - if ( pActors[uActorID].pMonsterInfo.uSpell1ID ) - { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);//"%s\f%05u\t060%s\n" - pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - } - if ( pActors[uActorID].pMonsterInfo.uSpell2ID ) - { - sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);//"%s\f%05u\t060%s\n" - pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - } - if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID ) - { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);//"%s\f%05u\t060%s\n" - pWindow->DrawText(pFontSmallnum, 150, (int)pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - } - } - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - pWindow->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[626], 0, 0, 0);//Immune - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - - string_name[0] = pGlobalTXT_LocalizationStrings[87];//Fire - string_name[1] = pGlobalTXT_LocalizationStrings[6];//Air - string_name[2] = pGlobalTXT_LocalizationStrings[240]; - string_name[3] = pGlobalTXT_LocalizationStrings[70]; - string_name[4] = pGlobalTXT_LocalizationStrings[142]; - string_name[5] = pGlobalTXT_LocalizationStrings[214]; - string_name[6] = pGlobalTXT_LocalizationStrings[29]; - string_name[7] = pGlobalTXT_LocalizationStrings[133]; - string_name[8] = pGlobalTXT_LocalizationStrings[54]; - string_name[9] = pGlobalTXT_LocalizationStrings[624]; - - resistances[0] = pActors[uActorID].pMonsterInfo.uResFire; - resistances[1] = pActors[uActorID].pMonsterInfo.uResAir; - resistances[2] = pActors[uActorID].pMonsterInfo.uResWater; - resistances[3] = pActors[uActorID].pMonsterInfo.uResEarth; - resistances[4] = pActors[uActorID].pMonsterInfo.uResMind; - resistances[5] = pActors[uActorID].pMonsterInfo.uResSpirit; - resistances[6] = pActors[uActorID].pMonsterInfo.uResBody; - resistances[7] = pActors[uActorID].pMonsterInfo.uResLight; - resistances[8] = pActors[uActorID].pMonsterInfo.uResPhysical; - resistances[9] = pActors[uActorID].pMonsterInfo.uResDark; - - if ( grandmaster_level ) - { - for ( uint i = 0; i < 10; i++ ) - { - if ( resistances[i] == 200 ) - { - pText = pGlobalTXT_LocalizationStrings[625];//Immune - } - else - { - if ( resistances[i] ) - pText = pGlobalTXT_LocalizationStrings[627];//Resistant - else - pText = pGlobalTXT_LocalizationStrings[153];//None - } - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pText); - pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - } - } - else - { - for ( uint i = 0; i < 10; ++i ) - { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" - pWindow->DrawText(pFontSmallnum, 170, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; - } - } - //cast spell: Detect life - if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 ) - { - sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points - pFontSmallnum->GetLineWidth(pTmpBuf.data()); - pWindow->DrawTitleText(pFontSmallnum, 0, pWindow->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3); - } -} - -//----- (00417BB5) -------------------------------------------------------- -const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) -{ - char a2[1200]; // [sp+Ch] [bp-538h]@7 - char Source[120]; // [sp+4BCh] [bp-88h]@7 - int v35; // [sp+53Ch] [bp-8h]@1 - - v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal - if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]) > (signed int)v35 ) - v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert - if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]) > (signed int)v35 ) - v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master - if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]) > (signed int)v35 ) - v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand - - a2[0] = 0; - Source[0] = 0; - strcpy(a2, "%s\n\n"); - sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 1)); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 2)); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 3)); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 4)); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - if ( (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F) == (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) ) - { - sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], - pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], // Normal - pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], // Expert - pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], // Master - pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType]); // Grand - } - else - { - sprintf(Source, "\f%05d", Color16(0xFFu, 0xFFu, 0xFFu)); - strcat(a2, Source); - strcat(a2, "%s: +%d"); - sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], - pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], - pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], - pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], - pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType], - pGlobalTXT_LocalizationStrings[623], //Bonus - (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) - (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F)); - } - return static_sub_417BB5_out_string; -} - -//----- (00417FE5) -------------------------------------------------------- -void CharacterUI_SkillsTab_ShowHint() -{ - GUIButton *pButton; // esi@6 - unsigned int pX; // [sp+4h] [bp-8h]@1 - unsigned int pY; // [sp+8h] [bp-4h]@1 - - pMouse->GetClickPos(&pX, &pY); - if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) - { - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) - { - if ( pButton->msg == UIMSG_SkillUp - && (signed int)pX >= (signed int)pButton->uX - && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY - && (signed int)pY <= (signed int)pButton->uW ) - { - CharacterUI_DrawTooltip(pSkillNames[pButton->msg_param], CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)pButton->msg_param)); - } - } - } - else - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);//Очки навыков -} - -//----- (00418083) -------------------------------------------------------- -void CharacterUI_StatsTab_ShowHint() -{ - int pStringNum; // edi@1 - signed int pTextColor; // eax@15 - const char *pHourWord; // ecx@17 - const char *pDayWord; // eax@20 - int v15; // ebx@28 - POINT a2; // [sp+Ch] [bp-24h]@1 - int pHour; // [sp+14h] [bp-1Ch]@15 - unsigned int pDay; // [sp+24h] [bp-Ch]@15 - - pMouse->GetCursorPos(&a2); - for ( pStringNum = 0; pStringNum < stat_string_coord.size(); ++pStringNum ) - { - if (a2.x >= stat_string_coord[pStringNum].x && a2.x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width ) - { - if (a2.y >= stat_string_coord[pStringNum].y && a2.y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height ) - break; - } - } - - switch ( pStringNum ) - { - case 0:// Attributes - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] ) - CharacterUI_DrawTooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]); - break; - case 7:// Health Points - if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription); - break; - case 8:// Spell Points - if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription); - break; - case 9:// Armor Class - if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription); - break; - case 10:// Player Condition - strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription); - strcat(pTmpBuf2.data(), "\n"); - extern std::array<unsigned int, 18> pConditionImportancyTable; - for ( uint i = 0; i < 18; ++i ) - { - if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] ) - { - strcat(pTmpBuf2.data(), " \n"); - pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]]; - pHour = (unsigned int)((pHour * 0.234375) / 60 / 60); - pDay = (unsigned int)pHour / 24; - pHour %= 24i64; - pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]); - sprintfex(pTmpBuf.data(), format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]); - strcat(pTmpBuf2.data(), pTmpBuf.data()); - if ( pHour && pHour <= 1 ) - pHourWord = pGlobalTXT_LocalizationStrings[109]; - else - pHourWord = pGlobalTXT_LocalizationStrings[110]; - if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) ) - pDayWord = pGlobalTXT_LocalizationStrings[57]; - sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord); - strcat(pTmpBuf2.data(), pTmpBuf.data()); - } - } - if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data()); - break; - case 11:// Fast Spell - if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription); - break; - case 12:// Player Age - if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription); - break; - case 13:// Player Level - if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription); - break; - case 14://Experience - v15 = pPlayers[uActiveCharacter]->uLevel; - do - { - if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)GetExperienceRequiredForLevel(v15) ) - break; - ++v15; - } - while ( v15 <= 10000 ); - pTmpBuf[0] = 0; - pTmpBuf2[0] = 0; - if ( v15 > pPlayers[uActiveCharacter]->uLevel ) - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience), v15 + 1); - strcat(pTmpBuf.data(), "\n"); - strcat(pTmpBuf.data(), pTmpBuf2.data()); - sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data()); - if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data()); - break; - case 15:// Attack Bonus - if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription); - break; - case 16:// Attack Damage - if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription); - break; - case 17:// Missle Bonus - if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription); - break; - case 18:// Missle Damage - if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription); - break; - case 19:// Fire Resistance - if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription); - break; - case 20:// Air Resistance - if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription); - break; - case 21:// Water Resistance - if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription); - break; - case 22:// Earth Resistance - if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription); - break; - case 23:// Mind Resistance - if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription); - break; - case 24:// Body Resistance - if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription); - break; - case 25: // Skill Points - if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription ) - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); - break; - case 26: // Class description - { - if (pClassDescriptions[pPlayers[uActiveCharacter]->classType] && pClassNames[pPlayers[uActiveCharacter]->classType]) - CharacterUI_DrawTooltip(pClassNames[pPlayers[uActiveCharacter]->classType], pClassDescriptions[pPlayers[uActiveCharacter]->classType]); - } - break; - - default: - break; - } -} - -//----- (00410B28) -------------------------------------------------------- -void DrawSpellDescriptionPopup(int spell_index) -{ - SpellInfo *spell; // esi@1 - unsigned int v3; // eax@2 - LONG v5; // ecx@4 - GUIWindow spell_info_window; // [sp+Ch] [bp-68h]@4 - POINT mouse; // [sp+64h] [bp-10h]@1 - - spell = &pSpellStats->pInfos[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1]; - if ( pMouse->GetCursorPos(&mouse)->y <= 250 ) - v3 = pMouse->GetCursorPos(&mouse)->y + 30; - else - v3 = 30; - spell_info_window.uFrameY = v3; - spell_info_window.uFrameWidth = 328; - spell_info_window.uFrameHeight = 68; - spell_info_window.uFrameX = 90; - spell_info_window.uFrameZ = 417; - spell_info_window.uFrameW = v3 + 67; - spell_info_window.Hint = nullptr; - v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); - if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]) > v5 ) - v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); - if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]) > v5 ) - v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); - if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]) > v5 ) - v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); - sprintf(pTmpBuf2.data(), - "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", - spell->pDescription, - pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], v5 + 3, v5 + 10, spell->pBasicSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], v5 + 3, v5 + 10, spell->pExpertSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], v5 + 3, v5 + 10, spell->pMasterSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], v5 + 3, v5 + 10, spell->pGrandmasterSkillDesc); - spell_info_window.uFrameHeight += pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &spell_info_window, 0, 0); - if ( (signed int)spell_info_window.uFrameHeight < 150 ) - spell_info_window.uFrameHeight = 150; - spell_info_window.uFrameWidth = game_viewport_width; - spell_info_window.DrawMessageBox(0); - spell_info_window.uFrameWidth -= 12; - spell_info_window.uFrameHeight -= 12; - spell_info_window.uFrameZ = spell_info_window.uFrameX + spell_info_window.uFrameWidth - 1; - spell_info_window.uFrameW = spell_info_window.uFrameHeight + spell_info_window.uFrameY - 1; - spell_info_window.DrawTitleText(pFontArrus, 0x78u, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), spell->pName, 3); - spell_info_window.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); - spell_info_window.uFrameWidth = 108; - spell_info_window.uFrameZ = spell_info_window.uFrameX + 107; - int skill_level = SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12]); - spell_info_window.DrawTitleText(pFontComic, 12, 75, 0, pSkillNames[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12], 3); - sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], - pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[skill_level - 1]); - spell_info_window.DrawTitleText(pFontComic, 12, spell_info_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); - dword_507B00_spell_info_to_draw_in_popup = 0; -} - // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup; - -//----- (00416D62) -------------------------------------------------------- -void UI_OnMouseRightClick(Vec2_int_ *_this) -{ - int v5; // esi@62 - GUIButton *pButton; // esi@84 - const char *pStr; // edi@85 - const char *pHint; // edx@113 - GUIWindow popup_window; // [sp+4h] [bp-74h]@32 - struct tagPOINT Point; // [sp+60h] [bp-18h]@6 - unsigned int pX; // [sp+70h] [bp-8h]@3 - unsigned int pY; // [sp+74h] [bp-4h]@3 - - if ( pCurrentScreen == SCREEN_VIDEO || GetCurrentMenuID() == MENU_MAIN ) - return; - if ( _this ) - { - pX = _this->x; - pY = _this->y; - } - else - { - pMouse->GetClickPos(&pX, &pY); - } - //if ( pRenderer->bWindowMode ) - { - GetCursorPos(&Point); - ScreenToClient(window->GetApiHandle(), &Point); - if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) - { - back_to_game(); - return; - } - } - if ( pParty->pPickedItem.uItemID )//нажатие на портрет перса правой кнопкой мыши с раствором - { - for ( uint i = 0; i < 4; ++i ) - { - if ( (signed int)pX > RightClickPortraitXmin[i] && (signed int)pX < RightClickPortraitXmax[i] - && (signed int)pY > 375 && (signed int)pY < 466 ) - { - pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(i + 1, 1); - return; - } - } - } - - pEventTimer->Pause(); - switch(pCurrentScreen) - { - case SCREEN_CASTING: - { - Inventory_ItemPopupAndAlchemy(); - break; - } - case SCREEN_CHEST: - { - if ( !pPlayers[uActiveCharacter]->CanAct() ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы - popup_window.Hint = pTmpBuf.data(); - popup_window.uFrameWidth = 384; - popup_window.uFrameHeight = 180; - popup_window.uFrameY = 40; - if ( (signed int)pX <= 320 ) - popup_window.uFrameX = pX + 30; - else - popup_window.uFrameX = pX - 414; - popup_window.DrawMessageBox(0); - } - else - { - if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF ) - GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF) - 1] - 1]); - } - break; - } - case SCREEN_GAME://In the main menu displays a pop-up window(В главном меню показывает всплывающее окно) - { - if (GetCurrentMenuID() > 0) - break; - if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) - { - popup_window.ptr_1C = (void *)((signed int)pX / 118); - if ( (signed int)pX / 118 < 4 )//portaits zone - { - popup_window.Hint = nullptr; - popup_window.uFrameWidth = 400; - popup_window.uFrameHeight = 200; - popup_window.uFrameX = 38; - popup_window.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - GameUI_CharacterQuickRecord_Draw(&popup_window, pPlayers[(int)popup_window.ptr_1C + 1]); - } - } - else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) - { - if ( (signed int)pY >= 130 ) - { - if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )//buff_tooltip zone - { - popup_window.Hint = nullptr; - popup_window.uFrameWidth = 400; - popup_window.uFrameHeight = 200; - popup_window.uFrameX = 38; - popup_window.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - popup_window._41D73D_draw_buff_tooltip(); - } - else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )//NPC zone - { - if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) - { - pAudioPlayer->StopChannels(-1, -1); - GameUI_DrawNPCPopup((void *)1);//NPC 2 - } - } - else - { - pAudioPlayer->StopChannels(-1, -1); - GameUI_DrawNPCPopup(0);//NPC 1 - } - } - else//minimap zone - { - popup_window.Hint = (char *)GameUI_GetMinimapHintText(); - popup_window.uFrameWidth = 256; - popup_window.uFrameX = 130; - popup_window.uFrameY = 140; - popup_window.uFrameHeight = 64; - pAudioPlayer->StopChannels(-1, -1); - popup_window.DrawMessageBox(0); - } - } - else//game zone - { - popup_window.Hint = nullptr; - popup_window.uFrameWidth = 320; - popup_window.uFrameHeight = 320; - popup_window.uFrameX = pX - 350; - if ( (signed int)pX <= 320 ) - popup_window.uFrameX = pX + 30; - popup_window.uFrameY = 40; - //if ( pRenderer->pRenderD3D ) - v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); - /*else - v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/ - if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor) - { - /*if ( pRenderer->uNumSceneBegins ) - { - popup_window.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); - } - else*/ - { - pRenderer->BeginScene(); - popup_window.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); - pRenderer->EndScene(); - } - } - if (PID_TYPE((unsigned __int16)v5) == OBJECT_Item) - { - if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) ) - { - GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].stru_24); - } - } - } - break; - } - case SCREEN_BOOKS: - { - if ( !dword_506364 - || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X - || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y - || ((popup_window.Hint = (char *)GetMapBookHintText()) == 0) ) - break; - popup_window.uFrameWidth = (pFontArrus->GetLineWidth(popup_window.Hint) + 32) + 0.5f; - popup_window.uFrameX = pX + 5; - popup_window.uFrameY = pY + 5; - popup_window.uFrameHeight = 64; - pAudioPlayer->StopChannels(-1, -1); - popup_window.DrawMessageBox(0); - break; - } - case SCREEN_CHARACTERS: - case SCREEN_E: - case SCREEN_CHEST_INVENTORY: - { - if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) - Inventory_ItemPopupAndAlchemy(); - else if ( (signed int)pY >= 345 ) - break; - else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats - CharacterUI_StatsTab_ShowHint(); - else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills - CharacterUI_SkillsTab_ShowHint(); - else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory - Inventory_ItemPopupAndAlchemy(); - break; - } - case SCREEN_SPELL_BOOK: - { - if ( dword_507B00_spell_info_to_draw_in_popup ) - DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); - break; - } - case SCREEN_HOUSE: - { - if ( (signed int)pY < 345 && (signed int)pX < 469 ) - ShowPopupShopItem(); - break; - } - case SCREEN_PARTY_CREATION: - { - popup_window.Hint = nullptr; - pStr = 0; - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) - { - if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ - && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) - { - switch ( pButton->msg ) - { - case UIMSG_0: //stats info - popup_window.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; - pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; - break; - case UIMSG_PlayerCreationClickPlus: //Plus button info - pStr = pGlobalTXT_LocalizationStrings[670];//Добавить - popup_window.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" - break; - case UIMSG_PlayerCreationClickMinus: //Minus button info - pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть - popup_window.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" - break; - case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info - pStr = pSkillNames[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; - popup_window.Hint = pSkillDesc[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; - break; - case UIMSG_PlayerCreationSelectClass: //Available Class Info - popup_window.Hint = pClassDescriptions[pButton->msg_param]; - pStr = pClassNames[pButton->msg_param]; - break; - case UIMSG_PlayerCreationClickOK: //OK Info - popup_window.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. - pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК - break; - case UIMSG_PlayerCreationClickReset: //Clear info - popup_window.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. - pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить - break; - case UIMSG_PlayerCreation_SelectAttribute: // Character info - pStr = pParty->pPlayers[pButton->msg_param].pName; - popup_window.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; - break; - } - if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info - { - pY = 0; - if ( (signed int)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48) < 37 ) - { - strcpy(pTmpBuf2.data(), CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48))); - popup_window.Hint = pTmpBuf2.data(); - pStr = pSkillNames[pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48)]; - } - } - } - } - if ( popup_window.Hint ) - { - pHint = popup_window.Hint; - popup_window.Hint = nullptr; - popup_window.uFrameWidth = 384; - popup_window.uFrameHeight = 256; - popup_window.uFrameX = 128; - popup_window.uFrameY = 40; - popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; - popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; - popup_window.DrawMessageBox(0); - popup_window.uFrameX += 12; - popup_window.uFrameWidth -= 24; - popup_window.uFrameY += 12; - popup_window.uFrameHeight -= 12; - popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; - popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; - sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", Color16(0xFF, 0xFF, 0x9B), pStr); - popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); - popup_window.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); - } - break; - } - default: - break; - } - dword_507BF0_is_there_popup_onscreen = 1; - viewparams->bRedrawGameUI = 1; -} -int no_rightlick_in_inventory = false; // 0050CDCC -//----- (00416196) -------------------------------------------------------- -void Inventory_ItemPopupAndAlchemy() -{ - int potion1_id; // edx@25 - unsigned int potion2_id; // edi@25 - signed int potionID; // edx@27 - unsigned int pOut_y; // edx@57 - double v31; // st7@112 - Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 - GUIWindow message_window; // [sp+Ch] [bp-84h]@137 - POINT cursor; // [sp+78h] [bp-18h]@2 - unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 - - if (no_rightlick_in_inventory) - return; - - pMouse->GetCursorPos(&cursor); - int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1; - if (item_pid == -1) //added here to avoid crash - return; - ItemGen* item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; - - if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(вещи вне инвентаря) - { - GameUI_DrawItemInfo(item); - return; - } - - if (!item_pid) - { - int inventory_mouse_x = cursor.x - 14; - int inventory_mouse_y = cursor.y - 17; - - int mouse_cell_x = inventory_mouse_x / 32; - int mouse_cell_y = inventory_mouse_y / 32; - - if (mouse_cell_x + mouse_cell_y < 0) - return; - - int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; - if (inventory_idx > 126) - return; - - if (pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx) == 0) - return; - - item_pid = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); - } -//check character condition(проверка состояния персонажа) - if (!pPlayers[uActiveCharacter]->CanAct()) - { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы - message_window.Hint = pTmpBuf.data(); - message_window.uFrameWidth = 384; - message_window.uFrameHeight = 180; - if (cursor.x <= 320 ) - message_window.uFrameX = cursor.x + 30; - else - message_window.uFrameX = cursor.x - 414; - message_window.uFrameY = 40; - message_window.DrawMessageBox(0); - return; - } - - int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; - int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)); - -// for potion bottle(простая бутылка) - if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) - { - GameUI_DrawItemInfo(item); - return; - } -//for recharge potion(зелье перезарядка) - if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) - { - if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions - { - if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - - v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; - if ( v31 < 0.0 ) - v31 = 0.0; - item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); - item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); - - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - GameUI_DrawItemInfo(item); - return; - } -// for harden potion(зелье закалка) - else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) - { - if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions - { - if (item->IsBroken() || // cant harden broken items - item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts - item->GetItemEquipType() < EQUIP_SINGLE_HANDED || - item->GetItemEquipType() > EQUIP_WAND) - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - - item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - GameUI_DrawItemInfo(item); - return; - } -// several potions(несколько зелий) - else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || - pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || - item->uItemID >= ITEM_ARTIFACT_PUCK || - item->IsBroken() || - item->uSpecEnchantmentType || - item->uEnchantmentType || - item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - - item->UpdateTempBonus(pParty->uTimePlayed); - if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - item->uSpecEnchantmentType = 40; // of Slaying - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - else - { - static int _4E2904_enchantment_by_potion_lut[] = - { - 164, 93, 22, - 164, 93, 22, - 11, 5, 13, 7, 59 - }; - item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - - item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; - item->uAttributes = alchemy_skill_level | 0x18; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - GameUI_DrawItemInfo(item); - return; - } - // use reagents(применение реагентов) - if (pParty->pPickedItem.uItemID >= ITEM_REAGENT_WIDOWSWEEP_BERRIES && pParty->pPickedItem.uItemID <= ITEM_REAGENT_PHILOSOPHERS_STONE && - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_BOTTLE) - { - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice(); - switch ( pParty->pPickedItem.uItemID ) - { - case 200: - case 201: - case 202: - case 203: - case 204: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222; - break; - case 205: - case 206: - case 207: - case 208: - case 209: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223; - break; - case 210: - case 211: - case 212: - case 213: - case 214: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224; - break; - case 215: - case 216: - case 217: - case 218: - case 219: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221; - break; - default: - break; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - if ( dword_4E455C ) - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); - dword_4E455C = 0; - } - return; - } -//potions mixing(смешивание двух зелий) - if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION && - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST && - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION) - { - potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS; - potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; - - if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) - potionID = 5; - else - potionID = pItemsTable->potion_data[potion2_id][potion1_id]; - damage_level = 0; - if ( alchemy_skill_points ) - { - if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227 - { - if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239 - damage_level = 2; - if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261 - damage_level = 3; - if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID - damage_level = 4; - } - } - else//no skill(нет навыка) - { - if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 - damage_level = 1; - if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 - damage_level = 2; - if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 - damage_level = 3; - if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 - damage_level = 4; - } - - int pOut_x = item_pid + 1; - for ( uint i = 0; i < 126; ++i ) - { - if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x ) - { - pOut_y = i; - break; - } - } - if ( !potionID ) - { - GameUI_DrawItemInfo(item); - return; - } - if ( damage_level == 1 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); - pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); - v39.z = pParty->vPosition.z + pParty->sEyelevel; - v39.x = pParty->vPosition.x; - v39.y = pParty->vPosition.y; - - int rot_x, rot_y, rot_z; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); - SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); - if ( dword_4E455C ) - { - if ( pPlayers[uActiveCharacter]->CanAct() ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! - dword_4E455C = 0; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( damage_level == 2 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); - pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); - pPlayers[uActiveCharacter]->ItemsEnchant(1); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - v39.x = pParty->vPosition.x; - v39.y = pParty->vPosition.y; - - int rot_x, rot_y, rot_z; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); - SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); - if ( dword_4E455C ) - { - if ( pPlayers[uActiveCharacter]->CanAct() ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! - dword_4E455C = 0; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( damage_level == 3 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); - pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE); - pPlayers[uActiveCharacter]->ItemsEnchant(5); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - v39.x = pParty->vPosition.x; - v39.y = pParty->vPosition.y; - - int rot_x, rot_y, rot_z; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); - SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); - if ( dword_4E455C ) - { - if ( pPlayers[uActiveCharacter]->CanAct() ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! - dword_4E455C = 0; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( damage_level == 4 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); - pPlayers[uActiveCharacter]->SetCondition(Condition_Eradicated, 0); - pPlayers[uActiveCharacter]->ItemsEnchant(0); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - v39.x = pParty->vPosition.x; - v39.y = pParty->vPosition.y; - - int rot_x, rot_y, rot_z; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); - SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); - if ( dword_4E455C ) - { - if ( pPlayers[uActiveCharacter]->CanAct() ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! - dword_4E455C = 0; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( damage_level == 0 ) - { - if ( alchemy_skill_points ) - { - if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(катализатор) - { - if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 ) - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID; - if ( pParty->pPickedItem.uItemID == 221 ) - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType; - } - else - { - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID; - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2; - pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]); - } - int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//бутылка - if ( bottle ) - pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED; - if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) ) - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1; - if ( !dword_4E455C ) - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); - dword_4E455C = 0; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - GameUI_DrawItemInfo(item); - return; - } - } - GameUI_DrawItemInfo(item); - return; -} - - -//----- (0045828B) -------------------------------------------------------- -unsigned int __fastcall GetSpellColor(signed int a1) -{ - if ( a1 == 0 ) - return Color16(0, 0, 0); - if ( a1 < 12 ) - return Color16(255, 85, 0); - if ( a1 < 23 ) - return Color16(150, 212, 255); - if ( a1 < 34 ) - return Color16(0, 128, 255); - if ( a1 < 45 ) - return Color16(128, 128, 128); - if ( a1 < 56 ) - return Color16(225, 225, 225); - if ( a1 < 67 ) - return Color16(235, 15, 255); - if ( a1 < 78 ) - return Color16(255, 128, 0); - if ( a1 < 89 ) - return Color16(255, 255, 155); - if ( a1 < 100 ) - return Color16(192, 192, 240); - else - __debugbreak(); -} - -//----- (004B46F8) -------------------------------------------------------- -__int64 GetExperienceRequiredForLevel(int level) -{ - __int64 v1; // eax@1 - int i; // edx@1 - - v1 = 0; - for (i = 0; i < level; ++i) - v1 += i + 1; - return 1000 * v1; -}
--- a/UI/UIPopup.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -#pragma once - -unsigned int __fastcall GetSpellColor(signed int a1); -__int64 GetExperienceRequiredForLevel(int a1);
--- a/UI/UIRest.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\Engine/Party.h" -#include "..\AudioPlayer.h" -#include "..\Engine/Graphics/Outdoor.h" -#include "..\Engine/LOD.h" -#include "..\Engine/Graphics/Viewport.h" -#include "..\Engine/Timer.h" -#include "..\Engine/texts.h" - -#include "..\Engine/mm7_data.h" - - - -//----- (0041F6C1) -------------------------------------------------------- -void RestUI_Load() -{ - if ( !dword_506F14 ) - pAudioPlayer->StopChannels(-1, -1); - if ( pCurrentScreen != SCREEN_GAME) - { - pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = true; - } - pEventTimer->Pause(); - if ( dword_506F14 != 2 ) - GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0); - _506F18_num_minutes_to_sleep = 0; - dword_506F14 = 0; - uRestUI_FoodRequiredToRest = 2; - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); - if ( PartyHasDragon() ) - { - for ( uint i = 0; i < 4; ++i ) - { - if (pParty->pPlayers[i].classType == PLAYER_CLASS_WARLOCK) - ++uRestUI_FoodRequiredToRest; - } - } - if ( CheckHiredNPCSpeciality(Porter) ) - --uRestUI_FoodRequiredToRest; - if ( CheckHiredNPCSpeciality(QuarterMaster) ) - uRestUI_FoodRequiredToRest -= 2; - if ( CheckHiredNPCSpeciality(Gypsy) ) - --uRestUI_FoodRequiredToRest; - if ( uRestUI_FoodRequiredToRest < 1 ) - uRestUI_FoodRequiredToRest = 1; - if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )//Замок Хармондейл - uRestUI_FoodRequiredToRest = 0; - - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - - pCurrentScreen = SCREEN_REST; - _507CD4_RestUI_hourglass_anim_controller = 0; - uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); - OutdoorLocation::LoadActualSkyFrame(); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0); - pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); - pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); - pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); - pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); - pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); -} - -//----- (0041FA01) -------------------------------------------------------- -void RestUI_Draw() -{ - int live_characters; // esi@1 - unsigned int v3; // eax@15 - GUIButton tmp_button; // [sp+8h] [bp-DCh]@19 - unsigned int am_pm_hours; // [sp+D8h] [bp-Ch]@9 - - live_characters = 0; - for( int i = 1; i < 5; ++i ) - if ( !pPlayers[i]->IsDead() && !pPlayers[i]->IsEradicated() && pPlayers[i]->sHealth > 0 ) - ++live_characters; - - if ( live_characters ) - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_RestUI_restmain)); - am_pm_hours = pParty->uCurrentHour; - dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; - if ( (signed int)pParty->uCurrentHour <= 12 ) - { - if ( !am_pm_hours ) - am_pm_hours = 12; - } - else - am_pm_hours -= 12; - pRenderer->DrawTextureIndexed(16, 26, pTexture_RestUI_CurrentSkyFrame); - if ( pTexture_RestUI_CurrentHourglassFrame ) - { - pTexture_RestUI_CurrentHourglassFrame->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller; - _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed; - if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 ) - { - v3 = 0; - _507CD4_RestUI_hourglass_anim_controller = 0; - } - hourglass_icon_idx = (int)floorf(((double)v3 / 512.0 * 120.0) + 0.5f) % 256 + 1; - if (hourglass_icon_idx >= 120 ) - hourglass_icon_idx = 1; - - sprintf(pTmpBuf.data(), "hglas%03d", hourglass_icon_idx); - pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(267, 159, pTexture_RestUI_CurrentHourglassFrame); - memset(&tmp_button, 0, sizeof(GUIButton)); - tmp_button.uX = 24; - tmp_button.uY = 154; - tmp_button.uZ = 194; - tmp_button.uW = 190; - tmp_button.uWidth = 171; - tmp_button.uHeight = 37; - tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; - tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Отдых и лечение 8 часов - tmp_button.pParent = 0; - - sprintf(pTmpBuf.data(), "\r408%d", uRestUI_FoodRequiredToRest); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); - - pButton_RestUI_WaitUntilDawn->DrawLabel(pGlobalTXT_LocalizationStrings[237], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать до рассвета - pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать 1 час - pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать 5 минут - pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Закончить отдыхать - memset(&tmp_button, 0, sizeof(GUIButton)); - tmp_button.uX = 45; - tmp_button.uY = 199; - - tmp_button.uZ = 229; - tmp_button.uW = 228; - - tmp_button.uWidth = 185; - tmp_button.uHeight = 30; - - tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; - tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, Color16(10, 0, 0), Color16(230, 214, 193));//Ждать без лечения - tmp_button.pParent = 0; - sprintf(pTmpBuf.data(), "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute, aAMPMNames[(pParty->uCurrentHour >= 12 && pParty->uCurrentHour < 24)? 1:0]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); - sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);//День - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); - sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);//Месяц - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); - sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);//Год - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, Color16(10, 0, 0), pTmpBuf.data(), 0, 0, Color16(230, 214, 193)); - if ( dword_506F14 ) - Party::Sleep6Hours(); - } - else - GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, - (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest" -} \ No newline at end of file
--- a/UI/UIRest.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#pragma once \ No newline at end of file
--- a/UI/UISaveLoad.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include <io.h> - -#include "..\Engine/MM7.h" -#include "..\Engine/ErrorHandling.h" - -#include "..\Keyboard.h" - -#include "..\Engine/MapInfo.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\Engine/Graphics/Render.h" -#include "..\Engine/LOD.h" -#include "..\Engine/SaveLoad.h" -#include "..\Engine/texts.h" - -#include "..\Engine/mm7_data.h" - -#include "..\Engine/Game.h" - - -//----- (004601B7) -------------------------------------------------------- -static void UI_DrawSaveLoad(bool save) -{ -// const char *pSlotName; // edi@36 - GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8 - unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 - unsigned __int64 full_hours; - unsigned __int64 full_days; - int full_weeks; - int full_month; - int current_year; - int current_month; - int current_day; - int current_hour; - int current_minutes; - - pRenderer->BeginScene(); - if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if (save) - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); - pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up)); - } - else - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); - pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up)); - } - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - } - if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) - { - memset(&save_load_window, 0, 0x54); - save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; - save_load_window.uFrameWidth = 220; - save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157; - save_load_window.uFrameZ = save_load_window.uFrameX + 219; - save_load_window.uFrameHeight = pFontSmallnum->uFontHeight; - save_load_window.uFrameW = pFontSmallnum->uFontHeight + save_load_window.uFrameY - 1; - if ( pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels ) - pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); -//Draw map name - save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pSavegameHeader[uLoadGameUI_SelectedSlot].pLocationName)].pName, 3); -//Draw date - full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64; - full_days = (unsigned int)full_hours / 24; - full_weeks = (unsigned int)(full_days / 7); - full_month = (unsigned int)full_weeks / 4; - current_year = (full_month / 12) + game_starting_year; - current_month = full_month % 12; - current_day = full_days % 28; - current_hour = full_hours % 24; - current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64); - - save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; - int am; - if ( (signed int)current_hour >= 12 ) - { - current_hour -= 12; - if ( !current_hour ) - current_hour = 12; - am = 1; - } - else - am = 0; - const char* day = aDayNames[full_days % 7]; - const char* ampm = aAMPMNames[am]; - const char* month = aMonthNames[current_month]; - - sprintfex(pTmpBuf.data(), "%s %d:%02d %s\n%d %s %d", day, current_hour, current_minutes, aAMPMNames[am], current_day + 1, month, current_year); - save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3); - } - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) - { - pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pKeyActionMap->pPressedKeysBuffer); - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); - } - else - { - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) - pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - } - if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) - { - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, - 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, - pSavegameHeader[uLoadGameUI_SelectedSlot].pName) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, - 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите" - } - else - { - if ( save ) - pSaveFiles = 40; - else - pSaveFiles = uNumSavegameFiles; - - int slot_Y = 199; - for ( uint i = pSaveListPosition; i < pSaveFiles; ++i ) - { - if ( slot_Y >= 346 ) - break; - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? Color16(0xFF, 0xFF, 0x64) : 0, pSavegameHeader[i].pName, 185, 0); - else - pGUIWindow_CurrentMenu->DrawFlashingInputCursor(pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? Color16(0xFF, 0xFF, 0x64) : 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1) + 27, - slot_Y, pFontSmallnum); - slot_Y += 21; - } - } - pRenderer->EndScene(); -} -// 6A0C9C: using guessed type int dword_6A0C9C; - -//----- (004606F7) -------------------------------------------------------- -void LoadUI_Draw() -{ - UI_DrawSaveLoad(false); -} - -//----- (004606FE) -------------------------------------------------------- -void SaveUI_Draw() -{ - UI_DrawSaveLoad(true); -} - -//----- (0045E361) -------------------------------------------------------- -void LoadUI_Load(unsigned int uDialogueType) -{ - LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - - dword_6BE138 = -1; - pIcons_LOD->_inlined_sub2(); - - memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); - memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - if ( uDialogueType ) - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if ( pCurrentScreen == SCREEN_SAVEGAME ) - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); - pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); - } - else - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); - pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); - } - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - } - else - pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); - pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType], saveload_dlg_ys[uDialogueType], saveload_dlg_zs[uDialogueType], - saveload_dlg_ws[uDialogueType], WINDOW_MainMenu_Load, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." - pRenderer->Present(); - pSavegameList->Initialize(0); - if ( pSaveListPosition > (signed int)uNumSavegameFiles ) - { - pSaveListPosition = 0; - uLoadGameUI_SelectedSlot = 0; - } - pLODFile.AllocSubIndicesAndIO(300, 0); - Assert(sizeof(SavegameHeader) == 100); - for (uint i = 0; i < uNumSavegameFiles; ++i) - { - sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); - if (_access(pTmpBuf.data(), 6)) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" - continue; - } - pLODFile.LoadFile(pTmpBuf.data(), 1); - if ( pLODFile.FindContainer("header.bin", true) ) - fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); - if ( !_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" - if ( !pLODFile.FindContainer("image.pcx", true) ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); - } - else - { - pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); - pLODFile.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - } - - pLODFile.FreeSubIndexAndIO(); - if ( pCurrentScreen == SCREEN_SAVEGAME ) - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); - } - else - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); - } - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); -} - -//----- (0045E93E) -------------------------------------------------------- -void SaveUI_Load() -{ - char *v3; // eax@7 - LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); - memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if ( pCurrentScreen == SCREEN_SAVEGAME ) - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); - } - else - { - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); - } - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) - pRenderer->Present(); - pSavegameList->Initialize(1); - pLODFile.AllocSubIndicesAndIO(300, 0); - for (uint i = 0; i < 40; ++i) - { - v3 = pSavegameList->pFileList[i].pSaveFileName; - if ( !*pSavegameList->pFileList[i].pSaveFileName ) - v3 = "1.mm7"; - sprintf(pTmpBuf.data(), "saves\\%s", v3); - if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); - } - else - { - pLODFile.LoadFile(pTmpBuf.data(), 1); - fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); - if ( pLODFile.FindContainer("image.pcx", 1) ) - { - pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); - pLODFile.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - else - pSavegameUsedSlots[i] = 0; - } - } - pLODFile.FreeSubIndexAndIO(); - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SaveLoadButtons, 0, 0); - pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); -} \ No newline at end of file
--- a/UI/UISaveLoad.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#pragma once \ No newline at end of file
--- a/UI/UIShops.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1978 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "UIShops.h" -#include "..\Engine/Objects/Items.h" -#include "..\GUIWindow.h" -#include "..\Engine/mm7_data.h" -#include "..\Engine/texts.h" -#include "UIHouses.h" -#include "..\GUIFont.h" -#include "..\Engine/Graphics/Render.h" -#include "..\Engine/Party.h" -#include "..\Engine/Graphics/Texture.h" -#include "..\Mouse.h" -#include "..\Engine/Events2D.h" -#include "..\AudioPlayer.h" -#include "..\Engine/MapInfo.h" -#include "..\Engine/Graphics/Viewport.h" -#include "..\Engine/Graphics/Outdoor.h" -#include "..\Engine/Graphics/Indoor.h" - - - -//----- (004B910F) -------------------------------------------------------- -void WeaponShopDialog() -{ - int phrases_id; // eax@16 - int v19; // edi@25 - GUIButton *pButton; // esi@27 - unsigned int pColorText; // ax@27 - signed int v32; // esi@41 - const char *pText; // ecx@84 - int all_text_height; // esi@96 - ItemGen *item; - int pItemID; - POINT mouse; // [sp+64h] [bp-94h]@8 - GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 - __int32 v103; // [sp+D4h] [bp-24h]@25 - int pPrice; // [sp+ECh] [bp-Ch]@26 - unsigned int v109; - int pNumString; - int item_X; - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); - pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); - all_text_height = 0; - for ( int i = 0; i < 4; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v103 = (174 - all_text_height) / 4; - v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - pNumString = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v103 + v19; - pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; - pButton->uW = v19; - pColorText = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); - ++pNumString; - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - item_X = 0; - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - { - pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); - } - item_X += 70; - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - uint item_num = 0; - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - ++item_num; - } - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет - else - pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки - DrawTextAtStatusBar(pText, 0); - if ( item_num ) - { - pMouse->GetCursorPos(&mouse); - if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) - { - item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) - { - pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], - uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - else - { - pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - } - } - else - dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней - } - break; - } - - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - item_X = 0; - for ( uint i = 0; i < 6; ++i ) - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - { - pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); - } - item_X += 70; - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - uint item_num = 0; - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) - ++item_num; - } - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - pText = pGlobalTXT_LocalizationStrings[185]; - else - pText = pGlobalTXT_LocalizationStrings[196]; - DrawTextAtStatusBar(pText, 0); - if ( item_num ) - { - pMouse->GetCursorPos(&mouse); - if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) - { - item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) - { - pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], - uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - else - { - pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - } - } - else - dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - } - break; - } - - case HOUSE_DIALOGUE_SHOP_SELL: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pMouse->GetCursorPos(&mouse); - v109 = ((mouse.x + 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if( mouse.x <= 13 || mouse.x >= 462 ) - return; - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); - if ( !pItemID ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; - phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); - pText = BuildDialogueString(pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - break; - } - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pMouse->GetCursorPos(&mouse); - v109 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if( mouse.x <= 13 || mouse.x >= 462 ) - return; - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); - if ( !pItemID ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; - if (!item->IsIdentified()) - { - phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); - pText = BuildDialogueString(pMerchantsIdentifyPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - else - { - pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - break; - } - - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !HouseUI_CheckIfPlayerCanInteract()) - return; - pMouse->GetCursorPos(&mouse); - v109 = ((mouse.x - 14) >> 5) + 14 * (mouse.y - 17) >> 5; - if( ( mouse.x <= 13) || mouse.x >= 462 ) - return; - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); - if ( !pItemID || (!(pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes & 2)) ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; - phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); - pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return; - } - break; - - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);//sell - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);//identify - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);//repair - all_text_height = 0; - for ( int i = 0; i < 3; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v103 = (174 - all_text_height) / 3; - v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; - pNumString = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v103 + v19; - pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; - pButton->uW = v19; - pColorText = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); - ++pNumString; - } - break; - } - - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!HouseUI_CheckIfPlayerCanInteract()) - return; - uint item_num = 0; - all_text_height = 0; - v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < v32 / 3 ) - pPrice = v32 / 3; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); - item_num++; - } - } - if ( item_num ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v103 = (149 - all_text_height) / item_num; - if ( (149 - all_text_height) / item_num > 32 ) - v103 = 32; - v19 = (149 - item_num * v103 - all_text_height) / 2 - v103 / 2 + 162; - for ( uint i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v103 + v19; - pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); - v19 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; - pButton->uW = v19; - pColorText = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); - } - } - break; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); - return; - } - default: - { - __debugbreak(); - break; - } - } -} - -//----- (004BA928) -------------------------------------------------------- -void ArmorShopDialog() -{ - int phrases_id; // eax@20 - int all_text_height; // ebx@22 - int v146; // [sp+E4h] [bp-20h]@24 - int v23; // ebx@24 - GUIButton *pButton; // eax@26 - signed int v38; // esi@42 - int v59; // eax@68 - const char *pText; // ecx@91 - ItemGen *selected_item; // ecx@99 - int pNumString; // edx@109 - unsigned __int16 pTextColor; // ax@109 - POINT mouse; // [sp+4Ch] [bp-B8h]@97 - GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 - __int32 pItemCount; // [sp+F0h] [bp-14h]@8 - int item_x; // [sp+100h] [bp-4h]@44 - int pPrice; - unsigned int v153; - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - switch (dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard" - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special" - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory" - pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); - all_text_height = 0; - for( int i = 0; i < 4; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = ( 174 - all_text_height ) / 4; - v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; - pNumString = 0; - for (int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v146 + v23; - pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; - pButton->uW = v23; - pTextColor = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); - ++pNumString; - } - } - break; - - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка - item_x = 0; - for ( int i = 0; i < 8; ++i )// разместить вещи - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - { - if ( i >= 4 ) //low row - { - pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); - v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; - } - else - { - pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); - v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + window->GetWidth() * (98 - ItemsInShopTexture[i]->uTextureHeight); - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); - } - item_x += 105; - } - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pItemCount = 0; - for ( int i = 0; i < 8; ++i ) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) - ++pItemCount; - } - if ( GetAsyncKeyState(VK_CONTROL) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - else - pText = pGlobalTXT_LocalizationStrings[185];//"Steal item" - DrawTextAtStatusBar(pText, 0); - if ( pItemCount ) - { - pMouse->GetCursorPos(&mouse); - if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) - return; - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal()) - { - pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], - uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - else - { - pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - return; - } - dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - break; - - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - item_x = 0; - for ( int i = 0; i < 8; ++i ) - { - if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) - { - if ( i >= 4 ) - { - pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); - v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; - } - else - { - pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); - v59 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + window->GetWidth() * (98 - ItemsInShopTexture[i]->uTextureHeight); - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); - } - item_x += 105; - } - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pItemCount = 0; - for ( uint i = 0; i < 6; ++i ) - { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - ++pItemCount; - } - if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) - pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" - else - pText = pGlobalTXT_LocalizationStrings[185]; - DrawTextAtStatusBar(pText, 0); - if ( pItemCount ) - { - pMouse->GetCursorPos(&mouse); - if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) - return; - pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; - if ( dialog_menu_id == 2 ) - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - else - selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) - { - pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], - uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - else - { - pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);//"Steal %24" - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - } - return; - } - dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - break; - - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]); //"Sell" - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]); //"Identify" - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]); //"Repair" - all_text_height = 0; - for ( int i = 0; i < 3; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 3; - v23 = (3 * (58 - v146) - all_text_height) / 2 - v146 / 2 + 138; - pNumString = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v146 + v23; - pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; - pButton->uW = v23; - pTextColor = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); - ++pNumString; - } - return; - } - break; - - case HOUSE_DIALOGUE_SHOP_SELL: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" - if ( !HouseUI_CheckIfPlayerCanInteract()) - return; - pMouse->GetCursorPos(&mouse); - v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if ( mouse.x <= 13 || mouse.x >= 462 ) - return; - if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) - return; - selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; - pText = BuildDialogueString(pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)], - uActiveCharacter - 1, selected_item, (char *) window_SpeakInHouse->par1C, 3, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return; - } - break; - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - pMouse->GetCursorPos(&mouse); - v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if ( mouse.x > 13 && mouse.x < 462 ) - { - if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) ) - { - selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153)-1]; - if (selected_item->IsIdentified()) - pText = BuildDialogueString("%24", uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - else - pText = BuildDialogueString(pMerchantsIdentifyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, - (int)window_SpeakInHouse->ptr_1C, 4)], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return; - } - } - } - } - break; - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !HouseUI_CheckIfPlayerCanInteract()) - return; - pMouse->GetCursorPos(&mouse); - v153 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if( mouse.x <= 13 || mouse.x >= 462 ) - return; - if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - || (!(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1].uAttributes& 2)) ) - return; - selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1]; - phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1], - BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); - pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return; - } - break; - - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!HouseUI_CheckIfPlayerCanInteract() ) - return; - uint item_num = 0; - v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pPrice = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( (signed int)pPrice < v38 / 3 ) - pPrice = v38 / 3; - all_text_height = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); - item_num ++; - } - } - if ( item_num ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v146 = (149 - all_text_height) / item_num; - if ( (149 - all_text_height) / item_num > 32 ) - v146 = 32; - v23 = (149 - v146 * item_num - all_text_height) / 2 - v146 / 2 + 162; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] - || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v146 + v23; - pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); - v23 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; - pButton->uW = v23; - pTextColor = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pTextColor = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3); - } - } - return; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); - return; - } - break; - default: - __debugbreak(); - } -} -//----- (004B9CC6) -------------------------------------------------------- -void AlchemistDialog() -{ - int index; // eax@7 - signed int v5; // esi@9 - int v18; // eax@23 - const char *pText; // edx@29 - unsigned int product_height_1row; // edi@55 - unsigned int product_width_1row; // esi@57 - unsigned int product_height_2row; // edi@67 - unsigned int product_width_2row; // esi@69 - ItemGen *item; // esi@118 - int v71; // eax@123 - int all_text_height; // edi@125 - GUIButton *pButton; // esi@129 - unsigned int pColorText; // ax@129 - POINT mouse; // [sp+2Ch] [bp-ACh]@117 - GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 - int v105; // [sp+B0h] [bp-28h]@19 - int pNumString; // [sp+C8h] [bp-10h]@9 - int item_num; // [sp+D4h] [bp-4h]@11 - int pPrice; - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); - pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); - all_text_height = 0; - for ( int i = 0; i < 4; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v18 = (174 - all_text_height) / 4; - v105 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - pNumString = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v18 + v105; - pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; - pButton->uW = v105; - pColorText = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); - ++pNumString; - } - } - return; - } - - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) - { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; - if ( (signed int)product_height_1row < 1 ) - product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; - } - } - else if ( (signed int)product_width_1row < 18 ) - product_width_1row = 18; - pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); - } - } - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID ) - { - product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; - if ( (signed int)product_height_2row < 1 ) - product_height_2row = 0; - product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; - } - } - else - { - if ( (signed int)product_width_2row < 18 ) - product_width_2row = 18; - } - pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); - } - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - item_num = 0; - for ( uint i = 0; i < 12; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - ++item_num; - } - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); - else - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); - if ( !item_num ) - { - dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - pMouse->GetCursorPos(&mouse); - if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) - { - item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) - { - v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); - pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - } - else - pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return ; - } - } - return; - } - - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - for ( uint i = 0; i < 6; ++i ) - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; - if ( (signed int)product_height_1row < 1 ) - product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; - } - } - else - { - if ( (signed int)product_width_1row < 18 ) - product_width_1row = 18; - } - pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); - } - } - for ( uint i = 0; i < 6; ++i ) - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid - { - product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight; - if ( (signed int)product_height_2row < 1 ) - product_height_2row = 0; - product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; - } - } - else - { - if ( (signed int)product_width_2row < 18 ) - product_width_2row = 18; - } - pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); - } - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - item_num = 0; - for ( uint i = 0; i < 12; ++i ) - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - ++item_num; - } - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0); - else - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0); - if ( !item_num ) - { - dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - pMouse->GetCursorPos(&mouse); - if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) - { - item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( !GetAsyncKeyState(VK_CONTROL) || !pPlayers[uActiveCharacter]->CanSteal() ) - { - v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); - pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - } - else - pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return; - } - } - return; - } - - case HOUSE_DIALOGUE_SHOP_SELL: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pMouse->GetCursorPos(&mouse); - index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if ( mouse.x <= 13 || mouse.x >= 462 ) - return; - if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) - return; - v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], - BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); - pText = BuildDialogueString(pMerchantsSellPhrases[v71], uActiveCharacter - 1, &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1], - (char *)window_SpeakInHouse->ptr_1C, 3, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return; - } - - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - if ( HouseUI_CheckIfPlayerCanInteract() ) - return; - pMouse->GetCursorPos(&mouse); - index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if ( mouse.x <= 13 || mouse.x >= 462 ) - return; - if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1]; - if (!item->IsIdentified()) - { - v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); - pText = BuildDialogueString(pMerchantsIdentifyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - } - else - pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), pText, 3); - return; - } - - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]); - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]); - all_text_height = 0; - for ( int i = 0; i < 2; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v18 = (174 - all_text_height) / 2; - v105 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; - pNumString = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - pButton->uY = v18 + v105; - pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; - pButton->uW = v105; - pColorText = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3); - ++pNumString; - } - return; - } - - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!HouseUI_CheckIfPlayerCanInteract()) - return; - all_text_height = 0; - v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pPrice = v5 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < v5 / 3 ) - pPrice = v5 / 3; - item_num = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); - ++item_num; - } - } - if ( !item_num ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); - return; - } - if ( item_num ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v18 = (149 - all_text_height) / item_num; - if ( (149 - all_text_height) / item_num > 32 ) - v18 = 32; - v105 = (149 - item_num * v18 - all_text_height) / 2 - v18 / 2 + 162; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; i++ ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] - || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v18 + v105; - pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); - v105 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; - pButton->uW = v105; - pColorText = Color16(0xE1u, 0xCDu, 0x23u); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - pColorText = Color16(0xFFu, 0xFFu, 0xFFu); - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); - } - } - return; - } - } - default: - __debugbreak(); - } -} - -//----- (004B4FCF) -------------------------------------------------------- -void MagicShopDialog() -{ - int all_text_height; // edi@21 - GUIButton *control_button; // esi@25 - int v23; // eax@25 - unsigned __int16 text_color; // ax@25 - char *v30; // edx@35 - signed int v33; // esi@40 - unsigned int product_height_1row; // edi@64 - unsigned int product_width_1row; // esi@66 - unsigned int product_height_2row; // edi@76 - unsigned int product_width_2row; // esi@76 - int v75; // eax@130 - POINT mouse; // [sp+6Ch] [bp-8Ch]@30 - GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 - int item_num; // [sp+E0h] [bp-18h]@8 - int v117; // [sp+E4h] [bp-14h]@40 - int pPrice; // [sp+E8h] [bp-10h]@24 - int one_string; // [sp+ECh] [bp-Ch]@1 - int pSrtingNum; - ItemGen *item; - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard" - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special" - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory" - pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]); - all_text_height = 0; - for ( int i = 0; i < 4; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - one_string = (174 - all_text_height) / 4; - v23 = (174 - 4 * one_string - all_text_height) / 2 - one_string / 2 + 138; - int pNumString = 0; - for (int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) - { - control_button = pDialogueWindow->GetControl(i); - control_button->uY = one_string + v23; - control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = Color16(225, 205, 35); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - text_color = Color16(255, 255, 255); - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pNumString], 3); - ++pNumString; - } - return; - } - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; - if ( (signed int)product_height_1row < 1 ) - product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; - } - } - else - { - if ( (signed int)product_width_1row < 18 ) - product_width_1row = 18; - } - pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); - } - } - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) - { - product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; - product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; - } - } - else - { - if ( (signed int)product_width_2row < 18 ) - product_width_2row = 18; - } - pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); - } - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - item_num = 0; - for ( uint i = 0; i < 12; ++i ) - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) - ++item_num; - } - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" - else - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);// "Select the Item to Buy" - if ( !item_num ) - { - dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - pMouse->GetCursorPos(&mouse); - if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) - { - item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" - else - { - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); - v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - } - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); - return; - } - } - return; - } - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - for ( uint i = 0; i < 6; ++i ) - { - if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) - { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; - if ( (signed int)product_height_1row < 1 ) - product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; - } - } - else - { - if ( (signed int)product_width_1row < 18 ) - product_width_1row = 18; - } - pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); - } - } - for ( uint i = 0; i < 6; ++i ) - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID) - { - product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight; - if ( (signed int)product_height_2row < 1 ) - product_height_2row = 0; - product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; - if ( i ) - { - if ( i == 5 ) - { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; - } - } - else - { - if ( (signed int)product_width_2row < 18 ) - product_width_2row = 18; - } - pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7); - } - } - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - item_num = 0; - for ( uint i = 0; i < 12; ++i ) - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) - ++item_num; - } - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item" - else - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);// "Select the Special Item to Buy" - if ( !item_num ) - { - dialog_window.DrawShops_next_generation_time_string( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - pMouse->GetCursorPos(&mouse); - if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) - { - item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; - if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() ) - v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24" - else - { - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); - v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - } - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); - return; - } - } - return; - } - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);// "Sell" - pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);// "Identify" - pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);// "Repair" - all_text_height = 0; - for ( uint i = 0; i < 3; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - one_string = ((174 - all_text_height) / 3); - v23 = (3 * (58 - (signed int)one_string) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; - pSrtingNum = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - control_button = pDialogueWindow->GetControl(i); - control_button->uY = one_string + v23; - control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); - v23 = control_button->uHeight + control_button->uY - 1; - control_button->uW = v23; - text_color = Color16(225, 205, 35); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - text_color = Color16(255, 255, 255); - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pSrtingNum], 3); - ++pSrtingNum; - } - return; - } - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pMouse->GetCursorPos(&mouse); - v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if ( mouse.x <= 13 || mouse.x >= 462 ) - return; - if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); - v30 = BuildDialogueString(pMerchantsSellPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); - return; - } - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - pMouse->GetCursorPos(&mouse); - v117 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if ( mouse.x > 13 && mouse.x < 462 ) - { - if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) ) - { - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; - if ( item->uAttributes & ITEM_IDENTIFIED ) - { - dialog_window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), &dialog_window, 0, 0)) / 2 + 101, - Color16(255, 255, 255), BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), 3); - return; - } - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); - v30 = BuildDialogueString(pMerchantsIdentifyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); - return; - } - } - } - return; - } - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" - if ( !HouseUI_CheckIfPlayerCanInteract() ) - return; - pMouse->GetCursorPos(&mouse); - v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); - if ( mouse.x <= 13 || mouse.x >= 462 ) - return; - if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - || !(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)-1].uAttributes& 2) ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1]; - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1], - BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); - v30 = BuildDialogueString(pMerchantsRepairPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, Color16(255, 255, 255), v30, 3); - return; - } - - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) - { - if ( HouseUI_CheckIfPlayerCanInteract() ) - { - all_text_height = 0; - v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pPrice = v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( pPrice < v33 / 3 ) - pPrice = v33 / 3; - item_num = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); - ++item_num; - } - } - if ( !item_num ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, Color16(225, 205, 35), pTmpBuf.data(), 3); - return; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu" - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - one_string = (149 - all_text_height) / item_num; - if ( one_string > 32 ) - one_string = 32; - v23 = (149 - item_num * one_string - all_text_height) / 2 - one_string / 2 + 162; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i) - { - control_button = pDialogueWindow->GetControl(i); - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][control_button->msg_param - 36] - || pPlayers[uActiveCharacter]->pActiveSkills[control_button->msg_param - 36] ) - { - control_button->uW = 0; - control_button->uHeight = 0; - control_button->uY = 0; - } - else - { - control_button->uY = one_string + v23; - control_button->uHeight = pFontArrus->CalcTextHeight(pSkillNames[control_button->msg_param - 36], &dialog_window, 0, 0); - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = Color16(225, 205, 35); - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - text_color = Color16(255, 255, 255); - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pSkillNames[control_button->msg_param - 36], 3); - } - } - } - return; - } - return; -} -//----- (004BDB56) -------------------------------------------------------- -void UIShop_Buy_Identify_Repair() -{ - int v8; // eax@15 - unsigned int pItemID; // esi@20 - ItemGen *item; // esi@21 - unsigned int v15; // eax@33 - POINT *pCursorPos; // esi@37 - int v18; // ecx@37 - float pPriceMultiplier; // ST1C_4@38 - int taken_item; // eax@40 - ItemGen *bought_item; // esi@51 - int party_reputation; // eax@55 - int v39; // eax@63 - int v42; // esi@74 - signed int v43; // ebx@74 - unsigned __int16 *pSkill; // esi@77 - int v55; // [sp+0h] [bp-B4h]@26 - POINT cursor; // [sp+40h] [bp-74h]@37 - int a6; // [sp+98h] [bp-1Ch]@57 - int a3; // [sp+9Ch] [bp-18h]@53 - unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 - unsigned int v79; // [sp+A8h] [bp-Ch]@9 - int uPriceItemService; // [sp+ACh] [bp-8h]@12 - - if ( pCurrentScreen == SCREEN_E ) - { - pPlayers[uActiveCharacter]->OnInventoryLeftClick(); - return; - } - if ( !HouseUI_CheckIfPlayerCanInteract() ) - { - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - return; - } - - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pPlayers[uActiveCharacter]->OnInventoryLeftClick(); - break; - } - case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: - { - pMouse->GetCursorPos(&cursor); - v18 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; - if ( !v18 ) - return; - bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); - pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); - GetAsyncKeyState(VK_CONTROL); - if ( pParty->uNumGold < uPriceItemService ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - return; - } - taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); - if ( taken_item ) - { - bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1], bought_item, 0x24u); - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" - break; - } - case HOUSE_DIALOGUE_SHOP_SELL: - { - v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&cursor)->x <= 13 - || pMouse->GetCursorPos(&cursor)->x >= 462 - || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) - return; - if ( pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1].MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) - { - dword_F8B1E4 = 1; - pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); - viewparams->bRedrawGameUI = 1; - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - break; - } - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - pMouse->GetCursorPos(&cursor); - v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); - if (cursor.x > 13 && cursor.x < 462) - { - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); - if ( pItemID ) - { - uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; - if ( !(item->uAttributes & ITEM_IDENTIFIED) ) - { - if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) - { - if ( pParty->uNumGold >= uPriceItemService ) - { - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - item->uAttributes |= ITEM_IDENTIFIED; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - return; - } - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); - return; - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&cursor)->x > 13 ) - { - if ( pMouse->GetCursorPos(&cursor)->x < 462 ) - { - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); - if ( pItemID ) - { - item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; - pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - ItemGen* _v = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; - uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); - if ( item->uAttributes & ITEM_BROKEN ) - { - if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) - { - if ( pParty->uNumGold >= uPriceItemService ) - { - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - v8 = item->uAttributes; - LOBYTE(v8) = item->uAttributes & 0xFD; - item->uAttributes = v8 | 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - return; - } - pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); - return; - } - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pCursorPos = pMouse->GetCursorPos(&cursor); - v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; - if ( !v18 ) - return; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; - else - bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; - uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - uNumSeconds = 0; - a3 = 0; - if ( pMapStats->GetMapInfo(pCurrentMapName) ) - a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm; - party_reputation = pParty->GetPartyReputation(); - if (pPlayers[uActiveCharacter]->CanSteal() && GetAsyncKeyState(VK_CONTROL)) - { - uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); - if ( !uNumSeconds ) - { - sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); - return; - } - } - else if (pParty->uNumGold < uPriceItemService) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - return; - } - v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); - if ( v39 ) - { - bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); - if (uNumSeconds != 0) - { - pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); - sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); - } - else - { - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - } - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - else - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" - return; - } - break; - } - default:// if click video screen in shop - { - __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum - if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) - { - v42 = dialog_menu_id - 36; - //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( uPriceItemService < v43 / 3 ) - uPriceItemService = v43 / 3; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) - { - pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; - if ( !*pSkill ) - { - if ( pParty->uNumGold < uPriceItemService ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - if ( in_current_building_type == BuildingType_Training ) - v55 = 4; - else - v55 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); - return; - } - Party::TakeGold(uPriceItemService); - dword_F8B1E4 = 1; - *pSkill = 1; - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); - return; - } - } - } - break; - } - } -} -//----- (004B1A2D) -------------------------------------------------------- -void ShowPopupShopItem() -{ - int v3; // ecx@5 -// unsigned int v6; // eax@13 - ItemGen *v7; // ecx@13 - POINT cursor; // [sp+30h] [bp-1Ch]@17 - - if ( in_current_building_type <= 0 ) - return; - if ( dialog_menu_id < HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - return; - if ( in_current_building_type <= BuildingType_AlchemistShop ) - { - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) - { - pMouse->GetCursorPos(&cursor); - v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; - if ( !v3 ) - return; - v7 = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1]; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) - v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1]; - GameUI_DrawItemInfo(v7); - return; - } - - if ( dialog_menu_id >= HOUSE_DIALOGUE_SHOP_SELL && dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR - || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) - { - pMouse->GetCursorPos(&cursor); - v3 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); - if ( cursor.x <= 13 || cursor.x >= 462 - || !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) ) - return; - GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) - 1]); - return; - } - } - if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) - { - pMouse->GetCursorPos(&cursor); - v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF; - if ( v3 ) - { - unsigned int guildId = (unsigned int)window_SpeakInHouse->ptr_1C - 139; - sub_4B1523_showSpellbookInfo(pParty->SpellBooksInGuilds[guildId][v3].uItemID); - } - } -} - -//----- (004B1523) -------------------------------------------------------- -void sub_4B1523_showSpellbookInfo(int spellItemId) -{ - int spellId; // esi@1 - int spellLevel; // edx@1 - unsigned int v3; // eax@2 - int v4; // eax@4 - LONG v5; // ecx@4 - int v6; // eax@10 - char *v7; // ST44_4@12 - unsigned __int16 v8; // ax@12 - GUIWindow a1; // [sp+Ch] [bp-68h]@4 - unsigned int spellSchool; // [sp+60h] [bp-14h]@1 - POINT a2; // [sp+64h] [bp-10h]@1 - int v13; // [sp+6Ch] [bp-8h]@4 - int v14; // [sp+70h] [bp-4h]@4 - - spellId = spellItemId - 399; - spellLevel = (spellItemId - 400) % 11 + 1; - spellSchool = 4 * (spellItemId - 400) / 11; - // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used - if ( pMouse->GetCursorPos(&a2)->y <= 320 ) - v3 = pMouse->GetCursorPos(&a2)->y + 30; - else - v3 = 30; - a1.Hint = nullptr; - a1.uFrameY = v3; - a1.uFrameWidth = 328; - a1.uFrameHeight = 68; - a1.uFrameX = 90; - a1.uFrameZ = 417; - a1.uFrameW = v3 + 67; - a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); - v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); - v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); - v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); - v5 = a2.y; - if ( v14 > a2.y ) - v5 = v14; - if ( v13 > v5 ) - v5 = v13; - if ( v4 > v5 ) - v5 = v4; - sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", - pSpellStats->pInfos[spellId].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" - v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" - v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" - v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" - v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pGrandmasterSkillDesc); - v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); - a1.uFrameHeight += v6; - if ( (signed int)a1.uFrameHeight < 150 ) - a1.uFrameHeight = 150; - a1.uFrameWidth = game_viewport_width; - a1.DrawMessageBox(0); - a1.uFrameWidth -= 12; - a1.uFrameHeight -= 12; - v7 = pSpellStats->pInfos[spellId].pName; - a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; - a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; - v8 = Color16(0xFFu, 0xFFu, 0x9Bu); - a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); - a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); - a1.uFrameZ = a1.uFrameX + 107; - a1.uFrameWidth = 108; - a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[spellSchool / 4 + 12], 3u); - sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * spellId)); - a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); -} -//----- (004B1D27) -------------------------------------------------------- -void GetHouseGoodbyeSpeech() -{ - signed int v2; // edi@10 - signed int v5; // edi@20 - int v7[4]; // [sp+Ch] [bp-10h]@12 - - if ( in_current_building_type > 0 ) - { - if ( in_current_building_type > BuildingType_MagicShop ) - { - if ( in_current_building_type == BuildingType_Bank ) - { - if ( !dword_F8B1E4 ) - return; - } - else - { - if ( in_current_building_type != BuildingType_Temple ) - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); - return; - } - if ( (signed __int64)pParty->PartyTimes._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed ) - { - if ( pParty->uNumGold <= 10000 ) - { - if ( !dword_F8B1E4 ) - return; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)(dword_F8B1E4 + 3)); - if ( !dword_F8B1E4 && !_A750D8_player_speech_timer ) - { - v5 = 0; - for ( uint i = 1; i <= 4; ++i ) - { - if ( pPlayers[i]->CanAct() ) - v7[v5++] = i; - } - if ( v5 ) - { - _A750D8_player_speech_timer = 256i64; - PlayerSpeechID = SPEECH_80; - uSpeakingCharacter = v7[rand() % v5]; - return; - } - } - } - else - { - if ( !_A750D8_player_speech_timer ) - { - v2 = 0; - for ( uint i = 1; i <= 4; ++i ) - { - if ( pPlayers[i]->CanAct() ) - v7[v2++] = i; - } - if ( v2 ) - { - _A750D8_player_speech_timer = 256i64; - PlayerSpeechID = SPEECH_80; - uSpeakingCharacter = v7[rand() % v2]; - return; - } - } - } - } -} - -//----- (004B1447) -------------------------------------------------------- -void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd) -{ - signed int v3; // esi@1 - DDM_DLV_Header *v7; // eax@14 - - if (stealingResult == 0 || stealingResult == 1) - { - if (pParty->uFine < 4000000) - { - if (fineToAdd + pParty->uFine < 0) - pParty->uFine = 0; - else if (fineToAdd + pParty->uFine > 4000000) - pParty->uFine = 4000000; - else - pParty->uFine += fineToAdd; - } - if (pParty->uFine) - { - for (uint i = 1; i <= 4; ++i) - { - if (!_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1)) - _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); - } - } - if (stealingResult == 1) - v3 = 2; - else - v3 = 1; - } - else - v3 = 2; - pParty->PartyTimes._shop_ban_times[shopId] = pParty->uTimePlayed + 368640; - pParty->InTheShopFlags[shopId] = 1; - v7 = &pOutdoor->ddm; - if (uCurrentlyLoadedLevelType != LEVEL_Outdoor) - v7 = &pIndoor->dlv; - v7->uReputation += v3; - if (v7->uReputation > 10000) - v7->uReputation = 10000; -}
--- a/UI/UIShops.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#pragma once -void UIShop_Buy_Identify_Repair(); -void sub_4B1523_showSpellbookInfo(int spellItemId); -void ShowPopupShopItem(); -void GetHouseGoodbyeSpeech(); -void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd);
--- a/UI/UITransition.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include <io.h> - -#include "..\Engine/ErrorHandling.h" -#include "..\Engine/mm7_data.h" -#include "..\MediaPlayer.h" -#include "..\Engine/MapInfo.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\GUIProgressBar.h" -#include "..\Engine/Party.h" -#include "..\AudioPlayer.h" -#include "..\Engine/Graphics/Outdoor.h" -#include "..\Engine/LOD.h" -#include "..\Engine/Timer.h" -#include "..\Engine/stru159.h" -#include "..\Engine/Events2D.h" -#include "..\Engine/texts.h" -#include "UIHouses.h" - - - - -//----- (00444839) -------------------------------------------------------- -void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) -{ - const char *v15; // eax@14 - char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 - - dword_59117C_teleportx = x; - dword_591178_teleporty = y; - dword_591174_teleportz = z; - dword_591170_teleport_directiony = directiony; - dword_59116C_teleport_directionx = directionx; - dword_591168_teleport_speedz = a8; - dword_591164_teleport_map_name = (char *)pLocationName; - uCurrentHouse_Animation = anim_id; - pEventTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; - default: Error("Invalid alignment: %u", pParty->alignment); - } - - pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)]; - pTexture_outside = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[exit_pic_id], TEXTURE_16BIT_PALETTE); - if (anim_id) - { - if ( !IndoorLocation::GetLocationIndex(pLocationName) ) - pMediaPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1); - } - else if ( !IndoorLocation::GetLocationIndex(pLocationName) ) - { - if ( pMapStats->GetMapInfo(pCurrentMapName) ) - { - sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); // "Leave %s" - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); - //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) - //PlayHouseSound(anim_id, HouseSound_Greeting); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); - if ( IndoorLocation::GetLocationIndex(pLocationName) ) - uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); - return; - } - strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]); - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); - //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) - //PlayHouseSound(anim_id, HouseSound_Greeting); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); - if ( IndoorLocation::GetLocationIndex(pLocationName) ) - uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); - return; - } - v15 = pLocationName; - if ( *pLocationName == 48 ) - v15 = pCurrentMapName; - if ( pMapStats->GetMapInfo(v15) ) - { - sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s] - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); - if ( IndoorLocation::GetLocationIndex(pLocationName) ) - uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); - return; - } - strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Transition, 0, sHouseName.data()); - //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) - //PlayHouseSound(anim_id, HouseSound_Greeting); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); - if ( IndoorLocation::GetLocationIndex(pLocationName) ) - uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); -} - -//----- (00444C8F) -------------------------------------------------------- -void TravelUI_Load() -{ - char pContainer[32]; // [sp+0h] [bp-28h]@1 - - pEventTimer->Pause(); - - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; - default: Error("Invalid alignment: %u", pParty->alignment); - } - - pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); - if ( pMapStats->GetMapInfo(pCurrentMapName) ) - sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);// "Leave %s" - else - strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit" - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_ChangeLocation, 0, sHouseName.data()); -} - -//----- (00444DCA) -------------------------------------------------------- -void TravelUI_Draw() -{ - GUIWindow travel_window; // [sp+Ch] [bp-78h]@1 - char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1 - - memcpy(&travel_window, pPrimaryWindow, sizeof(travel_window)); - pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); - pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent(468, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); - pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); - pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); - if ( pMapStats->GetMapInfo(pDestinationMapName) ) - { - travel_window.uFrameX = 493; - travel_window.uFrameWidth = 126; - travel_window.uFrameZ = 366; - travel_window.DrawTitleText(pFontCreate, 0, 4, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName, 3); - travel_window.uFrameX = 483; - travel_window.uFrameWidth = 148; - travel_window.uFrameZ = 334; - if ( GetTravelTime() == 1 ) - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[663], 1, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d day to cross to %s." - else - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[128], GetTravelTime(), pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d days to travel to %s." - - strcat(pTmpBuf.data(), "\n \n"); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); - strcat(pTmpBuf.data(), pTmpBuf2.data()); - travel_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); - _unused_5B5924_is_travel_ui_drawn = 1; - } -} - -//----- (00444A51) -------------------------------------------------------- -void TransitionUI_Draw() -{ - unsigned int v4; // [sp-10h] [bp-7Ch]@12 - GUIWindow transition_window; // [sp+Ch] [bp-60h]@1 - unsigned int v9; // [sp+60h] [bp-Ch]@1 - unsigned int map_id; // [sp+64h] [bp-8h]@1 - - memcpy(&transition_window, pPrimaryWindow, sizeof(transition_window)); - v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); - pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C)); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); - uTextureID_right_panel_loop = uTextureID_right_panel; - pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); - pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); - pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); - map_id = pMapStats->GetMapInfo(pCurrentMapName); - if ( (pMovie_Track || v9) && *dword_591164_teleport_map_name != ' ' ) - map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name); - transition_window.uFrameX = 493; - transition_window.uFrameWidth = 126; - transition_window.uFrameZ = 366; - transition_window.DrawTitleText(pFontCreate, 0, 5, 0, pMapStats->pInfos[map_id].pName, 3); - transition_window.uFrameX = 483; - transition_window.uFrameWidth = 148; - transition_window.uFrameZ = 334; - - if ( uCurrentHouse_Animation ) - { - v4 = (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uCurrentHouse_Animation], &transition_window, 0, 0)) / 2 + 101; - transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTransitionStrings[uCurrentHouse_Animation], 3); - } - else if ( map_id ) - { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapStats->pInfos[map_id].pName);// "Do you wish to leave %s?" - v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &transition_window, 0, 0)) / 2 + 101; - transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3); - } - else Error("Troubles in da house"); - - _unused_5B5924_is_travel_ui_drawn = true; -}
--- a/UI/UITransition.h Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#pragma once \ No newline at end of file
--- a/UI/UiGame.cpp Fri Sep 19 03:00:21 2014 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2260 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include "..\Engine/Events.h" -#include "..\Engine/Graphics/Texture.h" -#include "..\Engine/MM7.h" -#include "..\Engine/ErrorHandling.h" - -#include "..\Mouse.h" -#include "..\Keyboard.h" -#include "..\Engine/mm7_data.h" - -#include "..\Engine/Graphics/Vis.h" -#include "..\Engine/MapInfo.h" -#include "..\Engine/Game.h" -#include "..\GUIWindow.h" -#include "..\GUIFont.h" -#include "..\Engine/Party.h" -#include "..\AudioPlayer.h" -#include "..\Engine/Graphics/Outdoor.h" -#include "..\Engine/LOD.h" -#include "..\Engine/Objects/Actor.h" -#include "..\Engine/Graphics/Viewport.h" -#include "..\Engine/Objects/SpriteObject.h" -#include "..\Engine/Objects/ObjectList.h" -#include "..\Engine/Graphics/DecorationList.h" -#include "..\Engine/Tables/PlayerFrameTable.h" -#include "..\Engine/stru123.h" -#include "..\Engine/Timer.h" -#include "..\Engine/Tables/IconFrameTable.h" -#include "..\Engine/TurnEngine/TurnEngine.h" -#include "..\Engine/texts.h" -#include "UIHouses.h" -#include "..\Engine/Graphics/BSPModel.h" -#include "..\Engine/OurMath.h" -#include "..\Engine/Graphics/Level/Decoration.h" -#include "..\Engine/Objects/Chest.h" -#include "UIGame.h" - -#include "..\Engine/Graphics/Overlays.h" - -#include "..\Engine/Graphics/Sprites.h" -#include "..\Engine/Graphics/PaletteManager.h" - -int uTextureID_GameUI_CharSelectionFrame; // 50C98C - -//----- (00421D00) -------------------------------------------------------- -void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) -{ - Player* player = &pParty->pPlayers[uPlayerID - 1]; - if (pParty->pPickedItem.uItemID) - { - if (int slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) - { - memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u); - viewparams->bRedrawGameUI = true; - pMouse->RemoveHoldingItem(); - return; - } - - if (!player->CanAct()) - { - player = pPlayers[uActiveCharacter]; - } - if( player->CanAct() || !pPlayers[uActiveCharacter]->CanAct() ) - player->PlaySound(SPEECH_NoRoom, 0); - } - - if (pCurrentScreen == SCREEN_GAME) - { - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter != uPlayerID ) - { - if ( pPlayers[uPlayerID]->uTimeToRecovery ) - return; - - uActiveCharacter = uPlayerID; - return; - } - pGUIWindow_CurrentMenu = CharacterUI_Initialize(7); - return; - } - if ( pCurrentScreen == SCREEN_SPELL_BOOK ) - return; - if ( pCurrentScreen == SCREEN_CHEST ) - { - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter == uPlayerID ) - { - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = SCREEN_CHEST_INVENTORY; - uActiveCharacter = uPlayerID; - return; - } - if ( pPlayers[uPlayerID]->uTimeToRecovery ) - return; - uActiveCharacter = uPlayerID; - return; - } - if ( pCurrentScreen != SCREEN_HOUSE ) - { - if ( pCurrentScreen == SCREEN_E ) - { - uActiveCharacter = uPlayerID; - return; - } - if ( pCurrentScreen != SCREEN_CHEST_INVENTORY ) - { - viewparams->bRedrawGameUI = true; - uActiveCharacter = uPlayerID; - if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) - FillAwardsData(); - return; - } - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter == uPlayerID ) - { - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = SCREEN_CHEST_INVENTORY; - uActiveCharacter = uPlayerID; - return; - } - if ( pPlayers[uPlayerID]->uTimeToRecovery ) - return; - uActiveCharacter = uPlayerID; - return; - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) - return; - viewparams->bRedrawGameUI = true; - if ( uActiveCharacter != uPlayerID ) - { - uActiveCharacter = uPlayerID; - return; - } - if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) - { - __debugbreak(); // fix indexing - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pGUIWindow_CurrentMenu = CharacterUI_Initialize(14); - return; - } -} -// 4E28F8: using guessed type int pCurrentScreen; -// F8B19C: using guessed type int dword_F8B19C; - -//----- (00416B01) -------------------------------------------------------- -void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText -{ - int v1; // edi@2 - NPCData *pNPC; // eax@16 - const CHAR *pText; // eax@18 - char *v11; // esi@26 - GUIWindow popup_window; // [sp+Ch] [bp-60h]@23 - int a2; // [sp+60h] [bp-Ch]@16 - LPCSTR lpsz; // [sp+68h] [bp-4h]@6 - - if ( bNoNPCHiring != 1 ) - { - v1 = 0; - /*do - { - if ( v3->pName ) - pTmpBuf[v1++] = v2; - ++v3; - ++v2; - } - while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/ - for (int i = 0; i < 2; ++i) - { - if (pParty->pHirelings[i].pName) - pTmpBuf[v1++] = i; - } - lpsz = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) - { - /*v4 = pNPCStats->pNewNPCData; - do - { - if ( v4->uFlags & 0x80 - && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName)) - && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) ) - pTmpBuf[v1++] = (char)lpsz + 2; - ++lpsz; - ++v4; - } - while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ - for ( uint i = 0; i < pNPCStats->uNumNewNPCs; ++i ) - { - if (pNPCStats->pNewNPCData[i].Hired()) - { - if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) - { - if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) - pTmpBuf[v1++] = i + 2; - } - } - } - } - if ( (signed int)((char *)_this + pParty->hirelingScrollPosition) < v1 ) - { - sDialogue_SpeakingActorNPC_ID = -1 - pParty->hirelingScrollPosition - (int)_this; - pNPC = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &a2); - if ( pNPC ) - { - if ( a2 == 57 ) - pText = pNPCTopics[512].pText; // Baby dragon - else - pText = (const CHAR *)pNPCStats->pProfessions[pNPC->uProfession].pBenefits; - lpsz = pText; - if ( !pText ) - { - lpsz = (LPCSTR)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; - if ( !lpsz ) - lpsz = ""; - } - popup_window.Hint = nullptr; - popup_window.uFrameX = 38; - popup_window.uFrameY = 60; - popup_window.uFrameWidth = 276; - popup_window.uFrameZ = 313; - popup_window.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &popup_window, 0, 0) + 2 * LOBYTE(pFontArrus->uFontHeight) + 24; - if ( (signed int)popup_window.uFrameHeight < 130 ) - popup_window.uFrameHeight = 130; - popup_window.uFrameWidth = 400; - popup_window.uFrameZ = popup_window.uFrameX + 399; - popup_window.DrawMessageBox(0); - sprintfex(pTmpBuf2.data(), "NPC%03d", pNPC->uPortraitID); - pRenderer->DrawTextureIndexed(popup_window.uFrameX + 22, popup_window.uFrameY + 36, - (Texture *)(pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE) != -1 - ? &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE)] : 0)); - if ( pNPC->uProfession ) - { - v11 = pTmpBuf.data(); - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]); - } - else - { - v11 = pTmpBuf.data(); - strcpy(pTmpBuf.data(), pNPC->pName); - } - popup_window.DrawTitleText(pFontArrus, 0, 12, Color16(0xFFu, 0xFFu, 0x9Bu), v11, 3); - popup_window.uFrameWidth -= 24; - popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; - popup_window.DrawText(pFontArrus, 100, 36, 0, BuildDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0), 0, 0, 0); - } - } - } -} - -//----- (00445D4A) -------------------------------------------------------- -void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello) -{ - NPCData *pNPCInfo; // ebp@1 - int v9; // esi@8 - int pNumberContacts; // eax@11 - char pContainer[32]; // [sp+14h] [bp-28h]@3 - - dword_A74CDC = -1; - pNPCStats->dword_AE336C_LastMispronouncedNameFirstLetter = -1; - pEventTimer->Pause(); - pMiscTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - uDialogueType = 0; - sDialogue_SpeakingActorNPC_ID = actor->sNPC_ID; - pDialogue_SpeakingActor = actor; - pNPCInfo = GetNPCData(actor->sNPC_ID); - if ( (pNPCInfo->uFlags & 3) != 2 ) - pNPCInfo->uFlags = pNPCInfo->uFlags + 1; - - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; - } - - pDialogueNPCCount = 0; - uNumDialogueNPCPortraits = 1; - pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - sprintfex(pContainer, "npc%03u", pNPCInfo->uPortraitID); - v9 = 0; - pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); - dword_591084 = areWeLoadingTexture; - uTextureID_right_panel_loop = uTextureID_right_panel; - if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 ) - { - if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame - || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) ) - { - v9 = 1; - } - else - { - if ( pNumberContacts > 1 ) - { - if ( pNumberContacts == 2 ) - { - v9 = 3; - } - else - { - if ( pNumberContacts != 3 ) - { - if ( pNumberContacts != 4 ) - v9 = 1; - } - else - { - v9 = 2; - } - } - } - else if ( pNPCInfo->rep ) - { - v9 = 2; - } - } - } - if (sDialogue_SpeakingActorNPC_ID < 0) - v9 = 4; - pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3; - if (pNPCInfo->Hired() && !pNPCInfo->bHasUsedTheAbility) - { - if (pNPCInfo->uProfession == 10 || //Healer - pNPCInfo->uProfession == 11 || //Expert Healer - pNPCInfo->uProfession == 12 || //Master Healer - pNPCInfo->uProfession == 33 || //Cook - pNPCInfo->uProfession == 34 || //Chef - pNPCInfo->uProfession == 39 || //Wind Master - pNPCInfo->uProfession == 40 || //Water Master - pNPCInfo->uProfession == 41 || //Gate Master - pNPCInfo->uProfession == 42 || //Chaplain - pNPCInfo->uProfession == 43 || //Piper - pNPCInfo->uProfession == 52 //Fallen Wizard - ) - { - pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); - } - } - - pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - - if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired()) - { - if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); - else - pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); - } -} - -//----- (00445350) -------------------------------------------------------- -void GameUI_DrawDialogue() -{ - NPCData *pNPC; // ebx@2 - int pGreetType; // eax@2 - int pTextHeight; // esi@39 - GUIButton *pButton; // eax@43 - int all_text_height; // ebx@93 - signed int index; // esi@99 - int v42; // edi@102 - int v45; - unsigned __int16 pTextColor; // ax@104 - GUIWindow window; // [sp+ACh] [bp-68h]@42 -// GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 - const char *pInString=nullptr; // [sp+110h] [bp-4h]@32 - - if ( !pDialogueWindow ) - return; - - // Window title(Заголовок окна)---- - memcpy(&window, pDialogueWindow, sizeof(window)); - pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); - pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID); - window.uFrameWidth -= 10; - window.uFrameZ -= 10; - pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0)); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[0]); - - if (pNPC->uProfession) - { - assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames.data())); // sometimes buffer overflows; errors emerge both here and in dialogue text - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s - } - else if (pNPC->pName) - strcpy(pTmpBuf.data(), pNPC->pName); - - window.DrawTitleText(pFontArrus, 483, 112, ui_game_dialogue_npc_name_color, pTmpBuf.data(), 3); - pParty->GetPartyFame(); - - pInString = nullptr; - switch (uDialogueType) - { - case DIALOGUE_13: - pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); - break; - - case DIALOGUE_PROFESSION_DETAILS: - { - //auto prof = pNPCStats->pProfessions[pNPC->uProfession]; - - if (dialogue_show_profession_details) - pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pBenefits, uActiveCharacter - 1, 0, 0, 0, 0); - else if (pNPC->Hired()) - pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); - else - pInString = BuildDialogueString(pNPCStats->pProfessions[pNPC->uProfession].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); - } - break; - - - case DIALOGUE_ARENA_WELCOME: - pInString = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" - break; - - case DIALOGUE_ARENA_FIGHT_NOT_OVER_YET: - pInString = pGlobalTXT_LocalizationStrings[577]; //"Get back in there you wimps:" - break; - - case DIALOGUE_ARENA_REWARD: - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold." - pInString = pTmpBuf.data(); - break; - - case DIALOGUE_ARENA_ALREADY_WON: - pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" - break; - - default: - if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_EVT_E && !byte_5B0938[0]) - { - pInString = (char *)current_npc_text; - } - else if (pGreetType == 1)//QuestNPC_greet - { - if (pNPC->greet) - { - if ((pNPC->uFlags & 3) == 2) - pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting2; - else - pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreeting1; - } - } - else if (pGreetType == 2)//HiredNPC_greet - { - NPCProfession* prof = &pNPCStats->pProfessions[pNPC->uProfession]; - - if (pNPC->Hired()) - pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); - else - pInString = BuildDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0); - } - break; - } - - // Message window(Окно сообщения)---- - if (pInString) - { - window.uFrameWidth = game_viewport_width; - window.uFrameZ = 452; - GUIFont* font = pFontArrus; - pTextHeight = pFontArrus->CalcTextHeight(pInString, &window, 13, 0) + 7; - if ( 352 - pTextHeight < 8 ) - { - font = pFontCreate; - pTextHeight = pFontCreate->CalcTextHeight(pInString, &window, 13, 0) + 7; - } - if (uTextureID_Leather != -1) - pRenderer->GetLeather(8, 352 - pTextHeight, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - pTextHeight); - pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - pDialogueWindow->DrawText(font, 13, 354 - pTextHeight, 0, FitTextInAWindow(pInString, font, &window, 13, 0), 0, 0, 0); - } - // Right panel(Правая панель)------- - memcpy(&window, pDialogueWindow, sizeof(window)); - window.uFrameX = 483; - window.uFrameWidth = 148; - window.uFrameZ = 334; - for (int i = window.pStartingPosActiveItem; i < window.pStartingPosActiveItem + window.pNumPresenceButton; ++i) - { - pButton = window.GetControl(i); - if ( !pButton ) - break; - - if ( pButton->msg_param > 88 ) - pButton->pButtonName[0] = 0; - else if (pButton->msg_param == 88) - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord - else if (pButton->msg_param == 87) - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight - else if (pButton->msg_param == 86) - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire - else if (pButton->msg_param == 85) - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page - else if (pButton->msg_param == 77) - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details - else if (pButton->msg_param == 76) - { - if (pNPC->Hired()) - sprintf(pButton->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s - else - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire - } - else if (pButton->msg_param == 24) - { - __debugbreak(); // learn conditions of this event - if (!pNPC->evt_F) - { - pButton->pButtonName[0] = 0; - pButton->msg_param = 0; - } - else - strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_F].pTopic); - } - else if (pButton->msg_param == 9) - strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession)); - else if (pButton->msg_param == 19) // Scavenger Hunt - { - if (!pNPC->evt_A) - { - pButton->pButtonName[0] = 0; - pButton->msg_param = 0; - } - else - strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_A].pTopic); - } - else if (pButton->msg_param == 20) // Scavenger Hunt - { - if (!pNPC->evt_B) - { - pButton->pButtonName[0] = 0; - pButton->msg_param = 0; - } - else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_B].pTopic); - } - else if (pButton->msg_param == 21) - { - //__debugbreak(); // learn conditions of this event - if (!pNPC->evt_C) - { - pButton->pButtonName[0] = 0; - pButton->msg_param = 0; - } - else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_C].pTopic); - } - else if (pButton->msg_param == 22) - { - //__debugbreak(); // learn conditions of this event - if (!pNPC->evt_D) - { - pButton->pButtonName[0] = 0; - pButton->msg_param = 0; - } - else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_D].pTopic); - } - else if (pButton->msg_param == 23) - { - //__debugbreak(); // learn conditions of this event - if (!pNPC->evt_E) - { - pButton->pButtonName[0] = 0; - pButton->msg_param = 0; - } - else strcpy(pButton->pButtonName, pNPCTopics[pNPC->evt_E].pTopic); - } - else if (pButton->msg_param == 13) - { - if (pNPC->Hired()) - sprintf(pButton->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s - else - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join - } - else - pButton->pButtonName[0] = 0; - - if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1) - { - int num_dead_actors = 0; - pInString = nullptr; - for ( uint i = 0; i < uNumActors; ++i ) - { - if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) - ++num_dead_actors; - else - { - int sumonner_type = PID_TYPE(pActors[i].uSummonerID); - if (sumonner_type == OBJECT_Player) - ++num_dead_actors; - } - } - if (num_dead_actors == uNumActors) - strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize - } - } - - // Install Buttons(Установка кнопок)-------- - index = 0; - all_text_height = 0; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !pButton ) - break; - all_text_height += pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); - index++; - } - if ( index ) - { - v45 = (174 - all_text_height) / index; - if ( v45 > 32 ) - v45 = 32; - v42 = (174 - v45 * index - all_text_height)/ 2 - v45 / 2 + 138; - for ( int i = pDialogueWindow->pStartingPosActiveItem; - i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) - { - pButton = pDialogueWindow->GetControl(i); - if ( !pButton ) - break; - pButton->uY = (unsigned int)(v45 + v42); - pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); - pButton->uHeight = pTextHeight; - v42 = pButton->uY + pTextHeight - 1; - pButton->uW = v42; - pTextColor = ui_game_dialogue_option_normal_color; - if ( pDialogueWindow->pCurrentPosActiveItem == i ) - pTextColor = ui_game_dialogue_option_highlight_color; - window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pButton->pButtonName, 3); - } - } - pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); -} - -//----- (00444FBE) -------------------------------------------------------- -void GameUI_DrawBranchlessDialogue() -{ - int pTextHeight; // esi@4 - char Str[200]; // [sp+Ch] [bp-120h]@12 - GUIWindow BranchlessDlg_window; // [sp+D4h] [bp-58h]@4 - GUIFont *pFont; // [sp+128h] [bp-4h]@1 - - pFont = pFontArrus; - if ( current_npc_text && !byte_5B0938[0] ) - strcpy(byte_5B0938.data(), current_npc_text); - BranchlessDlg_window.uFrameWidth = game_viewport_width; - BranchlessDlg_window.uFrameZ = 452; - pTextHeight = pFontArrus->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; - if ( 352 - pTextHeight < 8 ) - { - pFont = pFontCreate; - pTextHeight = pFontCreate->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; - } - pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); - pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); - pGUIWindow2->DrawText(pFont, 12, 354 - pTextHeight, 0, FitTextInAWindow(byte_5B0938.data(), pFont, &BranchlessDlg_window, 12, 0), 0, 0, 0); - pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); - if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) - { - if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) - { - pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - strcpy(GameUI_Footer_TimedString.data(), pKeyActionMap->pPressedKeysBuffer); - sub_4452BB(); - return; - } - if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) - return; - pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); - sub_4452BB(); - return; - } - if ( pGUIWindow2->ptr_1C == (void *)26 ) - { - sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer); - pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0); - pGUIWindow2->DrawFlashingInputCursor(pFontLucida->GetLineWidth(Str) + 13, 357, pFontLucida); - return; - } - if ( pKeyActionMap->pPressedKeysBuffer[0] ) - { - pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); - memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); - sub_4452BB(); - return; - } -} - -//----- (004443D5) -------------------------------------------------------- -const char *GameUI_GetMinimapHintText() -{ - double v3; // st7@1 - int v7; // eax@4 - const char *v14; // eax@8 - char *result; // eax@12 - unsigned int pMapID; // eax@14 - int global_coord_X; // [sp+10h] [bp-1Ch]@1 - int global_coord_Y; // [sp+14h] [bp-18h]@1 - unsigned int pY; // [sp+1Ch] [bp-10h]@1 - unsigned int pX; // [sp+28h] [bp-4h]@1 - - result = 0; - pMouse->GetClickPos(&pX, &pY); - v3 = 1.0 / (float)((signed int)viewparams->uMinimapZoom * 0.000015258789); - global_coord_X = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); - global_coord_Y = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || pOutdoor->uNumBModels <= 0 ) - { - pMapID = pMapStats->GetMapInfo(pCurrentMapName); - if ( pMapID == 0 ) - result = "No Maze Info for this maze on file!"; - else - result = pMapStats->pInfos[pMapID].pName; - } - else - { - for ( uint j = 0; j < (uint)pOutdoor->uNumBModels; ++j ) - { - v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - global_coord_X), - abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - global_coord_Y), 0); - if ( v7 < 2 * pOutdoor->pBModels[j].sBoundingRadius ) - { - if ( pOutdoor->pBModels[j].uNumFaces ) - { - for ( uint i = 0; i < (uint)pOutdoor->pBModels[j].uNumFaces; ++i ) - { - if ( pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID ) - { - if ( !(pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_HAS_EVENT) ) - { - v14 = GetEventHintString(pOutdoor->pBModels[j].pFaces[i].sCogTriggeredID); - if ( v14 ) - { - if ( _stricmp(v14, "") ) - result = (char *)v14; - } - } - } - } - } - if ( result ) - return result; - } - } - pMapID = pMapStats->GetMapInfo(pCurrentMapName); - if ( pMapID == 0 ) - result = "No Maze Info for this maze on file!"; - else - result = pMapStats->pInfos[pMapID].pName; - return result; - } - return result; -} - -//----- (0041D3B7) -------------------------------------------------------- -void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player) -{ - Texture *v13; // eax@6 - PlayerFrame *v15; // eax@12 - unsigned int pTextColor; // eax@15 - const char *v29; // eax@16 - int v36; // esi@22 - const char *v39; // eax@24 - signed int uFramesetID; // [sp+20h] [bp-8h]@9 - int uFramesetIDa; // [sp+20h] [bp-8h]@18 - - uint numActivePlayerBuffs = 0; - for (uint i = 0; i < 24; ++i) - if (player->pPlayerBuffs[i].uExpireTime > 0) - ++numActivePlayerBuffs; - - window->uFrameHeight = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)); - window->uFrameZ = window->uFrameWidth + window->uFrameX - 1; - window->uFrameW = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)) + window->uFrameY - 1; - window->DrawMessageBox(0); - - if (player->IsEradicated()) - v13 = pTexture_PlayerFaceEradicated; - else if (player->IsDead()) - v13 = pTexture_PlayerFaceDead; - else - { - uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(player->expression); - if ( !uFramesetID ) - uFramesetID = 1; - if ( player->expression == CHARACTER_EXPRESSION_21) - v15 = pPlayerFrameTable->GetFrameBy_y(&player->_expression21_frameset, &player->_expression21_animtime, pMiscTimer->uTimeElapsed); - else - v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, pMiscTimer->Time()); - player->field_1AA2 = v15->uTextureID - 1; - v13 = pTextures_PlayerFaces[(unsigned int)window->ptr_1C][v15->uTextureID - 1]; - } - - pRenderer->DrawTextureTransparent(window->uFrameX + 24, window->uFrameY + 24, v13); - - sprintfex(pTmpBuf.data(), "\f%05d", ui_character_header_text_color); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); // "%s the %s" - strcat(pTmpBuf.data(), pTmpBuf2.data()); - strcat(pTmpBuf.data(), "\f00000\n"); - - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()); - sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[108], // "Hit Points" - pTextColor, player->sHealth, player->GetMaxHealth()); - strcat(pTmpBuf.data(), pTmpBuf2.data()); - - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()); - sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[212], // "Spell Points" - pTextColor, player->sMana, player->GetMaxMana()); - strcat(pTmpBuf.data(), pTmpBuf2.data()); - - pTextColor = player->GetMajorConditionIdx(); - sprintfex(pTmpBuf2.data(), "%s: \f%05d%s\f00000\n", pGlobalTXT_LocalizationStrings[47], // "Condition - GetConditionDrawColor(pTextColor), aCharacterConditionNames[pTextColor]); - strcat(pTmpBuf.data(), pTmpBuf2.data()); - - if ( player->uQuickSpell ) - v29 = pSpellStats->pInfos[player->uQuickSpell].pShortName; - else - v29 = pGlobalTXT_LocalizationStrings[153]; - sprintfex(pTmpBuf2.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v29); // "Quick Spell" - strcat(pTmpBuf.data(), pTmpBuf2.data()); - - window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf.data(), 0, 0, 0); - - uFramesetIDa = 0; - for (uint i = 0; i < 24; ++i) - { - SpellBuff* buff = &player->pPlayerBuffs[i]; - if (buff->uExpireTime > 0) - { - v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134; - window->DrawText(pFontComic, 52, v36, ui_game_character_record_playerbuff_colors[i], aSpellNames[20 + i], 0, 0, 0); - DrawBuff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic); - } - } - - v39 = ""; - if ( uFramesetIDa == 0 ) - v39 = pGlobalTXT_LocalizationStrings[153]; // "None" - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[450], v39); // "Active Spells: %s" - window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf.data(), 0, 0, 0); -} - -//----- (0041A57E) -------------------------------------------------------- -void GameUI_QuickRef_Draw() -{ - unsigned int pTextColor; // eax@7 - unsigned int pX; // [sp+14h] [bp-18h]@2 - unsigned int pY; // edi@9 - int pSkillsCount; // ecx@27 - const char *pText; // eax@38 - int pFontHeight; // [sp+18h] [bp-14h]@1 - - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); - pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1; - for ( uint i = 0; i < 4; ++i ) - { - Player* player = &pParty->pPlayers[i]; - pX = 94 * i + 89; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0); - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 47, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Уров. - sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel()); - if ( player->GetActualLevel() <= player->GetBaseLevel()) - pTextColor = player->GetExperienceDisplayColor(); - else - pTextColor = ui_character_bonus_text_color; - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, 47, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + 47; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pFontHeight + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//Класс - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pClassNames[player->classType], 84, 0); - pY = pFontHeight + pY; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//Здор. - sprintf(pTmpBuf.data(), "%d", player->sHealth); - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sHealth, player->GetMaxHealth()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//Мана - sprintf(pTmpBuf.data(), "%d", player->sMana); - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->sMana, player->GetMaxMana()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( i == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);//Класс брони - sprintf(pTmpBuf.data(), "%d", player->GetActualAC()); - pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Атака - sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(false)); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetMeleeDamageString(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Стрелять - sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Повр. - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetRangedDamageString(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Навыки - pSkillsCount = 0; - for ( uint j = 0; j <= 36; ++j ) - { - if ( player->pActiveSkills[j] ) - ++pSkillsCount; - } - sprintf(pTmpBuf.data(), "%lu", pSkillsCount); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Очки - sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Сост. - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, aCharacterConditionNames[player->GetMajorConditionIdx()], 84, 0); - pY = pFontHeight + pY; - if ( !i ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Б.Прим. - if (player->uQuickSpell) - pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; - else - pText = pGlobalTXT_LocalizationStrings[153];//Нет - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pText, 84, 0); - } - - if ( pParty->GetPartyReputation() >= 0 ) - { - if ( pParty->GetPartyReputation() <= 5 ) - pTextColor = ui_character_default_text_color; - else - pTextColor = ui_character_bonus_text_color_neg; - } - else - pTextColor = ui_character_bonus_text_color; - - sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], pTextColor, GetReputationString(pParty->GetPartyReputation()));//Reputation - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0); - sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame Слава - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0); -} - -//----- (0041AD6E) -------------------------------------------------------- -void GameUI_DrawRightPanelItems() -{ - if ( (unsigned long long)GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed ) - GameUI_RightPanel_BookFlashTimer = 0; - - if ( pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128 ) - { - GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; - - static bool byte_50697C = false; // 50697C - byte_50697C = !byte_50697C; - if ( byte_50697C && pCurrentScreen != SCREEN_REST ) - { - if (bFlashQuestBook) pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); - if (bFlashAutonotesBook) pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); - if (bFlashHistoryBook) pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); - } - else - { - pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); - GameUI_DrawHiredNPCs(); - } - } -} - -//----- (0041AEBB) -------------------------------------------------------- -void GameUI_DrawFoodAndGold() -{ - int text_y; // esi@2 - - if ( uGameState != GAME_STATE_FINAL_WINDOW ) - { - text_y = _44100D_should_alter_right_panel() != 0 ? 381 : 322; - sprintf(pTmpBuf.data(), "\r087%lu", pParty->uNumFoodRations); - pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow); - sprintf(pTmpBuf.data(), "\r028%lu", pParty->uNumGold); - pPrimaryWindow->DrawText(pFontSmallnum, 0, text_y, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow); - } -} - -//----- (0041B0C9) -------------------------------------------------------- -void GameUI_DrawLifeManaBars() -{ - double v3; // st7@3 - double v7; // st7@25 - Texture *pTextureHealth; // [sp-4h] [bp-30h]@10 - Texture *pTextureMana; // [sp+Ch] [bp-20h]@1 - - pTextureMana = pIcons_LOD->GetTexture(uTextureID_BarBlue); - for (uint i = 0; i < 4; ++i) - { - if (pParty->pPlayers[i].sHealth > 0) - { - int v17 = 0; - if (i == 2 || i == 3) - v17 = 2; - v3 = (double)pParty->pPlayers[i].sHealth / (double)pParty->pPlayers[i].GetMaxHealth(); - if( v3 > 0.5 ) - { - if ( v3 > 1.0 ) - v3 = 1.0; - pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarGreen); - } - else if ( v3 > 0.25 ) - pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarYellow); - else if ( v3 > 0.0 ) - pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarRed); - if( v3 > 0.0 ) - { - pRenderer->SetTextureClipRect(v17 + pHealthBarPos[i], (signed __int64)((1.0 - v3) * pTextureHealth->uTextureHeight) + 402, - v17 + pHealthBarPos[i] + pTextureHealth->uTextureWidth, pTextureHealth->uTextureHeight + 402); - pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[i], 402, pTextureHealth); - pRenderer->ResetTextureClipRect(); - } - } - if (pParty->pPlayers[i].sMana > 0) - { - v7 = pParty->pPlayers[i].sMana / (double)pParty->pPlayers[i].GetMaxMana(); - if ( v7 > 1.0 ) - v7 = 1.0; - int v17 = 0; - if (i == 2) - v17 = 1; - pRenderer->SetTextureClipRect(v17 + pManaBarPos[i], (signed __int64)((1.0 - v7) * pTextureMana->uTextureHeight) + 402, - v17 + pManaBarPos[i] + pTextureMana->uTextureWidth, pTextureMana->uTextureHeight + 402); - pRenderer->DrawTextureIndexed(v17 + pManaBarPos[i], 402, pTextureMana); - pRenderer->ResetTextureClipRect(); - } - } -} - -//----- (0041B3B6) -------------------------------------------------------- -void GameUI_DrawRightPanel() -{ - pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); -} - -//----- (0041B3E2) -------------------------------------------------------- -void GameUI_DrawRightPanelFrames() -{ - pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); - pRenderer->DrawTextureRGB(0, 8, pTexture_LeftFrame); - pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); - pRenderer->DrawTextureRGB(0, 352, pTexture_BottomFrame); - GameUI_DrawFoodAndGold(); - GameUI_DrawRightPanelItems(); -} - -//----- (0041C047) -------------------------------------------------------- -void GameUI_Footer_2() -{ - char *v1; // edx@2 - int v5; // eax@5 - - pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); - if (GameUI_Footer_TimeLeft) - v1 = GameUI_Footer_TimedString.data(); - else - { - if (!pFooterString[0]) - return; - v1 = pFooterString.data(); - } - - v5 = pFontLucida->AlignText_Center(450, v1); - pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); -} - -//----- (0041C0B8) -------------------------------------------------------- -void GameUI_SetFooterString(const char *pStr) -{ - const char *v1; // esi@1 - - v1 = pStr; - if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(pStr, 1) && (*v1 || GameUI_Footer_TimeLeft) ) - { - if ( GameUI_Footer_TimeLeft ) - { - for ( int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) - GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; - } - else - { - strcpy(pFooterString.data(), v1); - for ( int j = pFontLucida->GetLineWidth(pFooterString.data()); j > 450; j = pFontLucida->GetLineWidth(pFooterString.data()) ) - pFooterString[strlen(pFooterString.data()) - 1] = 0; - } - } -} - -//----- (0041C179) -------------------------------------------------------- -void GameUI_Footer() -{ - char *v1; // edi@5 - int v2; // eax@5 - int v6; // eax@9 - char v9; // zf@12 - - if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) - { - pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); - if ( GameUI_Footer_TimeLeft ) - { - v1 = GameUI_Footer_TimedString.data(); - v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); - while ( v2 > 450 ) - { - GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; - v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); - } - } - else - { - v1 = pFooterString.data(); - v6 = pFontLucida->GetLineWidth(pFooterString.data()); - while ( v6 > 450 ) - { - pFooterString[strlen(pFooterString.data()) - 1] = 0; - v6 = pFontLucida->GetLineWidth(pFooterString.data()); - } - } - v9 = *v1 == 0; - bForceDrawFooter = 0; - if ( !v9 ) - pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, v1) + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); - } -} -// 5C35BC: using guessed type int bForceDrawFooter; -//----- (00420EFF) -------------------------------------------------------- -void GameUI_WritePointedObjectStatusString() -{ - GUIWindow *pWindow; // edi@7 - GUIButton *pButton; // ecx@11 - int requiredSkillpoints; // ecx@19 - enum UIMessageType pMessageType1; // esi@24 - int v14; // eax@41 - ItemGen *pItemGen; // ecx@44 - int v16; // ecx@46 - signed int pickedObjectPID; // eax@55 - signed int v18b; - signed int pickedObjectID; // ecx@63 - BLVFace *pFace; // eax@69 - const char *pText; // ecx@79 - enum UIMessageType pMessageType2; // esi@110 - enum UIMessageType pMessageType3; // edx@117 - char Str1[200]; // [sp+Ch] [bp-D4h]@129 - unsigned int pX; // [sp+D4h] [bp-Ch]@1 - unsigned int pY; // [sp+D8h] [bp-8h]@1 - - pMouse->uPointingObjectID = 0; - pMouse->GetClickPos(&pX, &pY); - if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 ) - return; - if ( pCurrentScreen == SCREEN_GAME ) - { - if ( pX <= (window->GetWidth() - 1) * 0.73125 && pY <= (window->GetHeight() - 1) * 0.73125 ) - { - //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 - { - pickedObjectPID = pGame->pVisInstance->get_picked_object_zbuf_val(); - if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X - || pY < (unsigned int)pViewport->uScreen_TL_Y || pY > (unsigned int)pViewport->uScreen_BR_Y ) - pickedObjectPID = -1; - if ( pickedObjectPID == -1 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - uLastPointedObjectID = 0; - return; - } - } - /*else - { - v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; - }*/ - pMouse->uPointingObjectID = (unsigned __int16)pickedObjectPID; - pickedObjectID = (signed)PID_ID(pickedObjectPID); - if ( PID_TYPE(pickedObjectPID) == OBJECT_Item ) - { - if ( pObjectList->pObjects[pSpriteObjects[pickedObjectID].uObjectDescID].uFlags & 0x10 ) - { - pMouse->uPointingObjectID = 0; - pFooterString[0] = 0; - bForceDrawFooter = 1; - uLastPointedObjectID = 0; - return; - } - if ( pickedObjectPID >= 0x2000000u || pParty->pPickedItem.uItemID ) - { - GameUI_SetFooterString(pSpriteObjects[pickedObjectID].stru_24.GetDisplayName()); - } - else - { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[pickedObjectID].stru_24.GetDisplayName());// "Get %s" - GameUI_SetFooterString(pTmpBuf.data()); - } //intentional fallthrough - } - else if ( PID_TYPE(pickedObjectPID) == OBJECT_Decoration ) - { - if ( !pLevelDecorations[pickedObjectID].uEventID ) - { - if ( pLevelDecorations[pickedObjectID].IsInteractive() ) - pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[pickedObjectID]._idx_in_stru123 - 75] + 380].pTopic;//неверно для костра - else - pText = pDecorationList->pDecorations[pLevelDecorations[pickedObjectID].uDecorationDescID].field_20; - GameUI_SetFooterString(pText); - } - else - { - char* hintString = GetEventHintString(pLevelDecorations[pickedObjectID].uEventID); - if ( hintString != '\0' ) - { - GameUI_SetFooterString(hintString); - } - } //intentional fallthrough - } - else if ( PID_TYPE(pickedObjectPID) == OBJECT_BModel ) - { - if ( pickedObjectPID < 0x2000000u ) - { - char* newString = nullptr; - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) - { - v18b = (signed int)(unsigned __int16)pickedObjectPID >> 9; - short triggeredId = pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID; - if (triggeredId != 0) - { - newString = GetEventHintString(pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID); - } - } - else - { - pFace = &pIndoor->pFaces[pickedObjectID]; - if ( pFace->uAttributes & FACE_INDICATE ) - { - unsigned short eventId = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; - if (eventId != 0) - { - newString = GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID); - } - } - } - if (newString) - { - GameUI_SetFooterString(newString); - if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - } - pMouse->uPointingObjectID = 0; - pFooterString[0] = 0; - bForceDrawFooter = 1; - uLastPointedObjectID = 0; - return; - } - else if ( PID_TYPE(pickedObjectPID) == OBJECT_Actor ) - { - if ( pickedObjectPID >= 0x2000000 ) - { - pMouse->uPointingObjectID = 0; - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - uLastPointedObjectID = 0; - return; - } - if ( pActors[pickedObjectID].dword_000334_unique_name ) - pText = pMonsterStats->pPlaceStrings[pActors[pickedObjectID].dword_000334_unique_name]; - else - pText = pMonsterStats->pInfos[pActors[pickedObjectID].pMonsterInfo.uID].pName; - GameUI_SetFooterString(pText); //intentional fallthrough - } - if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - } - else - { - for (int i = uNumVisibleWindows; i > 0; --i) - { - pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; - if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ - && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) - { - for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) - { - switch ( pButton->uButtonType ) - { - case 1://for dialogue window - if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddGUIMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 2://hovering over portraits - if (pButton->uWidth != 0 && pButton->uHeight != 0) - { - uint distW = pX - pButton->uX; - uint distY = pY - pButton->uY; - - double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); - double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); - - if (ratioX + ratioY < 1.0) - { - pMessageType2 = (UIMessageType)pButton->field_1C; - if ( pMessageType2 != 0 ) - pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); // for character name - uLastPointedObjectID = 1; - return; - } - } - break; - case 3:// click on skill - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; - if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) - sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" - else - sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" - GameUI_SetFooterString(Str1); - uLastPointedObjectID = 1; - return; - } - break; - } - } - } - if ( pWindow->uFrameHeight == 480 ) - { - //DebugBreak(); //Why is this condition here (in the original too)? Might check fullscreen windows. Let Silvo know if you find out - return; - } - } - //The game never gets to this point even in the original. It's also bugged(neither branch displays anything). - //TODO fix these and move them up before the window check loop. - if ( pCurrentScreen == SCREEN_CHEST ) - { - Chest::ChestUI_WritePointedObjectStatusString(); - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - uLastPointedObjectID = 0; - return; - } - else if ( pCurrentScreen == SCREEN_HOUSE ) - { - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD - || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) - || v16 == -65536 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - uLastPointedObjectID = 0; - return; - } - pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); - GameUI_SetFooterString(pItemGen->GetDisplayName()); - pFooterString[0] = 0; - bForceDrawFooter = 1; - uLastPointedObjectID = 0; - return; - } - if ( pY < 350 ) - { - v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; - if ( v14 == 0 || v14 == -65536 || v14 >= 5000 ) - { - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; - GameUI_SetFooterString(pItemGen->GetDisplayName()); - pFooterString[0] = 0; - bForceDrawFooter = 1; - uLastPointedObjectID = 0; - return; - } - } - if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ - && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) - { - for ( pButton = pWindowList[0].pControlsHead; pButton != nullptr; pButton = pButton->pNext ) - { - switch (pButton->uButtonType) - { - case 1: - if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) - { - pMessageType3 = (UIMessageType)pButton->field_1C; - if ( pMessageType3 == 0 ) // For books - { - GameUI_SetFooterString(pButton->pButtonName); - } - else - { - pMessageQueue_50CBD0->AddGUIMessage(pMessageType3, pButton->msg_param, 0); - } - uLastPointedObjectID = 1; - return; - } - break; - case 2://hovering over portraits - if (pButton->uWidth != 0 && pButton->uHeight != 0) - { - uint distW = pX - pButton->uX; - uint distY = pY - pButton->uY; - - double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); - double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); - - if (ratioX + ratioY < 1.0) - { - pMessageType2 = (UIMessageType)pButton->field_1C; - if ( pMessageType2 != 0 ) - pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); // for character name - uLastPointedObjectID = 1; - return; - } - } - break; - case 3: - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; - if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) - sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" - else - sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" - GameUI_SetFooterString(Str1); - uLastPointedObjectID = 1; - return; - } - break; - } - } - } - //pMouse->uPointingObjectID = sub_46A99B(); //for software - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - uLastPointedObjectID = 0; - return; -} - -//----- (0044158F) -------------------------------------------------------- -void GameUI_DrawCharacterSelectionFrame() -{ - if ( uActiveCharacter ) - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380, - pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame)); -} - -//----- (0044162D) -------------------------------------------------------- -void GameUI_DrawPartySpells() -{ - unsigned int v0; // ebp@1 - Texture *spell_texture; // [sp-4h] [bp-1Ch]@12 - //Texture *v9; // [sp-4h] [bp-1Ch]@21 - - v0 = (signed __int64)((double)GetTickCount() * 0.050000001); - //v1 = 0; - for (uint i = 0; i < 14; ++i) - { - //v2 = byte_4E5DD8[v1]; - if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) - { - Texture* tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); - //v3 = pTextureIDs_PartyBuffIcons[i]; - pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], - pPartySpellbuffsUI_XYs[i][1], tex, tex, - v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); - } - //++v1; - } - //while ( v1 < 14 ); - if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE) - { - if (pParty->FlyActive()) - { - if ( pParty->bFlying ) - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); - else - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); - //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(8, 8, spell_texture); - /*else - pRenderer->DrawTextureTransparent(8, 8, v7);*/ - } - if ( pParty->WaterWalkActive() ) - { - if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); - else - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); - //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(396, 8, spell_texture); - /*else - pRenderer->DrawTextureTransparent(396, 8, v9);*/ - } - } - for (uint i = 0; i < 4; ++i) - { - if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime ) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); - if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime ) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); - if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime ) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); - if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime ) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); - } -} - -//----- (004921C1) -------------------------------------------------------- -void GameUI_DrawPortraits(unsigned int _this) -{ - unsigned int face_expression_ID; // eax@17 - PlayerFrame *pFrame; // eax@21 - int pTextureID; // eax@57 - Texture *pPortrait; // [sp-4h] [bp-1Ch]@27 - - if ( _A750D8_player_speech_timer ) - { - _A750D8_player_speech_timer -= (signed int)pMiscTimer->uTimeElapsed; - if ( _A750D8_player_speech_timer <= 0 ) - { - if ( pPlayers[uSpeakingCharacter]->CanAct() ) - pPlayers[uSpeakingCharacter]->PlaySound(PlayerSpeechID, 0); - _A750D8_player_speech_timer = 0i64; - } - } - - for (uint i = 0; i < 4; ++i) - { - Player* pPlayer = &pParty->pPlayers[i]; - if ( pPlayer->IsEradicated() ) - { - pPortrait = pTexture_PlayerFaceEradicated; - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); - else - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); - if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) - sub_441A4E(i); - continue; - } - if (pPlayer->IsDead()) - { - pPortrait = pTexture_PlayerFaceDead; - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); - else - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); - if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) - sub_441A4E(i); - continue; - } - face_expression_ID = 0; - for ( uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j ) - if ( pPlayerFrameTable->pFrames[j].expression == pPlayer->expression ) - { - face_expression_ID = j; - break; - } - if ( face_expression_ID == 0 ) - face_expression_ID = 1; - if (pPlayer->expression == CHARACTER_EXPRESSION_21) - pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); - else - pFrame = pPlayerFrameTable->GetFrameBy_x(face_expression_ID, pPlayer->uExpressionTimePassed); - if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) - { - pPlayer->field_1AA2 = pFrame->uTextureID - 1; - pPortrait = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID]; - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); - else - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); - if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) - sub_441A4E(i); - continue; - } - } - if ( pParty->bTurnBasedModeOn == 1 ) - { - if ( pTurnEngine->turn_stage != TE_WAIT ) - { - if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) - { - if ( pTurnEngine->uActorQueueSize > 0 ) - { - for (uint i = 0; i < (uint)pTurnEngine->uActorQueueSize; ++i) - { - if (PID_TYPE(pTurnEngine->pQueue[i].uPackedID) != OBJECT_Player) - break; - pTextureID = dword_5079D0; - if ( pParty->uFlags & 0x10 ) - pTextureID = dword_5079CC; - else - { - if ( pParty->uFlags & 0x20 ) - pTextureID = dword_5079C8; - } - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pTurnEngine->pQueue[i].uPackedID)] - 4, 385, pIcons_LOD->GetTexture(pTextureID)); - } - } - } - } - } - else - { - for (uint i = 0; i < 4; ++i) - { - if (pParty->pPlayers[i].CanAct() && !pParty->pPlayers[i].uTimeToRecovery) - { - pTextureID = dword_5079D0; - if ( pParty->uFlags & 0x10 ) - pTextureID = dword_5079CC; - else - { - if ( pParty->uFlags & 0x20 ) - pTextureID = dword_5079C8; - } - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, 385, pIcons_LOD->GetTexture(pTextureID)); - } - } - } -} - -//----- (00441D38) -------------------------------------------------------- -void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap) -{ - int uHeight; // ebx@6 - signed int pW; // ebx@23 - int v15; // eax@23 - double v20; // st7@30 - signed int v27; // eax@37 - //unsigned __int16 *v28; // ecx@37 - signed int v29; // edi@40 - int pPoint_X; // edi@72 - int pPoint_Y; // ebx@72 - unsigned int lPitch; // [sp+20h] [bp-34h]@1 - signed int pY; // [sp+20h] [bp-34h]@23 - signed int pX; // [sp+24h] [bp-30h]@23 - signed int v70; // [sp+24h] [bp-30h]@37 - signed int uBluea; // [sp+28h] [bp-2Ch]@37 - int v73; // [sp+2Ch] [bp-28h]@30 - signed int uCenterY; // [sp+48h] [bp-Ch]@1 - signed int uCenterX; // [sp+4Ch] [bp-8h]@1 - signed int uWidth; // [sp+5Ch] [bp+8h]@30 - signed int pZ; // [sp+60h] [bp+Ch]@23 - float uWb; // [sp+60h] [bp+Ch]@30 - unsigned int pColor; - - uCenterX = (uX + uZ) / 2; - uCenterY = (uY + uW) / 2; - lPitch = pRenderer->uTargetSurfacePitch; - bool bWizardEyeActive = pParty->WizardEyeActive(); - int uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); - if ( CheckHiredNPCSpeciality(Cartographer) ) - { - bWizardEyeActive = true; - uWizardEyeSkillLevel = 2; - } - - if ( wizard_eye ) - { - bWizardEyeActive = true; - uWizardEyeSkillLevel = 3; - } - pRenderer->SetRasterClipRect(uX, uY, uZ - 1, uW - 1); - uHeight = uW - uY; - uWidth = uZ - uX; - - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - uchar* pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; - ushort* pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; - v73 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / (signed int)uZoom; - v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - switch (uZoom) - { - case 512: - { - v20 = v20 - (double)(uWidth / 2); - uWb = uWb - (double)(uHeight / 2); - } - break; - case 1024: - { - v20 = v20 - (double)(uWidth / 4); - uWb = uWb - (double)(uHeight / 4); - } - break; - case 2048: - { - v20 = v20 - (double)(uWidth / 8); - uWb = uWb - (double)(uHeight / 8); - } - break; - default: assert(false); - } - - static unsigned __int16 pOdmMinimap[117][137]; - assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short)); - - v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); - uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); - v27 = uBluea >> 16; - //v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; - - if (pMapLod0 && bRedrawOdmMinimap) - { - assert(uWidth == 137 && uHeight == 117); - //auto pMinimap = (unsigned __int16 *)pOdmMinimap; - - ushort mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - - v29 = v70 >> 16; - for (int y = 0; y < uHeight; ++y) - { - uchar* pMapLod0Line = &pMapLod0[v27 * mapWidth]; - for (int x = 0; x < uWidth; ++x) - { - //*pMinimap++ = pPal[pMapLod0Line[v29]]; - pRenderer->WritePixel16(uX + x, uY + y, pPal[pMapLod0Line[v29]]); - v29 = (v70 + x * v73) >> 16; - } - uBluea += v73; - v27 = uBluea >> 16; - } - - /*v29 = v70 >> 16; - for (int y = 0; y < uHeight; ++y) - { - uchar* pMapLod0Line = &pMapLod0[v27 * mapWidth]; - for (int x = 0; x < uWidth; ++x) - { - //*pMinimap++ = pPal[pMapLod0Line[v29]]; - pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; - v29 = (v70 + x * v73) >> 16; - } - v29 = v70 >> 16; - v28 += 137 - uWidth; - uBluea += v73; - v27 = uBluea >> 16; - }*/ - } - - /*for (int y = 0; y < 117; ++y) - { - for (int x = 0; x < 137; ++x) - { - *v28++ = pOdmMinimap[y][x]; - } - v28 += lPitch - 137; - }*/ - uNumBlueFacesInBLVMinimap = 0; - } - else// uCurrentlyLoadedLevelType == LEVEL_Indoor - { - pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); - uNumBlueFacesInBLVMinimap = 0; - - for (uint i = 0; i < (uint)pIndoor->pMapOutlines->uNumOutlines; ++i) - { - BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[i]; - //BLVFace* pFace1 = &pIndoor->pFaces[pOutline->uFace1ID]; - //BLVFace* pFace2 = &pIndoor->pFaces[pOutline->uFace2ID]; - if (pIndoor->pFaces[pOutline->uFace1ID].Visible() && pIndoor->pFaces[pOutline->uFace2ID].Visible()) - { - if ( pOutline->uFlags & 1 ) - { - if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && - (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && - (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) - { - if (uNumBlueFacesInBLVMinimap < 49) - pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; - } - else - { - pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); - pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); - pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); - pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); - v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; - if ( v15 > 100 ) - v15 = 100; - pRenderer->RasterLine2D(pX, pY, pZ, pW, viewparams->pPalette[-v15 + 200]); - } - continue; - } - if (pIndoor->pFaces[pOutline->uFace1ID].uAttributes & FACE_UNKNOW4 || pIndoor->pFaces[pOutline->uFace2ID].uAttributes & FACE_UNKNOW4) - { - pOutline->uFlags = pOutline->uFlags | 1; - pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); - if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && - (pIndoor->pFaces[pOutline->uFace1ID].Clickable() || pIndoor->pFaces[pOutline->uFace2ID].Clickable()) && - (pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace1ID].uFaceExtraID].uEventID || pIndoor->pFaceExtras[pIndoor->pFaces[pOutline->uFace2ID].uFaceExtraID].uEventID)) - { - if (uNumBlueFacesInBLVMinimap < 49) - pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; - } - else - { - pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); - pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); - pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); - pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); - v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; - if ( v15 > 100 ) - v15 = 100; - pRenderer->RasterLine2D(pX, pY, pZ, pW, viewparams->pPalette[-v15 + 200]); - } - continue; - } - } - } - - for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) - { - BLVMapOutline* pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; - pX = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); - pY = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex1ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); - pZ = uCenterX + ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].x)) << 16) - uZoom * pParty->vPosition.x) >> 16); - pW = uCenterY - ((signed int)(((unsigned int)(fixpoint_mul(uZoom, pIndoor->pVertices[pOutline->uVertex2ID].y)) << 16) - uZoom * pParty->vPosition.y) >> 16); - pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color); - } - } - - //draw arrow on the minimap(include. Ritor1) - uint arrow_idx; - unsigned int rotate = pParty->sRotationY & stru_5C6E00->uDoublePiMask; - if ( (signed int)rotate <= 1920 ) - arrow_idx = 6; - if ( (signed int)rotate < 1664 ) - arrow_idx = 5; - if ( (signed int)rotate <= 1408 ) - arrow_idx = 4; - if ( (signed int)rotate < 1152 ) - arrow_idx = 3; - if ( (signed int)rotate <= 896 ) - arrow_idx = 2; - if ( (signed int)rotate < 640 ) - arrow_idx = 1; - if ( (signed int)rotate <= 384 ) - arrow_idx = 0; - if ( (signed int)rotate < 128 || (signed int)rotate > 1920 ) - arrow_idx = 7; - pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx]));//стрелка - - //draw objects on the minimap - if ( bWizardEyeActive ) - { - if ( uWizardEyeSkillLevel >= 2 ) - { - for ( uint i = 0; i < uNumSpriteObjects; ++i ) - { - if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID ) - continue; - //if (uWizardEyeSkillLevel == 1 - pPoint_X = uCenterX + fixpoint_mul((pSpriteObjects[i].vPosition.x - pParty->vPosition.x), uZoom); - pPoint_Y = uCenterY - fixpoint_mul((pSpriteObjects[i].vPosition.y - pParty->vPosition.y), uZoom); - //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z && - // pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w) - { - if (pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) - { - pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_projectile_color); - } - else if ( uZoom > 512 ) - { - pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y, pPoint_X - 2, pPoint_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y, pPoint_X + 2, pPoint_Y + 1, ui_game_minimap_treasure_color); - } - else - { - pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, ui_game_minimap_treasure_color); - } - } - } - } - for ( uint i = 0; i < uNumActors; ++i )//draw actors(отрисовка монстров и нпс) - { - if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled - && (pActors[i].uAIState == Dead || pActors[i].ActorNearby()) ) - { - pPoint_X = uCenterX + (fixpoint_mul((pActors[i].vPosition.x - pParty->vPosition.x), uZoom)); - pPoint_Y = uCenterY - (fixpoint_mul((pActors[i].vPosition.y - pParty->vPosition.y), uZoom)); - //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z - // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) - { - pColor = ui_game_minimap_actor_friendly_color; - if ( pActors[i].uAttributes & ACTOR_HOSTILE ) - pColor = ui_game_minimap_actor_hostile_color; - if ( pActors[i].uAIState == Dead) - pColor = ui_game_minimap_actor_corpse_color; - if ( uZoom > 1024 ) - { - pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y - 1, pPoint_X - 2, pPoint_Y + 1, pColor); - pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 2, pPoint_X - 1, pPoint_Y + 2, pColor); - pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 2, pColor); - pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 2, pPoint_X + 1, pPoint_Y + 2, pColor); - pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y - 1, pPoint_X + 2, pPoint_Y + 1, pColor); - } - else - { - pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, pColor); - pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, pColor); - } - } - } - } - for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )//draw items(отрисовка предметов) - { - if ( pLevelDecorations[i].uFlags & 8 ) - { - pPoint_X = uCenterX + (fixpoint_mul((pLevelDecorations[i].vPosition.x - pParty->vPosition.x), uZoom)); - pPoint_Y = uCenterY - (fixpoint_mul((pLevelDecorations[i].vPosition.y - pParty->vPosition.y), uZoom)); - //if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z - // && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) - { - if ( (signed int)uZoom > 512 ) - { - pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); - pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y + 1, ui_game_minimap_decoration_color_1); - pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); - } - else - pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_decoration_color_1); - } - } - } - } - pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_Minimap_Loop));//draw minimap_loop - pRenderer->SetTextureClipRect(541, 0, 567, 480); - pRenderer->DrawTextureIndexed(floorf(((double)pParty->sRotationY * 0.1171875) + 0.5f) + 285, 136, pIcons_LOD->GetTexture(uTextureID_Compas));//draw compas - pRenderer->ResetTextureClipRect(); -} - -//----- (00441498) -------------------------------------------------------- -void GameUI_DrawTorchlightAndWizardEye() -{ - if (pCurrentScreen == SCREEN_GAME - || pCurrentScreen == SCREEN_MENU - || pCurrentScreen == SCREEN_OPTIONS - || pCurrentScreen == SCREEN_REST - || pCurrentScreen == SCREEN_SPELL_BOOK - || pCurrentScreen == SCREEN_CHEST - || pCurrentScreen == SCREEN_SAVEGAME - || pCurrentScreen == SCREEN_LOADGAME - || pCurrentScreen == SCREEN_CHEST_INVENTORY - || pCurrentScreen == SCREEN_BOOKS - || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) - { - if (pParty->TorchlightActive()) - { - IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); - } - if (pParty->WizardEyeActive()) - { - IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); - } - } -} -// 4E28F8: using guessed type int pCurrentScreen; - - -//----- (00491F87) -------------------------------------------------------- -void GameUI_DrawHiredNPCs() -{ - unsigned int v13; // eax@23 - char pContainer[20]; // [sp+Ch] [bp-30h]@18 - signed int uFrameID; // [sp+24h] [bp-18h]@19 - int v22; // [sp+34h] [bp-8h]@2 - unsigned __int8 pNPC_limit_ID; // [sp+3Bh] [bp-1h]@2 - - if ( bNoNPCHiring != 1 ) - { - pNPC_limit_ID = 0; - v22 = 0; - if (pParty->pHirelings[0].pName) - pTmpBuf[v22++] = 0; - if (pParty->pHirelings[1].pName) - pTmpBuf[v22++] = 1; - - for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) - { - if (pNPCStats->pNewNPCData[i].uFlags & 128) - { - if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName)) - { - if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName)) - pTmpBuf[v22++] = i + 2; - } - } - } - - for ( int i = pParty->hirelingScrollPosition; i < v22 && pNPC_limit_ID < 2; i++ ) - { - if ( (unsigned __int8)pTmpBuf[i] >= 2 ) - { - sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)pTmpBuf[i] + 499].uPortraitID); - pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); - } - else - { - sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].uPortraitID); - pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); - if ( pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_A == 1 ) - { - uFrameID = pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_B; - v13 = 0; - if (pIconsFrameTable->uNumIcons) - { - for ( v13 = 0; v13 < pIconsFrameTable->uNumIcons; ++v13 ) - { - if ( !_stricmp("spell96", pIconsFrameTable->pIcons[v13].pAnimationName) ) - break; - } - } - pRenderer->DrawTextureTransparent(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(v13, uFrameID)->uTextureID]); - } - } - ++pNPC_limit_ID; - } - } -} - -//----- (004178FE) -------------------------------------------------------- -unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos) -{ - unsigned __int16 R, G, B; - - if ( current_pos <= base_pos ) - { - if ( current_pos == base_pos )//White - return 0; - if ( 100 * current_pos / base_pos >= 25 )//Yellow( current_pos > 1/4 ) - R = 255, G = 255, B = 100; - else//Red( current_pos < 1/4 ) - R = 255, G = 0, B = 0; - } - else//Green - R = 0, G = 255, B = 0; - return Color16(R, G, B); -} - -//----- (00417939) -------------------------------------------------------- -int GetConditionDrawColor(unsigned int uConditionIdx) -{ - switch (uConditionIdx) - { - case Condition_Zombie: - case Condition_Good: - return ui_character_condition_normal_color; - - case Condition_Cursed: - case Condition_Weak: - case Condition_Fear: - case Condition_Drunk: - case Condition_Insane: - case Condition_Poison_Weak: - case Condition_Disease_Weak: - return ui_character_condition_light_color; - - case Condition_Sleep: - case Condition_Poison_Medium: - case Condition_Disease_Medium: - case Condition_Paralyzed: - case Condition_Unconcious: - return ui_character_condition_moderate_color; - - case Condition_Poison_Severe: - case Condition_Disease_Severe: - case Condition_Dead: - case Condition_Pertified: - case Condition_Eradicated: - return ui_character_condition_severe_color; - } - Error("Invalid condition (%u)", uConditionIdx); -} - -//----- (00495430) -------------------------------------------------------- -const char * GetReputationString(signed int a1) -{ - if (a1 >= 25) - return pGlobalTXT_LocalizationStrings[379]; // Hated - else if (a1 >= 6) - return pGlobalTXT_LocalizationStrings[392]; // Unfriendly - else if (a1 >= -5) - return pGlobalTXT_LocalizationStrings[399]; // Neutral; - else if (a1 >= -24) - return pGlobalTXT_LocalizationStrings[402]; // Friendly - else - return pGlobalTXT_LocalizationStrings[434]; // Respected; -} - -//----- (00441A4E) -------------------------------------------------------- -__int16 __fastcall sub_441A4E(int a1)//for blessing -{ - __int16 result; // ax@1 - int v2; // ebx@1 - // char *v3; // esi@1 - // int v4; // edi@4 - bool v5; // ecx@4 - SpriteFrame *pFrame; // eax@6 - //SpriteFrame *v7; // edi@6 - int v8; // eax@6 - // unsigned __int16 v9; // ax@6 - RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 - int v11; // [sp+5Ch] [bp-Ch]@6 - int v12; // [sp+60h] [bp-8h]@1 - //int v13; // [sp+64h] [bp-4h]@6 - - v10.sParentBillboardID = -1; - v10.pTarget = pRenderer->pTargetSurface; - v10.pTargetZ = pRenderer->pActiveZBuffer; - v10.uTargetPitch = pRenderer->GetRenderWidth(); - result = 0; - v2 = a1; - v10.uViewportX = 0; - v10.uViewportY = 0; - v10.uViewportZ = window->GetWidth() - 1; - v10.uViewportW = window->GetHeight() - 1; - v12 = 0; - //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; - //do - for (uint i = 0; i < 50; ++i) - { - if (pOtherOverlayList->pOverlays[i].field_6 > 0) - { - result = pOtherOverlayList->pOverlays[i].field_0; - if (pOtherOverlayList->pOverlays[i].field_0 >= 300) - { - //v4 = result; - v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 - || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 - || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 - || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; - pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; - if (pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5) - { - if (!pOtherOverlayList->pOverlays[i].field_0) - { - pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, - pOtherOverlayList->pOverlays[i].field_4); - //v7 = v6; - v11 = pOtherOverlayList->pOverlays[i].field_E; - //v13 = pFrame->scale; - //v13 = fixpoint_mul(v11, pFrame->scale); - v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; - v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; - v10._screenspace_x_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); - v10._screenspace_y_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); - v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); - v8 = pOtherOverlayList->pOverlays[i].field_2; - v10.sZValue = 0; - v10.uFlags = 0; - //v9 = pOverlayList->pOverlays[v8].uOverlayType; - if (!pOverlayList->pOverlays[v8].uOverlayType || pOverlayList->pOverlays[v8].uOverlayType == 2) - v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight / 2; - result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); - ++v12; - if (v12 == 5) - break; - } - } - } - } - //v3 += 20; - } - //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); - return result; -}