Mercurial > mm7
changeset 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
line wrap: on
line diff
--- a/Build/Visual Studio 2015/World of Might and Magic.vcxproj Mon Mar 07 03:48:40 2016 +0200 +++ b/Build/Visual Studio 2015/World of Might and Magic.vcxproj Wed Mar 09 01:39:52 2016 +0200 @@ -135,7 +135,6 @@ <ClCompile Include="..\..\Engine\OurMath.cpp" /> <ClCompile Include="..\..\Engine\Party.cpp" /> <ClCompile Include="..\..\Engine\Random.cpp" /> - <ClCompile Include="..\..\Engine\Registry.cpp" /> <ClCompile Include="..\..\Engine\SaveLoad.cpp" /> <ClCompile Include="..\..\Engine\Serialization\LegacyImages.cpp" /> <ClCompile Include="..\..\Engine\Spells\CastSpellInfo.cpp" /> @@ -313,7 +312,6 @@ <ClInclude Include="..\..\Engine\OurMath.h" /> <ClInclude Include="..\..\Engine\Party.h" /> <ClInclude Include="..\..\Engine\Random.h" /> - <ClInclude Include="..\..\Engine\Registry.h" /> <ClInclude Include="..\..\Engine\resource.h" /> <ClInclude Include="..\..\Engine\SaveLoad.h" /> <ClInclude Include="..\..\Engine\Serialization\LegacyImages.h" />
--- a/Build/Visual Studio 2015/World of Might and Magic.vcxproj.filters Mon Mar 07 03:48:40 2016 +0200 +++ b/Build/Visual Studio 2015/World of Might and Magic.vcxproj.filters Wed Mar 09 01:39:52 2016 +0200 @@ -474,9 +474,6 @@ <ClCompile Include="..\..\Engine\Random.cpp"> <Filter>Engine</Filter> </ClCompile> - <ClCompile Include="..\..\Engine\Registry.cpp"> - <Filter>Engine</Filter> - </ClCompile> <ClCompile Include="..\..\Engine\SaveLoad.cpp"> <Filter>Engine</Filter> </ClCompile> @@ -1247,9 +1244,6 @@ <ClInclude Include="..\..\Engine\Random.h"> <Filter>Engine</Filter> </ClInclude> - <ClInclude Include="..\..\Engine\Registry.h"> - <Filter>Engine</Filter> - </ClInclude> <ClInclude Include="..\..\Engine\resource.h"> <Filter>Engine</Filter> </ClInclude>
--- a/Engine/Engine.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Engine.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -15,7 +15,6 @@ #include "Engine/LuaVM.h" #include "Engine/MMT.h" #include "Engine/SaveLoad.h" -#include "Engine/Registry.h" #include "Engine/Graphics/Vis.h" #include "Engine/Graphics/Weather.h" #include "Engine/Graphics/LightmapBuilder.h" @@ -961,13 +960,11 @@ static_assert(sizeof(ObjectDesc_mm6) == 52, "Wrong type size"); static_assert(sizeof(ObjectDesc) == 56, "Wrong type size"); static_assert(sizeof(DecorationDesc) == 84, "Wrong type size"); - static_assert(sizeof(IconFrame) == 32, "Wrong type size"); static_assert(sizeof(PlayerFrame) == 10, "Wrong type size"); static_assert(sizeof(TextureFrame) == 20, "Wrong type size"); static_assert(sizeof(SpriteFrame) == 60, "Wrong type size"); static_assert(sizeof(RenderVertexSoft) == 0x30, "Wrong type size"); static_assert(sizeof(RenderBillboard) == 0x34, "Wrong type size"); - static_assert(sizeof(Texture_MM7) == 0x48, "Wrong type size"); //static_assert(sizeof(RGBTexture) == 0x28, "Wrong type size"); //static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr static_assert(sizeof(AudioPlayer) == 0xC84, "Wrong type size"); @@ -998,7 +995,7 @@ static_assert(sizeof(Actor) == 0x344, "Wrong type size"); static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size"); static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size"); - static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size"); + //static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size"); //static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size"); static_assert(sizeof(ODMFace) == 0x134, "Wrong type size"); static_assert(sizeof(BSPNode) == 0x8, "Wrong type size"); @@ -1692,8 +1689,9 @@ { 606, 0, 0, 0 } }; - pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]); - pIconsFrameTable->InitializeAnimation(pUIAnims[i]->uIconID); + //pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]); + pUIAnims[i]->icon = pIconsFrameTable->GetIcon(pUIAnimNames[i]); + pIconsFrameTable->InitializeAnimation(pUIAnims[i]->icon->id); pUIAnims[i]->uAnimLength = 0; pUIAnims[i]->uAnimTime = 0;
--- a/Engine/Graphics/IRender.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Graphics/IRender.h Wed Mar 09 01:39:52 2016 +0200 @@ -81,18 +81,17 @@ virtual void BlendTextures(unsigned int a2, unsigned int a3, struct Image *a4, struct Texture_MM7 *a5, int t, int start_opacity, int end_opacity) = 0; virtual void _4A65CC(unsigned int x, unsigned int y, struct Texture_MM7 *a4, struct Texture_MM7 *a5, int a6, int a7, int a8) = 0; + virtual void DrawMasked(float u, float v, struct Image *img, unsigned int color_dimming_level, unsigned __int16 mask) = 0; + virtual void DrawTextureGrayShade(float u, float v, struct Image *a4) = 0; virtual void DrawTransparentRedShade(float u, float v, struct Image *a4) = 0; virtual void DrawTransparentGreenShade(float u, float v, struct Image *pTexture) = 0; virtual void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices) = 0; - virtual void DrawMasked(float u, float v, struct Image *pTexture, unsigned __int16 mask) = 0; - virtual void DrawTextAlpha(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, bool present_time_transparency) = 0; virtual void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor) = 0; virtual void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) = 0; virtual void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) = 0; - virtual void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture_MM7 *a4) = 0; virtual void DrawBuildingsD3D() = 0;
--- a/Engine/Graphics/Indoor.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Graphics/Indoor.h Wed Mar 09 01:39:52 2016 +0200 @@ -480,7 +480,7 @@ #define FACE_FLOW_HORIZONTAL 0x00000800 // Horizontal flow of the lava or water #define FACE_HAS_EVENT_HINT 0x00001000 #define FACE_INVISIBLE 0x00002000 -#define FACE_TEXTURE_FRAME 0x00004000 // Texture_MM7 ID is a frameset from TextureFrameTable, otherwise BitmapID +#define FACE_TEXTURE_FRAME 0x00004000 // Texture ID is a frameset from TextureFrameTable, otherwise BitmapID #define FACE_OUTLINED 0x00010000 // outline face edges #define FACE_INDOOR_DOOR 0x00020000 #define FACE_TEXTURE_FLOW 0x00040000 // The texture moves slowly. For horizontal facets only.
--- a/Engine/Graphics/Overlays.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Graphics/Overlays.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -83,7 +83,7 @@ //----- (00441964) -------------------------------------------------------- void OtherOverlayList::DrawTurnBasedIcon(int a2) { - IconFrame *frame; // eax@12 + Icon *frame; // eax@12 unsigned int v5; // [sp-8h] [bp-Ch]@4 if ( current_screen_type != SCREEN_GAME || !pParty->bTurnBasedModeOn) @@ -102,7 +102,7 @@ else if ( pTurnEngine->turn_stage == TE_ATTACK )//группа атакует(ладонь) frame = pIconsFrameTable->GetFrame(uIconID_TurnStop, pEventTimer->uStartTime); //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureTransparentColorKey(394, 288, &pIcons_LOD->pTextures[frame->uTextureID]); + pRenderer->DrawTextureAlphaNew(394/640.0f, 288/480.0f, frame->texture); /*else pRenderer->DrawTextureIndexedAlpha(0x18Au, 0x120u, v7);*/ if ( dword_50C994 < dword_50C998_turnbased_icon_1A )
--- a/Engine/Graphics/Render.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Graphics/Render.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -31,7 +31,6 @@ #include "Lights.h" #include "Level/Decoration.h" #include "Vis.h" -#include "Engine/Registry.h" #include "Weather.h" #include "Engine/MMT.h" @@ -6370,12 +6369,6 @@ 0xF800 & (r << (6 + 5 + 5 - 8)); } -void Render::DrawTextureNew(float u, float v, Texture_MM7 *a4) -{ - __debugbreak(); -} - - void Render::DrawTextureCustomHeight(float u, float v, class Image *img, int custom_height) @@ -6522,145 +6515,9 @@ } //----- (004A6E7E) -------------------------------------------------------- -void Render::DrawTranslucent(unsigned int a2, unsigned int a3, Texture_MM7 *a4) -{ - int v5; // edx@4 - unsigned int v6; // edi@4 - unsigned int v7; // edx@5 - unsigned int v8; // edx@6 - unsigned int v9; // edx@7 - unsigned int v10; // edx@8 - unsigned int v11; // ebx@9 - unsigned int v12; // esi@11 - unsigned int v13; // edx@12 - unsigned int v14; // ebx@15 - unsigned int v15; // esi@17 - unsigned int v16; // edi@18 - int v18; // [sp+14h] [bp-Ch]@4 - int v19; // [sp+18h] [bp-8h]@4 - unsigned __int8 *v20; // [sp+1Ch] [bp-4h]@4 - - if ( this->uNumSceneBegins && a4 && a4->pPalette16 ) - { - //v4 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; - v20 = a4->paletted_pixels; - v5 = a4->uTextureWidth; - v6 = a4->uTextureHeight; - v19 = a4->uTextureWidth; - v18 = a4->uTextureWidth; - int clipped_out_x = a2; - int clipped_out_y = a3; - if ( this->bClip ) - { - v7 = this->uClipX; - if ( (signed int)a2 < (signed int)v7 ) - { - v8 = v7 - a2; - v20 += v8; - v19 += a2 - this->uClipX; - //v4 += v8; - clipped_out_x = uClipX; - } - v9 = this->uClipY; - if ( (signed int)a3 < (signed int)v9 ) - { - v10 = v9 - a3; - v20 += v18 * v10; - v6 = a3 - this->uClipY + a4->uTextureHeight; - //v4 += this->uTargetSurfacePitch * v10; - clipped_out_y = uClipY; - } - v11 = this->uClipX; - v5 = v19; - if ( (signed int)v11 < (signed int)a2 ) - v11 = a2; - v12 = this->uClipZ; - if ( (signed int)(v19 + v11) > (signed int)v12 ) - { - v13 = this->uClipX; - if ( (signed int)v13 < (signed int)a2 ) - v13 = a2; - v5 = v12 - v13; - } - v14 = this->uClipY; - if ( (signed int)v14 < (signed int)a3 ) - v14 = a3; - v15 = this->uClipW; - if ( (signed int)(v6 + v14) > (signed int)v15 ) - { - v16 = this->uClipY; - if ( (signed int)v16 < (signed int)a3 ) - v16 = a3; - v6 = v15 - v16; - } - } - - for (uint y = 0; y < v6; ++y) - { - for (int x = 0; x < v5; ++x) - { - if ( *v20 ) - WritePixel16(clipped_out_x + x, clipped_out_y + y, ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF); - ++v20; - } - v20 += v18 - v5; - } - - /*if ( pRenderer->uTargetGBits == 5 ) - { - if ( (signed int)v6 > 0 ) - { - v23 = v6; - do - { - if ( v5 > 0 ) - { - v21 = v5; - do - { - if ( *v20 ) - *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x3DEF; - ++v4; - ++v20; - --v21; - } - while ( v21 ); - } - v20 += v18 - v5; - v17 = v23-- == 1; - v4 += this->uTargetSurfacePitch - v5; - } - while ( !v17 ); - } - } - else - { - if ( (signed int)v6 > 0 ) - { - v24 = v6; - do - { - if ( v5 > 0 ) - { - v22 = v5; - do - { - if ( *v20 ) - *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF; - ++v4; - ++v20; - --v22; - } - while ( v22 ); - } - v20 += v18 - v5; - v17 = v24-- == 1; - v4 += this->uTargetSurfacePitch - v5; - } - while ( !v17 ); - } - }*/ - } +void Render::DrawTextureGrayShade(float u, float v, Image *img) +{ + DrawMasked(u, v, img, 1, 0x7BEF); } //----- (004A6DF5) -------------------------------------------------------- @@ -6973,18 +6830,18 @@ //----- (004A68EF) -------------------------------------------------------- void Render::DrawTransparentGreenShade(float u, float v, Image *pTexture) { - DrawMasked(u, v, pTexture, 0x07E0); + DrawMasked(u, v, pTexture, 0, 0x07E0); } //----- (004A6776) -------------------------------------------------------- void Render::DrawTransparentRedShade(float u, float v, Image *a4) { - DrawMasked(u, v, a4, 0xF800); + DrawMasked(u, v, a4, 0, 0xF800); } //----- (004A68EF) -------------------------------------------------------- -void Render::DrawMasked(float u, float v, Image *pTexture, unsigned __int16 mask) +void Render::DrawMasked(float u, float v, Image *pTexture, unsigned int color_dimming_level, unsigned __int16 mask) { unsigned int v5; // ebx@4 int v10; // edx@8 @@ -7072,7 +6929,7 @@ WritePixel16( clipped_out_x + x, clipped_out_y + y, - Color16((*pixels >> 16) & 0xFF, (*pixels >> 8) & 0xFF, *pixels & 0xFF) & mask + (Color16((*pixels >> 16) & 0xFF, (*pixels >> 8) & 0xFF, *pixels & 0xFF) >> color_dimming_level) & mask ); ++pixels; } @@ -7376,7 +7233,7 @@ } - +/* //----- (004A6274) -------------------------------------------------------- void Render::DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, Texture_MM7 *pTexture) { @@ -7453,7 +7310,8 @@ } } } -} +}*/ + //----- (004A612A) -------------------------------------------------------- void Render::ZDrawTextureAlpha(float u, float v, Image *img, int zVal) @@ -7627,7 +7485,7 @@ } - +/* //----- (004A5EB2) -------------------------------------------------------- void Render::DrawTextureTransparentColorKey(signed int x, signed int y, Texture_MM7 *tex) { @@ -7714,7 +7572,7 @@ } } } -} +}*/
--- a/Engine/Graphics/Render.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Graphics/Render.h Wed Mar 09 01:39:52 2016 +0200 @@ -263,18 +263,17 @@ virtual void BlendTextures(unsigned int a2, unsigned int a3, struct Image *a4, struct Texture_MM7 *a5, int t, int start_opacity, int end_opacity); virtual void _4A65CC(unsigned int x, unsigned int y, struct Texture_MM7 *a4, struct Texture_MM7 *a5, int a6, int a7, int a8); + virtual void DrawMasked(float u, float v, struct Image *img, unsigned int color_dimming_level, unsigned __int16 mask); + virtual void DrawTextureGrayShade(float u, float v, struct Image *a4); virtual void DrawTransparentRedShade(float u, float v, struct Image *a4); virtual void DrawTransparentGreenShade(float u, float v, struct Image *pTexture); virtual void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices); - virtual void DrawMasked(float u, float v, struct Image *pTexture, unsigned __int16 mask); - virtual void DrawTextAlpha(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, bool present_time_transparency); virtual void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor); virtual void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16); virtual void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7); - virtual void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture_MM7 *a4); virtual void DrawBuildingsD3D(); //struct BSPModel *DrawBuildingsSW();
--- a/Engine/Graphics/RenderD3D11.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Graphics/RenderD3D11.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -65,11 +65,11 @@ void RenderD3D11::DrawTransparentRedShade(float u, float v, struct Image *a4) {__debugbreak();} void RenderD3D11::DrawTransparentGreenShade(float u, float v, struct Image *pTexture) {__debugbreak();} void RenderD3D11::DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices) {__debugbreak();} -void RenderD3D11::DrawMasked(float u, float v, struct Image *pTexture, unsigned __int16 mask) {__debugbreak();} +void RenderD3D11::DrawMasked(float u, float v, struct Image *pTexture, unsigned int, unsigned __int16 mask) {__debugbreak();} void RenderD3D11::DrawTextureCustomHeight(float u, float v, class Image *img, int height) {__debugbreak();} void RenderD3D11::FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16) {__debugbreak();} void RenderD3D11::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) {__debugbreak();} -void RenderD3D11::DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture_MM7 *a4) {__debugbreak();} +void RenderD3D11::DrawTextureGrayShade(float a2, float a3, struct Image *a4) {__debugbreak();} void RenderD3D11::DrawBuildingsD3D() {__debugbreak();} void RenderD3D11::DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID) {__debugbreak();} void RenderD3D11::DrawOutdoorSkyD3D() {__debugbreak();} @@ -146,11 +146,6 @@ } -void RenderD3D11::DrawTextureTransparentColorKey(signed int x, signed int y, struct Texture_MM7 *tex) -{ - PrepareTextureIndexed(tex); - DrawTexture((float)x / window->GetWidth(), (float)y / window->GetHeight(), tex->uTextureWidth, tex->uTextureHeight, tex->d3d11_srv, ui_blend_solid); -} void RenderD3D11::DrawTextureAlphaNew(float u, float v, Image *img) @@ -158,18 +153,6 @@ __debugbreak(); } -void RenderD3D11::DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, struct Texture_MM7 *a4) -{ - PrepareTextureIndexed(a4); - DrawTexture((float)uX / window->GetWidth(), (float)uY / window->GetHeight(), a4->uTextureWidth, a4->uTextureHeight, a4->d3d11_srv, ui_blend_alpha); -} - - -void RenderD3D11::DrawTextureNew(float u, float v, Texture_MM7 *tex) -{ - __debugbreak(); -} - void RenderD3D11::DrawTextureNew(float u, float v, Image *tex) {
--- a/Engine/Graphics/RenderD3D11.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Graphics/RenderD3D11.h Wed Mar 09 01:39:52 2016 +0200 @@ -81,27 +81,23 @@ virtual void DrawTextureNew(float u, float v, struct Image *); virtual void DrawTextureAlphaNew(float u, float v, struct Image *); virtual void DrawTextureCustomHeight(float u, float v, class Image *img, int height); - //virtual void DrawTextureNew(float u, float v, struct Texture_MM7 *); - //virtual void DrawTextureTransparentColorKey(signed int x, signed int y, struct Texture_MM7 *tex); - //virtual void DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, struct Texture_MM7 *pTexture); virtual void ZBuffer_Fill_2(signed int a2, signed int a3, struct Image *pTexture, int a5); virtual void ZDrawTextureAlpha(float u, float v, struct Image *pTexture, int zVal); virtual void BlendTextures(unsigned int a2, unsigned int a3, struct Image *a4, struct Texture_MM7 *a5, int t, int start_opacity, int end_opacity); virtual void _4A65CC(unsigned int x, unsigned int y, struct Texture_MM7 *a4, struct Texture_MM7 *a5, int a6, int a7, int a8); + virtual void DrawMasked(float u, float v, struct Image *img, unsigned int color_dimming_level, unsigned __int16 mask); + virtual void DrawTextureGrayShade(float u, float v, struct Image *a4); virtual void DrawTransparentRedShade(float u, float v, struct Image *a4); virtual void DrawTransparentGreenShade(float u, float v, struct Image *pTexture); virtual void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices); - virtual void DrawMasked(float u, float v, struct Image *pTexture, unsigned __int16 mask); - virtual void DrawTextAlpha(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, bool present_time_transparency); virtual void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor); virtual void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16); virtual void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7); - virtual void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture_MM7 *a4); virtual void DrawBuildingsD3D();
--- a/Engine/LOD.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/LOD.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -1795,7 +1795,7 @@ } //----- (00410522) -------------------------------------------------------- -int LODFile_IconsBitmaps::_410522(Texture_MM7 *pDst, const char *pContainer, unsigned int uTextureType) +int LODFile_IconsBitmaps::PlacementLoadTexture(Texture_MM7 *pDst, const char *pContainer, unsigned int uTextureType) { void *v9; // ST2C_4@6 int v15; // ecx@12
--- a/Engine/LOD.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/LOD.h Wed Mar 09 01:39:52 2016 +0200 @@ -159,7 +159,7 @@ void ReleaseHardwareTextures(); void ReleaseLostHardwareTextures(); void _410423_move_textures_to_device(); - int _410522(struct Texture_MM7 *pDst, const char *pContainer, unsigned int uTextureType); + int PlacementLoadTexture(struct Texture_MM7 *pDst, const char *pContainer, unsigned int uTextureType); void SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits); void ReleaseAll2(); void RemoveTexturesPackFromTextureList();
--- a/Engine/Objects/Chest.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Objects/Chest.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -218,8 +218,8 @@ bool Chest::CanPlaceItemAt( signed int test_cell_position, int item_id, signed int uChestID ) { // int v3; // eax@1 - unsigned int item_texture_id; // eax@1 - Texture_MM7 *item_texture; // ecx@1 + //unsigned int item_texture_id; // eax@1 + //Image *item_texture; // ecx@1 signed int v6; // eax@1 // signed int v7; // edi@3 signed int v8; // eax@3 @@ -235,21 +235,30 @@ chest_cell_heght = pChestHeightsByType[pChests[uChestID].uChestBitmapID]; chest_cell_width = pChestWidthsByType[pChests[uChestID].uChestBitmapID]; - item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE); - item_texture = pIcons_LOD->GetTexture(item_texture_id); - v6 = item_texture->uTextureWidth; + + auto item_texture = assets->GetImage_16BitColorKey(pItemsTable->pItems[item_id].pIconName, 0x7FF); + //item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE); + //item_texture = pIcons_LOD->GetTexture(item_texture_id); + v6 = item_texture->GetWidth(); if ( v6 < 14 ) v6 = 14; texture_cell_width = ((v6 - 14) >> 5) + 1; - v8 = item_texture->uTextureHeight; + v8 = item_texture->GetHeight(); if ( v8 < 14 ) v8 = 14; texture_cell_height = ((v8 - 14) >> 5) + 1; - if ( !areWeLoadingTexture ) + + if (item_texture) + { + item_texture->Release(); + item_texture = nullptr; + } + /*if ( !areWeLoadingTexture ) { item_texture->Release(); pIcons_LOD->SyncLoadedFilesCount(); - } + }*/ + if ( (texture_cell_width + test_cell_position % chest_cell_width <= chest_cell_width) && (texture_cell_height + test_cell_position / chest_cell_width <= chest_cell_heght) ) { //we not put over borders @@ -312,9 +321,9 @@ ItemGen *v4; // edi@1 int v5; // esi@1 int result; // eax@11 - unsigned int v7; // eax@12 + //unsigned int v7; // eax@12 int v8; // edx@12 - Texture_MM7 *texture; // ecx@12 + //Texture_MM7 *texture; // ecx@12 signed int v10; // eax@12 signed int v11; // edi@14 unsigned int v12; // esi@14 @@ -351,15 +360,18 @@ pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); return 0; } - v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE); HIWORD(v8) = 0; - texture = pIcons_LOD->GetTexture(v7); - v10 = texture->uTextureWidth; - if ( texture->uTextureWidth < 14 ) + + auto texture = assets->GetImage_16BitColorKey(v4->GetIconName(), 0x7FF); + //v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE); + //texture = pIcons_LOD->GetTexture(v7); + + v10 = texture->GetWidth(); + if ( texture->GetWidth() < 14 ) v10 = 14; v12 = ((v10 - 14) >> 5) + 1; - v11 = texture->uTextureHeight; - if ( texture->uTextureHeight < 14 ) + v11 = texture->GetHeight(); + if ( texture->GetHeight() < 14 ) v11 = 14; v13 = ((v11 - 14) >> 5) + 1; if ( !areWeLoadingTexture )
--- a/Engine/Objects/NPC.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Objects/NPC.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -20,7 +20,7 @@ #include "../Graphics/Overlays.h" int pDialogueNPCCount; -std::array<struct Texture_MM7 *, 6> pDialogueNPCPortraits; +std::array<class Image *, 6> pDialogueNPCPortraits; int uNumDialogueNPCPortraits; // weak struct NPCStats *pNPCStats = nullptr;
--- a/Engine/Objects/NPC.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Objects/NPC.h Wed Mar 09 01:39:52 2016 +0200 @@ -198,7 +198,7 @@ #pragma pack(pop) extern int pDialogueNPCCount; -extern std::array<struct Texture_MM7 *, 6> pDialogueNPCPortraits; +extern std::array<class Image *, 6> pDialogueNPCPortraits; extern int uNumDialogueNPCPortraits; // weak extern struct NPCStats *pNPCStats;
--- a/Engine/Party.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Party.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -37,6 +37,29 @@ +struct +{ + struct UIAnimation _pUIAnim_Food; + struct UIAnimation _pUIAnim_Gold; + struct UIAnimation _pUIAnum_Torchlight; + struct UIAnimation _pUIAnim_WizardEye; +} _uianim; + +struct UIAnimation *pUIAnim_Food = &_uianim._pUIAnim_Food; +struct UIAnimation *pUIAnim_Gold = &_uianim._pUIAnim_Gold; +struct UIAnimation *pUIAnum_Torchlight = &_uianim._pUIAnum_Torchlight; +struct UIAnimation *pUIAnim_WizardEye = &_uianim._pUIAnim_WizardEye; + +std::array<struct UIAnimation *, 4> pUIAnims = +{ + &_uianim._pUIAnim_Food, + &_uianim._pUIAnim_Gold, + &_uianim._pUIAnum_Torchlight, + &_uianim._pUIAnim_WizardEye +}; + + + //----- (0044A56A) -------------------------------------------------------- void Party::CountHirelings() { @@ -218,7 +241,7 @@ { pUIAnim_Food->uAnimTime = 0; pParty->uNumFoodRations = uNumFood; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; + pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); } //----- (00492B03) -------------------------------------------------------- @@ -230,7 +253,7 @@ pParty->uNumFoodRations -= uNumFood; pUIAnim_Food->uAnimTime = 0; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; + pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); } //----- (00492B42) -------------------------------------------------------- @@ -238,7 +261,7 @@ { pParty->uNumFoodRations += _this; pUIAnim_Food->uAnimTime = 0; - pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; + pUIAnim_Food->uAnimLength = pUIAnim_Food->icon->GetAnimLength(); } //----- (00492B70) -------------------------------------------------------- @@ -246,7 +269,7 @@ { pParty->uNumGold = uNumGold; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); } @@ -258,7 +281,7 @@ else pParty->uNumGold = 0; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); } @@ -1015,7 +1038,7 @@ } this->uNumGold += goldToGain - hirelingSalaries; pUIAnim_Gold->uAnimTime = 0; - pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; + pUIAnim_Gold->uAnimLength = pUIAnim_Gold->icon->GetAnimLength(); if ( pTmpBuf2[0] ) ShowStatusBarString(pTmpBuf2.data(), 2u); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); @@ -1023,24 +1046,26 @@ //----- (00421B2C) -------------------------------------------------------- void Party::sub_421B2C_PlaceInInventory_or_DropPickedItem() { - unsigned int v0; // eax@2 - Texture_MM7 *v1; // ebx@2 + //unsigned int v0; // eax@2 + //Texture_MM7 *v1; // ebx@2 int v2; // eax@3 int v4; // eax@6 unsigned __int16 v5; // dx@11 signed int v6; // eax@11 __int16 v8; // ax@16 SpriteObject a1; // [sp+4h] [bp-78h]@11 - int v11; // [sp+74h] [bp-8h]@2 + //int v11; // [sp+74h] [bp-8h]@2 int v12; // [sp+78h] [bp-4h]@5 if ( !pParty->pPickedItem.uItemID ) return; - v0 = pIcons_LOD->LoadTexture( - pParty->pPickedItem.GetIconName(), - TEXTURE_16BIT_PALETTE); - v1 = pIcons_LOD->GetTexture(v0); - v11 = areWeLoadingTexture; + + auto texture = assets->GetImage_16BitColorKey(pParty->pPickedItem.GetIconName(), 0x7FF); + //v0 = pIcons_LOD->LoadTexture( + // pParty->pPickedItem.GetIconName(), + // TEXTURE_16BIT_PALETTE); + //v1 = pIcons_LOD->GetTexture(v0); + //v11 = areWeLoadingTexture; if ( uActiveCharacter && (v2 = ::pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) { @@ -1091,12 +1116,12 @@ pMouse->RemoveHoldingItem(); } } - if ( !v11 ) + + if (texture) { - v1->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + texture->Release(); + texture = nullptr; } - return; } @@ -1105,11 +1130,11 @@ { unsigned int v2; // eax@1 char *v5; // eax@8 - Texture_MM7 *v7; // ebx@10 + //Texture_MM7 *v7; // ebx@10 signed int v8; // esi@10 Player *v9; // edi@11 int v10; // eax@11 - int v21; // [sp+24h] [bp-4h]@10 + //int v21; // [sp+24h] [bp-4h]@10 v2 = pItem->uItemID; if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) @@ -1118,8 +1143,9 @@ v5 = pItemsTable->pItems[v2].pIconName; if ( v5 ) { - v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); - v21 = areWeLoadingTexture; + auto texture = assets->GetImage_16BitColorKey(v5, 0x7FF); + //v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); + //v21 = areWeLoadingTexture; v8 = 0; uint current_player = uActiveCharacter; for (int i = 0; i < 4; i++) @@ -1135,28 +1161,28 @@ pItem->Reset(); pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0); v9->PlaySound(SPEECH_60, 0); - if ( !v21 ) + + if (texture) { - v7->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + texture->Release(); + texture = nullptr; } return true; } } - if ( !v21 ) + if (texture) { - v7->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + texture->Release(); + texture = nullptr; } - return false; } else { MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); - return false; } + return false; } -// 506128: using guessed type int areWeLoadingTexture; + bool Party::IsPartyEvil() {
--- a/Engine/Registry.cpp Mon Mar 07 03:48:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -#define _CRTDBG_MAP_ALLOC -#include <stdlib.h> -#include <crtdbg.h> - -#define _CRT_SECURE_NO_WARNINGS -#include <stdio.h> -#include <array> -#include <windows.h> - -#include "Registry.h" -#include "Engine/ErrorHandling.h" - -//----- (004649EF) -------------------------------------------------------- -int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue) -{ - DWORD cbData; // [sp+8h] [bp-20h]@1 - LPCSTR lpValueName; // [sp+Ch] [bp-1Ch]@1 - DWORD dwDisposition; // [sp+10h] [bp-18h]@2 - BYTE Data[4]; // [sp+14h] [bp-14h]@5 - HKEY hKey; // [sp+18h] [bp-10h]@1 - HKEY phkResult; // [sp+1Ch] [bp-Ch]@1 - HKEY v10; // [sp+20h] [bp-8h]@1 - HKEY v11; // [sp+24h] [bp-4h]@1 - - lpValueName = pKey; - v11 = 0; - v10 = 0; - hKey = 0; - phkResult = 0; - cbData = 4; - if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) )// for 64 bit - { - if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition) ) - { - if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v10, &dwDisposition) ) - { - if ( !RegCreateKeyExA(v10, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v11, &dwDisposition) ) - { - LSTATUS status; - if ( status = RegQueryValueExA(v11, lpValueName, 0, 0, Data, &cbData) ) - { - status; - GetLastError(); - - *(int *)Data = uDefValue; - RegSetValueExA(v11, lpValueName, 0, 4, Data, 4); - } - RegCloseKey(v11); - } - RegCloseKey(v10); - } - RegCloseKey(phkResult); - } - RegCloseKey(hKey); - } - return *(int *)Data; -} - -//----- (00464B02) -------------------------------------------------------- -void __fastcall WriteWindowsRegistryString(const char *pKey, const char *pString) -{ - size_t v2; // eax@5 - const char *lpValueName; // [sp+4h] [bp-1Ch]@1 - const char *Str; // [sp+8h] [bp-18h]@1 - DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 - HKEY hKey; // [sp+10h] [bp-10h]@1 - HKEY phkResult; // [sp+14h] [bp-Ch]@1 - HKEY v8; // [sp+18h] [bp-8h]@1 - HKEY v9; // [sp+1Ch] [bp-4h]@1 - - Str = pString; - lpValueName = pKey; - v9 = 0; - v8 = 0; - hKey = 0; - phkResult = 0; - if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) ) - { - if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition) ) - { - if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v8, &dwDisposition) ) - { - if ( !RegCreateKeyExA(v8, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v9, &dwDisposition) ) - { - v2 = strlen(Str); - RegSetValueExA(v9, lpValueName, 0, 1, (const BYTE *)Str, v2 + 1); - RegCloseKey(v9); - } - RegCloseKey(v8); - } - RegCloseKey(phkResult); - } - RegCloseKey(hKey); - } -} - -//----- (00464BEF) -------------------------------------------------------- -void __fastcall ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue) -{ - //LSTATUS (__stdcall *v4)(HKEY); // esi@1 - LSTATUS result; // eax@7 - DWORD Type; // [sp+Ch] [bp-24h]@5 - LPCSTR lpValueName; // [sp+10h] [bp-20h]@1 - DWORD cbData; // [sp+14h] [bp-1Ch]@1 - LPBYTE Dest; // [sp+18h] [bp-18h]@1 - DWORD dwDisposition; // [sp+1Ch] [bp-14h]@2 - HKEY phkResult; // [sp+20h] [bp-10h]@1 - HKEY hKey; // [sp+24h] [bp-Ch]@1 - HKEY v13; // [sp+28h] [bp-8h]@1 - HKEY v14; // [sp+2Ch] [bp-4h]@1 - - cbData = uBufLen; - Dest = (LPBYTE)pOutString; - lpValueName = pKeyName; - v14 = 0; - v13 = 0; - hKey = 0; - phkResult = 0; - result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); - if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) ) - { - if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) - { - if (!RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v13, &dwDisposition)) - { - if( !RegCreateKeyExA(v13, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v14, &dwDisposition) ) - { - if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) ) - GetLastError(); - RegCloseKey(v14); - v14 = NULL; - } - RegCloseKey(v13); - v13 = NULL; - } - RegCloseKey(phkResult); - phkResult = NULL; - } - RegCloseKey(hKey); - hKey = NULL; - } -} - -//----- (00464D32) -------------------------------------------------------- -void __fastcall WriteWindowsRegistryInt(const char *pKey, int val) -{ - const char *lpValueName; // [sp+4h] [bp-1Ch]@1 - BYTE Data[4]; // [sp+8h] [bp-18h]@1 - DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 - HKEY hKey; // [sp+10h] [bp-10h]@1 - HKEY phkResult; // [sp+14h] [bp-Ch]@1 - HKEY v7; // [sp+18h] [bp-8h]@1 - HKEY v8; // [sp+1Ch] [bp-4h]@1 - - *(int *)Data = val; - lpValueName = pKey; - v8 = 0; - v7 = 0; - hKey = 0; - phkResult = 0; - if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) ) - { - if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition) ) - { - if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v7, &dwDisposition) ) - { - if ( !RegCreateKeyExA(v7, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v8, &dwDisposition) ) - { - RegSetValueExA(v8, lpValueName, 0, 4, Data, 4); - RegCloseKey(v8); - } - RegCloseKey(v7); - } - RegCloseKey(phkResult); - } - RegCloseKey(hKey); - } -} \ No newline at end of file
--- a/Engine/Registry.h Mon Mar 07 03:48:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#pragma once - - - -int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue); // idb -void __fastcall WriteWindowsRegistryString(const char *pKey, const char *pString); -void __fastcall ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue); -void __fastcall WriteWindowsRegistryInt(const char *pKey, int val); \ No newline at end of file
--- a/Engine/Serialization/LegacyImages.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Serialization/LegacyImages.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -1,6 +1,8 @@ #include "Engine/Engine.h" +#include "Engine/LOD.h" #include "Engine/Timer.h" #include "Engine/Party.h" +#include "Engine/Tables/IconFrameTable.h" #include "Engine/Objects/NPC.h" #include "Engine/Graphics/Overlays.h" #include "Engine/Serialization/LegacyImages.h" @@ -83,6 +85,18 @@ memset(this, 0, sizeof(*this)); } +IconFrame_MM7::IconFrame_MM7() +{ + Assert(sizeof(*this) == 0x20); + memset(this, 0, sizeof(*this)); +} + +UIAnimation_MM7::UIAnimation_MM7() +{ + Assert(sizeof(*this) == 0xD); + memset(this, 0, sizeof(*this)); +} + @@ -942,4 +956,55 @@ player->uNumArmageddonCasts = this->uNumArmageddonCasts; player->uNumFireSpikeCasts = this->uNumFireSpikeCasts; player->field_1B3B = this->field_1B3B; +} + + + +void IconFrame_MM7::Serialize(Icon *icon) +{ + strcpy(pAnimationName, icon->GetAnimationName()); + uAnimLength = icon->GetAnimLength(); + + strcpy(pTextureName, icon->pTextureName); + uAnimTime = icon->GetAnimTime(); + uFlags = icon->uFlags; + + __debugbreak(); // impossible + //uTextureID = icon->uTextureID; +} + +void IconFrame_MM7::Deserialize(Icon *icon) +{ + icon->SetAnimationName(this->pAnimationName); + icon->SetAnimLength(8 * this->uAnimLength); + + strcpy(icon->pTextureName, pTextureName); + icon->SetAnimTime(uAnimTime); + icon->uFlags = uFlags; + icon->texture = assets->GetImage_16BitColorKey(pIcons_LOD->pTextures[uTextureID].pName, 0x7FF); +} + + + +void UIAnimation_MM7::Serialize(UIAnimation *anim) +{ + /* 000 */ uIconID = anim->icon->id; + /* 002 */ field_2 = anim->field_2; + /* 004 */ uAnimTime = anim->uAnimTime; + /* 006 */ uAnimLength = anim->uAnimLength; + /* 008 */ x = anim->x; + /* 00A */ y = anim->y; + /* 00C */ field_C = anim->field_C; +} + +void UIAnimation_MM7::Deserialize(UIAnimation *anim) +{ + anim->icon = pIconsFrameTable->GetIcon(uIconID); + ///* 000 */ anim->uIconID = uIconID; + /* 002 */ anim->field_2 = field_2; + /* 004 */ anim->uAnimTime = uAnimTime; + /* 006 */ anim->uAnimLength = uAnimLength; + /* 008 */ anim->x = x; + /* 00A */ anim->y = y; + /* 00C */ anim->field_C = field_C; } \ No newline at end of file
--- a/Engine/Serialization/LegacyImages.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Serialization/LegacyImages.h Wed Mar 09 01:39:52 2016 +0200 @@ -520,5 +520,46 @@ /* 3EC */ int bRedraw; /* 3F0 */ }; +#pragma pack(pop) -#pragma pack(pop) \ No newline at end of file + + + + +/* 44 */ +#pragma pack(push, 1) +struct IconFrame_MM7 +{ + IconFrame_MM7(); + + void Serialize(class Icon *); + void Deserialize(class Icon *); + + /* 000 */ char pAnimationName[12]; + /* 00C */ char pTextureName[12]; + /* 018 */ __int16 uAnimTime; + /* 01A */ __int16 uAnimLength; + /* 01C */ __int16 uFlags; // 0x01 - more icons in this animation + /* 01E */ unsigned __int16 uTextureID; +}; +#pragma pack(pop) + + +/* 76 */ +#pragma pack(push, 1) +struct UIAnimation_MM7 +{ + UIAnimation_MM7(); + + void Serialize(class UIAnimation *); + void Deserialize(class UIAnimation *); + + /* 000 */ unsigned __int16 uIconID; + /* 002 */ __int16 field_2; + /* 004 */ __int16 uAnimTime; + /* 006 */ __int16 uAnimLength; + /* 008 */ __int16 x; + /* 00A */ __int16 y; + /* 00C */ char field_C; +}; +#pragma pack(pop)
--- a/Engine/Spells/CastSpellInfo.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Spells/CastSpellInfo.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -3084,7 +3084,7 @@ } pParty->pHirelings[achieved_awards[pCastSpell->uPlayerID_2 - 4] - 1].evt_A = 1; pParty->pHirelings[achieved_awards[pCastSpell->uPlayerID_2 - 4] - 1].evt_B = 0; - pParty->pHirelings[achieved_awards[pCastSpell->uPlayerID_2 - 4] - 1].evt_C = pIconsFrameTable->GetIconAnimLength(pIconsFrameTable->FindIcon("spell96")); + pParty->pHirelings[achieved_awards[pCastSpell->uPlayerID_2 - 4] - 1].evt_C = pIconsFrameTable->GetIcon("spell96")->GetAnimLength(); for ( uint pl_id = 0; pl_id < 4; pl_id++ ) { pParty->pPlayers[pl_id].sHealth = pParty->pPlayers[pl_id].GetMaxHealth();
--- a/Engine/Tables/IconFrameTable.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Tables/IconFrameTable.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -5,33 +5,57 @@ #define _CRT_SECURE_NO_WARNINGS #include "Engine/Engine.h" +#include "Engine/Serialization/LegacyImages.h" #include "IconFrameTable.h" #include "../LOD.h" #include "FrameTableInc.h" + +Icon *IconFrameTable::GetIcon(unsigned int idx) +{ + if (idx < this->uNumIcons) + return &this->pIcons[idx]; + return nullptr; +} + +Icon *IconFrameTable::GetIcon(const char *pIconName) +{ + for (unsigned int i = 0; i < this->uNumIcons; i++) + { + if (!_stricmp(pIconName, this->pIcons[i].GetAnimationName())) + return &this->pIcons[i]; + } + return nullptr; +} + + + //----- (00494F3A) -------------------------------------------------------- unsigned int IconFrameTable::FindIcon(const char *pIconName) { for ( uint i = 0; i < (signed int)this->uNumIcons; i++ ) { - if ( !_stricmp(pIconName, this->pIcons[i].pAnimationName) ) + if ( !_stricmp(pIconName, this->pIcons[i].GetAnimationName()) ) return i; } return 0; } //----- (00494F70) -------------------------------------------------------- -IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) +Icon *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int frame_time) { int v6; // edx@3 uint i; - if ( this->pIcons[uIconID].uFlags & 1 && this->pIcons[uIconID].uAnimLength != 0 ) + if ( this->pIcons[uIconID].uFlags & 1 && this->pIcons[uIconID].GetAnimLength() != 0 ) { - v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)this->pIcons[uIconID].uAnimLength; - for ( i = uIconID; v6 > this->pIcons[i].uAnimTime; i++ ) - v6 -= this->pIcons[i].uAnimTime; + int t = frame_time; + + t = (t /*/ 8*/) % (unsigned __int16)this->pIcons[uIconID].GetAnimLength(); + t /= 8; + for ( i = uIconID; t > this->pIcons[i].GetAnimTime(); i++ ) + t -= this->pIcons[i].GetAnimTime(); return &this->pIcons[i]; } else @@ -45,7 +69,8 @@ { for ( uint i = uIconID; ; ++i ) { - this->pIcons[i].uTextureID = pIcons_LOD->LoadTexture(this->pIcons[i].pTextureName, TEXTURE_16BIT_PALETTE); + //this->pIcons[i].uTextureID = pIcons_LOD->LoadTexture(this->pIcons[i].pTextureName, TEXTURE_16BIT_PALETTE); + this->pIcons[i].texture = assets->GetImage_16BitColorKey(this->pIcons[i].pTextureName, 0x7FF); if ( !(this->pIcons[i].uFlags & 1) ) break; } @@ -80,14 +105,24 @@ uNumIcons = num_mm6_frames + num_mm7_frames + num_mm8_frames; Assert(uNumIcons); + Assert(!num_mm6_frames); Assert(!num_mm8_frames); - pIcons = (IconFrame *)malloc(uNumIcons * sizeof(IconFrame)); - memcpy(pIcons, (char *)data_mm7 + 4, num_mm7_frames * sizeof(IconFrame)); - memcpy(pIcons + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(IconFrame)); - memcpy(pIcons + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(IconFrame)); + IconFrame_MM7 *pIcons = (IconFrame_MM7 *)malloc(uNumIcons * sizeof(IconFrame_MM7)); + memcpy(pIcons, (char *)data_mm7 + 4, num_mm7_frames * sizeof(IconFrame_MM7)); + //memcpy(pIcons + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(IconFrame_MM7)); + //memcpy(pIcons + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(IconFrame_MM7)); + + this->pIcons = new Icon[uNumIcons]; + for (unsigned int i = 0; i < uNumIcons; ++i) + { + pIcons[i].Deserialize(&this->pIcons[i]); + + this->pIcons[i].id = i; + } } +/* //----- (0049509D) -------------------------------------------------------- int IconFrameTable::FromFileTxt(const char *Args) { @@ -103,7 +138,7 @@ int v11; // ecx@21 int v12; // eax@22 signed int j; // edx@25 - IconFrame *v14; // ecx@26 + IconFrame_MM7 *v14; // ecx@26 int v15; // esi@26 int k; // eax@27 signed int result; // eax@11 @@ -144,7 +179,7 @@ } this->uNumIcons = v4; v5 = malloc(32 * v4);//, "I Frames"); - this->pIcons = (IconFrame *)v5; + this->pIcons = (IconFrame_MM7 *)v5; if ( v5 ) { v6 = File; @@ -210,9 +245,11 @@ result = 0; } return result; -} +}*/ + +/* //----- (0042EB78) -------------------------------------------------------- int IconFrameTable::GetIconAnimLength(unsigned int uIconID) { return 8 * this->pIcons[uIconID].uAnimLength; -} \ No newline at end of file +}*/ \ No newline at end of file
--- a/Engine/Tables/IconFrameTable.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Tables/IconFrameTable.h Wed Mar 09 01:39:52 2016 +0200 @@ -2,20 +2,36 @@ #include <array> - - -/* 44 */ -#pragma pack(push, 1) -struct IconFrame +class Icon { - char pAnimationName[12]; - char pTextureName[12]; - __int16 uAnimTime; - __int16 uAnimLength; - __int16 uFlags; - unsigned __int16 uTextureID; + public: + inline void SetAnimationName(const char *name) { strcpy(this->anim_name, name); } + inline const char *GetAnimationName() const { return anim_name; } + + inline void SetAnimLength(unsigned int anim_length) { this->anim_length = anim_length; } + inline unsigned int GetAnimLength() const { return this->anim_length; } + + inline void SetAnimTime(unsigned int anim_time) { this->anim_time = anim_time; } + inline unsigned int GetAnimTime() const { return this->anim_time; } + + ///* 000 */ char pAnimationName[12]; + /* 00C */ char pTextureName[12]; + ///* 018 */ __int16 uAnimTime; + ///* 01A */ __int16 uAnimLength; + /* 01C */ __int16 uFlags; + class Image *texture;///* 01E */ unsigned __int16 uTextureID; + int id; + + + protected: + char anim_name[64]; + //char texture_name[64]; + //unsigned int anim_time; + unsigned int anim_length; + unsigned int anim_time; + //unsigned int flags; + //unsigned int texture_id; }; -#pragma pack(pop) /* 45 */ #pragma pack(push, 1) @@ -25,16 +41,18 @@ uNumIcons(0), pIcons(nullptr) {} + Icon *GetIcon(unsigned int idx); + Icon *GetIcon(const char *pIconName); unsigned int FindIcon(const char *pIconName); - IconFrame *GetFrame(unsigned int uIconID, unsigned int uFrameID); + Icon *GetFrame(unsigned int uIconID, unsigned int frame_time); void InitializeAnimation(unsigned int uIconID); void ToFile(); void FromFile(void *data_mm6, void *data_mm7, void *data_mm8); int FromFileTxt(const char *Args); - int GetIconAnimLength(unsigned int uIconID); + //int GetIconAnimLength(unsigned int uIconID); unsigned int uNumIcons; - struct IconFrame *pIcons; + struct Icon *pIcons; }; #pragma pack(pop) @@ -49,20 +67,18 @@ -/* 76 */ -#pragma pack(push, 1) -struct UIAnimation +class UIAnimation { - unsigned __int16 uIconID; - __int16 field_2; - __int16 uAnimTime; - __int16 uAnimLength; - __int16 x; - __int16 y; - char field_C; + public: + class Icon *icon; + + /* 002 */ __int16 field_2; + /* 004 */ __int16 uAnimTime; + /* 006 */ __int16 uAnimLength; + /* 008 */ __int16 x; + /* 00A */ __int16 y; + /* 00C */ char field_C; }; -#pragma pack(pop) - @@ -71,9 +87,9 @@ extern struct IconFrameTable *pIconsFrameTable; -extern struct UIAnimation *pUIAnim_Food; -extern struct UIAnimation *pUIAnim_Gold; -extern struct UIAnimation *pUIAnum_Torchlight; -extern struct UIAnimation *pUIAnim_WizardEye; +extern class UIAnimation *pUIAnim_Food; +extern class UIAnimation *pUIAnim_Gold; +extern class UIAnimation *pUIAnum_Torchlight; +extern class UIAnimation *pUIAnim_WizardEye; -extern std::array<struct UIAnimation *, 4> pUIAnims; +extern std::array<class UIAnimation *, 4> pUIAnims;
--- a/Engine/TurnEngine/TurnEngine.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/TurnEngine/TurnEngine.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -124,7 +124,7 @@ pAudioPlayer->StopChannels(-1, -1); pAudioPlayer->PlaySound(SOUND_batllest, 0, 0, -1, 0, 0, 0, 0); //pPlayer = pParty->pPlayers.data(); - dword_50C998_turnbased_icon_1A = 8 * pIconsFrameTable->pIcons[uIconID_TurnStart].uAnimLength; + dword_50C998_turnbased_icon_1A = pIconsFrameTable->GetIcon(uIconID_TurnStart)->GetAnimLength(); dword_50C994 = 0; this->turn_initiative = 100;
--- a/Engine/mm7_data.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/mm7_data.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -235,27 +235,6 @@ #include "Engine/Tables/IconFrameTable.h" struct IconFrameTable *pIconsFrameTable; -struct -{ - struct UIAnimation _pUIAnim_Food; - struct UIAnimation _pUIAnim_Gold; - struct UIAnimation _pUIAnum_Torchlight; - struct UIAnimation _pUIAnim_WizardEye; -} _uianim; - -struct UIAnimation *pUIAnim_Food = &_uianim._pUIAnim_Food; -struct UIAnimation *pUIAnim_Gold = &_uianim._pUIAnim_Gold; -struct UIAnimation *pUIAnum_Torchlight = &_uianim._pUIAnum_Torchlight; -struct UIAnimation *pUIAnim_WizardEye = &_uianim._pUIAnim_WizardEye; - -std::array<struct UIAnimation *, 4> pUIAnims = -{ - &_uianim._pUIAnim_Food, - &_uianim._pUIAnim_Gold, - &_uianim._pUIAnum_Torchlight, - &_uianim._pUIAnim_WizardEye -}; - #include "Engine/Tables/PlayerFrameTable.h" @@ -767,10 +746,6 @@ char bFlashHistoryBook; // weak char bFlashAutonotesBook; // weak char bFlashQuestBook; // weak -int uTextureID_PlayerBuff_PainReflection; // weak -int uTextureID_PlayerBuff_Hammerhands; // weak -int uTextureID_PlayerBuff_Preservation; // weak -int uTextureID_PlayerBuff_Bless; // weak struct GUIButton *pBtn_ZoomOut; // idb struct GUIButton *pBtn_ZoomIn; // idb unsigned int uGameUIFontShadow; @@ -1023,9 +998,6 @@ int uPlayerCreationUI_ArrowAnim; unsigned int uPlayerCreationUI_SelectedCharacter; int dword_A74CDC; // weak -struct Texture_MM7 *pTexture_PlayerFaceEradicated; -struct Texture_MM7 *pTexture_PlayerFaceDead; -std::array< std::array<struct Texture_MM7 *, 56>, 4> pTextures_PlayerFaces; __int64 _A750D8_player_speech_timer; // qword_A750D8 enum PlayerSpeech PlayerSpeechID; int uSpeakingCharacter; // weak @@ -1037,7 +1009,6 @@ //int dword_F8B144; // nexindex [-1] to the following std::array<int, 4> player_levels = {{1, 1, 1, 1}}; std::array<__int16, 6> weapons_Ypos; // word_F8B158 -std::array<struct Texture_MM7 *, 12> ItemsInShopTexture; __int16 bountyHunting_monster_id_for_hunting; // word_F8B1A0 const char *bountyHunting_text; // word_F8B1A4 int contract_approved; // weak
--- a/Engine/mm7_data.h Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/mm7_data.h Wed Mar 09 01:39:52 2016 +0200 @@ -437,10 +437,6 @@ extern char bFlashHistoryBook; // weak extern char bFlashAutonotesBook; // weak extern char bFlashQuestBook; // weak -extern int uTextureID_PlayerBuff_PainReflection; // weak -extern int uTextureID_PlayerBuff_Hammerhands; // weak -extern int uTextureID_PlayerBuff_Preservation; // weak -extern int uTextureID_PlayerBuff_Bless; // weak extern struct GUIButton *pBtn_ZoomOut; // idb extern struct GUIButton *pBtn_ZoomIn; // idb extern unsigned int uGameUIFontShadow; @@ -717,9 +713,6 @@ extern int uPlayerCreationUI_ArrowAnim; extern unsigned int uPlayerCreationUI_SelectedCharacter; extern int dword_A74CDC; // weak -extern struct Texture_MM7 *pTexture_PlayerFaceEradicated; -extern struct Texture_MM7 *pTexture_PlayerFaceDead; -extern std::array< std::array<struct Texture_MM7 *, 56>, 4> pTextures_PlayerFaces; extern __int64 _A750D8_player_speech_timer; // qword_A750D8 extern enum PlayerSpeech PlayerSpeechID; extern int uSpeakingCharacter; // weak @@ -730,7 +723,6 @@ extern std::array<int, 32> dword_F1B430; // weak extern std::array<int, 4> player_levels; extern std::array<__int16, 6> weapons_Ypos; // word_F8B158 -extern std::array<struct Texture_MM7 *, 12> ItemsInShopTexture; extern __int16 bountyHunting_monster_id_for_hunting; // weak extern const char *bountyHunting_text; // idb extern int contract_approved; // weak
--- a/Engine/stru6.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/stru6.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -1236,7 +1236,7 @@ v4->uSpellIconID = pIconsFrameTable->FindIcon(v6); if (v4->bRender) - v4->uSpellAnimTime = 8 * pIconsFrameTable->pIcons[v4->uSpellIconID].uAnimLength; + v4->uSpellAnimTime = pIconsFrameTable->GetIcon(v4->uSpellIconID)->GetAnimLength(); } //----- (004A8BDF) -------------------------------------------------------- @@ -1376,8 +1376,8 @@ continue; } - IconFrame* icon = pIconsFrameTable->GetFrame(buff->uSpellIconID, buff->uSpellAnimTimeElapsed); - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 385, pIcons_LOD->GetTexture(icon->uTextureID)); + Icon* icon = pIconsFrameTable->GetFrame(buff->uSpellIconID, buff->uSpellAnimTimeElapsed); + pRenderer->DrawTextureAlphaNew(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 385/480.0f, icon->texture); pOtherOverlayList->bRedraw = true; }
--- a/GUI/GUIProgressBar.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/GUIProgressBar.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -85,16 +85,21 @@ uWidth = 449; uHeight = 56; uProgressMax = 26; - pIcons_LOD->_410522(&pLoadingProgress, "loadprog", 2u); + + //pIcons_LOD->PlacementLoadTexture(&pLoadingProgress, "loadprog", 2u); + progressbar_loading = assets->GetImage_16BitColorKey("loadprog", 0x7FF); Draw(); return true; } switch (pParty->alignment) { - case PartyAlignment_Good: pIcons_LOD->_410522(&pBardata, "bardata-b", 2); break; - case PartyAlignment_Neutral: pIcons_LOD->_410522(&pBardata, "bardata", 2); break; - case PartyAlignment_Evil: pIcons_LOD->_410522(&pBardata, "bardata-c", 2); break; + case PartyAlignment_Good: progressbar_dungeon = assets->GetImage_16BitColorKey("bardata-b", 0x7FF); break; + case PartyAlignment_Neutral: progressbar_dungeon = assets->GetImage_16BitColorKey("bardata", 0x7FF); break; + case PartyAlignment_Evil: progressbar_dungeon = assets->GetImage_16BitColorKey("bardata-c", 0x7FF); break; + //case PartyAlignment_Good: pIcons_LOD->PlacementLoadTexture(&pBardata, "bardata-b", 2); break; + //case PartyAlignment_Neutral: pIcons_LOD->PlacementLoadTexture(&pBardata, "bardata", 2); break; + //case PartyAlignment_Evil: pIcons_LOD->PlacementLoadTexture(&pBardata, "bardata-c", 2); break; default: Error("Invalid alignment type: %u", pParty->alignment); } @@ -139,21 +144,33 @@ this->uProgressCurrent = this->uProgressMax - 1; Progress(); } - v3 = (int)&this->pLoadingProgress.paletted_pixels; - free(this->pLoadingProgress.paletted_pixels); - free(this->pLoadingProgress.pPalette16); - this->pLoadingProgress.pPalette16 = 0; + + if (progressbar_loading) + { + progressbar_loading->Release(); + progressbar_loading = nullptr; + } + //v3 = (int)&this->pLoadingProgress.paletted_pixels; + //free(this->pLoadingProgress.paletted_pixels); + //free(this->pLoadingProgress.pPalette16); + //this->pLoadingProgress.pPalette16 = 0; + //*(int *)v3 = 0; } else { - if ( !this->pBardata.paletted_pixels) - return; - free(this->pBardata.paletted_pixels); - v3 = (int)&this->pBardata.pPalette16; - free(this->pBardata.pPalette16); - this->pBardata.paletted_pixels = 0; + //if ( !this->pBardata.paletted_pixels) + // return; + //free(this->pBardata.paletted_pixels); + //v3 = (int)&this->pBardata.pPalette16; + //free(this->pBardata.pPalette16); + //this->pBardata.paletted_pixels = 0; + //*(int *)v3 = 0; + if (progressbar_dungeon) + { + progressbar_dungeon->Release(); + progressbar_dungeon = nullptr; + } } - *(int *)v3 = 0; } //----- (00443670) -------------------------------------------------------- @@ -162,12 +179,12 @@ pRenderer->BeginScene(); if (uType != TYPE_Fullscreen) { - if (pBardata.paletted_pixels) + //if (pBardata.paletted_pixels) { pRenderer->Sub01(); - pRenderer->DrawTextureTransparentColorKey(80, 122, &pBardata);//прогрессбар для данжей - pRenderer->DrawTextureIndexedAlpha(100, 146, &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->uTextureID]); + pRenderer->DrawTextureAlphaNew(80/640.0f, 122/480.0f, progressbar_dungeon); + pRenderer->DrawTextureAlphaNew(100/640.0f, 146/480.0f, pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->texture); //pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15), //16, pRenderer->uTargetRMask); pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15), @@ -187,11 +204,10 @@ } else { - pRenderer->DrawTextureNew(0, 0, loading_bg); //pRenderer->SetRasterClipRect(0, 0, 639, 479); pRenderer->SetUIClipRect(172, 459, 15 * (signed int)(signed __int64)((double)(300 * uProgressCurrent) / (double)uProgressMax) / 15 + 172, 471); - pRenderer->DrawTextureIndexedAlpha(172, 459, &pLoadingProgress); + pRenderer->DrawTextureAlphaNew(172/640.0f, 459/480.0f, progressbar_loading); pRenderer->ResetUIClipRect(); pRenderer->EndScene(); pRenderer->Present();
--- a/GUI/GUIProgressBar.h Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/GUIProgressBar.h Wed Mar 09 01:39:52 2016 +0200 @@ -42,8 +42,8 @@ //RGBTexture field_90; //RGBTexture field_B8; struct Texture_MM7 field_E0; - struct Texture_MM7 pBardata; - struct Texture_MM7 pLoadingProgress; + class Image *progressbar_dungeon;//struct Texture_MM7 pBardata; + class Image *progressbar_loading;//struct Texture_MM7 pLoadingProgress; inline GUIProgressBar():
--- a/GUI/GUIWindow.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/GUIWindow.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -419,7 +419,13 @@ // ----------------------------------------- // 0041C26A void GUIWindow::Release --- part if (!dword_591084) - pDialogueNPCPortraits[0]->Release(); + { + if (pDialogueNPCPortraits[0]) + { + pDialogueNPCPortraits[0]->Release(); + pDialogueNPCPortraits[0] = nullptr; + } + } uNumDialogueNPCPortraits = 0; if (game_ui_dialogue_background) @@ -449,7 +455,13 @@ // ----------------------------------------- // 0041C26A void GUIWindow::Release --- part for (int i = 0; i < uNumDialogueNPCPortraits; ++i) - pDialogueNPCPortraits[i]->Release(); + { + if (pDialogueNPCPortraits[i]) + { + pDialogueNPCPortraits[i]->Release(); + pDialogueNPCPortraits[i] = nullptr; + } + } uNumDialogueNPCPortraits = 0; if (game_ui_dialogue_background) @@ -685,8 +697,8 @@ { pRenderer->DrawTextureAlphaNew((pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4)/640.0f, (pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4)/480.0f, game_ui_evtnpc); - pRenderer->DrawTextureTransparentColorKey(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8], - pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]); + pRenderer->DrawTextureAlphaNew(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8]/640.0f, + pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8]/480.0f, pDialogueNPCPortraits[v8]); if ( uNumDialogueNPCPortraits < 4 ) { if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) @@ -703,7 +715,7 @@ continue; } pTitleText = HouseNPCData[v8 +1 - (dword_591080 != 0)]->pName; - v9 = pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2; + v9 = pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] + pDialogueNPCPortraits[v8]->GetHeight() + 2; } v10 = v9; pWindow.DrawTitleText(pFontCreate, 483, v10, pColor2, pTitleText, 3); @@ -720,7 +732,7 @@ } v4 = (char *)pDialogueNPCCount - 1; pRenderer->DrawTextureAlphaNew((pNPCPortraits_x[0][0] - 4)/640.0f, (pNPCPortraits_y[0][0] - 4)/480.0f, game_ui_evtnpc); - pRenderer->DrawTextureTransparentColorKey(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); + pRenderer->DrawTextureAlphaNew(pNPCPortraits_x[0][0]/640.0f, pNPCPortraits_y[0][0]/480.0f, pDialogueNPCPortraits[(signed int)v4]); if ( current_screen_type == SCREEN_E ) { CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); @@ -1738,21 +1750,22 @@ ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-C"); game_ui_btn_zoomin = assets->GetImage_16BitAlpha("ib-autout-C"); game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-C"); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2); + game_ui_player_selection_frame = assets->GetImage_16BitColorKey("IB-selec-C", 0x7FF); game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-c"); game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-c"); game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-c"); game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-c"); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2); + game_ui_playerbuff_bless = assets->GetImage_16BitColorKey("isg-01-c", 0x7FF); + game_ui_playerbuff_preservation = assets->GetImage_16BitColorKey("isg-02-c", 0x7FF); + game_ui_playerbuff_hammerhands = assets->GetImage_16BitColorKey("isg-03-c", 0x7FF); + game_ui_playerbuff_pain_reflection = assets->GetImage_16BitColorKey("isg-04-c", 0x7FF); - pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); - pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID); - pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); - pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID); + pUIAnim_WizardEye->icon = pIconsFrameTable->GetIcon("wizeyeC"); + pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->icon->id); + + pUIAnum_Torchlight->icon = pIconsFrameTable->GetIcon("torchC"); + pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->icon->id); ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-c", 0x7FF); @@ -1787,23 +1800,26 @@ ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-C"); game_ui_btn_zoomin = assets->GetImage_16BitAlpha(L"ib-autout-C"); game_ui_btn_zoomout = assets->GetImage_16BitAlpha(L"ib-autin-C"); - uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); + game_ui_player_selection_frame = assets->GetImage_16BitColorKey("IB-selec-C", 0x7FF); game_ui_btn_cast = assets->GetImage_16BitAlpha(L"ib-m1d-c"); game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-c"); game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-c"); game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-c"); ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-c", 0x7FF); - uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); - uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); - uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); - uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); + game_ui_playerbuff_bless = assets->GetImage_16BitColorKey("isg-01-c", 0x7FF); + game_ui_playerbuff_preservation = assets->GetImage_16BitColorKey("isg-02-c", 0x7FF); + game_ui_playerbuff_hammerhands = assets->GetImage_16BitColorKey("isg-03-c", 0x7FF); + game_ui_playerbuff_pain_reflection = assets->GetImage_16BitColorKey("isg-04-c", 0x7FF); + game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc-c", 0x7FF); ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven", 0x7FF); - pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); - pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); + + pUIAnim_WizardEye->icon = pIconsFrameTable->GetIcon("wizeyeC"); + pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->icon->id); + + pUIAnum_Torchlight->icon = pIconsFrameTable->GetIcon("torchC"); + pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->icon->id); } uGameUIFontMain = Color16(0xC8u, 0, 0); uGameUIFontShadow = Color16(10, 0, 0); @@ -1829,19 +1845,21 @@ ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-a"); game_ui_btn_zoomin = assets->GetImage_16BitAlpha("ib-autout-a"); game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-a"); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2); + game_ui_player_selection_frame = assets->GetImage_16BitColorKey("IB-selec-a", 0x7FF); game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-a"); game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-a"); game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-a"); game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-a"); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2); - pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); - pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); + + game_ui_playerbuff_bless = assets->GetImage_16BitColorKey("isg-01-a", 0x7FF); + game_ui_playerbuff_preservation = assets->GetImage_16BitColorKey("isg-02-a", 0x7FF); + game_ui_playerbuff_hammerhands = assets->GetImage_16BitColorKey("isg-03-a", 0x7FF); + game_ui_playerbuff_pain_reflection = assets->GetImage_16BitColorKey("isg-04-a", 0x7FF); + + pUIAnim_WizardEye->icon = pIconsFrameTable->GetIcon("wizeyeA"); + pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->icon->id); + pUIAnum_Torchlight->icon = pIconsFrameTable->GetIcon("torchA"); + pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->icon->id); ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-a", 0x7FF); @@ -1874,7 +1892,7 @@ ui_btn_npc_left = assets->GetImage_16BitAlpha(L"IB-NPCLD-A"); ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-A"); - uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); + game_ui_player_selection_frame = assets->GetImage_16BitColorKey("IB-selec-A", 0x7FF); game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-a"); game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-a"); game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-a"); @@ -1883,16 +1901,19 @@ game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-a"); ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-a", 0x7FF); - uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); - uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); - uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); - uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); + game_ui_playerbuff_bless = assets->GetImage_16BitColorKey("isg-01-a", 0x7FF); + game_ui_playerbuff_preservation = assets->GetImage_16BitColorKey("isg-02-a", 0x7FF); + game_ui_playerbuff_hammerhands = assets->GetImage_16BitColorKey("isg-03-a", 0x7FF); + game_ui_playerbuff_pain_reflection = assets->GetImage_16BitColorKey("isg-04-a", 0x7FF); + game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc", 0x7FF); ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven", 0x7FF); - pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); - pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); + + pUIAnim_WizardEye->icon = pIconsFrameTable->GetIcon("wizeyeA"); + pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->icon->id); + pUIAnum_Torchlight->icon = pIconsFrameTable->GetIcon("torchA"); + pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->icon->id); + messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll"); messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr"); messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul"); @@ -1927,21 +1948,23 @@ ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-B"); game_ui_btn_zoomin = assets->GetImage_16BitAlpha("ib-autout-B"); game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-B"); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-B", 2); + game_ui_player_selection_frame = assets->GetImage_16BitColorKey("IB-selec-B", 0x7FF); game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-b"); game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-b"); game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-b"); game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-b"); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-b", 2); - pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); - pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); - pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); + + game_ui_playerbuff_bless = assets->GetImage_16BitColorKey("isg-01-b", 0x7FF); + game_ui_playerbuff_preservation = assets->GetImage_16BitColorKey("isg-02-b", 0x7FF); + game_ui_playerbuff_hammerhands = assets->GetImage_16BitColorKey("isg-03-b", 0x7FF); + game_ui_playerbuff_pain_reflection = assets->GetImage_16BitColorKey("isg-04-b", 0x7FF); + + pUIAnim_WizardEye->icon = pIconsFrameTable->GetIcon("wizeyeB"); + pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->icon->id); + pUIAnum_Torchlight->icon = pIconsFrameTable->GetIcon("torchB"); + pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->icon->id); + ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-b", 0x7FF); - game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc-b", 0x7FF); ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven-b", 0x7FF); messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll-b");
--- a/GUI/GUIWindow.h Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/GUIWindow.h Wed Mar 09 01:39:52 2016 +0200 @@ -867,8 +867,6 @@ extern std::array<GUIButton*, 4> pCreationUI_BtnPressLeft; extern std::array<GUIButton*, 4> pCreationUI_BtnPressRight; -extern int uTextureID_GameUI_CharSelectionFrame; // 50C98C - extern unsigned int ui_mainmenu_copyright_color; extern unsigned int ui_character_tooltip_header_default_color; extern unsigned int ui_character_default_text_color;
--- a/GUI/UI/Chest.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/Chest.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -57,10 +57,10 @@ auto uChestID = (unsigned int)ptr_1C; int chestBitmapId; // eax@1 - unsigned int v5; // eax@1 + //Image *v5; // eax@1 int chest_item_index; // ecx@3 - unsigned int item_texture_id; // eax@4 - Texture_MM7 *item_texture; // esi@4 + //unsigned int item_texture_id; // eax@4 + //Texture_MM7 *item_texture; // esi@4 signed int itemPixelWidth; // ecx@4 signed int itemPixelHeght; // edx@4 // signed int v11; // eax@4 @@ -84,20 +84,26 @@ chestWidthCells = pChestWidthsByType[chestBitmapId]; chestHeghtCells = pChestHeightsByType[chestBitmapId]; sprintfex(pTmpBuf.data(), "chest%02d", pChestList->pChests[chestBitmapId].uTextureID); - v5 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureTransparentColorKey(8u, 8u, pIcons_LOD->GetTexture(v5)); + + //v5 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + auto chest_background = assets->GetImage_16BitColorKey(pTmpBuf.data(), 0x7FF); + pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, chest_background); for (item_counter = 0; item_counter < chestWidthCells * chestHeghtCells; ++item_counter) { chest_item_index = pChests[uChestID].pInventoryIndices[item_counter]; if (chest_item_index > 0) { - item_texture_id = pIcons_LOD->LoadTexture( - //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, - pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), TEXTURE_16BIT_PALETTE); - item_texture = pIcons_LOD->GetTexture(item_texture_id); - itemPixelWidth = item_texture->uTextureWidth; - itemPixelHeght = item_texture->uTextureHeight; + //item_texture_id = pIcons_LOD->LoadTexture( + // //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, + // pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), TEXTURE_16BIT_PALETTE); + //item_texture = pIcons_LOD->GetTexture(item_texture_id); + //itemPixelWidth = item_texture->uTextureWidth; + //itemPixelHeght = item_texture->uTextureHeight; + auto item_texture = assets->GetImage_16BitColorKey(pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), 0x7FF); + itemPixelWidth = item_texture->GetWidth(); + itemPixelHeght = item_texture->GetHeight(); + if (itemPixelWidth < 14) itemPixelWidth = 14; v12 = itemPixelWidth - 14; @@ -107,9 +113,9 @@ itemPixelHeght = 14; itemPixelPosX = chest_offs_x + 32 * (item_counter % chestWidthCells) + ((signed int)(v13 - itemPixelWidth) / 2); itemPixelPosY = chest_offs_y + 32 * (item_counter / chestHeghtCells) + - ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32 - item_texture->uTextureHeight) / 2); - pRenderer->DrawTextureIndexedAlpha(itemPixelPosX, itemPixelPosY, item_texture); - ZBuffer_DoFill2(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1); + ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32 - item_texture->GetHeight()) / 2); + pRenderer->DrawTextureAlphaNew(itemPixelPosX/640.0f, itemPixelPosY/480.0f, item_texture); + //ZBuffer_DoFill2(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1); } } pRenderer->DrawTextureAlphaNew(pBtn_ExitCancel->uX/640.0f, pBtn_ExitCancel->uY/480.0f, ui_exit_cancel_button_background);
--- a/GUI/UI/UIArena.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIArena.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -165,7 +165,6 @@ pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, 0x7FF); - //Texture_MM7* pTex = pIcons_LOD->GetTexture(ui_leather_mm7); pRenderer->DrawTextureCustomHeight( 8/640.0f, (352 - v0)/480.0f,
--- a/GUI/UI/UICharacter.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UICharacter.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -533,10 +533,11 @@ CharacterUI_ReleaseButtons(); ReleaseAwardsScrollBar(); CharacterUI_StatsTab_Draw(player); - pRenderer->DrawTextureTransparentColorKey( - pCharacterScreen_StatsBtn->uX, - pCharacterScreen_StatsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE) + pRenderer->DrawTextureAlphaNew( + pCharacterScreen_StatsBtn->uX/640.0f, + pCharacterScreen_StatsBtn->uY/480.0f, + //pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE) + assets->GetImage_16BitColorKey("ib-cd1-d", 0x7FF) ); } break; @@ -550,10 +551,11 @@ } ReleaseAwardsScrollBar(); CharacterUI_SkillsTab_Draw(player); - pRenderer->DrawTextureTransparentColorKey( - pCharacterScreen_SkillsBtn->uX, - pCharacterScreen_SkillsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE) + pRenderer->DrawTextureAlphaNew( + pCharacterScreen_SkillsBtn->uX/640.0f, + pCharacterScreen_SkillsBtn->uY/480.0f, + //pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE) + assets->GetImage_16BitColorKey("ib-cd2-d", 0x7FF) ); } break; @@ -564,10 +566,11 @@ ReleaseAwardsScrollBar(); CreateAwardsScrollBar(); CharacterUI_AwardsTab_Draw(player); - pRenderer->DrawTextureTransparentColorKey( - pCharacterScreen_AwardsBtn->uX, - pCharacterScreen_AwardsBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE) + pRenderer->DrawTextureAlphaNew( + pCharacterScreen_AwardsBtn->uX/640.0f, + pCharacterScreen_AwardsBtn->uY/480.0f, + //pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE) + assets->GetImage_16BitColorKey("ib-cd4-d", 0x7FF) ); } break; @@ -577,10 +580,11 @@ CharacterUI_ReleaseButtons(); ReleaseAwardsScrollBar(); CharacterUI_InventoryTab_Draw(player, false); - pRenderer->DrawTextureTransparentColorKey( - pCharacterScreen_InventoryBtn->uX, - pCharacterScreen_InventoryBtn->uY, - pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE) + pRenderer->DrawTextureAlphaNew( + pCharacterScreen_InventoryBtn->uX/640.0f, + pCharacterScreen_InventoryBtn->uY/480.0f, + //pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE) + assets->GetImage_16BitColorKey("ib-cd3-d", 0x7FF) ); } break;
--- a/GUI/UI/UIGame.h Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIGame.h Wed Mar 09 01:39:52 2016 +0200 @@ -62,15 +62,6 @@ extern class Image *game_ui_monster_hp_border_left; extern class Image *game_ui_monster_hp_border_right; -extern class Image *game_ui_bar_red; -extern class Image *game_ui_bar_yellow; -extern class Image *game_ui_bar_green; -extern class Image *game_ui_bar_blue; - -extern class Image *game_ui_player_alert_yellow; // 5079C8 -extern class Image *game_ui_player_alert_red; // 5079CC -extern class Image *game_ui_player_alert_green; // 5079D0 - extern class Image *game_ui_minimap_frame; // 5079D8 extern class Image *game_ui_minimap_compass; // 5079B4 extern std::array<class Image *, 8> game_ui_minimap_dirs; @@ -100,4 +91,24 @@ extern std::array<class Image *, 5> game_ui_options_controls; -extern class Image *game_ui_evtnpc; // 50795C \ No newline at end of file +extern class Image *game_ui_evtnpc; // 50795C + + +extern std::array< std::array<class Image *, 56>, 4> game_ui_player_faces; +extern class Image *game_ui_player_face_eradicated; +extern class Image *game_ui_player_face_dead; + +extern class Image *game_ui_player_selection_frame; // 50C98C +extern class Image *game_ui_player_alert_yellow; // 5079C8 +extern class Image *game_ui_player_alert_red; // 5079CC +extern class Image *game_ui_player_alert_green; // 5079D0 + +extern class Image *game_ui_bar_red; +extern class Image *game_ui_bar_yellow; +extern class Image *game_ui_bar_green; +extern class Image *game_ui_bar_blue; + +extern class Image *game_ui_playerbuff_pain_reflection; +extern class Image *game_ui_playerbuff_hammerhands; +extern class Image *game_ui_playerbuff_preservation; +extern class Image *game_ui_playerbuff_bless; \ No newline at end of file
--- a/GUI/UI/UIGuilds.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIGuilds.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -166,8 +166,8 @@ { if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID ) { - pRenderer->DrawTextureIndexedAlpha(pX, 90, ItemsInShopTexture[v6]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); + pRenderer->DrawTextureAlphaNew(pX/640.0f, 90/480.0f, shop_ui_items_in_store[v6]); + //ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), shop_ui_items_in_store[v6], v6 + 1); } v62 += 280; ++v6; @@ -178,8 +178,8 @@ { if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) { - pRenderer->DrawTextureIndexedAlpha(pX, 250, ItemsInShopTexture[v7]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); + pRenderer->DrawTextureAlphaNew(pX/640.0f, 250/480.0f, shop_ui_items_in_store[v7]); + //ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), shop_ui_items_in_store[v7], v7 + 1); } v62 += 280; ++v7; @@ -271,7 +271,8 @@ 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); + + shop_ui_items_in_store[i] = assets->GetImage_16BitColorKey(pItemsTable->pItems[pItemNum].pIconName, 0x7FF); } return; } \ No newline at end of file
--- a/GUI/UI/UIHouses.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIHouses.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -996,12 +996,12 @@ char icon_name[128]; sprintfex(icon_name, "npc%03u", npc_id_arr[i]); - pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); + pDialogueNPCPortraits[i] = assets->GetImage_16BitColorKey(icon_name, 0x7FF); } if (uHouse_ExitPic) { - pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); + pDialogueNPCPortraits[uNumDialogueNPCPortraits] = assets->GetImage_16BitColorKey(pHouse_ExitPictures[uHouse_ExitPic], 0x7FF); ++uNumDialogueNPCPortraits; uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; } @@ -1097,7 +1097,7 @@ 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)]; + shop_ui_items_in_store[i] = assets->GetImage_16BitColorKey(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), 0x7FF); } } else//generation new books @@ -1340,7 +1340,7 @@ 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)]; + shop_ui_items_in_store[i] = assets->GetImage_16BitColorKey(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), 0x7FF); } } if ( in_current_building_type == BuildingType_WeaponShop ) @@ -1350,7 +1350,7 @@ 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); + weapons_Ypos[i] = rand() % (300 - shop_ui_items_in_store[i]->GetHeight()); } } } @@ -1362,7 +1362,7 @@ 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)]; + shop_ui_items_in_store[i] = assets->GetImage_16BitColorKey(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), 0x7FF); } } if ( in_current_building_type == BuildingType_WeaponShop ) @@ -1372,7 +1372,7 @@ 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); + weapons_Ypos[i] = rand() % (300 - shop_ui_items_in_store[i]->GetHeight()); } } }
--- a/GUI/UI/UIMainMenu.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIMainMenu.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -67,9 +67,21 @@ // pWindow = pGUIWindow_CurrentMenu; + static bool b = false; + if (!b) + { + pUIAnim_Food->icon = pIconsFrameTable->GetIcon("torchA"); + pIconsFrameTable->InitializeAnimation(pUIAnim_Food->icon->id); + b = true; + } + + auto icon = pIconsFrameTable->GetFrame(pUIAnim_Food->icon->id, GetTickCount()/2); + pRenderer->DrawTextureAlphaNew(64 / 640.0f, 48 / 480.0f, icon->texture); + + if (GetCurrentMenuID() == MENU_MAIN) { - Texture_MM7 *pTexture = nullptr; + Image *pTexture = nullptr; if (!pModalWindow)// ??? { auto pButton = pWindow->pControlsHead; @@ -84,23 +96,23 @@ switch (pControlParam) // backlight for buttons { case 0: - pTexture = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); + pTexture = assets->GetImage_16BitColorKey("title_new", 0x7FF); pY = 172; break; case 1: - pTexture = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); + pTexture = assets->GetImage_16BitColorKey("title_load", 0x7FF); pY = 227; break; case 2: - pTexture = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); + pTexture = assets->GetImage_16BitColorKey("title_cred", 0x7FF); pY = 282; break; case 3: - pTexture = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); + pTexture = assets->GetImage_16BitColorKey("title_exit", 0x7FF); pY = 337; break; } - pRenderer->DrawTextureTransparentColorKey(495, pY, pTexture); + pRenderer->DrawTextureAlphaNew(495/640.0f, pY/480.0f, pTexture); } } }
--- a/GUI/UI/UIPartyCreation.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIPartyCreation.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -16,8 +16,9 @@ #include "IO/Mouse.h" #include "IO/Keyboard.h" +#include "GUI/GUIFont.h" #include "GUI/UI/UIPartyCreation.h" -#include "GUI/GUIFont.h" +#include "GUI/UI/UIGame.h" #include "Media/Audio/AudioPlayer.h" @@ -74,11 +75,11 @@ 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); + game_ui_player_faces[i][j] = assets->GetImage_16BitColorKey(pTmpBuf.data(), 0x7FF); } - pTexture_PlayerFaceEradicated = pIcons_LOD->LoadTexturePtr("ERADCATE", TEXTURE_16BIT_PALETTE); - pTexture_PlayerFaceDead = pIcons_LOD->LoadTexturePtr("DEAD", TEXTURE_16BIT_PALETTE); + game_ui_player_face_eradicated = assets->GetImage_16BitColorKey("ERADCATE", 0x7FF); + game_ui_player_face_dead = assets->GetImage_16BitColorKey("DEAD", 0x7FF); ui_partycreation_face_mask = assets->GetImage_16BitColorKey("FACEMASK", 0x7FF); if (SoundSetAction[24][0]) @@ -95,7 +96,8 @@ 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); + //pIcons_LOD->ReloadTexture(game_ui_player_faces[player_id][i], pTmpBuf.data(), 2); + game_ui_player_faces[player_id][i] = assets->GetImage_16BitColorKey(pTmpBuf.data(), 0x7FF); } } @@ -105,7 +107,7 @@ void GUIWindow_PartyCreation::Update() { int pTextCenter; // eax@3 - IconFrame *pFrame; // eax@3 + Icon *pFrame; // eax@3 int pX; // ecx@7 GUIButton *uPosActiveItem; // edi@12 int v17; // eax@33 @@ -153,10 +155,10 @@ pRenderer->DrawTextureAlphaNew(176/640.0f, 35/480.0f, ui_partycreation_portraits[pParty->pPlayers[1].uCurrentFace]); pRenderer->DrawTextureAlphaNew(335/640.0f, 35/480.0f, ui_partycreation_portraits[pParty->pPlayers[2].uCurrentFace]); pRenderer->DrawTextureAlphaNew(494/640.0f, 35/480.0f, ui_partycreation_portraits[pParty->pPlayers[3].uCurrentFace]); - pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime); //arrows - pRenderer->DrawTextureIndexedAlpha(pX, 29, &pIcons_LOD->pTextures[pFrame->uTextureID]); + pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime); + pRenderer->DrawTextureAlphaNew(pX/640.0f, 29/480.0f, pFrame->texture); uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem); uPlayerCreationUI_ArrowAnim = 18 - (GetTickCount() % 450) / 25; pRenderer->DrawTextureAlphaNew((uPosActiveItem->uZ - 4)/640.0f, uPosActiveItem->uY/480.0f, ui_partycreation_arrow_l[uPlayerCreationUI_ArrowAnim + 1]);
--- a/GUI/UI/UIPopup.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIPopup.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -208,6 +208,9 @@ if (!inspect_item->uItemID) return; + + auto inspect_item_image = assets->GetImage_16BitColorKey(inspect_item->GetIconName(), 0x7FF); + iteminfo_window.Hint = nullptr; iteminfo_window.uFrameWidth = 384; iteminfo_window.uFrameHeight = 180; @@ -217,8 +220,8 @@ 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; + v78 = 100 - inspect_item_image->GetWidth(); + v81 = 144 - inspect_item_image->GetHeight(); if ( v78 > 0 ) v78 = v78 / 2; if ( v81 <= 0 ) @@ -284,7 +287,7 @@ (iteminfo_window.uFrameX + v78) / 640.0f, (v81 + iteminfo_window.uFrameY + 30) / 480.0f, //pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); - assets->GetImage_16BitAlpha(inspect_item->GetIconName())); + inspect_item_image); if ( inspect_item->IsIdentified()) pText = (char *)inspect_item->GetIdentifiedName(); else @@ -293,11 +296,13 @@ 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->ResetUIClipRect(); - if ( !areWeLoadingTexture ) + + if (inspect_item_image) { - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + inspect_item_image->Release(); + inspect_item_image = nullptr; } + return; } if (!inspect_item->IsIdentified()) @@ -309,15 +314,19 @@ 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->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); + pRenderer->DrawTextureAlphaNew( + (iteminfo_window.uFrameX + v78)/640.0f, + (v81 + iteminfo_window.uFrameY + 30)/480.0f, + inspect_item_image); 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->ResetUIClipRect(); - if ( !areWeLoadingTexture ) + + if (inspect_item_image) { - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); - pIcons_LOD->SyncLoadedFilesCount(); + inspect_item_image->Release(); + inspect_item_image = nullptr; } return; } @@ -421,9 +430,11 @@ 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->DrawTextureIndexedAlpha(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)); + pRenderer->DrawTextureAlphaNew( + (iteminfo_window.uFrameX + v78)/640.0f, + (iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - inspect_item_image->GetHeight()) / 2)/480.0f, + inspect_item_image + ); v34 = (int)(v85 + 35); Str = out_text; @@ -507,8 +518,6 @@ } return; } -// 4E455C: using guessed type int dword_4E455C; -// 506128: using guessed type int areWeLoadingTexture; //----- (0041E360) -------------------------------------------------------- void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow)
--- a/GUI/UI/UIQuickReference.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIQuickReference.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -12,6 +12,9 @@ #include "Media/Audio/AudioPlayer.h" + +Image *ui_game_quickref_background = nullptr; + GUIWindow_QuickReference::GUIWindow_QuickReference() : GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 5, 0) { @@ -22,6 +25,9 @@ //paperdoll_dbrds[2] = assets->GetImage_16BitAlpha(L"BUTTEXI1"); + if (!ui_game_quickref_background) + ui_game_quickref_background = assets->GetImage_16BitColorKey("quikref", 0x7FF); + pBtn_ExitCancel = CreateButton( 0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],// "Exit" @@ -48,7 +54,8 @@ const char *pText; // eax@38 int pFontHeight; // [sp+18h] [bp-14h]@1 - pRenderer->DrawTextureTransparentColorKey(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); + pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, ui_game_quickref_background); + pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1; for (uint i = 0; i < 4; ++i) {
--- a/GUI/UI/UIRest.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIRest.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -47,7 +47,7 @@ GUIButton2.uHeight = 37; GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); - pRenderer->DrawTextureTransparentColorKey(uFrameX, uFrameY, *((Texture_MM7 **)ptr_1C + 15)); + pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, *((Image **)ptr_1C + 15)); viewparams->bRedrawGameUI = 1; GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0); // Rest & Heal 8 hrs / Отдых и лечение 8 часов GUIButton2.pParent = 0;
--- a/GUI/UI/UIShops.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIShops.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -26,6 +26,8 @@ Image *shop_ui_background = nullptr; +std::array<Image *, 12> shop_ui_items_in_store; + //----- (004B910F) -------------------------------------------------------- void WeaponShopDialog() @@ -92,8 +94,11 @@ { if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) { - pRenderer->DrawTextureIndexedAlpha((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); + pRenderer->DrawTextureAlphaNew( + ((60 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + item_X)/640.0f, + (weapons_Ypos[i] + 30)/480.0f, + shop_ui_items_in_store[i]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)shop_ui_items_in_store[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], shop_ui_items_in_store[i], i + 1); } item_X += 70; } @@ -143,8 +148,11 @@ { if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) { - pRenderer->DrawTextureIndexedAlpha((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); + pRenderer->DrawTextureAlphaNew( + ((60 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + item_X)/640.0f, + (weapons_Ypos[i] + 30)/480.0f, + shop_ui_items_in_store[i]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)shop_ui_items_in_store[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], shop_ui_items_in_store[i], i + 1); } item_X += 70; } @@ -420,15 +428,21 @@ { if ( i >= 4 ) //low row { - pRenderer->DrawTextureIndexedAlpha((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); - v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; + pRenderer->DrawTextureAlphaNew( + ((90 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x - 420)/640.0f, + 126/480.0f, + shop_ui_items_in_store[i]); + v59 = (90 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x + 80220; } else { - pRenderer->DrawTextureIndexedAlpha(( 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); + pRenderer->DrawTextureAlphaNew( + ((86 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x)/640.0f, + (98 - shop_ui_items_in_store[i]->GetWidth())/480.0f, + shop_ui_items_in_store[i]); + v59 = item_x + (86 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + window->GetWidth() * (98 - shop_ui_items_in_store[i]->GetHeight()); } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); + //ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], shop_ui_items_in_store[i], i + 1); } item_x += 105; } @@ -479,15 +493,21 @@ { if ( i >= 4 ) { - pRenderer->DrawTextureIndexedAlpha(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); - v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; + pRenderer->DrawTextureAlphaNew( + (item_x + (90 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) - 420)/640.0f, + 126/480.0f, + shop_ui_items_in_store[i]); + v59 = item_x + (90 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + 80220; } else { - pRenderer->DrawTextureIndexedAlpha(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); + pRenderer->DrawTextureAlphaNew( + (86 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2) + item_x)/640.0f, + (98 - shop_ui_items_in_store[i]->GetHeight())/480.0f, + shop_ui_items_in_store[i]); + v59 = (86 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x + window->GetWidth() * (98 - shop_ui_items_in_store[i]->GetHeight()); } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); + //ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], shop_ui_items_in_store[i], i + 1); } item_x += 105; } @@ -764,38 +784,38 @@ { if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight(); if ( (signed int)product_height_1row < 1 ) product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth()) + product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth(); } } else if ( (signed int)product_width_1row < 18 ) product_width_1row = 18; - pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[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; + product_height_2row = 308 - shop_ui_items_in_store[i + 6]->GetHeight(); if ( (signed int)product_height_2row < 1 ) product_height_2row = 0; - product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth()) + product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth(); } } else @@ -803,8 +823,8 @@ if ( (signed int)product_width_2row < 18 ) product_width_2row = 18; } - pRenderer->DrawTextureIndexedAlpha(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); + pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7); } } if ( HouseUI_CheckIfPlayerCanInteract() ) @@ -849,16 +869,16 @@ { if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight(); if ( (signed int)product_height_1row < 1 ) product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth()) + product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth(); } } else @@ -866,24 +886,24 @@ if ( (signed int)product_width_1row < 18 ) product_width_1row = 18; } - pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[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; + product_height_2row = 308 - shop_ui_items_in_store[i + 6]->GetHeight(); if ( (signed int)product_height_2row < 1 ) product_height_2row = 0; - product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth()) + product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth(); } } else @@ -891,8 +911,8 @@ if ( (signed int)product_width_2row < 18 ) product_width_2row = 18; } - pRenderer->DrawTextureIndexedAlpha(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); + pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7); } } if ( HouseUI_CheckIfPlayerCanInteract() ) @@ -1138,16 +1158,16 @@ { if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight(); if ( (signed int)product_height_1row < 1 ) product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth()) + product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth(); } } else @@ -1155,22 +1175,22 @@ if ( (signed int)product_width_1row < 18 ) product_width_1row = 18; } - pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[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; + product_height_2row = 306 - shop_ui_items_in_store[i + 6]->GetHeight(); + product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth()) + product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth(); } } else @@ -1178,8 +1198,8 @@ if ( (signed int)product_width_2row < 18 ) product_width_2row = 18; } - pRenderer->DrawTextureIndexedAlpha(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); + pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7); } } if ( HouseUI_CheckIfPlayerCanInteract() ) @@ -1224,16 +1244,16 @@ { if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) { - product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight; + product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight(); if ( (signed int)product_height_1row < 1 ) product_height_1row = 0; - product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40; + product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth ) - product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth()) + product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth(); } } else @@ -1241,24 +1261,24 @@ if ( (signed int)product_width_1row < 18 ) product_width_1row = 18; } - pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1); + pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[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; + product_height_2row = 306 - shop_ui_items_in_store[i + 6]->GetHeight(); if ( (signed int)product_height_2row < 1 ) product_height_2row = 0; - product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40; + product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40; if ( i ) { if ( i == 5 ) { - if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth ) - product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth()) + product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth(); } } else @@ -1266,8 +1286,8 @@ if ( (signed int)product_width_2row < 18 ) product_width_2row = 18; } - pRenderer->DrawTextureIndexedAlpha(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); + pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]); + //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7); } } if ( HouseUI_CheckIfPlayerCanInteract() )
--- a/GUI/UI/UIShops.h Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UIShops.h Wed Mar 09 01:39:52 2016 +0200 @@ -6,4 +6,6 @@ void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd); -extern class Image *shop_ui_background; \ No newline at end of file +extern class Image *shop_ui_background; + +extern std::array<class Image *, 12> shop_ui_items_in_store; \ No newline at end of file
--- a/GUI/UI/UiGame.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UiGame.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -44,8 +44,6 @@ #include "Media/Audio/AudioPlayer.h" -int uTextureID_GameUI_CharSelectionFrame; // 50C98C - Image *game_ui_statusbar = nullptr; Image *game_ui_rightframe = nullptr; @@ -60,15 +58,6 @@ Image *game_ui_monster_hp_border_left = nullptr; Image *game_ui_monster_hp_border_right = nullptr; -Image *game_ui_bar_red = nullptr; -Image *game_ui_bar_yellow = nullptr; -Image *game_ui_bar_green = nullptr; -Image *game_ui_bar_blue = nullptr; - -Image *game_ui_player_alert_yellow = nullptr; // 5079C8 -Image *game_ui_player_alert_red = nullptr; // 5079CC -Image *game_ui_player_alert_green = nullptr; // 5079D0 - Image *game_ui_minimap_frame = nullptr; // 5079D8 Image *game_ui_minimap_compass = nullptr; // 5079B4 std::array<Image *, 8> game_ui_minimap_dirs; @@ -105,6 +94,24 @@ Image *game_ui_evtnpc = nullptr; // 50795C +std::array< std::array<Image *, 56>, 4> game_ui_player_faces; +Image *game_ui_player_face_eradicated = nullptr; +Image *game_ui_player_face_dead = nullptr; + +Image *game_ui_player_selection_frame = nullptr; // 50C98C +Image *game_ui_player_alert_yellow = nullptr; // 5079C8 +Image *game_ui_player_alert_red = nullptr; // 5079CC +Image *game_ui_player_alert_green = nullptr; // 5079D0 + +Image *game_ui_bar_red = nullptr; +Image *game_ui_bar_yellow = nullptr; +Image *game_ui_bar_green = nullptr; +Image *game_ui_bar_blue = nullptr; + +Image *game_ui_playerbuff_pain_reflection = nullptr; +Image *game_ui_playerbuff_hammerhands = nullptr; +Image *game_ui_playerbuff_preservation = nullptr; +Image *game_ui_playerbuff_bless = nullptr; GUIWindow_GameMenu::GUIWindow_GameMenu() : GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) @@ -759,9 +766,11 @@ popup_window.uFrameZ = popup_window.uFrameX + 399; popup_window.DrawMessageBox(0); sprintfex(pTmpBuf2.data(), "NPC%03d", pNPC->uPortraitID); - pRenderer->DrawTextureTransparentColorKey(popup_window.uFrameX + 22, popup_window.uFrameY + 36, - (Texture_MM7 *)(pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE) != -1 - ? &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE)] : 0)); + pRenderer->DrawTextureAlphaNew( + (popup_window.uFrameX + 22)/640.0f, + (popup_window.uFrameY + 36)/480.0f, + assets->GetImage_16BitColorKey(pTmpBuf2.data(), 0x7FF) + ); if ( pNPC->uProfession ) { v11 = pTmpBuf.data(); @@ -814,7 +823,7 @@ game_ui_dialogue_background = assets->GetImage_16Bit(pContainer); sprintfex(pContainer, "npc%03u", pNPCInfo->uPortraitID); v9 = 0; - pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + pDialogueNPCPortraits[0] = assets->GetImage_16BitColorKey(pContainer, 0x7FF); dword_591084 = areWeLoadingTexture; if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 ) @@ -916,7 +925,7 @@ pRenderer->DrawTextureNew(477/640.0f, 0, game_ui_dialogue_background); pRenderer->DrawTextureAlphaNew(468/640.0f, 0, game_ui_right_panel_frame); pRenderer->DrawTextureAlphaNew((pNPCPortraits_x[0][0] - 4)/640.0f, (pNPCPortraits_y[0][0] - 4)/480.0f, game_ui_evtnpc); - pRenderer->DrawTextureTransparentColorKey(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[0]); + pRenderer->DrawTextureAlphaNew(pNPCPortraits_x[0][0]/640.0f, pNPCPortraits_y[0][0]/480.0f, pDialogueNPCPortraits[0]); if (pNPC->uProfession) { @@ -1306,7 +1315,7 @@ //----- (0041D3B7) -------------------------------------------------------- void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player) { - Texture_MM7 *v13; // eax@6 + Image *v13; // eax@6 PlayerFrame *v15; // eax@12 unsigned int pTextColor; // eax@15 const char *v29; // eax@16 @@ -1326,9 +1335,9 @@ window->DrawMessageBox(0); if (player->IsEradicated()) - v13 = pTexture_PlayerFaceEradicated; + v13 = game_ui_player_face_eradicated; else if (player->IsDead()) - v13 = pTexture_PlayerFaceDead; + v13 = game_ui_player_face_dead; else { uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(player->expression); @@ -1339,10 +1348,10 @@ 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]; + v13 = game_ui_player_faces[(unsigned int)window->ptr_1C][v15->uTextureID - 1]; } - pRenderer->DrawTextureIndexedAlpha(window->uFrameX + 24, window->uFrameY + 24, v13); + pRenderer->DrawTextureAlphaNew((window->uFrameX + 24)/640.0f, (window->uFrameY + 24)/480.0f, 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" @@ -1951,15 +1960,17 @@ void GameUI_DrawCharacterSelectionFrame() { if ( uActiveCharacter ) - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380, - pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame)); + pRenderer->DrawTextureAlphaNew( + (pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9)/640.0f, + 380/480.0f, + game_ui_player_selection_frame); } //----- (0044162D) -------------------------------------------------------- void GameUI_DrawPartySpells() { unsigned int v0; // ebp@1 - Texture_MM7 *spell_texture; // [sp-4h] [bp-1Ch]@12 + Image *spell_texture; // [sp-4h] [bp-1Ch]@12 //Texture_MM7 *v9; // [sp-4h] [bp-1Ch]@21 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); @@ -1971,9 +1982,11 @@ { Texture_MM7* 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); + pRenderer->_4A65CC( + pPartySpellbuffsUI_XYs[i][0], + pPartySpellbuffsUI_XYs[i][1], tex, tex, + v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63 + ); } //++v1; } @@ -1983,22 +1996,22 @@ if (pParty->FlyActive()) { if ( pParty->bFlying ) - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->texture; else - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->texture; //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureTransparentColorKey(8, 8, spell_texture); + pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, spell_texture); /*else pRenderer->DrawTextureIndexedAlpha(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); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->texture; else - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->texture; //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureTransparentColorKey(396, 8, spell_texture); + pRenderer->DrawTextureAlphaNew(396/640.0f, 8/480.0f, spell_texture); /*else pRenderer->DrawTextureIndexedAlpha(396, 8, v9);*/ } @@ -2006,13 +2019,13 @@ for (uint i = 0; i < 4; ++i) { if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 427/480.0f, game_ui_playerbuff_hammerhands); if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 393/480.0f, game_ui_playerbuff_bless); if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 410/480.0f, game_ui_playerbuff_preservation); if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 444/480.0f, game_ui_playerbuff_pain_reflection); } } @@ -2021,7 +2034,7 @@ { unsigned int face_expression_ID; // eax@17 PlayerFrame *pFrame; // eax@21 - Texture_MM7 *pPortrait; // [sp-4h] [bp-1Ch]@27 + Image *pPortrait; // [sp-4h] [bp-1Ch]@27 if ( _A750D8_player_speech_timer ) { @@ -2039,11 +2052,11 @@ Player* pPlayer = &pParty->pPlayers[i]; if ( pPlayer->IsEradicated() ) { - pPortrait = pTexture_PlayerFaceEradicated; + pPortrait = game_ui_player_face_eradicated; if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); else - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, 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 ) @@ -2052,11 +2065,11 @@ } if (pPlayer->IsDead()) { - pPortrait = pTexture_PlayerFaceDead; + pPortrait = game_ui_player_face_dead; if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); else - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, 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 ) @@ -2079,11 +2092,11 @@ if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) { pPlayer->field_1AA2 = pFrame->uTextureID - 1; - pPortrait = (Texture_MM7 *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture_MM7 *)pTextures_PlayerFaces[i][pFrame->uTextureID]; + pPortrait = game_ui_player_faces[i][pPlayer->field_1AA2];//pFace = (Texture_MM7 *)game_ui_player_faces[i][pFrame->uTextureID]; if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); else - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, 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 ) @@ -2483,13 +2496,19 @@ { if (pParty->TorchlightActive()) { - IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureIndexedAlpha(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); + pRenderer->DrawTextureAlphaNew( + pUIAnum_Torchlight->x/640.0f, + pUIAnum_Torchlight->y/480.0f, + pIconsFrameTable->GetFrame(pUIAnum_Torchlight->icon->id, pEventTimer->Time())->texture + ); } if (pParty->WizardEyeActive()) { - IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureIndexedAlpha(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); + pRenderer->DrawTextureAlphaNew( + pUIAnim_WizardEye->x/640.0f, + pUIAnim_WizardEye->y/480.0f, + pIconsFrameTable->GetFrame(pUIAnim_WizardEye->icon->id, pEventTimer->Time())->texture + ); } } } @@ -2530,14 +2549,22 @@ if ( (unsigned __int8)pTmpBuf[i] >= 2 ) { sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)pTmpBuf[i] + 499].uPortraitID); - pRenderer->DrawTextureTransparentColorKey(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); + pRenderer->DrawTextureAlphaNew( + pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, + pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, + //pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)) + assets->GetImage_16BitColorKey(pContainer, 0x7FF) + ); } else { sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].uPortraitID); - pRenderer->DrawTextureTransparentColorKey(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); + pRenderer->DrawTextureAlphaNew( + pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, + pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, + //pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)) + assets->GetImage_16BitColorKey(pContainer, 0x7FF) + ); if ( pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_A == 1 ) { uFrameID = pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_B; @@ -2546,12 +2573,16 @@ { for ( v13 = 0; v13 < pIconsFrameTable->uNumIcons; ++v13 ) { - if ( !_stricmp("spell96", pIconsFrameTable->pIcons[v13].pAnimationName) ) + if ( !_stricmp("spell96", pIconsFrameTable->pIcons[v13].GetAnimationName()) ) break; } } - pRenderer->DrawTextureIndexedAlpha(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(v13, uFrameID)->uTextureID]); + pRenderer->DrawTextureAlphaNew( + pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, + pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, + //&pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(v13, uFrameID)->uTextureID] + pIconsFrameTable->GetFrame(v13, uFrameID)->texture + ); } } ++pNPC_limit_ID;
--- a/Game/Game.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Game/Game.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -6,7 +6,6 @@ #include "Engine/Timer.h" #include "Engine/texts.h" #include "Engine/SaveLoad.h" -#include "Engine/Registry.h" #include "Engine/Objects/Actor.h" #include "Engine/Objects/Chest.h" #include "Engine/Objects/ObjectList.h"
--- a/Game/GameMenu.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Game/GameMenu.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -5,7 +5,6 @@ #include "Engine/LOD.h" #include "Engine/Party.h" #include "Engine/SaveLoad.h" -#include "Engine/Registry.h" #include "Engine/texts.h" #include "Engine/Graphics/IRender.h" #include "Engine/Graphics/Viewport.h"
--- a/IO/Keyboard.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/IO/Keyboard.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -6,7 +6,6 @@ #include "Engine/Engine.h" #include "Engine/Party.h" #include "Engine/Timer.h" -#include "Engine/Registry.h" #include "Engine/TurnEngine/TurnEngine.h" #include "Engine/Graphics/Vis.h" #include "Engine/Graphics/Weather.h"
--- a/Media/Audio/AudioPlayer.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Media/Audio/AudioPlayer.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -22,7 +22,6 @@ #include "Engine/MapInfo.h" #include "GUI/GUIWindow.h" #include "Engine/Graphics/Level/Decoration.h" -#include "Engine/Registry.h" #include "Media/Video/Bink_Smacker.h"
--- a/OSAPI.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/OSAPI.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -14,6 +14,80 @@ + + +bool ReadWindowsRegistryStringRecursive(HKEY parent_key, const char *path, char *out_string, int out_string_size) +{ + char current_key[128]; + char path_tail[1024]; + + const char *delimiter = strstr(path, "/"); + if (delimiter) + { + strncpy(current_key, path, delimiter - path); + current_key[delimiter - path] = '\0'; + + strcpy(path_tail, delimiter + 1); + + if (!parent_key) + { + if (!strcmpi(current_key, "HKEY_CLASSES_ROOT")) + parent_key = HKEY_CLASSES_ROOT; + else if (!strcmpi(current_key, "HKEY_CURRENT_CONFIG")) + parent_key = HKEY_CURRENT_CONFIG; + else if (!strcmpi(current_key, "HKEY_CURRENT_USER")) + parent_key = HKEY_CURRENT_USER; + else if (!strcmpi(current_key, "HKEY_LOCAL_MACHINE")) + parent_key = HKEY_LOCAL_MACHINE; + else if (!strcmpi(current_key, "HKEY_USERS")) + parent_key = HKEY_USERS; + else return false; + + delimiter = strstr(path_tail, "/"); + if (delimiter) + { + strncpy(current_key, path_tail, delimiter - path_tail); + current_key[delimiter - path_tail] = '\0'; + + strcpy(path_tail, delimiter + 1); + } + else return false; + } + + bool result = false; + HKEY key; + if (!RegOpenKeyExA(parent_key, current_key, 0, KEY_READ | KEY_WOW64_32KEY, &key)) + { + /*int idx = 0, r; + do { + char value_name[1024]; + DWORD value_name_size = sizeof(value_name); + r = RegEnumValueA(key, idx++, value_name, &value_name_size, nullptr, nullptr, nullptr, nullptr); + __debugbreak(); + } while (r == ERROR_SUCCESS);*/ + + result = ReadWindowsRegistryStringRecursive(key, path_tail, out_string, out_string_size); + RegCloseKey(key); + } + + return result; + } + else + { + DWORD data_size = out_string_size; + if (RegQueryValueExA(parent_key, path, nullptr, nullptr, (LPBYTE)out_string, &data_size)) + return false; + return true; + } +} + +bool ReadWindowsRegistryString(const char *path, char *out_string, int out_string_size) +{ + return ReadWindowsRegistryStringRecursive(nullptr, path, out_string, out_string_size); +} + + + //----- (00462C94) -------------------------------------------------------- int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hprevinstance, wchar_t *lpCmdLine, int nShowCmd) { @@ -24,8 +98,19 @@ #endif Log::Initialize(); - - //if (HWND hMM7Window = FindWindowW(L"MM7", 0)) + + bool mm7_installation_found = false; + char mm7_path[2048]; + + // standard 1.0 installation + if (!mm7_installation_found) + mm7_installation_found = ReadWindowsRegistryString("HKEY_LOCAL_MACHINE/SOFTWARE/New World Computing/Might and Magic VII/1.0/AppPath", mm7_path, sizeof(mm7_path)); + + // GoG version + if (!mm7_installation_found) + mm7_installation_found = ReadWindowsRegistryString("HKEY_LOCAL_MACHINE/SOFTWARE/GOG.com/GOGMM7/PATH", mm7_path, sizeof(mm7_path)); + + if (HWND hMM7Window = FindWindowW(L"M&MTrilogy", 0))//check whether the window is open { if (IsIconic(hMM7Window)) @@ -53,4 +138,175 @@ void MsgBox(const wchar_t *msg, const wchar_t *title) { MessageBoxW(nullptr, msg, title, 0); +} + + + + +//----- (004649EF) -------------------------------------------------------- +int ReadWindowsRegistryInt(const char *pKey, int uDefValue) +{ + DWORD cbData; // [sp+8h] [bp-20h]@1 + LPCSTR lpValueName; // [sp+Ch] [bp-1Ch]@1 + DWORD dwDisposition; // [sp+10h] [bp-18h]@2 + BYTE Data[4]; // [sp+14h] [bp-14h]@5 + HKEY hKey; // [sp+18h] [bp-10h]@1 + HKEY phkResult; // [sp+1Ch] [bp-Ch]@1 + HKEY v10; // [sp+20h] [bp-8h]@1 + HKEY v11; // [sp+24h] [bp-4h]@1 + + lpValueName = pKey; + v11 = 0; + v10 = 0; + hKey = 0; + phkResult = 0; + cbData = 4; + if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ | KEY_WOW64_32KEY, &hKey))// for 64 bit + { + if (!RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) + { + if (!RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v10, &dwDisposition)) + { + if (!RegCreateKeyExA(v10, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v11, &dwDisposition)) + { + LSTATUS status; + if (status = RegQueryValueExA(v11, lpValueName, 0, 0, Data, &cbData)) + { + status; + GetLastError(); + + *(int *)Data = uDefValue; + RegSetValueExA(v11, lpValueName, 0, 4, Data, 4); + } + RegCloseKey(v11); + } + RegCloseKey(v10); + } + RegCloseKey(phkResult); + } + RegCloseKey(hKey); + } + return *(int *)Data; +} + +//----- (00464B02) -------------------------------------------------------- +void WriteWindowsRegistryString(const char *pKey, const char *pString) +{ + size_t v2; // eax@5 + const char *lpValueName; // [sp+4h] [bp-1Ch]@1 + const char *Str; // [sp+8h] [bp-18h]@1 + DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 + HKEY hKey; // [sp+10h] [bp-10h]@1 + HKEY phkResult; // [sp+14h] [bp-Ch]@1 + HKEY v8; // [sp+18h] [bp-8h]@1 + HKEY v9; // [sp+1Ch] [bp-4h]@1 + + Str = pString; + lpValueName = pKey; + v9 = 0; + v8 = 0; + hKey = 0; + phkResult = 0; + if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ | KEY_WOW64_32KEY, &hKey)) + { + if (!RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) + { + if (!RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v8, &dwDisposition)) + { + if (!RegCreateKeyExA(v8, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v9, &dwDisposition)) + { + v2 = strlen(Str); + RegSetValueExA(v9, lpValueName, 0, 1, (const BYTE *)Str, v2 + 1); + RegCloseKey(v9); + } + RegCloseKey(v8); + } + RegCloseKey(phkResult); + } + RegCloseKey(hKey); + } +} + + +//----- (00464BEF) -------------------------------------------------------- +void ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue) +{ + //LSTATUS (__stdcall *v4)(HKEY); // esi@1 + LSTATUS result; // eax@7 + DWORD Type; // [sp+Ch] [bp-24h]@5 + LPCSTR lpValueName; // [sp+10h] [bp-20h]@1 + DWORD cbData; // [sp+14h] [bp-1Ch]@1 + LPBYTE Dest; // [sp+18h] [bp-18h]@1 + DWORD dwDisposition; // [sp+1Ch] [bp-14h]@2 + HKEY phkResult; // [sp+20h] [bp-10h]@1 + HKEY hKey; // [sp+24h] [bp-Ch]@1 + HKEY v13; // [sp+28h] [bp-8h]@1 + HKEY v14; // [sp+2Ch] [bp-4h]@1 + + cbData = uBufLen; + Dest = (LPBYTE)pOutString; + lpValueName = pKeyName; + v14 = 0; + v13 = 0; + hKey = 0; + phkResult = 0; + result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); + if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ | KEY_WOW64_32KEY, &hKey)) + { + if (!RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) + { + if (!RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v13, &dwDisposition)) + { + if (!RegCreateKeyExA(v13, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v14, &dwDisposition)) + { + if (RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData)) + GetLastError(); + RegCloseKey(v14); + v14 = NULL; + } + RegCloseKey(v13); + v13 = NULL; + } + RegCloseKey(phkResult); + phkResult = NULL; + } + RegCloseKey(hKey); + hKey = NULL; + } +} + +//----- (00464D32) -------------------------------------------------------- +void WriteWindowsRegistryInt(const char *pKey, int val) +{ + const char *lpValueName; // [sp+4h] [bp-1Ch]@1 + BYTE Data[4]; // [sp+8h] [bp-18h]@1 + DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 + HKEY hKey; // [sp+10h] [bp-10h]@1 + HKEY phkResult; // [sp+14h] [bp-Ch]@1 + HKEY v7; // [sp+18h] [bp-8h]@1 + HKEY v8; // [sp+1Ch] [bp-4h]@1 + + *(int *)Data = val; + lpValueName = pKey; + v8 = 0; + v7 = 0; + hKey = 0; + phkResult = 0; + if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ | KEY_WOW64_32KEY, &hKey)) + { + if (!RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) + { + if (!RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, KEY_ALL_ACCESS, 0, &v7, &dwDisposition)) + { + if (!RegCreateKeyExA(v7, "1.0", 0, "", 0, KEY_ALL_ACCESS, 0, &v8, &dwDisposition)) + { + RegSetValueExA(v8, lpValueName, 0, 4, Data, 4); + RegCloseKey(v8); + } + RegCloseKey(v7); + } + RegCloseKey(phkResult); + } + RegCloseKey(hKey); + } } \ No newline at end of file
--- a/OSAPI.h Mon Mar 07 03:48:40 2016 +0200 +++ b/OSAPI.h Wed Mar 09 01:39:52 2016 +0200 @@ -1,9 +1,16 @@ +#pragma once #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <MMSystem.h> #pragma comment(lib, "winmm.lib") + +int ReadWindowsRegistryInt(const char *pKey, int uDefValue); // idb +void WriteWindowsRegistryString(const char *pKey, const char *pString); +void ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue); +void WriteWindowsRegistryInt(const char *pKey, int val); + #undef DrawText #undef PlaySound #undef Polygon \ No newline at end of file