comparison GUIWindow.cpp @ 1018:9ac94d00012e

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