Mercurial > mm7
diff IO/Mouse.cpp @ 2544:c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
author | a.parshin |
---|---|
date | Mon, 11 May 2015 09:51:04 +0200 |
parents | a902abdfc7f2 |
children | 87e5590d034b |
line wrap: on
line diff
--- a/IO/Mouse.cpp Sun May 10 03:21:14 2015 +0200 +++ b/IO/Mouse.cpp Mon May 11 09:51:04 2015 +0200 @@ -473,10 +473,10 @@ y = pY; for ( int i = uNumVisibleWindows; i >= 0; --i ) { - if ( x >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameX && x <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameZ - && y >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameY && y <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameW ) + if ( x >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameX && x <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameZ + && y >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameY && y <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1]->uFrameW ) { - for ( control = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; control; control = control->pNext ) + for ( control = pWindowList[pVisibleWindowsIdxs[i] - 1]->pControlsHead; control; control = control->pNext ) { if ( control->uButtonType == 1 ) { @@ -604,30 +604,30 @@ //while ( 1 ) { v3 = pVisibleWindowsIdxs[i] - 1; - if (!pWindowList[v3].receives_keyboard_input) + if (!pWindowList[v3]->receives_keyboard_input) continue; switch (vkKey) { case VK_LEFT: { - v12 = pWindowList[v3].field_34; - if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) + v12 = pWindowList[v3]->field_34; + if ( pWindowList[v3]->pCurrentPosActiveItem - pWindowList[v3]->pStartingPosActiveItem - v12 >= 0 ) { v8 = current_screen_type == SCREEN_PARTY_CREATION; - pWindowList[v3].pCurrentPosActiveItem -= v12; + pWindowList[v3]->pCurrentPosActiveItem -= v12; if ( v8 ) { pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); //v2 = pMessageQueue_50CBD0->uNumMessages; } } - if ( pWindowList[v3].field_30 != 0 ) + if ( pWindowList[v3]->field_30 != 0 ) { break; } - pButton = pWindowList[v3].pControlsHead; - v13 = pWindowList[v3].pCurrentPosActiveItem; + pButton = pWindowList[v3]->pControlsHead; + v13 = pWindowList[v3]->pCurrentPosActiveItem; if ( v13 > 0) { do @@ -642,23 +642,23 @@ } case VK_RIGHT: { - v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; - if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) + v7 = pWindowList[v3]->pCurrentPosActiveItem + pWindowList[v3]->field_34; + if ( v7 < pWindowList[v3]->pNumPresenceButton + pWindowList[v3]->pStartingPosActiveItem ) { v8 = current_screen_type == SCREEN_PARTY_CREATION; - pWindowList[v3].pCurrentPosActiveItem = v7; + pWindowList[v3]->pCurrentPosActiveItem = v7; if ( v8 ) { pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); //v2 = pMessageQueue_50CBD0->uNumMessages; } } - if ( pWindowList[v3].field_30 != 0 ) + if ( pWindowList[v3]->field_30 != 0 ) { break; } - pButton = pWindowList[v3].pControlsHead; - v10 = pWindowList[v3].pCurrentPosActiveItem; + pButton = pWindowList[v3]->pControlsHead; + v10 = pWindowList[v3]->pCurrentPosActiveItem; if ( v10 > 0) { do @@ -673,16 +673,16 @@ } case VK_DOWN: { - v17 = pWindowList[v3].pStartingPosActiveItem; - v18 = pWindowList[v3].pCurrentPosActiveItem; - if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) - pWindowList[v3].pCurrentPosActiveItem = v17; + v17 = pWindowList[v3]->pStartingPosActiveItem; + v18 = pWindowList[v3]->pCurrentPosActiveItem; + if ( v18 >= pWindowList[v3]->pNumPresenceButton + v17 - 1 ) + pWindowList[v3]->pCurrentPosActiveItem = v17; else - pWindowList[v3].pCurrentPosActiveItem = v18 + 1; - if ( pWindowList[v3].field_30 != 0 ) + pWindowList[v3]->pCurrentPosActiveItem = v18 + 1; + if ( pWindowList[v3]->field_30 != 0 ) return true; - pButton = pWindowList[v3].pControlsHead; - v20 = pWindowList[v3].pCurrentPosActiveItem; + pButton = pWindowList[v3]->pControlsHead; + v20 = pWindowList[v3]->pCurrentPosActiveItem; if ( v20 > 0) { do @@ -698,13 +698,13 @@ case VK_SELECT: { pMouse->GetClickPos(&uClickX, &uClickY); - v4 = pWindowList[v3].pStartingPosActiveItem; - v28 = v4 + pWindowList[v3].pNumPresenceButton; - if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) + v4 = pWindowList[v3]->pStartingPosActiveItem; + v28 = v4 + pWindowList[v3]->pNumPresenceButton; + if ( v4 < v4 + pWindowList[v3]->pNumPresenceButton ) { while ( 1 ) { - pButton = pWindowList[v3].pControlsHead; + pButton = pWindowList[v3]->pControlsHead; if ( v4 > 0 ) { v6 = v4; @@ -731,7 +731,7 @@ //continue; } } - pWindowList[v3].pCurrentPosActiveItem = v4; + pWindowList[v3]->pCurrentPosActiveItem = v4; return true; } //v2 = pMessageQueue_50CBD0->uNumMessages; @@ -739,18 +739,18 @@ } case VK_UP: { - v22 = pWindowList[v3].pCurrentPosActiveItem; - v23 = pWindowList[v3].pStartingPosActiveItem; + v22 = pWindowList[v3]->pCurrentPosActiveItem; + v23 = pWindowList[v3]->pStartingPosActiveItem; if ( v22 <= v23 ) - v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; + v24 = pWindowList[v3]->pNumPresenceButton + v23 - 1; else v24 = v22 - 1; - v8 = pWindowList[v3].field_30 == 0; - pWindowList[v3].pCurrentPosActiveItem = v24; + v8 = pWindowList[v3]->field_30 == 0; + pWindowList[v3]->pCurrentPosActiveItem = v24; if ( !v8 ) return true; - pButton = pWindowList[v3].pControlsHead; - v25 = pWindowList[v3].pCurrentPosActiveItem; + pButton = pWindowList[v3]->pControlsHead; + v25 = pWindowList[v3]->pCurrentPosActiveItem; if ( v25 > 0) { do @@ -765,13 +765,13 @@ } case VK_NEXT: { - if ( pWindowList[v3].field_30 != 0 ) //crashed at skill draw + if ( pWindowList[v3]->field_30 != 0 ) //crashed at skill draw { pMouse->GetClickPos(&uClickX, &uClickY); - v29 = pWindowList[v3].pStartingPosActiveItem + pWindowList[v3].pNumPresenceButton; //num buttons more than buttons - for ( v4 = pWindowList[v3].pStartingPosActiveItem; v4 < v29; ++v4 ) + v29 = pWindowList[v3]->pStartingPosActiveItem + pWindowList[v3]->pNumPresenceButton; //num buttons more than buttons + for ( v4 = pWindowList[v3]->pStartingPosActiveItem; v4 < v29; ++v4 ) { - pButton = pWindowList[v3].pControlsHead; + pButton = pWindowList[v3]->pControlsHead; if ( v4 > 0 ) { for ( v15 = v4; v15; --v15 ) @@ -780,7 +780,7 @@ if ( (signed int)uClickX >= (signed int)pButton->uX && (signed int)uClickX <= (signed int)pButton->uZ && (signed int)uClickY >= (signed int)pButton->uY && (signed int)uClickY <= (signed int)pButton->uW ) { - pWindowList[v3].pCurrentPosActiveItem = v4; + pWindowList[v3]->pCurrentPosActiveItem = v4; return true; } }