Mercurial > mm7
changeset 2408:4bb0b96cec90
Слияние
author | Ritor1 |
---|---|
date | Mon, 14 Jul 2014 18:09:42 +0600 |
parents | 82512695b45d (diff) 378e5732ba38 (current diff) |
children | b29880e9ee79 |
files | |
diffstat | 28 files changed, 653 insertions(+), 613 deletions(-) [+] |
line wrap: on
line diff
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Wed Jul 09 18:19:54 2014 +0600 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Mon Jul 14 18:09:42 2014 +0600 @@ -99,6 +99,7 @@ <ClCompile Include="..\..\CShow.cpp" /> <ClCompile Include="..\..\DecalBuilder.cpp" /> <ClCompile Include="..\..\DecorationList.cpp" /> + <ClCompile Include="..\..\DirectX11.cpp" /> <ClCompile Include="..\..\Events.cpp" /> <ClCompile Include="..\..\FrameTableInc.cpp" /> <ClCompile Include="..\..\Game.cpp" /> @@ -265,6 +266,7 @@ <ClInclude Include="..\..\CShow.h" /> <ClInclude Include="..\..\DecalBuilder.h" /> <ClInclude Include="..\..\DecorationList.h" /> + <ClInclude Include="..\..\DirectX11.h" /> <ClInclude Include="..\..\ErrorHandling.h" /> <ClInclude Include="..\..\Events.h" /> <ClInclude Include="..\..\Events2D.h" />
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Wed Jul 09 18:19:54 2014 +0600 +++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Mon Jul 14 18:09:42 2014 +0600 @@ -532,6 +532,7 @@ <ClInclude Include="..\..\UI\UIArena.h"> <Filter>UI</Filter> </ClInclude> + <ClInclude Include="..\..\DirectX11.h" /> </ItemGroup> <ItemGroup> <Filter Include="lib"> @@ -964,6 +965,7 @@ <ClCompile Include="..\..\UI\UIArena.cpp"> <Filter>UI</Filter> </ClCompile> + <ClCompile Include="..\..\DirectX11.cpp" /> </ItemGroup> <ItemGroup> <CustomBuild Include="..\..\NewUI\Core\UIControlModule.swig">
--- a/CastSpellInfo.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/CastSpellInfo.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -1702,7 +1702,7 @@ continue; } town_portal_caster_id = pCastSpell->uPlayerID; - pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_OnCastTownPortal, 0, 0); spell_sound_flag = true; break; } @@ -1718,7 +1718,7 @@ if ( pPlayer->sMana >= (signed int)uRequiredMana ) { pEventTimer->Pause(); - pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_OnCastLloydsBeacon, 0, 0); lloyds_beacon_spell_level = (signed int)(604800 * spell_level); _506348_current_lloyd_playerid = pCastSpell->uPlayerID; ::uRequiredMana = uRequiredMana;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DirectX11.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -0,0 +1,105 @@ +#define WIN32_LEAN_AND_MEAN + +#include "DirectX11.h" + +HRESULT D3D11::InitDevice() +{ + HRESULT hr = S_OK; + RECT rc; + GetClientRect( g_hWnd, &rc ); + UINT width = rc.right - rc.left; // + UINT height = rc.bottom - rc.top; // + UINT createDeviceFlags = 0; + D3D_DRIVER_TYPE driverTypes[] = + { + D3D_DRIVER_TYPE_HARDWARE, + D3D_DRIVER_TYPE_WARP, + D3D_DRIVER_TYPE_REFERENCE, + }; + UINT numDriverTypes = ARRAYSIZE( driverTypes ); + + // DirectX + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + }; + UINT numFeatureLevels = ARRAYSIZE( featureLevels ); + + // DirectX. , + // . + DXGI_SWAP_CHAIN_DESC sd; // , (Swap Chain) + ZeroMemory( &sd, sizeof( sd ) ); // + sd.BufferCount = 1; // + sd.BufferDesc.Width = width; // + sd.BufferDesc.Height = height; // + sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // + sd.BufferDesc.RefreshRate.Numerator = 75; // + sd.BufferDesc.RefreshRate.Denominator = 1; + sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // - + sd.OutputWindow = g_hWnd; // + sd.SampleDesc.Count = 1; + sd.SampleDesc.Quality = 0; + sd.Windowed = TRUE; // + + for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ ) + { + g_driverType = driverTypes[driverTypeIndex]; + hr = D3D11CreateDeviceAndSwapChain ( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext ); + if (SUCCEEDED(hr)) // , + break; + } + if (FAILED(hr)) return hr; + + // . , SDK + // RenderTargetOutput - , RenderTargetView - . + ID3D11Texture2D* pBackBuffer = NULL; + hr = g_pSwapChain->GetBuffer( 0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer ); + if (FAILED(hr)) return hr; + + // g_pd3dDevice + hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView ); + pBackBuffer->Release(); + if (FAILED(hr)) return hr; + + // + g_pImmediateContext->OMSetRenderTargets( 1, &g_pRenderTargetView, NULL ); + + // + D3D11_VIEWPORT vp; + vp.Width = (FLOAT)width; + vp.Height = (FLOAT)height; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + vp.TopLeftX = 0; + vp.TopLeftY = 0; + + // + g_pImmediateContext->RSSetViewports (1, &vp); + + return S_OK; +} + +//-------------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------------- +void D3D11::CleanupDevice() +{ + // , . + if( g_pImmediateContext ) g_pImmediateContext->ClearState(); + + // , , . + if( g_pRenderTargetView ) g_pRenderTargetView->Release(); + + if( g_pSwapChain ) g_pSwapChain->Release(); + + if( g_pImmediateContext ) g_pImmediateContext->Release(); + + if( g_pd3dDevice ) g_pd3dDevice->Release(); +} + +void Render() +{ + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DirectX11.h Mon Jul 14 18:09:42 2014 +0600 @@ -0,0 +1,31 @@ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +#include <MMSystem.h> + +#include <d3d11.h> +#pragma comment(lib, "d3d11.lib") +#pragma comment(lib, "winmm.lib") + +class D3D11 +{ + HINSTANCE g_hInst; + HWND g_hWnd; + D3D_DRIVER_TYPE g_driverType; // , . + D3D_FEATURE_LEVEL g_featureLevel; //, , DirectX . + ID3D11Device* g_pd3dDevice; + ID3D11DeviceContext* g_pImmediateContext; + IDXGISwapChain* g_pSwapChain; + ID3D11RenderTargetView* g_pRenderTargetView; + + +public: + + D3D11(): + g_hInst(NULL), g_hWnd(NULL), g_driverType(D3D_DRIVER_TYPE_NULL), g_featureLevel(D3D_FEATURE_LEVEL_11_0), + g_pd3dDevice(NULL), g_pImmediateContext(NULL), g_pSwapChain(NULL), g_pRenderTargetView(NULL){} + + HRESULT InitDevice(); // DirectX + void CleanupDevice(); // DirectX + void Render(); // +};
--- a/GUIWindow.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/GUIWindow.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -170,7 +170,7 @@ { if ( result->uHotkey == v3 ) { - pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(result->msg, result->msg_param, 0); return result; } } @@ -1837,7 +1837,7 @@ continue; } pNumMessages = pMessageQueue_50CBD0->uNumMessages; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); continue; } case WINDOW_Transition: @@ -1878,7 +1878,7 @@ if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); pEventTimer->Resume(); ptr_507BD0->Release(); pCurrentScreen = SCREEN_GAME; @@ -2010,9 +2010,9 @@ pButton->DrawLabel(pHint, pFontCreate, 0, 0); pWindow->Release(); if (pCurrentScreen == SCREEN_SAVEGAME) - pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); else - pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); continue; } case WINDOW_LoadGame_CancelBtn: @@ -2025,7 +2025,7 @@ if ( pWindow->Hint && pWindow->Hint != (char *)1 ) pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); pWindow->Release(); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); continue; } case WINDOW_CloseRestWindowBtn: @@ -2039,7 +2039,7 @@ if ( pHint && pHint != (char *)1 ) pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); pWindow->Release(); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); continue; } case WINDOW_ExitCharacterWindow: @@ -2054,7 +2054,7 @@ pButton->DrawLabel(pHint, pFontCreate, 0, 0); pWindow->Release(); pNumMessages = pMessageQueue_50CBD0->uNumMessages; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); continue; } case WINDOW_RestWindow: @@ -2187,7 +2187,7 @@ //----- (0041426F) -------------------------------------------------------- void ModalWindow_Release() { - pMessageQueue_50CBD0->AddMessage((UIMessageType)pModalWindow->par1C, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pModalWindow->par1C, 0, 0); pModalWindow->Release(); pModalWindow = nullptr;
--- a/GUIWindow.h Wed Jul 09 18:19:54 2014 +0600 +++ b/GUIWindow.h Mon Jul 14 18:09:42 2014 +0600 @@ -438,7 +438,7 @@ -#define AddMessage(msg, param, a4) AddMessageImpl((msg), (param), (a4), __FILE__, __LINE__) +#define AddGUIMessage(msg, param, a4) AddMessageImpl((msg), (param), (a4), __FILE__, __LINE__) /* 250 */ #pragma pack(push, 1) struct GUIMessageQueue
--- a/Game.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/Game.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -1504,8 +1504,8 @@ v10 = pSaveListPosition + uMessageParam; if ( dword_6BE138 == pSaveListPosition + uMessageParam ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); } uLoadGameUI_SelectedSlot = v10; dword_6BE138 = v10; @@ -2948,7 +2948,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); continue; case UIMSG_OnCastTownPortal: @@ -2996,7 +2996,7 @@ continue; case UIMSG_CloseAfterInstallBeacon: dword_50CDC8 = 1; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; @@ -3047,7 +3047,7 @@ pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); pBooksWindow->Release(); pGUIWindow_CurrentMenu->Release(); pBooksWindow = 0; @@ -3134,7 +3134,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); continue; } v63 = 210; @@ -3576,7 +3576,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); continue; @@ -3733,8 +3733,8 @@ dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; ++dword_50C9E8; }*/ - pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); - // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); + pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); + // pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); } else { @@ -3835,7 +3835,7 @@ pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); continue; case UIMSG_ClickAwardScrollBar: books_page_number = 1; @@ -4060,7 +4060,7 @@ v115 = pMessageQueue_50CBD0->uNumMessages; if ( !pMessageQueue_50CBD0->uNumMessages ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); /*if ( (signed int)v115 < 40 ) //goto LABEL_769; { @@ -4075,7 +4075,7 @@ if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) { pMessageQueue_50CBD0->uNumMessages = 1; - pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); /*v115 = v0; pMessageQueue_50CBD0->uNumMessages = v0; pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; @@ -4087,7 +4087,7 @@ } v115 = 0; pMessageQueue_50CBD0->uNumMessages = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0); /*if ( (signed int)v115 < 40 ) //goto LABEL_769; { @@ -4208,7 +4208,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); + pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); dword_50C9DC = 0; } else @@ -4225,7 +4225,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0); + pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0); _50C9D0_AfterEnchClickEventId = 0; _50C9D4_AfterEnchClickEventSecondParam = 0; _50C9D8_AfterEnchClickEventTimeout = 0; @@ -4421,8 +4421,8 @@ v26 = pParam + pSaveListPosition; if ( dword_6BE138 == pParam + pSaveListPosition ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); } uLoadGameUI_SelectedSlot = v26; dword_6BE138 = v26; @@ -4492,7 +4492,7 @@ SetCurrentMenuID(MENU_CREDITSCLOSE);// break; } - pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0); break; } if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen ) @@ -4509,7 +4509,7 @@ SetCurrentMenuID(MENU_CREDITSCLOSE); break; } - pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0); break; } if ( pCurrentScreen == SCREEN_LOADGAME )
--- a/Indoor.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/Indoor.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -4677,7 +4677,7 @@ { Actor::AI_FaceObject(v17, 4, 0, 0); if ( pActors[v17].sNPC_ID ) - pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v17, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_StartNPCDialogue, v17, 0); else { if ( pNPCStats->pGroups_copy[pActors[v17].uGroup] )
--- a/Keyboard.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/Keyboard.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -529,7 +529,7 @@ { if (pCurrentScreen == SCREEN_GAME) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Game_Action, 0, 0); continue; } if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) @@ -550,7 +550,7 @@ } pMessageQueue_50CBD0->uNumMessages = 0; } - //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + //pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); } } }*/ @@ -761,11 +761,11 @@ spell_price > pPlayers[uActiveCharacter]->sMana) ) { pPartyActionQueue = pPartyActionQueue; - pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0); break; } else - pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); + pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastQuickSpell, 0, 0); break; case INPUT_Attack: if (pCurrentScreen != SCREEN_GAME) @@ -775,12 +775,12 @@ pTurnEngine->field_18 |= TE_FLAG_8; break; } - pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0); break; case INPUT_EventTrigger: if (pCurrentScreen == SCREEN_GAME) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Game_Action, 0, 0); break; } if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) @@ -799,14 +799,14 @@ } break; } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); } break; case INPUT_CharCycle: if ( pCurrentScreen == SCREEN_SPELL_BOOK ) break; - pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); + pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CycleCharacters, 0, 0); break; case INPUT_LookUp: if ( pEventTimer->bPaused ) @@ -847,10 +847,10 @@ } break; case INPUT_ZoomIn: - pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); + pMessageQueue_50C9E8->AddGUIMessage(UIMSG_ClickZoomOutBtn, 0, 0); break; case INPUT_ZoomOut: - pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); + pMessageQueue_50C9E8->AddGUIMessage(UIMSG_ClickZoomInBtn, 0, 0); break; case INPUT_AlwaysRun: bAlwaysRun = bAlwaysRun == 0;
--- a/Mouse.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/Mouse.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -473,7 +473,7 @@ v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; } - pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(control->msg, control->msg_param, 0); return; } continue; @@ -489,7 +489,7 @@ v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; } - pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(control->msg, control->msg_param, 0); return; } continue; @@ -505,7 +505,7 @@ v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; } - pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(control->msg, control->msg_param, 0); return; } continue; @@ -534,7 +534,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_STEALFROMACTOR, PID_ID((unsigned __int16)v5), 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_STEALFROMACTOR, PID_ID((unsigned __int16)v5), 0); if ( pParty->bTurnBasedModeOn == 1 ) { @@ -621,7 +621,7 @@ } while ( v13 ); } - pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0); break; } case VK_RIGHT: @@ -652,7 +652,7 @@ } while ( v10 ); } - pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0); break; } case VK_DOWN: @@ -676,7 +676,7 @@ } while ( v20 ); } - pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0); return true; } case VK_SELECT: @@ -744,7 +744,7 @@ } while ( v25 ); } - pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + pMessageQueue_50CBD0->AddGUIMessage(pButton->msg, pButton->msg_param, 0); return true; } case VK_NEXT:
--- a/NPC.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/NPC.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -1442,7 +1442,7 @@ } pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; @@ -1497,7 +1497,7 @@ pCurrentNPCInfo->evt_F = 0; break; } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; @@ -1561,7 +1561,7 @@ PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); dialog_menu_id = HOUSE_DIALOGUE_MAIN; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; @@ -1987,7 +1987,7 @@ case GateMaster: { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); dword_50C9DC = 195; ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); }
--- a/OSWindow.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/OSWindow.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -236,7 +236,7 @@ } if ( wparam == VK_ESCAPE ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); return 0; } if ( wparam <= VK_HOME )
--- a/Party.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/Party.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -861,7 +861,7 @@ } if ( dword_506F14 == 2 ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); } } else
--- a/Player.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/Player.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -4316,7 +4316,7 @@ if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); } if ( v73 ) { @@ -4612,7 +4612,7 @@ // pMouse->RemoveHoldingItem(); // return; // } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); } if ( v73 ) { @@ -4665,11 +4665,11 @@ else { pMouse->RemoveHoldingItem(); - pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); + pMessageQueue_50C9E8->AddGUIMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); if ( pCurrentScreen && pGUIWindow_CurrentMenu && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); } } return; @@ -4728,7 +4728,7 @@ pMouse->RemoveHoldingItem(); return; } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); } // if ( v73 ) v73 is always 0 at this point // {
--- a/Render.h Wed Jul 09 18:19:54 2014 +0600 +++ b/Render.h Mon Jul 14 18:09:42 2014 +0600 @@ -293,14 +293,17 @@ void ClearBlack(); void PresentBlackScreen(); - void SavePCXScreenshot(); + void SaveWinnersCertificate(const char *a1); void ClearTarget(unsigned int uColor); void Present(); + void _49FD3A_fullscreen(); + bool InitializeFullscreen(); + void CreateZBuffer(); void Release(); - bool InitializeFullscreen(); + bool SwitchToWindow(); void RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor); void ClearZBuffer(int a2, int a3); @@ -316,63 +319,85 @@ void BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags); void BltBackToFontFast(int a2, int a3, RECT *a4); void BeginSceneD3D(); - void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); + unsigned int GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6); + void DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture); void DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders); - void DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture); - void DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture); void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8); - void DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID); + void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle); + + void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level); + void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse); + void TransformBillboardsAndSetPalettesODM(); + void DrawBillboardList_BLV(); + void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9); - void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse); bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture); bool MoveSpriteToDevice(Sprite *pSprite); + void BeginScene(); void EndScene(); void ScreenFade(unsigned int color, float t); + void SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); void ResetTextureClipRect(); void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4); void CreditsTextureScroll(unsigned int pX, unsigned int pY, int move_X, int move_Y, RGBTexture *pTexture); void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4); + void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5); void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal); void DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture); void DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); + void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4); void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture); + void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices); + void DrawMasked(signed int a2, signed int a3, struct Texture *pTexture, unsigned __int16 mask); void GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height); + void DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8); 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); + void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16); void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7); void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture *a4); + void DrawBuildingsD3D(); //struct BSPModel *DrawBuildingsSW(); //int OnOutdoorRedrawSW(); + + void DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID); void DrawOutdoorSkyD3D(); //int DrawSkySW(struct Span *a1, Polygon *a2, int a3); + void DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture); + void DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture); + void PrepareDecorationsRenderList_ODM(); void DrawSpriteObjects_ODM(); - void TransformBillboardsAndSetPalettesODM(); - float DrawBezierTerrain(); + + //float DrawBezierTerrain(); void RenderTerrainD3D(); void DrawTerrainD3D(int a1, int edx0, int a3, int unk4); //void DrawTerrainSW(int a1, int a2, int a3, int a4); + //void ExecOutdoorDrawSW(); void ChangeBetweenWinFullscreenModes(); - void DrawBillboardList_BLV(); bool AreRenderSurfacesOk(); bool IsGammaSupported(); + void SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height); void PackScreenshot(unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size); + void SavePCXScreenshot(); + int _466_GetActorsInViewport(int pDepth); + void BeginLightmaps(); void EndLightmaps(); void BeginLightmaps2(); @@ -385,71 +410,121 @@ void do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff); void DrawLines(const RenderVertexD3D3 *vertices, unsigned int num_vertices); - void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices); + void DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture); void am_Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3); void am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode); + public: + int *pActiveZBuffer; + IDirectDraw4 *pDirectDraw4; + IDirectDrawSurface4 *pFrontBuffer4; + IDirectDrawSurface4 *pBackBuffer4; + void *pTargetSurface; + unsigned int uTargetSurfacePitch; + unsigned int bUseColoredLights; + unsigned int bTinting; + unsigned int bUsingSpecular; + uint32_t uFogColor; + unsigned int pHDWaterBitmapIDs[7]; + int hd_water_current_frame; + int hd_water_tile_id; + void (*pBeforePresentFunction)(); + uint32_t bFogEnabled; + RenderBillboardD3D pBillboardRenderListD3D[1000]; + unsigned int uNumBillboardsToDraw; - protected: unsigned int uDesiredDirect3DDevice; - protected: int raster_clip_x; - protected: int raster_clip_y; // clipping rect for raster ops - protected: int raster_clip_z; // like RasterLine2D for (mini)map - protected: int raster_clip_w; - public: int *pActiveZBuffer; - protected: int *pDefaultZBuffer; - protected: OSWindow *window; - protected: unsigned int bWindowMode; - protected: RenderD3D *pRenderD3D; - public: IDirectDraw4 *pDirectDraw4; - public: IDirectDrawSurface4 *pFrontBuffer4; - public: IDirectDrawSurface4 *pBackBuffer4; - protected: DDPIXELFORMAT ddpfPrimarySuface; - protected: unsigned int uTargetRBits; - protected: unsigned int uTargetGBits; - protected: unsigned int uTargetBBits; - protected: unsigned int uTargetRMask; - protected: unsigned int uTargetGMask; - protected: unsigned int uTargetBMask; - protected: unsigned int uNumSceneBegins; - protected: unsigned __int32 *pTargetSurface_unaligned; - public: void *pTargetSurface; - public: unsigned int uTargetSurfacePitch; - protected: unsigned int uClipY; - protected: unsigned int uClipX; - protected: unsigned int uClipW; - protected: unsigned int uClipZ; - protected: unsigned int bClip; - protected: unsigned int uNumD3DSceneBegins; - protected: int using_software_screen_buffer; - protected: RenderHWLContainer pD3DBitmaps; - protected: RenderHWLContainer pD3DSprites; - public: unsigned int bUseColoredLights; - protected: unsigned int bRequiredTextureStagesAvailable; - public: unsigned int bTinting; - protected: unsigned int uLevelOfDetail; - protected: unsigned int uMaxDeviceTextureDim; - protected: unsigned int uMinDeviceTextureDim; - public: unsigned int bUsingSpecular; - public: uint32_t uFogColor; - public: unsigned int pHDWaterBitmapIDs[7]; - public: int hd_water_current_frame; - public: int hd_water_tile_id; - public: void (*pBeforePresentFunction)(); - public: uint32_t bFogEnabled; - public: RenderBillboardD3D pBillboardRenderListD3D[1000]; - public: unsigned int uNumBillboardsToDraw; + inline void WritePixel16(int x, int y, unsigned __int16 color) + { + if (ddpfPrimarySuface.dwRGBBitCount == 32) + { + auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch; + *p = Color32(color); + } + else if (ddpfPrimarySuface.dwRGBBitCount == 16) + { + auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch; + *p = color; + } + else __debugbreak(); + } + inline unsigned __int16 ReadPixel16(int x, int y) + { + if (ddpfPrimarySuface.dwRGBBitCount == 32) + { + auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch; + return Color16((*p >> 16) & 255, (*p >> 8) & 255, *p & 255); + } + else if (ddpfPrimarySuface.dwRGBBitCount == 16) + { + auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch; + return *p; + } + else __debugbreak(); + } + + inline void ToggleTint() {bTinting = !bTinting;} + inline void ToggleColoredLights() {bUseColoredLights = !bUseColoredLights;} + + inline unsigned int GetRenderWidth() {return window->GetWidth();} + inline unsigned int GetRenderHeight() {return window->GetHeight();} + + inline void Sub01() + { + if (pRenderD3D && !bWindowMode) + _49FD3A_fullscreen(); + } + + friend void Present_NoColorKey(); protected: + unsigned int uDesiredDirect3DDevice; + int raster_clip_x; + int raster_clip_y; // clipping rect for raster ops + int raster_clip_z; // like RasterLine2D for (mini)map + int raster_clip_w; + int *pDefaultZBuffer; + OSWindow *window; + unsigned int bWindowMode; + RenderD3D *pRenderD3D; + DDPIXELFORMAT ddpfPrimarySuface; + unsigned int uTargetRBits; + unsigned int uTargetGBits; + unsigned int uTargetBBits; + unsigned int uTargetRMask; + unsigned int uTargetGMask; + unsigned int uTargetBMask; + unsigned int uNumSceneBegins; + unsigned __int32 *pTargetSurface_unaligned; + unsigned int uClipY; + unsigned int uClipX; + unsigned int uClipW; + unsigned int uClipZ; + unsigned int bClip; + unsigned int uNumD3DSceneBegins; + int using_software_screen_buffer; + RenderHWLContainer pD3DBitmaps; + RenderHWLContainer pD3DSprites; + unsigned int bRequiredTextureStagesAvailable; + unsigned int uLevelOfDetail; + unsigned int uMaxDeviceTextureDim; + unsigned int uMinDeviceTextureDim; + void DoRenderBillboards_D3D(); void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); + void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard); + unsigned int Billboard_ProbablyAddToListAndSortByZOrder(float z); + unsigned int GetParentBillboardID(unsigned int uBillboardID); + unsigned int GetBillboardDrawListSize(); + void DrawBorderTiles(struct Polygon *poly); + unsigned short *MakeScreenshot(signed int width, signed int height); bool CheckTextureStages(); void ParseTargetPixelFormat(); - void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard); + void CreateDirectDraw(); void SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen); void SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP); @@ -457,57 +532,9 @@ void CreateBackBuffer(); void CreateDirectDrawPrimarySurface(); void CreateClipper(HWND a2); + void PackPCXpicture(unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size); void SavePCXImage(const char *Filename, unsigned short* picture_data, int width, int height); - unsigned int Billboard_ProbablyAddToListAndSortByZOrder(float z); - unsigned int GetParentBillboardID(unsigned int uBillboardID); - unsigned int GetBillboardDrawListSize(); - - public: - inline void WritePixel16(int x, int y, unsigned __int16 color) - { - if (ddpfPrimarySuface.dwRGBBitCount == 32) - { - auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch; - *p = Color32(color); - } - else if (ddpfPrimarySuface.dwRGBBitCount == 16) - { - auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch; - *p = color; - } - else __debugbreak(); - } - - inline unsigned __int16 ReadPixel16(int x, int y) - { - if (ddpfPrimarySuface.dwRGBBitCount == 32) - { - auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch; - return Color16((*p >> 16) & 255, (*p >> 8) & 255, *p & 255); - } - else if (ddpfPrimarySuface.dwRGBBitCount == 16) - { - auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch; - return *p; - } - else __debugbreak(); - } - - - inline void ToggleTint() {bTinting = !bTinting;} - inline void ToggleColoredLights() {bUseColoredLights = !bUseColoredLights;} - - inline unsigned int GetRenderWidth() {return window->GetWidth();} - inline unsigned int GetRenderHeight() {return window->GetHeight();} - - inline void Sub01() - { - if (pRenderD3D && !bWindowMode) - _49FD3A_fullscreen(); - } - - friend void Present_NoColorKey(); //int windowed_mode_width; //int windowed_mode_height;
--- a/UI/Books/UIMapBook.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/Books/UIMapBook.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -182,7 +182,7 @@ } } if ( byte_506360 ) - pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); return BeaconID; }
--- a/UI/UIArena.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/UIArena.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -182,7 +182,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); //v2 = pParty->pPlayers.data(); for ( uint i = 0; i < 4; i++ ) {
--- a/UI/UIGuilds.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/UIGuilds.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -228,7 +228,7 @@ } } } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } //----- (004BC8D5) --------------------------------------------------------
--- a/UI/UIHouses.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/UIHouses.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -1291,7 +1291,7 @@ } case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: { - pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_PlayArcomage, 0, 0); dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; break; } @@ -1536,7 +1536,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//" " PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } @@ -1606,7 +1606,7 @@ sqrt(3.1415926); while ( HouseDialogPressCloseBtn() ) ; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); return; } else @@ -1731,7 +1731,7 @@ v2 = atoi(pKeyActionMap->pPressedKeysBuffer); if ( v1 <= 0 ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } if ( v1 > pParty->uNumGold ) @@ -1751,7 +1751,7 @@ if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) { window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); } break; } @@ -1805,7 +1805,7 @@ takes_sum = entered_sum; if ( !entered_sum ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } if ( entered_sum > pParty->uNumGold ) @@ -1821,13 +1821,13 @@ pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); } window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } if (window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) { window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); } return; } @@ -1860,13 +1860,13 @@ } } window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) { window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); } return; } @@ -2062,14 +2062,14 @@ pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; ++pMessageQueue_50CBD0->uNumMessages;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_RentRoom, (int)window_SpeakInHouse->ptr_1C, 1); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_RentRoom, (int)window_SpeakInHouse->ptr_1C, 1); window_SpeakInHouse->Release(); window_SpeakInHouse = 0; return; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); break; } @@ -2143,7 +2143,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);// ! if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } if ( pParty->uNumGold >= pPriceFood ) @@ -2151,12 +2151,12 @@ Party::TakeGold(pPriceFood); pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); break; } @@ -2284,7 +2284,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//" " PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } Party::TakeGold(pPrice); @@ -2303,7 +2303,7 @@ pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } if ( (unsigned int)pPlayers[uActiveCharacter]->pConditions[Condition_Zombie] | v35 ) @@ -2316,7 +2316,7 @@ pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } pPlayers[uActiveCharacter]->uPrevFace = pPlayers[uActiveCharacter]->uCurrentFace; @@ -2333,7 +2333,7 @@ pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); pPlayers[uActiveCharacter]->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } //--------------------------------------------------- @@ -2388,12 +2388,12 @@ ++byte_F8B1EF[uActiveCharacter]; pPlayers[uActiveCharacter]->PlaySound(SPEECH_83, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2); // "Thank You!" - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//" " PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } //------------------------------------------------ @@ -2607,12 +2607,12 @@ sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// // "%s is now Level %lu and has earned %lu Skill Points!" ShowStatusBarString(pTmpBuf.data(), 2); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)4); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1);// @@ -2628,7 +2628,7 @@ } training_dialog_window.DrawTitleText(pFontArrus, 0, v36, Color16(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)3); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); return; } } @@ -2836,7 +2836,7 @@ { v5 = 0; } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, v5); return; // void func }
--- a/UI/UIPartyCreation.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/UIPartyCreation.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -568,7 +568,7 @@ && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement { pControlParam = pControlsHead->uControlParam; - pMessageQueue_50CBD0->AddMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0); + pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0); v1 = 0; } pControlsHead = pControlsHead->pNext;
--- a/UI/UIPopup.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/UIPopup.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -1866,7 +1866,7 @@ pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; v39.x = pParty->vPosition.x; v39.y = pParty->vPosition.y; @@ -1891,7 +1891,7 @@ pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); pPlayers[uActiveCharacter]->ItemsEnchant(1); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; v39.x = pParty->vPosition.x; @@ -1918,7 +1918,7 @@ pPlayers[uActiveCharacter]->ItemsEnchant(5); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; v39.x = pParty->vPosition.x; @@ -1945,7 +1945,7 @@ pPlayers[uActiveCharacter]->ItemsEnchant(0); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); v39.z = pParty->vPosition.z + pParty->sEyelevel; v39.x = pParty->vPosition.x;
--- a/UI/UISaveLoad.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/UISaveLoad.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -96,7 +96,7 @@ { pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pKeyActionMap->pPressedKeysBuffer); - pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); } else {
--- a/UI/UiGame.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/UI/UiGame.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -1147,67 +1147,60 @@ //----- (00420EFF) -------------------------------------------------------- void GameUI_WritePointedObjectStatusString() { - int v1; // ebx@6 GUIWindow *pWindow; // edi@7 GUIButton *pButton; // ecx@11 - int v7; // ecx@19 + int requiredSkillpoints; // ecx@19 enum UIMessageType pMessageType1; // esi@24 -// int v14; // eax@41 + int v14; // eax@41 ItemGen *pItemGen; // ecx@44 int v16; // ecx@46 - signed int v18; // eax@55 + signed int pickedObjectPID; // eax@55 signed int v18b; - signed int v19; // ecx@63 + signed int pickedObjectID; // ecx@63 + BLVFace *pFace; // eax@69 const char *pText; // ecx@79 -// char *v28; // esi@82 -// enum UIMessageType pMessageType2; // esi@110 -// enum UIMessageType pMessageType3; // edx@117 + enum UIMessageType pMessageType2; // esi@110 + enum UIMessageType pMessageType3; // edx@117 char Str1[200]; // [sp+Ch] [bp-D4h]@129 unsigned int pX; // [sp+D4h] [bp-Ch]@1 unsigned int pY; // [sp+D8h] [bp-8h]@1 -// unsigned int v45; // [sp+DCh] [bp-4h]@21 int interaction_distance_limit = 512; - int monster_info_distance_limit = 5120; pMouse->uPointingObjectID = 0; pMouse->GetClickPos(&pX, &pY); - if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 )// + if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 ) return; - if ( pX <= 467 && pY <= 351 )// + if ( pCurrentScreen == SCREEN_GAME ) { - //() ---------------------------------- - if ( pCurrentScreen == SCREEN_GAME ) + if ( pX <= (window->GetWidth() - 1) * 0.73125 && pY <= (window->GetHeight() - 1) * 0.73125 ) { //if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 { - v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); + pickedObjectPID = pGame->pVisInstance->get_picked_object_zbuf_val(); if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X || pY < (unsigned int)pViewport->uScreen_TL_Y || pY > (unsigned int)pViewport->uScreen_BR_Y ) - v18 = -1; - if ( v18 == -1 ) + pickedObjectPID = -1; + if ( pickedObjectPID == -1 ) { - pMouse->uPointingObjectID = 0; - if ( pMouse->uPointingObjectID == 0 ) + if ( uLastPointedObjectID != 0 ) { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } + pFooterString[0] = 0; + bForceDrawFooter = 1; } - uLastPointedObjectID = pMouse->uPointingObjectID; + uLastPointedObjectID = 0; return; } } /*else - v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/ - pMouse->uPointingObjectID = (unsigned __int16)v18; - v19 = (signed)PID_ID(v18); - //For Items------------------------------------ - if (PID_TYPE(v18) == OBJECT_Item) { - if ( pObjectList->pObjects[pSpriteObjects[v19].uObjectDescID].uFlags & 0x10 ) + v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; + }*/ + pMouse->uPointingObjectID = (unsigned __int16)pickedObjectPID; + pickedObjectID = (signed)PID_ID(pickedObjectPID); + if ( PID_TYPE(pickedObjectPID) == OBJECT_Item ) + { + if ( pObjectList->pObjects[pSpriteObjects[pickedObjectID].uObjectDescID].uFlags & 0x10 ) { pMouse->uPointingObjectID = 0; pFooterString[0] = 0; @@ -1215,40 +1208,213 @@ uLastPointedObjectID = 0; return; } - if ( HIWORD(v18) < interaction_distance_limit && !pParty->pPickedItem.uItemID ) + if ( pickedObjectPID >= 0x2000000u || pParty->pPickedItem.uItemID ) { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[v19].stru_24.GetDisplayName());// "Get %s" + GameUI_SetFooterString(pSpriteObjects[pickedObjectID].stru_24.GetDisplayName()); + } + else + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[pickedObjectID].stru_24.GetDisplayName());// "Get %s" GameUI_SetFooterString(pTmpBuf.data()); - return; + } //intentional fallthrough + } + else if ( PID_TYPE(pickedObjectPID) == OBJECT_Decoration ) + { + if ( !pLevelDecorations[pickedObjectID].uEventID ) + { + if ( pLevelDecorations[pickedObjectID].IsInteractive() ) + pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[pickedObjectID]._idx_in_stru123 - 75] + 380].pTopic;// + else + pText = pDecorationList->pDecorations[pLevelDecorations[pickedObjectID].uDecorationDescID].field_20; + GameUI_SetFooterString(pText); } - GameUI_SetFooterString(pSpriteObjects[v19].stru_24.GetDisplayName()); - if ( pMouse->uPointingObjectID == 0 ) + else + { + char* hintString = GetEventHintString(pLevelDecorations[pickedObjectID].uEventID); + if ( hintString != '\0' ) + { + GameUI_SetFooterString(hintString); + } + } //intentional fallthrough + } + else if ( PID_TYPE(pickedObjectPID) == OBJECT_BModel ) + { + if ( pickedObjectPID < 0x2000000u ) { + char* newString = nullptr; + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) + { + v18b = (signed int)(unsigned __int16)pickedObjectPID >> 9; + short triggeredId = pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID; + if (triggeredId != 0) + { + newString = GetEventHintString(pOutdoor->pBModels[v18b].pFaces[pickedObjectID & 0x3F].sCogTriggeredID); + } + } + else + { + pFace = &pIndoor->pFaces[pickedObjectID]; + if ( BYTE3(pFace->uAttributes) & 6 ) + { + unsigned short eventId = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; + if (eventId != 0) + { + newString = GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID); + } + } + } + if (newString) + { + GameUI_SetFooterString(newString); + if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = pMouse->uPointingObjectID; + return; + } + } + pMouse->uPointingObjectID = 0; + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + else if ( PID_TYPE(pickedObjectPID) == OBJECT_Actor ) + { + if ( pickedObjectPID >= 0x2000000u ) + { + pMouse->uPointingObjectID = 0; if ( uLastPointedObjectID != 0 ) { pFooterString[0] = 0; bForceDrawFooter = 1; } + uLastPointedObjectID = 0; + return; } - uLastPointedObjectID = pMouse->uPointingObjectID; + if ( pActors[pickedObjectID].dword_000334_unique_name ) + pText = pMonsterStats->pPlaceStrings[pActors[pickedObjectID].dword_000334_unique_name]; + else + pText = pMonsterStats->pInfos[pActors[pickedObjectID].pMonsterInfo.uID].pName; + GameUI_SetFooterString(pText); //intentional fallthrough + } + if ( pMouse->uPointingObjectID == 0 && uLastPointedObjectID != 0) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = pMouse->uPointingObjectID; + return; + } + } + else + { + for (int i = uNumVisibleWindows; i > 0; --i) + { + pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; + if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ + && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) + { + for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) + { + switch ( pButton->uButtonType ) + { + case 1://for dialogue window + if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ + && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) + { + pMessageType1 = (UIMessageType)pButton->field_1C; + if ( pMessageType1 ) + pMessageQueue_50CBD0->AddGUIMessage(pMessageType1, pButton->msg_param, 0); + GameUI_SetFooterString(pButton->pButtonName); + uLastPointedObjectID = 1; + return; + } + break; + case 2://hovering over portraits + if (pButton->uWidth != 0 && pButton->uHeight != 0) + { + uint distW = pX - pButton->uX; + uint distY = pY - pButton->uY; + + double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); + double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); + + if (ratioX + ratioY < 1.0) + { + pMessageType2 = (UIMessageType)pButton->field_1C; + if ( pMessageType2 != 0 ) + pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); + GameUI_SetFooterString(pButton->pButtonName); // for character name + uLastPointedObjectID = 1; + return; + } + } + break; + case 3:// click on skill + if ( pX >= pButton->uX && pX <= pButton->uZ + && pY >= pButton->uY && pY <= pButton->uW ) + { + requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; + if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) + sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" + else + sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" + GameUI_SetFooterString(Str1); + uLastPointedObjectID = 1; + return; + } + break; + } + } + } + if ( pWindow->uFrameHeight == 480 ) + { + //DebugBreak(); //Why is this condition here (in the original too)? Might check fullscreen windows. Let Silvo know if you find out return; } - //For Decorations---------------------------------- - if (PID_TYPE(v18) == OBJECT_Decoration) + } + //The game never gets to this point even in the original. It's also bugged(neither branch displays anything). + //TODO fix these and move them up before the window check loop. + if ( pCurrentScreen == SCREEN_CHEST ) + { + Chest::ChestUI_WritePointedObjectStatusString(); + if ( uLastPointedObjectID != 0 ) { - if ( !pLevelDecorations[v19].uEventID ) + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + uLastPointedObjectID = 0; + return; + } + else if ( pCurrentScreen == SCREEN_HOUSE ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD + || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) + || v16 == -65536 ) + { + if ( uLastPointedObjectID != 0 ) { - if ( pLevelDecorations[v19].IsInteractive() ) - pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 380].pTopic;//-379 - else - pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20; - GameUI_SetFooterString(pText); + pFooterString[0] = 0; + bForceDrawFooter = 1; } - else - { - if ( GetEventHintString(pLevelDecorations[v19].uEventID) ) - GameUI_SetFooterString(GetEventHintString(pLevelDecorations[v19].uEventID)); - } + uLastPointedObjectID = 0; + return; + } + pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); + GameUI_SetFooterString(pItemGen->GetDisplayName()); + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + if ( pY < 350 ) + { + v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; + if ( v14 == 0 || v14 == -65536 || v14 >= 5000 ) + { if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1260,373 +1426,82 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - //For 3D Model------------------------------------- - if (PID_TYPE(v18) == OBJECT_BModel) - { - if ( HIWORD(v18) < interaction_distance_limit ) - { - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - v18b = (signed int)(unsigned __int16)v18 >> 9; - if ( !pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID - || !GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID) ) - { - pMouse->uPointingObjectID = 0; - pFooterString[0] = 0; - bForceDrawFooter = 1; - uLastPointedObjectID = 0; - return; - } - GameUI_SetFooterString(GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID)); - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - if ( pIndoor->pFaces[v19].uAttributes & FACE_INDICATE ) - { - if ( !pIndoor->pFaceExtras[pIndoor->pFaces[v19].uFaceExtraID].uEventID - || !GetEventHintString(pIndoor->pFaceExtras[pIndoor->pFaces[v19].uFaceExtraID].uEventID) ) - { - pMouse->uPointingObjectID = 0; - pFooterString[0] = 0; - bForceDrawFooter = 1; - uLastPointedObjectID = 0; - return; - } - GameUI_SetFooterString(GetEventHintString(pIndoor->pFaceExtras[pIndoor->pFaces[v19].uFaceExtraID].uEventID)); - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - } - } - pMouse->uPointingObjectID = 0; - pFooterString[0] = 0; - bForceDrawFooter = 1; - uLastPointedObjectID = 0; - return; - } - if (PID_TYPE(v18) == OBJECT_Actor && HIWORD(v18) < monster_info_distance_limit ) - { - if ( pActors[v19].dword_000334_unique_name ) - pText = pMonsterStats->pPlaceStrings[pActors[v19].dword_000334_unique_name]; - else - pText = pMonsterStats->pInfos[pActors[v19].pMonsterInfo.uID].pName; - strncpy(pTmpBuf.data(), pText, 2000); - GameUI_SetFooterString(pTmpBuf.data()); - } - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - //() ------------------------------------------- - if ( pCurrentScreen == SCREEN_CHEST ) - { - Chest::ChestUI_WritePointedObjectStatusString(); - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - //() ----------------------------------------- - if ( pCurrentScreen == SCREEN_HOUSE ) - { - v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; - if ( v16 != 0 && v16 != -65536 ) - { - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) - { - pItemGen = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v16-1]; - GameUI_SetFooterString(pItemGen->GetDisplayName()); - uLastPointedObjectID = 1; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) - { - pItemGen = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v16-1]; - GameUI_SetFooterString(pItemGen->GetDisplayName()); - uLastPointedObjectID = 1; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL ) - { - pItemGen = &pPlayers[uActiveCharacter]->pInventoryItemList[v16-1]; - GameUI_SetFooterString(pItemGen->GetDisplayName()); - uLastPointedObjectID = 1; - } - } - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; + pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; + GameUI_SetFooterString(pItemGen->GetDisplayName()); + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; return; } - //----------------------------------------- - for ( v1 = uNumVisibleWindows; v1 >= 0; --v1 ) // some other fullscreen ui + } + if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ + && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) + { + for ( pButton = pWindowList[0].pControlsHead; pButton != nullptr; pButton = pButton->pNext ) { - pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; - if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ - && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) + switch (pButton->uButtonType) { - for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) + case 1: + if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ + && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) { - if ( !pButton ) - break; - switch ( pButton->uButtonType ) + pMessageType3 = (UIMessageType)pButton->field_1C; + if ( pMessageType3 == 0 ) // For books { - case 1://for dialogue window - if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 2: - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 3:// click on skill - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; - if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) - sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" - else - sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" - GameUI_SetFooterString(Str1); - uLastPointedObjectID = 1; - return; - } - break; + GameUI_SetFooterString(pButton->pButtonName); } + else + { + pMessageQueue_50CBD0->AddGUIMessage(pMessageType3, pButton->msg_param, 0); + } + uLastPointedObjectID = 1; + return; } - } - } - }// ------------------------ - if ( pX > 467 && pX <= window->GetWidth() - 1 && pY <= window->GetHeight() - 1 )// - { - if ( pCurrentScreen == SCREEN_GAME ) - { - pWindow = &pWindowList[0]; - if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ - && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) - { - for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) + break; + case 2://hovering over portraits + if (pButton->uWidth != 0 && pButton->uHeight != 0) { - if ( !pButton ) - break; - switch ( pButton->uButtonType ) + uint distW = pX - pButton->uX; + uint distY = pY - pButton->uY; + + double ratioX = 1.0 * (distW*distW) / (pButton->uWidth*pButton->uWidth); + double ratioY = 1.0 * (distY*distY) / (pButton->uHeight*pButton->uHeight); + + if (ratioX + ratioY < 1.0) { - case 1://for dialogue window - if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 2: - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 3:// click on skill - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; - if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) - sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" - else - sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" - GameUI_SetFooterString(Str1); - uLastPointedObjectID = 1; - return; - } - break; + pMessageType2 = (UIMessageType)pButton->field_1C; + if ( pMessageType2 != 0 ) + pMessageQueue_50CBD0->AddGUIMessage(pMessageType2, pButton->msg_param, 0); + GameUI_SetFooterString(pButton->pButtonName); // for character name + uLastPointedObjectID = 1; + return; } } - } - } - else - { - for ( v1 = uNumVisibleWindows; v1 > 0; --v1 ) - { - pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; - if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ - && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) + break; + case 3: + if ( pX >= pButton->uX && pX <= pButton->uZ + && pY >= pButton->uY && pY <= pButton->uW ) { - for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) - { - if ( !pButton ) - break; - switch ( pButton->uButtonType ) - { - case 1://for dialogue window - if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 2: - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 3:// click on skill - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; - if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) - sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" - else - sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" - GameUI_SetFooterString(Str1); - uLastPointedObjectID = 1; - return; - } - break; - } - } + requiredSkillpoints = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; + if ( pPlayers[uActiveCharacter]->uSkillPoints < requiredSkillpoints ) + sprintf(Str1, pGlobalTXT_LocalizationStrings[469], requiredSkillpoints - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" + else + sprintf(Str1, pGlobalTXT_LocalizationStrings[468], requiredSkillpoints);// "Clicking here will spend %d Skill Points" + GameUI_SetFooterString(Str1); + uLastPointedObjectID = 1; + return; } - } - } - } - if ( pX <= 467 && pY > 351 && pY <= 479 )// - { - pWindow = &pWindowList[0]; - if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ - && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) - { - for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) - { - if ( !pButton ) - break; - switch ( pButton->uButtonType ) - { - case 1://for dialogue window - if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 2: - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - pMessageType1 = (UIMessageType)pButton->field_1C; - if ( pMessageType1 ) - pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); - GameUI_SetFooterString(pButton->pButtonName); - uLastPointedObjectID = 1; - return; - } - break; - case 3:// click on skill - if ( pX >= pButton->uX && pX <= pButton->uZ - && pY >= pButton->uY && pY <= pButton->uW ) - { - v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; - if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) - sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" - else - sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" - GameUI_SetFooterString(Str1); - uLastPointedObjectID = 1; - return; - } - break; - } + break; } } } //pMouse->uPointingObjectID = sub_46A99B(); //for software - if ( pMouse->uPointingObjectID == 0 ) + if ( uLastPointedObjectID != 0 ) { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } + pFooterString[0] = 0; + bForceDrawFooter = 1; } - uLastPointedObjectID = pMouse->uPointingObjectID; + uLastPointedObjectID = 0; return; }
--- a/Viewport.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/Viewport.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -470,7 +470,7 @@ } return; } - pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, mon_id, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_StartNPCDialogue, mon_id, 0); return; } if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == TE_MOVEMENT ) @@ -478,7 +478,7 @@ pTurnEngine->field_18 |= TE_FLAG_8; return; } - pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0); } else { @@ -488,7 +488,7 @@ return; } if ( uActiveCharacter && sub_427769_isSpellQuickCastableOnShiftClick(pPlayers[uActiveCharacter]->uQuickSpell)) - pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CastQuickSpell, 0, 0); } return; }
--- a/_deleted.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/_deleted.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -12468,7 +12468,7 @@ //} if ( wParam == VK_ESCAPE ) { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); return 0; } if ( wParam <= VK_HOME )
--- a/mm7_2.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/mm7_2.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -64,8 +64,6 @@ #include "MMT.h" #include "Registry.h" -//#include "lib/lua/lua.h" - int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); @@ -283,11 +281,11 @@ { pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Quit, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Quit, 1, 0); } else { - pMessageQueue_50CBD0->AddMessage(UIMSG_ShowFinalWindow, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ShowFinalWindow, 1, 0); /*if ( (signed int)result < 40 ) { pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5;
--- a/mm7_4.cpp Wed Jul 09 18:19:54 2014 +0600 +++ b/mm7_4.cpp Mon Jul 14 18:09:42 2014 +0600 @@ -2129,7 +2129,7 @@ pParty->hirelingScrollPosition = 0; pParty->CountHirelings(); dword_591084 = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); dword_7241C8 = 0; return; } @@ -2167,7 +2167,7 @@ strcpy(v13, speakingNPC->pName); pParty->hirelingScrollPosition = 0; pParty->CountHirelings(); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); if ( sDialogue_SpeakingActorNPC_ID >= 0 ) pDialogue_SpeakingActor->uAIState = Removed; if ( uActiveCharacter ) @@ -2185,7 +2185,7 @@ { if ( speakingNPC->uProfession != GateMaster ) speakingNPC->bHasUsedTheAbility = 1; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); } else ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!" @@ -2211,7 +2211,7 @@ pParty->hirelingScrollPosition = 0; pParty->CountHirelings(); dword_591084 = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); dword_7241C8 = 0; return; }