comparison mm7_5.cpp @ 838:d061180f2b42

Merge
author Gloval
date Thu, 28 Mar 2013 00:37:58 +0400
parents bebc19f3d2af dfd683c4f538
children ae8f83e1b0cf 710cf848ad24
comparison
equal deleted inserted replaced
837:bebc19f3d2af 838:d061180f2b42
3 #include "mm7.h" 3 #include "mm7.h"
4 #include "MapInfo.h" 4 #include "MapInfo.h"
5 #include "Game.h" 5 #include "Game.h"
6 #include "GUIWindow.h" 6 #include "GUIWindow.h"
7 #include "GUIFont.h" 7 #include "GUIFont.h"
8 #include "GUIButton.h"
9 #include "GUIProgressBar.h" 8 #include "GUIProgressBar.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"
552 uTextureID_ControlBG[9] = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); 551 uTextureID_ControlBG[9] = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
553 uTextureID_ControlBG[20] = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); 552 uTextureID_ControlBG[20] = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
554 uTextureID_ControlBG[22] = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); 553 uTextureID_ControlBG[22] = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
555 uTextureID_ControlBG[21] = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); 554 uTextureID_ControlBG[21] = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
556 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); 555 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0);
557 pGUIWindow_CurrentMenu->CreateButton(0x16u, 0x10Eu, 556 pGUIWindow_CurrentMenu->CreateButton(22, 270,
558 (uTextureID_ControlBG[3] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[3]].uTextureWidth : 24), 557 pIcons_LOD->GetTexture(uTextureID_ControlBG[3])->uTextureWidth,
559 (uTextureID_ControlBG[3] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[3]].uTextureHeight : 26), 558 pIcons_LOD->GetTexture(uTextureID_ControlBG[3])->uTextureHeight,
560 v0, 0, 0xB8u, 0x80u, 0, v1, 0); 559 v0, 0,
561 pGUIWindow_CurrentMenu->CreateButton(0x5Du, 0x10Eu, 560 UIMSG_SetTurnSpeed, 0x80,
562 (uTextureID_ControlBG[2] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[2]].uTextureWidth : 24), 561 0, v1, 0);
563 (uTextureID_ControlBG[2] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[2]].uTextureHeight : 26), 562 pGUIWindow_CurrentMenu->CreateButton(0x5Du, 270,
564 v0, 0, 0xB8u, 0x40u, 0, v1, 0); 563 pIcons_LOD->GetTexture(uTextureID_ControlBG[2])->uTextureWidth,
565 pGUIWindow_CurrentMenu->CreateButton(0xA4u, 0x10Eu, 564 pIcons_LOD->GetTexture(uTextureID_ControlBG[2])->uTextureHeight,
566 (uTextureID_ControlBG[1] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[1]].uTextureWidth : 24), 565 v0, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0);
567 (uTextureID_ControlBG[1] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[1]].uTextureHeight : 26), 566 pGUIWindow_CurrentMenu->CreateButton(0xA4u, 270,
568 v0, 0, 0xB8u, 0, 0, v1, 0); 567 pIcons_LOD->GetTexture(uTextureID_ControlBG[1])->uTextureWidth,
568 pIcons_LOD->GetTexture(uTextureID_ControlBG[1])->uTextureHeight,
569 v0, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0);
569 pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu, 570 pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu,
570 (uTextureID_ControlBG[21] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[21]].uTextureWidth : 24), 571 pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureWidth,
571 (uTextureID_ControlBG[21] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[21]].uTextureHeight : 26), 572 pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureHeight,
572 v0, 0, 0xB9u, 0, 0, v1, 0); 573 v0, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0);
573 pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu, 574 pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu,
574 (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureWidth : 24), 575 (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureWidth : 24),
575 (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureHeight : 26), 576 (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureHeight : 26),
576 v0, 0, 0xBBu, 0, 0, v1, 0); 577 v0, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0);
577 pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u, 578 pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u,
578 (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureWidth : 24), 579 (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureWidth : 24),
579 (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureHeight : 26), 580 (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureHeight : 26),
580 v0, 0, 0xE1u, 0, 0, v1, 0); 581 v0, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0);
581 pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u, 582 pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u,
582 (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureWidth : 24), 583 (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureWidth : 24),
583 (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureHeight : 26), 584 (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureHeight : 26),
584 v0, 0, 0xE2u, 0, 0, v1, 0); 585 v0, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0);
585 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, 111, 4, 0, v1, 586 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 4, 0, v1,
586 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); 587 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
587 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, 0x6Fu, 5, 0, v1, 588 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeSoundVolume, 5, 0, v1,
588 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); 589 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
589 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xA2u, 0xACu, 0x11u, v0, 0, 0x6Fu, 0, 0, v1, 0); 590 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xA2u, 0xACu, 0x11u, v0, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0);
590 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 4, 0, v1, 591 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0xD8u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeMusicVolume, 4, 0, v1,
591 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); 592 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
592 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 5, 0, v1, 593 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeMusicVolume, 5, 0, v1,
593 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); 594 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
594 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xD8u, 0xACu, 0x11u, v0, 0, 0x70u, 0, 0, v1, 0); 595 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xD8u, 0xACu, 0x11u, v0, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0);
595 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 4, 0, v1, 596 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0x10Eu, 0x10u, 0x10u, v0, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1,
596 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0); 597 &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
597 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 5u, 0, v1, 598 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, UIMSG_ChangeVoiceVolume, 5u, 0, v1,
598 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0); 599 &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
599 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0x10Eu, 0xACu, 0x11u, v0, 0, 0xBAu, 0, 0, v1, 0); 600 pGUIWindow_CurrentMenu->CreateButton(0x107u, 0x10Eu, 0xACu, 0x11u, v0, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0);
600 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, 0x71u, 0, 0, 601 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, UIMSG_Escape, 0, 0,
601 pGlobalTXT_LocalizationStrings[619],// "Return to Game" 602 pGlobalTXT_LocalizationStrings[619],// "Return to Game"
602 0); 603 0);
603 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, 0x19Fu, 0, 0x4Bu, v1, 0); 604 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0);
604 pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, 421, 0, 86, v1, 0); 605 pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0);
605 continue; 606 continue;
606 case UIMSG_OpenKeyMappingOptions://Open 607 case UIMSG_OpenKeyMappingOptions://Open
607 if ( pMessageQueue_50CBD0->uNumMessages ) 608 if ( pMessageQueue_50CBD0->uNumMessages )
608 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 609 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
609 pGUIWindow_CurrentMenu->Release(); 610 pGUIWindow_CurrentMenu->Release();
613 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); 614 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
614 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); 615 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
615 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); 616 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
616 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); 617 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
617 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); 618 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0);
618 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, 0x71u, 0, 0, "", 0); 619 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0);
619 pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A0u, 0, 0, "", 0); 620 pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0);
620 pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A1u, 0, 0, "", 0); 621 pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0);
621 pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x1A2u, 0, 0, "", 0); 622 pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0);
622 pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x7Fu, 0, 0, "", 0); 623 pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0);
623 pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, 0x1A3u, 0, 0, "", 0); 624 pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0);
624 pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, 0x1A3u, 1u, 0, "", 0); 625 pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0);
625 pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, 0x1A3u, 2u, 0, "", 0); 626 pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0);
626 pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, 0x1A3u, 3u, 0, "", 0); 627 pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0);
627 pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, 0x1A3u, 4u, 0, "", 0); 628 pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0);
628 pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 5u, 0, "", 0); 629 pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0);
629 pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 6u, 0, "", 0); 630 pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0);
630 pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, 0x1A3u, 7u, 0, "", 0); 631 pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0);
631 pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, 0x1A3u, 8u, 0, "", 0); 632 pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0);
632 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, 0x1A3u, 9u, 0, "", 0); 633 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0);
633 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, 0x1A3u, 0xAu, 0, "", 0); 634 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0);
634 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, 0x1A3u, 0xBu, 0, "", 0); 635 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0);
635 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 0xCu, 0, "", 0); 636 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0);
636 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 0xDu, 0, "", 0); 637 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0);
637 dword_506E68 = -1; 638 dword_506E68 = -1;
638 KeyboardPageNum = 1; 639 KeyboardPageNum = 1;
639 memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray)); 640 memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
640 //*(_WORD *)KeyButtonArray[28] = 0; 641 //*(_WORD *)KeyButtonArray[28] = 0;
641 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); 642 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
714 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); 715 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
715 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); 716 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE);
716 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); 717 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE);
717 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); 718 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
718 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); 719 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0);
719 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, 0x71u, 0, 0, v1, 0); 720 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, UIMSG_Escape, 0, 0, v1, 0);
720 if ( pRenderer->pRenderD3D ) 721 if ( pRenderer->pRenderD3D )
721 { 722 {
722 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, v0, 0, 0x1A6u, 0, 0, v1, 0); 723 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0);
723 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, v0, 0, 0x1A7u, 0, 0, v1, 0); 724 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0);
724 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, v0, 0, 0x1A8u, 0, 0, v1, 0); 725 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleTint, 0, 0, v1, 0);
725 } 726 }
726 if ( !pRenderer->bWindowMode ) 727 if ( !pRenderer->bWindowMode )
727 { 728 {
728 v0 = 1; 729 v0 = 1;
729 if ( GammaController::IsGammaSupported() ) 730 if ( GammaController::IsGammaSupported() )
730 { 731 {
731 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, 0x1A9u, 4u, 0, v1, 732 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C20), 0);
732 &pIcons_LOD->pTextures[uTextureID_507C20], 0); 733 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C24), 0);
733 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, 0x1A9u, 5u, 0, v1, 734 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, v1, 0);
734 &pIcons_LOD->pTextures[uTextureID_507C24], 0);
735 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, 425, 0, 0, v1, 0);
736 } 735 }
737 } 736 }
738 continue; 737 continue;
739 case UIMSG_1A9: 738 case UIMSG_1A9:
740 if ( uMessageParam == 4 ) 739 if ( uMessageParam == 4 )
1494 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); 1493 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
1495 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); 1494 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
1496 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE); 1495 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
1497 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); 1496 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
1498 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE); 1497 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
1499 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, v0, 0, 0x7Cu, 0, 0x4Eu, 1498 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, v0, 0, UIMSG_StartNewGame, 0, 0x4Eu,
1500 pGlobalTXT_LocalizationStrings[614],// "New Game" 1499 pGlobalTXT_LocalizationStrings[614],// "New Game"
1501 pIcons_LOD->GetTexture(uTextureID_New1), 0); 1500 pIcons_LOD->GetTexture(uTextureID_New1), 0);
1502 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, 0x7Eu, 0, 0x53u, 1501 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u,
1503 pGlobalTXT_LocalizationStrings[615],// "Save Game" 1502 pGlobalTXT_LocalizationStrings[615],// "Save Game"
1504 pIcons_LOD->GetTexture(uTextureID_Save1), 0); 1503 pIcons_LOD->GetTexture(uTextureID_Save1), 0);
1505 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, 0x7Du, 0, 0x4Cu, 1504 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu,
1506 pGlobalTXT_LocalizationStrings[616],// "Load Game" 1505 pGlobalTXT_LocalizationStrings[616],// "Load Game"
1507 pIcons_LOD->GetTexture(uTextureID_Load1), 0); 1506 pIcons_LOD->GetTexture(uTextureID_Load1), 0);
1508 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, 0x7Fu, 0, 0x43u, 1507 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u,
1509 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" 1508 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
1510 pIcons_LOD->GetTexture(uTextureID_Controls1), 0); 1509 pIcons_LOD->GetTexture(uTextureID_Controls1), 0);
1511 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, 0x84u, 0, 0x51u, 1510 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, UIMSG_Quit, 0, 0x51u,
1512 pGlobalTXT_LocalizationStrings[618],// "Quit" 1511 pGlobalTXT_LocalizationStrings[618],// "Quit"
1513 pIcons_LOD->GetTexture(uTextureID_Quit1), 0); 1512 pIcons_LOD->GetTexture(uTextureID_Quit1), 0);
1514 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, 0x7Bu, 0, 0x52u, 1513 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u,
1515 pGlobalTXT_LocalizationStrings[619],// "Return to Game" 1514 pGlobalTXT_LocalizationStrings[619],// "Return to Game"
1516 pIcons_LOD->GetTexture(uTextureID_Resume1), 0); 1515 pIcons_LOD->GetTexture(uTextureID_Resume1), 0);
1517 pGUIWindow_CurrentMenu->_41D08F(6, v0, 0, 0); 1516 pGUIWindow_CurrentMenu->_41D08F(6, v0, 0, 0);
1518 viewparams->field_48 = v0; 1517 viewparams->field_48 = v0;
1519 stru_506E40.Release(); 1518 stru_506E40.Release();
2843 v135 = -1; 2842 v135 = -1;
2844 v132 = 0; 2843 v132 = 0;
2845 v130 = 0; 2844 v130 = 0;
2846 v127 = rand() % 2 + 204; 2845 v127 = rand() % 2 + 204;
2847 goto _play_sound_and_continue; 2846 goto _play_sound_and_continue;
2848 case UIMSG_57: 2847 case UIMSG_OpenSpellbookPage:
2849 if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) 2848 if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage )
2850 continue; 2849 continue;
2851 sub_41140B(); 2850 sub_41140B();
2852 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; 2851 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam;
2853 pGUIWindow_CurrentMenu->OpenSpellBook(); 2852 pGUIWindow_CurrentMenu->OpenSpellBook();
2980 pEventTimer->Pause(); 2979 pEventTimer->Pause();
2981 pAudioPlayer->StopChannels(-1, -1); 2980 pAudioPlayer->StopChannels(-1, -1);
2982 pCurrentScreen = SCREEN_QUICK_REFERENCE; 2981 pCurrentScreen = SCREEN_QUICK_REFERENCE;
2983 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); 2982 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0);
2984 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); 2983 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE);
2985 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, v0, 0, 0x71u, 0, 0, 2984 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, v0, 0, UIMSG_Escape, 0, 0,
2986 pGlobalTXT_LocalizationStrings[79],// "Exit" 2985 pGlobalTXT_LocalizationStrings[79],// "Exit"
2987 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); //, v179); 2986 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); //, v179);
2988 continue; 2987 continue;
2989 case UIMSG_GameMenuButton: 2988 case UIMSG_GameMenuButton:
2990 if ( pCurrentScreen ) 2989 if ( pCurrentScreen )
3042 v128 = 30; 3041 v128 = 30;
3043 v125 = 30; 3042 v125 = 30;
3044 v123 = 300; 3043 v123 = 300;
3045 v121 = 600; 3044 v121 = 600;
3046 } 3045 }
3047 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, v0, 0, 0x55u, 0, 0, 3046 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, v0, 0, UIMSG_MainMenu_ShowLoadWindow, 0, 0,
3048 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" 3047 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle"
3049 0); 3048 0);
3050 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, v0, 0, 0x85u, 0, 0, v1, 0); 3049 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, v0, 0, UIMSG_85, 0, 0, v1, 0);
3051 goto LABEL_422; 3050 goto LABEL_422;
3052 case UIMSG_85: 3051 case UIMSG_85:
3053 OnPaperdollLeftClick(); 3052 OnPaperdollLeftClick();
3054 continue; 3053 continue;
3055 case UIMSG_73: 3054 case UIMSG_73:
4538 v39 = (signed int)*((short *)v1 - 300) >> 3; 4537 v39 = (signed int)*((short *)v1 - 300) >> 3;
4539 if ( v2 == 2 ) 4538 if ( v2 == 2 )
4540 { 4539 {
4541 v4 = &pSpriteObjects[v3]; 4540 v4 = &pSpriteObjects[v3];
4542 v36 = v4; 4541 v36 = v4;
4543 v5 = v4->field_58_pid; 4542 v5 = v4->spell_caster_pid;
4544 v2 = v5 & 7; 4543 v2 = v5 & 7;
4545 v3 = v5 >> 3; 4544 v3 = v5 >> 3;
4546 } 4545 }
4547 v41 = v2; 4546 v41 = v2;
4548 v37 = v3; 4547 v37 = v3;
4779 if ( (a1 & 7) == OBJECT_Item) 4778 if ( (a1 & 7) == OBJECT_Item)
4780 { 4779 {
4781 v4 = &pSpriteObjects[a1 >> 3]; 4780 v4 = &pSpriteObjects[a1 >> 3];
4782 //uDamageAmount = (int)v4; 4781 //uDamageAmount = (int)v4;
4783 v61 = v4->field_60_distance_related_prolly_lod; 4782 v61 = v4->field_60_distance_related_prolly_lod;
4784 a1 = v4->field_58_pid; 4783 a1 = v4->spell_caster_pid;
4785 //v54 = v4->field_58_pid; 4784 //v54 = v4->field_58_pid;
4786 } 4785 }
4787 //v5 = a1 & 7; 4786 //v5 = a1 & 7;
4788 //uPlayerID = a1 >> 3; 4787 //uPlayerID = a1 >> 3;
4789 if ((a1 & 7) != OBJECT_Player) 4788 if ((a1 & 7) != OBJECT_Player)
4848 goto LABEL_67; 4847 goto LABEL_67;
4849 //goto LABEL_69; 4848 //goto LABEL_69;
4850 } 4849 }
4851 4850
4852 4851
4853 v19 = v4->field_48 == 99; 4852 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER;
4854 v61 = v4->field_60_distance_related_prolly_lod; 4853 v61 = v4->field_60_distance_related_prolly_lod;
4855 if ( !v19 ) 4854 if ( !v19 )
4856 { 4855 {
4857 v9 = (SpriteObject *)uDamageAmount; 4856 v9 = (SpriteObject *)uDamageAmount;
4858 v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); 4857 v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4);
4895 v61 = 1; 4894 v61 = 1;
4896 } 4895 }
4897 v4 = (SpriteObject *)uDamageAmount; 4896 v4 = (SpriteObject *)uDamageAmount;
4898 } 4897 }
4899 4898
4900 v15 = v4->field_48; 4899 v15 = v4->spell_id;
4901 if ( v15 == 102 ) 4900 if ( v15 == SPELL_LASER_PROJECTILE )
4902 { 4901 {
4903 v16 = player->pActiveSkills[7]; 4902 v16 = player->pActiveSkills[7];
4904 v61 = 1; 4903 v61 = 1;
4905 if ( (signed int)SkillToMastery(v16) >= 3 ) 4904 if ( (signed int)SkillToMastery(v16) >= 3 )
4906 a4 = player->pActiveSkills[7] & 0x3F; 4905 a4 = player->pActiveSkills[7] & 0x3F;
4907 a2 = 4; 4906 a2 = 4;
4908 uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0); 4907 uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0);
4909 goto LABEL_67; 4908 goto LABEL_67;
4910 } 4909 }
4911 if ( v15 != 100 ) 4910 if ( v15 != SPELL_BOW_ARROW )
4912 { 4911 {
4913 if ( v15 == 101 ) 4912 if ( v15 == SPELL_101 )
4914 { 4913 {
4915 a2 = 0; 4914 a2 = 0;
4916 v18 = player->CalculateRangedDamageTo(0); 4915 v18 = player->CalculateRangedDamageTo(0);
4917 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; 4916 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0;
4918 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; 4917 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0;
4920 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) 4919 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
4921 uDamageAmount >>= 1; 4920 uDamageAmount >>= 1;
4922 v59 = 1; 4921 v59 = 1;
4923 goto LABEL_67; 4922 goto LABEL_67;
4924 } 4923 }
4925 if ( v15 == 39 ) 4924 if ( v15 == SPELL_EARTH_BLADES )
4926 { 4925 {
4927 a4 = 5 * v4->field_4C; 4926 a4 = 5 * v4->spell_level;
4928 a2 = player->GetSpellSchool(0x27u); 4927 a2 = player->GetSpellSchool(0x27u);
4929 v21 = v4->field_4C; 4928 v21 = v4->spell_level;
4930 v50 = pMonster->sCurrentHP; 4929 v50 = pMonster->sCurrentHP;
4931 pMonsterName = (char *)v4->field_50; 4930 pMonsterName = (char *)v4->spell_skill;
4932 v22 = _43AFE3_calc_spell_damage(39, v21, (signed int)pMonsterName, v50); 4931 v22 = _43AFE3_calc_spell_damage(39, v21, v4->spell_skill, v50);
4933 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; 4932 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0;
4934 v24 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; 4933 v24 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0;
4935 uDamageAmount = v22; 4934 uDamageAmount = v22;
4936 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) 4935 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) )
4937 uDamageAmount >>= 1; 4936 uDamageAmount >>= 1;
4943 player->PlaySound(SPEECH_52, 0); 4942 player->PlaySound(SPEECH_52, 0);
4944 return; 4943 return;
4945 } 4944 }
4946 goto LABEL_69; 4945 goto LABEL_69;
4947 } 4946 }
4948 if ( v15 == 34 ) 4947 if ( v15 == SPELL_EARTH_STUN )
4949 { 4948 {
4950 uDamageAmount = 0; 4949 uDamageAmount = 0;
4951 a2 = 4; 4950 a2 = 4;
4952 hit_will_stun = 1; 4951 hit_will_stun = 1;
4953 goto LABEL_67; 4952 goto LABEL_67;
4954 } 4953 }
4955 v50 = v4->field_48; 4954 a2 = player->GetSpellSchool(v4->spell_id);
4956 a2 = player->GetSpellSchool(v50); 4955 v25 = v4->spell_level;
4957 v25 = v4->field_4C; 4956 v26 = v4->spell_id;
4958 v26 = v4->field_48;
4959 v50 = pMonster->sCurrentHP; 4957 v50 = pMonster->sCurrentHP;
4960 pMonsterName = (char *)v4->field_50; 4958 pMonsterName = (char *)v4->spell_skill;
4961 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); 4959 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50);
4962 v59 = 0; 4960 v59 = 0;
4963 //v57 = (PlayerEquipment *)1; 4961 //v57 = (PlayerEquipment *)1;
4964 //LABEL_65: 4962 //LABEL_65:
4965 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); 4963 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, v4->spell_skill, v50);
4966 //if ( !v57 ) 4964 //if ( !v57 )
4967 // goto LABEL_67; 4965 // goto LABEL_67;
4968 goto LABEL_69; 4966 goto LABEL_69;
4969 } 4967 }
4970 v50 = pMonster->word_000086_some_monster_id; 4968 v50 = pMonster->word_000086_some_monster_id;
5448 } 5446 }
5449 viewparams->bRedrawGameUI = 1; 5447 viewparams->bRedrawGameUI = 1;
5450 return; 5448 return;
5451 } 5449 }
5452 v37 = &pSpriteObjects[uActorID]; 5450 v37 = &pSpriteObjects[uActorID];
5453 v38 = v37->field_58_pid & 7; 5451 v38 = v37->spell_caster_pid & 7;
5454 v39 = v37->field_58_pid >> 3; 5452 v39 = v37->spell_caster_pid >> 3;
5455 v40 = v37->field_58_pid & 7; 5453 v40 = v37->spell_caster_pid & 7;
5456 uActorID = v37->field_58_pid >> 3; 5454 uActorID = v37->spell_caster_pid >> 3;
5457 v41 = v40 - 2; 5455 v41 = v40 - 2;
5458 if ( !v41 ) 5456 if ( !v41 )
5459 goto LABEL_80; 5457 goto LABEL_80;
5460 v42 = v41 - 1; 5458 v42 = v41 - 1;
5461 if ( !v42 ) 5459 if ( !v42 )
5637 if ( a4 != -1 ) 5635 if ( a4 != -1 )
5638 { 5636 {
5639 v43 = &pParty->pPlayers[a4]; 5637 v43 = &pParty->pPlayers[a4];
5640 LABEL_168: 5638 LABEL_168:
5641 a4b = v43; 5639 a4b = v43;
5642 if ( v38 != OBJECT_Player || v37->field_48 != 100 ) 5640 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW)
5643 { 5641 {
5644 v70 = v43->GetMaxHealth(); 5642 v70 = v43->GetMaxHealth();
5645 v68 = _43AFE3_calc_spell_damage(v37->field_48, v37->field_4C, v37->field_50, v70); 5643 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70);
5646 v69 = LOBYTE(pSpellStats->pInfos[v37->field_48].uSchool); 5644 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool);
5647 } 5645 }
5648 else 5646 else
5649 { 5647 {
5650 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); 5648 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
5651 v69 = 0; 5649 v69 = 0;
5679 } 5677 }
5680 5678
5681 //----- (0043A97E) -------------------------------------------------------- 5679 //----- (0043A97E) --------------------------------------------------------
5682 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) 5680 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
5683 { 5681 {
5684 unsigned int v2; // esi@1 5682 if ( PID_TYPE(a2) == OBJECT_BLVDoor)
5685 unsigned int v3; // ebx@1 5683 {
5686 int v4; // edi@1 5684 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
5687 int v5; // edx@1 5685 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
5688 unsigned int v6; // [sp+10h] [bp-4h]@1 5686 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
5689 5687
5690 v6 = uLayingItemID;
5691 v2 = uLayingItemID;
5692 v3 = a2 >> 3;
5693 v4 = pSpriteObjects[uLayingItemID].field_58_pid & 7;
5694 v5 = (a2 & 7) - 3;
5695 if ( v5 )
5696 {
5697 if ( v5 == 1 )
5698 {
5699 layingitem_vel_50FDFC.x = pSpriteObjects[v2].vVelocity.x;
5700 layingitem_vel_50FDFC.y = pSpriteObjects[v2].vVelocity.y;
5701 layingitem_vel_50FDFC.z = pSpriteObjects[v2].vVelocity.z;
5702 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
5703 DamagePlayerFromMonster(8 * v6 | 2, pSpriteObjects[v2].field_61, &layingitem_vel_50FDFC, 0xFFFFFFFFu);
5704 }
5705 }
5706 else
5707 {
5708 layingitem_vel_50FDFC.x = pSpriteObjects[v2].vVelocity.x;
5709 layingitem_vel_50FDFC.y = pSpriteObjects[v2].vVelocity.y;
5710 layingitem_vel_50FDFC.z = pSpriteObjects[v2].vVelocity.z;
5711 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); 5688 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
5712 switch ( v4 ) 5689 DamagePlayerFromMonster(PID(OBJECT_Item, uLayingItemID), pSpriteObjects[uLayingItemID].field_61, &layingitem_vel_50FDFC, 0xFFFFFFFFu);
5690 }
5691 else if (PID_TYPE(a2) == OBJECT_Actor)
5692 {
5693 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
5694 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
5695 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
5696
5697 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
5698 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid))
5713 { 5699 {
5714 case OBJECT_Actor: 5700 case OBJECT_Actor:
5715 sub_43B1B0(8 * v6 | AI_OBJECT_LAYING_ITEM, v3, &layingitem_vel_50FDFC, pSpriteObjects[v2].field_61); 5701 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61);
5716 break; 5702 break;
5717 case OBJECT_Player: 5703 case OBJECT_Player:
5718 DamageMonsterFromParty(8 * v6 | AI_OBJECT_LAYING_ITEM, v3, &layingitem_vel_50FDFC); 5704 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
5719 break; 5705 break;
5720 case OBJECT_Item: 5706 case OBJECT_Item:
5721 sub_43B057(8 * v6 | AI_OBJECT_LAYING_ITEM, v3, &layingitem_vel_50FDFC); 5707 sub_43B057(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
5722 break; 5708 break;
5723 } 5709 }
5724 } 5710 }
5725 } 5711 }
5726 5712
5862 if ( !pActors[uActorID].IsNotAlive() ) 5848 if ( !pActors[uActorID].IsNotAlive() )
5863 { 5849 {
5864 if ( (a2 & 7) == OBJECT_Item) 5850 if ( (a2 & 7) == OBJECT_Item)
5865 { 5851 {
5866 v4 = &pSpriteObjects[(signed int)a2 >> 3]; 5852 v4 = &pSpriteObjects[(signed int)a2 >> 3];
5867 v5 = v4->field_48; 5853 v5 = v4->spell_id;
5868 if ( v5 ) 5854 if ( v5 )
5869 { 5855 {
5870 v6 = _43AFE3_calc_spell_damage(v5, v4->field_4C, v4->field_50, pActor->sCurrentHP); 5856 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP);
5871 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); 5857 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6);
5872 pActor->sCurrentHP -= v7; 5858 pActor->sCurrentHP -= v7;
5873 if ( v7 ) 5859 if ( v7 )
5874 { 5860 {
5875 if ( pActor->sCurrentHP > 0 ) 5861 if ( pActor->sCurrentHP > 0 )
5922 v17 = a1; 5908 v17 = a1;
5923 if ( (a1 & 7) == OBJECT_Item) 5909 if ( (a1 & 7) == OBJECT_Item)
5924 { 5910 {
5925 v5 = &pSpriteObjects[a1 >> 3]; 5911 v5 = &pSpriteObjects[a1 >> 3];
5926 v4 = v5->field_60_distance_related_prolly_lod; 5912 v4 = v5->field_60_distance_related_prolly_lod;
5927 v17 = v5->field_58_pid; 5913 v17 = v5->spell_caster_pid;
5928 } 5914 }
5929 LOWORD(v6) = v17 & 7; 5915 LOWORD(v6) = v17 & 7;
5930 if ( v6 == OBJECT_Actor) 5916 if ( v6 == OBJECT_Actor)
5931 { 5917 {
5932 v7 = &pActors[a2]; 5918 v7 = &pActors[a2];
6893 6879
6894 v1 = this; 6880 v1 = this;
6895 _404544(); 6881 _404544();
6896 v2 = v1->pQueue; 6882 v2 = v1->pQueue;
6897 v3 = 0; 6883 v3 = 0;
6898 if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player) 6884 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player)
6899 uActiveCharacter = (v1->pQueue[0].uPackedID >> 3) + 1; 6885 uActiveCharacter = PID_ID(v1->pQueue[0].uPackedID) + 1;
6900 else 6886 else
6901 uActiveCharacter = 0; 6887 uActiveCharacter = 0;
6902 viewparams->bRedrawGameUI = 1; 6888 viewparams->bRedrawGameUI = 1;
6903 if ( v1->field_1C ) 6889 if ( v1->field_1C )
6904 { 6890 {
6912 v13 = 0; 6898 v13 = 0;
6913 if ( v1->uActorQueueSize <= 0 ) 6899 if ( v1->uActorQueueSize <= 0 )
6914 goto LABEL_27; 6900 goto LABEL_27;
6915 do 6901 do
6916 { 6902 {
6917 if ( (v2->uPackedID & 7) != OBJECT_Player) 6903 if (PID_TYPE(v2->uPackedID) != OBJECT_Player)
6918 { 6904 {
6919 v5 = &pActors[v2->uPackedID >> 3]; 6905 v5 = &pActors[PID_ID(v2->uPackedID)];
6920 LOWORD(v6) = v5->uAIState; 6906 LOWORD(v6) = v5->uAIState;
6921 if ( (short)v6 == 4 6907 if ( (short)v6 == 4
6922 || (short)v6 == 8 6908 || (short)v6 == 8
6923 || (short)v6 == 2 6909 || (short)v6 == 2
6924 || (short)v6 == 3 6910 || (short)v6 == 3
6970 if ( v1->uActorQueueSize > v3 ) 6956 if ( v1->uActorQueueSize > v3 )
6971 { 6957 {
6972 v9 = v1->pQueue; 6958 v9 = v1->pQueue;
6973 do 6959 do
6974 { 6960 {
6975 if ( (v9->uPackedID & 7) != OBJECT_Player) 6961 if (PID_TYPE(v9->uPackedID) != OBJECT_Player)
6976 { 6962 {
6977 v10 = v9->uPackedID >> 3; 6963 v10 = PID_ID(v9->uPackedID);
6978 v11 = pActors[v10].uAIState; 6964 v11 = pActors[v10].uAIState;
6979 if ( v11 != 5 ) 6965 if ( v11 != 5 )
6980 { 6966 {
6981 if ( v11 != 4 && v11 != 11 && v11 != 19 ) 6967 if ( v11 != 4 && v11 != 11 && v11 != 19 )
6982 { 6968 {
7022 result = 1; 7008 result = 1;
7023 viewparams->bRedrawGameUI = 1; 7009 viewparams->bRedrawGameUI = 1;
7024 v4 = v1->pQueue[0].field_4; 7010 v4 = v1->pQueue[0].field_4;
7025 if ( v4 ) 7011 if ( v4 )
7026 { 7012 {
7027 if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player) 7013 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player)
7028 { 7014 {
7029 v5 = v1->uActorQueueSize; 7015 v5 = v1->uActorQueueSize;
7030 while ( 1 ) 7016 while ( 1 )
7031 { 7017 {
7032 v6 = 0; 7018 v6 = 0;
7121 { 7107 {
7122 v6 = pMonsterStats->pInfos[pActors[v3 >> 3].pMonsterInfo.uID].uRecoveryTime; 7108 v6 = pMonsterStats->pInfos[pActors[v3 >> 3].pMonsterInfo.uID].uRecoveryTime;
7123 } 7109 }
7124 v2->pQueue[a2].field_4 = v6; 7110 v2->pQueue[a2].field_4 = v6;
7125 v2->_404544(); 7111 v2->_404544();
7126 if ( (v2->pQueue[0].uPackedID & 7) == OBJECT_Player) 7112 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player)
7127 uActiveCharacter = (v2->pQueue[0].uPackedID >> 3) + 1; 7113 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1;
7128 else 7114 else
7129 uActiveCharacter = 0; 7115 uActiveCharacter = 0;
7130 result = (int)&v2->pQueue[0].field_4; 7116 result = (int)&v2->pQueue[0].field_4;
7131 viewparams->bRedrawGameUI = 1; 7117 viewparams->bRedrawGameUI = 1;
7132 while ( *(int *)result > 0 ) 7118 while ( *(int *)result > 0 )
7200 unsigned int v5; // edi@14 7186 unsigned int v5; // edi@14
7201 7187
7202 v1 = this; 7188 v1 = this;
7203 LOWORD(v2) = _404544(); 7189 LOWORD(v2) = _404544();
7204 if ( v1->pQueue[0].field_4 <= 0 7190 if ( v1->pQueue[0].field_4 <= 0
7205 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, (v1->pQueue[0].uPackedID & 7) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2), 7191 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2),
7206 viewparams->bRedrawGameUI = 1, 7192 viewparams->bRedrawGameUI = 1,
7207 v1->pQueue[0].field_4 <= 0) ) 7193 v1->pQueue[0].field_4 <= 0) )
7208 { 7194 {
7209 v3 = 0; 7195 v3 = 0;
7210 if ( v1->uActorQueueSize > 0 ) 7196 if ( v1->uActorQueueSize > 0 )
7268 unsigned int a2a; // [sp+50h] [bp+8h]@2 7254 unsigned int a2a; // [sp+50h] [bp+8h]@2
7269 7255
7270 v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); 7256 v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2));
7271 v28 = v1; 7257 v28 = v1;
7272 v3 = v1->uPackedID; 7258 v3 = v1->uPackedID;
7273 if ( (v1->uPackedID & 7) != OBJECT_Player) 7259 if (PID_TYPE(v1->uPackedID) != OBJECT_Player)
7274 { 7260 {
7275 v4 = v3 >> 3; // turn based only stuff 7261 v4 = PID_ID(v3);
7276 a2a = ai_near_actors_targets_pid[v3 >> 3]; 7262 a2a = ai_near_actors_targets_pid[PID_ID(v3)];
7277 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[v3 >> 3], &a3, 0), sizeof(a3)); 7263 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3));
7278 memcpy(&a4, &a3, sizeof(a4)); 7264 memcpy(&a4, &a3, sizeof(a4));
7279 v5 = &pActors[v3 >> 3]; 7265 v5 = &pActors[PID_ID(v3 >> 3)];
7280 LOWORD(v3) = v5->uAIState; 7266 LOWORD(v3) = v5->uAIState;
7281 if ( (short)v3 != Dead ) 7267 if ( (short)v3 != Dead )
7282 { 7268 {
7283 if ( (short)v3 != Disabled ) 7269 if ( (short)v3 != Disabled )
7284 { 7270 {
7432 if ( ((a3.uDistance - v8) & 0x80000000u) != 0 ) 7418 if ( ((a3.uDistance - v8) & 0x80000000u) != 0 )
7433 { 7419 {
7434 v9 = 0; 7420 v9 = 0;
7435 v20 = 0; 7421 v20 = 0;
7436 } 7422 }
7437 if ( (v22 & 7) == OBJECT_Actor) 7423 if (PID_TYPE(v22) == OBJECT_Actor)
7438 v10 = (unsigned __int8)*(&byte_5C8D1A[89 7424 v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[v22 >> 3].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3);
7439 * (pMonsterStats->pInfos[pActors[v22 >> 3].pMonsterInfo.uID].uID - 1)
7440 / 3]
7441 + (v5->pMonsterInfo.uID - 1) / 3);
7442 else 7425 else
7443 v10 = 4; 7426 v10 = 4;
7444 if ( v10 == 1 ) 7427 if ( v10 == 1 )
7445 { 7428 {
7446 if ( (double)(signed int)v20 < 307.2 ) 7429 if ( (double)(signed int)v20 < 307.2 )
7565 { 7548 {
7566 v10 = this->pQueue; 7549 v10 = this->pQueue;
7567 while ( 1 ) 7550 while ( 1 )
7568 { 7551 {
7569 v5 = v10->uPackedID; 7552 v5 = v10->uPackedID;
7570 if ( (v10->uPackedID & 7) == OBJECT_Actor) 7553 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor)
7571 { 7554 {
7572 v8 = ai_near_actors_targets_pid[v5 >> 3]; 7555 v8 = ai_near_actors_targets_pid[PID_ID(v5)];
7573 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); 7556 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7));
7574 if ( !v1->_406D10(a2) ) 7557 if ( !v1->_406D10(a2) )
7575 Actor::AI_Stand(v10->uPackedID >> 3, v8, 0x20u, &v7); 7558 Actor::AI_Stand(v10->uPackedID >> 3, v8, 0x20u, &v7);
7576 } 7559 }
7577 ++a2; 7560 ++a2;
7604 if ( this->uActorQueueSize > 0 ) 7587 if ( this->uActorQueueSize > 0 )
7605 { 7588 {
7606 v2 = this->pQueue; 7589 v2 = this->pQueue;
7607 do 7590 do
7608 { 7591 {
7609 if ( (v2->uPackedID & 7) == OBJECT_Actor) 7592 if (PID_TYPE(v2->uPackedID) == OBJECT_Actor)
7610 { 7593 {
7611 v3 = v2->uPackedID >> 3; 7594 v3 = PID_ID(v2->uPackedID);
7612 v8 = v3; 7595 v8 = v3;
7613 if ( pActors[v3].CanAct() ) 7596 if ( pActors[v3].CanAct() )
7614 { 7597 {
7615 v4 = v2->uPackedID; 7598 v4 = v2->uPackedID;
7616 v9 = ai_near_actors_targets_pid[v3]; 7599 v9 = ai_near_actors_targets_pid[v3];
7659 v14 = this->pQueue; 7642 v14 = this->pQueue;
7660 while ( 1 ) 7643 while ( 1 )
7661 { 7644 {
7662 v4 = v14->uPackedID; 7645 v4 = v14->uPackedID;
7663 a1 = v14->uPackedID; 7646 a1 = v14->uPackedID;
7664 if ( (a1 & 7) != OBJECT_Player) 7647 if (PID_TYPE(a1) != OBJECT_Player)
7665 { 7648 {
7666 v5 = v4 >> 3; 7649 v5 = v4 >> 3;
7667 v12 = v5; 7650 v12 = v5;
7668 v6 = &pActors[v5]; 7651 v6 = &pActors[v5];
7669 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result 7652 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result
7742 unsigned int v28; // [sp+48h] [bp-Ch]@10 7725 unsigned int v28; // [sp+48h] [bp-Ch]@10
7743 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 7726 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7
7744 unsigned int uActorID; // [sp+50h] [bp-4h]@2 7727 unsigned int uActorID; // [sp+50h] [bp-4h]@2
7745 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 7728 unsigned int a2a; // [sp+5Ch] [bp+8h]@7
7746 7729
7730 __debugbreak();
7747 v2 = *(&this->field_0 + 4 * (a2 + 2)); 7731 v2 = *(&this->field_0 + 4 * (a2 + 2));
7748 if ( (v2 & 7) == OBJECT_Player) 7732 if (PID_TYPE(v2) == OBJECT_Player)
7749 return 0; 7733 return 0;
7750 v3 = v2 >> 3; 7734 v3 = PID_ID(v2);
7751 uActorID = v3; 7735 uActorID = v3;
7752 v4 = &pActors[v3]; 7736 v4 = &pActors[v3];
7753 v5 = v4->uAIState; 7737 v5 = v4->uAIState;
7754 if ( v5 == 5 || v5 == 4 || v5 == 11 || v5 == 19 || v5 == 17 ) 7738 if ( v5 == 5 || v5 == 4 || v5 == 11 || v5 == 19 || v5 == 17 )
7755 return 1; 7739 return 1;
7937 v3 = this->pQueue; 7921 v3 = this->pQueue;
7938 v18 = (char *)&pTurnEngine - (char *)this; 7922 v18 = (char *)&pTurnEngine - (char *)this;
7939 v14 = this->pQueue; 7923 v14 = this->pQueue;
7940 do 7924 do
7941 { 7925 {
7942 if ( (v3->uPackedID & 7) != OBJECT_Player) 7926 if (PID_TYPE(v3->uPackedID) != OBJECT_Player)
7943 { 7927 {
7944 v4 = v3->uPackedID >> 3; 7928 v4 = PID_ID(v3->uPackedID);
7945 uActorID = v4; 7929 uActorID = v4;
7946 v5 = &pActors[v4]; 7930 v5 = &pActors[v4];
7947 v6 = v5->uAIState; 7931 v6 = v5->uAIState;
7948 if ( v6 != 5 ) 7932 if ( v6 != 5 )
7949 { 7933 {
11606 { 11590 {
11607 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 11591 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
11608 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 11592 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
11609 } 11593 }
11610 //v11 = i->uControlParam; 11594 //v11 = i->uControlParam;
11611 pMessageQueue_50CBD0->AddMessage((UIMessageType)i->uControlID, i->uControlParam, 0); 11595 pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0);
11612 return; 11596 return;
11613 } 11597 }
11614 goto LABEL_45; 11598 goto LABEL_45;
11615 } 11599 }
11616 y = pY; 11600 y = pY;
11619 if ( pRenderer->pRenderD3D ) 11603 if ( pRenderer->pRenderD3D )
11620 v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); 11604 v5 = pGame->pVisInstance->get_picked_object_zbuf_val();
11621 else 11605 else
11622 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; 11606 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
11623 v6 = (unsigned __int16)v5; 11607 v6 = (unsigned __int16)v5;
11624 if ( (v5 & 7) == OBJECT_Actor 11608 if (PID_TYPE(v5) == OBJECT_Actor
11625 && uActiveCharacter 11609 && uActiveCharacter
11626 && v5 < 33554432 11610 && v5 < 0x2000000
11627 && pPlayers[uActiveCharacter]->CanAct() 11611 && pPlayers[uActiveCharacter]->CanAct()
11628 && pPlayers[uActiveCharacter]->CanSteal() ) 11612 && pPlayers[uActiveCharacter]->CanSteal() )
11629 { 11613 {
11630 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 11614 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
11631 { 11615 {
11632 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)27; 11616 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)27;
11633 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3; 11617 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3;
11634 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 11618 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
11635 ++pMessageQueue_50CBD0->uNumMessages; 11619 ++pMessageQueue_50CBD0->uNumMessages;
11636 }*/ 11620 }*/
11637 pMessageQueue_50CBD0->AddMessage(UIMSG_1B, v6 >> 3, 0); 11621 pMessageQueue_50CBD0->AddMessage(UIMSG_1B, PID_ID(v6), 0);
11638 11622
11639 if ( pParty->bTurnBasedModeOn == 1 ) 11623 if ( pParty->bTurnBasedModeOn == 1 )
11640 { 11624 {
11641 if ( pTurnEngine->field_4 == 3 ) 11625 if ( pTurnEngine->field_4 == 3 )
11642 pTurnEngine->field_18 |= 8u; 11626 pTurnEngine->field_18 |= 8u;
11855 if ( !dword_507CBC ) 11839 if ( !dword_507CBC )
11856 { 11840 {
11857 dword_507CBC = 1; 11841 dword_507CBC = 1;
11858 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) 11842 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
11859 { 11843 {
11860 if ( i->uControlID == 120 ) 11844 if ( i->msg == UIMSG_InventoryLeftClick )
11861 { 11845 {
11862 dword_50698C = i->uX; 11846 dword_50698C = i->uX;
11863 dword_506988 = i->uY; 11847 dword_506988 = i->uY;
11864 dword_506984 = i->uZ; 11848 dword_506984 = i->uZ;
11865 dword_506980 = i->uW; 11849 dword_506980 = i->uW;
11874 0x2Eu, 11858 0x2Eu,
11875 (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureWidth : 24), 11859 (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureWidth : 24),
11876 (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureHeight : 26), 11860 (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureHeight : 26),
11877 1, 11861 1,
11878 0, 11862 0,
11879 0xA9u, 11863 UIMSG_A9, 0,
11880 0,
11881 0, 11864 0,
11882 "", 11865 "",
11883 (Texture *)(uTextureID_ar_up_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_up] : 0), 11866 (Texture *)(uTextureID_ar_up_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_up] : 0),
11884 uTextureID_ar_up_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_dn] : 0, 11867 uTextureID_ar_up_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_dn] : 0,
11885 0); 11868 0);
11888 0x124u, 11871 0x124u,
11889 (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureWidth : 24), 11872 (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureWidth : 24),
11890 (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureHeight : 26), 11873 (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureHeight : 26),
11891 1, 11874 1,
11892 0, 11875 0,
11893 0xAAu, 11876 UIMSG_AA, 0,
11894 0,
11895 0, 11877 0,
11896 "", 11878 "",
11897 (Texture *)(uTextureID_ar_dn_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_up] : 0), 11879 (Texture *)(uTextureID_ar_dn_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_up] : 0),
11898 uTextureID_ar_dn_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_dn] : 0, 11880 uTextureID_ar_dn_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_dn] : 0,
11899 0); 11881 0);
11902 0x3Eu, 11884 0x3Eu,
11903 0x10u, 11885 0x10u,
11904 0xE8u, 11886 0xE8u,
11905 1, 11887 1,
11906 0, 11888 0,
11907 0xC0u, 11889 UIMSG_C0, 0,
11908 0,
11909 0, 11890 0,
11910 "", 11891 "",
11911 0); 11892 0);
11912 } 11893 }
11913 } 11894 }
11927 pBtn_Down->Release(); 11908 pBtn_Down->Release();
11928 pBtn_Down = 0; 11909 pBtn_Down = 0;
11929 pBtn_Up = 0; 11910 pBtn_Up = 0;
11930 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) 11911 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
11931 { 11912 {
11932 if ( i->uControlID == 120 ) 11913 if ( i->msg == UIMSG_InventoryLeftClick )
11933 { 11914 {
11934 i->uX = dword_50698C; 11915 i->uX = dword_50698C;
11935 i->uY = dword_506988; 11916 i->uY = dword_506988;
11936 i->uZ = dword_506984; 11917 i->uZ = dword_506984;
11937 i->uW = dword_506980; 11918 i->uW = dword_506980;