comparison mm7_2.cpp @ 838:d061180f2b42

Merge
author Gloval
date Thu, 28 Mar 2013 00:37:58 +0400
parents bebc19f3d2af b66abf8b7d50
children ceef50611567 06fc66ceecd6 710cf848ad24
comparison
equal deleted inserted replaced
837:bebc19f3d2af 838:d061180f2b42
3 #include <assert.h> 3 #include <assert.h>
4 4
5 #include "MapInfo.h" 5 #include "MapInfo.h"
6 #include "Game.h" 6 #include "Game.h"
7 #include "GUIWindow.h" 7 #include "GUIWindow.h"
8 #include "GUIButton.h"
9 #include "GUIFont.h" 8 #include "GUIFont.h"
10 #include "Party.h" 9 #include "Party.h"
11 #include "AudioPlayer.h" 10 #include "AudioPlayer.h"
12 #include "Outdoor.h" 11 #include "Outdoor.h"
13 #include "IndoorCamera.h" 12 #include "IndoorCamera.h"
291 const char *result; // eax@19 290 const char *result; // eax@19
292 291
293 uDialogueType = 83; 292 uDialogueType = 83;
294 pDialogueWindow->Release(); 293 pDialogueWindow->Release();
295 pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); 294 pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0);
296 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" 295 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
297 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); 296 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
298 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); 297 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
299 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); 298 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_0, 0x53u, 0, "", 0);
300 pDialogueWindow->_41D08F(1, 1, 0, 2); 299 pDialogueWindow->_41D08F(1, 1, 0, 2);
301 dialog_menu_id = HOUSE_DIALOGUE_OTHER; 300 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
302 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); 301 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
303 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) 302 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed )
304 { 303 {
434 while ( v6 ); 433 while ( v6 );
435 } 434 }
436 pDialogueWindow->pControlsHead = 0; 435 pDialogueWindow->pControlsHead = 0;
437 pDialogueWindow->pControlsTail = 0; 436 pDialogueWindow->pControlsTail = 0;
438 pDialogueWindow->uNumControls = 0; 437 pDialogueWindow->uNumControls = 0;
439 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 438 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],
440 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); 439 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
441 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x55u, 0, "", 0); 440 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x55u, 0, "", 0);
442 pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x56u, 0, "", 0); 441 pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0);
443 pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x57u, 0, "", 0); 442 pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0);
444 pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x58u, 0, "", 0); 443 pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x58u, 0, "", 0);
445 pDialogueWindow->_41D08F(4, 1, 0, 1); 444 pDialogueWindow->_41D08F(4, 1, 0, 1);
446 } 445 }
447 } 446 }
448 // F8B1B4: using guessed type int dword_F8B1B4; 447 // F8B1B4: using guessed type int dword_F8B1B4;
449 448
806 //----- (004BCA33) -------------------------------------------------------- 805 //----- (004BCA33) --------------------------------------------------------
807 void UI_CreateEndConversationButton() 806 void UI_CreateEndConversationButton()
808 { 807 {
809 pDialogueWindow->Release(); 808 pDialogueWindow->Release();
810 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); 809 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
811 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0, 810 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
812 pGlobalTXT_LocalizationStrings[74], //"End Conversation" 811 pGlobalTXT_LocalizationStrings[74], //"End Conversation"
813 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); 812 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
814 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); 813 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
815 } 814 }
816 815
817 //----- (004BD8B5) -------------------------------------------------------- 816 //----- (004BD8B5) --------------------------------------------------------
818 signed int __cdecl sub_4BD8B5() 817 signed int __cdecl sub_4BD8B5()
819 { 818 {
825 if ( pMessageQueue_50CBD0->uNumMessages ) 824 if ( pMessageQueue_50CBD0->uNumMessages )
826 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 825 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
827 pKeyActionMap->_459ED1(3); 826 pKeyActionMap->_459ED1(3);
828 pKeyActionMap->ResetKeys(); 827 pKeyActionMap->ResetKeys();
829 activeLevelDecoration = NULL; 828 activeLevelDecoration = NULL;
830 ptr_F8B1E8 = 0; 829 current_npc_text = 0;
831 if ( pDialogueNPCCount ) 830 if ( pDialogueNPCCount )
832 { 831 {
833 v0 = dialog_menu_id; 832 v0 = dialog_menu_id;
834 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD 833 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD
835 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL 834 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL
896 { 895 {
897 //v3 = byte_591180; 896 //v3 = byte_591180;
898 do 897 do
899 { 898 {
900 HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2], 899 HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
901 0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, byte_591180[v2], 0, 0, 0); 900 0x3Fu, 0x49u, 1, 0, UIMSG_19A, v2, 0, byte_591180[v2], 0, 0, 0);
902 v1 = uNumDialogueNPCPortraits; 901 v1 = uNumDialogueNPCPortraits;
903 ++v2; 902 ++v2;
904 //v3 += 100; 903 //v3 += 100;
905 } 904 }
906 while ( (signed int)v2 < uNumDialogueNPCPortraits ); 905 while ( (signed int)v2 < uNumDialogueNPCPortraits );
1159 return; 1158 return;
1160 } 1159 }
1161 } 1160 }
1162 break; 1161 break;
1163 } 1162 }
1164
1165 1163
1166 case HOUSE_DIALOGUE_SHOP_REPAIR: 1164 case HOUSE_DIALOGUE_SHOP_REPAIR:
1167 { 1165 {
1168 v1 = pMouse->GetCursorPos(&a2)->x - 14; 1166 v1 = pMouse->GetCursorPos(&a2)->x - 14;
1169 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); 1167 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5);
4301 a1a.uAttributes = 0; 4299 a1a.uAttributes = 0;
4302 a1a.uSoundID = 0; 4300 a1a.uSoundID = 0;
4303 a1a.uFacing = 0; 4301 a1a.uFacing = 0;
4304 a1a.vPosition.z = a2->vPosition.z; 4302 a1a.vPosition.z = a2->vPosition.z;
4305 a1a.vPosition.x = a2->vPosition.x; 4303 a1a.vPosition.x = a2->vPosition.x;
4306 a1a.field_50 = 0; 4304 a1a.spell_skill = 0;
4307 a1a.field_4C = 0; 4305 a1a.spell_level = 0;
4308 a1a.field_48 = 0; 4306 a1a.spell_id = 0;
4309 a1a.field_5C = 0; 4307 a1a.spell_target_pid = 0;
4310 a1a.field_58_pid = 0; 4308 a1a.spell_caster_pid = 0;
4311 a1a.uSpriteFrameID = 0; 4309 a1a.uSpriteFrameID = 0;
4312 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);; 4310 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
4313 return a1a.Create(0, 0, 0, 0); 4311 return a1a.Create(0, 0, 0, 0);
4314 } 4312 }
4315 4313
6939 { 6937 {
6940 if ( pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ 6938 if ( pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ
6941 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW 6939 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW
6942 && pWindow == pWindow_MainMenu ) 6940 && pWindow == pWindow_MainMenu )
6943 { 6941 {
6944 pControlParam = pButton->uControlParam; 6942 pControlParam = pButton->msg_param;
6945 switch (pControlParam) // подсветка кнопок 6943 switch (pControlParam) // подсветка кнопок
6946 { 6944 {
6947 case 0: 6945 case 0:
6948 pTexture = pNew; 6946 pTexture = pNew;
6949 pY = 172; 6947 pY = 172;
6986 } 6984 }
6987 6985
6988 //----- (004637EB) -------------------------------------------------------- 6986 //----- (004637EB) --------------------------------------------------------
6989 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) 6987 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
6990 { 6988 {
6991 unsigned int v4; // esi@1 6989 //unsigned int v4; // esi@1
6992 Render *v5; // ecx@14 6990 Render *v5; // ecx@14
6993 HANDLE v6; // eax@32 6991 HANDLE v6; // eax@32
6994 Keyboard *v7; // eax@33 6992 Keyboard *v7; // eax@33
6995 //HDC v9; // edi@41 6993 //HDC v9; // edi@41
6996 HDC v10; // edi@50 6994 HDC v10; // edi@50
7027 int a2; // [sp+7Ch] [bp+10h]@50 7025 int a2; // [sp+7Ch] [bp+10h]@50
7028 7026
7029 switch (Msg) 7027 switch (Msg)
7030 { 7028 {
7031 case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); 7029 case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
7030 case WM_CHAR:
7031 {
7032 if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C)
7033 GUI_HandleHotkey(wParam);
7034 }
7035 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7032 }; 7036 };
7033 7037
7034 7038
7035 v4 = lParam;
7036 if ( Msg > WM_SYSCOMMAND ) 7039 if ( Msg > WM_SYSCOMMAND )
7037 { 7040 {
7038 switch ( Msg ) 7041 switch ( Msg )
7039 { 7042 {
7040 default: 7043 default:
7088 { 7091 {
7089 LABEL_218: 7092 LABEL_218:
7090 if ( pAsyncMouse != v32 ) 7093 if ( pAsyncMouse != v32 )
7091 goto _def_wnd_proc; 7094 goto _def_wnd_proc;
7092 back_to_game(); 7095 back_to_game();
7093 return DefWindowProcA(hWnd, Msg, wParam, v4); 7096 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7094 } 7097 }
7095 if (pAsyncMouse) 7098 if (pAsyncMouse)
7096 goto _def_wnd_proc; 7099 goto _def_wnd_proc;
7097 pArcomageGame->stru1.field_0 = 4; 7100 pArcomageGame->stru1.field_0 = 4;
7098 v29 = 0; 7101 v29 = 0;
7102 if ( pArcomageGame->bGameInProgress ) 7105 if ( pArcomageGame->bGameInProgress )
7103 { 7106 {
7104 if (pAsyncMouse) 7107 if (pAsyncMouse)
7105 goto _def_wnd_proc; 7108 goto _def_wnd_proc;
7106 pArcomageGame->stru1.field_0 = 7; 7109 pArcomageGame->stru1.field_0 = 7;
7107 return DefWindowProcA(hWnd, Msg, wParam, v4); 7110 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7108 } 7111 }
7109 if ( pVideoPlayer->pVideoFrame.pPixels ) 7112 if ( pVideoPlayer->pVideoFrame.pPixels )
7110 pVideoPlayer->bStopBeforeSchedule = 1; 7113 pVideoPlayer->bStopBeforeSchedule = 1;
7111 if ( !pAsyncMouse ) 7114 if ( !pAsyncMouse )
7112 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); 7115 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16);
7127 pGame->PickMouse(512.0, (unsigned __int16)lParam, lParam >> 16, v28, &vis_sprite_filter_3, &vis_door_filter); 7130 pGame->PickMouse(512.0, (unsigned __int16)lParam, lParam >> 16, v28, &vis_sprite_filter_3, &vis_door_filter);
7128 } 7131 }
7129 if ( pAsyncMouse == (void *)v28 ) 7132 if ( pAsyncMouse == (void *)v28 )
7130 { 7133 {
7131 UI_OnMouseLeftClick(0); 7134 UI_OnMouseLeftClick(0);
7132 return DefWindowProcA(hWnd, Msg, wParam, v4); 7135 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7133 } 7136 }
7134 goto _def_wnd_proc; 7137 goto _def_wnd_proc;
7135 case WM_RBUTTONDBLCLK: 7138 case WM_RBUTTONDBLCLK:
7136 v31 = 0; 7139 v31 = 0;
7137 if ( !pArcomageGame->bGameInProgress ) 7140 if ( !pArcomageGame->bGameInProgress )
7149 pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter); 7152 pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter);
7150 } 7153 }
7151 if (!pAsyncMouse) 7154 if (!pAsyncMouse)
7152 { 7155 {
7153 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); 7156 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
7154 return DefWindowProcA(hWnd, Msg, wParam, v4); 7157 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7155 } 7158 }
7156 goto _def_wnd_proc; 7159 goto _def_wnd_proc;
7157 } 7160 }
7158 if (pAsyncMouse) 7161 if (pAsyncMouse)
7159 goto _def_wnd_proc; 7162 goto _def_wnd_proc;
7160 pArcomageGame->stru1.field_0 = 8; 7163 pArcomageGame->stru1.field_0 = 8;
7161 return DefWindowProcA(hWnd, Msg, wParam, v4); 7164 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7162 case WM_MBUTTONDOWN: 7165 case WM_MBUTTONDOWN:
7163 if ( pRenderer->pRenderD3D ) 7166 if ( pRenderer->pRenderD3D )
7164 { 7167 {
7165 if ( pGame && !pAsyncMouse ) 7168 if ( pGame && !pAsyncMouse )
7166 { 7169 {
7167 v34 = GetPickDepth(); 7170 v34 = GetPickDepth();
7168 pGame->PickMouse(v34, (unsigned __int16)lParam, lParam >> 16, 1, &vis_sprite_filter_3, &vis_face_filter); 7171 pGame->PickMouse(v34, (unsigned __int16)lParam, lParam >> 16, 1, &vis_sprite_filter_3, &vis_face_filter);
7169 return DefWindowProcA(hWnd, Msg, wParam, v4); 7172 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7170 } 7173 }
7171 goto _def_wnd_proc; 7174 goto _def_wnd_proc;
7172 } 7175 }
7173 if ( !pGame ) 7176 if ( !pGame )
7174 goto _def_wnd_proc; 7177 goto _def_wnd_proc;
7175 sub_417871(0); 7178 sub_417871(0);
7176 return DefWindowProcA(hWnd, Msg, wParam, v4); 7179 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7177 case WM_MOUSEMOVE: 7180 case WM_MOUSEMOVE:
7178 if ( pArcomageGame->bGameInProgress ) 7181 if ( pArcomageGame->bGameInProgress )
7179 { 7182 {
7180 if (pAsyncMouse) 7183 if (pAsyncMouse)
7181 goto _def_wnd_proc; 7184 goto _def_wnd_proc;
7193 { 7196 {
7194 if (pAsyncMouse) 7197 if (pAsyncMouse)
7195 goto _def_wnd_proc; 7198 goto _def_wnd_proc;
7196 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); 7199 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16);
7197 } 7200 }
7198 return DefWindowProcA(hWnd, Msg, wParam, v4); 7201 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7199 } 7202 }
7200 } 7203 }
7201 if ( Msg == WM_SYSCOMMAND ) 7204 if ( Msg == WM_SYSCOMMAND )
7202 { 7205 {
7203 if ( wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER ) 7206 if ( wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER )
7211 if (pVideoPlayer) 7214 if (pVideoPlayer)
7212 { 7215 {
7213 if (pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer) 7216 if (pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer)
7214 { 7217 {
7215 BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0); 7218 BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0);
7216 return DefWindowProcA(hWnd, Msg, wParam, v4); 7219 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7217 } 7220 }
7218 } 7221 }
7219 goto _def_wnd_proc; 7222 goto _def_wnd_proc;
7220 } 7223 }
7221 if ( Msg != WM_KEYFIRST ) 7224 if ( Msg != WM_KEYFIRST )
7223 if ( Msg == WM_KEYUP ) 7226 if ( Msg == WM_KEYUP )
7224 { 7227 {
7225 if ( wParam == VK_CONTROL ) 7228 if ( wParam == VK_CONTROL )
7226 { 7229 {
7227 dword_507B98_ctrl_pressed = 0; 7230 dword_507B98_ctrl_pressed = 0;
7228 return DefWindowProcA(hWnd, Msg, wParam, v4); 7231 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7229 }
7230 goto _def_wnd_proc;
7231 }
7232 if ( Msg == WM_CHAR )
7233 {
7234 if ( !pKeyActionMap->_459F10(wParam) && !viewparams->field_4C )
7235 {
7236 GUI_HandleHotkey(wParam);
7237 return DefWindowProcA(hWnd, Msg, wParam, v4);
7238 } 7232 }
7239 goto _def_wnd_proc; 7233 goto _def_wnd_proc;
7240 } 7234 }
7241 if ( Msg != WM_COMMAND ) 7235 if ( Msg != WM_COMMAND )
7242 goto _def_wnd_proc; 7236 goto _def_wnd_proc;
7253 if ( pArcomageGame->bGameInProgress ) 7247 if ( pArcomageGame->bGameInProgress )
7254 pArcomageGame->field_F6 = 1; 7248 pArcomageGame->field_F6 = 1;
7255 return 0; 7249 return 0;
7256 } 7250 }
7257 if ( wParam != 40001 ) 7251 if ( wParam != 40001 )
7258 return DefWindowProcA(hWnd, Msg, wParam, v4); 7252 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7259 } 7253 }
7260 v38 = 0; 7254 v38 = 0;
7261 v37 = 0; 7255 v37 = 0;
7262 v36 = 2; 7256 v36 = 2;
7263 v35 = ::hWnd; 7257 v35 = ::hWnd;
7266 return 0; 7260 return 0;
7267 } 7261 }
7268 if ( dword_506E68 != -1 ) 7262 if ( dword_506E68 != -1 )
7269 { 7263 {
7270 pKeyActionMap->_459F10(wParam); 7264 pKeyActionMap->_459F10(wParam);
7271 return DefWindowProcA(hWnd, Msg, wParam, v4); 7265 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7272 } 7266 }
7273 if ( !pArcomageGame->bGameInProgress ) 7267 if ( !pArcomageGame->bGameInProgress )
7274 { 7268 {
7275 if ( pVideoPlayer->pVideoFrame.pPixels ) 7269 if ( pVideoPlayer->pVideoFrame.pPixels )
7276 pVideoPlayer->bStopBeforeSchedule = 1; 7270 pVideoPlayer->bStopBeforeSchedule = 1;
7596 SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); 7590 SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u);
7597 ClipCursor(0); 7591 ClipCursor(0);
7598 if (pAsyncMouse) 7592 if (pAsyncMouse)
7599 { 7593 {
7600 pAsyncMouse->Suspend(); 7594 pAsyncMouse->Suspend();
7601 return DefWindowProcA(hWnd, Msg, wParam, v4); 7595 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7602 } 7596 }
7603 } 7597 }
7604 _def_wnd_proc: 7598 _def_wnd_proc:
7605 v4 = lParam; 7599 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7606 return DefWindowProcA(hWnd, Msg, wParam, v4);
7607 } 7600 }
7608 if ( Msg != WM_KILLFOCUS ) 7601 if ( Msg != WM_KILLFOCUS )
7609 { 7602 {
7610 if ( Msg == WM_PAINT ) 7603 if ( Msg == WM_PAINT )
7611 { 7604 {
7629 return 0; 7622 return 0;
7630 } 7623 }
7631 goto _def_wnd_proc; 7624 goto _def_wnd_proc;
7632 } 7625 }
7633 if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || !pAsyncMouse ) 7626 if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || !pAsyncMouse )
7634 return DefWindowProcA(hWnd, Msg, wParam, v4); 7627 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7635 pAsyncMouse->Resume(); 7628 pAsyncMouse->Resume();
7636 if ( !pAsyncMouse ) 7629 if ( !pAsyncMouse )
7637 goto _def_wnd_proc; 7630 goto _def_wnd_proc;
7638 pAsyncMouse->Clip(); 7631 pAsyncMouse->Clip();
7639 return DefWindowProcA(hWnd, Msg, wParam, v4); 7632 return DefWindowProcA(hWnd, Msg, wParam, lParam);
7640 } 7633 }
7641 7634
7642 //----- (00464479) -------------------------------------------------------- 7635 //----- (00464479) --------------------------------------------------------
7643 void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() 7636 void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
7644 { 7637 {
7775 if ( !_strcmpi(pCurrentMapName, "out15.odm") ) 7768 if ( !_strcmpi(pCurrentMapName, "out15.odm") )
7776 { 7769 {
7777 bUnderwater = 1; 7770 bUnderwater = 1;
7778 pGame->uFlags2 |= 8u; 7771 pGame->uFlags2 |= 8u;
7779 } 7772 }
7780 pParty->field_6F4_packedid = 0; 7773 pParty->floor_face_pid = 0;
7781 if ( _strcmpi(Str1, "blv") ) 7774 if ( _strcmpi(Str1, "blv") )
7782 PrepareToLoadODM(v9, 0); 7775 PrepareToLoadODM(v9, 0);
7783 else 7776 else
7784 PrepareToLoadBLV(v9); 7777 PrepareToLoadBLV(v9);
7785 pAudioPlayer->SetMapEAX(); 7778 pAudioPlayer->SetMapEAX();
10989 //UNDEF(v3); 10982 //UNDEF(v3);
10990 if ( !(v4 | v5) ) 10983 if ( !(v4 | v5) )
10991 { 10984 {
10992 if ( stru_50C198.GetMagicalResistance(v2, 0xAu) ) 10985 if ( stru_50C198.GetMagicalResistance(v2, 0xAu) )
10993 { 10986 {
10994 v2->pActorBuffs[v1->field_48].Apply( 10987 v2->pActorBuffs[v1->spell_id].Apply(
10995 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->field_4C << 7) * 0.033333335), 10988 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->spell_level << 7) * 0.033333335),
10996 v1->field_50, 10989 v1->spell_skill,
10997 4u, 10990 4u,
10998 0, 10991 0,
10999 0); 10992 0);
11000 HIWORD(v2->uAttributes) |= 8u; 10993 HIWORD(v2->uAttributes) |= 8u;
11001 } 10994 }
11168 v3 = &pObjectList->pObjects[v2->uObjectDescID]; 11161 v3 = &pObjectList->pObjects[v2->uObjectDescID];
11169 v145 = a2; 11162 v145 = a2;
11170 v151 = a2 & 7; 11163 v151 = a2 & 7;
11171 if ( (a2 & 7) == OBJECT_Actor) 11164 if ( (a2 & 7) == OBJECT_Actor)
11172 { 11165 {
11173 if ( (v2->field_58_pid & 7) == OBJECT_Actor && !pActors[v2->field_58_pid >> 3].GetActorsRelation(&pActors[a2 >> 3]) ) 11166 if ( (v2->spell_caster_pid & 7) == OBJECT_Actor && !pActors[v2->spell_caster_pid >> 3].GetActorsRelation(&pActors[a2 >> 3]) )
11174 return 1; 11167 return 1;
11175 } 11168 }
11176 else 11169 else
11177 { 11170 {
11178 if ( (a2 & 7) == OBJECT_Player && (v2->field_58_pid & 7) == OBJECT_Player) 11171 if ( (a2 & 7) == OBJECT_Player && (v2->spell_caster_pid & 7) == OBJECT_Player)
11179 return 1; 11172 return 1;
11180 } 11173 }
11181 if ( pParty->bTurnBasedModeOn == 1 ) 11174 if ( pParty->bTurnBasedModeOn == 1 )
11182 { 11175 {
11183 v5 = v2->uAttributes; 11176 v5 = v2->uAttributes;
11185 { 11178 {
11186 --pTurnEngine->field_1C; 11179 --pTurnEngine->field_1C;
11187 v2->uAttributes = v5 & 0xFFFB; 11180 v2->uAttributes = v5 & 0xFFFB;
11188 } 11181 }
11189 } 11182 }
11190 if ( v151 == OBJECT_BModel && (v2->field_58_pid & 7) != OBJECT_Player) 11183 if ( v151 == OBJECT_BModel && (v2->spell_caster_pid & 7) != OBJECT_Player)
11191 BYTE2(pActors[v2->field_58_pid >> 3].uAttributes) |= 4u; 11184 BYTE2(pActors[v2->spell_caster_pid >> 3].uAttributes) |= 4u;
11192 v6 = v2->uType; 11185 v6 = v2->uType;
11193 v7 = v2->uType; 11186 v7 = v2->uType;
11194 if ( v7 > 3060 ) 11187 if ( v7 > 3060 )
11195 { 11188 {
11196 if ( v7 > 6090 ) 11189 if ( v7 > 6090 )
11244 break; 11237 break;
11245 } 11238 }
11246 v138 = 1; 11239 v138 = 1;
11247 if ( v151 != OBJECT_Actor) 11240 if ( v151 != OBJECT_Actor)
11248 { 11241 {
11249 if ( v6 != 9030 || v2->field_50 != 4 ) 11242 if ( v6 != 9030 || v2->spell_skill != 4 )
11250 goto LABEL_246; 11243 goto LABEL_246;
11251 v2->_46BEF1_apply_spells(); 11244 v2->_46BEF1_apply_spells();
11252 LABEL_233: 11245 LABEL_233:
11253 if ( !v138 ) 11246 if ( !v138 )
11254 { 11247 {
11301 return 0; 11294 return 0;
11302 } 11295 }
11303 v106 = v145; 11296 v106 = v145;
11304 v150 = 0; 11297 v150 = 0;
11305 v139 = v106 >> 3; 11298 v139 = v106 >> 3;
11306 v137 = v2->field_4C; 11299 v137 = v2->spell_level;
11307 v152 = v2->field_50; 11300 v152 = v2->spell_skill;
11308 v136 = v2->field_48; 11301 v136 = v2->spell_id;
11309 if ( v6 == 9030 ) 11302 if ( v6 == 9030 )
11310 { 11303 {
11311 v150 = 2; 11304 v150 = 2;
11312 if ( v152 == 2 ) 11305 if ( v152 == 2 )
11313 { 11306 {
11357 } 11350 }
11358 else 11351 else
11359 { 11352 {
11360 v2->_46BEF1_apply_spells(); 11353 v2->_46BEF1_apply_spells();
11361 } 11354 }
11362 v2->field_4C = 0; 11355 v2->spell_level = 0;
11363 v2->field_50 = 0; 11356 v2->spell_skill = 0;
11364 v2->field_48 = 0; 11357 v2->spell_id = 0;
11365 goto LABEL_233; 11358 goto LABEL_233;
11366 } 11359 }
11367 v135 = 10; 11360 v135 = 10;
11368 } 11361 }
11369 } 11362 }
11467 v128 = -1; 11460 v128 = -1;
11468 LOBYTE(v124) = v124 | 2; 11461 LOBYTE(v124) = v124 | 2;
11469 v127 = v9; 11462 v127 = v9;
11470 v126 = v124; 11463 v126 = v124;
11471 LABEL_268: 11464 LABEL_268:
11472 v116 = word_4EE088_sound_ids[v2->field_48]; 11465 v116 = word_4EE088_sound_ids[v2->spell_id];
11473 LABEL_269: 11466 LABEL_269:
11474 v125 = v116 + 1; 11467 v125 = v116 + 1;
11475 goto LABEL_29; 11468 goto LABEL_29;
11476 } 11469 }
11477 v59 = v6 + 2; 11470 v59 = v6 + 2;
11500 } 11493 }
11501 v2->uObjectDescID = v63; 11494 v2->uObjectDescID = v63;
11502 if ( !v63 ) 11495 if ( !v63 )
11503 SpriteObject::OnInteraction(v153); 11496 SpriteObject::OnInteraction(v153);
11504 v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; 11497 v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi;
11505 v44 = v2->field_50 == 4; 11498 v44 = v2->spell_skill == 4;
11506 v2->vVelocity.z = 0; 11499 v2->vVelocity.z = 0;
11507 v2->vVelocity.y = 0; 11500 v2->vVelocity.y = 0;
11508 v2->vVelocity.x = 0; 11501 v2->vVelocity.x = 0;
11509 v65 = 7; 11502 v65 = 7;
11510 if ( v44 ) 11503 if ( v44 )