comparison mm7_5.cpp @ 1057:37498d2cceed

Слияние
author Ritor1
date Thu, 23 May 2013 21:37:22 +0600
parents 010a844ef4a0 d48c762de563
children b79139c3b5c8
comparison
equal deleted inserted replaced
1056:86a7e8f9ca33 1057:37498d2cceed
455 continue; 455 continue;
456 case UIMSG_SaveLoadBtn: 456 case UIMSG_SaveLoadBtn:
457 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); 457 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
458 continue; 458 continue;
459 case UIMSG_SelectLoadSlot: 459 case UIMSG_SelectLoadSlot:
460 if ( pGUIWindow_CurrentMenu->field_40 == 1 ) 460 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
461 pKeyActionMap->_459ED1(0); 461 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
462 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) 462 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam )
463 { 463 {
464 v10 = pSaveListPosition + uMessageParam; 464 v10 = pSaveListPosition + uMessageParam;
465 if ( dword_6BE138 == pSaveListPosition + uMessageParam ) 465 if ( dword_6BE138 == pSaveListPosition + uMessageParam )
466 { 466 {
467 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); 467 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0);
468 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); 468 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0);
469 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
470 {
471 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_SaveLoadBtn;
472 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
473 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
474 //v11 = pMessageQueue_50CBD0->uNumMessages + 1;
475 //v13 = pMessageQueue_50CBD0->uNumMessages + 1 > 40;
476 //v12 = (signed int)pMessageQueue_50CBD0->uNumMessages - 39 < 0;
477 ++pMessageQueue_50CBD0->uNumMessages;
478 if ( v12 ^ v13 )
479 {
480 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_LoadGame;
481 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
482 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
483 ++pMessageQueue_50CBD0->uNumMessages;
484 }
485 }*/
486 } 469 }
487 uLoadGameUI_SelectedSlot = v10; 470 uLoadGameUI_SelectedSlot = v10;
488 dword_6BE138 = v10; 471 dword_6BE138 = v10;
489 } 472 }
490 else 473 else
502 uGameState = GAME_STATE_3; 485 uGameState = GAME_STATE_3;
503 } 486 }
504 stru_506E40.Release(); 487 stru_506E40.Release();
505 continue; 488 continue;
506 case UIMSG_SaveGame: 489 case UIMSG_SaveGame:
507 if ( pGUIWindow_CurrentMenu->field_40 == 1 ) 490 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
508 { 491 {
509 pKeyActionMap->_459ED1(0); 492 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
510 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); 493 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer);
511 } 494 }
512 DoSavegame(uLoadGameUI_SelectedSlot); 495 DoSavegame(uLoadGameUI_SelectedSlot);
513 stru_506E40.Release(); 496 stru_506E40.Release();
514 continue; 497 continue;
1653 sub_44987B(dword_591164_teleport_map_name, MapStartPoint_Party); 1636 sub_44987B(dword_591164_teleport_map_name, MapStartPoint_Party);
1654 } 1637 }
1655 } 1638 }
1656 else 1639 else
1657 { 1640 {
1658 start_event_seq_number = dword_5C341C; 1641 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
1659 EventProcessor(dword_5C3418, 0, 1); 1642 }
1660 }
1661 start_event_seq_number = 0;
1662 if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) 1643 if ( !_strcmpi(byte_6BE3B0, "d05.blv") )
1663 pParty->uTimePlayed += 1474560i64; 1644 pParty->uTimePlayed += 1474560i64;
1664 continue; 1645 continue;
1665 case UIMSG_TransitionWindowCloseBtn: 1646 case UIMSG_TransitionWindowCloseBtn:
1666 CloseWindowBackground(); 1647 CloseWindowBackground();
1667 pVideoPlayer->Unload(); 1648 pVideoPlayer->Unload();
1668 DialogueEnding(); 1649 DialogueEnding();
1669 start_event_seq_number = 0;
1670 viewparams->bRedrawGameUI = true; 1650 viewparams->bRedrawGameUI = true;
1671 continue; 1651 continue;
1672 case UIMSG_CycleCharacters: 1652 case UIMSG_CycleCharacters:
1673 v39 = GetAsyncKeyState(VK_SHIFT); 1653 v39 = GetAsyncKeyState(VK_SHIFT);
1674 uActiveCharacter = CycleCharacter(v39); 1654 uActiveCharacter = CycleCharacter(v39);
3184 continue; 3164 continue;
3185 } 3165 }
3186 v119 = 2048; 3166 v119 = 2048;
3187 if ( (signed int)v118 <= 2048 ) 3167 if ( (signed int)v118 <= 2048 )
3188 { 3168 {
3189 dword_576E2C = v118; 3169 _576E2C_current_minimap_zoom = v118;
3190 dword_576E28 = viewparams->field_28; 3170 dword_576E28 = viewparams->field_28;
3191 break; 3171 break;
3192 } 3172 }
3193 viewparams->field_28 = 11; 3173 viewparams->field_28 = 11;
3194 viewparams->uMinimapZoom = v119; 3174 viewparams->uMinimapZoom = v119;
3195 dword_576E2C = v119; 3175 _576E2C_current_minimap_zoom = v119;
3196 dword_576E28 = viewparams->field_28; 3176 dword_576E28 = viewparams->field_28;
3197 break; 3177 break;
3198 case UIMSG_ClickZoomInBtn: 3178 case UIMSG_ClickZoomInBtn:
3199 if ( pCurrentScreen ) 3179 if ( pCurrentScreen )
3200 continue; 3180 continue;
3211 { 3191 {
3212 viewparams->field_28 = 9; 3192 viewparams->field_28 = 9;
3213 v118 = v119; 3193 v118 = v119;
3214 viewparams->uMinimapZoom = v119; 3194 viewparams->uMinimapZoom = v119;
3215 } 3195 }
3216 dword_576E2C = v118; 3196 _576E2C_current_minimap_zoom = v118;
3217 dword_576E28 = viewparams->field_28; 3197 dword_576E28 = viewparams->field_28;
3218 } 3198 }
3219 else 3199 else
3220 { 3200 {
3221 if ( (signed int)v118 < 256 ) 3201 if ( (signed int)v118 < 256 )
3462 break; 3442 break;
3463 SetCurrentMenuID(MENU_LoadingProcInMainMenu); 3443 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
3464 break; 3444 break;
3465 case UIMSG_SelectLoadSlot: 3445 case UIMSG_SelectLoadSlot:
3466 //main menu save/load wnd clicking on savegame lines 3446 //main menu save/load wnd clicking on savegame lines
3467 if (pGUIWindow_CurrentMenu->field_40 == 1) 3447 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
3468 pKeyActionMap->_459ED1(0); 3448 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
3469 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) 3449 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition )
3470 { 3450 {
3471 //load clicked line 3451 //load clicked line
3472 v26 = pParam + pSaveListPosition; 3452 v26 = pParam + pSaveListPosition;
3473 if ( dword_6BE138 == pParam + pSaveListPosition ) 3453 if ( dword_6BE138 == pParam + pSaveListPosition )
4758 } 4738 }
4759 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41 4739 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41
4760 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 4740 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41
4761 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) 4741 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41)
4762 && uDamageAmount != v41 ) 4742 && uDamageAmount != v41 )
4763 player->ReceiveDamage(uDamageAmount, a2); 4743 player->ReceiveDamage(uDamageAmount, (DAMAGE_TYPE)a2);
4764 v50 = 24; 4744 v50 = 24;
4765 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; 4745 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP;
4766 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) 4746 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41)
4767 && stru_50C198.GetMagicalResistance(pMonster, 3u) ) 4747 && stru_50C198.GetMagicalResistance(pMonster, 3u) )
4768 { 4748 {
5010 v22 = v7->pMonsterInfo.uAttack1Type; 4990 v22 = v7->pMonsterInfo.uAttack1Type;
5011 } 4991 }
5012 LABEL_43: 4992 LABEL_43:
5013 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) 4993 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
5014 { 4994 {
5015 v24 = v6->ReceiveDamage(v77, v22); 4995 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22);
5016 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 4996 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0
5017 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) 4997 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) )
5018 { 4998 {
5019 v25 = v7->uAIState; 4999 v25 = v7->uAIState;
5020 if ( v25 != 5 ) 5000 if ( v25 != 5 )
5073 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); 5053 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7);
5074 } 5054 }
5075 if ( !pParty->bTurnBasedModeOn ) 5055 if ( !pParty->bTurnBasedModeOn )
5076 { 5056 {
5077 v35 = v6->GetActualEndurance(); 5057 v35 = v6->GetActualEndurance();
5078 v36 = (double)(20 - v6->_48EA1B_get_static_effect(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; 5058 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
5079 v6->SetRecoveryTime((signed __int64)v36); 5059 v6->SetRecoveryTime((signed __int64)v36);
5080 } 5060 }
5081 if ( v77 ) 5061 if ( v77 )
5082 { 5062 {
5083 v73 = (double)(signed int)v75; 5063 v73 = (double)(signed int)v75;
5195 else 5175 else
5196 v50 = 4; 5176 v50 = 4;
5197 LABEL_133: 5177 LABEL_133:
5198 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) 5178 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
5199 { 5179 {
5200 v54 = v45->ReceiveDamage(v77, v50); 5180 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50);
5201 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) 5181 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 )
5202 { 5182 {
5203 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) 5183 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) )
5204 { 5184 {
5205 v55 = v44->uAIState; 5185 v55 = v44->uAIState;
5261 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) 5241 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType )
5262 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); 5242 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44);
5263 if ( !pParty->bTurnBasedModeOn ) 5243 if ( !pParty->bTurnBasedModeOn )
5264 { 5244 {
5265 v65 = v45->GetActualEndurance(); 5245 v65 = v45->GetActualEndurance();
5266 v66 = (double)(20 - v45->_48EA1B_get_static_effect(v65)) 5246 v66 = (double)(20 - v45->GetParameterBonus(v65))
5267 * flt_6BE3A4_debug_recmod1 5247 * flt_6BE3A4_debug_recmod1
5268 * 2.133333333333333; 5248 * 2.133333333333333;
5269 v45->SetRecoveryTime((signed __int64)v66); 5249 v45->SetRecoveryTime((signed __int64)v66);
5270 } 5250 }
5271 return; 5251 return;
5292 else 5272 else
5293 { 5273 {
5294 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); 5274 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
5295 v69 = 0; 5275 v69 = 0;
5296 } 5276 }
5297 a4b->ReceiveDamage(v68, v69); 5277 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69);
5298 if ( v38 == OBJECT_Player && !qword_A750D8 ) 5278 if ( v38 == OBJECT_Player && !qword_A750D8 )
5299 { 5279 {
5300 qword_A750D8 = 256i64; 5280 qword_A750D8 = 256i64;
5301 word_A750E0 = 44; 5281 word_A750E0 = 44;
5302 word_A750E2 = uActorID + 1; 5282 word_A750E2 = uActorID + 1;
5357 } 5337 }
5358 5338
5359 //----- (0043AA99) -------------------------------------------------------- 5339 //----- (0043AA99) --------------------------------------------------------
5360 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz) 5340 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz)
5361 { 5341 {
5362 /* int v7; // ebx@1
5363 int v8; // ST14_4@1
5364 int v9; // edi@1
5365 int anglea; // [sp+20h] [bp+8h]@1
5366
5367 v7 = sRotX;
5368 v8 = sDepth;
5369 v9 = sRotY;
5370 anglea = (unsigned __int64)(stru_5C6E00->SinCos(sRotX) * (signed __int64)sDepth) >> 16;
5371 *outx = v.x + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY) * (signed __int64)anglea) >> 16);
5372 *outy = v.y + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY - stru_5C6E00->uIntegerHalfPi) * (signed __int64)anglea) >> 16);
5373 *outz = v.z + ((unsigned __int64)(stru_5C6E00->SinCos(sRotX - stru_5C6E00->uIntegerHalfPi) * (signed __int64)sDepth) >> 16);*/
5374
5375 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f), 5342 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f),
5376 sinf_x = sinf(3.14159265f * sRotX / 1024.0f), 5343 sinf_x = sinf(3.14159265f * sRotX / 1024.0f),
5377 cosf_y = cosf(3.14159265f * sRotY / 1024.0f), 5344 cosf_y = cosf(3.14159265f * sRotY / 1024.0f),
5378 sinf_y = sinf(3.14159265f * sRotY / 1024.0f); 5345 sinf_y = sinf(3.14159265f * sRotY / 1024.0f);
5379 //sDepth = 14000000; 5346
5380 *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); 5347 *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
5381 *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); 5348 *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
5382 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16); 5349 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16);
5383
5384 } 5350 }
5385 5351
5386 //----- (0043AB61) -------------------------------------------------------- 5352 //----- (0043AB61) --------------------------------------------------------
5387 void Vec3_int_::Normalize(int *x, int *y, int *z) 5353 void Vec3_int_::Normalize(int *x, int *y, int *z)
5388 { 5354 {
9765 } 9731 }
9766 return result; 9732 return result;
9767 } 9733 }
9768 9734
9769 9735
9770 //----- (00411150) --------------------------------------------------------
9771 void DrawTownPortalScreen()
9772 {
9773 //signed int v0; // edi@1
9774 //__int16 v1; // dx@8
9775 //POINT *v2; // edi@17
9776 int v3; // edi@17
9777 //__int16 v4; // dx@24
9778 GUIWindow v6; // [sp+Ch] [bp-64h]@1
9779 //POINT v7; // [sp+60h] [bp-10h]@17
9780 POINT a2; // [sp+68h] [bp-8h]@17
9781
9782 pRenderer->ClearZBuffer(0, 479);
9783 pRenderer->DrawTextureTransparent(8, 8, pTexture_CurrentBook);
9784 pRenderer->DrawTextureTransparent(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
9785
9786 v6.uFrameX = game_viewport_x;
9787 v6.uFrameY = game_viewport_y;
9788 v6.uFrameWidth = game_viewport_width;
9789 v6.uFrameHeight = game_viewport_height;
9790 v6.uFrameZ = game_viewport_z;
9791 v6.uFrameW = game_viewport_w;
9792
9793 const uint fountain_bits_lut[] = {PARTY_QUEST_FOUNTAIN_HARMONDALE,
9794 PARTY_QUEST_FOUNTAIN_PIERPONT,
9795 PARTY_QUEST_FOUNTAIN_NIGHON,
9796 PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE,
9797 PARTY_QUEST_FOUNTAIN_CELESTIA,
9798 PARTY_QUEST_FOUNTAIN_THE_PIT};
9799 for (uint i = 0; i < 6; ++i)
9800 {
9801
9802 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[i]))
9803 pRenderer->DrawMaskToZBuffer(pTownPortalBook_xs[i],
9804 pTownPortalBook_ys[i],
9805 pTexture_TownPortalIcons[i], i + 1);
9806 }
9807
9808 /* v0 = 0;
9809 do
9810 {
9811 if ( !v0 )
9812 {
9813 v1 = 206;
9814 LABEL_14:
9815 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v1) )
9816 goto LABEL_16;
9817 goto LABEL_15;
9818 }
9819 if ( v0 == 1 )
9820 {
9821 v1 = 208;
9822 goto LABEL_14;
9823 }
9824 if ( v0 == 2 )
9825 {
9826 v1 = 207;
9827 goto LABEL_14;
9828 }
9829 if ( v0 == 3 )
9830 {
9831 v1 = 211;
9832 goto LABEL_14;
9833 }
9834 if ( v0 == 4 )
9835 {
9836 v1 = 209;
9837 goto LABEL_14;
9838 }
9839 if ( v0 == 5 )
9840 {
9841 v1 = 210;
9842 goto LABEL_14;
9843 }
9844 LABEL_15:
9845 pRenderer->DrawMaskToZBuffer(
9846 pTownPortalBook_xs[v0],
9847 pTownPortalBook_ys[v0],
9848 *(&pTexture_TownPortalHarmn + v0),
9849 v0 + 1);
9850 LABEL_16:
9851 ++v0;
9852 }
9853 while ( v0 < 6 );*/
9854
9855 pMouse->GetCursorPos(&a2);
9856 //v2 = pMouse->GetCursorPos(&a2);
9857 v3 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
9858
9859 if (v3)
9860 {
9861 if (_449B57_test_bit(pParty->_quest_bits, fountain_bits_lut[v3 - 1]))
9862 pRenderer->DrawTextureIndexed(pTownPortalBook_xs[v3 - 1], pTownPortalBook_ys[v3 - 1], pTexture_TownPortalIcons[v3 - 1]);
9863 }
9864 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);
9865
9866
9867 /* if ( !v3 ) // Town Portal
9868 {
9869 v6.DrawTitleText(pBook2Font, 0, 22, 0, pGlobalTXT_LocalizationStrings[10], 3); // "Town Portal"
9870 return;
9871 }
9872 if ( v3 == 1 )
9873 {
9874 v4 = 206;
9875 LABEL_30:
9876 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) )
9877 goto LABEL_31;
9878 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u); // "Town Portal"
9879 return;
9880 }
9881 if ( v3 == 2 )
9882 {
9883 v4 = 208;
9884 goto LABEL_30;
9885 }
9886 if ( v3 == 3 )
9887 {
9888 v4 = 207;
9889 goto LABEL_30;
9890 }
9891 if ( v3 == 4 )
9892 {
9893 v4 = 211;
9894 goto LABEL_30;
9895 }
9896 if ( v3 == 5 )
9897 {
9898 v4 = 209;
9899 goto LABEL_30;
9900 }
9901 if ( v3 == 6 )
9902 {
9903 v4 = 210;
9904 goto LABEL_30;
9905 }
9906 LABEL_31:
9907 pRenderer->DrawTextureIndexed(word_4E1D3A[v3], pTownPortalBook_xs[v3 + 5], *(&pTex_tab_an_6b__zoom_on + v3));
9908 v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);*/
9909 }
9910 // 4E1D3A: using guessed type __int16 word_4E1D3A[];
9911
9912
9913 //----- (00413FF1) -------------------------------------------------------- 9736 //----- (00413FF1) --------------------------------------------------------
9914 void SetMonthNames() 9737 void SetMonthNames()
9915 { 9738 {
9916 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; 9739 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415];
9917 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; 9740 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416];
9978 } 9801 }
9979 9802
9980 9803
9981 9804
9982 9805
9983
9984 //----- (004141CA) --------------------------------------------------------
9985 void ModalWindow(const char *pStr, int a4)
9986 {
9987 pEventTimer->Pause();
9988 dword_506F0C[0] = pCurrentScreen;
9989 ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, (int)pStr);
9990 pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE;
9991 }
9992 // 4E28F8: using guessed type int pCurrentScreen;
9993
9994 //----- (0041420D) -------------------------------------------------------- 9806 //----- (0041420D) --------------------------------------------------------
9995 void __cdecl sub_41420D_press_esc() 9807 void __cdecl sub_41420D_press_esc()
9996 { 9808 {
9997 GUIWindow v0; // [sp+4h] [bp-54h]@1 9809 GUIWindow v0; // [sp+4h] [bp-54h]@1
9998 9810
10012 { 9824 {
10013 GUIWindow *v0; // ecx@1 9825 GUIWindow *v0; // ecx@1
10014 9826
10015 v0 = ptr_507BDC; 9827 v0 = ptr_507BDC;
10016 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0); 9828 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0);
10017 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 9829
10018 {
10019 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)(int)ptr_507BDC->ptr_1C;
10020 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
10021 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
10022 ++pMessageQueue_50CBD0->uNumMessages;
10023 }*/
10024 v0->Release(); 9830 v0->Release();
10025 ptr_507BDC = 0; 9831 ptr_507BDC = 0;
10026 pCurrentScreen = dword_506F0C[0]; 9832 pCurrentScreen = dword_506F0C[0];
10027 pEventTimer->Resume(); 9833 pEventTimer->Resume();
10028 } 9834 }
10221 continue; 10027 continue;
10222 } 10028 }
10223 case WINDOW_50: 10029 case WINDOW_50:
10224 { 10030 {
10225 v27 = TargetColor(255, 255, 255); 10031 v27 = TargetColor(255, 255, 255);
10226 if ( ptr_507BD0->field_40 == 1 ) 10032 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
10227 { 10033 {
10228 ptr_507BD0->DrawMessageBox(0); 10034 ptr_507BD0->DrawMessageBox(0);
10229 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); 10035 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
10230 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 10036 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
10231 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); 10037 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
10232 continue; 10038 continue;
10233 } 10039 }
10234 if ( ptr_507BD0->field_40 == 2 ) 10040 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
10235 { 10041 {
10236 pWindow->field_40 = 0; 10042 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
10237 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); 10043 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0);
10238 pEventTimer->Resume(); 10044 pEventTimer->Resume();
10239 ptr_507BD0->Release(); 10045 ptr_507BD0->Release();
10240 pCurrentScreen = 0; 10046 pCurrentScreen = SCREEN_GAME;
10241 viewparams->bRedrawGameUI = 1; 10047 viewparams->bRedrawGameUI = true;
10242 continue; 10048 continue;
10243 } 10049 }
10244 if ( ptr_507BD0->field_40 == 3 ) 10050 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
10245 { 10051 {
10246 pWindow->field_40 = 0; 10052 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
10247 pEventTimer->Resume(); 10053 pEventTimer->Resume();
10248 ptr_507BD0->Release(); 10054 ptr_507BD0->Release();
10249 continue; 10055 continue;
10250 } 10056 }
10251 } 10057 }
10258 { 10064 {
10259 ItemGen2.Reset(); 10065 ItemGen2.Reset();
10260 pWindow->Release(); 10066 pWindow->Release();
10261 pEventTimer->Resume(); 10067 pEventTimer->Resume();
10262 pCurrentScreen = 0; 10068 pCurrentScreen = 0;
10263 viewparams->bRedrawGameUI = 1; 10069 viewparams->bRedrawGameUI = true;
10264 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 10070 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
10265 if ( v26 > 0 ) 10071 if ( v26 > 0 )
10266 { 10072 {
10267 if ( v26 < 800 ) 10073 if ( v26 < 800 )
10268 { 10074 {
10766 } 10572 }
10767 if ( v51 == 1 ) 10573 if ( v51 == 1 )
10768 { 10574 {
10769 v0->RemoveItemAtInventoryIndex(v18); 10575 v0->RemoveItemAtInventoryIndex(v18);
10770 v26 = rand(); 10576 v26 = rand();
10771 v0->ReceiveDamage(v26 % 11 + 10, 0); 10577 v0->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE);
10772 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); 10578 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
10773 10579
10774 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 10580 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
10775 10581
10776 v42 = (int *)&a2.y; 10582 v42 = (int *)&a2.y;
10782 { 10588 {
10783 if ( v51 == 2 ) 10589 if ( v51 == 2 )
10784 { 10590 {
10785 v0->RemoveItemAtInventoryIndex(v18); 10591 v0->RemoveItemAtInventoryIndex(v18);
10786 v25 = rand(); 10592 v25 = rand();
10787 v0->ReceiveDamage(v25 % 71 + 30, 0); 10593 v0->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE);
10788 v23 = 1; 10594 v23 = 1;
10789 } 10595 }
10790 else 10596 else
10791 { 10597 {
10792 if ( v51 == 3 ) 10598 if ( v51 == 3 )
10793 { 10599 {
10794 v0->RemoveItemAtInventoryIndex(v18); 10600 v0->RemoveItemAtInventoryIndex(v18);
10795 v24 = rand(); 10601 v24 = rand();
10796 v0->ReceiveDamage(v24 % 201 + 50, 0); 10602 v0->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE);
10797 v23 = 5; 10603 v23 = 5;
10798 } 10604 }
10799 else 10605 else
10800 { 10606 {
10801 if ( v51 != 4 ) 10607 if ( v51 != 4 )
10908 dword_4E455C = 0; 10714 dword_4E455C = 0;
10909 } 10715 }
10910 } 10716 }
10911 10717
10912 10718
10913 //----- (00416B01) --------------------------------------------------------
10914 void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText
10915 {
10916 int v1; // edi@2
10917 int v2; // ecx@2
10918 NPCData *v3; // eax@2
10919 NPCData *v4; // esi@7
10920 NPCData *v5; // eax@16
10921 NPCData *v6; // esi@16
10922 const CHAR *v7; // eax@18
10923 unsigned int v8; // eax@25
10924 unsigned int v9; // eax@25
10925 const char *v10; // ST14_4@26
10926 char *v11; // esi@26
10927 const char *v12; // ST18_4@27
10928 unsigned __int16 v13; // ax@28
10929 char *v14; // eax@28
10930 GUIWindow a1; // [sp+Ch] [bp-60h]@23
10931 int a2; // [sp+60h] [bp-Ch]@16
10932 void *v17; // [sp+64h] [bp-8h]@1
10933 LPCSTR lpsz; // [sp+68h] [bp-4h]@6
10934
10935 v17 = _this;
10936 if ( bNoNPCHiring != 1 )
10937 {
10938 v1 = 0;
10939 v2 = 0;
10940 v3 = pParty->pHirelings;
10941 /*do
10942 {
10943 if ( v3->pName )
10944 pTmpBuf[v1++] = v2;
10945 ++v3;
10946 ++v2;
10947 }
10948 while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/
10949 for (int i = 0; i < 2; ++i)
10950 {
10951 if (pParty->pHirelings[i].pName)
10952 pTmpBuf[v1++] = i;
10953 }
10954 lpsz = 0;
10955 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
10956 {
10957 /*v4 = pNPCStats->pNewNPCData;
10958 do
10959 {
10960 if ( v4->uFlags & 0x80
10961 && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName))
10962 && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) )
10963 pTmpBuf[v1++] = (char)lpsz + 2;
10964 ++lpsz;
10965 ++v4;
10966 }
10967 while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/
10968 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
10969 {
10970 if (pNPCStats->pNewNPCData[i].Hired())
10971 {
10972 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
10973 {
10974 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
10975 pTmpBuf[v1++] = i + 2;
10976 }
10977 }
10978 }
10979 }
10980 if ( (signed int)((char *)v17 + (unsigned __int8)pParty->field_709) < v1 )
10981 {
10982 sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)v17;
10983 v5 = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&a2);
10984 v6 = v5;
10985 if ( v5 )
10986 {
10987 if ( a2 == 57 )
10988 v7 = pNPCTopics[512].pText; // Baby dragon
10989 else
10990 v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits;
10991 lpsz = v7;
10992 if ( !v7 )
10993 {
10994 lpsz = (LPCSTR)pNPCStats->pProfessions[v5->uProfession].pJoinText;
10995 if ( !lpsz )
10996 lpsz = "";
10997 }
10998 a1.Hint = 0;
10999 a1.uFrameX = 38;
11000 a1.uFrameY = 60;
11001 a1.uFrameWidth = 276;
11002 a1.uFrameZ = 313;
11003 a1.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &a1, 0, 0)
11004 + 2 * LOBYTE(pFontArrus->uFontHeight)
11005 + 24;
11006 if ( (signed int)a1.uFrameHeight < 130 )
11007 a1.uFrameHeight = 130;
11008 a1.uFrameWidth = 400;
11009 a1.uFrameZ = a1.uFrameX + 399;
11010 a1.DrawMessageBox(0);
11011 sprintf(pTmpBuf2, "NPC%03d", v6->uPortraitID);
11012 v8 = pIcons_LOD->LoadTexture(pTmpBuf2, TEXTURE_16BIT_PALETTE);
11013 pRenderer->DrawTextureIndexed(
11014 a1.uFrameX + 22,
11015 a1.uFrameY + 36,
11016 (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0));
11017 v9 = v6->uProfession;
11018 if ( v9 )
11019 {
11020 v10 = v6->pName;
11021 v11 = pTmpBuf;
11022 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]);
11023 }
11024 else
11025 {
11026 v12 = v6->pName;
11027 v11 = pTmpBuf;
11028 strcpy(pTmpBuf, v12);
11029 }
11030 v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
11031 a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u);
11032 a1.uFrameWidth -= 24;
11033 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
11034 v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0);
11035 a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0);
11036 }
11037 }
11038 }
11039 }
11040
11041 10719
11042 10720
11043 10721
11044 //----- (004175C0) -------------------------------------------------------- 10722 //----- (004175C0) --------------------------------------------------------
11045 void UI_OnMouseLeftClick(int *pXY) 10723 void UI_OnMouseLeftClick(int *pXY)
11192 { 10870 {
11193 pMouse->GetClickPos(&pX, &pY); 10871 pMouse->GetClickPos(&pX, &pY);
11194 } 10872 }
11195 pMouse->GetCursorPos(&a2); 10873 pMouse->GetCursorPos(&a2);
11196 pMouse->GetCursorPos(&v1); 10874 pMouse->GetCursorPos(&v1);
11197 }
11198 }
11199
11200 //----- (004178C4) --------------------------------------------------------
11201 void __cdecl sub_4178C4()
11202 {
11203 if ( pArcomageGame->bGameInProgress == 1 )
11204 {
11205 if (pAsyncMouse)
11206 pArcomageGame->stru1.field_0 = 7;
11207 }
11208 }
11209
11210 //----- (004178E1) --------------------------------------------------------
11211 void __cdecl sub_4178E1()
11212 {
11213 if ( pArcomageGame->bGameInProgress == 1 )
11214 {
11215 if (pAsyncMouse)
11216 pArcomageGame->stru1.field_0 = 8;
11217 } 10875 }
11218 } 10876 }
11219 10877
11220 //----- (004178FE) -------------------------------------------------------- 10878 //----- (004178FE) --------------------------------------------------------
11221 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) 10879 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2)