Mercurial > mm7
comparison Mouse.cpp @ 2098:7810cb3a5fb7
Popup window in MainMenu not shown
author | Ritor1 |
---|---|
date | Fri, 13 Dec 2013 16:10:36 +0600 |
parents | 52415f8bf7c2 |
children | 7edf389d49fc |
comparison
equal
deleted
inserted
replaced
2097:2b39f6b451f9 | 2098:7810cb3a5fb7 |
---|---|
142 } | 142 } |
143 | 143 |
144 //----- (00469BA3) -------------------------------------------------------- | 144 //----- (00469BA3) -------------------------------------------------------- |
145 void Mouse::ClearCursor() | 145 void Mouse::ClearCursor() |
146 { | 146 { |
147 Mouse *v1; // esi@1 | 147 //Mouse *v1; // esi@1 |
148 void *v2; // eax@1 | 148 //void *v2; // eax@1 |
149 void **v3; // esi@5 | 149 //void **v3; // esi@5 |
150 | 150 |
151 v1 = this; | 151 //v1 = this; |
152 v2 = this->pCursorBitmap_sysmem; | 152 //v2 = this->pCursorBitmap_sysmem; |
153 this->bActive = 0; | 153 this->bActive = 0; |
154 if ( v2 ) | 154 if ( this->pCursorBitmap_sysmem ) |
155 { | 155 { |
156 free(v2); | 156 free(this->pCursorBitmap_sysmem); |
157 v1->pCursorBitmap_sysmem = 0; | 157 this->pCursorBitmap_sysmem = 0; |
158 } | 158 } |
159 if ( v1->pCursorBitmap2_sysmem ) | 159 if ( this->pCursorBitmap2_sysmem ) |
160 { | 160 { |
161 free(v1->pCursorBitmap2_sysmem); | 161 free(this->pCursorBitmap2_sysmem); |
162 v1->pCursorBitmap2_sysmem = 0; | 162 this->pCursorBitmap2_sysmem = 0; |
163 } | 163 } |
164 v3 = &v1->ptr_90; | 164 //v3 = &this->ptr_90; |
165 if ( *v3 ) | 165 if ( this->ptr_90 ) |
166 free(*v3); | 166 free(this->ptr_90); |
167 *v3 = 0; | 167 this->ptr_90 = 0; |
168 } | 168 } |
169 | 169 |
170 //----- (00469BE6) -------------------------------------------------------- | 170 //----- (00469BE6) -------------------------------------------------------- |
171 void Mouse::AllocCursorSystemMem() | 171 void Mouse::AllocCursorSystemMem() |
172 { | 172 { |
466 uMouseClickY = y; | 466 uMouseClickY = y; |
467 } | 467 } |
468 //----- (004175C0) -------------------------------------------------------- | 468 //----- (004175C0) -------------------------------------------------------- |
469 void UI_OnMouseLeftClick(int *pXY) | 469 void UI_OnMouseLeftClick(int *pXY) |
470 { | 470 { |
471 int *pXY_; // esi@1 | |
472 signed int y; // eax@7 | 471 signed int y; // eax@7 |
473 signed int x; // ecx@7 | 472 signed int x; // ecx@7 |
474 signed int v4; // eax@11 | |
475 signed int v5; // eax@17 | 473 signed int v5; // eax@17 |
476 signed int v6; // esi@19 | 474 GUIButton *control; // esi@37 |
477 int v7; // esi@30 | |
478 GUIWindow *v8; // edx@31 | |
479 GUIButton *i; // esi@37 | |
480 signed int v10; // eax@50 | 475 signed int v10; // eax@50 |
481 int v11; // ecx@52 | 476 int v11; // ecx@52 |
482 unsigned int pX; // [sp+14h] [bp-8h]@7 | 477 unsigned int pX; // [sp+14h] [bp-8h]@7 |
483 unsigned int pY; // [sp+18h] [bp-4h]@7 | 478 unsigned int pY; // [sp+18h] [bp-4h]@7 |
484 | 479 |
485 pXY_ = pXY; | 480 if ( pCurrentScreen == SCREEN_VIDEO || sub_4637E0_is_there_popup_onscreen() ) |
486 if ( pCurrentScreen == SCREEN_VIDEO | |
487 || sub_4637E0_is_there_popup_onscreen() ) | |
488 return; | 481 return; |
489 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 ) | 482 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 ) |
490 { | 483 { |
491 sub_4452BB(); | 484 sub_4452BB(); |
492 return; | 485 return; |
493 } | 486 } |
494 if ( pXY_ ) | 487 if ( pXY ) |
495 { | 488 { |
496 x = *pXY_; | 489 x = *pXY; |
497 y = pXY_[1]; | 490 y = pXY[1]; |
498 pX = *pXY_; | 491 pX = *pXY; |
499 pY = y; | 492 pY = y; |
500 } | 493 } |
501 else | 494 else |
502 { | 495 { |
503 pMouse->GetClickPos(&pX, &pY); | 496 pMouse->GetClickPos(&pX, &pY); |
504 y = pY; | 497 y = pY; |
505 x = pX; | 498 x = pX; |
506 } | 499 } |
507 | 500 |
508 extern bool _507B98_ctrl_pressed; | 501 extern bool _507B98_ctrl_pressed; |
509 if ( pCurrentScreen != SCREEN_GAME || !_507B98_ctrl_pressed ) // stealing cursor | |
510 goto LABEL_30; | |
511 v4 = GetCurrentMenuID(); | |
512 x = pX; | 502 x = pX; |
513 if ( v4 != -1 | 503 if ( GetCurrentMenuID() != -1 || pCurrentScreen != SCREEN_GAME || !_507B98_ctrl_pressed // stealing cursor |
514 || (signed int)pX < (signed int)pViewport->uViewportTL_X | 504 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X |
515 || (signed int)pX > (signed int)pViewport->uViewportBR_X ) | 505 || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y) |
516 { | 506 { |
517 y = pY; | 507 y = pY; |
518 LABEL_30: | 508 for ( int i = uNumVisibleWindows; i >= 0; --i ) |
519 v7 = uNumVisibleWindows; | 509 { |
520 if ( uNumVisibleWindows < 0 ) | 510 if ( x >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameX && x <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameZ |
521 return; | 511 && y >= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameY && y <= (signed int)pWindowList[pVisibleWindowsIdxs[i] - 1].uFrameW ) |
522 while ( 1 ) | 512 { |
523 { | 513 for ( control = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; control; control = control->pNext ) |
524 //v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]]; | 514 { |
525 v8 = &pWindowList[pVisibleWindowsIdxs[v7] - 1]; | 515 if ( control->uButtonType == 1 ) |
526 if ( x >= (signed int)v8->uFrameX ) | 516 { |
527 { | 517 if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW ) |
528 if ( x <= (signed int)v8->uFrameZ && y >= (signed int)v8->uFrameY && y <= (signed int)v8->uFrameW ) | 518 { |
529 break; | 519 control->field_2C_is_pushed = 1; |
530 } | 520 v10 = pMessageQueue_50CBD0->uNumMessages; |
531 --v7; | 521 if ( pMessageQueue_50CBD0->uNumMessages ) |
532 if ( v7 < 0 ) | 522 { |
533 return; | 523 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
534 } | 524 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
535 for ( i = v8->pControlsHead; ; i = i->pNext ) | 525 } |
536 { | 526 pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0); |
537 if ( !i ) | 527 return; |
538 return; | 528 } |
539 if ( i->uButtonType == 1 ) | 529 continue; |
540 goto LABEL_41; | 530 } |
541 if ( i->uButtonType != 2 ) | 531 if ( control->uButtonType == 2 )//когда нажимаешь на партреты персов |
542 break; | 532 { |
543 if ( (signed int)(signed __int64)sqrt((double)((x - i->uX) * (x - i->uX) + (y - i->uY) * (y - i->uY))) < (signed int)i->uWidth ) | 533 if ( (signed int)(signed __int64)sqrt((double)((x - control->uX) * (x - control->uX) + (y - control->uY) * (y - control->uY))) < (signed int)control->uWidth ) |
544 goto LABEL_50; | 534 { |
545 y = pY; | 535 control->field_2C_is_pushed = 1; |
546 x = pX; | 536 v10 = pMessageQueue_50CBD0->uNumMessages; |
547 LABEL_45: | 537 if ( pMessageQueue_50CBD0->uNumMessages ) |
548 ; | 538 { |
549 } | 539 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
550 if ( i->uButtonType != 3 ) | 540 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
551 goto LABEL_45; | 541 } |
552 LABEL_41: | 542 pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0); |
553 if ( x >= (signed int)i->uX && x <= (signed int)i->uZ && y >= (signed int)i->uY && y <= (signed int)i->uW ) | 543 return; |
554 { | 544 } |
555 LABEL_50: | 545 continue; |
556 i->field_2C_is_pushed = 1; | 546 } |
557 v10 = pMessageQueue_50CBD0->uNumMessages; | 547 if ( control->uButtonType == 3 )//когда нажимаешь на скиллы |
558 if ( pMessageQueue_50CBD0->uNumMessages ) | 548 { |
559 { | 549 if ( x >= (signed int)control->uX && x <= (signed int)control->uZ && y >= (signed int)control->uY && y <= (signed int)control->uW ) |
560 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 550 { |
561 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 551 control->field_2C_is_pushed = 1; |
562 } | 552 v10 = pMessageQueue_50CBD0->uNumMessages; |
563 //v11 = i->uControlParam; | 553 if ( pMessageQueue_50CBD0->uNumMessages ) |
564 pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0); | 554 { |
565 return; | 555 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
566 } | 556 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
567 goto LABEL_45; | 557 } |
558 pMessageQueue_50CBD0->AddMessage(control->msg, control->msg_param, 0); | |
559 return; | |
560 } | |
561 continue; | |
562 } | |
563 y = pY; | |
564 x = pX; | |
565 } | |
566 } | |
567 } | |
568 return; | |
568 } | 569 } |
569 y = pY; | 570 y = pY; |
570 if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y ) | |
571 goto LABEL_30; | |
572 if ( pRenderer->pRenderD3D ) | 571 if ( pRenderer->pRenderD3D ) |
573 v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); | 572 v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); |
574 else | 573 else |
575 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | 574 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; |
576 v6 = (unsigned __int16)v5; | 575 |
577 | 576 uint type = PID_TYPE((unsigned __int16)v5); |
578 uint type = PID_TYPE(v6); | 577 if (type == OBJECT_Actor && uActiveCharacter && v5 < 0x2000000 |
579 if (type == OBJECT_Actor | 578 && pPlayers[uActiveCharacter]->CanAct() && pPlayers[uActiveCharacter]->CanSteal() ) |
580 && uActiveCharacter | |
581 && v5 < 0x2000000 | |
582 && pPlayers[uActiveCharacter]->CanAct() | |
583 && pPlayers[uActiveCharacter]->CanSteal() ) | |
584 { | 579 { |
585 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | 580 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
586 { | 581 { |
587 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B; | 582 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B; |
588 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3; | 583 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3; |
589 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | 584 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; |
590 ++pMessageQueue_50CBD0->uNumMessages; | 585 ++pMessageQueue_50CBD0->uNumMessages; |
591 }*/ | 586 }*/ |
592 pMessageQueue_50CBD0->AddMessage(UIMSG_STEALFROMACTOR, PID_ID(v6), 0); | 587 pMessageQueue_50CBD0->AddMessage(UIMSG_STEALFROMACTOR, PID_ID((unsigned __int16)v5), 0); |
593 | 588 |
594 if ( pParty->bTurnBasedModeOn == 1 ) | 589 if ( pParty->bTurnBasedModeOn == 1 ) |
595 { | 590 { |
596 if ( pTurnEngine->turn_stage == 3 ) | 591 if ( pTurnEngine->turn_stage == 3 ) |
597 pTurnEngine->field_18 |= TE_FLAG_8; | 592 pTurnEngine->field_18 |= TE_FLAG_8; |