Mercurial > mm7
comparison GUIWindow.cpp @ 1055:010a844ef4a0
Слияние
author | Ritor1 |
---|---|
date | Wed, 22 May 2013 22:23:04 +0600 |
parents | 306ec23b37df |
children | 39f42990698f |
comparison
equal
deleted
inserted
replaced
1054:5520fdca7a74 | 1055:010a844ef4a0 |
---|---|
13 #include "Mouse.h" | 13 #include "Mouse.h" |
14 #include "Viewport.h" | 14 #include "Viewport.h" |
15 #include "Render.h" | 15 #include "Render.h" |
16 #include "PlayerFrameTable.h" | 16 #include "PlayerFrameTable.h" |
17 #include "SaveLoad.h" | 17 #include "SaveLoad.h" |
18 #include "FactionTable.h" | |
19 #include "StorylineTextTable.h" | 18 #include "StorylineTextTable.h" |
20 #include "Events2D.h" | 19 #include "Events2D.h" |
21 #include "UIHouses.h" | 20 #include "UIHouses.h" |
22 #include "texts.h" | 21 #include "texts.h" |
23 #include "Autonotes.h" | 22 #include "Autonotes.h" |
32 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb | 31 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb |
33 struct GUIWindow *pWindow_MainMenu; | 32 struct GUIWindow *pWindow_MainMenu; |
34 struct GUIWindow pWindowList[20]; | 33 struct GUIWindow pWindowList[20]; |
35 | 34 |
36 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; | 35 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; |
37 | 36 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; |
38 | 37 |
39 // inlined | 38 // inlined |
40 //----- (mm6c::00420520) -------------------------------------------------- | 39 //----- (mm6c::00420520) -------------------------------------------------- |
41 void GUIMessageQueue::Flush() | 40 void GUIMessageQueue::Flush() |
42 { | 41 { |
98 if ( bFirstCall ) | 97 if ( bFirstCall ) |
99 { | 98 { |
100 for ( i = uNumVisibleWindows; i >= 0; --i ) | 99 for ( i = uNumVisibleWindows; i >= 0; --i ) |
101 { | 100 { |
102 result = 84 * pVisibleWindowsIdxs[i]; | 101 result = 84 * pVisibleWindowsIdxs[i]; |
103 //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) | |
104 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) | 102 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) |
105 j->field_28 = 0; | 103 j->field_28 = 0; |
106 } | 104 } |
107 } | 105 } |
108 for ( k = uNumVisibleWindows; k >= 0; --k ) | 106 for ( k = uNumVisibleWindows; k >= 0; --k ) |
109 { | 107 { |
110 result = 84 * pVisibleWindowsIdxs[k]; | 108 result = 84 * pVisibleWindowsIdxs[k]; |
111 //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) | |
112 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) | 109 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) |
113 { | 110 { |
114 LOBYTE(result) = v10; | 111 LOBYTE(result) = v10; |
115 if ( l->uHotkey == v10 ) | 112 if ( l->uHotkey == v10 ) |
116 { | 113 { |
174 return 0; | 171 return 0; |
175 } | 172 } |
176 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | 173 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; |
177 | 174 |
178 //----- (0041D73D) -------------------------------------------------------- | 175 //----- (0041D73D) -------------------------------------------------------- |
179 char GUIWindow::_41D73D_draw_buff_tooltip() | 176 void GUIWindow::_41D73D_draw_buff_tooltip() |
180 { | 177 { |
181 GUIFont *v1; // esi@1 | 178 GUIFont *v1; // esi@1 |
182 GUIWindow *v2; // edi@1 | 179 GUIWindow *v2; // edi@1 |
183 SpellBuff *v3; // eax@1 | 180 SpellBuff *v3; // eax@1 |
184 unsigned int v4; // eax@5 | 181 unsigned int v4; // eax@5 |
185 int v5; // ecx@5 | 182 int v5; // ecx@5 |
240 v14 = TargetColor( | 237 v14 = TargetColor( |
241 (unsigned __int8)*(v8 - 1), | 238 (unsigned __int8)*(v8 - 1), |
242 (unsigned __int8)*v8, | 239 (unsigned __int8)*v8, |
243 (unsigned __int8)v8[1]); | 240 (unsigned __int8)v8[1]); |
244 v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0); | 241 v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0); |
245 LOBYTE(v9) = sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2); | 242 sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2); |
246 v1 = a2; | 243 v1 = a2; |
247 } | 244 } |
248 ++v18; | 245 ++v18; |
249 ++v16; | 246 ++v16; |
250 v8 += 3; | 247 v8 += 3; |
251 } | 248 } |
252 while ( (signed int)v18 < (signed int)pParty->pPlayers ); | 249 while ( (signed int)v18 < (signed int)pParty->pPlayers ); |
253 return v9; | 250 |
254 } | 251 } |
255 | 252 |
256 | |
257 //----- (0041D3B7) -------------------------------------------------------- | |
258 void GUIWindow::DrawQuickCharRecord() | |
259 { | |
260 Player *pPlayer; // esi@1 | |
261 int v6; // eax@5 | |
262 int v7; // ebx@5 | |
263 unsigned int v8; // ecx@5 | |
264 int v9; // ebx@5 | |
265 unsigned int v10; // eax@5 | |
266 int v11; // eax@5 | |
267 unsigned int v12; // ecx@5 | |
268 Texture *v13; // eax@6 | |
269 unsigned int v14; // eax@12 | |
270 PlayerFrame *v15; // eax@12 | |
271 unsigned int v16; // eax@15 | |
272 unsigned int v20; // eax@15 | |
273 unsigned int v24; // eax@15 | |
274 unsigned int v25; // eax@15 | |
275 unsigned __int8 v28; // al@15 | |
276 char *v29; // eax@16 | |
277 __int64 v35; // ST38_8@22 | |
278 int v36; // esi@22 | |
279 unsigned int v38; // eax@22 | |
280 char *v39; // eax@24 | |
281 signed int uFramesetID; // [sp+20h] [bp-8h]@9 | |
282 int uFramesetIDa; // [sp+20h] [bp-8h]@18 | |
283 | |
284 pPlayer = &pParty->pPlayers[(unsigned int)ptr_1C]; | |
285 | |
286 uint numActivePlayerBuffs = 0; | |
287 | |
288 for (uint i = 0; i < 24; ++i) | |
289 if (pPlayer->pPlayerBuffs[i].uExpireTime > 0) | |
290 ++numActivePlayerBuffs; | |
291 | |
292 v6 = pFontArrus->uFontHeight + 162; | |
293 uFrameHeight = v6; | |
294 v7 = (numActivePlayerBuffs - 1) * pFontArrus->uFontHeight; | |
295 v8 = uFrameX; | |
296 v9 = v6 + v7; | |
297 v10 = uFrameWidth; | |
298 uFrameHeight = v9; | |
299 v11 = v10 + v8 - 1; | |
300 v12 = uFrameY; | |
301 uFrameZ = v11; | |
302 uFrameW = v9 + v12 - 1; | |
303 DrawMessageBox(0); | |
304 if (pPlayer->Eradicated()) | |
305 v13 = pTexture_PlayerFaceEradicated; | |
306 else if (pPlayer->Dead()) | |
307 v13 = pTexture_PlayerFaceDead; | |
308 else | |
309 { | |
310 uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(pPlayer->expression); | |
311 if ( !uFramesetID ) | |
312 uFramesetID = 1; | |
313 if ( pPlayer->expression == CHARACTER_EXPRESSION_21) | |
314 { | |
315 v15 = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); | |
316 } | |
317 else | |
318 { | |
319 v14 = pMiscTimer->Time(); | |
320 v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, v14); | |
321 } | |
322 pPlayer->field_1AA2 = v15->uTextureID - 1; | |
323 v13 = pTextures_PlayerFaces[(unsigned int)ptr_1C][v15->uTextureID-1]; | |
324 } | |
325 | |
326 pRenderer->DrawTextureTransparent(uFrameX + 24, uFrameY + 24, v13); | |
327 v16 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
328 sprintf(pTmpBuf, "\f%05d", v16); | |
329 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]); | |
330 strcat(pTmpBuf, pTmpBuf2); | |
331 strcat(pTmpBuf, "\f00000\n"); | |
332 v20 = UI_GetHealthManaStringColor(pPlayer->sHealth, pPlayer->GetMaxHealth()); | |
333 sprintf(pTmpBuf2, "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[108], | |
334 v20, pPlayer->sHealth, pPlayer->GetMaxHealth()); | |
335 strcat(pTmpBuf, pTmpBuf2); | |
336 v24 = UI_GetHealthManaStringColor(pPlayer->sMana, pPlayer->GetMaxMana()); | |
337 sprintf(pTmpBuf2, "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[212], | |
338 v24, pPlayer->sMana, pPlayer->GetMaxMana()); | |
339 strcat(pTmpBuf, pTmpBuf2); | |
340 v25 = pPlayer->GetMajorConditionIdx(); | |
341 sprintf(pTmpBuf2, "%s: \f%05d%s\f00000\n", pGlobalTXT_LocalizationStrings[47], | |
342 GetConditionDrawColor(v25), aCharacterConditionNames[v25]); | |
343 strcat(pTmpBuf, pTmpBuf2); | |
344 v28 = pPlayer->uQuickSpell; | |
345 if ( v28 ) | |
346 v29 = pSpellStats->pInfos[v28].pShortName; | |
347 else | |
348 v29 = pGlobalTXT_LocalizationStrings[153]; | |
349 sprintf((char*)pTmpBuf2, "%s: %s", (char*)pGlobalTXT_LocalizationStrings[172], v29); | |
350 strcat((char*)pTmpBuf, (char*)pTmpBuf2); | |
351 DrawText(pFontArrus, 120, 22, 0, pTmpBuf, 0, 0, 0); | |
352 | |
353 uFramesetIDa = 0; | |
354 for (uint i = 0; i < 24; ++i) | |
355 { | |
356 auto buff = pPlayer->pPlayerBuffs + i; | |
357 if (buff->uExpireTime > 0) | |
358 { | |
359 v35 = buff->uExpireTime - pParty->uTimePlayed; | |
360 v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134; | |
361 v38 = TargetColor( | |
362 _4E2AD8_ui_colors[i * 3], | |
363 _4E2AD8_ui_colors[i * 3 + 1], | |
364 _4E2AD8_ui_colors[i * 3 + 2]); | |
365 DrawText(pFontComic, 52, v36, v38, aSpellNames[20 + i], 0, 0, 0); | |
366 sub_41D20D_buff_remaining_time_string(v36, this, v35, pFontComic); | |
367 } | |
368 } | |
369 | |
370 v39 = ""; | |
371 if ( uFramesetIDa == 0 ) | |
372 v39 = pGlobalTXT_LocalizationStrings[153]; | |
373 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[450], v39); | |
374 DrawText(pFontArrus, 14, 114, 0, pTmpBuf, 0, 0, 0); | |
375 } | |
376 | 253 |
377 //----- (0041D08F) -------------------------------------------------------- | 254 //----- (0041D08F) -------------------------------------------------------- |
378 void GUIWindow::_41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5) | 255 void GUIWindow::_41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5) |
379 { | 256 { |
380 if ( a2 ) | 257 if ( a2 ) |
415 | 292 |
416 switch( this->eWindowType ) | 293 switch( this->eWindowType ) |
417 { | 294 { |
418 case WINDOW_GreetingNPC: | 295 case WINDOW_GreetingNPC: |
419 { | 296 { |
420 pIcons_LOD->_40F9C5(); | 297 pIcons_LOD->SyncLoadedFilesCount(); |
421 pCurrentScreen = pMainScreenNum; | 298 pCurrentScreen = pMainScreenNum; |
422 pKeyActionMap->_459ED1(3); | 299 pKeyActionMap->_459ED1(3); |
423 break; | 300 break; |
424 } | 301 } |
425 case WINDOW_HouseInterior: | 302 case WINDOW_HouseInterior: |
427 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | 304 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) |
428 pDialogueNPCPortraits[i]->Release(); | 305 pDialogueNPCPortraits[i]->Release(); |
429 uNumDialogueNPCPortraits = 0; | 306 uNumDialogueNPCPortraits = 0; |
430 pTexture_Dialogue_Background->Release(); | 307 pTexture_Dialogue_Background->Release(); |
431 | 308 |
432 pIcons_LOD->_40F9C5(); | 309 pIcons_LOD->SyncLoadedFilesCount(); |
433 pIcons_LOD->_4114F2(); | 310 pIcons_LOD->_4114F2(); |
434 dword_5C35D4 = 0; | 311 dword_5C35D4 = 0; |
435 if ( bFlipOnExit ) | 312 if ( bFlipOnExit ) |
436 { | 313 { |
437 pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi | 314 pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi |
444 case WINDOW_Transition: | 321 case WINDOW_Transition: |
445 { | 322 { |
446 pVideoPlayer->Unload(); | 323 pVideoPlayer->Unload(); |
447 pTexture_outside->Release(); | 324 pTexture_outside->Release(); |
448 pTexture_Dialogue_Background->Release(); | 325 pTexture_Dialogue_Background->Release(); |
449 pIcons_LOD->_40F9C5(); | 326 pIcons_LOD->SyncLoadedFilesCount(); |
450 pCurrentScreen = pMainScreenNum; | 327 pCurrentScreen = pMainScreenNum; |
451 break; | 328 break; |
452 } | 329 } |
453 case WINDOW_SpellBook: | 330 case WINDOW_SpellBook: |
454 { | 331 { |
463 } | 340 } |
464 case WINDOW_ChangeLocation: | 341 case WINDOW_ChangeLocation: |
465 { | 342 { |
466 pTexture_outside->Release(); | 343 pTexture_outside->Release(); |
467 pTexture_Dialogue_Background->Release(); | 344 pTexture_Dialogue_Background->Release(); |
468 pIcons_LOD->_40F9C5(); | 345 pIcons_LOD->SyncLoadedFilesCount(); |
469 pCurrentScreen = pMainScreenNum; | 346 pCurrentScreen = pMainScreenNum; |
470 break; | 347 break; |
471 } | 348 } |
472 case WINDOW_Dialogue: | 349 case WINDOW_Dialogue: |
473 { | 350 { |
474 if ( !dword_591084 ) | 351 if ( !dword_591084 ) |
475 pDialogueNPCPortraits[0]->Release(); | 352 pDialogueNPCPortraits[0]->Release(); |
476 uNumDialogueNPCPortraits = 0; | 353 uNumDialogueNPCPortraits = 0; |
477 pTexture_Dialogue_Background->Release(); | 354 pTexture_Dialogue_Background->Release(); |
478 | 355 |
479 pIcons_LOD->_40F9C5(); | 356 pIcons_LOD->SyncLoadedFilesCount(); |
480 pCurrentScreen = pMainScreenNum; | 357 pCurrentScreen = pMainScreenNum; |
481 } | 358 } |
482 default: | 359 default: |
483 { | 360 { |
484 break; | 361 break; |
766 pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); | 643 pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); |
767 pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE); | 644 pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE); |
768 } | 645 } |
769 break; | 646 break; |
770 | 647 |
771 case WINDOW_HistoryBook: | 648 case WINDOW_JournalBook: |
772 { | 649 { |
773 pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE); | 650 pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE); |
774 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | 651 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); |
775 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | 652 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); |
776 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | 653 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); |
937 DrawPopupWindow(a2.y, v12, v21, v16); | 814 DrawPopupWindow(a2.y, v12, v21, v16); |
938 v17 = v3->Hint; | 815 v17 = v3->Hint; |
939 if ( v17 ) | 816 if ( v17 ) |
940 { | 817 { |
941 v18 = pFontLucida->CalcTextHeight(v17, &v19, 0, 0); | 818 v18 = pFontLucida->CalcTextHeight(v17, &v19, 0, 0); |
942 v19.DrawTitleText(pFontLucida, 0, (signed int)(v16 - v18) / 2 - 14, 0, v17, 3u); | 819 v19.DrawTitleText(pFontLucida, 0, (signed int)(v16 - v18) / 2 - 14, 0, v17, 3); |
943 } | 820 } |
944 } | 821 } |
945 | 822 |
946 | 823 |
947 | 824 |
1358 // 5C6DB4: using guessed type int ui_current_text_color; | 1235 // 5C6DB4: using guessed type int ui_current_text_color; |
1359 | 1236 |
1360 | 1237 |
1361 | 1238 |
1362 //----- (0044CE08) -------------------------------------------------------- | 1239 //----- (0044CE08) -------------------------------------------------------- |
1363 char GUIWindow::DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor) | 1240 void GUIWindow::DrawText( GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor ) |
1364 { | 1241 { |
1365 GUIWindow *v9; // edi@1 | 1242 GUIWindow *v9; // edi@1 |
1366 GUIFont *v10; // ebx@1 | 1243 GUIFont *v10; // ebx@1 |
1367 int v11; // eax@2 | 1244 int v11; // eax@2 |
1368 signed int v12; // esi@9 | 1245 signed int v12; // esi@9 |
1369 signed int v13; // edi@9 | 1246 signed int v13; // edi@9 |
1393 v10 = a2; | 1270 v10 = a2; |
1394 v31 = a1; | 1271 v31 = a1; |
1395 if ( !Str ) | 1272 if ( !Str ) |
1396 { | 1273 { |
1397 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0); | 1274 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0); |
1398 return v11; | 1275 return; |
1399 } | 1276 } |
1400 v11 = strcmp(Str, "null"); | 1277 v11 = strcmp(Str, "null"); |
1401 if ( v11 ) | 1278 if ( v11 ) |
1402 { | 1279 { |
1403 v30 = strlen(Str); | 1280 v30 = strlen(Str); |
1468 { | 1345 { |
1469 v11 = LOBYTE(v10->uFontHeight); | 1346 v11 = LOBYTE(v10->uFontHeight); |
1470 LABEL_36: | 1347 LABEL_36: |
1471 v11 = v11 + v13 - 3; | 1348 v11 = v11 + v13 - 3; |
1472 if ( v11 > a8 ) | 1349 if ( v11 > a8 ) |
1473 return v11; | 1350 return; |
1474 break; | 1351 break; |
1475 } | 1352 } |
1476 break; | 1353 break; |
1477 default: | 1354 default: |
1478 if ( (char)v11 == 34 && v32[v14 + 1] == 34 ) | 1355 if ( (char)v11 == 34 && v32[v14 + 1] == 34 ) |
1520 } | 1397 } |
1521 while ( (signed int)pInString < (signed int)v30 ); | 1398 while ( (signed int)pInString < (signed int)v30 ); |
1522 } | 1399 } |
1523 } | 1400 } |
1524 } | 1401 } |
1525 return v11; | 1402 return; |
1526 } | 1403 } |
1527 | 1404 |
1528 | 1405 |
1529 //----- (0044CB4F) -------------------------------------------------------- | 1406 //----- (0044CB4F) -------------------------------------------------------- |
1530 int GUIWindow::DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8) | 1407 int GUIWindow::DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8) |