comparison IO/Mouse.cpp @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents 1bcadc6dd203
children c674d547cc7c
comparison
equal deleted inserted replaced
2540:abc6a9d079b9 2541:a902abdfc7f2
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <crtdbg.h> 3 #include <crtdbg.h>
4 4
5 #define _CRT_SECURE_NO_WARNINGS 5 #define _CRT_SECURE_NO_WARNINGS
6 6
7 #include "Engine/mm7_data.h" 7 #include "Engine/Engine.h"
8
8 #include "Mouse.h" 9 #include "Mouse.h"
9 #include "Engine/Party.h" 10 #include "Engine/Party.h"
10 #include "Engine/LOD.h" 11 #include "Engine/LOD.h"
11 #include "Engine/Game.h"
12 12
13 #include "Engine/TurnEngine/TurnEngine.h" 13 #include "Engine/TurnEngine/TurnEngine.h"
14 #include "Engine/Graphics/Viewport.h" 14 #include "Engine/Graphics/Viewport.h"
15 #include "GUI/GUIWindow.h" 15 #include "GUI/GUIWindow.h"
16 #include "Engine/Graphics/Vis.h" 16 #include "Engine/Graphics/Vis.h"
17 #include "Engine/Objects/Actor.h" 17 #include "Engine/Objects/Actor.h"
18 #include "Engine/MM7.h"
19 #include "Media/Audio/AudioPlayer.h" 18 #include "Media/Audio/AudioPlayer.h"
20 19
21 20
22 Mouse *pMouse; 21 Mouse *pMouse;
23 22
58 // DDSURFACEDESC2 Dst; 57 // DDSURFACEDESC2 Dst;
59 58
60 if ( !this->bInitialized || !pName ) 59 if ( !this->bInitialized || !pName )
61 return; 60 return;
62 if ( _stricmp("MICON2", pName) )//если кусор не мишень 61 if ( _stricmp("MICON2", pName) )//если кусор не мишень
63 pGame->uFlags2 &= 0xFFFFFFEF; 62 pEngine->uFlags2 &= 0xFFFFFFEF;
64 else 63 else
65 pGame->uFlags2 |= 0x10; 64 pEngine->uFlags2 |= 0x10;
66 if ( _stricmp(this->pCurrentCursorName, pName) ) 65 if ( _stricmp(this->pCurrentCursorName, pName) )
67 strcpy(this->pCurrentCursorName, pName); 66 strcpy(this->pCurrentCursorName, pName);
68 ClearCursor(); 67 ClearCursor();
69 if ( _strnicmp(pName, "MICON1", 5) )//for click to item / если курсор с вещью 68 if ( _strnicmp(pName, "MICON1", 5) )//for click to item / если курсор с вещью
70 { 69 {
442 signed int v10; // eax@50 441 signed int v10; // eax@50
443 // int v11; // ecx@52 442 // int v11; // ecx@52
444 unsigned int pX; // [sp+14h] [bp-8h]@7 443 unsigned int pX; // [sp+14h] [bp-8h]@7
445 unsigned int pY; // [sp+18h] [bp-4h]@7 444 unsigned int pY; // [sp+18h] [bp-4h]@7
446 445
447 if ( pCurrentScreen == SCREEN_VIDEO || sub_4637E0_is_there_popup_onscreen() ) 446 if ( current_screen_type == SCREEN_VIDEO || sub_4637E0_is_there_popup_onscreen() )
448 return; 447 return;
449 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 ) 448 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 )
450 { 449 {
451 sub_4452BB(); 450 sub_4452BB();
452 return; 451 return;
465 x = pX; 464 x = pX;
466 } 465 }
467 466
468 extern bool _507B98_ctrl_pressed; 467 extern bool _507B98_ctrl_pressed;
469 x = pX; 468 x = pX;
470 if ( GetCurrentMenuID() != -1 || pCurrentScreen != SCREEN_GAME || !_507B98_ctrl_pressed // stealing cursor 469 if ( GetCurrentMenuID() != -1 || current_screen_type != SCREEN_GAME || !_507B98_ctrl_pressed // stealing cursor
471 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X 470 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X
472 || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y) 471 || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y)
473 { 472 {
474 y = pY; 473 y = pY;
475 for ( int i = uNumVisibleWindows; i >= 0; --i ) 474 for ( int i = uNumVisibleWindows; i >= 0; --i )
534 } 533 }
535 return; 534 return;
536 } 535 }
537 y = pY; 536 y = pY;
538 //if ( pRenderer->pRenderD3D ) 537 //if ( pRenderer->pRenderD3D )
539 v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); 538 v5 = pEngine->pVisInstance->get_picked_object_zbuf_val();
540 /*else 539 /*else
541 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/ 540 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];*/
542 541
543 uint type = PID_TYPE((unsigned __int16)v5); 542 uint type = PID_TYPE((unsigned __int16)v5);
544 if (type == OBJECT_Actor && uActiveCharacter && v5 < 0x2000000 543 if (type == OBJECT_Actor && uActiveCharacter && v5 < 0x2000000
613 case VK_LEFT: 612 case VK_LEFT:
614 { 613 {
615 v12 = pWindowList[v3].field_34; 614 v12 = pWindowList[v3].field_34;
616 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) 615 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
617 { 616 {
618 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; 617 v8 = current_screen_type == SCREEN_PARTY_CREATION;
619 pWindowList[v3].pCurrentPosActiveItem -= v12; 618 pWindowList[v3].pCurrentPosActiveItem -= v12;
620 if ( v8 ) 619 if ( v8 )
621 { 620 {
622 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); 621 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
623 //v2 = pMessageQueue_50CBD0->uNumMessages; 622 //v2 = pMessageQueue_50CBD0->uNumMessages;
644 case VK_RIGHT: 643 case VK_RIGHT:
645 { 644 {
646 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; 645 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
647 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) 646 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
648 { 647 {
649 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; 648 v8 = current_screen_type == SCREEN_PARTY_CREATION;
650 pWindowList[v3].pCurrentPosActiveItem = v7; 649 pWindowList[v3].pCurrentPosActiveItem = v7;
651 if ( v8 ) 650 if ( v8 )
652 { 651 {
653 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); 652 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0);
654 //v2 = pMessageQueue_50CBD0->uNumMessages; 653 //v2 = pMessageQueue_50CBD0->uNumMessages;